diff --git a/.github/workflows/main-build.yml b/.github/workflows/main-build.yml index b13694950..02825a38a 100644 --- a/.github/workflows/main-build.yml +++ b/.github/workflows/main-build.yml @@ -17,8 +17,8 @@ jobs: # TODO_TECHDEBT: upgrade to the latest Ignite (the latest at the moment of creating a note is 0.28). Need to downgrade to fix CI pipelines. Might be done in scope of #240. run: | # curl https://get.ignite.com/cli! | bash - wget https://github.com/ignite/cli/releases/download/v0.27.2/ignite_0.27.2_linux_amd64.tar.gz - tar -xzf ignite_0.27.2_linux_amd64.tar.gz + wget https://github.com/ignite/cli/releases/download/v28.2.0/ignite_28.2.0_linux_amd64.tar.gz + tar -xzf ignite_28.2.0_linux_amd64.tar.gz sudo mv ignite /usr/local/bin/ignite ignite version @@ -29,7 +29,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: "1.20.10" + go-version: "1.21.6" - name: Install CI dependencies run: make install_ci_deps @@ -103,11 +103,11 @@ jobs: sparse-checkout: | .github - - id: 'auth' - name: 'Authenticate to Google Cloud' - uses: 'google-github-actions/auth@v1' + - id: "auth" + name: "Authenticate to Google Cloud" + uses: "google-github-actions/auth@v1" with: - credentials_json: '${{ secrets.GKE_PROTOCOL_US_CENTRAL }}' + credentials_json: "${{ secrets.GKE_PROTOCOL_US_CENTRAL }}" - uses: google-github-actions/get-gke-credentials@v1 with: diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index b843265b6..ea7f2edd3 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -21,8 +21,8 @@ jobs: # TODO_TECHDEBT: upgrade to the latest Ignite (the latest at the moment of creating a note is 0.28). Need to downgrade to fix CI pipelines. Might be done in scope of #240. run: | # curl https://get.ignite.com/cli! | bash - wget https://github.com/ignite/cli/releases/download/v0.27.2/ignite_0.27.2_linux_amd64.tar.gz - tar -xzf ignite_0.27.2_linux_amd64.tar.gz + wget https://github.com/ignite/cli/releases/download/v28.2.0/ignite_28.2.0_linux_amd64.tar.gz + tar -xzf ignite_28.2.0_linux_amd64.tar.gz sudo mv ignite /usr/local/bin/ignite ignite version @@ -33,7 +33,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: "1.20.10" + go-version: "1.21.6" - name: Install CI dependencies run: make install_ci_deps diff --git a/.gitignore b/.gitignore index 11d396a32..9c6d636a9 100644 --- a/.gitignore +++ b/.gitignore @@ -49,10 +49,6 @@ localnet/*/config/*.json # Frontend utils ts-client/ -# Proto artifacts -**/*.pb.go -**/*.pb.gw.go - # Mock **/*_mock.go diff --git a/.tool-versions b/.tool-versions index 44c16157f..9b7a6107e 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,4 +1,4 @@ # Run `asdf plugin add golang` and `asdf install` to install the dependencies, # and `asdf current` to switch to the versions of dependencies listed below -golang 1.20.10 -go 1.20.10 +golang 1.21.6 +go 1.21.6 diff --git a/Dockerfile.dev b/Dockerfile.dev index be65919a6..585aefa4d 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,12 +1,12 @@ # This Dockerfile is used to build container image for development purposes. # It intentionally contains no security features, ships with code and troubleshooting tools. -FROM golang:1.20 as base +FROM golang:1.21.6 as base RUN apt update && \ apt-get install -y \ - ca-certificates net-tools kubernetes-client \ - curl jq make vim less dnsutils + ca-certificates net-tools kubernetes-client \ + curl jq make vim less dnsutils # enable faster module downloading. ENV GOPROXY https://proxy.golang.org diff --git a/Makefile b/Makefile index 4db767ccb..105a2cefc 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ install_ci_deps: ## Installs `mockgen` and other go tools go install "github.com/golang/mock/mockgen@v1.6.0" && mockgen --version go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest && golangci-lint --version go install golang.org/x/tools/cmd/goimports@latest + go install github.com/mikefarah/yq/v4@latest ######################## ### Makefile Helpers ### @@ -49,8 +50,8 @@ check_go_version: MAJOR_VERSION=$$(echo $$GO_VERSION | cut -d "." -f 1) && \ MINOR_VERSION=$$(echo $$GO_VERSION | cut -d "." -f 2) && \ \ - if [ "$$MAJOR_VERSION" -ne 1 ] || [ "$$MINOR_VERSION" -ge 21 ] || [ "$$MINOR_VERSION" -le 18 ] ; then \ - echo "Invalid Go version. Expected 1.19.x or 1.20.x but found $$GO_VERSION"; \ + if [ "$$MAJOR_VERSION" -ne 1 ] || [ "$$MINOR_VERSION" -le 20 ] ; then \ + echo "Invalid Go version. Expected 1.21.x or newer but found $$GO_VERSION"; \ exit 1; \ fi @@ -140,6 +141,13 @@ proto_regen: ## Delete existing protobuf artifacts and regenerate them find . \( -name "*.pb.go" -o -name "*.pb.gw.go" \) | xargs --no-run-if-empty rm ignite generate proto-go --yes +.PHONY: proto_clean_pulsar +proto_clean_pulsar: ## TODO: explain... + @find ./ -name "*.go" | xargs --no-run-if-empty sed -i -E 's,(^[[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),///\1,' + find ./ -name "*.pulsar.go" | xargs --no-run-if-empty rm + ignite generate proto-go --yes + find ./ -name "*.go" | xargs --no-run-if-empty sed -i -E 's,^///([[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),\1,' + ####################### ### Docker Helpers ### ####################### @@ -163,16 +171,27 @@ localnet_up: ## Starts localnet .PHONY: localnet_down localnet_down: ## Delete resources created by localnet tilt down - kubectl delete secret celestia-secret || exit 1 .PHONY: localnet_regenesis localnet_regenesis: ## Regenerate the localnet genesis file # NOTE: intentionally not using --home flag to avoid overwriting the test keyring - ignite chain init - mkdir -p $(POKTROLLD_HOME)/config/ - cp -r ${HOME}/.poktroll/keyring-test $(POKTROLLD_HOME) - cp ${HOME}/.poktroll/config/*_key.json $(POKTROLLD_HOME)/config/ - cp ${HOME}/.poktroll/config/genesis.json $(POKTROLLD_HOME)/config/ +# NB: Currently the stake => power calculation is constant; however, cosmos-sdk +# intends to make this parameterizable in the future. + @echo "Initializing chain..." + @set -e ;\ + ignite chain init ;\ + mkdir -p $(POKTROLLD_HOME)/config/ ;\ + cp -r ${HOME}/.poktroll/keyring-test $(POKTROLLD_HOME) ;\ + cp ${HOME}/.poktroll/config/*_key.json $(POKTROLLD_HOME)/config/ ;\ + ADDRESS=$$(jq -r '.address' $(POKTROLLD_HOME)/config/priv_validator_key.json) ;\ + PUB_KEY=$$(jq -r '.pub_key' $(POKTROLLD_HOME)/config/priv_validator_key.json) ;\ + POWER=$$(yq ".validators[0].bonded" ./config.yml | sed 's,000000upokt,,') ;\ + NAME=$$(yq ".validators[0].name" ./config.yml) ;\ + echo "Regenerating genesis file with new validator..." ;\ + jq --argjson pubKey "$$PUB_KEY" '.consensus["validators"]=[{"address": "'$$ADDRESS'", "pub_key": $$pubKey, "power": "'$$POWER'", "name": "'$$NAME'"}]' ${HOME}/.poktroll/config/genesis.json > temp.json ;\ + mv temp.json ${HOME}/.poktroll/config/genesis.json ;\ + cp ${HOME}/.poktroll/config/genesis.json $(POKTROLLD_HOME)/config/ ;\ + # TODO_BLOCKER(@okdas): Figure out how to copy these over w/ a functional state. # cp ${HOME}/.poktroll/config/app.toml $(POKTROLLD_HOME)/config/app.toml @@ -224,12 +243,12 @@ itest: check_go_version ## Run tests iteratively (see usage for more) .PHONY: go_mockgen go_mockgen: ## Use `mockgen` to generate mocks used for testing purposes of all the modules. find . -name "*_mock.go" | xargs --no-run-if-empty rm - go generate ./x/application/types/ - go generate ./x/gateway/types/ - go generate ./x/supplier/types/ - go generate ./x/session/types/ + # go generate ./x/application/types/ + # go generate ./x/gateway/types/ + # go generate ./x/supplier/types/ + # go generate ./x/session/types/ go generate ./x/service/types/ - go generate ./x/tokenomics/types/ + # go generate ./x/tokenomics/types/ go generate ./pkg/client/interface.go go generate ./pkg/miner/interface.go go generate ./pkg/relayer/interface.go @@ -250,7 +269,7 @@ go_develop: proto_regen go_mockgen ## Generate protos and mocks go_develop_and_test: go_develop go_test ## Generate protos, mocks and run all tests .PHONY: load_test_simple -load_test_simple: ## Runs the simpliest load test through the whole stack (appgate -> relayminer -> anvil) +load_test_simple: ## Runs the simplest load test through the whole stack (appgate -> relayminer -> anvil) k6 run load-testing/tests/appGateServerEtherium.js ############# @@ -644,4 +663,4 @@ act_list: check_act ## List all github actions that can be executed locally with act_reviewdog: check_act check_gh ## Run the reviewdog workflow locally like so: `GITHUB_TOKEN=$(gh auth token) make act_reviewdog` $(eval CONTAINER_ARCH := $(shell make -s detect_arch)) @echo "Detected architecture: $(CONTAINER_ARCH)" - act -v -s GITHUB_TOKEN=$(GITHUB_TOKEN) -W .github/workflows/reviewdog.yml --container-architecture $(CONTAINER_ARCH) \ No newline at end of file + act -v -s GITHUB_TOKEN=$(GITHUB_TOKEN) -W .github/workflows/reviewdog.yml --container-architecture $(CONTAINER_ARCH) diff --git a/Tiltfile b/Tiltfile index 6102c2222..69f40ad31 100644 --- a/Tiltfile +++ b/Tiltfile @@ -97,7 +97,7 @@ local_resource( docker_build_with_restart( "poktrolld", ".", - dockerfile_contents="""FROM golang:1.20.8 + dockerfile_contents="""FROM golang:1.21.6 RUN apt-get -q update && apt-get install -qyy curl jq less RUN go install github.com/go-delve/delve/cmd/dlv@latest COPY bin/poktrolld /usr/local/bin/poktrolld diff --git a/api/poktroll/service/genesis.pulsar.go b/api/poktroll/service/genesis.pulsar.go new file mode 100644 index 000000000..576428f97 --- /dev/null +++ b/api/poktroll/service/genesis.pulsar.go @@ -0,0 +1,750 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package service + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + shared "github.com/pokt-network/poktroll/api/poktroll/shared" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var _ protoreflect.List = (*_GenesisState_2_list)(nil) + +type _GenesisState_2_list struct { + list *[]*shared.Service +} + +func (x *_GenesisState_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_GenesisState_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_GenesisState_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*shared.Service) + (*x.list)[i] = concreteValue +} + +func (x *_GenesisState_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*shared.Service) + *x.list = append(*x.list, concreteValue) +} + +func (x *_GenesisState_2_list) AppendMutable() protoreflect.Value { + v := new(shared.Service) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_GenesisState_2_list) NewElement() protoreflect.Value { + v := new(shared.Service) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_2_list) IsValid() bool { + return x.list != nil +} + +var ( + md_GenesisState protoreflect.MessageDescriptor + fd_GenesisState_params protoreflect.FieldDescriptor + fd_GenesisState_service_list protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_genesis_proto_init() + md_GenesisState = File_poktroll_service_genesis_proto.Messages().ByName("GenesisState") + fd_GenesisState_params = md_GenesisState.Fields().ByName("params") + fd_GenesisState_service_list = md_GenesisState.Fields().ByName("service_list") +} + +var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) + +type fastReflection_GenesisState GenesisState + +func (x *GenesisState) ProtoReflect() protoreflect.Message { + return (*fastReflection_GenesisState)(x) +} + +func (x *GenesisState) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_genesis_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_GenesisState_messageType fastReflection_GenesisState_messageType +var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{} + +type fastReflection_GenesisState_messageType struct{} + +func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message { + return (*fastReflection_GenesisState)(nil) +} +func (x fastReflection_GenesisState_messageType) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} +func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_GenesisState) Type() protoreflect.MessageType { + return _fastReflection_GenesisState_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_GenesisState) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage { + return (*GenesisState)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_GenesisState_params, value) { + return + } + } + if len(x.ServiceList) != 0 { + value := protoreflect.ValueOfList(&_GenesisState_2_list{list: &x.ServiceList}) + if !f(fd_GenesisState_service_list, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.GenesisState.params": + return x.Params != nil + case "poktroll.service.GenesisState.service_list": + return len(x.ServiceList) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.GenesisState")) + } + panic(fmt.Errorf("message poktroll.service.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.GenesisState.params": + x.Params = nil + case "poktroll.service.GenesisState.service_list": + x.ServiceList = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.GenesisState")) + } + panic(fmt.Errorf("message poktroll.service.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.GenesisState.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.service.GenesisState.service_list": + if len(x.ServiceList) == 0 { + return protoreflect.ValueOfList(&_GenesisState_2_list{}) + } + listValue := &_GenesisState_2_list{list: &x.ServiceList} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.GenesisState")) + } + panic(fmt.Errorf("message poktroll.service.GenesisState does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.GenesisState.params": + x.Params = value.Message().Interface().(*Params) + case "poktroll.service.GenesisState.service_list": + lv := value.List() + clv := lv.(*_GenesisState_2_list) + x.ServiceList = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.GenesisState")) + } + panic(fmt.Errorf("message poktroll.service.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.GenesisState.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "poktroll.service.GenesisState.service_list": + if x.ServiceList == nil { + x.ServiceList = []*shared.Service{} + } + value := &_GenesisState_2_list{list: &x.ServiceList} + return protoreflect.ValueOfList(value) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.GenesisState")) + } + panic(fmt.Errorf("message poktroll.service.GenesisState does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.GenesisState.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.service.GenesisState.service_list": + list := []*shared.Service{} + return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.GenesisState")) + } + panic(fmt.Errorf("message poktroll.service.GenesisState does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.GenesisState", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_GenesisState) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_GenesisState) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.ServiceList) > 0 { + for _, e := range x.ServiceList { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.ServiceList) > 0 { + for iNdEx := len(x.ServiceList) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.ServiceList[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ServiceList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ServiceList = append(x.ServiceList, &shared.Service{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ServiceList[len(x.ServiceList)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/service/genesis.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// GenesisState defines the service module's genesis state. +type GenesisState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params defines all the parameters of the module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + ServiceList []*shared.Service `protobuf:"bytes,2,rep,name=service_list,json=serviceList,proto3" json:"service_list,omitempty"` +} + +func (x *GenesisState) Reset() { + *x = GenesisState{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_genesis_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenesisState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenesisState) ProtoMessage() {} + +// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead. +func (*GenesisState) Descriptor() ([]byte, []int) { + return file_poktroll_service_genesis_proto_rawDescGZIP(), []int{0} +} + +func (x *GenesisState) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +func (x *GenesisState) GetServiceList() []*shared.Service { + if x != nil { + return x.ServiceList + } + return nil +} + +var File_poktroll_service_genesis_proto protoreflect.FileDescriptor + +var file_poktroll_service_genesis_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x10, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8e, 0x01, 0x0a, 0x0c, 0x47, 0x65, + 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x41, 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0b, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x42, 0xa8, 0x01, 0x0a, 0x14, 0x63, + 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, + 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xca, + 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_service_genesis_proto_rawDescOnce sync.Once + file_poktroll_service_genesis_proto_rawDescData = file_poktroll_service_genesis_proto_rawDesc +) + +func file_poktroll_service_genesis_proto_rawDescGZIP() []byte { + file_poktroll_service_genesis_proto_rawDescOnce.Do(func() { + file_poktroll_service_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_service_genesis_proto_rawDescData) + }) + return file_poktroll_service_genesis_proto_rawDescData +} + +var file_poktroll_service_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_service_genesis_proto_goTypes = []interface{}{ + (*GenesisState)(nil), // 0: poktroll.service.GenesisState + (*Params)(nil), // 1: poktroll.service.Params + (*shared.Service)(nil), // 2: poktroll.shared.Service +} +var file_poktroll_service_genesis_proto_depIdxs = []int32{ + 1, // 0: poktroll.service.GenesisState.params:type_name -> poktroll.service.Params + 2, // 1: poktroll.service.GenesisState.service_list:type_name -> poktroll.shared.Service + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_poktroll_service_genesis_proto_init() } +func file_poktroll_service_genesis_proto_init() { + if File_poktroll_service_genesis_proto != nil { + return + } + file_poktroll_service_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_service_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenesisState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_service_genesis_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_service_genesis_proto_goTypes, + DependencyIndexes: file_poktroll_service_genesis_proto_depIdxs, + MessageInfos: file_poktroll_service_genesis_proto_msgTypes, + }.Build() + File_poktroll_service_genesis_proto = out.File + file_poktroll_service_genesis_proto_rawDesc = nil + file_poktroll_service_genesis_proto_goTypes = nil + file_poktroll_service_genesis_proto_depIdxs = nil +} diff --git a/api/poktroll/service/module/module.pulsar.go b/api/poktroll/service/module/module.pulsar.go new file mode 100644 index 000000000..a7217c244 --- /dev/null +++ b/api/poktroll/service/module/module.pulsar.go @@ -0,0 +1,578 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package module + +import ( + _ "cosmossdk.io/api/cosmos/app/v1alpha1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Module protoreflect.MessageDescriptor + fd_Module_authority protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_module_module_proto_init() + md_Module = File_poktroll_service_module_module_proto.Messages().ByName("Module") + fd_Module_authority = md_Module.Fields().ByName("authority") +} + +var _ protoreflect.Message = (*fastReflection_Module)(nil) + +type fastReflection_Module Module + +func (x *Module) ProtoReflect() protoreflect.Message { + return (*fastReflection_Module)(x) +} + +func (x *Module) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_module_module_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Module_messageType fastReflection_Module_messageType +var _ protoreflect.MessageType = fastReflection_Module_messageType{} + +type fastReflection_Module_messageType struct{} + +func (x fastReflection_Module_messageType) Zero() protoreflect.Message { + return (*fastReflection_Module)(nil) +} +func (x fastReflection_Module_messageType) New() protoreflect.Message { + return new(fastReflection_Module) +} +func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Module) Type() protoreflect.MessageType { + return _fastReflection_Module_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Module) New() protoreflect.Message { + return new(fastReflection_Module) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage { + return (*Module)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_Module_authority, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.module.Module.authority": + return x.Authority != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.module.Module")) + } + panic(fmt.Errorf("message poktroll.service.module.Module does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.module.Module.authority": + x.Authority = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.module.Module")) + } + panic(fmt.Errorf("message poktroll.service.module.Module does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.module.Module.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.module.Module")) + } + panic(fmt.Errorf("message poktroll.service.module.Module does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.module.Module.authority": + x.Authority = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.module.Module")) + } + panic(fmt.Errorf("message poktroll.service.module.Module does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.module.Module.authority": + panic(fmt.Errorf("field authority of message poktroll.service.module.Module is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.module.Module")) + } + panic(fmt.Errorf("message poktroll.service.module.Module does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.module.Module.authority": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.module.Module")) + } + panic(fmt.Errorf("message poktroll.service.module.Module does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.module.Module", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Module) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Module) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/service/module/module.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Module is the config object for the module. +type Module struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority defines the custom module authority. If not set, defaults to the governance module. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (x *Module) Reset() { + *x = Module{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_module_module_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Module) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Module) ProtoMessage() {} + +// Deprecated: Use Module.ProtoReflect.Descriptor instead. +func (*Module) Descriptor() ([]byte, []int) { + return file_poktroll_service_module_module_proto_rawDescGZIP(), []int{0} +} + +func (x *Module) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +var File_poktroll_service_module_module_proto protoreflect.FileDescriptor + +var file_poktroll_service_module_module_proto_rawDesc = []byte{ + 0x0a, 0x24, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x17, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x1a, + 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x5a, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x32, 0xba, 0xc0, 0x96, 0xda, 0x01, + 0x2c, 0x0a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6f, + 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0xd2, 0x01, + 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x0b, 0x4d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, + 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x4d, 0xaa, 0x02, 0x17, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xca, 0x02, 0x17, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0xe2, 0x02, 0x23, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x3a, 0x3a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_service_module_module_proto_rawDescOnce sync.Once + file_poktroll_service_module_module_proto_rawDescData = file_poktroll_service_module_module_proto_rawDesc +) + +func file_poktroll_service_module_module_proto_rawDescGZIP() []byte { + file_poktroll_service_module_module_proto_rawDescOnce.Do(func() { + file_poktroll_service_module_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_service_module_module_proto_rawDescData) + }) + return file_poktroll_service_module_module_proto_rawDescData +} + +var file_poktroll_service_module_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_service_module_module_proto_goTypes = []interface{}{ + (*Module)(nil), // 0: poktroll.service.module.Module +} +var file_poktroll_service_module_module_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_service_module_module_proto_init() } +func file_poktroll_service_module_module_proto_init() { + if File_poktroll_service_module_module_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_service_module_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Module); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_service_module_module_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_service_module_module_proto_goTypes, + DependencyIndexes: file_poktroll_service_module_module_proto_depIdxs, + MessageInfos: file_poktroll_service_module_module_proto_msgTypes, + }.Build() + File_poktroll_service_module_module_proto = out.File + file_poktroll_service_module_module_proto_rawDesc = nil + file_poktroll_service_module_module_proto_goTypes = nil + file_poktroll_service_module_module_proto_depIdxs = nil +} diff --git a/api/poktroll/service/params.pulsar.go b/api/poktroll/service/params.pulsar.go new file mode 100644 index 000000000..346acdd52 --- /dev/null +++ b/api/poktroll/service/params.pulsar.go @@ -0,0 +1,563 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package service + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Params protoreflect.MessageDescriptor + fd_Params_add_service_fee protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_params_proto_init() + md_Params = File_poktroll_service_params_proto.Messages().ByName("Params") + fd_Params_add_service_fee = md_Params.Fields().ByName("add_service_fee") +} + +var _ protoreflect.Message = (*fastReflection_Params)(nil) + +type fastReflection_Params Params + +func (x *Params) ProtoReflect() protoreflect.Message { + return (*fastReflection_Params)(x) +} + +func (x *Params) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_params_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Params_messageType fastReflection_Params_messageType +var _ protoreflect.MessageType = fastReflection_Params_messageType{} + +type fastReflection_Params_messageType struct{} + +func (x fastReflection_Params_messageType) Zero() protoreflect.Message { + return (*fastReflection_Params)(nil) +} +func (x fastReflection_Params_messageType) New() protoreflect.Message { + return new(fastReflection_Params) +} +func (x fastReflection_Params_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Params) Type() protoreflect.MessageType { + return _fastReflection_Params_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Params) New() protoreflect.Message { + return new(fastReflection_Params) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { + return (*Params)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.AddServiceFee != uint64(0) { + value := protoreflect.ValueOfUint64(x.AddServiceFee) + if !f(fd_Params_add_service_fee, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.Params.add_service_fee": + return x.AddServiceFee != uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) + } + panic(fmt.Errorf("message poktroll.service.Params does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.Params.add_service_fee": + x.AddServiceFee = uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) + } + panic(fmt.Errorf("message poktroll.service.Params does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.Params.add_service_fee": + value := x.AddServiceFee + return protoreflect.ValueOfUint64(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) + } + panic(fmt.Errorf("message poktroll.service.Params does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.Params.add_service_fee": + x.AddServiceFee = value.Uint() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) + } + panic(fmt.Errorf("message poktroll.service.Params does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.Params.add_service_fee": + panic(fmt.Errorf("field add_service_fee of message poktroll.service.Params is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) + } + panic(fmt.Errorf("message poktroll.service.Params does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.Params.add_service_fee": + return protoreflect.ValueOfUint64(uint64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) + } + panic(fmt.Errorf("message poktroll.service.Params does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Params) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.Params", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Params) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Params) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.AddServiceFee != 0 { + n += 1 + runtime.Sov(uint64(x.AddServiceFee)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.AddServiceFee != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.AddServiceFee)) + i-- + dAtA[i] = 0x8 + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AddServiceFee", wireType) + } + x.AddServiceFee = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.AddServiceFee |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/service/params.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Params defines the parameters for the module. +type Params struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The amount of uPOKT required to add a new service. + // This will be deducted from the signer's account balance, + // and transferred to the pocket network foundation. + AddServiceFee uint64 `protobuf:"varint,1,opt,name=add_service_fee,json=addServiceFee,proto3" json:"add_service_fee,omitempty"` +} + +func (x *Params) Reset() { + *x = Params{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_params_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Params) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Params) ProtoMessage() {} + +// Deprecated: Use Params.ProtoReflect.Descriptor instead. +func (*Params) Descriptor() ([]byte, []int) { + return file_poktroll_service_params_proto_rawDescGZIP(), []int{0} +} + +func (x *Params) GetAddServiceFee() uint64 { + if x != nil { + return x.AddServiceFee + } + return 0 +} + +var File_poktroll_service_params_proto protoreflect.FileDescriptor + +var file_poktroll_service_params_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x10, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x70, 0x0a, 0x06, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x12, 0x42, 0x0a, 0x0f, 0x61, 0x64, 0x64, 0x5f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x1a, 0xf2, + 0xde, 0x1f, 0x16, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x61, 0x64, 0x64, 0x5f, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x5f, 0x66, 0x65, 0x65, 0x22, 0x52, 0x0d, 0x61, 0x64, 0x64, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x46, 0x65, 0x65, 0x3a, 0x22, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, + 0xb0, 0x2a, 0x19, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xa7, 0x01, 0x0a, + 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, + 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_service_params_proto_rawDescOnce sync.Once + file_poktroll_service_params_proto_rawDescData = file_poktroll_service_params_proto_rawDesc +) + +func file_poktroll_service_params_proto_rawDescGZIP() []byte { + file_poktroll_service_params_proto_rawDescOnce.Do(func() { + file_poktroll_service_params_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_service_params_proto_rawDescData) + }) + return file_poktroll_service_params_proto_rawDescData +} + +var file_poktroll_service_params_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_service_params_proto_goTypes = []interface{}{ + (*Params)(nil), // 0: poktroll.service.Params +} +var file_poktroll_service_params_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_service_params_proto_init() } +func file_poktroll_service_params_proto_init() { + if File_poktroll_service_params_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_service_params_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Params); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_service_params_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_service_params_proto_goTypes, + DependencyIndexes: file_poktroll_service_params_proto_depIdxs, + MessageInfos: file_poktroll_service_params_proto_msgTypes, + }.Build() + File_poktroll_service_params_proto = out.File + file_poktroll_service_params_proto_rawDesc = nil + file_poktroll_service_params_proto_goTypes = nil + file_poktroll_service_params_proto_depIdxs = nil +} diff --git a/api/poktroll/service/query.pulsar.go b/api/poktroll/service/query.pulsar.go new file mode 100644 index 000000000..2f313aef1 --- /dev/null +++ b/api/poktroll/service/query.pulsar.go @@ -0,0 +1,3131 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package service + +import ( + _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/query/v1beta1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + shared "github.com/pokt-network/poktroll/api/poktroll/shared" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_QueryParamsRequest protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_service_query_proto_init() + md_QueryParamsRequest = File_poktroll_service_query_proto.Messages().ByName("QueryParamsRequest") +} + +var _ protoreflect.Message = (*fastReflection_QueryParamsRequest)(nil) + +type fastReflection_QueryParamsRequest QueryParamsRequest + +func (x *QueryParamsRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryParamsRequest)(x) +} + +func (x *QueryParamsRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_query_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryParamsRequest_messageType fastReflection_QueryParamsRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryParamsRequest_messageType{} + +type fastReflection_QueryParamsRequest_messageType struct{} + +func (x fastReflection_QueryParamsRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryParamsRequest)(nil) +} +func (x fastReflection_QueryParamsRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryParamsRequest) +} +func (x fastReflection_QueryParamsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryParamsRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryParamsRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryParamsRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryParamsRequest) New() protoreflect.Message { + return new(fastReflection_QueryParamsRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryParamsRequest) Interface() protoreflect.ProtoMessage { + return (*QueryParamsRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryParamsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryParamsRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryParamsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryParamsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryParamsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.QueryParamsRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryParamsRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryParamsRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryParamsRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryParamsResponse protoreflect.MessageDescriptor + fd_QueryParamsResponse_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_query_proto_init() + md_QueryParamsResponse = File_poktroll_service_query_proto.Messages().ByName("QueryParamsResponse") + fd_QueryParamsResponse_params = md_QueryParamsResponse.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_QueryParamsResponse)(nil) + +type fastReflection_QueryParamsResponse QueryParamsResponse + +func (x *QueryParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryParamsResponse)(x) +} + +func (x *QueryParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_query_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryParamsResponse_messageType fastReflection_QueryParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryParamsResponse_messageType{} + +type fastReflection_QueryParamsResponse_messageType struct{} + +func (x fastReflection_QueryParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryParamsResponse)(nil) +} +func (x fastReflection_QueryParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryParamsResponse) +} +func (x fastReflection_QueryParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryParamsResponse) New() protoreflect.Message { + return new(fastReflection_QueryParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryParamsResponse) Interface() protoreflect.ProtoMessage { + return (*QueryParamsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_QueryParamsResponse_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.QueryParamsResponse.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.QueryParamsResponse.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.QueryParamsResponse.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.QueryParamsResponse.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryParamsResponse.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryParamsResponse.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.QueryParamsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryParamsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryParamsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryGetServiceRequest protoreflect.MessageDescriptor + fd_QueryGetServiceRequest_id protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_query_proto_init() + md_QueryGetServiceRequest = File_poktroll_service_query_proto.Messages().ByName("QueryGetServiceRequest") + fd_QueryGetServiceRequest_id = md_QueryGetServiceRequest.Fields().ByName("id") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetServiceRequest)(nil) + +type fastReflection_QueryGetServiceRequest QueryGetServiceRequest + +func (x *QueryGetServiceRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetServiceRequest)(x) +} + +func (x *QueryGetServiceRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_query_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryGetServiceRequest_messageType fastReflection_QueryGetServiceRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetServiceRequest_messageType{} + +type fastReflection_QueryGetServiceRequest_messageType struct{} + +func (x fastReflection_QueryGetServiceRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetServiceRequest)(nil) +} +func (x fastReflection_QueryGetServiceRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetServiceRequest) +} +func (x fastReflection_QueryGetServiceRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetServiceRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetServiceRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetServiceRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryGetServiceRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryGetServiceRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetServiceRequest) New() protoreflect.Message { + return new(fastReflection_QueryGetServiceRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetServiceRequest) Interface() protoreflect.ProtoMessage { + return (*QueryGetServiceRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryGetServiceRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Id != "" { + value := protoreflect.ValueOfString(x.Id) + if !f(fd_QueryGetServiceRequest_id, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryGetServiceRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.QueryGetServiceRequest.id": + return x.Id != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetServiceRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.QueryGetServiceRequest.id": + x.Id = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryGetServiceRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.QueryGetServiceRequest.id": + value := x.Id + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetServiceRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.QueryGetServiceRequest.id": + x.Id = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetServiceRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryGetServiceRequest.id": + panic(fmt.Errorf("field id of message poktroll.service.QueryGetServiceRequest is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryGetServiceRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryGetServiceRequest.id": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryGetServiceRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.QueryGetServiceRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryGetServiceRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetServiceRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryGetServiceRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryGetServiceRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetServiceRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Id) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryGetServiceRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Id) > 0 { + i -= len(x.Id) + copy(dAtA[i:], x.Id) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Id))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryGetServiceRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetServiceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetServiceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryGetServiceResponse protoreflect.MessageDescriptor + fd_QueryGetServiceResponse_service protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_query_proto_init() + md_QueryGetServiceResponse = File_poktroll_service_query_proto.Messages().ByName("QueryGetServiceResponse") + fd_QueryGetServiceResponse_service = md_QueryGetServiceResponse.Fields().ByName("service") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetServiceResponse)(nil) + +type fastReflection_QueryGetServiceResponse QueryGetServiceResponse + +func (x *QueryGetServiceResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetServiceResponse)(x) +} + +func (x *QueryGetServiceResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_query_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryGetServiceResponse_messageType fastReflection_QueryGetServiceResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetServiceResponse_messageType{} + +type fastReflection_QueryGetServiceResponse_messageType struct{} + +func (x fastReflection_QueryGetServiceResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetServiceResponse)(nil) +} +func (x fastReflection_QueryGetServiceResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetServiceResponse) +} +func (x fastReflection_QueryGetServiceResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetServiceResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetServiceResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetServiceResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryGetServiceResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryGetServiceResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetServiceResponse) New() protoreflect.Message { + return new(fastReflection_QueryGetServiceResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetServiceResponse) Interface() protoreflect.ProtoMessage { + return (*QueryGetServiceResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryGetServiceResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Service != nil { + value := protoreflect.ValueOfMessage(x.Service.ProtoReflect()) + if !f(fd_QueryGetServiceResponse_service, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryGetServiceResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.QueryGetServiceResponse.service": + return x.Service != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetServiceResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.QueryGetServiceResponse.service": + x.Service = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryGetServiceResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.QueryGetServiceResponse.service": + value := x.Service + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetServiceResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.QueryGetServiceResponse.service": + x.Service = value.Message().Interface().(*shared.Service) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetServiceResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryGetServiceResponse.service": + if x.Service == nil { + x.Service = new(shared.Service) + } + return protoreflect.ValueOfMessage(x.Service.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryGetServiceResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryGetServiceResponse.service": + m := new(shared.Service) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryGetServiceResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.QueryGetServiceResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryGetServiceResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetServiceResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryGetServiceResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryGetServiceResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetServiceResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Service != nil { + l = options.Size(x.Service) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryGetServiceResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Service != nil { + encoded, err := options.Marshal(x.Service) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryGetServiceResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetServiceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetServiceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Service", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Service == nil { + x.Service = &shared.Service{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Service); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryAllServicesRequest protoreflect.MessageDescriptor + fd_QueryAllServicesRequest_pagination protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_query_proto_init() + md_QueryAllServicesRequest = File_poktroll_service_query_proto.Messages().ByName("QueryAllServicesRequest") + fd_QueryAllServicesRequest_pagination = md_QueryAllServicesRequest.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryAllServicesRequest)(nil) + +type fastReflection_QueryAllServicesRequest QueryAllServicesRequest + +func (x *QueryAllServicesRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllServicesRequest)(x) +} + +func (x *QueryAllServicesRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_query_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryAllServicesRequest_messageType fastReflection_QueryAllServicesRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllServicesRequest_messageType{} + +type fastReflection_QueryAllServicesRequest_messageType struct{} + +func (x fastReflection_QueryAllServicesRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllServicesRequest)(nil) +} +func (x fastReflection_QueryAllServicesRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllServicesRequest) +} +func (x fastReflection_QueryAllServicesRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllServicesRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAllServicesRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllServicesRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryAllServicesRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryAllServicesRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAllServicesRequest) New() protoreflect.Message { + return new(fastReflection_QueryAllServicesRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAllServicesRequest) Interface() protoreflect.ProtoMessage { + return (*QueryAllServicesRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryAllServicesRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryAllServicesRequest_pagination, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryAllServicesRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.QueryAllServicesRequest.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServicesRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllServicesRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.QueryAllServicesRequest.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServicesRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryAllServicesRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.QueryAllServicesRequest.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServicesRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllServicesRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.QueryAllServicesRequest.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageRequest) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServicesRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllServicesRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryAllServicesRequest.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageRequest) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServicesRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryAllServicesRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryAllServicesRequest.pagination": + m := new(v1beta1.PageRequest) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServicesRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryAllServicesRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.QueryAllServicesRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryAllServicesRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllServicesRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryAllServicesRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryAllServicesRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAllServicesRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Pagination != nil { + l = options.Size(x.Pagination) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryAllServicesRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryAllServicesRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllServicesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllServicesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Pagination == nil { + x.Pagination = &v1beta1.PageRequest{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_QueryAllServicesResponse_1_list)(nil) + +type _QueryAllServicesResponse_1_list struct { + list *[]*shared.Service +} + +func (x *_QueryAllServicesResponse_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_QueryAllServicesResponse_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_QueryAllServicesResponse_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*shared.Service) + (*x.list)[i] = concreteValue +} + +func (x *_QueryAllServicesResponse_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*shared.Service) + *x.list = append(*x.list, concreteValue) +} + +func (x *_QueryAllServicesResponse_1_list) AppendMutable() protoreflect.Value { + v := new(shared.Service) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryAllServicesResponse_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_QueryAllServicesResponse_1_list) NewElement() protoreflect.Value { + v := new(shared.Service) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryAllServicesResponse_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_QueryAllServicesResponse protoreflect.MessageDescriptor + fd_QueryAllServicesResponse_service protoreflect.FieldDescriptor + fd_QueryAllServicesResponse_pagination protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_query_proto_init() + md_QueryAllServicesResponse = File_poktroll_service_query_proto.Messages().ByName("QueryAllServicesResponse") + fd_QueryAllServicesResponse_service = md_QueryAllServicesResponse.Fields().ByName("service") + fd_QueryAllServicesResponse_pagination = md_QueryAllServicesResponse.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryAllServicesResponse)(nil) + +type fastReflection_QueryAllServicesResponse QueryAllServicesResponse + +func (x *QueryAllServicesResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllServicesResponse)(x) +} + +func (x *QueryAllServicesResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_query_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryAllServicesResponse_messageType fastReflection_QueryAllServicesResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllServicesResponse_messageType{} + +type fastReflection_QueryAllServicesResponse_messageType struct{} + +func (x fastReflection_QueryAllServicesResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllServicesResponse)(nil) +} +func (x fastReflection_QueryAllServicesResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllServicesResponse) +} +func (x fastReflection_QueryAllServicesResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllServicesResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAllServicesResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllServicesResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryAllServicesResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryAllServicesResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAllServicesResponse) New() protoreflect.Message { + return new(fastReflection_QueryAllServicesResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAllServicesResponse) Interface() protoreflect.ProtoMessage { + return (*QueryAllServicesResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryAllServicesResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Service) != 0 { + value := protoreflect.ValueOfList(&_QueryAllServicesResponse_1_list{list: &x.Service}) + if !f(fd_QueryAllServicesResponse_service, value) { + return + } + } + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryAllServicesResponse_pagination, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryAllServicesResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.QueryAllServicesResponse.service": + return len(x.Service) != 0 + case "poktroll.service.QueryAllServicesResponse.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServicesResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllServicesResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.QueryAllServicesResponse.service": + x.Service = nil + case "poktroll.service.QueryAllServicesResponse.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServicesResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryAllServicesResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.QueryAllServicesResponse.service": + if len(x.Service) == 0 { + return protoreflect.ValueOfList(&_QueryAllServicesResponse_1_list{}) + } + listValue := &_QueryAllServicesResponse_1_list{list: &x.Service} + return protoreflect.ValueOfList(listValue) + case "poktroll.service.QueryAllServicesResponse.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServicesResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllServicesResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.QueryAllServicesResponse.service": + lv := value.List() + clv := lv.(*_QueryAllServicesResponse_1_list) + x.Service = *clv.list + case "poktroll.service.QueryAllServicesResponse.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageResponse) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServicesResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllServicesResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryAllServicesResponse.service": + if x.Service == nil { + x.Service = []*shared.Service{} + } + value := &_QueryAllServicesResponse_1_list{list: &x.Service} + return protoreflect.ValueOfList(value) + case "poktroll.service.QueryAllServicesResponse.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageResponse) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServicesResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryAllServicesResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryAllServicesResponse.service": + list := []*shared.Service{} + return protoreflect.ValueOfList(&_QueryAllServicesResponse_1_list{list: &list}) + case "poktroll.service.QueryAllServicesResponse.pagination": + m := new(v1beta1.PageResponse) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServicesResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryAllServicesResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.QueryAllServicesResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryAllServicesResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllServicesResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryAllServicesResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryAllServicesResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAllServicesResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.Service) > 0 { + for _, e := range x.Service { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.Pagination != nil { + l = options.Size(x.Pagination) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryAllServicesResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Service) > 0 { + for iNdEx := len(x.Service) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Service[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryAllServicesResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllServicesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllServicesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Service", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Service = append(x.Service, &shared.Service{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Service[len(x.Service)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Pagination == nil { + x.Pagination = &v1beta1.PageResponse{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/service/query.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *QueryParamsRequest) Reset() { + *x = QueryParamsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_query_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryParamsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryParamsRequest) ProtoMessage() {} + +// Deprecated: Use QueryParamsRequest.ProtoReflect.Descriptor instead. +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return file_poktroll_service_query_proto_rawDescGZIP(), []int{0} +} + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params holds all the parameters of this module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *QueryParamsResponse) Reset() { + *x = QueryParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_query_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryParamsResponse) ProtoMessage() {} + +// Deprecated: Use QueryParamsResponse.ProtoReflect.Descriptor instead. +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_service_query_proto_rawDescGZIP(), []int{1} +} + +func (x *QueryParamsResponse) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +type QueryGetServiceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // TODO: We could support getting services by name. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *QueryGetServiceRequest) Reset() { + *x = QueryGetServiceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_query_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetServiceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetServiceRequest) ProtoMessage() {} + +// Deprecated: Use QueryGetServiceRequest.ProtoReflect.Descriptor instead. +func (*QueryGetServiceRequest) Descriptor() ([]byte, []int) { + return file_poktroll_service_query_proto_rawDescGZIP(), []int{2} +} + +func (x *QueryGetServiceRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type QueryGetServiceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Service *shared.Service `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` +} + +func (x *QueryGetServiceResponse) Reset() { + *x = QueryGetServiceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_query_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetServiceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetServiceResponse) ProtoMessage() {} + +// Deprecated: Use QueryGetServiceResponse.ProtoReflect.Descriptor instead. +func (*QueryGetServiceResponse) Descriptor() ([]byte, []int) { + return file_poktroll_service_query_proto_rawDescGZIP(), []int{3} +} + +func (x *QueryGetServiceResponse) GetService() *shared.Service { + if x != nil { + return x.Service + } + return nil +} + +type QueryAllServicesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pagination *v1beta1.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryAllServicesRequest) Reset() { + *x = QueryAllServicesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_query_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAllServicesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAllServicesRequest) ProtoMessage() {} + +// Deprecated: Use QueryAllServicesRequest.ProtoReflect.Descriptor instead. +func (*QueryAllServicesRequest) Descriptor() ([]byte, []int) { + return file_poktroll_service_query_proto_rawDescGZIP(), []int{4} +} + +func (x *QueryAllServicesRequest) GetPagination() *v1beta1.PageRequest { + if x != nil { + return x.Pagination + } + return nil +} + +type QueryAllServicesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Service []*shared.Service `protobuf:"bytes,1,rep,name=service,proto3" json:"service,omitempty"` + Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryAllServicesResponse) Reset() { + *x = QueryAllServicesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_query_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAllServicesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAllServicesResponse) ProtoMessage() {} + +// Deprecated: Use QueryAllServicesResponse.ProtoReflect.Descriptor instead. +func (*QueryAllServicesResponse) Descriptor() ([]byte, []int) { + return file_poktroll_service_query_proto_rawDescGZIP(), []int{5} +} + +func (x *QueryAllServicesResponse) GetService() []*shared.Service { + if x != nil { + return x.Service + } + return nil +} + +func (x *QueryAllServicesResponse) GetPagination() *v1beta1.PageResponse { + if x != nil { + return x.Pagination + } + return nil +} + +var File_poktroll_service_query_proto protoreflect.FileDescriptor + +var file_poktroll_service_query_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, + 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, + 0x62, 0x61, 0x73, 0x65, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, + 0x72, 0x65, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x52, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, + 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, + 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x28, 0x0a, 0x16, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x53, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, + 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, + 0x72, 0x65, 0x64, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, + 0x00, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0x61, 0x0a, 0x17, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x9d, 0x01, + 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xbb, 0x03, + 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x84, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x93, + 0x01, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x33, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2d, 0x12, 0x2b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, + 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x94, 0x01, 0x0a, 0x0b, 0x41, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x73, 0x12, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x28, 0x12, 0x26, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, + 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0xa6, 0x01, 0x0a, 0x14, + 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xca, 0x02, + 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_service_query_proto_rawDescOnce sync.Once + file_poktroll_service_query_proto_rawDescData = file_poktroll_service_query_proto_rawDesc +) + +func file_poktroll_service_query_proto_rawDescGZIP() []byte { + file_poktroll_service_query_proto_rawDescOnce.Do(func() { + file_poktroll_service_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_service_query_proto_rawDescData) + }) + return file_poktroll_service_query_proto_rawDescData +} + +var file_poktroll_service_query_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_poktroll_service_query_proto_goTypes = []interface{}{ + (*QueryParamsRequest)(nil), // 0: poktroll.service.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: poktroll.service.QueryParamsResponse + (*QueryGetServiceRequest)(nil), // 2: poktroll.service.QueryGetServiceRequest + (*QueryGetServiceResponse)(nil), // 3: poktroll.service.QueryGetServiceResponse + (*QueryAllServicesRequest)(nil), // 4: poktroll.service.QueryAllServicesRequest + (*QueryAllServicesResponse)(nil), // 5: poktroll.service.QueryAllServicesResponse + (*Params)(nil), // 6: poktroll.service.Params + (*shared.Service)(nil), // 7: poktroll.shared.Service + (*v1beta1.PageRequest)(nil), // 8: cosmos.base.query.v1beta1.PageRequest + (*v1beta1.PageResponse)(nil), // 9: cosmos.base.query.v1beta1.PageResponse +} +var file_poktroll_service_query_proto_depIdxs = []int32{ + 6, // 0: poktroll.service.QueryParamsResponse.params:type_name -> poktroll.service.Params + 7, // 1: poktroll.service.QueryGetServiceResponse.service:type_name -> poktroll.shared.Service + 8, // 2: poktroll.service.QueryAllServicesRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 7, // 3: poktroll.service.QueryAllServicesResponse.service:type_name -> poktroll.shared.Service + 9, // 4: poktroll.service.QueryAllServicesResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 0, // 5: poktroll.service.Query.Params:input_type -> poktroll.service.QueryParamsRequest + 2, // 6: poktroll.service.Query.Service:input_type -> poktroll.service.QueryGetServiceRequest + 4, // 7: poktroll.service.Query.AllServices:input_type -> poktroll.service.QueryAllServicesRequest + 1, // 8: poktroll.service.Query.Params:output_type -> poktroll.service.QueryParamsResponse + 3, // 9: poktroll.service.Query.Service:output_type -> poktroll.service.QueryGetServiceResponse + 5, // 10: poktroll.service.Query.AllServices:output_type -> poktroll.service.QueryAllServicesResponse + 8, // [8:11] is the sub-list for method output_type + 5, // [5:8] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_poktroll_service_query_proto_init() } +func file_poktroll_service_query_proto_init() { + if File_poktroll_service_query_proto != nil { + return + } + file_poktroll_service_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_service_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryParamsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetServiceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetServiceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAllServicesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAllServicesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_service_query_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_poktroll_service_query_proto_goTypes, + DependencyIndexes: file_poktroll_service_query_proto_depIdxs, + MessageInfos: file_poktroll_service_query_proto_msgTypes, + }.Build() + File_poktroll_service_query_proto = out.File + file_poktroll_service_query_proto_rawDesc = nil + file_poktroll_service_query_proto_goTypes = nil + file_poktroll_service_query_proto_depIdxs = nil +} diff --git a/api/poktroll/service/service.pulsar.go b/api/poktroll/service/service.pulsar.go new file mode 100644 index 000000000..e47fdeda9 --- /dev/null +++ b/api/poktroll/service/service.pulsar.go @@ -0,0 +1,639 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package service + +import ( + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Service protoreflect.MessageDescriptor + fd_Service_index protoreflect.FieldDescriptor + fd_Service_name protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_service_proto_init() + md_Service = File_poktroll_service_service_proto.Messages().ByName("Service") + fd_Service_index = md_Service.Fields().ByName("index") + fd_Service_name = md_Service.Fields().ByName("name") +} + +var _ protoreflect.Message = (*fastReflection_Service)(nil) + +type fastReflection_Service Service + +func (x *Service) ProtoReflect() protoreflect.Message { + return (*fastReflection_Service)(x) +} + +func (x *Service) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Service_messageType fastReflection_Service_messageType +var _ protoreflect.MessageType = fastReflection_Service_messageType{} + +type fastReflection_Service_messageType struct{} + +func (x fastReflection_Service_messageType) Zero() protoreflect.Message { + return (*fastReflection_Service)(nil) +} +func (x fastReflection_Service_messageType) New() protoreflect.Message { + return new(fastReflection_Service) +} +func (x fastReflection_Service_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Service +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Service) Descriptor() protoreflect.MessageDescriptor { + return md_Service +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Service) Type() protoreflect.MessageType { + return _fastReflection_Service_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Service) New() protoreflect.Message { + return new(fastReflection_Service) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Service) Interface() protoreflect.ProtoMessage { + return (*Service)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Service) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Index != "" { + value := protoreflect.ValueOfString(x.Index) + if !f(fd_Service_index, value) { + return + } + } + if x.Name != "" { + value := protoreflect.ValueOfString(x.Name) + if !f(fd_Service_name, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Service) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.Service.index": + return x.Index != "" + case "poktroll.service.Service.name": + return x.Name != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Service")) + } + panic(fmt.Errorf("message poktroll.service.Service does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Service) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.Service.index": + x.Index = "" + case "poktroll.service.Service.name": + x.Name = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Service")) + } + panic(fmt.Errorf("message poktroll.service.Service does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Service) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.Service.index": + value := x.Index + return protoreflect.ValueOfString(value) + case "poktroll.service.Service.name": + value := x.Name + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Service")) + } + panic(fmt.Errorf("message poktroll.service.Service does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Service) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.Service.index": + x.Index = value.Interface().(string) + case "poktroll.service.Service.name": + x.Name = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Service")) + } + panic(fmt.Errorf("message poktroll.service.Service does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Service) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.Service.index": + panic(fmt.Errorf("field index of message poktroll.service.Service is not mutable")) + case "poktroll.service.Service.name": + panic(fmt.Errorf("field name of message poktroll.service.Service is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Service")) + } + panic(fmt.Errorf("message poktroll.service.Service does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Service) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.Service.index": + return protoreflect.ValueOfString("") + case "poktroll.service.Service.name": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Service")) + } + panic(fmt.Errorf("message poktroll.service.Service does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Service) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.Service", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Service) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Service) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Service) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Service) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Service) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Index) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Name) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Service) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Name) > 0 { + i -= len(x.Name) + copy(dAtA[i:], x.Name) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Name))) + i-- + dAtA[i] = 0x12 + } + if len(x.Index) > 0 { + i -= len(x.Index) + copy(dAtA[i:], x.Index) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Index))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Service) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Service: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Service: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Index = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/service/service.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Service struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *Service) Reset() { + *x = Service{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Service) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Service) ProtoMessage() {} + +// Deprecated: Use Service.ProtoReflect.Descriptor instead. +func (*Service) Descriptor() ([]byte, []int) { + return file_poktroll_service_service_proto_rawDescGZIP(), []int{0} +} + +func (x *Service) GetIndex() string { + if x != nil { + return x.Index + } + return "" +} + +func (x *Service) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +var File_poktroll_service_service_proto protoreflect.FileDescriptor + +var file_poktroll_service_service_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x10, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x22, 0x33, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, + 0x64, 0x65, 0x78, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0xa8, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x42, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xca, 0x02, 0x10, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xe2, + 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_service_service_proto_rawDescOnce sync.Once + file_poktroll_service_service_proto_rawDescData = file_poktroll_service_service_proto_rawDesc +) + +func file_poktroll_service_service_proto_rawDescGZIP() []byte { + file_poktroll_service_service_proto_rawDescOnce.Do(func() { + file_poktroll_service_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_service_service_proto_rawDescData) + }) + return file_poktroll_service_service_proto_rawDescData +} + +var file_poktroll_service_service_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_service_service_proto_goTypes = []interface{}{ + (*Service)(nil), // 0: poktroll.service.Service +} +var file_poktroll_service_service_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_service_service_proto_init() } +func file_poktroll_service_service_proto_init() { + if File_poktroll_service_service_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_service_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Service); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_service_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_service_service_proto_goTypes, + DependencyIndexes: file_poktroll_service_service_proto_depIdxs, + MessageInfos: file_poktroll_service_service_proto_msgTypes, + }.Build() + File_poktroll_service_service_proto = out.File + file_poktroll_service_service_proto_rawDesc = nil + file_poktroll_service_service_proto_goTypes = nil + file_poktroll_service_service_proto_depIdxs = nil +} diff --git a/api/poktroll/service/tx.pulsar.go b/api/poktroll/service/tx.pulsar.go new file mode 100644 index 000000000..b756d9c17 --- /dev/null +++ b/api/poktroll/service/tx.pulsar.go @@ -0,0 +1,2067 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package service + +import ( + _ "cosmossdk.io/api/amino" + _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + shared "github.com/pokt-network/poktroll/api/poktroll/shared" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_MsgUpdateParams protoreflect.MessageDescriptor + fd_MsgUpdateParams_authority protoreflect.FieldDescriptor + fd_MsgUpdateParams_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_tx_proto_init() + md_MsgUpdateParams = File_poktroll_service_tx_proto.Messages().ByName("MsgUpdateParams") + fd_MsgUpdateParams_authority = md_MsgUpdateParams.Fields().ByName("authority") + fd_MsgUpdateParams_params = md_MsgUpdateParams.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParams)(nil) + +type fastReflection_MsgUpdateParams MsgUpdateParams + +func (x *MsgUpdateParams) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(x) +} + +func (x *MsgUpdateParams) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_tx_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParams_messageType fastReflection_MsgUpdateParams_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParams_messageType{} + +type fastReflection_MsgUpdateParams_messageType struct{} + +func (x fastReflection_MsgUpdateParams_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(nil) +} +func (x fastReflection_MsgUpdateParams_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} +func (x fastReflection_MsgUpdateParams_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParams) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParams_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParams) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParams) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParams)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgUpdateParams_authority, value) { + return + } + } + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_MsgUpdateParams_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParams) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParams.authority": + return x.Authority != "" + case "poktroll.service.MsgUpdateParams.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParams.authority": + x.Authority = "" + case "poktroll.service.MsgUpdateParams.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.MsgUpdateParams.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "poktroll.service.MsgUpdateParams.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParams does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParams.authority": + x.Authority = value.Interface().(string) + case "poktroll.service.MsgUpdateParams.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParams.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "poktroll.service.MsgUpdateParams.authority": + panic(fmt.Errorf("field authority of message poktroll.service.MsgUpdateParams is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParams.authority": + return protoreflect.ValueOfString("") + case "poktroll.service.MsgUpdateParams.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.MsgUpdateParams", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParams) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParams) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParams) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUpdateParamsResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_service_tx_proto_init() + md_MsgUpdateParamsResponse = File_poktroll_service_tx_proto.Messages().ByName("MsgUpdateParamsResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParamsResponse)(nil) + +type fastReflection_MsgUpdateParamsResponse MsgUpdateParamsResponse + +func (x *MsgUpdateParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(x) +} + +func (x *MsgUpdateParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_tx_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParamsResponse_messageType fastReflection_MsgUpdateParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParamsResponse_messageType{} + +type fastReflection_MsgUpdateParamsResponse_messageType struct{} + +func (x fastReflection_MsgUpdateParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(nil) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParamsResponse) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParamsResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParamsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.MsgUpdateParamsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParamsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParamsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgAddService protoreflect.MessageDescriptor + fd_MsgAddService_address protoreflect.FieldDescriptor + fd_MsgAddService_service protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_tx_proto_init() + md_MsgAddService = File_poktroll_service_tx_proto.Messages().ByName("MsgAddService") + fd_MsgAddService_address = md_MsgAddService.Fields().ByName("address") + fd_MsgAddService_service = md_MsgAddService.Fields().ByName("service") +} + +var _ protoreflect.Message = (*fastReflection_MsgAddService)(nil) + +type fastReflection_MsgAddService MsgAddService + +func (x *MsgAddService) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgAddService)(x) +} + +func (x *MsgAddService) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_tx_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgAddService_messageType fastReflection_MsgAddService_messageType +var _ protoreflect.MessageType = fastReflection_MsgAddService_messageType{} + +type fastReflection_MsgAddService_messageType struct{} + +func (x fastReflection_MsgAddService_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgAddService)(nil) +} +func (x fastReflection_MsgAddService_messageType) New() protoreflect.Message { + return new(fastReflection_MsgAddService) +} +func (x fastReflection_MsgAddService_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgAddService +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgAddService) Descriptor() protoreflect.MessageDescriptor { + return md_MsgAddService +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgAddService) Type() protoreflect.MessageType { + return _fastReflection_MsgAddService_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgAddService) New() protoreflect.Message { + return new(fastReflection_MsgAddService) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgAddService) Interface() protoreflect.ProtoMessage { + return (*MsgAddService)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgAddService) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_MsgAddService_address, value) { + return + } + } + if x.Service != nil { + value := protoreflect.ValueOfMessage(x.Service.ProtoReflect()) + if !f(fd_MsgAddService_service, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgAddService) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.MsgAddService.address": + return x.Address != "" + case "poktroll.service.MsgAddService.service": + return x.Service != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddService")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddService does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddService) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.MsgAddService.address": + x.Address = "" + case "poktroll.service.MsgAddService.service": + x.Service = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddService")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddService does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgAddService) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.MsgAddService.address": + value := x.Address + return protoreflect.ValueOfString(value) + case "poktroll.service.MsgAddService.service": + value := x.Service + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddService")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddService does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddService) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.MsgAddService.address": + x.Address = value.Interface().(string) + case "poktroll.service.MsgAddService.service": + x.Service = value.Message().Interface().(*shared.Service) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddService")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddService does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddService) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.MsgAddService.service": + if x.Service == nil { + x.Service = new(shared.Service) + } + return protoreflect.ValueOfMessage(x.Service.ProtoReflect()) + case "poktroll.service.MsgAddService.address": + panic(fmt.Errorf("field address of message poktroll.service.MsgAddService is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddService")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddService does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgAddService) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.MsgAddService.address": + return protoreflect.ValueOfString("") + case "poktroll.service.MsgAddService.service": + m := new(shared.Service) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddService")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddService does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgAddService) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.MsgAddService", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgAddService) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddService) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgAddService) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgAddService) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgAddService) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Address) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Service != nil { + l = options.Size(x.Service) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgAddService) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Service != nil { + encoded, err := options.Marshal(x.Service) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgAddService) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgAddService: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgAddService: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Service", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Service == nil { + x.Service = &shared.Service{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Service); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgAddServiceResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_service_tx_proto_init() + md_MsgAddServiceResponse = File_poktroll_service_tx_proto.Messages().ByName("MsgAddServiceResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgAddServiceResponse)(nil) + +type fastReflection_MsgAddServiceResponse MsgAddServiceResponse + +func (x *MsgAddServiceResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgAddServiceResponse)(x) +} + +func (x *MsgAddServiceResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_tx_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgAddServiceResponse_messageType fastReflection_MsgAddServiceResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgAddServiceResponse_messageType{} + +type fastReflection_MsgAddServiceResponse_messageType struct{} + +func (x fastReflection_MsgAddServiceResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgAddServiceResponse)(nil) +} +func (x fastReflection_MsgAddServiceResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgAddServiceResponse) +} +func (x fastReflection_MsgAddServiceResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgAddServiceResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgAddServiceResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgAddServiceResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgAddServiceResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgAddServiceResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgAddServiceResponse) New() protoreflect.Message { + return new(fastReflection_MsgAddServiceResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgAddServiceResponse) Interface() protoreflect.ProtoMessage { + return (*MsgAddServiceResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgAddServiceResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgAddServiceResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddServiceResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddServiceResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddServiceResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgAddServiceResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddServiceResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddServiceResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddServiceResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddServiceResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddServiceResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgAddServiceResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddServiceResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgAddServiceResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.MsgAddServiceResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgAddServiceResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddServiceResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgAddServiceResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgAddServiceResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgAddServiceResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgAddServiceResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgAddServiceResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgAddServiceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgAddServiceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/service/tx.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/service parameters to update. + // NOTE: All parameters must be supplied. + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParams) Reset() { + *x = MsgUpdateParams{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_tx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParams) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return file_poktroll_service_tx_proto_rawDescGZIP(), []int{0} +} + +func (x *MsgUpdateParams) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgUpdateParams) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUpdateParamsResponse) Reset() { + *x = MsgUpdateParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_tx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParamsResponse) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_service_tx_proto_rawDescGZIP(), []int{1} +} + +// MsgAddService defines a message for adding a new message to the network. +// Services can be added by any actor in the network making them truly +// permissionless. +// TODO_DOCUMENT(@h5law): This is a key function in making services +// permissionless, document it's usage and design - in docusaurus covering how +// the entire process works. +type MsgAddService struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // The Bech32 address of the service supplier using cosmos' ScalarDescriptor + Service *shared.Service `protobuf:"bytes,2,opt,name=service,proto3" json:"service,omitempty"` // The Service for which the supplier is adding to the network +} + +func (x *MsgAddService) Reset() { + *x = MsgAddService{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgAddService) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgAddService) ProtoMessage() {} + +// Deprecated: Use MsgAddService.ProtoReflect.Descriptor instead. +func (*MsgAddService) Descriptor() ([]byte, []int) { + return file_poktroll_service_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgAddService) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *MsgAddService) GetService() *shared.Service { + if x != nil { + return x.Service + } + return nil +} + +type MsgAddServiceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgAddServiceResponse) Reset() { + *x = MsgAddServiceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgAddServiceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgAddServiceResponse) ProtoMessage() {} + +// Deprecated: Use MsgAddServiceResponse.ProtoReflect.Descriptor instead. +func (*MsgAddServiceResponse) Descriptor() ([]byte, []int) { + return file_poktroll_service_tx_proto_rawDescGZIP(), []int{3} +} + +var File_poktroll_service_tx_proto protoreflect.FileDescriptor + +var file_poktroll_service_tx_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1a, 0x11, 0x61, + 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, + 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbd, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x74, 0x79, 0x12, 0x3b, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, + 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x3a, 0x35, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x22, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, + 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x8b, 0x01, 0x0a, 0x0d, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x22, 0x17, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc2, 0x01, 0x0a, 0x03, 0x4d, + 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x56, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x1f, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1a, + 0x27, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, + 0xa3, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, + 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xca, + 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_service_tx_proto_rawDescOnce sync.Once + file_poktroll_service_tx_proto_rawDescData = file_poktroll_service_tx_proto_rawDesc +) + +func file_poktroll_service_tx_proto_rawDescGZIP() []byte { + file_poktroll_service_tx_proto_rawDescOnce.Do(func() { + file_poktroll_service_tx_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_service_tx_proto_rawDescData) + }) + return file_poktroll_service_tx_proto_rawDescData +} + +var file_poktroll_service_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_poktroll_service_tx_proto_goTypes = []interface{}{ + (*MsgUpdateParams)(nil), // 0: poktroll.service.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 1: poktroll.service.MsgUpdateParamsResponse + (*MsgAddService)(nil), // 2: poktroll.service.MsgAddService + (*MsgAddServiceResponse)(nil), // 3: poktroll.service.MsgAddServiceResponse + (*Params)(nil), // 4: poktroll.service.Params + (*shared.Service)(nil), // 5: poktroll.shared.Service +} +var file_poktroll_service_tx_proto_depIdxs = []int32{ + 4, // 0: poktroll.service.MsgUpdateParams.params:type_name -> poktroll.service.Params + 5, // 1: poktroll.service.MsgAddService.service:type_name -> poktroll.shared.Service + 0, // 2: poktroll.service.Msg.UpdateParams:input_type -> poktroll.service.MsgUpdateParams + 2, // 3: poktroll.service.Msg.AddService:input_type -> poktroll.service.MsgAddService + 1, // 4: poktroll.service.Msg.UpdateParams:output_type -> poktroll.service.MsgUpdateParamsResponse + 3, // 5: poktroll.service.Msg.AddService:output_type -> poktroll.service.MsgAddServiceResponse + 4, // [4:6] is the sub-list for method output_type + 2, // [2:4] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_poktroll_service_tx_proto_init() } +func file_poktroll_service_tx_proto_init() { + if File_poktroll_service_tx_proto != nil { + return + } + file_poktroll_service_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_service_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_tx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgAddService); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgAddServiceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_service_tx_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_poktroll_service_tx_proto_goTypes, + DependencyIndexes: file_poktroll_service_tx_proto_depIdxs, + MessageInfos: file_poktroll_service_tx_proto_msgTypes, + }.Build() + File_poktroll_service_tx_proto = out.File + file_poktroll_service_tx_proto_rawDesc = nil + file_poktroll_service_tx_proto_goTypes = nil + file_poktroll_service_tx_proto_depIdxs = nil +} diff --git a/api/poktroll/shared/service.pulsar.go b/api/poktroll/shared/service.pulsar.go new file mode 100644 index 000000000..8cece2d86 --- /dev/null +++ b/api/poktroll/shared/service.pulsar.go @@ -0,0 +1,644 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package shared + +import ( + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Service protoreflect.MessageDescriptor + fd_Service_id protoreflect.FieldDescriptor + fd_Service_name protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_shared_service_proto_init() + md_Service = File_poktroll_shared_service_proto.Messages().ByName("Service") + fd_Service_id = md_Service.Fields().ByName("id") + fd_Service_name = md_Service.Fields().ByName("name") +} + +var _ protoreflect.Message = (*fastReflection_Service)(nil) + +type fastReflection_Service Service + +func (x *Service) ProtoReflect() protoreflect.Message { + return (*fastReflection_Service)(x) +} + +func (x *Service) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_shared_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Service_messageType fastReflection_Service_messageType +var _ protoreflect.MessageType = fastReflection_Service_messageType{} + +type fastReflection_Service_messageType struct{} + +func (x fastReflection_Service_messageType) Zero() protoreflect.Message { + return (*fastReflection_Service)(nil) +} +func (x fastReflection_Service_messageType) New() protoreflect.Message { + return new(fastReflection_Service) +} +func (x fastReflection_Service_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Service +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Service) Descriptor() protoreflect.MessageDescriptor { + return md_Service +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Service) Type() protoreflect.MessageType { + return _fastReflection_Service_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Service) New() protoreflect.Message { + return new(fastReflection_Service) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Service) Interface() protoreflect.ProtoMessage { + return (*Service)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Service) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Id != "" { + value := protoreflect.ValueOfString(x.Id) + if !f(fd_Service_id, value) { + return + } + } + if x.Name != "" { + value := protoreflect.ValueOfString(x.Name) + if !f(fd_Service_name, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Service) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.shared.Service.id": + return x.Id != "" + case "poktroll.shared.Service.name": + return x.Name != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Service")) + } + panic(fmt.Errorf("message poktroll.shared.Service does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Service) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.shared.Service.id": + x.Id = "" + case "poktroll.shared.Service.name": + x.Name = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Service")) + } + panic(fmt.Errorf("message poktroll.shared.Service does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Service) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.shared.Service.id": + value := x.Id + return protoreflect.ValueOfString(value) + case "poktroll.shared.Service.name": + value := x.Name + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Service")) + } + panic(fmt.Errorf("message poktroll.shared.Service does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Service) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.shared.Service.id": + x.Id = value.Interface().(string) + case "poktroll.shared.Service.name": + x.Name = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Service")) + } + panic(fmt.Errorf("message poktroll.shared.Service does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Service) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.Service.id": + panic(fmt.Errorf("field id of message poktroll.shared.Service is not mutable")) + case "poktroll.shared.Service.name": + panic(fmt.Errorf("field name of message poktroll.shared.Service is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Service")) + } + panic(fmt.Errorf("message poktroll.shared.Service does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Service) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.Service.id": + return protoreflect.ValueOfString("") + case "poktroll.shared.Service.name": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Service")) + } + panic(fmt.Errorf("message poktroll.shared.Service does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Service) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.shared.Service", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Service) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Service) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Service) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Service) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Service) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Id) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Name) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Service) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Name) > 0 { + i -= len(x.Name) + copy(dAtA[i:], x.Name) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Name))) + i-- + dAtA[i] = 0x12 + } + if len(x.Id) > 0 { + i -= len(x.Id) + copy(dAtA[i:], x.Id) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Id))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Service) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Service: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Service: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/shared/service.proto + +// NOTE that the `shared` package is not a Cosmos module, +// but rather a manually created package to resolve circular type dependencies. + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Service message to encapsulate unique and semantic identifiers for a service on the network +type Service struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // For example, what if we want to request a session for a certain service but with some additional configs that identify it? + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // Unique identifier for the service + // TODO_TECHDEBT: Name is currently unused but acts as a reminder that an optional onchain representation of the service is necessary + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // (Optional) Semantic human readable name for the service +} + +func (x *Service) Reset() { + *x = Service{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_shared_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Service) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Service) ProtoMessage() {} + +// Deprecated: Use Service.ProtoReflect.Descriptor instead. +func (*Service) Descriptor() ([]byte, []int) { + return file_poktroll_shared_service_proto_rawDescGZIP(), []int{0} +} + +func (x *Service) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Service) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +var File_poktroll_shared_service_proto protoreflect.FileDescriptor + +var file_poktroll_shared_service_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x0f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, + 0x22, 0x2d, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x42, + 0xa2, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x42, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, + 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, + 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, + 0x64, 0xca, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x68, 0x61, + 0x72, 0x65, 0x64, 0xe2, 0x02, 0x1b, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, + 0x68, 0x61, 0x72, 0x65, 0x64, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x68, + 0x61, 0x72, 0x65, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_shared_service_proto_rawDescOnce sync.Once + file_poktroll_shared_service_proto_rawDescData = file_poktroll_shared_service_proto_rawDesc +) + +func file_poktroll_shared_service_proto_rawDescGZIP() []byte { + file_poktroll_shared_service_proto_rawDescOnce.Do(func() { + file_poktroll_shared_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_shared_service_proto_rawDescData) + }) + return file_poktroll_shared_service_proto_rawDescData +} + +var file_poktroll_shared_service_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_shared_service_proto_goTypes = []interface{}{ + (*Service)(nil), // 0: poktroll.shared.Service +} +var file_poktroll_shared_service_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_shared_service_proto_init() } +func file_poktroll_shared_service_proto_init() { + if File_poktroll_shared_service_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_shared_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Service); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_shared_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_shared_service_proto_goTypes, + DependencyIndexes: file_poktroll_shared_service_proto_depIdxs, + MessageInfos: file_poktroll_shared_service_proto_msgTypes, + }.Build() + File_poktroll_shared_service_proto = out.File + file_poktroll_shared_service_proto_rawDesc = nil + file_poktroll_shared_service_proto_goTypes = nil + file_poktroll_shared_service_proto_depIdxs = nil +} diff --git a/app/app.go b/app/app.go index 7a92f9827..5e4cfa31d 100644 --- a/app/app.go +++ b/app/app.go @@ -1,224 +1,74 @@ package app import ( - "encoding/json" - "fmt" "io" "os" "path/filepath" - autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" - reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" - dbm "github.com/cometbft/cometbft-db" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" - tmos "github.com/cometbft/cometbft/libs/os" + "cosmossdk.io/depinject" + "cosmossdk.io/log" + storetypes "cosmossdk.io/store/types" + circuitkeeper "cosmossdk.io/x/circuit/keeper" + evidencekeeper "cosmossdk.io/x/evidence/keeper" + feegrantkeeper "cosmossdk.io/x/feegrant/keeper" + upgradekeeper "cosmossdk.io/x/upgrade/keeper" + dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" - nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/types" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/runtime" - runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services" + "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/server/api" "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" + testdata_pulsar "github.com/cosmos/cosmos-sdk/testutil/testdata/testpb" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/auth/ante" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" - authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/auth/vesting" - vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - "github.com/cosmos/cosmos-sdk/x/authz" authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" - authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" - "github.com/cosmos/cosmos-sdk/x/bank" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/capability" - capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - "github.com/cosmos/cosmos-sdk/x/consensus" - consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" - consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" - "github.com/cosmos/cosmos-sdk/x/crisis" + consensuskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" - crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" - distr "github.com/cosmos/cosmos-sdk/x/distribution" distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - "github.com/cosmos/cosmos-sdk/x/evidence" - evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - "github.com/cosmos/cosmos-sdk/x/feegrant" - feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper" - feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" "github.com/cosmos/cosmos-sdk/x/gov" govclient "github.com/cosmos/cosmos-sdk/x/gov/client" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - "github.com/cosmos/cosmos-sdk/x/group" groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" - groupmodule "github.com/cosmos/cosmos-sdk/x/group/module" - "github.com/cosmos/cosmos-sdk/x/mint" mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - "github.com/cosmos/cosmos-sdk/x/params" paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - "github.com/cosmos/cosmos-sdk/x/slashing" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/cosmos-sdk/x/upgrade" - upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" - upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts" - icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper" - icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" - icahost "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host" - icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper" - icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" - icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" - "github.com/cosmos/ibc-go/v7/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v7/modules/core" - ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client" - ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client" - ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - ibcporttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" - solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" - "github.com/spf13/cast" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" + icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper" + ibcfeekeeper "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper" + ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" - appparams "github.com/pokt-network/poktroll/app/params" - "github.com/pokt-network/poktroll/docs" - applicationmodule "github.com/pokt-network/poktroll/x/application" - applicationmodulekeeper "github.com/pokt-network/poktroll/x/application/keeper" - applicationmoduletypes "github.com/pokt-network/poktroll/x/application/types" - gatewaymodule "github.com/pokt-network/poktroll/x/gateway" - gatewaymodulekeeper "github.com/pokt-network/poktroll/x/gateway/keeper" - gatewaymoduletypes "github.com/pokt-network/poktroll/x/gateway/types" - pocketmodule "github.com/pokt-network/poktroll/x/pocket" - pocketmodulekeeper "github.com/pokt-network/poktroll/x/pocket/keeper" - pocketmoduletypes "github.com/pokt-network/poktroll/x/pocket/types" - servicemodule "github.com/pokt-network/poktroll/x/service" servicemodulekeeper "github.com/pokt-network/poktroll/x/service/keeper" - servicemoduletypes "github.com/pokt-network/poktroll/x/service/types" - sessionmodule "github.com/pokt-network/poktroll/x/session" - sessionmodulekeeper "github.com/pokt-network/poktroll/x/session/keeper" - sessionmoduletypes "github.com/pokt-network/poktroll/x/session/types" - suppliermodule "github.com/pokt-network/poktroll/x/supplier" - suppliermodulekeeper "github.com/pokt-network/poktroll/x/supplier/keeper" - suppliermoduletypes "github.com/pokt-network/poktroll/x/supplier/types" - tokenomicsmodule "github.com/pokt-network/poktroll/x/tokenomics" - tokenomicsmodulekeeper "github.com/pokt-network/poktroll/x/tokenomics/keeper" - tokenomicsmoduletypes "github.com/pokt-network/poktroll/x/tokenomics/types" + // this line is used by starport scaffolding # stargate/app/moduleImport + + "github.com/pokt-network/poktroll/docs" ) const ( AccountAddressPrefix = "pokt" - Name = "pocket" + Name = "poktroll" // TODO_CLEANUP: Find a way to centralize the use of `upokt` throughout the codebase DenomuPOKT = "upokt" ) -// this line is used by starport scaffolding # stargate/wasm/app/enabledProposals - -func getGovProposalHandlers() []govclient.ProposalHandler { - var govProposalHandlers []govclient.ProposalHandler - // this line is used by starport scaffolding # stargate/app/govProposalHandlers - - govProposalHandlers = append(govProposalHandlers, - paramsclient.ProposalHandler, - upgradeclient.LegacyProposalHandler, - upgradeclient.LegacyCancelProposalHandler, - ibcclientclient.UpdateClientProposalHandler, - ibcclientclient.UpgradeProposalHandler, - // this line is used by starport scaffolding # stargate/app/govProposalHandler - ) - - return govProposalHandlers -} - var ( // DefaultNodeHome default home directories for the application daemon DefaultNodeHome string - - // ModuleBasics defines the module BasicManager is in charge of setting up basic, - // non-dependant module elements, such as codec registration - // and genesis verification. - ModuleBasics = module.NewBasicManager( - auth.AppModuleBasic{}, - authzmodule.AppModuleBasic{}, - // TODO_DISCUSS: Should we rename all instances of `Validator` to `Sequencer`? - genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), - bank.AppModuleBasic{}, - capability.AppModuleBasic{}, - staking.AppModuleBasic{}, - mint.AppModuleBasic{}, - distr.AppModuleBasic{}, - gov.NewAppModuleBasic(getGovProposalHandlers()), - params.AppModuleBasic{}, - crisis.AppModuleBasic{}, - slashing.AppModuleBasic{}, - feegrantmodule.AppModuleBasic{}, - groupmodule.AppModuleBasic{}, - ibc.AppModuleBasic{}, - ibctm.AppModuleBasic{}, - solomachine.AppModuleBasic{}, - upgrade.AppModuleBasic{}, - evidence.AppModuleBasic{}, - transfer.AppModuleBasic{}, - ica.AppModuleBasic{}, - vesting.AppModuleBasic{}, - consensus.AppModuleBasic{}, - pocketmodule.AppModuleBasic{}, - servicemodule.AppModuleBasic{}, - sessionmodule.AppModuleBasic{}, - applicationmodule.AppModuleBasic{}, - suppliermodule.AppModuleBasic{}, - gatewaymodule.AppModuleBasic{}, - tokenomicsmodule.AppModuleBasic{}, - // this line is used by starport scaffolding # stargate/app/moduleBasic - ) - - // module account permissions - maccPerms = map[string][]string{ - authtypes.FeeCollectorName: nil, - distrtypes.ModuleName: nil, - icatypes.ModuleName: nil, - minttypes.ModuleName: {authtypes.Minter}, - stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, - stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, - govtypes.ModuleName: {authtypes.Burner}, - ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - suppliermoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, - servicemoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, - applicationmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, - gatewaymoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, - tokenomicsmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - // this line is used by starport scaffolding # stargate/app/maccPerms - } ) var ( @@ -226,790 +76,280 @@ var ( _ servertypes.Application = (*App)(nil) ) -func init() { - userHomeDir, err := os.UserHomeDir() - if err != nil { - panic(err) - } - - DefaultNodeHome = filepath.Join(userHomeDir, "."+Name) -} - // App extends an ABCI application, but with most of its parameters exported. // They are exported for convenience in creating helper functions, as object // capabilities aren't needed for testing. type App struct { - *baseapp.BaseApp - - cdc *codec.LegacyAmino + *runtime.App + legacyAmino *codec.LegacyAmino appCodec codec.Codec - interfaceRegistry types.InterfaceRegistry txConfig client.TxConfig - - invCheckPeriod uint - - // keys to access the substores - keys map[string]*storetypes.KVStoreKey - tkeys map[string]*storetypes.TransientStoreKey - memKeys map[string]*storetypes.MemoryStoreKey + interfaceRegistry codectypes.InterfaceRegistry // keepers AccountKeeper authkeeper.AccountKeeper - AuthzKeeper authzkeeper.Keeper BankKeeper bankkeeper.Keeper - CapabilityKeeper *capabilitykeeper.Keeper StakingKeeper *stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper MintKeeper mintkeeper.Keeper DistrKeeper distrkeeper.Keeper - GovKeeper govkeeper.Keeper + GovKeeper *govkeeper.Keeper CrisisKeeper *crisiskeeper.Keeper UpgradeKeeper *upgradekeeper.Keeper ParamsKeeper paramskeeper.Keeper - IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly + AuthzKeeper authzkeeper.Keeper EvidenceKeeper evidencekeeper.Keeper - TransferKeeper ibctransferkeeper.Keeper - ICAHostKeeper icahostkeeper.Keeper FeeGrantKeeper feegrantkeeper.Keeper GroupKeeper groupkeeper.Keeper - ConsensusParamsKeeper consensusparamkeeper.Keeper + ConsensusParamsKeeper consensuskeeper.Keeper + CircuitBreakerKeeper circuitkeeper.Keeper + + // IBC + IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly + CapabilityKeeper *capabilitykeeper.Keeper + IBCFeeKeeper ibcfeekeeper.Keeper + ICAControllerKeeper icacontrollerkeeper.Keeper + ICAHostKeeper icahostkeeper.Keeper + TransferKeeper ibctransferkeeper.Keeper + + // Scoped IBC + ScopedIBCKeeper capabilitykeeper.ScopedKeeper + ScopedIBCTransferKeeper capabilitykeeper.ScopedKeeper + ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper + ScopedICAHostKeeper capabilitykeeper.ScopedKeeper + + ServiceKeeper servicemodulekeeper.Keeper + // this line is used by starport scaffolding # stargate/app/keeperDeclaration - // make scoped keepers public for test purposes - ScopedIBCKeeper capabilitykeeper.ScopedKeeper - ScopedTransferKeeper capabilitykeeper.ScopedKeeper - ScopedICAHostKeeper capabilitykeeper.ScopedKeeper + // simulation manager + sm *module.SimulationManager +} - PocketKeeper pocketmodulekeeper.Keeper - ServiceKeeper servicemodulekeeper.Keeper - SessionKeeper sessionmodulekeeper.Keeper - ApplicationKeeper applicationmodulekeeper.Keeper - SupplierKeeper suppliermodulekeeper.Keeper +func init() { + userHomeDir, err := os.UserHomeDir() + if err != nil { + panic(err) + } - GatewayKeeper gatewaymodulekeeper.Keeper + DefaultNodeHome = filepath.Join(userHomeDir, "."+Name) +} - TokenomicsKeeper tokenomicsmodulekeeper.Keeper - // this line is used by starport scaffolding # stargate/app/keeperDeclaration +// getGovProposalHandlers return the chain proposal handlers. +func getGovProposalHandlers() []govclient.ProposalHandler { + var govProposalHandlers []govclient.ProposalHandler + // this line is used by starport scaffolding # stargate/app/govProposalHandlers + + govProposalHandlers = append(govProposalHandlers, + paramsclient.ProposalHandler, + // this line is used by starport scaffolding # stargate/app/govProposalHandler + ) - // mm is the module manager - mm *module.Manager + return govProposalHandlers +} - // sm is the simulation manager - sm *module.SimulationManager - configurator module.Configurator +// AppConfig returns the default app config. +func AppConfig() depinject.Config { + return depinject.Configs( + appConfig, + // Loads the ao config from a YAML file. + // appconfig.LoadYAML(AppConfigYAML), + depinject.Supply( + // supply custom module basics + map[string]module.AppModuleBasic{ + genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), + govtypes.ModuleName: gov.NewAppModuleBasic(getGovProposalHandlers()), + // this line is used by starport scaffolding # stargate/appConfig/moduleBasic + }, + ), + ) } -// New returns a reference to an initialized blockchain app +// New returns a reference to an initialized App. func New( logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, - skipUpgradeHeights map[int64]bool, - homePath string, - invCheckPeriod uint, - encodingConfig appparams.EncodingConfig, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), -) *App { - appCodec := encodingConfig.Marshaler - cdc := encodingConfig.Amino - interfaceRegistry := encodingConfig.InterfaceRegistry - txConfig := encodingConfig.TxConfig - - bApp := baseapp.NewBaseApp( - Name, - logger, - db, - encodingConfig.TxConfig.TxDecoder(), - baseAppOptions..., - ) - bApp.SetCommitMultiStoreTracer(traceStore) - bApp.SetVersion(version.Version) - bApp.SetInterfaceRegistry(interfaceRegistry) - bApp.SetTxEncoder(txConfig.TxEncoder()) - - keys := sdk.NewKVStoreKeys( - authtypes.StoreKey, authz.ModuleName, banktypes.StoreKey, stakingtypes.StoreKey, - crisistypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, - govtypes.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, - feegrant.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, icahosttypes.StoreKey, - capabilitytypes.StoreKey, group.StoreKey, icacontrollertypes.StoreKey, consensusparamtypes.StoreKey, - pocketmoduletypes.StoreKey, - servicemoduletypes.StoreKey, - sessionmoduletypes.StoreKey, - applicationmoduletypes.StoreKey, - suppliermoduletypes.StoreKey, - gatewaymoduletypes.StoreKey, - tokenomicsmoduletypes.StoreKey, - // this line is used by starport scaffolding # stargate/app/storeKey - ) - tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) - memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) - - // TODO_BLOCKER(#322): Change this to `authtypes.NewModuleAddress(govtypes.ModuleName)` - // once we figure out the MVP for on-chain parameter governance. - pnfAddress := "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw" - authority := pnfAddress - - app := &App{ - BaseApp: bApp, - cdc: cdc, - appCodec: appCodec, - interfaceRegistry: interfaceRegistry, - txConfig: encodingConfig.TxConfig, - invCheckPeriod: invCheckPeriod, - keys: keys, - tkeys: tkeys, - memKeys: memKeys, +) (*App, error) { + var ( + app = &App{} + appBuilder *runtime.AppBuilder + + // merge the AppConfig and other configuration in one config + // TODO_BLOCKER(@Olshansk): Revisit the advanced configuration and understand if/where it fits in Shannon + appConfig = depinject.Configs( + AppConfig(), + depinject.Supply( + // Supply the application options + appOpts, + // Supply with IBC keeper getter for the IBC modules with App Wiring. + // The IBC Keeper cannot be passed because it has not been initiated yet. + // Passing the getter, the app IBC Keeper will always be accessible. + // This needs to be removed after IBC supports App Wiring. + app.GetIBCKeeper, + app.GetCapabilityScopedKeeper, + // Supply the logger + logger, + + // ADVANCED CONFIGURATION + // + // AUTH + // + // For providing a custom function required in auth to generate custom account types + // add it below. By default the auth module uses simulation.RandomGenesisAccounts. + // + // authtypes.RandomGenesisAccountsFn(simulation.RandomGenesisAccounts), + // + // For providing a custom a base account type add it below. + // By default the auth module uses authtypes.ProtoBaseAccount(). + // + // func() sdk.AccountI { return authtypes.ProtoBaseAccount() }, + // + // For providing a different address codec, add it below. + // By default the auth module uses a Bech32 address codec, + // with the prefix defined in the auth module configuration. + // + // func() address.Codec { return <- custom address codec type -> } + + // + // STAKING + // + // For provinding a different validator and consensus address codec, add it below. + // By default the staking module uses the bech32 prefix provided in the auth config, + // and appends "valoper" and "valcons" for validator and consensus addresses respectively. + // When providing a custom address codec in auth, custom address codecs must be provided here as well. + // + // func() runtime.ValidatorAddressCodec { return <- custom validator address codec type -> } + // func() runtime.ConsensusAddressCodec { return <- custom consensus address codec type -> } + + // + // MINT + // + + // For providing a custom inflation function for x/mint add here your + // custom function that implements the minttypes.InflationCalculationFn + // interface. + ), + ) + ) + + if err := depinject.Inject(appConfig, + &appBuilder, + &app.appCodec, + &app.legacyAmino, + &app.txConfig, + &app.interfaceRegistry, + &app.AccountKeeper, + &app.BankKeeper, + &app.StakingKeeper, + &app.SlashingKeeper, + &app.MintKeeper, + &app.DistrKeeper, + &app.GovKeeper, + &app.CrisisKeeper, + &app.UpgradeKeeper, + &app.ParamsKeeper, + &app.AuthzKeeper, + &app.EvidenceKeeper, + &app.FeeGrantKeeper, + &app.GroupKeeper, + &app.ConsensusParamsKeeper, + &app.CircuitBreakerKeeper, + &app.ServiceKeeper, + // this line is used by starport scaffolding # stargate/app/keeperDefinition + ); err != nil { + panic(err) } - app.ParamsKeeper = initParamsKeeper( - appCodec, - cdc, - keys[paramstypes.StoreKey], - tkeys[paramstypes.TStoreKey], - ) - - // set the BaseApp's parameter store - app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper( - appCodec, - keys[upgradetypes.StoreKey], - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - bApp.SetParamStore(&app.ConsensusParamsKeeper) - - // add capability keeper and ScopeToModule for ibc module - app.CapabilityKeeper = capabilitykeeper.NewKeeper( - appCodec, - keys[capabilitytypes.StoreKey], - memKeys[capabilitytypes.MemStoreKey], - ) - - // grant capabilities for the ibc and ibc-transfer modules - scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) - scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) - scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) - scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) - // this line is used by starport scaffolding # stargate/app/scopedKeeper - - // add keepers - app.AccountKeeper = authkeeper.NewAccountKeeper( - appCodec, - keys[authtypes.StoreKey], - authtypes.ProtoBaseAccount, - maccPerms, - sdk.Bech32PrefixAccAddr, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.AuthzKeeper = authzkeeper.NewKeeper( - keys[authz.ModuleName], - appCodec, - app.MsgServiceRouter(), - app.AccountKeeper, - ) - - app.BankKeeper = bankkeeper.NewBaseKeeper( - appCodec, - keys[banktypes.StoreKey], - app.AccountKeeper, - app.BlockedModuleAccountAddrs(), - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.StakingKeeper = stakingkeeper.NewKeeper( - appCodec, - keys[stakingtypes.StoreKey], - app.AccountKeeper, - app.BankKeeper, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.FeeGrantKeeper = feegrantkeeper.NewKeeper( - appCodec, - keys[feegrant.StoreKey], - app.AccountKeeper, - ) - - app.MintKeeper = mintkeeper.NewKeeper( - appCodec, - keys[minttypes.StoreKey], - app.StakingKeeper, - app.AccountKeeper, - app.BankKeeper, - authtypes.FeeCollectorName, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.DistrKeeper = distrkeeper.NewKeeper( - appCodec, - keys[distrtypes.StoreKey], - app.AccountKeeper, - app.BankKeeper, - app.StakingKeeper, - authtypes.FeeCollectorName, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.SlashingKeeper = slashingkeeper.NewKeeper( - appCodec, - cdc, - keys[slashingtypes.StoreKey], - app.StakingKeeper, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.CrisisKeeper = crisiskeeper.NewKeeper( - appCodec, - keys[crisistypes.StoreKey], - invCheckPeriod, - app.BankKeeper, - authtypes.FeeCollectorName, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - groupConfig := group.DefaultConfig() - /* - Example of setting group params: - groupConfig.MaxMetadataLen = 1000 - */ - app.GroupKeeper = groupkeeper.NewKeeper( - keys[group.StoreKey], - appCodec, - app.MsgServiceRouter(), - app.AccountKeeper, - groupConfig, - ) - - app.UpgradeKeeper = upgradekeeper.NewKeeper( - skipUpgradeHeights, - keys[upgradetypes.StoreKey], - appCodec, - homePath, - app.BaseApp, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - // ... other modules keepers - - // Create IBC Keeper - app.IBCKeeper = ibckeeper.NewKeeper( - appCodec, keys[ibcexported.StoreKey], - app.GetSubspace(ibcexported.ModuleName), - app.StakingKeeper, - app.UpgradeKeeper, - scopedIBCKeeper, - ) - - // Create Transfer Keepers - app.TransferKeeper = ibctransferkeeper.NewKeeper( - appCodec, - keys[ibctransfertypes.StoreKey], - app.GetSubspace(ibctransfertypes.ModuleName), - app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, - app.AccountKeeper, - app.BankKeeper, - scopedTransferKeeper, - ) - transferModule := transfer.NewAppModule(app.TransferKeeper) - transferIBCModule := transfer.NewIBCModule(app.TransferKeeper) - - app.ICAHostKeeper = icahostkeeper.NewKeeper( - appCodec, keys[icahosttypes.StoreKey], - app.GetSubspace(icahosttypes.SubModuleName), - app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, - app.AccountKeeper, - scopedICAHostKeeper, - app.MsgServiceRouter(), - ) - icaControllerKeeper := icacontrollerkeeper.NewKeeper( - appCodec, keys[icacontrollertypes.StoreKey], - app.GetSubspace(icacontrollertypes.SubModuleName), - app.IBCKeeper.ChannelKeeper, // may be replaced with middleware such as ics29 fee - app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, - scopedICAControllerKeeper, app.MsgServiceRouter(), - ) - icaModule := ica.NewAppModule(&icaControllerKeeper, &app.ICAHostKeeper) - icaHostIBCModule := icahost.NewIBCModule(app.ICAHostKeeper) - - // Create evidence Keeper for to register the IBC light client misbehaviour evidence route - evidenceKeeper := evidencekeeper.NewKeeper( - appCodec, - keys[evidencetypes.StoreKey], - app.StakingKeeper, - app.SlashingKeeper, - ) - // If evidence needs to be handled for the app, set routes in router here and seal - app.EvidenceKeeper = *evidenceKeeper - - govConfig := govtypes.DefaultConfig() - govKeeper := govkeeper.NewKeeper( - appCodec, - keys[govtypes.StoreKey], - app.AccountKeeper, - app.BankKeeper, - app.StakingKeeper, - app.MsgServiceRouter(), - govConfig, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - govRouter := govv1beta1.NewRouter() - govRouter. - AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). - AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). - AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)) - govKeeper.SetLegacyRouter(govRouter) - - app.GovKeeper = *govKeeper.SetHooks( - govtypes.NewMultiGovHooks( - // register the governance hooks - ), - ) - - app.PocketKeeper = *pocketmodulekeeper.NewKeeper( - appCodec, - keys[pocketmoduletypes.StoreKey], - keys[pocketmoduletypes.MemStoreKey], - app.GetSubspace(pocketmoduletypes.ModuleName), - ) - pocketModule := pocketmodule.NewAppModule(appCodec, app.PocketKeeper, app.AccountKeeper, app.BankKeeper) - - app.ServiceKeeper = *servicemodulekeeper.NewKeeper( - appCodec, - keys[servicemoduletypes.StoreKey], - keys[servicemoduletypes.MemStoreKey], - app.GetSubspace(servicemoduletypes.ModuleName), - - app.BankKeeper, - ) - serviceModule := servicemodule.NewAppModule(appCodec, app.ServiceKeeper, app.AccountKeeper, app.BankKeeper) - - app.GatewayKeeper = *gatewaymodulekeeper.NewKeeper( - appCodec, - keys[gatewaymoduletypes.StoreKey], - keys[gatewaymoduletypes.MemStoreKey], - app.GetSubspace(gatewaymoduletypes.ModuleName), - - app.BankKeeper, - ) - gatewayModule := gatewaymodule.NewAppModule(appCodec, app.GatewayKeeper, app.AccountKeeper, app.BankKeeper) - - app.ApplicationKeeper = *applicationmodulekeeper.NewKeeper( - appCodec, - keys[applicationmoduletypes.StoreKey], - keys[applicationmoduletypes.MemStoreKey], - app.GetSubspace(applicationmoduletypes.ModuleName), - - app.BankKeeper, - app.AccountKeeper, - app.GatewayKeeper, - ) - applicationModule := applicationmodule.NewAppModule( - appCodec, - app.ApplicationKeeper, - app.AccountKeeper, - app.BankKeeper, - ) - - // TODO_TECHDEBT: Evaluate if this NB goes away after we upgrade to cosmos 0.5x - // NB: there is a circular dependency between the supplier and session keepers. - // Because the keepers are values (as opposed to pointers), they are copied - // when passed into their respective module constructor functions. For this - // reason, the existing pattern of ignite-generated keeper/module construction - // must be broken for these keepers and modules. + // Below we could construct and set an application specific mempool and + // ABCI 1.0 PrepareProposal and ProcessProposal handlers. These defaults are + // already set in the SDK's BaseApp, this shows an example of how to override + // them. // - // Order of operations: - // 1. Construct supplier keeper - // 2. Construct session keeper - // 3. Provide session keeper to supplier keeper via custom #SupplySessionKeeper method. - // 4. Construct supplier module - // 5. Construct session module - app.SupplierKeeper = *suppliermodulekeeper.NewKeeper( - appCodec, - keys[suppliermoduletypes.StoreKey], - keys[suppliermoduletypes.MemStoreKey], - app.GetSubspace(suppliermoduletypes.ModuleName), - - app.BankKeeper, - ) - - app.SessionKeeper = *sessionmodulekeeper.NewKeeper( - appCodec, - keys[sessionmoduletypes.StoreKey], - keys[sessionmoduletypes.MemStoreKey], - app.GetSubspace(sessionmoduletypes.ModuleName), - - app.ApplicationKeeper, - app.SupplierKeeper, - ) - - app.SupplierKeeper.SupplySessionKeeper(app.SessionKeeper) - - supplierModule := suppliermodule.NewAppModule(appCodec, app.SupplierKeeper, app.AccountKeeper, app.BankKeeper) - sessionModule := sessionmodule.NewAppModule(appCodec, app.SessionKeeper, app.AccountKeeper, app.BankKeeper) - - app.TokenomicsKeeper = *tokenomicsmodulekeeper.NewKeeper( - appCodec, - keys[tokenomicsmoduletypes.StoreKey], - keys[tokenomicsmoduletypes.MemStoreKey], - app.GetSubspace(tokenomicsmoduletypes.ModuleName), - app.BankKeeper, - authority, - ) - tokenomicsModule := tokenomicsmodule.NewAppModule(appCodec, app.TokenomicsKeeper, app.AccountKeeper, app.BankKeeper) - - // this line is used by starport scaffolding # stargate/app/keeperDefinition - - /**** IBC Routing ****/ - - // Sealing prevents other modules from creating scoped sub-keepers - app.CapabilityKeeper.Seal() - - // Create static IBC router, add transfer route, then set and seal it - ibcRouter := ibcporttypes.NewRouter() - ibcRouter.AddRoute(icahosttypes.SubModuleName, icaHostIBCModule). - AddRoute(ibctransfertypes.ModuleName, transferIBCModule) - // this line is used by starport scaffolding # ibc/app/router - app.IBCKeeper.SetRouter(ibcRouter) - - /**** Module Hooks ****/ - - // register hooks after all modules have been initialized - - app.StakingKeeper.SetHooks( - stakingtypes.NewMultiStakingHooks( - // insert staking hooks receivers here - app.DistrKeeper.Hooks(), - app.SlashingKeeper.Hooks(), - ), - ) - - /**** Module Options ****/ - - // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment - // we prefer to be more strict in what arguments the modules expect. - skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants)) - - // NOTE: Any module instantiated in the module manager that is later modified - // must be passed by reference here. - - app.mm = module.NewManager( - genutil.NewAppModule( - app.AccountKeeper, - app.StakingKeeper, - app.BaseApp.DeliverTx, - encodingConfig.TxConfig, - ), - auth.NewAppModule( - appCodec, - app.AccountKeeper, - authsims.RandomGenesisAccounts, - app.GetSubspace(authtypes.ModuleName), - ), - authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), - bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), - capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), - feegrantmodule.NewAppModule( - appCodec, - app.AccountKeeper, - app.BankKeeper, - app.FeeGrantKeeper, - app.interfaceRegistry, - ), - groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - gov.NewAppModule( - appCodec, - &app.GovKeeper, - app.AccountKeeper, - app.BankKeeper, - app.GetSubspace(govtypes.ModuleName), - ), - mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), - slashing.NewAppModule( - appCodec, - app.SlashingKeeper, - app.AccountKeeper, - app.BankKeeper, - app.StakingKeeper, - app.GetSubspace(slashingtypes.ModuleName), - ), - distr.NewAppModule( - appCodec, - app.DistrKeeper, - app.AccountKeeper, - app.BankKeeper, - app.StakingKeeper, - app.GetSubspace(distrtypes.ModuleName), - ), - staking.NewAppModule( - appCodec, - app.StakingKeeper, - app.AccountKeeper, - app.BankKeeper, - app.GetSubspace(stakingtypes.ModuleName), - ), - upgrade.NewAppModule(app.UpgradeKeeper), - evidence.NewAppModule(app.EvidenceKeeper), - consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), - ibc.NewAppModule(app.IBCKeeper), - params.NewAppModule(app.ParamsKeeper), - transferModule, - icaModule, - pocketModule, - serviceModule, - sessionModule, - applicationModule, - supplierModule, - gatewayModule, - tokenomicsModule, - // this line is used by starport scaffolding # stargate/app/appModule - - crisis.NewAppModule( - app.CrisisKeeper, - skipGenesisInvariants, - app.GetSubspace(crisistypes.ModuleName), - ), // always be last to make sure that it checks for all invariants and not only part of them - ) + // Example: + // + // app.App = appBuilder.Build(...) + // nonceMempool := mempool.NewSenderNonceMempool() + // abciPropHandler := NewDefaultProposalHandler(nonceMempool, app.App.BaseApp) + // + // app.App.BaseApp.SetMempool(nonceMempool) + // app.App.BaseApp.SetPrepareProposal(abciPropHandler.PrepareProposalHandler()) + // app.App.BaseApp.SetProcessProposal(abciPropHandler.ProcessProposalHandler()) + // + // Alternatively, you can construct BaseApp options, append those to + // baseAppOptions and pass them to the appBuilder. + // + // Example: + // + // prepareOpt = func(app *baseapp.BaseApp) { + // abciPropHandler := baseapp.NewDefaultProposalHandler(nonceMempool, app) + // app.SetPrepareProposal(abciPropHandler.PrepareProposalHandler()) + // } + // baseAppOptions = append(baseAppOptions, prepareOpt) + // + // create and set vote extension handler + // voteExtOp := func(bApp *baseapp.BaseApp) { + // voteExtHandler := NewVoteExtensionHandler() + // voteExtHandler.SetHandlers(bApp) + // } - // During begin block slashing happens after distr.BeginBlocker so that - // there is nothing left over in the validator fee pool, so as to keep the - // CanWithdrawInvariant invariant. - // NOTE: staking module is required if HistoricalEntries param > 0 - app.mm.SetOrderBeginBlockers( - // upgrades should be run first - upgradetypes.ModuleName, - capabilitytypes.ModuleName, - minttypes.ModuleName, - distrtypes.ModuleName, - slashingtypes.ModuleName, - evidencetypes.ModuleName, - stakingtypes.ModuleName, - authtypes.ModuleName, - banktypes.ModuleName, - govtypes.ModuleName, - crisistypes.ModuleName, - ibctransfertypes.ModuleName, - ibcexported.ModuleName, - icatypes.ModuleName, - genutiltypes.ModuleName, - authz.ModuleName, - feegrant.ModuleName, - group.ModuleName, - paramstypes.ModuleName, - vestingtypes.ModuleName, - consensusparamtypes.ModuleName, - pocketmoduletypes.ModuleName, - servicemoduletypes.ModuleName, - sessionmoduletypes.ModuleName, - applicationmoduletypes.ModuleName, - suppliermoduletypes.ModuleName, - gatewaymoduletypes.ModuleName, - tokenomicsmoduletypes.ModuleName, - // this line is used by starport scaffolding # stargate/app/beginBlockers - ) + app.App = appBuilder.Build(db, traceStore, baseAppOptions...) - app.mm.SetOrderEndBlockers( - crisistypes.ModuleName, - govtypes.ModuleName, - stakingtypes.ModuleName, - ibctransfertypes.ModuleName, - ibcexported.ModuleName, - icatypes.ModuleName, - capabilitytypes.ModuleName, - authtypes.ModuleName, - banktypes.ModuleName, - distrtypes.ModuleName, - slashingtypes.ModuleName, - minttypes.ModuleName, - genutiltypes.ModuleName, - evidencetypes.ModuleName, - authz.ModuleName, - feegrant.ModuleName, - group.ModuleName, - paramstypes.ModuleName, - upgradetypes.ModuleName, - vestingtypes.ModuleName, - consensusparamtypes.ModuleName, - pocketmoduletypes.ModuleName, - servicemoduletypes.ModuleName, - sessionmoduletypes.ModuleName, - applicationmoduletypes.ModuleName, - suppliermoduletypes.ModuleName, - gatewaymoduletypes.ModuleName, - tokenomicsmoduletypes.ModuleName, - // this line is used by starport scaffolding # stargate/app/endBlockers - ) + // Register legacy modules + app.registerIBCModules() - // NOTE: The genutils module must occur after staking so that pools are - // properly initialized with tokens from genesis accounts. - // NOTE: Capability module must occur first so that it can initialize any capabilities - // so that other modules that want to create or claim capabilities afterwards in InitChain - // can do so safely. - genesisModuleOrder := []string{ - capabilitytypes.ModuleName, - authtypes.ModuleName, - banktypes.ModuleName, - distrtypes.ModuleName, - stakingtypes.ModuleName, - slashingtypes.ModuleName, - govtypes.ModuleName, - minttypes.ModuleName, - crisistypes.ModuleName, - genutiltypes.ModuleName, - ibctransfertypes.ModuleName, - ibcexported.ModuleName, - icatypes.ModuleName, - evidencetypes.ModuleName, - authz.ModuleName, - feegrant.ModuleName, - group.ModuleName, - paramstypes.ModuleName, - upgradetypes.ModuleName, - vestingtypes.ModuleName, - consensusparamtypes.ModuleName, - pocketmoduletypes.ModuleName, - servicemoduletypes.ModuleName, - sessionmoduletypes.ModuleName, - applicationmoduletypes.ModuleName, - suppliermoduletypes.ModuleName, - gatewaymoduletypes.ModuleName, - tokenomicsmoduletypes.ModuleName, - // this line is used by starport scaffolding # stargate/app/initGenesis + // register streaming services + if err := app.RegisterStreamingServices(appOpts, app.kvStoreKeys()); err != nil { + return nil, err } - app.mm.SetOrderInitGenesis(genesisModuleOrder...) - app.mm.SetOrderExportGenesis(genesisModuleOrder...) - // Uncomment if you want to set a custom migration order here. - // app.mm.SetOrderMigrations(custom order) + /**** Module Options ****/ - app.mm.RegisterInvariants(app.CrisisKeeper) - app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) - app.mm.RegisterServices(app.configurator) + app.ModuleManager.RegisterInvariants(app.CrisisKeeper) - autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.mm.Modules)) - reflectionSvc, err := runtimeservices.NewReflectionService() - if err != nil { - panic(err) - } - reflectionv1.RegisterReflectionServiceServer(app.GRPCQueryRouter(), reflectionSvc) + // add test gRPC service for testing gRPC queries in isolation + testdata_pulsar.RegisterQueryServer(app.GRPCQueryRouter(), testdata_pulsar.QueryImpl{}) // create the simulation manager and define the order of the modules for deterministic simulations + // + // NOTE: this is not required apps that don't use the simulator for fuzz testing + // transactions overrideModules := map[string]module.AppModuleSimulation{ - authtypes.ModuleName: auth.NewAppModule( - app.appCodec, - app.AccountKeeper, - authsims.RandomGenesisAccounts, - app.GetSubspace(authtypes.ModuleName), - ), - } - app.sm = module.NewSimulationManagerFromAppModules(app.mm.Modules, overrideModules) - app.sm.RegisterStoreDecoders() - - // initialize stores - app.MountKVStores(keys) - app.MountTransientStores(tkeys) - app.MountMemoryStores(memKeys) - - // initialize BaseApp - anteHandler, err := ante.NewAnteHandler( - ante.HandlerOptions{ - AccountKeeper: app.AccountKeeper, - BankKeeper: app.BankKeeper, - SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), - FeegrantKeeper: app.FeeGrantKeeper, - SigGasConsumer: ante.DefaultSigVerificationGasConsumer, - }, - ) - if err != nil { - panic(fmt.Errorf("failed to create AnteHandler: %w", err)) + authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), } + app.sm = module.NewSimulationManagerFromAppModules(app.ModuleManager.Modules, overrideModules) - app.SetAnteHandler(anteHandler) - app.SetInitChainer(app.InitChainer) - app.SetBeginBlocker(app.BeginBlocker) - app.SetEndBlocker(app.EndBlocker) - - if loadLatest { - if err := app.LoadLatestVersion(); err != nil { - tmos.Exit(err.Error()) - } - } - - app.ScopedIBCKeeper = scopedIBCKeeper - app.ScopedTransferKeeper = scopedTransferKeeper - // this line is used by starport scaffolding # stargate/app/beforeInitReturn - - return app -} - -// Name returns the name of the App -func (app *App) Name() string { return app.BaseApp.Name() } - -// BeginBlocker application updates every begin block -func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { - return app.mm.BeginBlock(ctx, req) -} - -// EndBlocker application updates every end block -func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { - return app.mm.EndBlock(ctx, req) -} - -// InitChainer application update at chain initialization -func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { - var genesisState GenesisState - if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil { - panic(err) - } - app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap()) - return app.mm.InitGenesis(ctx, app.appCodec, genesisState) -} - -// Configurator get app configurator -func (app *App) Configurator() module.Configurator { - return app.configurator -} + app.sm.RegisterStoreDecoders() -// LoadHeight loads a particular height -func (app *App) LoadHeight(height int64) error { - return app.LoadVersion(height) -} + // A custom InitChainer can be set if extra pre-init-genesis logic is required. + // By default, when using app wiring enabled module, this is not required. + // For instance, the upgrade module will set automatically the module version map in its init genesis thanks to app wiring. + // However, when registering a module manually (i.e. that does not support app wiring), the module version map + // must be set manually as follow. The upgrade module will de-duplicate the module version map. + // + // app.SetInitChainer(func(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) { + // app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()) + // return app.App.InitChainer(ctx, req) + // }) -// ModuleAccountAddrs returns all the app's module account addresses. -func (app *App) ModuleAccountAddrs() map[string]bool { - modAccAddrs := make(map[string]bool) - for acc := range maccPerms { - modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true + if err := app.Load(loadLatest); err != nil { + return nil, err } - return modAccAddrs + return app, nil } -// BlockedModuleAccountAddrs returns all the app's blocked module account -// addresses. -func (app *App) BlockedModuleAccountAddrs() map[string]bool { - modAccAddrs := app.ModuleAccountAddrs() - delete(modAccAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String()) - - return modAccAddrs -} - -// LegacyAmino returns SimApp's amino codec. +// LegacyAmino returns App's amino codec. // // NOTE: This is solely to be used for testing purposes as it may be desirable // for modules to register their own custom testing types. func (app *App) LegacyAmino() *codec.LegacyAmino { - return app.cdc + return app.legacyAmino } -// AppCodec returns an app codec. +// AppCodec returns App's app codec. // // NOTE: This is solely to be used for testing purposes as it may be desirable // for modules to register their own custom testing types. @@ -1017,121 +357,93 @@ func (app *App) AppCodec() codec.Codec { return app.appCodec } -// InterfaceRegistry returns an InterfaceRegistry -func (app *App) InterfaceRegistry() types.InterfaceRegistry { - return app.interfaceRegistry -} - -// TxConfig returns SimApp's TxConfig -func (app *App) TxConfig() client.TxConfig { - return app.txConfig -} - // GetKey returns the KVStoreKey for the provided store key. -// -// NOTE: This is solely to be used for testing purposes. func (app *App) GetKey(storeKey string) *storetypes.KVStoreKey { - return app.keys[storeKey] + kvStoreKey, ok := app.UnsafeFindStoreKey(storeKey).(*storetypes.KVStoreKey) + if !ok { + return nil + } + return kvStoreKey } -// GetTKey returns the TransientStoreKey for the provided store key. -// -// NOTE: This is solely to be used for testing purposes. -func (app *App) GetTKey(storeKey string) *storetypes.TransientStoreKey { - return app.tkeys[storeKey] +// GetMemKey returns the MemoryStoreKey for the provided store key. +func (app *App) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { + key, ok := app.UnsafeFindStoreKey(storeKey).(*storetypes.MemoryStoreKey) + if !ok { + return nil + } + + return key } -// GetMemKey returns the MemStoreKey for the provided mem key. -// -// NOTE: This is solely used for testing purposes. -func (app *App) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { - return app.memKeys[storeKey] +// kvStoreKeys returns all the kv store keys registered inside App. +func (app *App) kvStoreKeys() map[string]*storetypes.KVStoreKey { + keys := make(map[string]*storetypes.KVStoreKey) + for _, k := range app.GetStoreKeys() { + if kv, ok := k.(*storetypes.KVStoreKey); ok { + keys[kv.Name()] = kv + } + } + + return keys } // GetSubspace returns a param subspace for a given module name. -// -// NOTE: This is solely to be used for testing purposes. func (app *App) GetSubspace(moduleName string) paramstypes.Subspace { subspace, _ := app.ParamsKeeper.GetSubspace(moduleName) return subspace } +// SimulationManager implements the SimulationApp interface. +func (app *App) SimulationManager() *module.SimulationManager { + return app.sm +} + // RegisterAPIRoutes registers all application module routes with the provided // API server. func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { - clientCtx := apiSvr.ClientCtx - // Register new tx routes from grpc-gateway. - authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - // Register new tendermint queries routes from grpc-gateway. - tmservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - // Register node gRPC service for grpc-gateway. - nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - - // Register grpc-gateway routes for all modules. - ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + app.App.RegisterAPIRoutes(apiSvr, apiConfig) + // register swagger API in app.go so that other applications can override easily + if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil { + panic(err) + } // register app's OpenAPI routes. docs.RegisterOpenAPIService(Name, apiSvr.Router) } -// RegisterTxService implements the Application.RegisterTxService method. -func (app *App) RegisterTxService(clientCtx client.Context) { - authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry) +// GetIBCKeeper returns the IBC keeper. +func (app *App) GetIBCKeeper() *ibckeeper.Keeper { + return app.IBCKeeper } -// RegisterTendermintService implements the Application.RegisterTendermintService method. -func (app *App) RegisterTendermintService(clientCtx client.Context) { - tmservice.RegisterTendermintService( - clientCtx, - app.BaseApp.GRPCQueryRouter(), - app.interfaceRegistry, - app.Query, - ) +// GetCapabilityScopedKeeper returns the capability scoped keeper. +func (app *App) GetCapabilityScopedKeeper(moduleName string) capabilitykeeper.ScopedKeeper { + return app.CapabilityKeeper.ScopeToModule(moduleName) } -// RegisterNodeService implements the Application.RegisterNodeService method. -func (app *App) RegisterNodeService(clientCtx client.Context) { - nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter()) -} - -// initParamsKeeper init params keeper and its subspaces -func initParamsKeeper( - appCodec codec.BinaryCodec, - legacyAmino *codec.LegacyAmino, - key, tkey storetypes.StoreKey, -) paramskeeper.Keeper { - paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) - - paramsKeeper.Subspace(authtypes.ModuleName) - paramsKeeper.Subspace(banktypes.ModuleName) - paramsKeeper.Subspace(stakingtypes.ModuleName) - paramsKeeper.Subspace(minttypes.ModuleName) - paramsKeeper.Subspace(distrtypes.ModuleName) - paramsKeeper.Subspace(slashingtypes.ModuleName) - paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable()) //nolint:staticcheck - paramsKeeper.Subspace(crisistypes.ModuleName) - paramsKeeper.Subspace(ibctransfertypes.ModuleName) - paramsKeeper.Subspace(ibcexported.ModuleName) - paramsKeeper.Subspace(icacontrollertypes.SubModuleName) - paramsKeeper.Subspace(icahosttypes.SubModuleName) - paramsKeeper.Subspace(pocketmoduletypes.ModuleName) - paramsKeeper.Subspace(servicemoduletypes.ModuleName) - paramsKeeper.Subspace(sessionmoduletypes.ModuleName) - paramsKeeper.Subspace(applicationmoduletypes.ModuleName) - paramsKeeper.Subspace(suppliermoduletypes.ModuleName) - paramsKeeper.Subspace(gatewaymoduletypes.ModuleName) - paramsKeeper.Subspace(tokenomicsmoduletypes.ModuleName) - // this line is used by starport scaffolding # stargate/app/paramSubspace - - return paramsKeeper -} - -// SimulationManager returns the app SimulationManager -func (app *App) SimulationManager() *module.SimulationManager { - return app.sm +// GetMaccPerms returns a copy of the module account permissions +// +// NOTE: This is solely to be used for testing purposes. +func GetMaccPerms() map[string][]string { + dup := make(map[string][]string) + for _, perms := range moduleAccPerms { + dup[perms.Account] = perms.Permissions + } + return dup } -// ModuleManager returns the app ModuleManager -func (app *App) ModuleManager() *module.Manager { - return app.mm +// BlockedAddresses returns all the app's blocked account addresses. +func BlockedAddresses() map[string]bool { + result := make(map[string]bool) + if len(blockAccAddrs) > 0 { + for _, addr := range blockAccAddrs { + result[addr] = true + } + } else { + for addr := range GetMaccPerms() { + result[addr] = true + } + } + return result } diff --git a/app/app_config.go b/app/app_config.go new file mode 100644 index 000000000..a82c7fef8 --- /dev/null +++ b/app/app_config.go @@ -0,0 +1,315 @@ +package app + +import ( + "time" + + runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1" + appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1" + authmodulev1 "cosmossdk.io/api/cosmos/auth/module/v1" + authzmodulev1 "cosmossdk.io/api/cosmos/authz/module/v1" + bankmodulev1 "cosmossdk.io/api/cosmos/bank/module/v1" + circuitmodulev1 "cosmossdk.io/api/cosmos/circuit/module/v1" + consensusmodulev1 "cosmossdk.io/api/cosmos/consensus/module/v1" + crisismodulev1 "cosmossdk.io/api/cosmos/crisis/module/v1" + distrmodulev1 "cosmossdk.io/api/cosmos/distribution/module/v1" + evidencemodulev1 "cosmossdk.io/api/cosmos/evidence/module/v1" + feegrantmodulev1 "cosmossdk.io/api/cosmos/feegrant/module/v1" + genutilmodulev1 "cosmossdk.io/api/cosmos/genutil/module/v1" + govmodulev1 "cosmossdk.io/api/cosmos/gov/module/v1" + groupmodulev1 "cosmossdk.io/api/cosmos/group/module/v1" + mintmodulev1 "cosmossdk.io/api/cosmos/mint/module/v1" + paramsmodulev1 "cosmossdk.io/api/cosmos/params/module/v1" + slashingmodulev1 "cosmossdk.io/api/cosmos/slashing/module/v1" + stakingmodulev1 "cosmossdk.io/api/cosmos/staking/module/v1" + txconfigv1 "cosmossdk.io/api/cosmos/tx/config/v1" + upgrademodulev1 "cosmossdk.io/api/cosmos/upgrade/module/v1" + vestingmodulev1 "cosmossdk.io/api/cosmos/vesting/module/v1" + "cosmossdk.io/core/appconfig" + _ "cosmossdk.io/x/circuit" // import for side-effects + circuittypes "cosmossdk.io/x/circuit/types" + _ "cosmossdk.io/x/evidence" // import for side-effects + evidencetypes "cosmossdk.io/x/evidence/types" + "cosmossdk.io/x/feegrant" + _ "cosmossdk.io/x/feegrant/module" // import for side-effects + _ "cosmossdk.io/x/upgrade" // import for side-effects + upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/runtime" + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import for side-effects + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + _ "github.com/cosmos/cosmos-sdk/x/auth/vesting" // import for side-effects + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" + "github.com/cosmos/cosmos-sdk/x/authz" + _ "github.com/cosmos/cosmos-sdk/x/authz/module" // import for side-effects + _ "github.com/cosmos/cosmos-sdk/x/bank" // import for side-effects + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + _ "github.com/cosmos/cosmos-sdk/x/consensus" // import for side-effects + consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + _ "github.com/cosmos/cosmos-sdk/x/crisis" // import for side-effects + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + _ "github.com/cosmos/cosmos-sdk/x/distribution" // import for side-effects + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/group" + _ "github.com/cosmos/cosmos-sdk/x/group/module" // import for side-effects + _ "github.com/cosmos/cosmos-sdk/x/mint" // import for side-effects + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + _ "github.com/cosmos/cosmos-sdk/x/params" // import for side-effects + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + _ "github.com/cosmos/cosmos-sdk/x/slashing" // import for side-effects + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + _ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + _ "github.com/cosmos/ibc-go/modules/capability" // import for side-effects + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + _ "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" // import for side-effects + icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + _ "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" // import for side-effects + ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + servicemodulev1 "github.com/pokt-network/poktroll/api/poktroll/service/module" + _ "github.com/pokt-network/poktroll/x/service/module" // import for side-effects + servicemoduletypes "github.com/pokt-network/poktroll/x/service/types" + "google.golang.org/protobuf/types/known/durationpb" + // this line is used by starport scaffolding # stargate/app/moduleImport +) + +var ( + // NOTE: The genutils module must occur after staking so that pools are + // properly initialized with tokens from genesis accounts. + // NOTE: The genutils module must also occur after auth so that it can access the params from auth. + // NOTE: Capability module must occur first so that it can initialize any capabilities + // so that other modules that want to create or claim capabilities afterwards in InitChain + // can do so safely. + genesisModuleOrder = []string{ + // cosmos-sdk/ibc modules + capabilitytypes.ModuleName, + authtypes.ModuleName, + banktypes.ModuleName, + distrtypes.ModuleName, + stakingtypes.ModuleName, + slashingtypes.ModuleName, + govtypes.ModuleName, + minttypes.ModuleName, + crisistypes.ModuleName, + ibcexported.ModuleName, + genutiltypes.ModuleName, + evidencetypes.ModuleName, + authz.ModuleName, + ibctransfertypes.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, + feegrant.ModuleName, + paramstypes.ModuleName, + upgradetypes.ModuleName, + vestingtypes.ModuleName, + circuittypes.ModuleName, + group.ModuleName, + consensusparamtypes.ModuleName, + circuittypes.ModuleName, + // chain modules + servicemoduletypes.ModuleName, + // this line is used by starport scaffolding # stargate/app/initGenesis + } + + // During begin block slashing happens after distr.BeginBlocker so that + // there is nothing left over in the validator fee pool, so as to keep the + // CanWithdrawInvariant invariant. + // NOTE: staking module is required if HistoricalEntries param > 0 + // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) + beginBlockers = []string{ + // cosmos sdk modules + minttypes.ModuleName, + distrtypes.ModuleName, + slashingtypes.ModuleName, + evidencetypes.ModuleName, + stakingtypes.ModuleName, + authz.ModuleName, + genutiltypes.ModuleName, + // ibc modules + capabilitytypes.ModuleName, + ibcexported.ModuleName, + ibctransfertypes.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, + // chain modules + servicemoduletypes.ModuleName, + // this line is used by starport scaffolding # stargate/app/beginBlockers + } + + endBlockers = []string{ + // cosmos sdk modules + crisistypes.ModuleName, + govtypes.ModuleName, + stakingtypes.ModuleName, + feegrant.ModuleName, + group.ModuleName, + genutiltypes.ModuleName, + // ibc modules + ibcexported.ModuleName, + ibctransfertypes.ModuleName, + capabilitytypes.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, + // chain modules + servicemoduletypes.ModuleName, + // this line is used by starport scaffolding # stargate/app/endBlockers + } + + preBlockers = []string{ + upgradetypes.ModuleName, + // this line is used by starport scaffolding # stargate/app/preBlockers + } + + // module account permissions + moduleAccPerms = []*authmodulev1.ModuleAccountPermission{ + {Account: authtypes.FeeCollectorName}, + {Account: distrtypes.ModuleName}, + {Account: minttypes.ModuleName, Permissions: []string{authtypes.Minter}}, + {Account: stakingtypes.BondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}}, + {Account: stakingtypes.NotBondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}}, + {Account: govtypes.ModuleName, Permissions: []string{authtypes.Burner}}, + {Account: ibctransfertypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}}, + {Account: ibcfeetypes.ModuleName}, + {Account: icatypes.ModuleName}, + {Account: servicemoduletypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner, authtypes.Staking}}, + // this line is used by starport scaffolding # stargate/app/maccPerms + } + + // blocked account addresses + blockAccAddrs = []string{ + authtypes.FeeCollectorName, + distrtypes.ModuleName, + minttypes.ModuleName, + stakingtypes.BondedPoolName, + stakingtypes.NotBondedPoolName, + // We allow the following module accounts to receive funds: + // govtypes.ModuleName + } + + // appConfig application configuration (used by depinject) + appConfig = appconfig.Compose(&appv1alpha1.Config{ + Modules: []*appv1alpha1.ModuleConfig{ + { + Name: runtime.ModuleName, + Config: appconfig.WrapAny(&runtimev1alpha1.Module{ + AppName: Name, + PreBlockers: preBlockers, + BeginBlockers: beginBlockers, + EndBlockers: endBlockers, + InitGenesis: genesisModuleOrder, + OverrideStoreKeys: []*runtimev1alpha1.StoreKeyConfig{ + { + ModuleName: authtypes.ModuleName, + KvStoreKey: "acc", + }, + }, + // When ExportGenesis is not specified, the export genesis module order + // is equal to the init genesis order + // ExportGenesis: genesisModuleOrder, + // Uncomment if you want to set a custom migration order here. + // OrderMigrations: nil, + }), + }, + { + Name: authtypes.ModuleName, + Config: appconfig.WrapAny(&authmodulev1.Module{ + Bech32Prefix: AccountAddressPrefix, + ModuleAccountPermissions: moduleAccPerms, + // By default modules authority is the governance module. This is configurable with the following: + // Authority: "group", // A custom module authority can be set using a module name + // Authority: "cosmos1cwwv22j5ca08ggdv9c2uky355k908694z577tv", // or a specific address + }), + }, + { + Name: vestingtypes.ModuleName, + Config: appconfig.WrapAny(&vestingmodulev1.Module{}), + }, + { + Name: banktypes.ModuleName, + Config: appconfig.WrapAny(&bankmodulev1.Module{ + BlockedModuleAccountsOverride: blockAccAddrs, + }), + }, + { + Name: stakingtypes.ModuleName, + Config: appconfig.WrapAny(&stakingmodulev1.Module{ + // NOTE: specifying a prefix is only necessary when using bech32 addresses + // If not specfied, the auth Bech32Prefix appended with "valoper" and "valcons" is used by default + Bech32PrefixValidator: AccountAddressPrefix + "valoper", + Bech32PrefixConsensus: AccountAddressPrefix + "valcons", + }), + }, + { + Name: slashingtypes.ModuleName, + Config: appconfig.WrapAny(&slashingmodulev1.Module{}), + }, + { + Name: paramstypes.ModuleName, + Config: appconfig.WrapAny(¶msmodulev1.Module{}), + }, + { + Name: "tx", + Config: appconfig.WrapAny(&txconfigv1.Config{}), + }, + { + Name: genutiltypes.ModuleName, + Config: appconfig.WrapAny(&genutilmodulev1.Module{}), + }, + { + Name: authz.ModuleName, + Config: appconfig.WrapAny(&authzmodulev1.Module{}), + }, + { + Name: upgradetypes.ModuleName, + Config: appconfig.WrapAny(&upgrademodulev1.Module{}), + }, + { + Name: distrtypes.ModuleName, + Config: appconfig.WrapAny(&distrmodulev1.Module{}), + }, + { + Name: evidencetypes.ModuleName, + Config: appconfig.WrapAny(&evidencemodulev1.Module{}), + }, + { + Name: minttypes.ModuleName, + Config: appconfig.WrapAny(&mintmodulev1.Module{}), + }, + { + Name: group.ModuleName, + Config: appconfig.WrapAny(&groupmodulev1.Module{ + MaxExecutionPeriod: durationpb.New(time.Second * 1209600), + MaxMetadataLen: 255, + }), + }, + { + Name: feegrant.ModuleName, + Config: appconfig.WrapAny(&feegrantmodulev1.Module{}), + }, + { + Name: govtypes.ModuleName, + Config: appconfig.WrapAny(&govmodulev1.Module{}), + }, + { + Name: crisistypes.ModuleName, + Config: appconfig.WrapAny(&crisismodulev1.Module{}), + }, + { + Name: consensustypes.ModuleName, + Config: appconfig.WrapAny(&consensusmodulev1.Module{}), + }, + { + Name: circuittypes.ModuleName, + Config: appconfig.WrapAny(&circuitmodulev1.Module{}), + }, + { + Name: servicemoduletypes.ModuleName, + Config: appconfig.WrapAny(&servicemodulev1.Module{}), + }, + // this line is used by starport scaffolding # stargate/app/moduleConfig + }, + }) +) diff --git a/app/encoding.go b/app/encoding.go deleted file mode 100644 index 3e32bee43..000000000 --- a/app/encoding.go +++ /dev/null @@ -1,35 +0,0 @@ -package app - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/std" - "github.com/cosmos/cosmos-sdk/x/auth/tx" - - "github.com/pokt-network/poktroll/app/params" -) - -// makeEncodingConfig creates an EncodingConfig for an amino based test configuration. -func makeEncodingConfig() params.EncodingConfig { - amino := codec.NewLegacyAmino() - interfaceRegistry := types.NewInterfaceRegistry() - marshaler := codec.NewProtoCodec(interfaceRegistry) - txCfg := tx.NewTxConfig(marshaler, tx.DefaultSignModes) - - return params.EncodingConfig{ - InterfaceRegistry: interfaceRegistry, - Marshaler: marshaler, - TxConfig: txCfg, - Amino: amino, - } -} - -// MakeEncodingConfig creates an EncodingConfig for testing -func MakeEncodingConfig() params.EncodingConfig { - encodingConfig := makeEncodingConfig() - std.RegisterLegacyAminoCodec(encodingConfig.Amino) - std.RegisterInterfaces(encodingConfig.InterfaceRegistry) - ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) - ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry) - return encodingConfig -} diff --git a/app/export.go b/app/export.go index db240d2b6..21203b274 100644 --- a/app/export.go +++ b/app/export.go @@ -5,7 +5,8 @@ import ( "fmt" "log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + storetypes "cosmossdk.io/store/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" @@ -15,23 +16,23 @@ import ( // ExportAppStateAndValidators exports the state of the application for a genesis // file. -func (app *App) ExportAppStateAndValidators( - forZeroHeight bool, - jailAllowedAddrs []string, - modulesToExport []string, -) (servertypes.ExportedApp, error) { +func (app *App) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs, modulesToExport []string) (servertypes.ExportedApp, error) { // as if they could withdraw from the start of the next block - ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) + ctx := app.NewContextLegacy(true, cmtproto.Header{Height: app.LastBlockHeight()}) // We export at last height + 1, because that's the height at which - // Tendermint will start InitChain. + // CometBFT will start InitChain. height := app.LastBlockHeight() + 1 if forZeroHeight { height = 0 app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs) } - genState := app.mm.ExportGenesisForModules(ctx, app.appCodec, modulesToExport) + genState, err := app.ModuleManager.ExportGenesisForModules(ctx, app.appCodec, modulesToExport) + if err != nil { + return servertypes.ExportedApp{}, err + } + appState, err := json.MarshalIndent(genState, "", " ") if err != nil { return servertypes.ExportedApp{}, err @@ -46,10 +47,10 @@ func (app *App) ExportAppStateAndValidators( }, err } -// prepForZeroHeightGenesis prepares for a fresh genesis -// +// prepare for fresh start at zero height // NOTE zero height genesis is a temporary feature which will be deprecated -// in favour of export at a block height +// +// in favor of export at a block height func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { applyAllowedAddrs := false @@ -74,13 +75,24 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str /* Handle fee distribution state. */ // withdraw all validator commission - app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { - _, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) + err := app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + valBz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) + if err != nil { + panic(err) + } + _, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, valBz) return false }) + if err != nil { + panic(err) + } // withdraw all delegator rewards - dels := app.StakingKeeper.GetAllDelegations(ctx) + dels, err := app.StakingKeeper.GetAllDelegations(ctx) + if err != nil { + panic(err) + } + for _, delegation := range dels { valAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) if err != nil { @@ -103,14 +115,26 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str ctx = ctx.WithBlockHeight(0) // reinitialize all validators - app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + err = app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + valBz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) + if err != nil { + panic(err) + } // donate any unwithdrawn outstanding reward fraction tokens to the community pool - scraps := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, val.GetOperator()) - feePool := app.DistrKeeper.GetFeePool(ctx) + scraps, err := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, valBz) + if err != nil { + panic(err) + } + feePool, err := app.DistrKeeper.FeePool.Get(ctx) + if err != nil { + panic(err) + } feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) - app.DistrKeeper.SetFeePool(ctx, feePool) + if err := app.DistrKeeper.FeePool.Set(ctx, feePool); err != nil { + panic(err) + } - if err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()); err != nil { + if err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, valBz); err != nil { panic(err) } return false @@ -145,7 +169,10 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str for i := range red.Entries { red.Entries[i].CreationHeight = 0 } - app.StakingKeeper.SetRedelegation(ctx, red) + err = app.StakingKeeper.SetRedelegation(ctx, red) + if err != nil { + panic(err) + } return false }) @@ -154,20 +181,23 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str for i := range ubd.Entries { ubd.Entries[i].CreationHeight = 0 } - app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) + err = app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) + if err != nil { + panic(err) + } return false }) // Iterate through validators by power descending, reset bond heights, and // update bond intra-tx counters. store := ctx.KVStore(app.GetKey(stakingtypes.StoreKey)) - iter := sdk.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) + iter := storetypes.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) counter := int16(0) for ; iter.Valid(); iter.Next() { addr := sdk.ValAddress(stakingtypes.AddressFromValidatorsKey(iter.Key())) - validator, found := app.StakingKeeper.GetValidator(ctx, addr) - if !found { + validator, err := app.StakingKeeper.GetValidator(ctx, addr) + if err != nil { panic("expected validator, not found") } @@ -185,7 +215,7 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str return } - _, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) + _, err = app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) if err != nil { log.Fatal(err) } diff --git a/app/genesis.go b/app/genesis.go index 5bf0c1da8..e4e849fc2 100644 --- a/app/genesis.go +++ b/app/genesis.go @@ -2,11 +2,9 @@ package app import ( "encoding/json" - - "github.com/cosmos/cosmos-sdk/codec" ) -// The genesis state of the blockchain is represented here as a map of raw json +// GenesisState of the blockchain is represented here as a map of raw json // messages key'd by a identifier string. // The identifier is used to determine which module genesis information belongs // to so it may be appropriately routed during init chain. @@ -14,8 +12,3 @@ import ( // the ModuleBasicManager which populates json from each BasicModule // object provided to it during init. type GenesisState map[string]json.RawMessage - -// NewDefaultGenesisState generates the default state for the application. -func NewDefaultGenesisState(cdc codec.JSONCodec) GenesisState { - return ModuleBasics.DefaultGenesis(cdc) -} diff --git a/app/genesis_account.go b/app/genesis_account.go new file mode 100644 index 000000000..91ff4dfc4 --- /dev/null +++ b/app/genesis_account.go @@ -0,0 +1,47 @@ +package app + +import ( + "errors" + + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" +) + +var _ authtypes.GenesisAccount = (*GenesisAccount)(nil) + +// GenesisAccount defines a type that implements the GenesisAccount interface +// to be used for simulation accounts in the genesis state. +type GenesisAccount struct { + *authtypes.BaseAccount + + // vesting account fields + OriginalVesting sdk.Coins `json:"original_vesting" yaml:"original_vesting"` // total vesting coins upon initialization + DelegatedFree sdk.Coins `json:"delegated_free" yaml:"delegated_free"` // delegated vested coins at time of delegation + DelegatedVesting sdk.Coins `json:"delegated_vesting" yaml:"delegated_vesting"` // delegated vesting coins at time of delegation + StartTime int64 `json:"start_time" yaml:"start_time"` // vesting start time (UNIX Epoch time) + EndTime int64 `json:"end_time" yaml:"end_time"` // vesting end time (UNIX Epoch time) + + // module account fields + ModuleName string `json:"module_name" yaml:"module_name"` // name of the module account + ModulePermissions []string `json:"module_permissions" yaml:"module_permissions"` // permissions of module account +} + +// Validate checks for errors on the vesting and module account parameters +func (sga GenesisAccount) Validate() error { + if !sga.OriginalVesting.IsZero() { + if sga.StartTime >= sga.EndTime { + return errors.New("vesting start-time cannot be before end-time") + } + } + + if sga.ModuleName != "" { + ma := authtypes.ModuleAccount{ + BaseAccount: sga.BaseAccount, Name: sga.ModuleName, Permissions: sga.ModulePermissions, + } + if err := ma.Validate(); err != nil { + return err + } + } + + return sga.BaseAccount.Validate() +} diff --git a/app/ibc.go b/app/ibc.go new file mode 100644 index 000000000..2b0bd5691 --- /dev/null +++ b/app/ibc.go @@ -0,0 +1,205 @@ +package app + +import ( + "cosmossdk.io/core/appmodule" + storetypes "cosmossdk.io/store/types" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/cosmos/ibc-go/modules/capability" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + icamodule "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" + icacontroller "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller" + icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" + icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" + icahost "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host" + icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper" + icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" + icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" + ibcfeekeeper "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper" + ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + ibctransfer "github.com/cosmos/ibc-go/v8/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v8/modules/core" + ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" + porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + solomachine "github.com/cosmos/ibc-go/v8/modules/light-clients/06-solomachine" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + // this line is used by starport scaffolding # ibc/app/import +) + +// registerIBCModules register IBC keepers and non dependency inject modules. +func (app *App) registerIBCModules() { + // set up non depinject support modules store keys + if err := app.RegisterStores( + storetypes.NewKVStoreKey(capabilitytypes.StoreKey), + storetypes.NewKVStoreKey(ibcexported.StoreKey), + storetypes.NewKVStoreKey(ibctransfertypes.StoreKey), + storetypes.NewKVStoreKey(ibcfeetypes.StoreKey), + storetypes.NewKVStoreKey(icahosttypes.StoreKey), + storetypes.NewKVStoreKey(icacontrollertypes.StoreKey), + storetypes.NewMemoryStoreKey(capabilitytypes.MemStoreKey), + storetypes.NewTransientStoreKey(paramstypes.TStoreKey), + ); err != nil { + panic(err) + } + + // register the key tables for legacy param subspaces + keyTable := ibcclienttypes.ParamKeyTable() + keyTable.RegisterParamSet(&ibcconnectiontypes.Params{}) + app.ParamsKeeper.Subspace(ibcexported.ModuleName).WithKeyTable(keyTable) + app.ParamsKeeper.Subspace(ibctransfertypes.ModuleName).WithKeyTable(ibctransfertypes.ParamKeyTable()) + app.ParamsKeeper.Subspace(icacontrollertypes.SubModuleName).WithKeyTable(icacontrollertypes.ParamKeyTable()) + app.ParamsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable()) + + // add capability keeper and ScopeToModule for ibc module + app.CapabilityKeeper = capabilitykeeper.NewKeeper( + app.AppCodec(), + app.GetKey(capabilitytypes.StoreKey), + app.GetMemKey(capabilitytypes.MemStoreKey), + ) + + // add capability keeper and ScopeToModule for ibc module + scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) + scopedIBCTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) + scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) + scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) + + // Create IBC keeper + app.IBCKeeper = ibckeeper.NewKeeper( + app.appCodec, + app.GetKey(ibcexported.StoreKey), + app.GetSubspace(ibcexported.ModuleName), + app.StakingKeeper, + app.UpgradeKeeper, + scopedIBCKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + // Register the proposal types + // Deprecated: Avoid adding new handlers, instead use the new proposal flow + // by granting the governance module the right to execute the message. + // See: https://docs.cosmos.network/main/modules/gov#proposal-messages + govRouter := govv1beta1.NewRouter() + govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler) + + app.IBCFeeKeeper = ibcfeekeeper.NewKeeper( + app.appCodec, app.GetKey(ibcfeetypes.StoreKey), + app.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware + app.IBCKeeper.ChannelKeeper, + app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, + ) + + // Create IBC transfer keeper + app.TransferKeeper = ibctransferkeeper.NewKeeper( + app.appCodec, + app.GetKey(ibctransfertypes.StoreKey), + app.GetSubspace(ibctransfertypes.ModuleName), + app.IBCFeeKeeper, + app.IBCKeeper.ChannelKeeper, + app.IBCKeeper.PortKeeper, + app.AccountKeeper, + app.BankKeeper, + scopedIBCTransferKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + // Create interchain account keepers + app.ICAHostKeeper = icahostkeeper.NewKeeper( + app.appCodec, + app.GetKey(icahosttypes.StoreKey), + app.GetSubspace(icahosttypes.SubModuleName), + app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack + app.IBCKeeper.ChannelKeeper, + app.IBCKeeper.PortKeeper, + app.AccountKeeper, + scopedICAHostKeeper, + app.MsgServiceRouter(), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( + app.appCodec, + app.GetKey(icacontrollertypes.StoreKey), + app.GetSubspace(icacontrollertypes.SubModuleName), + app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack + app.IBCKeeper.ChannelKeeper, + app.IBCKeeper.PortKeeper, + scopedICAControllerKeeper, + app.MsgServiceRouter(), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + app.GovKeeper.SetLegacyRouter(govRouter) + + // Create IBC modules with ibcfee middleware + transferIBCModule := ibcfee.NewIBCMiddleware(ibctransfer.NewIBCModule(app.TransferKeeper), app.IBCFeeKeeper) + + // integration point for custom authentication modules + var noAuthzModule porttypes.IBCModule + icaControllerIBCModule := ibcfee.NewIBCMiddleware( + icacontroller.NewIBCMiddleware(noAuthzModule, app.ICAControllerKeeper), + app.IBCFeeKeeper, + ) + + icaHostIBCModule := ibcfee.NewIBCMiddleware(icahost.NewIBCModule(app.ICAHostKeeper), app.IBCFeeKeeper) + + // Create static IBC router, add transfer route, then set and seal it + ibcRouter := porttypes.NewRouter(). + AddRoute(ibctransfertypes.ModuleName, transferIBCModule). + AddRoute(icacontrollertypes.SubModuleName, icaControllerIBCModule). + AddRoute(icahosttypes.SubModuleName, icaHostIBCModule) + + // this line is used by starport scaffolding # ibc/app/module + + app.IBCKeeper.SetRouter(ibcRouter) + + app.ScopedIBCKeeper = scopedIBCKeeper + app.ScopedIBCTransferKeeper = scopedIBCTransferKeeper + app.ScopedICAHostKeeper = scopedICAHostKeeper + app.ScopedICAControllerKeeper = scopedICAControllerKeeper + + // register IBC modules + if err := app.RegisterModules( + ibc.NewAppModule(app.IBCKeeper), + ibctransfer.NewAppModule(app.TransferKeeper), + ibcfee.NewAppModule(app.IBCFeeKeeper), + icamodule.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper), + capability.NewAppModule(app.appCodec, *app.CapabilityKeeper, false), + ibctm.AppModule{}, + solomachine.AppModule{}, + ); err != nil { + panic(err) + } +} + +// Since the IBC modules don't support dependency injection, we need to +// manually register the modules on the client side. +// This needs to be removed after IBC supports App Wiring. +func RegisterIBC(registry cdctypes.InterfaceRegistry) map[string]appmodule.AppModule { + modules := map[string]appmodule.AppModule{ + ibcexported.ModuleName: ibc.AppModule{}, + ibctransfertypes.ModuleName: ibctransfer.AppModule{}, + ibcfeetypes.ModuleName: ibcfee.AppModule{}, + icatypes.ModuleName: icamodule.AppModule{}, + capabilitytypes.ModuleName: capability.AppModule{}, + ibctm.ModuleName: ibctm.AppModule{}, + solomachine.ModuleName: solomachine.AppModule{}, + } + + for _, module := range modules { + if mod, ok := module.(interface { + RegisterInterfaces(registry cdctypes.InterfaceRegistry) + }); ok { + mod.RegisterInterfaces(registry) + } + } + + return modules +} diff --git a/app/params/encoding.go b/app/params/encoding.go deleted file mode 100644 index 3d634abf1..000000000 --- a/app/params/encoding.go +++ /dev/null @@ -1,16 +0,0 @@ -package params - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/types" -) - -// EncodingConfig specifies the concrete encoding types to use for a given app. -// This is provided for compatibility between protobuf and amino implementations. -type EncodingConfig struct { - InterfaceRegistry types.InterfaceRegistry - Marshaler codec.Codec - TxConfig client.TxConfig - Amino *codec.LegacyAmino -} diff --git a/app/sim_bench_test.go b/app/sim_bench_test.go new file mode 100644 index 000000000..91d1eb1f4 --- /dev/null +++ b/app/sim_bench_test.go @@ -0,0 +1,150 @@ +package app_test + +import ( + "fmt" + "os" + "testing" + + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/server" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/app" +) + +// Profile with: +// `go test -benchmem -run=^$ -bench ^BenchmarkFullAppSimulation ./app -Commit=true -cpuprofile cpu.out` +func BenchmarkFullAppSimulation(b *testing.B) { + b.ReportAllocs() + + config := simcli.NewConfigFromFlags() + config.ChainID = SimAppChainID + + db, dir, logger, skip, err := simtestutil.SetupSimulation(config, "goleveldb-app-sim", "Simulation", simcli.FlagVerboseValue, simcli.FlagEnabledValue) + if err != nil { + b.Fatalf("simulation setup failed: %s", err.Error()) + } + + if skip { + b.Skip("skipping benchmark application simulation") + } + + defer func() { + require.NoError(b, db.Close()) + require.NoError(b, os.RemoveAll(dir)) + }() + + appOptions := make(simtestutil.AppOptionsMap, 0) + appOptions[flags.FlagHome] = app.DefaultNodeHome + appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue + + bApp, err := app.New(logger, db, nil, true, appOptions, interBlockCacheOpt()) + require.NoError(b, err) + require.Equal(b, app.Name, bApp.Name()) + + // run randomized simulation + _, simParams, simErr := simulation.SimulateFromSeed( + b, + os.Stdout, + bApp.BaseApp, + simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.DefaultGenesis()), + simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 + simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), + app.BlockedAddresses(), + config, + bApp.AppCodec(), + ) + + // export state and simParams before the simulation error is checked + if err = simtestutil.CheckExportSimulation(bApp, config, simParams); err != nil { + b.Fatal(err) + } + + if simErr != nil { + b.Fatal(simErr) + } + + if config.Commit { + simtestutil.PrintStats(db) + } +} + +func BenchmarkInvariants(b *testing.B) { + b.ReportAllocs() + + config := simcli.NewConfigFromFlags() + config.ChainID = SimAppChainID + + db, dir, logger, skip, err := simtestutil.SetupSimulation(config, "leveldb-app-invariant-bench", "Simulation", simcli.FlagVerboseValue, simcli.FlagEnabledValue) + if err != nil { + b.Fatalf("simulation setup failed: %s", err.Error()) + } + + if skip { + b.Skip("skipping benchmark application simulation") + } + + config.AllInvariants = false + + defer func() { + require.NoError(b, db.Close()) + require.NoError(b, os.RemoveAll(dir)) + }() + + appOptions := make(simtestutil.AppOptionsMap, 0) + appOptions[flags.FlagHome] = app.DefaultNodeHome + appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue + + bApp, err := app.New(logger, db, nil, true, appOptions, interBlockCacheOpt()) + require.NoError(b, err) + require.Equal(b, app.Name, bApp.Name()) + + // run randomized simulation + _, simParams, simErr := simulation.SimulateFromSeed( + b, + os.Stdout, + bApp.BaseApp, + simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.DefaultGenesis()), + simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 + simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), + app.BlockedAddresses(), + config, + bApp.AppCodec(), + ) + + // export state and simParams before the simulation error is checked + if err = simtestutil.CheckExportSimulation(bApp, config, simParams); err != nil { + b.Fatal(err) + } + + if simErr != nil { + b.Fatal(simErr) + } + + if config.Commit { + simtestutil.PrintStats(db) + } + + ctx := bApp.NewContextLegacy(true, cmtproto.Header{Height: bApp.LastBlockHeight() + 1}) + + // 3. Benchmark each invariant separately + // + // NOTE: We use the crisis keeper as it has all the invariants registered with + // their respective metadata which makes it useful for testing/benchmarking. + for _, cr := range bApp.CrisisKeeper.Routes() { + cr := cr + b.Run(fmt.Sprintf("%s/%s", cr.ModuleName, cr.Route), func(b *testing.B) { + if res, stop := cr.Invar(ctx); stop { + b.Fatalf( + "broken invariant at block %d of %d\n%s", + ctx.BlockHeight()-1, config.NumBlocks, res, + ) + } + }) + } +} diff --git a/app/simulation_test.go b/app/sim_test.go similarity index 52% rename from app/simulation_test.go rename to app/sim_test.go index ee0ed33ad..c40e55ef6 100644 --- a/app/simulation_test.go +++ b/app/sim_test.go @@ -2,6 +2,7 @@ package app_test import ( "encoding/json" + "flag" "fmt" "math/rand" "os" @@ -10,44 +11,39 @@ import ( "testing" "time" - dbm "github.com/cometbft/cometbft-db" + "cosmossdk.io/log" + "cosmossdk.io/store" + storetypes "cosmossdk.io/store/types" + "cosmossdk.io/x/feegrant" abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/server" - storetypes "github.com/cosmos/cosmos-sdk/store/types" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - sdk "github.com/cosmos/cosmos-sdk/types" simulationtypes "github.com/cosmos/cosmos-sdk/types/simulation" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/cosmos/cosmos-sdk/x/simulation" simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/spf13/viper" "github.com/stretchr/testify/require" "github.com/pokt-network/poktroll/app" ) -type storeKeysPrefixes struct { - A storetypes.StoreKey - B storetypes.StoreKey - Prefixes [][]byte -} +const ( + SimAppChainID = "poktroll-simapp" +) + +var FlagEnableStreamingValue bool // Get flags every time the simulator is run func init() { simcli.GetSimulatorFlags() + flag.BoolVar(&FlagEnableStreamingValue, "EnableStreaming", false, "Enable streaming service") } // fauxMerkleModeOpt returns a BaseApp option to use a dbStoreAdapter instead of @@ -56,9 +52,15 @@ func fauxMerkleModeOpt(bapp *baseapp.BaseApp) { bapp.SetFauxMerkleMode() } +// interBlockCacheOpt returns a BaseApp option function that sets the persistent +// inter-block write-through cache. +func interBlockCacheOpt() func(*baseapp.BaseApp) { + return baseapp.SetInterBlockCache(store.NewCommitKVStoreCacheManager()) +} + // BenchmarkSimulation run the chain simulation // Running using starport command: -// `starport chain simulate -v --numBlocks 200 --blockSize 50` +// `ignite chain simulate -v --numBlocks 200 --blockSize 50` // Running as go benchmark test: // `go test -benchmem -run=^$ -bench ^BenchmarkSimulation ./app -NumBlocks=200 -BlockSize 50 -Commit=true -Verbose=true -Enabled=true` func BenchmarkSimulation(b *testing.B) { @@ -68,37 +70,25 @@ func BenchmarkSimulation(b *testing.B) { simcli.FlagEnabledValue = true config := simcli.NewConfigFromFlags() - config.ChainID = "mars-simapp" - db, dir, logger, _, err := simtestutil.SetupSimulation( - config, - "leveldb-bApp-sim", - "Simulation", - simcli.FlagVerboseValue, - simcli.FlagEnabledValue, - ) + config.ChainID = SimAppChainID + + db, dir, logger, skip, err := simtestutil.SetupSimulation(config, "leveldb-app-sim", "Simulation", simcli.FlagVerboseValue, simcli.FlagEnabledValue) + if skip { + b.Skip("skipping application simulation") + } require.NoError(b, err, "simulation setup failed") - b.Cleanup(func() { + defer func() { require.NoError(b, db.Close()) require.NoError(b, os.RemoveAll(dir)) - }) + }() appOptions := make(simtestutil.AppOptionsMap, 0) appOptions[flags.FlagHome] = app.DefaultNodeHome appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue - bApp := app.New( - logger, - db, - nil, - true, - map[int64]bool{}, - app.DefaultNodeHome, - 0, - app.MakeEncodingConfig(), - appOptions, - baseapp.SetChainID(config.ChainID), - ) + bApp, err := app.New(logger, db, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + require.NoError(b, err) require.Equal(b, app.Name, bApp.Name()) // run randomized simulation @@ -106,14 +96,10 @@ func BenchmarkSimulation(b *testing.B) { b, os.Stdout, bApp.BaseApp, - simtestutil.AppStateFn( - bApp.AppCodec(), - bApp.SimulationManager(), - app.NewDefaultGenesisState(bApp.AppCodec()), - ), + simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.DefaultGenesis()), simulationtypes.RandomAccounts, simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), - bApp.ModuleAccountAddrs(), + app.BlockedAddresses(), config, bApp.AppCodec(), ) @@ -128,105 +114,11 @@ func BenchmarkSimulation(b *testing.B) { } } -func TestAppStateDeterminism(t *testing.T) { - if !simcli.FlagEnabledValue { - t.Skip("skipping application simulation") - } - - config := simcli.NewConfigFromFlags() - config.InitialBlockHeight = 1 - config.ExportParamsPath = "" - config.OnOperation = true - config.AllInvariants = true - - var ( - r = rand.New(rand.NewSource(time.Now().Unix())) - numSeeds = 3 - numTimesToRunPerSeed = 5 - appHashList = make([]json.RawMessage, numTimesToRunPerSeed) - appOptions = make(simtestutil.AppOptionsMap, 0) - ) - appOptions[flags.FlagHome] = app.DefaultNodeHome - appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue - - for i := 0; i < numSeeds; i++ { - config.Seed = r.Int63() - - for j := 0; j < numTimesToRunPerSeed; j++ { - var logger log.Logger - if simcli.FlagVerboseValue { - logger = log.TestingLogger() - } else { - logger = log.NewNopLogger() - } - chainID := fmt.Sprintf("chain-id-%d-%d", i, j) - config.ChainID = chainID - - db := dbm.NewMemDB() - bApp := app.New( - logger, - db, - nil, - true, - map[int64]bool{}, - app.DefaultNodeHome, - simcli.FlagPeriodValue, - app.MakeEncodingConfig(), - appOptions, - fauxMerkleModeOpt, - baseapp.SetChainID(chainID), - ) - - fmt.Printf( - "running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n", - config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, - ) - - _, _, err := simulation.SimulateFromSeed( - t, - os.Stdout, - bApp.BaseApp, - simtestutil.AppStateFn( - bApp.AppCodec(), - bApp.SimulationManager(), - app.NewDefaultGenesisState(bApp.AppCodec()), - ), - simulationtypes.RandomAccounts, - simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), - bApp.ModuleAccountAddrs(), - config, - bApp.AppCodec(), - ) - require.NoError(t, err) - - if config.Commit { - simtestutil.PrintStats(db) - } - - appHash := bApp.LastCommitID().Hash - appHashList[j] = appHash - - if j != 0 { - require.Equal( - t, string(appHashList[0]), string(appHashList[j]), - "non-determinism in seed %d: %d/%d, attempt: %d/%d\n", config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, - ) - } - } - } -} - func TestAppImportExport(t *testing.T) { config := simcli.NewConfigFromFlags() - config.ChainID = "mars-simapp-import" + config.ChainID = SimAppChainID - db, dir, logger, skip, err := simtestutil.SetupSimulation( - config, - "leveldb-app-sim", - "Simulation", - simcli.FlagVerboseValue, - simcli.FlagEnabledValue, - ) + db, dir, logger, skip, err := simtestutil.SetupSimulation(config, "leveldb-app-sim", "Simulation", simcli.FlagVerboseValue, simcli.FlagEnabledValue) if skip { t.Skip("skipping application import/export simulation") } @@ -241,41 +133,27 @@ func TestAppImportExport(t *testing.T) { appOptions[flags.FlagHome] = app.DefaultNodeHome appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue - bApp := app.New( - logger, - db, - nil, - true, - map[int64]bool{}, - app.DefaultNodeHome, - 0, - app.MakeEncodingConfig(), - appOptions, - baseapp.SetChainID(config.ChainID), - ) + bApp, err := app.New(logger, db, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + require.NoError(t, err) require.Equal(t, app.Name, bApp.Name()) - // run randomized simulation + // Run randomized simulation _, simParams, simErr := simulation.SimulateFromSeed( t, os.Stdout, bApp.BaseApp, - simtestutil.AppStateFn( - bApp.AppCodec(), - bApp.SimulationManager(), - app.NewDefaultGenesisState(bApp.AppCodec()), - ), + simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.DefaultGenesis()), simulationtypes.RandomAccounts, simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), - bApp.BlockedModuleAccountAddrs(), + app.BlockedAddresses(), config, bApp.AppCodec(), ) - require.NoError(t, simErr) // export state and simParams before the simulation error is checked err = simtestutil.CheckExportSimulation(bApp, config, simParams) require.NoError(t, err) + require.NoError(t, simErr) if config.Commit { simtestutil.PrintStats(db) @@ -288,13 +166,7 @@ func TestAppImportExport(t *testing.T) { fmt.Printf("importing genesis...\n") - newDB, newDir, _, _, err := simtestutil.SetupSimulation( - config, - "leveldb-app-sim-2", - "Simulation-2", - simcli.FlagVerboseValue, - simcli.FlagEnabledValue, - ) + newDB, newDir, _, _, err := simtestutil.SetupSimulation(config, "leveldb-app-sim-2", "Simulation-2", simcli.FlagVerboseValue, simcli.FlagEnabledValue) require.NoError(t, err, "simulation setup failed") defer func() { @@ -302,85 +174,71 @@ func TestAppImportExport(t *testing.T) { require.NoError(t, os.RemoveAll(newDir)) }() - newApp := app.New( - log.NewNopLogger(), - newDB, - nil, - true, - map[int64]bool{}, - app.DefaultNodeHome, - 0, - app.MakeEncodingConfig(), - appOptions, - baseapp.SetChainID(config.ChainID), - ) - require.Equal(t, app.Name, bApp.Name()) + newApp, err := app.New(log.NewNopLogger(), newDB, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + require.NoError(t, err) + require.Equal(t, app.Name, newApp.Name()) var genesisState app.GenesisState err = json.Unmarshal(exported.AppState, &genesisState) require.NoError(t, err) - defer func() { - if r := recover(); r != nil { - err := fmt.Sprintf("%v", r) - if !strings.Contains(err, "validator set is empty after InitGenesis") { - panic(r) - } + ctxA := bApp.NewContextLegacy(true, cmtproto.Header{Height: bApp.LastBlockHeight()}) + ctxB := newApp.NewContextLegacy(true, cmtproto.Header{Height: bApp.LastBlockHeight()}) + _, err = newApp.ModuleManager.InitGenesis(ctxB, bApp.AppCodec(), genesisState) + + if err != nil { + if strings.Contains(err.Error(), "validator set is empty after InitGenesis") { logger.Info("Skipping simulation as all validators have been unbonded") logger.Info("err", err, "stacktrace", string(debug.Stack())) + return } - }() - - ctxA := bApp.NewContext(true, tmproto.Header{Height: bApp.LastBlockHeight()}) - ctxB := newApp.NewContext(true, tmproto.Header{Height: bApp.LastBlockHeight()}) - newApp.ModuleManager().InitGenesis(ctxB, bApp.AppCodec(), genesisState) - newApp.StoreConsensusParams(ctxB, exported.ConsensusParams) - + } + require.NoError(t, err) + err = newApp.StoreConsensusParams(ctxB, exported.ConsensusParams) + require.NoError(t, err) fmt.Printf("comparing stores...\n") - storeKeysPrefixes := []storeKeysPrefixes{ - {bApp.GetKey(authtypes.StoreKey), newApp.GetKey(authtypes.StoreKey), [][]byte{}}, - { - bApp.GetKey(stakingtypes.StoreKey), newApp.GetKey(stakingtypes.StoreKey), - [][]byte{ - stakingtypes.UnbondingQueueKey, stakingtypes.RedelegationQueueKey, stakingtypes.ValidatorQueueKey, - stakingtypes.HistoricalInfoKey, stakingtypes.UnbondingIDKey, stakingtypes.UnbondingIndexKey, stakingtypes.UnbondingTypeKey, stakingtypes.ValidatorUpdatesKey, - }, - }, // ordering may change but it doesn't matter - {bApp.GetKey(slashingtypes.StoreKey), newApp.GetKey(slashingtypes.StoreKey), [][]byte{}}, - {bApp.GetKey(minttypes.StoreKey), newApp.GetKey(minttypes.StoreKey), [][]byte{}}, - {bApp.GetKey(distrtypes.StoreKey), newApp.GetKey(distrtypes.StoreKey), [][]byte{}}, - {bApp.GetKey(banktypes.StoreKey), newApp.GetKey(banktypes.StoreKey), [][]byte{banktypes.BalancesPrefix}}, - {bApp.GetKey(paramstypes.StoreKey), newApp.GetKey(paramstypes.StoreKey), [][]byte{}}, - {bApp.GetKey(govtypes.StoreKey), newApp.GetKey(govtypes.StoreKey), [][]byte{}}, - {bApp.GetKey(evidencetypes.StoreKey), newApp.GetKey(evidencetypes.StoreKey), [][]byte{}}, - {bApp.GetKey(capabilitytypes.StoreKey), newApp.GetKey(capabilitytypes.StoreKey), [][]byte{}}, - {bApp.GetKey(authzkeeper.StoreKey), newApp.GetKey(authzkeeper.StoreKey), [][]byte{authzkeeper.GrantKey, authzkeeper.GrantQueuePrefix}}, + // skip certain prefixes + skipPrefixes := map[string][][]byte{ + stakingtypes.StoreKey: { + stakingtypes.UnbondingQueueKey, stakingtypes.RedelegationQueueKey, stakingtypes.ValidatorQueueKey, + stakingtypes.HistoricalInfoKey, stakingtypes.UnbondingIDKey, stakingtypes.UnbondingIndexKey, + stakingtypes.UnbondingTypeKey, stakingtypes.ValidatorUpdatesKey, + }, + authzkeeper.StoreKey: {authzkeeper.GrantQueuePrefix}, + feegrant.StoreKey: {feegrant.FeeAllowanceQueueKeyPrefix}, + slashingtypes.StoreKey: {slashingtypes.ValidatorMissedBlockBitmapKeyPrefix}, } - for _, skp := range storeKeysPrefixes { - storeA := ctxA.KVStore(skp.A) - storeB := ctxB.KVStore(skp.B) + storeKeys := bApp.GetStoreKeys() + require.NotEmpty(t, storeKeys) - failedKVAs, failedKVBs := sdk.DiffKVStores(storeA, storeB, skp.Prefixes) - require.Equal(t, len(failedKVAs), len(failedKVBs), "unequal sets of key-values to compare") + for _, appKeyA := range storeKeys { + // only compare kvstores + if _, ok := appKeyA.(*storetypes.KVStoreKey); !ok { + continue + } - fmt.Printf("compared %d different key/value pairs between %s and %s\n", len(failedKVAs), skp.A, skp.B) - require.Equal(t, 0, len(failedKVAs), simtestutil.GetSimulationLog(skp.A.Name(), bApp.SimulationManager().StoreDecoders, failedKVAs, failedKVBs)) + keyName := appKeyA.Name() + appKeyB := newApp.GetKey(keyName) + + storeA := ctxA.KVStore(appKeyA) + storeB := ctxB.KVStore(appKeyB) + + failedKVAs, failedKVBs := simtestutil.DiffKVStores(storeA, storeB, skipPrefixes[keyName]) + require.Equal(t, len(failedKVAs), len(failedKVBs), "unequal sets of key-values to compare %s", keyName) + + fmt.Printf("compared %d different key/value pairs between %s and %s\n", len(failedKVAs), appKeyA, appKeyB) + + require.Equal(t, 0, len(failedKVAs), simtestutil.GetSimulationLog(keyName, bApp.SimulationManager().StoreDecoders, failedKVAs, failedKVBs)) } } func TestAppSimulationAfterImport(t *testing.T) { config := simcli.NewConfigFromFlags() - config.ChainID = "mars-simapp-after-import" + config.ChainID = SimAppChainID - db, dir, logger, skip, err := simtestutil.SetupSimulation( - config, - "leveldb-app-sim", - "Simulation", - simcli.FlagVerboseValue, - simcli.FlagEnabledValue, - ) + db, dir, logger, skip, err := simtestutil.SetupSimulation(config, "leveldb-app-sim", "Simulation", simcli.FlagVerboseValue, simcli.FlagEnabledValue) if skip { t.Skip("skipping application simulation after import") } @@ -395,42 +253,27 @@ func TestAppSimulationAfterImport(t *testing.T) { appOptions[flags.FlagHome] = app.DefaultNodeHome appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue - bApp := app.New( - logger, - db, - nil, - true, - map[int64]bool{}, - app.DefaultNodeHome, - 0, - app.MakeEncodingConfig(), - appOptions, - fauxMerkleModeOpt, - baseapp.SetChainID(config.ChainID), - ) + bApp, err := app.New(logger, db, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + require.NoError(t, err) require.Equal(t, app.Name, bApp.Name()) - // run randomized simulation + // Run randomized simulation stopEarly, simParams, simErr := simulation.SimulateFromSeed( t, os.Stdout, bApp.BaseApp, - simtestutil.AppStateFn( - bApp.AppCodec(), - bApp.SimulationManager(), - app.NewDefaultGenesisState(bApp.AppCodec()), - ), + simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.DefaultGenesis()), simulationtypes.RandomAccounts, simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), - bApp.BlockedModuleAccountAddrs(), + app.BlockedAddresses(), config, bApp.AppCodec(), ) - require.NoError(t, simErr) // export state and simParams before the simulation error is checked err = simtestutil.CheckExportSimulation(bApp, config, simParams) require.NoError(t, err) + require.NoError(t, simErr) if config.Commit { simtestutil.PrintStats(db) @@ -448,13 +291,7 @@ func TestAppSimulationAfterImport(t *testing.T) { fmt.Printf("importing genesis...\n") - newDB, newDir, _, _, err := simtestutil.SetupSimulation( - config, - "leveldb-app-sim-2", - "Simulation-2", - simcli.FlagVerboseValue, - simcli.FlagEnabledValue, - ) + newDB, newDir, _, _, err := simtestutil.SetupSimulation(config, "leveldb-app-sim-2", "Simulation-2", simcli.FlagVerboseValue, simcli.FlagEnabledValue) require.NoError(t, err, "simulation setup failed") defer func() { @@ -462,40 +299,129 @@ func TestAppSimulationAfterImport(t *testing.T) { require.NoError(t, os.RemoveAll(newDir)) }() - newApp := app.New( - log.NewNopLogger(), - newDB, - nil, - true, - map[int64]bool{}, - app.DefaultNodeHome, - 0, - app.MakeEncodingConfig(), - appOptions, - fauxMerkleModeOpt, - baseapp.SetChainID(config.ChainID), - ) - require.Equal(t, app.Name, bApp.Name()) + newApp, err := app.New(log.NewNopLogger(), newDB, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + require.NoError(t, err) + require.Equal(t, app.Name, newApp.Name()) - newApp.InitChain(abci.RequestInitChain{ - ChainId: config.ChainID, + _, err = newApp.InitChain(&abci.RequestInitChain{ AppStateBytes: exported.AppState, + ChainId: SimAppChainID, }) + require.NoError(t, err) _, _, err = simulation.SimulateFromSeed( t, os.Stdout, newApp.BaseApp, - simtestutil.AppStateFn( - bApp.AppCodec(), - bApp.SimulationManager(), - app.NewDefaultGenesisState(bApp.AppCodec()), - ), + simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.DefaultGenesis()), simulationtypes.RandomAccounts, simtestutil.SimulationOperations(newApp, newApp.AppCodec(), config), - newApp.BlockedModuleAccountAddrs(), + app.BlockedAddresses(), config, bApp.AppCodec(), ) require.NoError(t, err) } + +func TestAppStateDeterminism(t *testing.T) { + if !simcli.FlagEnabledValue { + t.Skip("skipping application simulation") + } + + config := simcli.NewConfigFromFlags() + config.InitialBlockHeight = 1 + config.ExportParamsPath = "" + config.OnOperation = true + config.AllInvariants = true + + numSeeds := 3 + numTimesToRunPerSeed := 3 // This used to be set to 5, but we've temporarily reduced it to 3 for the sake of faster CI. + appHashList := make([]json.RawMessage, numTimesToRunPerSeed) + + // We will be overriding the random seed and just run a single simulation on the provided seed value + if config.Seed != simcli.DefaultSeedValue { + numSeeds = 1 + } + + appOptions := viper.New() + if FlagEnableStreamingValue { + m := make(map[string]interface{}) + m["streaming.abci.keys"] = []string{"*"} + m["streaming.abci.plugin"] = "abci_v1" + m["streaming.abci.stop-node-on-err"] = true + for key, value := range m { + appOptions.SetDefault(key, value) + } + } + appOptions.SetDefault(flags.FlagHome, app.DefaultNodeHome) + appOptions.SetDefault(server.FlagInvCheckPeriod, simcli.FlagPeriodValue) + if simcli.FlagVerboseValue { + appOptions.SetDefault(flags.FlagLogLevel, "debug") + } + + for i := 0; i < numSeeds; i++ { + if config.Seed == simcli.DefaultSeedValue { + config.Seed = rand.Int63() + } + fmt.Println("config.Seed: ", config.Seed) + + for j := 0; j < numTimesToRunPerSeed; j++ { + var logger log.Logger + if simcli.FlagVerboseValue { + logger = log.NewTestLogger(t) + } else { + logger = log.NewNopLogger() + } + chainID := fmt.Sprintf("chain-id-%d-%d", i, j) + config.ChainID = chainID + + db := dbm.NewMemDB() + bApp, err := app.New( + logger, + db, + nil, + true, + appOptions, + interBlockCacheOpt(), + baseapp.SetChainID(chainID), + ) + require.NoError(t, err) + + fmt.Printf( + "running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n", + config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, + ) + + _, _, err = simulation.SimulateFromSeed( + t, + os.Stdout, + bApp.BaseApp, + simtestutil.AppStateFn( + bApp.AppCodec(), + bApp.SimulationManager(), + bApp.DefaultGenesis(), + ), + simulationtypes.RandomAccounts, + simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), + app.BlockedAddresses(), + config, + bApp.AppCodec(), + ) + require.NoError(t, err) + + if config.Commit { + simtestutil.PrintStats(db) + } + + appHash := bApp.LastCommitID().Hash + appHashList[j] = appHash + + if j != 0 { + require.Equal( + t, string(appHashList[0]), string(appHashList[j]), + "non-determinism in seed %d: %d/%d, attempt: %d/%d\n", config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, + ) + } + } + } +} diff --git a/buf.work.yaml b/buf.work.yaml new file mode 100644 index 000000000..1b4a0d95c --- /dev/null +++ b/buf.work.yaml @@ -0,0 +1,8 @@ +# Generated by "buf config migrate-v1beta1". Edit as necessary, and +# remove this comment when you're finished. +# +# This workspace file points to the roots found in your +# previous "buf.yaml" configuration. +version: v1 +directories: + - proto diff --git a/cmd/pocketd/cmd/config.go b/cmd/pocketd/cmd/config.go deleted file mode 100644 index 1182b1159..000000000 --- a/cmd/pocketd/cmd/config.go +++ /dev/null @@ -1,27 +0,0 @@ -package cmd - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/app" -) - -// InitSDKConfig initializes the SDK's config with the appropriate parameters -// and prefixes so everything is named appropriately for Pocket Network. -// TODO_DISCUSS: Exporting publically for testing purposes only. -// Consider adding a helper per the discussion here: https://github.com/pokt-network/poktroll/pull/59#discussion_r1357816798 -func InitSDKConfig() { - // Set prefixes - accountPubKeyPrefix := app.AccountAddressPrefix + "pub" - validatorAddressPrefix := app.AccountAddressPrefix + "valoper" - validatorPubKeyPrefix := app.AccountAddressPrefix + "valoperpub" - consNodeAddressPrefix := app.AccountAddressPrefix + "valcons" - consNodePubKeyPrefix := app.AccountAddressPrefix + "valconspub" - - // Set and seal config - config := sdk.GetConfig() - config.SetBech32PrefixForAccount(app.AccountAddressPrefix, accountPubKeyPrefix) - config.SetBech32PrefixForValidator(validatorAddressPrefix, validatorPubKeyPrefix) - config.SetBech32PrefixForConsensusNode(consNodeAddressPrefix, consNodePubKeyPrefix) - config.Seal() -} diff --git a/cmd/pocketd/cmd/genaccounts.go b/cmd/pocketd/cmd/genaccounts.go deleted file mode 100644 index d5ec65337..000000000 --- a/cmd/pocketd/cmd/genaccounts.go +++ /dev/null @@ -1,192 +0,0 @@ -package cmd - -import ( - "bufio" - "encoding/json" - "errors" - "fmt" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/server" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/genutil" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - "github.com/spf13/cobra" -) - -const ( - flagVestingStart = "vesting-start-time" - flagVestingEnd = "vesting-end-time" - flagVestingAmt = "vesting-amount" -) - -// AddGenesisAccountCmd returns add-genesis-account cobra Command. -func AddGenesisAccountCmd(defaultNodeHome string) *cobra.Command { - cmd := &cobra.Command{ - Use: "add-genesis-account [address_or_key_name] [coin][,[coin]]", - Short: "Add a genesis account to genesis.json", - Long: `Add a genesis account to genesis.json. The provided account must specify -the account address or key name and a list of initial coins. If a key name is given, -the address will be looked up in the local Keybase. The list of initial tokens must -contain valid denominations. Accounts may optionally be supplied with vesting parameters. -`, - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - cdc := clientCtx.Codec - - serverCtx := server.GetServerContextFromCmd(cmd) - config := serverCtx.Config - - config.SetRoot(clientCtx.HomeDir) - - coins, err := sdk.ParseCoinsNormalized(args[1]) - if err != nil { - return fmt.Errorf("failed to parse coins: %w", err) - } - - addr, err := sdk.AccAddressFromBech32(args[0]) - if err != nil { - inBuf := bufio.NewReader(cmd.InOrStdin()) - keyringBackend, err := cmd.Flags().GetString(flags.FlagKeyringBackend) - if err != nil { - return err - } - - // attempt to lookup address from Keybase if no address was provided - kb, err := keyring.New(sdk.KeyringServiceName(), keyringBackend, clientCtx.HomeDir, inBuf, cdc) - if err != nil { - return err - } - - info, err := kb.Key(args[0]) - if err != nil { - return fmt.Errorf("failed to get address from Keybase: %w", err) - } - - addr, err = info.GetAddress() - if err != nil { - return fmt.Errorf("failed to get address from Keybase: %w", err) - } - } - - vestingStart, err := cmd.Flags().GetInt64(flagVestingStart) - if err != nil { - return err - } - vestingEnd, err := cmd.Flags().GetInt64(flagVestingEnd) - if err != nil { - return err - } - vestingAmtStr, err := cmd.Flags().GetString(flagVestingAmt) - if err != nil { - return err - } - - vestingAmt, err := sdk.ParseCoinsNormalized(vestingAmtStr) - if err != nil { - return fmt.Errorf("failed to parse vesting amount: %w", err) - } - - // create concrete account type based on input parameters - var genAccount authtypes.GenesisAccount - - balances := banktypes.Balance{Address: addr.String(), Coins: coins.Sort()} - baseAccount := authtypes.NewBaseAccount(addr, nil, 0, 0) - - if !vestingAmt.IsZero() { - baseVestingAccount := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd) - - if (balances.Coins.IsZero() && !baseVestingAccount.OriginalVesting.IsZero()) || - baseVestingAccount.OriginalVesting.IsAnyGT(balances.Coins) { - return errors.New("vesting amount cannot be greater than total amount") - } - - switch { - case vestingStart != 0 && vestingEnd != 0: - genAccount = authvesting.NewContinuousVestingAccountRaw(baseVestingAccount, vestingStart) - - case vestingEnd != 0: - genAccount = authvesting.NewDelayedVestingAccountRaw(baseVestingAccount) - - default: - return errors.New("invalid vesting parameters; must supply start and end time or end time") - } - } else { - genAccount = baseAccount - } - - if err := genAccount.Validate(); err != nil { - return fmt.Errorf("failed to validate new genesis account: %w", err) - } - - genFile := config.GenesisFile() - appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile) - if err != nil { - return fmt.Errorf("failed to unmarshal genesis state: %w", err) - } - - authGenState := authtypes.GetGenesisStateFromAppState(cdc, appState) - - accs, err := authtypes.UnpackAccounts(authGenState.Accounts) - if err != nil { - return fmt.Errorf("failed to get accounts from any: %w", err) - } - - if accs.Contains(addr) { - return fmt.Errorf("cannot add account at existing address %s", addr) - } - - // Add the new account to the set of genesis accounts and sanitize the - // accounts afterwards. - accs = append(accs, genAccount) - accs = authtypes.SanitizeGenesisAccounts(accs) - - genAccs, err := authtypes.PackAccounts(accs) - if err != nil { - return fmt.Errorf("failed to convert accounts into any's: %w", err) - } - authGenState.Accounts = genAccs - - authGenStateBz, err := cdc.MarshalJSON(&authGenState) - if err != nil { - return fmt.Errorf("failed to marshal auth genesis state: %w", err) - } - - appState[authtypes.ModuleName] = authGenStateBz - - bankGenState := banktypes.GetGenesisStateFromAppState(cdc, appState) - bankGenState.Balances = append(bankGenState.Balances, balances) - bankGenState.Balances = banktypes.SanitizeGenesisBalances(bankGenState.Balances) - - bankGenStateBz, err := cdc.MarshalJSON(bankGenState) - if err != nil { - return fmt.Errorf("failed to marshal bank genesis state: %w", err) - } - - appState[banktypes.ModuleName] = bankGenStateBz - - appStateJSON, err := json.Marshal(appState) - if err != nil { - return fmt.Errorf("failed to marshal application genesis state: %w", err) - } - - genDoc.AppState = appStateJSON - return genutil.ExportGenesisFile(genDoc, genFile) - }, - } - - cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|kwallet|pass|test)") - cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") - cmd.Flags().String(flagVestingAmt, "", "amount of coins for vesting accounts") - cmd.Flags().Int64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts") - cmd.Flags().Int64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts") - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/cmd/pocketd/cmd/root.go b/cmd/pocketd/cmd/root.go deleted file mode 100644 index 55b7071fc..000000000 --- a/cmd/pocketd/cmd/root.go +++ /dev/null @@ -1,386 +0,0 @@ -package cmd - -import ( - "errors" - "io" - "os" - "path/filepath" - "strings" - - // this line is used by starport scaffolding # root/moduleImport - - dbm "github.com/cometbft/cometbft-db" - tmcfg "github.com/cometbft/cometbft/config" - tmcli "github.com/cometbft/cometbft/libs/cli" - "github.com/cometbft/cometbft/libs/log" - tmtypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/config" - "github.com/cosmos/cosmos-sdk/client/debug" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/keys" - "github.com/cosmos/cosmos-sdk/client/rpc" - "github.com/cosmos/cosmos-sdk/server" - serverconfig "github.com/cosmos/cosmos-sdk/server/config" - servertypes "github.com/cosmos/cosmos-sdk/server/types" - "github.com/cosmos/cosmos-sdk/snapshots" - snapshottypes "github.com/cosmos/cosmos-sdk/snapshots/types" - "github.com/cosmos/cosmos-sdk/store" - sdk "github.com/cosmos/cosmos-sdk/types" - authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" - "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/crisis" - "github.com/cosmos/cosmos-sdk/x/genutil" - genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - "github.com/spf13/cast" - "github.com/spf13/cobra" - "github.com/spf13/pflag" - - // this line is used by starport scaffolding # root/moduleImport - - "github.com/pokt-network/poktroll/app" - appparams "github.com/pokt-network/poktroll/app/params" - appgateservercmd "github.com/pokt-network/poktroll/pkg/appgateserver/cmd" - relayercmd "github.com/pokt-network/poktroll/pkg/relayer/cmd" -) - -// NewRootCmd creates a new root command for a Cosmos SDK application -func NewRootCmd() (*cobra.Command, appparams.EncodingConfig) { - encodingConfig := app.MakeEncodingConfig() - initClientCtx := client.Context{}. - WithCodec(encodingConfig.Marshaler). - WithInterfaceRegistry(encodingConfig.InterfaceRegistry). - WithTxConfig(encodingConfig.TxConfig). - WithLegacyAmino(encodingConfig.Amino). - WithInput(os.Stdin). - WithAccountRetriever(types.AccountRetriever{}). - WithHomeDir(app.DefaultNodeHome). - WithViper("") - - rootCmd := &cobra.Command{ - Use: app.Name + "d", - Short: "Start pocket node", - PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { - // set the default command outputs - cmd.SetOut(cmd.OutOrStdout()) - cmd.SetErr(cmd.ErrOrStderr()) - initClientCtx, err := client.ReadPersistentCommandFlags(initClientCtx, cmd.Flags()) - if err != nil { - return err - } - initClientCtx, err = config.ReadFromClientConfig(initClientCtx) - if err != nil { - return err - } - - if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil { - return err - } - - customAppTemplate, customAppConfig := initAppConfig() - customTMConfig := initTendermintConfig() - return server.InterceptConfigsPreRunHandler( - cmd, customAppTemplate, customAppConfig, customTMConfig, - ) - }, - } - - initRootCmd(rootCmd, encodingConfig) - overwriteFlagDefaults(rootCmd, map[string]string{ - flags.FlagChainID: strings.ReplaceAll(app.Name, "-", ""), - flags.FlagKeyringBackend: "test", - }) - - return rootCmd, encodingConfig -} - -// initTendermintConfig helps to override default Tendermint Config values. -// return tmcfg.DefaultConfig if no custom configuration is required for the application. -func initTendermintConfig() *tmcfg.Config { - cfg := tmcfg.DefaultConfig() - return cfg -} - -func initRootCmd( - rootCmd *cobra.Command, - encodingConfig appparams.EncodingConfig, -) { - // Set config - InitSDKConfig() - - gentxModule := app.ModuleBasics[genutiltypes.ModuleName].(genutil.AppModuleBasic) - rootCmd.AddCommand( - genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome), - genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome, gentxModule.GenTxValidator), - genutilcli.MigrateGenesisCmd(), - genutilcli.GenTxCmd( - app.ModuleBasics, - encodingConfig.TxConfig, - banktypes.GenesisBalancesIterator{}, - app.DefaultNodeHome, - ), - genutilcli.ValidateGenesisCmd(app.ModuleBasics), - AddGenesisAccountCmd(app.DefaultNodeHome), - tmcli.NewCompletionCmd(rootCmd, true), - debug.Cmd(), - config.Cmd(), - // this line is used by starport scaffolding # root/commands - ) - - a := appCreator{ - encodingConfig, - } - - // add server commands - server.AddCommands( - rootCmd, - app.DefaultNodeHome, - a.newApp, - a.appExport, - addModuleInitFlags, - ) - - // add relayer command - rootCmd.AddCommand( - relayercmd.RelayerCmd(), - ) - - // add keybase, auxiliary RPC, query, and tx child commands - rootCmd.AddCommand( - rpc.StatusCommand(), - queryCommand(), - txCommand(), - keys.Commands(app.DefaultNodeHome), - ) - - // add the appgate server command - rootCmd.AddCommand( - appgateservercmd.AppGateServerCmd(), - ) -} - -// queryCommand returns the sub-command to send queries to the app -func queryCommand() *cobra.Command { - cmd := &cobra.Command{ - Use: "query", - Aliases: []string{"q"}, - Short: "Querying subcommands", - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - authcmd.GetAccountCmd(), - rpc.ValidatorCommand(), - rpc.BlockCommand(), - authcmd.QueryTxsByEventsCmd(), - authcmd.QueryTxCmd(), - ) - - app.ModuleBasics.AddQueryCommands(cmd) - cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") - - return cmd -} - -// txCommand returns the sub-command to send transactions to the app -func txCommand() *cobra.Command { - cmd := &cobra.Command{ - Use: "tx", - Short: "Transactions subcommands", - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - authcmd.GetSignCommand(), - authcmd.GetSignBatchCommand(), - authcmd.GetMultiSignCommand(), - authcmd.GetValidateSignaturesCommand(), - flags.LineBreak, - authcmd.GetBroadcastCommand(), - authcmd.GetEncodeCommand(), - authcmd.GetDecodeCommand(), - ) - - app.ModuleBasics.AddTxCommands(cmd) - cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") - - return cmd -} - -func addModuleInitFlags(startCmd *cobra.Command) { - crisis.AddModuleInitFlags(startCmd) - // this line is used by starport scaffolding # root/arguments -} - -func overwriteFlagDefaults(c *cobra.Command, defaults map[string]string) { - set := func(s *pflag.FlagSet, key, val string) { - if f := s.Lookup(key); f != nil { - f.DefValue = val - f.Value.Set(val) - } - } - for key, val := range defaults { - set(c.Flags(), key, val) - set(c.PersistentFlags(), key, val) - } - for _, c := range c.Commands() { - overwriteFlagDefaults(c, defaults) - } -} - -type appCreator struct { - encodingConfig appparams.EncodingConfig -} - -// newApp creates a new Cosmos SDK app -func (a appCreator) newApp( - logger log.Logger, - db dbm.DB, - traceStore io.Writer, - appOpts servertypes.AppOptions, -) servertypes.Application { - var cache sdk.MultiStorePersistentCache - - if cast.ToBool(appOpts.Get(server.FlagInterBlockCache)) { - cache = store.NewCommitKVStoreCacheManager() - } - - skipUpgradeHeights := make(map[int64]bool) - for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) { - skipUpgradeHeights[int64(h)] = true - } - - pruningOpts, err := server.GetPruningOptionsFromFlags(appOpts) - if err != nil { - panic(err) - } - - homeDir := cast.ToString(appOpts.Get(flags.FlagHome)) - chainID := cast.ToString(appOpts.Get(flags.FlagChainID)) - if chainID == "" { - // fallback to genesis chain-id - appGenesis, err := tmtypes.GenesisDocFromFile(filepath.Join(homeDir, "config", "genesis.json")) - if err != nil { - panic(err) - } - - chainID = appGenesis.ChainID - } - - snapshotDir := filepath.Join(cast.ToString(appOpts.Get(flags.FlagHome)), "data", "snapshots") - snapshotDB, err := dbm.NewDB("metadata", dbm.GoLevelDBBackend, snapshotDir) - if err != nil { - panic(err) - } - snapshotStore, err := snapshots.NewStore(snapshotDB, snapshotDir) - if err != nil { - panic(err) - } - - snapshotOptions := snapshottypes.NewSnapshotOptions( - cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval)), - cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent)), - ) - - return app.New( - logger, - db, - traceStore, - true, - skipUpgradeHeights, - cast.ToString(appOpts.Get(flags.FlagHome)), - cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)), - a.encodingConfig, - appOpts, - baseapp.SetPruning(pruningOpts), - baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))), - baseapp.SetHaltHeight(cast.ToUint64(appOpts.Get(server.FlagHaltHeight))), - baseapp.SetHaltTime(cast.ToUint64(appOpts.Get(server.FlagHaltTime))), - baseapp.SetMinRetainBlocks(cast.ToUint64(appOpts.Get(server.FlagMinRetainBlocks))), - baseapp.SetInterBlockCache(cache), - baseapp.SetTrace(cast.ToBool(appOpts.Get(server.FlagTrace))), - baseapp.SetIndexEvents(cast.ToStringSlice(appOpts.Get(server.FlagIndexEvents))), - baseapp.SetSnapshot(snapshotStore, snapshotOptions), - baseapp.SetIAVLCacheSize(cast.ToInt(appOpts.Get(server.FlagIAVLCacheSize))), - baseapp.SetIAVLDisableFastNode(cast.ToBool(appOpts.Get(server.FlagDisableIAVLFastNode))), - baseapp.SetChainID(chainID), - ) -} - -// appExport creates a new simapp (optionally at a given height) -func (a appCreator) appExport( - logger log.Logger, - db dbm.DB, - traceStore io.Writer, - height int64, - forZeroHeight bool, - jailAllowedAddrs []string, - appOpts servertypes.AppOptions, - modulesToExport []string, -) (servertypes.ExportedApp, error) { - homePath, ok := appOpts.Get(flags.FlagHome).(string) - if !ok || homePath == "" { - return servertypes.ExportedApp{}, errors.New("application home not set") - } - - app := app.New( - logger, - db, - traceStore, - height == -1, // -1: no height provided - map[int64]bool{}, - homePath, - uint(1), - a.encodingConfig, - appOpts, - ) - - if height != -1 { - if err := app.LoadHeight(height); err != nil { - return servertypes.ExportedApp{}, err - } - } - - return app.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) -} - -// initAppConfig helps to override default appConfig template and configs. -// return "", nil if no custom configuration is required for the application. -func initAppConfig() (string, interface{}) { - // The following code snippet is just for reference. - - type CustomAppConfig struct { - serverconfig.Config - } - - // Optionally allow the chain developer to overwrite the SDK's default - // server config. - srvCfg := serverconfig.DefaultConfig() - // The SDK's default minimum gas price is set to "" (empty value) inside - // app.toml. If left empty by validators, the node will halt on startup. - // However, the chain developer can set a default app.toml value for their - // validators here. - // - // In summary: - // - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their - // own app.toml config, - // - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their - // own app.toml to override, or use this default value. - // - // In simapp, we set the min gas prices to 0. - srvCfg.MinGasPrices = "0upokt" - - customAppConfig := CustomAppConfig{ - Config: *srvCfg, - } - customAppTemplate := serverconfig.DefaultConfigTemplate - - return customAppTemplate, customAppConfig -} diff --git a/cmd/pocketd/main.go b/cmd/pocketd/main.go deleted file mode 100644 index 25c7ebcef..000000000 --- a/cmd/pocketd/main.go +++ /dev/null @@ -1,24 +0,0 @@ -package main - -import ( - "os" - - "github.com/cosmos/cosmos-sdk/server" - svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" - - "github.com/pokt-network/poktroll/app" - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" -) - -func main() { - rootCmd, _ := cmd.NewRootCmd() - if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil { - switch e := err.(type) { - case server.ErrorCode: - os.Exit(e.Code) - - default: - os.Exit(1) - } - } -} diff --git a/cmd/poktrolld/cmd/commands.go b/cmd/poktrolld/cmd/commands.go new file mode 100644 index 000000000..7eb957904 --- /dev/null +++ b/cmd/poktrolld/cmd/commands.go @@ -0,0 +1,191 @@ +package cmd + +import ( + "errors" + "io" + + "cosmossdk.io/log" + confixcmd "cosmossdk.io/tools/confix/cmd" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/debug" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/keys" + "github.com/cosmos/cosmos-sdk/client/pruning" + "github.com/cosmos/cosmos-sdk/client/rpc" + "github.com/cosmos/cosmos-sdk/client/snapshot" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/server" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + "github.com/cosmos/cosmos-sdk/types/module" + authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" + "github.com/cosmos/cosmos-sdk/x/crisis" + genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" + "github.com/spf13/cobra" + "github.com/spf13/viper" + + "github.com/pokt-network/poktroll/app" +) + +func initRootCmd( + rootCmd *cobra.Command, + txConfig client.TxConfig, + interfaceRegistry codectypes.InterfaceRegistry, + appCodec codec.Codec, + basicManager module.BasicManager, +) { + rootCmd.AddCommand( + genutilcli.InitCmd(basicManager, app.DefaultNodeHome), + debug.Cmd(), + confixcmd.ConfigCommand(), + pruning.Cmd(newApp, app.DefaultNodeHome), + snapshot.Cmd(newApp), + ) + + server.AddCommands(rootCmd, app.DefaultNodeHome, newApp, appExport, addModuleInitFlags) + + // add keybase, auxiliary RPC, query, genesis, and tx child commands + rootCmd.AddCommand( + server.StatusCommand(), + genesisCommand(txConfig, basicManager), + queryCommand(), + txCommand(), + keys.Commands(), + ) +} + +func addModuleInitFlags(startCmd *cobra.Command) { + crisis.AddModuleInitFlags(startCmd) +} + +// genesisCommand builds genesis-related `poktrolld genesis` command. Users may provide application specific commands as a parameter +func genesisCommand(txConfig client.TxConfig, basicManager module.BasicManager, cmds ...*cobra.Command) *cobra.Command { + cmd := genutilcli.Commands(txConfig, basicManager, app.DefaultNodeHome) + + for _, subCmd := range cmds { + cmd.AddCommand(subCmd) + } + return cmd +} + +func queryCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "query", + Aliases: []string{"q"}, + Short: "Querying subcommands", + DisableFlagParsing: false, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + rpc.QueryEventForTxCmd(), + rpc.ValidatorCommand(), + server.QueryBlockCmd(), + authcmd.QueryTxsByEventsCmd(), + server.QueryBlocksCmd(), + authcmd.QueryTxCmd(), + server.QueryBlockResultsCmd(), + ) + cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") + + return cmd +} + +func txCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "tx", + Short: "Transactions subcommands", + DisableFlagParsing: false, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + authcmd.GetSignCommand(), + authcmd.GetSignBatchCommand(), + authcmd.GetMultiSignCommand(), + authcmd.GetMultiSignBatchCmd(), + authcmd.GetValidateSignaturesCommand(), + flags.LineBreak, + authcmd.GetBroadcastCommand(), + authcmd.GetEncodeCommand(), + authcmd.GetDecodeCommand(), + authcmd.GetSimulateCmd(), + ) + cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") + + return cmd +} + +// newApp creates the application +func newApp( + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + appOpts servertypes.AppOptions, +) servertypes.Application { + baseappOptions := server.DefaultBaseappOptions(appOpts) + + app, err := app.New( + logger, db, traceStore, true, + appOpts, + baseappOptions..., + ) + if err != nil { + panic(err) + } + return app +} + +// appExport creates a new app (optionally at a given height) and exports state. +func appExport( + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + height int64, + forZeroHeight bool, + jailAllowedAddrs []string, + appOpts servertypes.AppOptions, + modulesToExport []string, +) (servertypes.ExportedApp, error) { + var ( + bApp *app.App + err error + ) + + // this check is necessary as we use the flag in x/upgrade. + // we can exit more gracefully by checking the flag here. + homePath, ok := appOpts.Get(flags.FlagHome).(string) + if !ok || homePath == "" { + return servertypes.ExportedApp{}, errors.New("application home not set") + } + + viperAppOpts, ok := appOpts.(*viper.Viper) + if !ok { + return servertypes.ExportedApp{}, errors.New("appOpts is not viper.Viper") + } + + // overwrite the FlagInvCheckPeriod + viperAppOpts.Set(server.FlagInvCheckPeriod, 1) + appOpts = viperAppOpts + + if height != -1 { + bApp, err = app.New(logger, db, traceStore, false, appOpts) + if err != nil { + return servertypes.ExportedApp{}, err + } + + if err := bApp.LoadHeight(height); err != nil { + return servertypes.ExportedApp{}, err + } + } else { + bApp, err = app.New(logger, db, traceStore, true, appOpts) + if err != nil { + return servertypes.ExportedApp{}, err + } + } + + return bApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) +} diff --git a/cmd/poktrolld/cmd/config.go b/cmd/poktrolld/cmd/config.go new file mode 100644 index 000000000..0041179d1 --- /dev/null +++ b/cmd/poktrolld/cmd/config.go @@ -0,0 +1,91 @@ +package cmd + +import ( + "sync" + + cmtcfg "github.com/cometbft/cometbft/config" + serverconfig "github.com/cosmos/cosmos-sdk/server/config" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/app" +) + +var once sync.Once + +func InitSDKConfig() { + once.Do(func() { + initSDKConfig() + }) +} + +func initSDKConfig() { + // Set prefixes + accountPubKeyPrefix := app.AccountAddressPrefix + "pub" + validatorAddressPrefix := app.AccountAddressPrefix + "valoper" + validatorPubKeyPrefix := app.AccountAddressPrefix + "valoperpub" + consNodeAddressPrefix := app.AccountAddressPrefix + "valcons" + consNodePubKeyPrefix := app.AccountAddressPrefix + "valconspub" + + // Set and seal config + config := sdk.GetConfig() + config.SetBech32PrefixForAccount(app.AccountAddressPrefix, accountPubKeyPrefix) + config.SetBech32PrefixForValidator(validatorAddressPrefix, validatorPubKeyPrefix) + config.SetBech32PrefixForConsensusNode(consNodeAddressPrefix, consNodePubKeyPrefix) + config.Seal() +} + +// initCometBFTConfig helps to override default CometBFT Config values. +// return cmtcfg.DefaultConfig if no custom configuration is required for the application. +func initCometBFTConfig() *cmtcfg.Config { + cfg := cmtcfg.DefaultConfig() + + // these values put a higher strain on node memory + // cfg.P2P.MaxNumInboundPeers = 100 + // cfg.P2P.MaxNumOutboundPeers = 40 + + return cfg +} + +// initAppConfig helps to override default appConfig template and configs. +// return "", nil if no custom configuration is required for the application. +func initAppConfig() (string, interface{}) { + // The following code snippet is just for reference. + type CustomAppConfig struct { + serverconfig.Config `mapstructure:",squash"` + } + + // Optionally allow the chain developer to overwrite the SDK's default + // server config. + srvCfg := serverconfig.DefaultConfig() + // The SDK's default minimum gas price is set to "" (empty value) inside + // app.toml. If left empty by validators, the node will halt on startup. + // However, the chain developer can set a default app.toml value for their + // validators here. + // + // In summary: + // - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their + // own app.toml config, + // - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their + // own app.toml to override, or use this default value. + // + // In tests, we set the min gas prices to 0. + // srvCfg.MinGasPrices = "0stake" + // srvCfg.BaseConfig.IAVLDisableFastNode = true // disable fastnode by default + + customAppConfig := CustomAppConfig{ + Config: *srvCfg, + } + + customAppTemplate := serverconfig.DefaultConfigTemplate + // Edit the default template file + // + // customAppTemplate := serverconfig.DefaultConfigTemplate + ` + // [wasm] + // # This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries + // query_gas_limit = 300000 + // # This is the number of wasm vm instances we keep cached in memory for speed-up + // # Warning: this is currently unstable and may lead to crashes, best to keep for 0 unless testing locally + // lru_size = 0` + + return customAppTemplate, customAppConfig +} diff --git a/cmd/poktrolld/cmd/root.go b/cmd/poktrolld/cmd/root.go new file mode 100644 index 000000000..1bfbfd135 --- /dev/null +++ b/cmd/poktrolld/cmd/root.go @@ -0,0 +1,173 @@ +package cmd + +import ( + "os" + "strings" + + "cosmossdk.io/client/v2/autocli" + clientv2keyring "cosmossdk.io/client/v2/autocli/keyring" + "cosmossdk.io/core/address" + "cosmossdk.io/depinject" + "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/config" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/cosmos/cosmos-sdk/server" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/tx" + txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" + "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/spf13/cobra" + "github.com/spf13/pflag" + + "github.com/pokt-network/poktroll/app" +) + +// NewRootCmd creates a new root command for poktrolld. It is called once in the main function. +func NewRootCmd() *cobra.Command { + InitSDKConfig() + + var ( + txConfigOpts tx.ConfigOptions + autoCliOpts autocli.AppOptions + moduleBasicManager module.BasicManager + clientCtx client.Context + ) + + if err := depinject.Inject( + depinject.Configs(app.AppConfig(), + depinject.Supply( + log.NewNopLogger(), + ), + depinject.Provide( + ProvideClientContext, + ProvideKeyring, + ), + ), + &txConfigOpts, + &autoCliOpts, + &moduleBasicManager, + &clientCtx, + ); err != nil { + panic(err) + } + + rootCmd := &cobra.Command{ + Use: app.Name + "d", + Short: "Start poktroll node", + SilenceErrors: true, + PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { + // set the default command outputs + cmd.SetOut(cmd.OutOrStdout()) + cmd.SetErr(cmd.ErrOrStderr()) + + clientCtx = clientCtx.WithCmdContext(cmd.Context()) + clientCtx, err := client.ReadPersistentCommandFlags(clientCtx, cmd.Flags()) + if err != nil { + return err + } + + clientCtx, err = config.ReadFromClientConfig(clientCtx) + if err != nil { + return err + } + + // This needs to go after ReadFromClientConfig, as that function + // sets the RPC client needed for SIGN_MODE_TEXTUAL. + txConfigOpts.EnabledSignModes = append(txConfigOpts.EnabledSignModes, signing.SignMode_SIGN_MODE_TEXTUAL) + txConfigOpts.TextualCoinMetadataQueryFn = txmodule.NewGRPCCoinMetadataQueryFn(clientCtx) + txConfigWithTextual, err := tx.NewTxConfigWithOptions( + codec.NewProtoCodec(clientCtx.InterfaceRegistry), + txConfigOpts, + ) + if err != nil { + return err + } + + clientCtx = clientCtx.WithTxConfig(txConfigWithTextual) + if err := client.SetCmdClientContextHandler(clientCtx, cmd); err != nil { + return err + } + + if err := client.SetCmdClientContextHandler(clientCtx, cmd); err != nil { + return err + } + + customAppTemplate, customAppConfig := initAppConfig() + customCMTConfig := initCometBFTConfig() + + return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, customCMTConfig) + }, + } + + // Since the IBC modules don't support dependency injection, we need to + // manually register the modules on the client side. + // This needs to be removed after IBC supports App Wiring. + ibcModules := app.RegisterIBC(clientCtx.InterfaceRegistry) + for name, module := range ibcModules { + autoCliOpts.Modules[name] = module + } + initRootCmd(rootCmd, clientCtx.TxConfig, clientCtx.InterfaceRegistry, clientCtx.Codec, moduleBasicManager) + + overwriteFlagDefaults(rootCmd, map[string]string{ + flags.FlagChainID: strings.ReplaceAll(app.Name, "-", ""), + flags.FlagKeyringBackend: "test", + }) + + if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil { + panic(err) + } + + return rootCmd +} + +func overwriteFlagDefaults(c *cobra.Command, defaults map[string]string) { + set := func(s *pflag.FlagSet, key, val string) { + if f := s.Lookup(key); f != nil { + f.DefValue = val + f.Value.Set(val) + } + } + for key, val := range defaults { + set(c.Flags(), key, val) + set(c.PersistentFlags(), key, val) + } + for _, c := range c.Commands() { + overwriteFlagDefaults(c, defaults) + } +} + +func ProvideClientContext( + appCodec codec.Codec, + interfaceRegistry codectypes.InterfaceRegistry, + txConfig client.TxConfig, + legacyAmino *codec.LegacyAmino, +) client.Context { + clientCtx := client.Context{}. + WithCodec(appCodec). + WithInterfaceRegistry(interfaceRegistry). + WithTxConfig(txConfig). + WithLegacyAmino(legacyAmino). + WithInput(os.Stdin). + WithAccountRetriever(types.AccountRetriever{}). + WithHomeDir(app.DefaultNodeHome). + WithViper(app.Name) // env variable prefix + + // Read the config again to overwrite the default values with the values from the config file + clientCtx, _ = config.ReadFromClientConfig(clientCtx) + + return clientCtx +} + +func ProvideKeyring(clientCtx client.Context, addressCodec address.Codec) (clientv2keyring.Keyring, error) { + kb, err := client.NewKeyringFromBackend(clientCtx, clientCtx.Keyring.Backend()) + if err != nil { + return nil, err + } + + return keyring.NewAutoCLIKeyring(kb) +} diff --git a/cmd/poktrolld/main.go b/cmd/poktrolld/main.go new file mode 100644 index 000000000..c5aee5e20 --- /dev/null +++ b/cmd/poktrolld/main.go @@ -0,0 +1,19 @@ +package main + +import ( + "fmt" + "os" + + svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" + + "github.com/pokt-network/poktroll/app" + "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" +) + +func main() { + rootCmd := cmd.NewRootCmd() + if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil { + fmt.Fprintln(rootCmd.OutOrStderr(), err) + os.Exit(1) + } +} diff --git a/config.yml b/config.yml index d55021f8f..7ba4164c1 100644 --- a/config.yml +++ b/config.yml @@ -1,6 +1,6 @@ version: 1 build: - main: cmd/pocketd + main: cmd/poktrolld accounts: - name: faucet mnemonic: "baby advance work soap slow exclude blur humble lucky rough teach wide chuckle captain rack laundry butter main very cannon donate armor dress follow" diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index ee5879532..3dfa4ed44 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -4,204 +4,26 @@ info: name: '' description: '' paths: - /cosmos/auth/v1beta1/account_info/{address}: - get: - summary: AccountInfo queries account info which is common to all account types. + /cosmos.auth.v1beta1.Msg/UpdateParams: + post: + summary: >- + UpdateParams defines a (governance) operation for updating the x/auth + module + + parameters. The authority defaults to the x/gov module account. description: 'Since: cosmos-sdk 0.47' - operationId: CosmosAuthV1Beta1AccountInfo + operationId: CosmosAuthV1Beta1Msg_UpdateParams responses: '200': description: A successful response. schema: type: object - properties: - info: - description: info is the account info which is represented by BaseAccount. - type: object - properties: - address: - type: string - pub_key: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a - `value` which holds the custom JSON in addition to the - `@type` + MsgUpdateParams message. - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - account_number: - type: string - format: uint64 - sequence: - type: string - format: uint64 - description: |- - QueryAccountInfoResponse is the Query/AccountInfo response type. Since: cosmos-sdk 0.47 default: @@ -310,8 +132,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -321,7 +147,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -349,10 +175,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -390,32 +214,79 @@ paths: "value": "1.212s" } parameters: - - name: address - description: address is the account address string. - in: path - required: true - type: string - tags: - - Query - /cosmos/auth/v1beta1/accounts: - get: - summary: Accounts returns all the existing accounts. - description: >- - When called from another module, this query might consume a high amount - of + - name: body + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. - gas if the pagination field is incorrectly set. + Since: cosmos-sdk 0.47 + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + params: + description: |- + params defines the x/auth parameters to update. + NOTE: All parameters must be supplied. + type: object + properties: + max_memo_characters: + type: string + format: uint64 + tx_sig_limit: + type: string + format: uint64 + tx_size_cost_per_byte: + type: string + format: uint64 + sig_verify_cost_ed25519: + type: string + format: uint64 + sig_verify_cost_secp256k1: + type: string + format: uint64 + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. - Since: cosmos-sdk 0.43 - operationId: CosmosAuthV1Beta1Accounts + Since: cosmos-sdk 0.47 + tags: + - Msg + /cosmos.authz.v1beta1.Msg/Exec: + post: + summary: |- + Exec attempts to execute the provided messages using + authorizations granted to the grantee. Each message should have only + one signer corresponding to the granter of the authorization. + operationId: CosmosAuthzV1Beta1Msg_Exec responses: '200': description: A successful response. schema: type: object properties: - accounts: + results: + type: array + items: + type: string + format: byte + description: MsgExecResponse defines the Msg/MsgExecResponse response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: type: array items: type: object @@ -511,8 +382,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -522,7 +397,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -550,10 +425,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -590,43 +463,20 @@ paths: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } - title: accounts are the existing accounts - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryAccountsResponse is the response type for the Query/Accounts - RPC method. - - - Since: cosmos-sdk 0.43 - default: - description: An unexpected error response. + parameters: + - name: body + description: |- + MsgExec attempts to execute the provided messages using + authorizations granted to the grantee. Each message should have only + one signer corresponding to the granter of the authorization. + in: body + required: true schema: type: object properties: - code: - type: integer - format: int32 - message: + grantee: type: string - details: + msgs: type: array items: type: object @@ -722,8 +572,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -733,7 +587,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -761,10 +615,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -801,247 +653,36 @@ paths: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. + description: >- + Execute Msg. - count_total is only respected when offset is used. It is ignored - when key + The x/authz will try to find a grant matching (msg.signers[0], + grantee, MsgTypeURL(msg)) - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. + triple and validate it. + description: >- + MsgExec attempts to execute the provided messages using + authorizations granted to the grantee. Each message should have + only - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean + one signer corresponding to the granter of the authorization. tags: - - Query - /cosmos/auth/v1beta1/accounts/{address}: - get: - summary: Account returns account details based on address. - operationId: CosmosAuthV1Beta1Account + - Msg + /cosmos.authz.v1beta1.Msg/Grant: + post: + summary: |- + Grant grants the provided authorization to the grantee on the granter's + account with the provided expiration time. If there is already a grant + for the given (granter, grantee, Authorization) triple, then the grant + will be overwritten. + operationId: CosmosAuthzV1Beta1Msg_Grant responses: '200': description: A successful response. schema: type: object - properties: - account: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - QueryAccountResponse is the response type for the Query/Account - RPC method. + description: MsgGrantResponse defines the Msg/MsgGrant response type. default: description: An unexpected error response. schema: @@ -1148,8 +789,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -1159,7 +804,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -1187,10 +832,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -1228,257 +871,234 @@ paths: "value": "1.212s" } parameters: - - name: address - description: address defines the address to query for. - in: path + - name: body + description: >- + MsgGrant is a request type for Grant method. It declares + authorization to the grantee + + on behalf of the granter with the provided expiration time. + in: body required: true - type: string - tags: - - Query - /cosmos/auth/v1beta1/address_by_id/{id}: - get: - summary: AccountAddressByID returns account address based on account number. - description: 'Since: cosmos-sdk 0.46.2' - operationId: CosmosAuthV1Beta1AccountAddressByID - responses: - '200': - description: A successful response. schema: type: object properties: - account_address: + granter: type: string - description: 'Since: cosmos-sdk 0.46.2' - title: >- - QueryAccountAddressByIDResponse is the response type for - AccountAddressByID rpc method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: + grantee: type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized + grant: + type: object + properties: + authorization: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type + of the serialized - protocol buffer message. This string must contain at - least + protocol buffer message. This string must contain at + least - one "/" character. The last segment of the URL's path - must represent + one "/" character. The last segment of the URL's path + must represent - the fully qualified name of the type (as in + the fully qualified name of the type (as in - `path/google.protobuf.Duration`). The name should be in - a canonical form + `path/google.protobuf.Duration`). The name should be + in a canonical form - (e.g., leading "." is not accepted). + (e.g., leading "." is not accepted). - In practice, teams usually precompile into the binary - all types that they + In practice, teams usually precompile into the binary + all types that they - expect it to use in the context of Any. However, for - URLs which use the + expect it to use in the context of Any. However, for + URLs which use the - scheme `http`, `https`, or no scheme, one can optionally - set up a type + scheme `http`, `https`, or no scheme, one can + optionally set up a type - server that maps type URLs to message definitions as - follows: + server that maps type URLs to message definitions as + follows: - * If no scheme is provided, `https` is assumed. + * If no scheme is provided, `https` is assumed. - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results + based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - Note: this functionality is not currently available in - the official + Note: this functionality is not currently available in + the official - protobuf release, and it is not used for type URLs - beginning with + protobuf release, and it is not used for type URLs + beginning with - type.googleapis.com. + type.googleapis.com. - Schemes other than `http`, `https` (or the empty scheme) - might be + Schemes other than `http`, `https` (or the empty + scheme) might be - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a - URL that describes the type of the serialized message. + URL that describes the type of the serialized message. - Protobuf library provides support to pack/unpack Any values - in the form + Protobuf library provides support to pack/unpack Any + values in the form - of utility functions or additional generated methods of the - Any type. + of utility functions or additional generated methods of + the Any type. - Example 1: Pack and unpack a message in C++. + Example 1: Pack and unpack a message in C++. - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { + Foo foo = ...; + Any any; + any.PackFrom(foo); ... - } + if (any.UnpackTo(&foo)) { + ... + } - Example 2: Pack and unpack a message in Java. + Example 2: Pack and unpack a message in Java. - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) + foo = Foo(...) + any = Any() + any.Pack(foo) ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } ... - } + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } - The pack methods provided by protobuf library will by - default use + The pack methods provided by protobuf library will by + default use - 'type.googleapis.com/full.type.name' as the type URL and the - unpack + 'type.googleapis.com/full.type.name' as the type URL and + the unpack - methods only use the fully qualified type name after the - last '/' + methods only use the fully qualified type name after the + last '/' - in the type URL, for example "foo.bar.com/x/y.z" will yield - type + in the type URL, for example "foo.bar.com/x/y.z" will + yield type - name "y.z". + name "y.z". + JSON - JSON - ==== + The JSON representation of an `Any` value uses the regular - The JSON representation of an `Any` value uses the regular + representation of the deserialized, embedded message, with + an - representation of the deserialized, embedded message, with - an + additional field `@type` which contains the type URL. + Example: - additional field `@type` which contains the type URL. - Example: + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + If the embedded message type is well-known and has a + custom JSON - If the embedded message type is well-known and has a custom - JSON + representation, that representation will be embedded + adding a field - representation, that representation will be embedded adding - a field + `value` which holds the custom JSON in addition to the + `@type` - `value` which holds the custom JSON in addition to the - `@type` + field. Example (for message [google.protobuf.Duration][]): - field. Example (for message [google.protobuf.Duration][]): + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + expiration: + type: string + format: date-time + title: >- + time when the grant will expire and will be pruned. If + null, then the grant - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: id - description: |- - Deprecated, use account_id instead + doesn't have a time expiration (other conditions in + `authorization` - id is the account number of the address to be queried. This field - should have been an uint64 (like all account numbers), and will be - updated to uint64 in a future version of the auth query. - in: path - required: true - type: string - format: int64 - - name: account_id - description: |- - account_id is the account number of the address to be queried. + may apply to invalidate the grant) + description: |- + Grant gives permissions to execute + the provide method with expiration time. + description: >- + MsgGrant is a request type for Grant method. It declares + authorization to the grantee - Since: cosmos-sdk 0.47 - in: query - required: false - type: string - format: uint64 + on behalf of the granter with the provided expiration time. tags: - - Query - /cosmos/auth/v1beta1/bech32: - get: - summary: Bech32Prefix queries bech32Prefix - description: 'Since: cosmos-sdk 0.46' - operationId: CosmosAuthV1Beta1Bech32Prefix + - Msg + /cosmos.authz.v1beta1.Msg/Revoke: + post: + summary: >- + Revoke revokes any authorization corresponding to the provided method + name on the + + granter's account that has been granted to the grantee. + operationId: CosmosAuthzV1Beta1Msg_Revoke responses: '200': description: A successful response. schema: type: object - properties: - bech32_prefix: - type: string - description: >- - Bech32PrefixResponse is the response type for Bech32Prefix rpc - method. - - - Since: cosmos-sdk 0.46 + description: MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. default: description: An unexpected error response. schema: @@ -1585,8 +1205,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -1596,7 +1220,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -1624,10 +1248,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -1664,27 +1286,43 @@ paths: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } - tags: - - Query - /cosmos/auth/v1beta1/bech32/{address_bytes}: - get: - summary: AddressBytesToString converts Account Address bytes to string - description: 'Since: cosmos-sdk 0.46' - operationId: CosmosAuthV1Beta1AddressBytesToString - responses: - '200': - description: A successful response. + parameters: + - name: body + description: >- + MsgRevoke revokes any authorization with the provided sdk.Msg type + on the + + granter's account with that has been granted to the grantee. + in: body + required: true schema: type: object properties: - address_string: + granter: + type: string + grantee: + type: string + msg_type_url: type: string description: >- - AddressBytesToStringResponse is the response type for - AddressString rpc method. + MsgRevoke revokes any authorization with the provided sdk.Msg type + on the - - Since: cosmos-sdk 0.46 + granter's account with that has been granted to the grantee. + tags: + - Msg + /cosmos.bank.v1beta1.Msg/MultiSend: + post: + summary: >- + MultiSend defines a method for sending coins from some accounts to other + accounts. + operationId: CosmosBankV1Beta1Msg_MultiSend + responses: + '200': + description: A successful response. + schema: + type: object + description: MsgMultiSendResponse defines the Msg/MultiSend response type. default: description: An unexpected error response. schema: @@ -1702,202 +1340,414 @@ paths: properties: '@type': type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. + additionalProperties: {} + parameters: + - name: body + description: >- + MsgMultiSend represents an arbitrary multi-in, multi-out send + message. + in: body + required: true + schema: + type: object + properties: + inputs: + type: array + items: + type: object + properties: + address: + type: string + coins: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - Note: this functionality is not currently available in - the official + NOTE: The amount field is an Int which implements the + custom method - protobuf release, and it is not used for type URLs - beginning with + signatures required by gogoproto. + description: Input models transaction input. + description: >- + Inputs, despite being `repeated`, only allows one sender + input. This is - type.googleapis.com. + checked in MsgMultiSend's ValidateBasic. + outputs: + type: array + items: + type: object + properties: + address: + type: string + coins: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. - Schemes other than `http`, `https` (or the empty scheme) - might be + NOTE: The amount field is an Int which implements the + custom method - used with implementation specific semantics. + signatures required by gogoproto. + description: Output models transaction outputs. + description: >- + MsgMultiSend represents an arbitrary multi-in, multi-out send + message. + tags: + - Msg + /cosmos.bank.v1beta1.Msg/Send: + post: + summary: >- + Send defines a method for sending coins from one account to another + account. + operationId: CosmosBankV1Beta1Msg_Send + responses: + '200': + description: A successful response. + schema: + type: object + description: MsgSendResponse defines the Msg/Send response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string additionalProperties: {} + parameters: + - name: body + description: >- + MsgSend represents a message to send coins from one account to + another. + in: body + required: true + schema: + type: object + properties: + from_address: + type: string + to_address: + type: string + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. + Coin defines a token with a denomination and an amount. - Example 1: Pack and unpack a message in C++. + NOTE: The amount field is an Int which implements the custom + method - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } + signatures required by gogoproto. + description: >- + MsgSend represents a message to send coins from one account to + another. + tags: + - Msg + /cosmos.bank.v1beta1.Msg/SetSendEnabled: + post: + summary: >- + SetSendEnabled is a governance operation for setting the SendEnabled + flag - Example 2: Pack and unpack a message in Java. + on any number of Denoms. Only the entries to add or update should be - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } + included. Entries that already exist in the store, but that aren't - Example 3: Pack and unpack a message in Python. + included in this message, will be left unchanged. + description: 'Since: cosmos-sdk 0.47' + operationId: CosmosBankV1Beta1Msg_SetSendEnabled + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response + type. - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - Example 4: Pack and unpack a message in Go + Since: cosmos-sdk 0.47 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: |- + MsgSetSendEnabled is the Msg/SetSendEnabled request type. - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } + Only entries to add/update/delete need to be included. + Existing SendEnabled entries that are not included in this + message are left unchanged. - The pack methods provided by protobuf library will by - default use + Since: cosmos-sdk 0.47 + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: authority is the address that controls the module. + send_enabled: + type: array + items: + type: object + properties: + denom: + type: string + enabled: + type: boolean + description: >- + SendEnabled maps coin denom to a send_enabled status + (whether a denom is - 'type.googleapis.com/full.type.name' as the type URL and the - unpack + sendable). + description: send_enabled is the list of entries to add or update. + use_default_for: + type: array + items: + type: string + description: >- + use_default_for is a list of denoms that should use the + params.default_send_enabled value. - methods only use the fully qualified type name after the - last '/' + Denoms listed here will have their SendEnabled entries + deleted. - in the type URL, for example "foo.bar.com/x/y.z" will yield - type + If a denom is included that doesn't have a SendEnabled entry, - name "y.z". + it will be ignored. + description: |- + MsgSetSendEnabled is the Msg/SetSendEnabled request type. + Only entries to add/update/delete need to be included. + Existing SendEnabled entries that are not included in this + message are left unchanged. + Since: cosmos-sdk 0.47 + tags: + - Msg + /cosmos.bank.v1beta1.Msg/UpdateParams: + post: + summary: >- + UpdateParams defines a governance operation for updating the x/bank + module parameters. - JSON + The authority is defined in the keeper. + description: 'Since: cosmos-sdk 0.47' + operationId: CosmosBankV1Beta1Msg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a - ==== + MsgUpdateParams message. - The JSON representation of an `Any` value uses the regular - representation of the deserialized, embedded message, with - an + Since: cosmos-sdk 0.47 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. - additional field `@type` which contains the type URL. - Example: + Since: cosmos-sdk 0.47 + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + params: + description: |- + params defines the x/bank parameters to update. - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } + NOTE: All parameters must be supplied. + type: object + properties: + send_enabled: + type: array + items: + type: object + properties: + denom: + type: string + enabled: + type: boolean + description: >- + SendEnabled maps coin denom to a send_enabled status + (whether a denom is - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + sendable). + description: >- + Deprecated: Use of SendEnabled in params is deprecated. - If the embedded message type is well-known and has a custom - JSON + For genesis, use the newly added send_enabled field in the + genesis object. - representation, that representation will be embedded adding - a field + Storage, lookup, and manipulation of this information is + now in the keeper. - `value` which holds the custom JSON in addition to the - `@type` - field. Example (for message [google.protobuf.Duration][]): + As of cosmos-sdk 0.47, this only exists for backwards + compatibility of genesis files. + default_send_enabled: + type: boolean + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: address_bytes - in: path - required: true - type: string - format: byte + Since: cosmos-sdk 0.47 tags: - - Query - /cosmos/auth/v1beta1/bech32/{address_string}: + - Msg + /cosmos/base/node/v1beta1/config: get: - summary: AddressStringToBytes converts Address string to bytes - description: 'Since: cosmos-sdk 0.46' - operationId: CosmosAuthV1Beta1AddressStringToBytes + summary: Config queries for the operator configuration. + operationId: CosmosBaseNodeV1Beta1Service_Config + responses: + '200': + description: A successful response. + schema: + type: object + properties: + minimum_gas_price: + type: string + pruning_keep_recent: + type: string + title: pruning settings + pruning_interval: + type: string + description: >- + ConfigResponse defines the response structure for the Config gRPC + query. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + tags: + - Service + /cosmos/base/node/v1beta1/status: + get: + summary: Status queries for the node status. + operationId: CosmosBaseNodeV1Beta1Service_Status responses: '200': description: A successful response. schema: type: object properties: - address_bytes: + earliest_store_height: + type: string + format: uint64 + title: earliest block height available in the store + height: + type: string + format: uint64 + title: current block height + timestamp: + type: string + format: date-time + title: block height timestamp + app_hash: type: string format: byte + title: app hash of the current block + validator_hash: + type: string + format: byte + title: validator hash provided by the consensus header description: >- - AddressStringToBytesResponse is the response type for AddressBytes - rpc method. - - - Since: cosmos-sdk 0.46 + StateResponse defines the response structure for the status of a + node. default: description: An unexpected error response. schema: @@ -1915,373 +1765,492 @@ paths: properties: '@type': type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized + additionalProperties: {} + tags: + - Service + /cosmos.consensus.v1.Msg/UpdateParams: + post: + summary: >- + UpdateParams defines a governance operation for updating the x/consensus + module parameters. - protocol buffer message. This string must contain at - least + The authority is defined in the keeper. + description: 'Since: cosmos-sdk 0.47' + operationId: CosmosConsensusV1Msg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a - one "/" character. The last segment of the URL's path - must represent + MsgUpdateParams message. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: MsgUpdateParams is the Msg/UpdateParams request type. + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + block: + description: >- + params defines the x/consensus parameters to update. - the fully qualified name of the type (as in + VersionsParams is not included in this Msg because it is + tracked - `path/google.protobuf.Duration`). The name should be in - a canonical form + separarately in x/upgrade. - (e.g., leading "." is not accepted). + NOTE: All parameters must be supplied. + type: object + properties: + max_bytes: + type: string + format: int64 + title: |- + Max block size, in bytes. + Note: must be greater than 0 + max_gas: + type: string + format: int64 + title: |- + Max gas per block. + Note: must be greater or equal to -1 + evidence: + type: object + properties: + max_age_num_blocks: + type: string + format: int64 + description: >- + Max age of evidence, in blocks. - In practice, teams usually precompile into the binary - all types that they - expect it to use in the context of Any. However, for - URLs which use the + The basic formula for calculating this is: MaxAgeDuration + / {average block - scheme `http`, `https`, or no scheme, one can optionally - set up a type + time}. + max_age_duration: + type: string + description: >- + Max age of evidence, in time. - server that maps type URLs to message definitions as - follows: + It should correspond with an app's "unbonding period" or + other similar - * If no scheme is provided, `https` is assumed. + mechanism for handling [Nothing-At-Stake - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + max_bytes: + type: string + format: int64 + title: >- + This sets the maximum size of total evidence in bytes that + can be committed in a single block. - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". + and should fall comfortably under the max block bytes. + Default is 1048576 or 1MB + description: >- + EvidenceParams determine how we handle evidence of + malfeasance. + validator: + type: object + properties: + pub_key_types: + type: array + items: + type: string + description: >- + ValidatorParams restrict the public key types validators can + use. + NOTE: uses ABCI pubkey naming, not Amino names. + abci: + title: 'Since: cosmos-sdk 0.50' + type: object + properties: + vote_extensions_enable_height: + type: string + format: int64 + description: >- + vote_extensions_enable_height configures the first height + during which - JSON + vote extensions will be enabled. During this specified + height, and for all - ==== + subsequent heights, precommit messages that do not contain + valid extension data - The JSON representation of an `Any` value uses the regular + will be considered invalid. Prior to this height, vote + extensions will not - representation of the deserialized, embedded message, with - an + be used or accepted by validators on the network. - additional field `@type` which contains the type URL. - Example: - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } + Once enabled, vote extensions will be created by the + application in ExtendVote, - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + passed to the application for validation in + VerifyVoteExtension and given - If the embedded message type is well-known and has a custom - JSON + to the application to use when proposing a block during + PrepareProposal. + description: >- + ABCIParams configure functionality specific to the Application + Blockchain Interface. + description: MsgUpdateParams is the Msg/UpdateParams request type. + tags: + - Msg + /cosmos.crisis.v1beta1.Msg/UpdateParams: + post: + summary: >- + UpdateParams defines a governance operation for updating the x/crisis + module - representation, that representation will be embedded adding - a field + parameters. The authority is defined in the keeper. + description: 'Since: cosmos-sdk 0.47' + operationId: CosmosCrisisV1Beta1Msg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a - `value` which holds the custom JSON in addition to the - `@type` + MsgUpdateParams message. - field. Example (for message [google.protobuf.Duration][]): - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } + Since: cosmos-sdk 0.47 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} parameters: - - name: address_string - in: path + - name: body + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + in: body required: true - type: string + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + constant_fee: + description: constant_fee defines the x/crisis parameter. + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 tags: - - Query - /cosmos/auth/v1beta1/module_accounts: - get: - summary: ModuleAccounts returns all the existing module accounts. - description: 'Since: cosmos-sdk 0.46' - operationId: CosmosAuthV1Beta1ModuleAccounts + - Msg + /cosmos.crisis.v1beta1.Msg/VerifyInvariant: + post: + summary: VerifyInvariant defines a method to verify a particular invariant. + operationId: CosmosCrisisV1Beta1Msg_VerifyInvariant responses: '200': description: A successful response. + schema: + type: object + description: >- + MsgVerifyInvariantResponse defines the Msg/VerifyInvariant + response type. + default: + description: An unexpected error response. schema: type: object properties: - accounts: + code: + type: integer + format: int32 + message: + type: string + details: type: array items: type: object properties: '@type': type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. + parameters: + - name: body + description: >- + MsgVerifyInvariant represents a message to verify a particular + invariance. + in: body + required: true + schema: + type: object + properties: + sender: + type: string + description: >- + sender is the account address of private key to send coins to + fee collector account. + invariant_module_name: + type: string + description: name of the invariant module. + invariant_route: + type: string + description: invariant_route is the msg's invariant route. + description: >- + MsgVerifyInvariant represents a message to verify a particular + invariance. + tags: + - Msg + /cosmos.distribution.v1beta1.Msg/CommunityPoolSpend: + post: + summary: >- + CommunityPoolSpend defines a governance operation for sending tokens + from - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } + the community pool in the x/distribution module to another account, + which - Example 2: Pack and unpack a message in Java. + could be the governance module itself. The authority is defined in the - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } + keeper. + description: 'Since: cosmos-sdk 0.47' + operationId: CosmosDistributionV1Beta1Msg_CommunityPoolSpend + responses: + '200': + description: A successful response. + schema: + type: object + description: |- + MsgCommunityPoolSpendResponse defines the response to executing a + MsgCommunityPoolSpend message. - Example 3: Pack and unpack a message in Python. + Since: cosmos-sdk 0.47 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: >- + MsgCommunityPoolSpend defines a message for sending tokens from the + community - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... + pool to another account. This message is typically executed via a + governance - Example 4: Pack and unpack a message in Go + proposal with the governance module being the executing authority. - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - The pack methods provided by protobuf library will by - default use + Since: cosmos-sdk 0.47 + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + recipient: + type: string + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - methods only use the fully qualified type name after the - last '/' + NOTE: The amount field is an Int which implements the custom + method - in the type URL, for example "foo.bar.com/x/y.z" will yield - type + signatures required by gogoproto. + description: >- + MsgCommunityPoolSpend defines a message for sending tokens from + the community - name "y.z". + pool to another account. This message is typically executed via a + governance + proposal with the governance module being the executing authority. - JSON + Since: cosmos-sdk 0.47 + tags: + - Msg + /cosmos.distribution.v1beta1.Msg/DepositValidatorRewardsPool: + post: + summary: >- + DepositValidatorRewardsPool defines a method to provide additional + rewards - ==== + to delegators to a specific validator. + description: 'Since: cosmos-sdk 0.50' + operationId: CosmosDistributionV1Beta1Msg_DepositValidatorRewardsPool + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgDepositValidatorRewardsPoolResponse defines the response to + executing a - The JSON representation of an `Any` value uses the regular + MsgDepositValidatorRewardsPool message. - representation of the deserialized, embedded message, with - an - additional field `@type` which contains the type URL. - Example: + Since: cosmos-sdk 0.50 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: |- + DepositValidatorRewardsPool defines the request structure to provide + additional rewards to delegators from a specific validator. - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } + Since: cosmos-sdk 0.50 + in: body + required: true + schema: + type: object + properties: + depositor: + type: string + validator_address: + type: string + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - If the embedded message type is well-known and has a custom - JSON + NOTE: The amount field is an Int which implements the custom + method - representation, that representation will be embedded adding - a field + signatures required by gogoproto. + description: >- + DepositValidatorRewardsPool defines the request structure to + provide - `value` which holds the custom JSON in addition to the - `@type` + additional rewards to delegators from a specific validator. - field. Example (for message [google.protobuf.Duration][]): - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } + Since: cosmos-sdk 0.50 + tags: + - Msg + /cosmos.distribution.v1beta1.Msg/FundCommunityPool: + post: + summary: |- + FundCommunityPool defines a method to allow an account to directly + fund the community pool. + operationId: CosmosDistributionV1Beta1Msg_FundCommunityPool + responses: + '200': + description: A successful response. + schema: + type: object description: >- - QueryModuleAccountsResponse is the response type for the - Query/ModuleAccounts RPC method. - - - Since: cosmos-sdk 0.46 + MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool + response type. default: description: An unexpected error response. schema: @@ -2299,40 +2268,403 @@ paths: properties: '@type': type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type + additionalProperties: {} + parameters: + - name: body + description: |- + MsgFundCommunityPool allows an account to directly + fund the community pool. + in: body + required: true + schema: + type: object + properties: + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - server that maps type URLs to message definitions as - follows: + NOTE: The amount field is an Int which implements the custom + method - * If no scheme is provided, `https` is assumed. + signatures required by gogoproto. + depositor: + type: string + description: |- + MsgFundCommunityPool allows an account to directly + fund the community pool. + tags: + - Msg + /cosmos.distribution.v1beta1.Msg/SetWithdrawAddress: + post: + summary: |- + SetWithdrawAddress defines a method to change the withdraw address + for a delegator (or validator self-delegation). + operationId: CosmosDistributionV1Beta1Msg_SetWithdrawAddress + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress + response - * An HTTP GET on the URL must yield a + type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: |- + MsgSetWithdrawAddress sets the withdraw address for + a delegator (or validator self-delegation). + in: body + required: true + schema: + type: object + properties: + delegator_address: + type: string + withdraw_address: + type: string + description: |- + MsgSetWithdrawAddress sets the withdraw address for + a delegator (or validator self-delegation). + tags: + - Msg + /cosmos.distribution.v1beta1.Msg/UpdateParams: + post: + summary: >- + UpdateParams defines a governance operation for updating the + x/distribution + + module parameters. The authority is defined in the keeper. + description: 'Since: cosmos-sdk 0.47' + operationId: CosmosDistributionV1Beta1Msg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a + + MsgUpdateParams message. + + + Since: cosmos-sdk 0.47 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + params: + description: |- + params defines the x/distribution parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + community_tax: + type: string + base_proposer_reward: + type: string + description: >- + Deprecated: The base_proposer_reward field is deprecated + and is no longer used + + in the x/distribution module's reward mechanism. + bonus_proposer_reward: + type: string + description: >- + Deprecated: The bonus_proposer_reward field is deprecated + and is no longer used + + in the x/distribution module's reward mechanism. + withdraw_addr_enabled: + type: boolean + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + tags: + - Msg + /cosmos.distribution.v1beta1.Msg/WithdrawDelegatorReward: + post: + summary: >- + WithdrawDelegatorReward defines a method to withdraw rewards of + delegator + + from a single validator. + operationId: CosmosDistributionV1Beta1Msg_WithdrawDelegatorReward + responses: + '200': + description: A successful response. + schema: + type: object + properties: + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: 'Since: cosmos-sdk 0.46' + description: >- + MsgWithdrawDelegatorRewardResponse defines the + Msg/WithdrawDelegatorReward + + response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: >- + MsgWithdrawDelegatorReward represents delegation withdrawal to a + delegator + + from a single validator. + in: body + required: true + schema: + type: object + properties: + delegator_address: + type: string + validator_address: + type: string + description: >- + MsgWithdrawDelegatorReward represents delegation withdrawal to a + delegator + + from a single validator. + tags: + - Msg + /cosmos.distribution.v1beta1.Msg/WithdrawValidatorCommission: + post: + summary: |- + WithdrawValidatorCommission defines a method to withdraw the + full commission to the validator address. + operationId: CosmosDistributionV1Beta1Msg_WithdrawValidatorCommission + responses: + '200': + description: A successful response. + schema: + type: object + properties: + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: 'Since: cosmos-sdk 0.46' + description: |- + MsgWithdrawValidatorCommissionResponse defines the + Msg/WithdrawValidatorCommission response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: >- + MsgWithdrawValidatorCommission withdraws the full commission to the + validator + + address. + in: body + required: true + schema: + type: object + properties: + validator_address: + type: string + description: >- + MsgWithdrawValidatorCommission withdraws the full commission to + the validator + + address. + tags: + - Msg + /cosmos.evidence.v1beta1.Msg/SubmitEvidence: + post: + summary: >- + SubmitEvidence submits an arbitrary Evidence of misbehavior such as + equivocation or + + counterfactual signing. + operationId: CosmosEvidenceV1Beta1Msg_SubmitEvidence + responses: + '200': + description: A successful response. + schema: + type: object + properties: + hash: + type: string + format: byte + description: hash defines the hash of the evidence. + description: >- + MsgSubmitEvidenceResponse defines the Msg/SubmitEvidence response + type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] value in binary format, or produce an error. * Applications are allowed to cache lookup results based @@ -2388,8 +2720,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -2399,7 +2735,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -2427,10 +2763,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -2467,19 +2801,24 @@ paths: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } - tags: - - Query - /cosmos/auth/v1beta1/module_accounts/{name}: - get: - summary: ModuleAccountByName returns the module account info by module name - operationId: CosmosAuthV1Beta1ModuleAccountByName - responses: - '200': - description: A successful response. + parameters: + - name: body + description: >- + MsgSubmitEvidence represents a message that supports submitting + arbitrary + + Evidence of misbehavior such as equivocation or counterfactual + signing. + in: body + required: true schema: type: object properties: - account: + submitter: + type: string + description: submitter is the signer account address of evidence. + evidence: + description: evidence defines the evidence of misbehavior. type: object properties: '@type': @@ -2540,117 +2879,28 @@ paths: used with implementation specific semantics. additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): + description: >- + MsgSubmitEvidence represents a message that supports submitting + arbitrary - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } + Evidence of misbehavior such as equivocation or counterfactual + signing. + tags: + - Msg + /cosmos.feegrant.v1beta1.Msg/GrantAllowance: + post: + summary: |- + GrantAllowance grants fee allowance to the grantee on the granter's + account with the provided expiration time. + operationId: CosmosFeegrantV1Beta1Msg_GrantAllowance + responses: + '200': + description: A successful response. + schema: + type: object description: >- - QueryModuleAccountByNameResponse is the response type for the - Query/ModuleAccountByName RPC method. + MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse + response type. default: description: An unexpected error response. schema: @@ -2757,8 +3007,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -2768,7 +3022,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -2796,10 +3050,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -2837,93 +3089,165 @@ paths: "value": "1.212s" } parameters: - - name: name - in: path + - name: body + description: >- + MsgGrantAllowance adds permission for Grantee to spend up to + Allowance + + of fees from the account of Granter. + in: body required: true - type: string - tags: - - Query - /cosmos/auth/v1beta1/params: - get: - summary: Params queries all parameters. - operationId: CosmosAuthV1Beta1Params - responses: - '200': - description: A successful response. schema: type: object properties: - params: - description: params defines the parameters of the module. + granter: + type: string + description: >- + granter is the address of the user granting an allowance of + their funds. + grantee: + type: string + description: >- + grantee is the address of the user being granted an allowance + of another user's funds. + allowance: + description: >- + allowance can be any of basic, periodic, allowed fee + allowance. type: object properties: - max_memo_characters: - type: string - format: uint64 - tx_sig_limit: - type: string - format: uint64 - tx_size_cost_per_byte: - type: string - format: uint64 - sig_verify_cost_ed25519: - type: string - format: uint64 - sig_verify_cost_secp256k1: + '@type': type: string - format: uint64 - description: >- - QueryParamsResponse is the response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized + description: >- + A URL/resource name that uniquely identifies the type of + the serialized - protocol buffer message. This string must contain at - least + protocol buffer message. This string must contain at least - one "/" character. The last segment of the URL's path - must represent + one "/" character. The last segment of the URL's path must + represent - the fully qualified name of the type (as in + the fully qualified name of the type (as in - `path/google.protobuf.Duration`). The name should be in - a canonical form + `path/google.protobuf.Duration`). The name should be in a + canonical form - (e.g., leading "." is not accepted). + (e.g., leading "." is not accepted). - In practice, teams usually precompile into the binary - all types that they + In practice, teams usually precompile into the binary all + types that they - expect it to use in the context of Any. However, for - URLs which use the + expect it to use in the context of Any. However, for URLs + which use the - scheme `http`, `https`, or no scheme, one can optionally - set up a type + scheme `http`, `https`, or no scheme, one can optionally + set up a type - server that maps type URLs to message definitions as - follows: + server that maps type URLs to message definitions as + follows: - * If no scheme is provided, `https` is assumed. + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + MsgGrantAllowance adds permission for Grantee to spend up to + Allowance + + of fees from the account of Granter. + tags: + - Msg + /cosmos.feegrant.v1beta1.Msg/PruneAllowances: + post: + summary: >- + PruneAllowances prunes expired fee allowances, currently up to 75 at a + time. + description: Since cosmos-sdk 0.50 + operationId: CosmosFeegrantV1Beta1Msg_PruneAllowances + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgPruneAllowancesResponse defines the Msg/PruneAllowancesResponse + response type. + + + Since cosmos-sdk 0.50 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. * An HTTP GET on the URL must yield a [google.protobuf.Type][] @@ -2981,8 +3305,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -2992,7 +3320,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -3020,10 +3348,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -3060,237 +3386,40 @@ paths: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } + parameters: + - name: body + description: |- + MsgPruneAllowances prunes expired fee allowances. + + Since cosmos-sdk 0.50 + in: body + required: true + schema: + type: object + properties: + pruner: + type: string + description: pruner is the address of the user pruning expired allowances. + description: |- + MsgPruneAllowances prunes expired fee allowances. + + Since cosmos-sdk 0.50 tags: - - Query - /cosmos/authz/v1beta1/grants: - get: - summary: Returns list of `Authorization`, granted to the grantee by the granter. - operationId: CosmosAuthzV1Beta1Grants + - Msg + /cosmos.feegrant.v1beta1.Msg/RevokeAllowance: + post: + summary: |- + RevokeAllowance revokes any fee allowance of granter's account that + has been granted to the grantee. + operationId: CosmosFeegrantV1Beta1Msg_RevokeAllowance responses: '200': description: A successful response. schema: type: object - properties: - grants: - type: array - items: - type: object - properties: - authorization: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message - [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - expiration: - type: string - format: date-time - title: >- - time when the grant will expire and will be pruned. If - null, then the grant - - doesn't have a time expiration (other conditions in - `authorization` - - may apply to invalidate the grant) - description: |- - Grant gives permissions to execute - the provide method with expiration time. - description: >- - authorizations is a list of grants granted for grantee by - granter. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise description: >- - QueryGrantsResponse is the response type for the - Query/Authorizations RPC method. + MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse + response type. default: description: An unexpected error response. schema: @@ -3397,8 +3526,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -3408,7 +3541,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -3436,10 +3569,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -3477,305 +3608,63 @@ paths: "value": "1.212s" } parameters: - - name: granter - in: query - required: false - type: string - - name: grantee - in: query - required: false - type: string - - name: msg_type_url - description: >- - Optional, msg_type_url, when set, will query only grants matching - given msg type. - in: query - required: false - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse + - name: body description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean + MsgRevokeAllowance removes any existing Allowance from Granter to + Grantee. + in: body + required: true + schema: + type: object + properties: + granter: + type: string + description: >- + granter is the address of the user granting an allowance of + their funds. + grantee: + type: string + description: >- + grantee is the address of the user being granted an allowance + of another user's funds. + description: >- + MsgRevokeAllowance removes any existing Allowance from Granter to + Grantee. tags: - - Query - /cosmos/authz/v1beta1/grants/grantee/{grantee}: - get: - summary: GranteeGrants returns a list of `GrantAuthorization` by grantee. - description: 'Since: cosmos-sdk 0.46' - operationId: CosmosAuthzV1Beta1GranteeGrants + - Msg + /cosmos.gov.v1.Msg/CancelProposal: + post: + summary: CancelProposal defines a method to cancel governance proposal + description: 'Since: cosmos-sdk 0.50' + operationId: CosmosGovV1Msg_CancelProposal responses: '200': description: A successful response. schema: type: object properties: - grants: - type: array - items: - type: object - properties: - granter: - type: string - grantee: - type: string - authorization: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + canceled_time: + type: string + format: date-time + description: canceled_time is the time when proposal is canceled. + canceled_height: + type: string + format: uint64 + description: >- + canceled_height defines the block height at which the proposal + is canceled. + description: >- + MsgCancelProposalResponse defines the response structure for + executing a - field. Example (for message - [google.protobuf.Duration][]): + MsgCancelProposal message. - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - expiration: - type: string - format: date-time - title: >- - GrantAuthorization extends a grant with both the addresses - of the grantee and granter. - - It is used in genesis.proto and query.proto - description: grants is a list of grants granted to the grantee. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - was set, its value is undefined otherwise - description: >- - QueryGranteeGrantsResponse is the response type for the - Query/GranteeGrants RPC method. + Since: cosmos-sdk 0.50 default: description: An unexpected error response. schema: @@ -3882,8 +3771,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -3893,7 +3786,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -3921,10 +3814,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -3962,294 +3853,39 @@ paths: "value": "1.212s" } parameters: - - name: grantee - in: path - required: true - type: string - - name: pagination.key + - name: body description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. + MsgCancelProposal is the Msg/CancelProposal request type. + Since: cosmos-sdk 0.50 + in: body + required: true + schema: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + proposer: + type: string + description: proposer is the account address of the proposer. + description: |- + MsgCancelProposal is the Msg/CancelProposal request type. - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean + Since: cosmos-sdk 0.50 tags: - - Query - /cosmos/authz/v1beta1/grants/granter/{granter}: - get: - summary: GranterGrants returns list of `GrantAuthorization`, granted by granter. - description: 'Since: cosmos-sdk 0.46' - operationId: CosmosAuthzV1Beta1GranterGrants + - Msg + /cosmos.gov.v1.Msg/Deposit: + post: + summary: Deposit defines a method to add deposit on a specific proposal. + operationId: CosmosGovV1Msg_Deposit responses: '200': description: A successful response. schema: type: object - properties: - grants: - type: array - items: - type: object - properties: - granter: - type: string - grantee: - type: string - authorization: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message - [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - expiration: - type: string - format: date-time - title: >- - GrantAuthorization extends a grant with both the addresses - of the grantee and granter. - - It is used in genesis.proto and query.proto - description: grants is a list of grants granted by the granter. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGranterGrantsResponse is the response type for the - Query/GranterGrants RPC method. + description: MsgDepositResponse defines the Msg/Deposit response type. default: description: An unexpected error response. schema: @@ -4356,8 +3992,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -4367,7 +4007,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -4395,10 +4035,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -4436,84 +4074,23 @@ paths: "value": "1.212s" } parameters: - - name: granter - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse + - name: body description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/bank/v1beta1/balances/{address}: - get: - summary: AllBalances queries the balance of all coins for a single account. - description: >- - When called from another module, this query might consume a high amount - of - - gas if the pagination field is incorrectly set. - operationId: CosmosBankV1Beta1AllBalances - responses: - '200': - description: A successful response. + MsgDeposit defines a message to submit a deposit to an existing + proposal. + in: body + required: true schema: type: object properties: - balances: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + depositor: + type: string + description: depositor defines the deposit addresses from the proposals. + amount: type: array items: type: object @@ -4530,33 +4107,28 @@ paths: method signatures required by gogoproto. - description: balances is the balances of all the coins. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise + description: amount to be deposited by depositor. description: >- - QueryAllBalancesResponse is the response type for the - Query/AllBalances RPC - - method. - default: - description: An unexpected error response. + MsgDeposit defines a message to submit a deposit to an existing + proposal. + tags: + - Msg + /cosmos.gov.v1.Msg/ExecLegacyContent: + post: + summary: |- + ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal + to execute a legacy content-based proposal. + operationId: CosmosGovV1Msg_ExecLegacyContent + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent + response type. + default: + description: An unexpected error response. schema: type: object properties: @@ -4572,667 +4144,280 @@ paths: properties: '@type': type: string - additionalProperties: {} - parameters: - - name: address - description: address is the address to query balances for. - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. + description: >- + A URL/resource name that uniquely identifies the type of + the serialized - It is less efficient than using key. Only one of offset or key - should + protocol buffer message. This string must contain at + least - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. + one "/" character. The last segment of the URL's path + must represent - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include + the fully qualified name of the type (as in - a count of the total number of items available for pagination in - UIs. + `path/google.protobuf.Duration`). The name should be in + a canonical form - count_total is only respected when offset is used. It is ignored - when key + (e.g., leading "." is not accepted). - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. + In practice, teams usually precompile into the binary + all types that they - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/bank/v1beta1/balances/{address}/by_denom: - get: - summary: Balance queries the balance of a single coin for a single account. - operationId: CosmosBankV1Beta1Balance - responses: - '200': - description: A successful response. - schema: - type: object - properties: - balance: - description: balance is the balance of the coin. - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - QueryBalanceResponse is the response type for the Query/Balance - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: address - description: address is the address to query balances for. - in: path - required: true - type: string - - name: denom - description: denom is the coin denom to query balances for. - in: query - required: false - type: string - tags: - - Query - /cosmos/bank/v1beta1/denom_owners/{denom}: - get: - summary: >- - DenomOwners queries for all account addresses that own a particular - token + expect it to use in the context of Any. However, for + URLs which use the - denomination. - description: >- - When called from another module, this query might consume a high amount - of + scheme `http`, `https`, or no scheme, one can optionally + set up a type - gas if the pagination field is incorrectly set. + server that maps type URLs to message definitions as + follows: - Since: cosmos-sdk 0.46 - operationId: CosmosBankV1Beta1DenomOwners - responses: - '200': - description: A successful response. - schema: - type: object - properties: - denom_owners: - type: array - items: - type: object - properties: - address: - type: string - description: >- - address defines the address that owns a particular - denomination. - balance: - description: >- - balance is the balance of the denominated coin for an - account. - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DenomOwner defines structure representing an account that - owns or holds a + * If no scheme is provided, `https` is assumed. - particular denominated token. It contains the account - address and account + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - balance of the denominated token. + Note: this functionality is not currently available in + the official + protobuf release, and it is not used for type URLs + beginning with - Since: cosmos-sdk 0.46 - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + type.googleapis.com. - was set, its value is undefined otherwise - description: >- - QueryDenomOwnersResponse defines the RPC response of a DenomOwners - RPC query. + Schemes other than `http`, `https` (or the empty scheme) + might be - Since: cosmos-sdk 0.46 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string + used with implementation specific semantics. additionalProperties: {} - parameters: - - name: denom - description: >- - denom defines the coin denomination to query all account holders - for. - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a - It is less efficient than using key. Only one of offset or key - should + URL that describes the type of the serialized message. - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include + Protobuf library provides support to pack/unpack Any values + in the form - a count of the total number of items available for pagination in - UIs. + of utility functions or additional generated methods of the + Any type. - count_total is only respected when offset is used. It is ignored - when key - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. + Example 1: Pack and unpack a message in C++. + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/bank/v1beta1/denoms_metadata: - get: - summary: |- - DenomsMetadata queries the client metadata for all registered coin - denominations. - operationId: CosmosBankV1Beta1DenomsMetadata - responses: - '200': - description: A successful response. - schema: - type: object - properties: - metadatas: - type: array - items: - type: object - properties: - description: - type: string - denom_units: - type: array - items: - type: object - properties: - denom: - type: string - description: >- - denom represents the string name of the given - denom unit (e.g uatom). - exponent: - type: integer - format: int64 - description: >- - exponent represents power of 10 exponent that one - must - - raise the base_denom to in order to equal the - given DenomUnit's denom - - 1 denom = 10^exponent base_denom - - (e.g. with a base_denom of uatom, one can create a - DenomUnit of 'atom' with - - exponent = 6, thus: 1 atom = 10^6 uatom). - aliases: - type: array - items: - type: string - title: >- - aliases is a list of string aliases for the given - denom - description: |- - DenomUnit represents a struct that describes a given - denomination unit of the basic token. - title: >- - denom_units represents the list of DenomUnit's for a - given coin - base: - type: string - description: >- - base represents the base denom (should be the DenomUnit - with exponent = 0). - display: - type: string - description: |- - display indicates the suggested denom that should be - displayed in clients. - name: - type: string - description: 'Since: cosmos-sdk 0.43' - title: 'name defines the name of the token (eg: Cosmos Atom)' - symbol: - type: string - description: >- - symbol is the token symbol usually shown on exchanges - (eg: ATOM). This can + Example 2: Pack and unpack a message in Java. - be the same as the display. + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + Example 3: Pack and unpack a message in Python. - Since: cosmos-sdk 0.43 - uri: - type: string - description: >- - URI to a document (on or off-chain) that contains - additional information. Optional. + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + Example 4: Pack and unpack a message in Go - Since: cosmos-sdk 0.46 - uri_hash: - type: string - description: >- - URIHash is a sha256 hash of a document pointed by URI. - It's used to verify that + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } - the document didn't change. Optional. + The pack methods provided by protobuf library will by + default use + 'type.googleapis.com/full.type.name' as the type URL and the + unpack - Since: cosmos-sdk 0.46 - description: |- - Metadata represents a struct that describes - a basic token. - description: >- - metadata provides the client information for all the - registered tokens. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + methods only use the fully qualified type name after the + last '/' - was set, its value is undefined otherwise - description: >- - QueryDenomsMetadataResponse is the response type for the - Query/DenomsMetadata RPC + in the type URL, for example "foo.bar.com/x/y.z" will yield + type - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. + name "y.z". - It is less efficient than using key. Only one of offset or key - should - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. + JSON - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - a count of the total number of items available for pagination in - UIs. + The JSON representation of an `Any` value uses the regular - count_total is only respected when offset is used. It is ignored - when key + representation of the deserialized, embedded message, with + an - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. + additional field `@type` which contains the type URL. + Example: + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/bank/v1beta1/denoms_metadata/{denom}: - get: - summary: DenomsMetadata queries the client metadata of a given coin denomination. - operationId: CosmosBankV1Beta1DenomMetadata - responses: - '200': - description: A successful response. + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgExecLegacyContent is used to wrap the legacy content field into a + message. + + This ensures backwards compatibility with v1beta1.MsgSubmitProposal. + in: body + required: true schema: type: object properties: - metadata: - description: >- - metadata describes and provides all the client information for - the requested token. + content: + description: content is the proposal's content. type: object properties: - description: + '@type': type: string - denom_units: - type: array - items: - type: object - properties: - denom: - type: string - description: >- - denom represents the string name of the given denom - unit (e.g uatom). - exponent: - type: integer - format: int64 - description: >- - exponent represents power of 10 exponent that one - must + description: >- + A URL/resource name that uniquely identifies the type of + the serialized - raise the base_denom to in order to equal the given - DenomUnit's denom + protocol buffer message. This string must contain at least - 1 denom = 10^exponent base_denom + one "/" character. The last segment of the URL's path must + represent - (e.g. with a base_denom of uatom, one can create a - DenomUnit of 'atom' with + the fully qualified name of the type (as in - exponent = 6, thus: 1 atom = 10^6 uatom). - aliases: - type: array - items: - type: string - title: >- - aliases is a list of string aliases for the given - denom - description: |- - DenomUnit represents a struct that describes a given - denomination unit of the basic token. - title: >- - denom_units represents the list of DenomUnit's for a given - coin - base: - type: string - description: >- - base represents the base denom (should be the DenomUnit - with exponent = 0). - display: - type: string - description: |- - display indicates the suggested denom that should be - displayed in clients. - name: - type: string - description: 'Since: cosmos-sdk 0.43' - title: 'name defines the name of the token (eg: Cosmos Atom)' - symbol: - type: string - description: >- - symbol is the token symbol usually shown on exchanges (eg: - ATOM). This can + `path/google.protobuf.Duration`). The name should be in a + canonical form - be the same as the display. + (e.g., leading "." is not accepted). - Since: cosmos-sdk 0.43 - uri: - type: string - description: >- - URI to a document (on or off-chain) that contains - additional information. Optional. + In practice, teams usually precompile into the binary all + types that they + expect it to use in the context of Any. However, for URLs + which use the - Since: cosmos-sdk 0.46 - uri_hash: - type: string - description: >- - URIHash is a sha256 hash of a document pointed by URI. - It's used to verify that + scheme `http`, `https`, or no scheme, one can optionally + set up a type - the document didn't change. Optional. + server that maps type URLs to message definitions as + follows: - Since: cosmos-sdk 0.46 - description: >- - QueryDenomMetadataResponse is the response type for the - Query/DenomMetadata RPC + * If no scheme is provided, `https` is assumed. - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + authority: type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: denom - description: denom is the coin denom to query the metadata for. - in: path - required: true - type: string + description: authority must be the gov module address. + description: >- + MsgExecLegacyContent is used to wrap the legacy content field into + a message. + + This ensures backwards compatibility with + v1beta1.MsgSubmitProposal. tags: - - Query - /cosmos/bank/v1beta1/params: - get: - summary: Params queries the parameters of x/bank module. - operationId: CosmosBankV1Beta1Params + - Msg + /cosmos.gov.v1.Msg/SubmitProposal: + post: + summary: >- + SubmitProposal defines a method to create new proposal given the + messages. + operationId: CosmosGovV1Msg_SubmitProposal responses: '200': description: A successful response. schema: type: object properties: - params: - type: object - properties: - send_enabled: - type: array - items: - type: object - properties: - denom: - type: string - enabled: - type: boolean - description: >- - SendEnabled maps coin denom to a send_enabled status - (whether a denom is - - sendable). - description: >- - Deprecated: Use of SendEnabled in params is deprecated. - - For genesis, use the newly added send_enabled field in the - genesis object. - - Storage, lookup, and manipulation of this information is - now in the keeper. - - - As of cosmos-sdk 0.47, this only exists for backwards - compatibility of genesis files. - default_send_enabled: - type: boolean - description: Params defines the parameters for the bank module. + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. description: >- - QueryParamsResponse defines the response type for querying x/bank - parameters. + MsgSubmitProposalResponse defines the Msg/SubmitProposal response + type. default: description: An unexpected error response. schema: @@ -5250,697 +4435,189 @@ paths: properties: '@type': type: string - additionalProperties: {} - tags: - - Query - /cosmos/bank/v1beta1/send_enabled: - get: - summary: SendEnabled queries for SendEnabled entries. - description: >- - This query only returns denominations that have specific SendEnabled - settings. + description: >- + A URL/resource name that uniquely identifies the type of + the serialized - Any denomination that does not have a specific setting will use the - default + protocol buffer message. This string must contain at + least - params.default_send_enabled, and will not be returned by this query. + one "/" character. The last segment of the URL's path + must represent + the fully qualified name of the type (as in - Since: cosmos-sdk 0.47 - operationId: CosmosBankV1Beta1SendEnabled - responses: - '200': - description: A successful response. - schema: - type: object - properties: - send_enabled: - type: array - items: - type: object - properties: - denom: - type: string - enabled: - type: boolean - description: >- - SendEnabled maps coin denom to a send_enabled status - (whether a denom is - - sendable). - pagination: - description: >- - pagination defines the pagination in the response. This field - is only - - populated if the denoms field in the request is empty. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QuerySendEnabledResponse defines the RPC response of a SendEnable - query. - - - Since: cosmos-sdk 0.47 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: denoms - description: >- - denoms is the specific denoms you want look up. Leave empty to get - all entries. - in: query - required: false - type: array - items: - type: string - collectionFormat: multi - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. + `path/google.protobuf.Duration`). The name should be in + a canonical form - count_total is only respected when offset is used. It is ignored - when key + (e.g., leading "." is not accepted). - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. + In practice, teams usually precompile into the binary + all types that they - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/bank/v1beta1/spendable_balances/{address}: - get: - summary: >- - SpendableBalances queries the spendable balance of all coins for a - single + expect it to use in the context of Any. However, for + URLs which use the - account. - description: >- - When called from another module, this query might consume a high amount - of + scheme `http`, `https`, or no scheme, one can optionally + set up a type - gas if the pagination field is incorrectly set. + server that maps type URLs to message definitions as + follows: - Since: cosmos-sdk 0.46 - operationId: CosmosBankV1Beta1SpendableBalances - responses: - '200': - description: A successful response. - schema: - type: object - properties: - balances: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. + * If no scheme is provided, `https` is assumed. + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - NOTE: The amount field is an Int which implements the custom - method + Note: this functionality is not currently available in + the official - signatures required by gogoproto. - description: balances is the spendable balances of all the coins. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + protobuf release, and it is not used for type URLs + beginning with - was set, its value is undefined otherwise - description: >- - QuerySpendableBalancesResponse defines the gRPC response structure - for querying + type.googleapis.com. - an account's spendable balances. + Schemes other than `http`, `https` (or the empty scheme) + might be - Since: cosmos-sdk 0.46 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string + used with implementation specific semantics. additionalProperties: {} - parameters: - - name: address - description: address is the address to query spendable balances for. - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a - It is less efficient than using key. Only one of offset or key - should + URL that describes the type of the serialized message. - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include + Protobuf library provides support to pack/unpack Any values + in the form - a count of the total number of items available for pagination in - UIs. + of utility functions or additional generated methods of the + Any type. - count_total is only respected when offset is used. It is ignored - when key - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. + Example 1: Pack and unpack a message in C++. + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/bank/v1beta1/spendable_balances/{address}/by_denom: - get: - summary: >- - SpendableBalanceByDenom queries the spendable balance of a single denom - for + Example 2: Pack and unpack a message in Java. - a single account. - description: >- - When called from another module, this query might consume a high amount - of + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - gas if the pagination field is incorrectly set. + Example 3: Pack and unpack a message in Python. + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... - Since: cosmos-sdk 0.47 - operationId: CosmosBankV1Beta1SpendableBalanceByDenom - responses: - '200': - description: A successful response. - schema: - type: object - properties: - balance: - description: balance is the balance of the coin. - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - QuerySpendableBalanceByDenomResponse defines the gRPC response - structure for + Example 4: Pack and unpack a message in Go - querying an account's spendable balance for a specific denom. + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + The pack methods provided by protobuf library will by + default use - Since: cosmos-sdk 0.47 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: address - description: address is the address to query balances for. - in: path - required: true - type: string - - name: denom - description: denom is the coin denom to query balances for. - in: query - required: false - type: string - tags: - - Query - /cosmos/bank/v1beta1/supply: - get: - summary: TotalSupply queries the total supply of all coins. - description: >- - When called from another module, this query might consume a high amount - of + 'type.googleapis.com/full.type.name' as the type URL and the + unpack - gas if the pagination field is incorrectly set. - operationId: CosmosBankV1Beta1TotalSupply - responses: - '200': - description: A successful response. - schema: - type: object - properties: - supply: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. + methods only use the fully qualified type name after the + last '/' + in the type URL, for example "foo.bar.com/x/y.z" will yield + type - NOTE: The amount field is an Int which implements the custom - method + name "y.z". - signatures required by gogoproto. - title: supply is the supply of the coins - pagination: - description: |- - pagination defines the pagination in the response. - Since: cosmos-sdk 0.43 - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + JSON - was set, its value is undefined otherwise - title: >- - QueryTotalSupplyResponse is the response type for the - Query/TotalSupply RPC - method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. + The JSON representation of an `Any` value uses the regular - It is less efficient than using key. Only one of offset or key - should + representation of the deserialized, embedded message, with + an - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. + additional field `@type` which contains the type URL. + Example: - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } - a count of the total number of items available for pagination in - UIs. + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } - count_total is only respected when offset is used. It is ignored - when key + If the embedded message type is well-known and has a custom + JSON - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. + representation, that representation will be embedded adding + a field + `value` which holds the custom JSON in addition to the + `@type` - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/bank/v1beta1/supply/by_denom: - get: - summary: SupplyOf queries the supply of a single coin. - description: >- - When called from another module, this query might consume a high amount - of + field. Example (for message [google.protobuf.Duration][]): - gas if the pagination field is incorrectly set. - operationId: CosmosBankV1Beta1SupplyOf - responses: - '200': - description: A successful response. - schema: - type: object - properties: - amount: - description: amount is the supply of the coin. - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - QuerySupplyOfResponse is the response type for the Query/SupplyOf - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } parameters: - - name: denom - description: denom is the coin denom to query balances for. - in: query - required: false - type: string - tags: - - Query - /cosmos/base/node/v1beta1/config: - get: - summary: Config queries for the operator configuration. - operationId: CosmosBaseNodeV1Beta1Config - responses: - '200': - description: A successful response. - schema: - type: object - properties: - minimum_gas_price: - type: string - description: >- - ConfigResponse defines the response structure for the Config gRPC - query. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Service - /cosmos/base/tendermint/v1beta1/abci_query: - get: - summary: >- - ABCIQuery defines a query handler that supports ABCI queries directly to - the - - application, bypassing Tendermint completely. The ABCI query must - contain - - a valid and supported path, including app, custom, p2p, and store. - description: 'Since: cosmos-sdk 0.46' - operationId: CosmosBaseTendermintV1Beta1ABCIQuery - responses: - '200': - description: A successful response. - schema: - type: object - properties: - code: - type: integer - format: int64 - log: - type: string - title: nondeterministic - info: - type: string - title: nondeterministic - index: - type: string - format: int64 - key: - type: string - format: byte - value: - type: string - format: byte - proof_ops: - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - description: >- - ProofOp defines an operation used for calculating Merkle - root. The data could - - be arbitrary format, providing necessary data for - example neighbouring node - - hash. - - - Note: This type is a duplicate of the ProofOp proto type - defined in Tendermint. - description: >- - ProofOps is Merkle proof defined by the list of ProofOps. - - - Note: This type is a duplicate of the ProofOps proto type - defined in Tendermint. - height: - type: string - format: int64 - codespace: - type: string - description: >- - ABCIQueryResponse defines the response structure for the ABCIQuery - gRPC query. - - - Note: This type is a duplicate of the ResponseQuery proto type - defined in + - name: body + description: >- + MsgSubmitProposal defines an sdk.Msg type that supports submitting + arbitrary - Tendermint. - default: - description: An unexpected error response. + proposal Content. + in: body + required: true schema: type: object properties: - code: - type: integer - format: int32 - message: - type: string - details: + messages: type: array items: type: object @@ -6036,8 +4713,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -6047,7 +4728,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -6075,10 +4756,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -6115,1199 +4794,78 @@ paths: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } - parameters: - - name: data - in: query - required: false - type: string - format: byte - - name: path - in: query - required: false - type: string - - name: height - in: query - required: false - type: string - format: int64 - - name: prove - in: query - required: false - type: boolean - tags: - - Service - /cosmos/base/tendermint/v1beta1/blocks/latest: - get: - summary: GetLatestBlock returns the latest block. - operationId: CosmosBaseTendermintV1Beta1GetLatestBlock - responses: - '200': - description: A successful response. - schema: - type: object - properties: - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - block: - title: 'Deprecated: please use `sdk_block` instead' - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing - a block in the blockchain, - - including all blockchain data structures and the rules - of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs from the - previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. - - NOTE: not all txs here are valid. We're just agreeing - on the order first. - - This means that block.AppHash does not include these - txs. - title: >- - Data contains the set of transactions included in the - block - evidence: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed - message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or - commit vote from validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed - message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or - commit vote from validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a - validator signed two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules - for processing a block in the - blockchain, - - including all blockchain data structures - and the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: >- - commit from validators from the last - block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs - from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: >- - Header defines the structure of a block - header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included - in a Commit. - description: >- - Commit contains the evidence that a - block was committed by a set of - validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a - set of validators attempting to mislead a light - client. - last_commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included in a - Commit. - description: >- - Commit contains the evidence that a block was committed by - a set of validators. - sdk_block: - title: 'Since: cosmos-sdk 0.47' - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing - a block in the blockchain, + description: >- + messages are the arbitrary messages to be executed if proposal + passes. + initial_deposit: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - including all blockchain data structures and the rules - of the application's - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs from the - previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - description: >- - proposer_address is the original block proposer - address, formatted as a Bech32 string. + NOTE: The amount field is an Int which implements the custom + method - In Tendermint, this type is `bytes`, but in the SDK, - we convert it to a Bech32 string + signatures required by gogoproto. + description: >- + initial_deposit is the deposit value that must be paid at + proposal submission. + proposer: + type: string + description: proposer is the account address of the proposer. + metadata: + type: string + description: metadata is any arbitrary metadata attached to the proposal. + title: + type: string + description: |- + title is the title of the proposal. - for better UX. + Since: cosmos-sdk 0.47 + summary: + type: string + description: 'Since: cosmos-sdk 0.47' + title: summary is the summary of the proposal + expedited: + type: boolean + description: 'Since: cosmos-sdk 0.50' + title: expedited defines if the proposal is expedited or not + description: >- + MsgSubmitProposal defines an sdk.Msg type that supports submitting + arbitrary + proposal Content. + tags: + - Msg + /cosmos.gov.v1.Msg/UpdateParams: + post: + summary: >- + UpdateParams defines a governance operation for updating the x/gov + module - original proposer of the block - description: Header defines the structure of a Tendermint block header. - data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. + parameters. The authority is defined in the keeper. + description: 'Since: cosmos-sdk 0.47' + operationId: CosmosGovV1Msg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a - NOTE: not all txs here are valid. We're just agreeing - on the order first. + MsgUpdateParams message. - This means that block.AppHash does not include these - txs. - title: >- - Data contains the set of transactions included in the - block - evidence: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed - message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or - commit vote from validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed - message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or - commit vote from validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a - validator signed two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules - for processing a block in the - blockchain, - - including all blockchain data structures - and the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: >- - commit from validators from the last - block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs - from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: >- - Header defines the structure of a block - header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included - in a Commit. - description: >- - Commit contains the evidence that a - block was committed by a set of - validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a - set of validators attempting to mislead a light - client. - last_commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included in a - Commit. - description: >- - Commit contains the evidence that a block was committed by - a set of validators. - description: >- - Block is tendermint type Block, with the Header proposer - address - field converted to bech32 string. - description: >- - GetLatestBlockResponse is the response type for the - Query/GetLatestBlock RPC method. + Since: cosmos-sdk 0.47 default: description: An unexpected error response. schema: @@ -7414,8 +4972,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -7425,7 +4987,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -7453,10 +5015,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -7493,1180 +5053,170 @@ paths: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } - tags: - - Service - /cosmos/base/tendermint/v1beta1/blocks/{height}: - get: - summary: GetBlockByHeight queries block for given height. - operationId: CosmosBaseTendermintV1Beta1GetBlockByHeight - responses: - '200': - description: A successful response. + parameters: + - name: body + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + in: body + required: true schema: type: object properties: - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - block: - title: 'Deprecated: please use `sdk_block` instead' + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + params: + description: |- + params defines the x/gov parameters to update. + + NOTE: All parameters must be supplied. type: object properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing - a block in the blockchain, + min_deposit: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - including all blockchain data structures and the rules - of the application's - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs from the - previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. + NOTE: The amount field is an Int which implements the + custom method - NOTE: not all txs here are valid. We're just agreeing - on the order first. + signatures required by gogoproto. + description: Minimum deposit for a proposal to enter voting period. + max_deposit_period: + type: string + description: >- + Maximum period for Atom holders to deposit on a proposal. + Initial value: 2 - This means that block.AppHash does not include these - txs. - title: >- - Data contains the set of transactions included in the - block - evidence: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed - message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or - commit vote from validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed - message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or - commit vote from validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a - validator signed two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules - for processing a block in the - blockchain, - - including all blockchain data structures - and the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: >- - commit from validators from the last - block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs - from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: >- - Header defines the structure of a block - header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included - in a Commit. - description: >- - Commit contains the evidence that a - block was committed by a set of - validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a - set of validators attempting to mislead a light - client. - last_commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included in a - Commit. + months. + voting_period: + type: string + description: Duration of the voting period. + quorum: + type: string description: >- - Commit contains the evidence that a block was committed by - a set of validators. - sdk_block: - title: 'Since: cosmos-sdk 0.47' - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing - a block in the blockchain, + Minimum percentage of total stake needed to vote for a + result to be + considered valid. + threshold: + type: string + description: >- + Minimum proportion of Yes votes for proposal to pass. + Default value: 0.5. + veto_threshold: + type: string + description: >- + Minimum value of Veto votes to Total votes ratio for + proposal to be + vetoed. Default value: 1/3. + min_initial_deposit_ratio: + type: string + description: >- + The ratio representing the proportion of the deposit value + that must be paid at proposal submission. + proposal_cancel_ratio: + type: string + description: >- + The cancel ratio which will not be returned back to the + depositors when a proposal is cancelled. - including all blockchain data structures and the rules - of the application's - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs from the - previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - description: >- - proposer_address is the original block proposer - address, formatted as a Bech32 string. + Since: cosmos-sdk 0.50 + proposal_cancel_dest: + type: string + description: >- + The address which will receive (proposal_cancel_ratio * + deposit) proposal deposits. - In Tendermint, this type is `bytes`, but in the SDK, - we convert it to a Bech32 string + If empty, the (proposal_cancel_ratio * deposit) proposal + deposits will be burned. - for better UX. + Since: cosmos-sdk 0.50 + expedited_voting_period: + type: string + description: |- + Duration of the voting period of an expedited proposal. - original proposer of the block - description: Header defines the structure of a Tendermint block header. - data: - type: object - properties: - txs: - type: array - items: + Since: cosmos-sdk 0.50 + expedited_threshold: + type: string + description: >- + Minimum proportion of Yes votes for proposal to pass. + Default value: 0.67. + + + Since: cosmos-sdk 0.50 + expedited_min_deposit: + type: array + items: + type: object + properties: + denom: type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - NOTE: not all txs here are valid. We're just agreeing - on the order first. - This means that block.AppHash does not include these - txs. - title: >- - Data contains the set of transactions included in the - block - evidence: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed - message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or - commit vote from validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed - message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or - commit vote from validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a - validator signed two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules - for processing a block in the - blockchain, - - including all blockchain data structures - and the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: >- - commit from validators from the last - block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs - from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: >- - Header defines the structure of a block - header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included - in a Commit. - description: >- - Commit contains the evidence that a - block was committed by a set of - validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a - set of validators attempting to mislead a light - client. - last_commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included in a - Commit. + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. description: >- - Commit contains the evidence that a block was committed by - a set of validators. - description: >- - Block is tendermint type Block, with the Header proposer - address + Minimum expedited deposit for a proposal to enter voting + period. + burn_vote_quorum: + type: boolean + title: burn deposits if a proposal does not meet quorum + burn_proposal_deposit_prevote: + type: boolean + title: burn deposits if the proposal does not enter voting period + burn_vote_veto: + type: boolean + title: burn deposits if quorum with vote type no_veto is met + min_deposit_ratio: + type: string + description: >- + The ratio representing the proportion of the deposit value + minimum that must be met when making a deposit. - field converted to bech32 string. - description: >- - GetBlockByHeightResponse is the response type for the - Query/GetBlockByHeight RPC method. + Default value: 0.01. Meaning that for a chain with a + min_deposit of 100stake, a deposit of 1stake would be + + required. + + + Since: cosmos-sdk 0.50 + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + tags: + - Msg + /cosmos.gov.v1.Msg/Vote: + post: + summary: Vote defines a method to add a vote on a specific proposal. + operationId: CosmosGovV1Msg_Vote + responses: + '200': + description: A successful response. + schema: + type: object + description: MsgVoteResponse defines the Msg/Vote response type. default: description: An unexpected error response. schema: @@ -8773,8 +5323,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -8784,7 +5338,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -8812,10 +5366,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -8853,95 +5405,50 @@ paths: "value": "1.212s" } parameters: - - name: height - in: path + - name: body + description: MsgVote defines a message to cast a vote. + in: body required: true - type: string - format: int64 + schema: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + voter: + type: string + description: voter is the voter address for the proposal. + option: + description: option defines the vote option. + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + metadata: + type: string + description: metadata is any arbitrary metadata attached to the Vote. + description: MsgVote defines a message to cast a vote. tags: - - Service - /cosmos/base/tendermint/v1beta1/node_info: - get: - summary: GetNodeInfo queries the current node info. - operationId: CosmosBaseTendermintV1Beta1GetNodeInfo + - Msg + /cosmos.gov.v1.Msg/VoteWeighted: + post: + summary: >- + VoteWeighted defines a method to add a weighted vote on a specific + proposal. + operationId: CosmosGovV1Msg_VoteWeighted responses: '200': description: A successful response. schema: type: object - properties: - default_node_info: - type: object - properties: - protocol_version: - type: object - properties: - p2p: - type: string - format: uint64 - block: - type: string - format: uint64 - app: - type: string - format: uint64 - default_node_id: - type: string - listen_addr: - type: string - network: - type: string - version: - type: string - channels: - type: string - format: byte - moniker: - type: string - other: - type: object - properties: - tx_index: - type: string - rpc_address: - type: string - application_version: - type: object - properties: - name: - type: string - app_name: - type: string - version: - type: string - git_commit: - type: string - build_tags: - type: string - go_version: - type: string - build_deps: - type: array - items: - type: object - properties: - path: - type: string - title: module path - version: - type: string - title: module version - sum: - type: string - title: checksum - title: Module is the type for VersionInfo - cosmos_sdk_version: - type: string - title: 'Since: cosmos-sdk 0.43' - description: VersionInfo is the type for the GetNodeInfoResponse message. description: >- - GetNodeInfoResponse is the response type for the Query/GetNodeInfo - RPC method. + MsgVoteWeightedResponse defines the Msg/VoteWeighted response + type. default: description: An unexpected error response. schema: @@ -9048,8 +5555,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -9059,7 +5570,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -9087,10 +5598,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -9127,23 +5636,63 @@ paths: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } - tags: - - Service - /cosmos/base/tendermint/v1beta1/syncing: - get: - summary: GetSyncing queries node syncing. - operationId: CosmosBaseTendermintV1Beta1GetSyncing - responses: - '200': - description: A successful response. - schema: - type: object - properties: - syncing: - type: boolean - description: >- - GetSyncingResponse is the response type for the Query/GetSyncing - RPC method. + parameters: + - name: body + description: MsgVoteWeighted defines a message to cast a vote. + in: body + required: true + schema: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + voter: + type: string + description: voter is the voter address for the proposal. + options: + type: array + items: + type: object + properties: + option: + description: >- + option defines the valid vote options, it must not + contain duplicate vote options. + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + weight: + type: string + description: >- + weight is the vote weight associated with the vote + option. + description: WeightedVoteOption defines a unit of vote for vote split. + description: options defines the weighted vote options. + metadata: + type: string + description: >- + metadata is any arbitrary metadata attached to the + VoteWeighted. + description: MsgVoteWeighted defines a message to cast a vote. + tags: + - Msg + /cosmos.gov.v1beta1.Msg/Deposit: + post: + summary: Deposit defines a method to add deposit on a specific proposal. + operationId: CosmosGovV1Beta1Msg_Deposit + responses: + '200': + description: A successful response. + schema: + type: object + description: MsgDepositResponse defines the Msg/Deposit response type. default: description: An unexpected error response. schema: @@ -9250,8 +5799,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -9261,7 +5814,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -9289,10 +5842,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -9329,232 +5880,63 @@ paths: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } - tags: - - Service - /cosmos/base/tendermint/v1beta1/validatorsets/latest: - get: - summary: GetLatestValidatorSet queries latest validator-set. - operationId: CosmosBaseTendermintV1Beta1GetLatestValidatorSet - responses: - '200': - description: A successful response. + parameters: + - name: body + description: >- + MsgDeposit defines a message to submit a deposit to an existing + proposal. + in: body + required: true schema: type: object properties: - block_height: + proposal_id: type: string - format: int64 - validators: + format: uint64 + description: proposal_id defines the unique id of the proposal. + depositor: + type: string + description: depositor defines the deposit addresses from the proposals. + amount: type: array items: type: object properties: - address: + denom: type: string - pub_key: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - field. Example (for message - [google.protobuf.Duration][]): - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - description: Validator is the type for the validator-set. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + NOTE: The amount field is an Int which implements the custom + method - was set, its value is undefined otherwise + signatures required by gogoproto. + description: amount to be deposited by depositor. + description: >- + MsgDeposit defines a message to submit a deposit to an existing + proposal. + tags: + - Msg + /cosmos.gov.v1beta1.Msg/SubmitProposal: + post: + summary: SubmitProposal defines a method to create new proposal given a content. + operationId: CosmosGovV1Beta1Msg_SubmitProposal + responses: + '200': + description: A successful response. + schema: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. description: >- - GetLatestValidatorSetResponse is the response type for the - Query/GetValidatorSetByHeight RPC method. + MsgSubmitProposalResponse defines the Msg/SubmitProposal response + type. default: description: An unexpected error response. schema: @@ -9661,8 +6043,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -9672,7 +6058,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -9700,10 +6086,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -9741,288 +6125,119 @@ paths: "value": "1.212s" } parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse + - name: body description: >- - reverse is set to true if results are to be returned in the - descending order. - + MsgSubmitProposal defines an sdk.Msg type that supports submitting + arbitrary - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Service - /cosmos/base/tendermint/v1beta1/validatorsets/{height}: - get: - summary: GetValidatorSetByHeight queries validator-set at a given height. - operationId: CosmosBaseTendermintV1Beta1GetValidatorSetByHeight - responses: - '200': - description: A successful response. + proposal Content. + in: body + required: true schema: type: object properties: - block_height: - type: string - format: int64 - validators: - type: array - items: - type: object - properties: - address: - type: string - pub_key: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } + content: + description: content is the proposal's content. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized - The pack methods provided by protobuf library will by - default use + protocol buffer message. This string must contain at least - 'type.googleapis.com/full.type.name' as the type URL and - the unpack + one "/" character. The last segment of the URL's path must + represent - methods only use the fully qualified type name after the - last '/' + the fully qualified name of the type (as in - in the type URL, for example "foo.bar.com/x/y.z" will - yield type + `path/google.protobuf.Duration`). The name should be in a + canonical form - name "y.z". + (e.g., leading "." is not accepted). + In practice, teams usually precompile into the binary all + types that they - JSON + expect it to use in the context of Any. However, for URLs + which use the - ==== + scheme `http`, `https`, or no scheme, one can optionally + set up a type - The JSON representation of an `Any` value uses the - regular + server that maps type URLs to message definitions as + follows: - representation of the deserialized, embedded message, - with an - additional field `@type` which contains the type URL. - Example: + * If no scheme is provided, `https` is assumed. - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + Note: this functionality is not currently available in the + official - If the embedded message type is well-known and has a - custom JSON + protobuf release, and it is not used for type URLs + beginning with - representation, that representation will be embedded - adding a field + type.googleapis.com. - `value` which holds the custom JSON in addition to the - `@type` - field. Example (for message - [google.protobuf.Duration][]): + Schemes other than `http`, `https` (or the empty scheme) + might be - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - voting_power: + used with implementation specific semantics. + additionalProperties: {} + initial_deposit: + type: array + items: + type: object + properties: + denom: type: string - format: int64 - proposer_priority: + amount: type: string - format: int64 - description: Validator is the type for the validator-set. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method - was set, its value is undefined otherwise + signatures required by gogoproto. + description: >- + initial_deposit is the deposit value that must be paid at + proposal submission. + proposer: + type: string + description: proposer is the account address of the proposer. description: >- - GetValidatorSetByHeightResponse is the response type for the - Query/GetValidatorSetByHeight RPC method. + MsgSubmitProposal defines an sdk.Msg type that supports submitting + arbitrary + + proposal Content. + tags: + - Msg + /cosmos.gov.v1beta1.Msg/Vote: + post: + summary: Vote defines a method to add a vote on a specific proposal. + operationId: CosmosGovV1Beta1Msg_Vote + responses: + '200': + description: A successful response. + schema: + type: object + description: MsgVoteResponse defines the Msg/Vote response type. default: description: An unexpected error response. schema: @@ -10129,8 +6344,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -10140,7 +6359,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -10168,10 +6387,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -10209,167 +6426,51 @@ paths: "value": "1.212s" } parameters: - - name: height - in: path + - name: body + description: MsgVote defines a message to cast a vote. + in: body required: true - type: string - format: int64 - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean + schema: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + voter: + type: string + description: voter is the voter address for the proposal. + option: + description: option defines the vote option. + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + description: MsgVote defines a message to cast a vote. tags: - - Service - /cosmos/consensus/v1/params: - get: - summary: Params queries the parameters of x/consensus_param module. - operationId: CosmosConsensusV1Params + - Msg + /cosmos.gov.v1beta1.Msg/VoteWeighted: + post: + summary: >- + VoteWeighted defines a method to add a weighted vote on a specific + proposal. + description: 'Since: cosmos-sdk 0.43' + operationId: CosmosGovV1Beta1Msg_VoteWeighted responses: '200': description: A successful response. schema: type: object - properties: - params: - description: >- - params are the tendermint consensus params stored in the - consensus module. - - Please note that `params.version` is not populated in this - response, it is - - tracked separately in the x/upgrade module. - type: object - properties: - block: - type: object - properties: - max_bytes: - type: string - format: int64 - title: |- - Max block size, in bytes. - Note: must be greater than 0 - max_gas: - type: string - format: int64 - title: |- - Max gas per block. - Note: must be greater or equal to -1 - description: BlockParams contains limits on the block size. - evidence: - type: object - properties: - max_age_num_blocks: - type: string - format: int64 - description: >- - Max age of evidence, in blocks. - - - The basic formula for calculating this is: - MaxAgeDuration / {average block - - time}. - max_age_duration: - type: string - description: >- - Max age of evidence, in time. - - - It should correspond with an app's "unbonding period" - or other similar - - mechanism for handling [Nothing-At-Stake - - attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). - max_bytes: - type: string - format: int64 - title: >- - This sets the maximum size of total evidence in bytes - that can be committed in a single block. - - and should fall comfortably under the max block bytes. + description: >- + MsgVoteWeightedResponse defines the Msg/VoteWeighted response + type. - Default is 1048576 or 1MB - description: >- - EvidenceParams determine how we handle evidence of - malfeasance. - validator: - type: object - properties: - pub_key_types: - type: array - items: - type: string - description: >- - ValidatorParams restrict the public key types validators - can use. - NOTE: uses ABCI pubkey naming, not Amino names. - version: - type: object - properties: - app: - type: string - format: uint64 - description: VersionParams contains the ABCI application version. - description: >- - QueryParamsResponse defines the response type for querying - x/consensus parameters. + Since: cosmos-sdk 0.43 default: description: An unexpected error response. schema: @@ -10387,43 +6488,249 @@ paths: properties: '@type': type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. additionalProperties: {} - tags: - - Query - /cosmos/distribution/v1beta1/community_pool: - get: - summary: CommunityPool queries the community pool coins. - operationId: CosmosDistributionV1Beta1CommunityPool - responses: - '200': - description: A successful response. + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: |- + MsgVoteWeighted defines a message to cast a vote. + + Since: cosmos-sdk 0.43 + in: body + required: true schema: type: object properties: - pool: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + voter: + type: string + description: voter is the voter address for the proposal. + options: type: array items: type: object properties: - denom: + option: + description: >- + option defines the valid vote options, it must not + contain duplicate vote options. type: string - amount: + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + weight: type: string - description: >- - DecCoin defines a token with a denomination and a decimal - amount. + description: >- + weight is the vote weight associated with the vote + option. + description: |- + WeightedVoteOption defines a unit of vote for vote split. + Since: cosmos-sdk 0.43 + description: options defines the weighted vote options. + description: |- + MsgVoteWeighted defines a message to cast a vote. - NOTE: The amount field is an Dec which implements the custom - method + Since: cosmos-sdk 0.43 + tags: + - Msg + /cosmos.mint.v1beta1.Msg/UpdateParams: + post: + summary: >- + UpdateParams defines a governance operation for updating the x/mint + module - signatures required by gogoproto. - description: pool defines community pool's coins. + parameters. The authority is defaults to the x/gov module account. + description: 'Since: cosmos-sdk 0.47' + operationId: CosmosMintV1Beta1Msg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object description: >- - QueryCommunityPoolResponse is the response type for the - Query/CommunityPool + MsgUpdateParamsResponse defines the response structure for + executing a - RPC method. + MsgUpdateParams message. + + + Since: cosmos-sdk 0.47 default: description: An unexpected error response. schema: @@ -10442,71 +6749,79 @@ paths: '@type': type: string additionalProperties: {} + parameters: + - name: body + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + params: + description: |- + params defines the x/mint parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + mint_denom: + type: string + title: type of coin to mint + inflation_rate_change: + type: string + title: maximum annual change in inflation rate + inflation_max: + type: string + title: maximum inflation rate + inflation_min: + type: string + title: minimum inflation rate + goal_bonded: + type: string + title: goal of percent bonded atoms + blocks_per_year: + type: string + format: uint64 + title: expected blocks per year + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 tags: - - Query - /cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards: + - Msg + /cosmos/params/v1beta1/params: get: summary: |- - DelegationTotalRewards queries the total rewards accrued by a each - validator. - operationId: CosmosDistributionV1Beta1DelegationTotalRewards + Params queries a specific parameter of a module, given its subspace and + key. + operationId: CosmosParamsV1Beta1Query_Params responses: '200': description: A successful response. schema: type: object properties: - rewards: - type: array - items: - type: object - properties: - validator_address: - type: string - reward: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a - decimal amount. - - - NOTE: The amount field is an Dec which implements the - custom method - - signatures required by gogoproto. - description: |- - DelegationDelegatorReward represents the properties - of a delegator's delegation reward. - description: rewards defines all the rewards accrued by a delegator. - total: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a decimal - amount. - - - NOTE: The amount field is an Dec which implements the custom - method - - signatures required by gogoproto. - description: total defines the sum of all the rewards. - description: |- - QueryDelegationTotalRewardsResponse is the response type for the - Query/DelegationTotalRewards RPC method. + param: + description: param defines the queried parameter. + type: object + properties: + subspace: + type: string + key: + type: string + value: + type: string + description: >- + QueryParamsResponse is response type for the Query/Params RPC + method. default: description: An unexpected error response. schema: @@ -10526,45 +6841,58 @@ paths: type: string additionalProperties: {} parameters: - - name: delegator_address - description: delegator_address defines the delegator address to query for. - in: path - required: true + - name: subspace + description: subspace defines the module to query the parameter for. + in: query + required: false + type: string + - name: key + description: key defines the key of the parameter in the subspace. + in: query + required: false type: string tags: - Query - /cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards/{validator_address}: + /cosmos/params/v1beta1/subspaces: get: - summary: DelegationRewards queries the total rewards accrued by a delegation. - operationId: CosmosDistributionV1Beta1DelegationRewards + summary: >- + Subspaces queries for all registered subspaces and all keys for a + subspace. + description: 'Since: cosmos-sdk 0.46' + operationId: CosmosParamsV1Beta1Query_Subspaces responses: '200': description: A successful response. schema: type: object properties: - rewards: + subspaces: type: array items: type: object properties: - denom: - type: string - amount: + subspace: type: string + keys: + type: array + items: + type: string description: >- - DecCoin defines a token with a denomination and a decimal - amount. + Subspace defines a parameter subspace name and all the keys + that exist for + the subspace. - NOTE: The amount field is an Dec which implements the custom - method - signatures required by gogoproto. - description: rewards defines the rewards accrued by a delegation. - description: |- - QueryDelegationRewardsResponse is the response type for the - Query/DelegationRewards RPC method. + Since: cosmos-sdk 0.46 + description: >- + QuerySubspacesResponse defines the response types for querying for + all + + registered subspaces and all keys for a subspace. + + + Since: cosmos-sdk 0.46 default: description: An unexpected error response. schema: @@ -10583,39 +6911,24 @@ paths: '@type': type: string additionalProperties: {} - parameters: - - name: delegator_address - description: delegator_address defines the delegator address to query for. - in: path - required: true - type: string - - name: validator_address - description: validator_address defines the validator address to query for. - in: path - required: true - type: string tags: - Query - /cosmos/distribution/v1beta1/delegators/{delegator_address}/validators: - get: - summary: DelegatorValidators queries the validators of a delegator. - operationId: CosmosDistributionV1Beta1DelegatorValidators + /cosmos.slashing.v1beta1.Msg/Unjail: + post: + summary: >- + Unjail defines a method for unjailing a jailed validator, thus returning + + them into the bonded validator set, so they can begin receiving + provisions + + and rewards again. + operationId: CosmosSlashingV1Beta1Msg_Unjail responses: '200': description: A successful response. schema: type: object - properties: - validators: - type: array - items: - type: string - description: >- - validators defines the validators a delegator is delegating - for. - description: |- - QueryDelegatorValidatorsResponse is the response type for the - Query/DelegatorValidators RPC method. + title: MsgUnjailResponse defines the Msg/Unjail response type default: description: An unexpected error response. schema: @@ -10635,29 +6948,39 @@ paths: type: string additionalProperties: {} parameters: - - name: delegator_address - description: delegator_address defines the delegator address to query for. - in: path + - name: body + in: body required: true - type: string + schema: + type: object + properties: + validator_addr: + type: string + title: MsgUnjail defines the Msg/Unjail request type tags: - - Query - /cosmos/distribution/v1beta1/delegators/{delegator_address}/withdraw_address: - get: - summary: DelegatorWithdrawAddress queries withdraw address of a delegator. - operationId: CosmosDistributionV1Beta1DelegatorWithdrawAddress + - Msg + /cosmos.slashing.v1beta1.Msg/UpdateParams: + post: + summary: >- + UpdateParams defines a governance operation for updating the x/slashing + module + + parameters. The authority defaults to the x/gov module account. + description: 'Since: cosmos-sdk 0.47' + operationId: CosmosSlashingV1Beta1Msg_UpdateParams responses: '200': description: A successful response. schema: type: object - properties: - withdraw_address: - type: string - description: withdraw_address defines the delegator address to query for. - description: |- - QueryDelegatorWithdrawAddressResponse is the response type for the - Query/DelegatorWithdrawAddress RPC method. + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a + + MsgUpdateParams message. + + + Since: cosmos-sdk 0.47 default: description: An unexpected error response. schema: @@ -10677,332 +7000,68 @@ paths: type: string additionalProperties: {} parameters: - - name: delegator_address - description: delegator_address defines the delegator address to query for. - in: path + - name: body + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + in: body required: true - type: string - tags: - - Query - /cosmos/distribution/v1beta1/params: - get: - summary: Params queries params of the distribution module. - operationId: CosmosDistributionV1Beta1Params - responses: - '200': - description: A successful response. schema: type: object properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). params: - description: params defines the parameters of the module. + description: |- + params defines the x/slashing parameters to update. + + NOTE: All parameters must be supplied. type: object properties: - community_tax: + signed_blocks_window: type: string - base_proposer_reward: + format: int64 + min_signed_per_window: type: string - description: >- - Deprecated: The base_proposer_reward field is deprecated - and is no longer used - - in the x/distribution module's reward mechanism. - bonus_proposer_reward: + format: byte + downtime_jail_duration: type: string - description: >- - Deprecated: The bonus_proposer_reward field is deprecated - and is no longer used + slash_fraction_double_sign: + type: string + format: byte + slash_fraction_downtime: + type: string + format: byte + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. - in the x/distribution module's reward mechanism. - withdraw_addr_enabled: - type: boolean - description: >- - QueryParamsResponse is the response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} + Since: cosmos-sdk 0.47 tags: - - Query - /cosmos/distribution/v1beta1/validators/{validator_address}: - get: + - Msg + /cosmos.staking.v1beta1.Msg/BeginRedelegate: + post: summary: >- - ValidatorDistributionInfo queries validator commission and - self-delegation rewards for validator - operationId: CosmosDistributionV1Beta1ValidatorDistributionInfo - responses: - '200': - description: A successful response. - schema: - type: object - properties: - operator_address: - type: string - description: operator_address defines the validator operator address. - self_bond_rewards: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a decimal - amount. - - - NOTE: The amount field is an Dec which implements the custom - method - - signatures required by gogoproto. - description: self_bond_rewards defines the self delegations rewards. - commission: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a decimal - amount. - - - NOTE: The amount field is an Dec which implements the custom - method + BeginRedelegate defines a method for performing a redelegation - signatures required by gogoproto. - description: commission defines the commission the validator received. - description: >- - QueryValidatorDistributionInfoResponse is the response type for - the Query/ValidatorDistributionInfo RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: validator_address - description: validator_address defines the validator address to query for. - in: path - required: true - type: string - tags: - - Query - /cosmos/distribution/v1beta1/validators/{validator_address}/commission: - get: - summary: ValidatorCommission queries accumulated commission for a validator. - operationId: CosmosDistributionV1Beta1ValidatorCommission + of coins from a delegator and source validator to a destination + validator. + operationId: CosmosStakingV1Beta1Msg_BeginRedelegate responses: '200': description: A successful response. schema: type: object properties: - commission: - description: commission defines the commission the validator received. - type: object - properties: - commission: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a - decimal amount. - - - NOTE: The amount field is an Dec which implements the - custom method - - signatures required by gogoproto. - title: |- - QueryValidatorCommissionResponse is the response type for the - Query/ValidatorCommission RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: + completion_time: type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: validator_address - description: validator_address defines the validator address to query for. - in: path - required: true - type: string - tags: - - Query - /cosmos/distribution/v1beta1/validators/{validator_address}/outstanding_rewards: - get: - summary: ValidatorOutstandingRewards queries rewards of a validator address. - operationId: CosmosDistributionV1Beta1ValidatorOutstandingRewards - responses: - '200': - description: A successful response. - schema: - type: object - properties: - rewards: - type: object - properties: - rewards: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a - decimal amount. - - - NOTE: The amount field is an Dec which implements the - custom method - - signatures required by gogoproto. - description: >- - ValidatorOutstandingRewards represents outstanding - (un-withdrawn) rewards - - for a validator inexpensive to track, allows simple sanity - checks. + format: date-time description: >- - QueryValidatorOutstandingRewardsResponse is the response type for - the - - Query/ValidatorOutstandingRewards RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: validator_address - description: validator_address defines the validator address to query for. - in: path - required: true - type: string - tags: - - Query - /cosmos/distribution/v1beta1/validators/{validator_address}/slashes: - get: - summary: ValidatorSlashes queries slash events of a validator. - operationId: CosmosDistributionV1Beta1ValidatorSlashes - responses: - '200': - description: A successful response. - schema: - type: object - properties: - slashes: - type: array - items: - type: object - properties: - validator_period: - type: string - format: uint64 - fraction: - type: string - description: >- - ValidatorSlashEvent represents a validator slash event. - - Height is implicit within the store key. - - This is needed to calculate appropriate amount of staking - tokens - - for delegations which are withdrawn after a slash has - occurred. - description: slashes defines the slashes the validator received. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryValidatorSlashesResponse is the response type for the - Query/ValidatorSlashes RPC method. + MsgBeginRedelegateResponse defines the Msg/BeginRedelegate + response type. default: description: An unexpected error response. schema: @@ -11014,104 +7073,6 @@ paths: message: type: string details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: validator_address - description: validator_address defines the validator address to query for. - in: path - required: true - type: string - - name: starting_height - description: >- - starting_height defines the optional starting height to query the - slashes. - in: query - required: false - type: string - format: uint64 - - name: ending_height - description: >- - starting_height defines the optional ending height to query the - slashes. - in: query - required: false - type: string - format: uint64 - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/evidence/v1beta1/evidence: - get: - summary: AllEvidence queries all evidence. - operationId: CosmosEvidenceV1Beta1AllEvidence - responses: - '200': - description: A successful response. - schema: - type: object - properties: - evidence: type: array items: type: object @@ -11207,8 +7168,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -11218,7 +7183,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -11246,10 +7211,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -11286,31 +7249,64 @@ paths: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } - description: evidence returns all evidences. - pagination: - description: pagination defines the pagination in the response. + parameters: + - name: body + description: >- + MsgBeginRedelegate defines a SDK message for performing a + redelegation + + of coins from a delegator and source validator to a destination + validator. + in: body + required: true + schema: + type: object + properties: + delegator_address: + type: string + validator_src_address: + type: string + validator_dst_address: + type: string + amount: type: object properties: - next_key: + denom: type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: + amount: type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method - was set, its value is undefined otherwise + signatures required by gogoproto. description: >- - QueryAllEvidenceResponse is the response type for the - Query/AllEvidence RPC + MsgBeginRedelegate defines a SDK message for performing a + redelegation - method. + of coins from a delegator and source validator to a destination + validator. + tags: + - Msg + /cosmos.staking.v1beta1.Msg/CancelUnbondingDelegation: + post: + summary: >- + CancelUnbondingDelegation defines a method for performing canceling the + unbonding delegation + + and delegate back to previous validator. + description: 'Since: cosmos-sdk 0.46' + operationId: CosmosStakingV1Beta1Msg_CancelUnbondingDelegation + responses: + '200': + description: A successful response. + schema: + type: object + description: 'Since: cosmos-sdk 0.46' + title: MsgCancelUnbondingDelegationResponse default: description: An unexpected error response. schema: @@ -11417,8 +7413,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -11428,7 +7428,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -11456,10 +7456,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -11497,139 +7495,57 @@ paths: "value": "1.212s" } parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/evidence/v1beta1/evidence/{hash}: - get: - summary: Evidence queries evidence based on evidence hash. - operationId: CosmosEvidenceV1Beta1Evidence - responses: - '200': - description: A successful response. + - name: body + description: 'Since: cosmos-sdk 0.46' + in: body + required: true schema: type: object properties: - evidence: - description: evidence returns the requested evidence. + delegator_address: + type: string + validator_address: + type: string + amount: type: object properties: - '@type': + denom: type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - Schemes other than `http`, `https` (or the empty scheme) - might be + NOTE: The amount field is an Int which implements the custom + method - used with implementation specific semantics. - additionalProperties: {} + signatures required by gogoproto. + title: >- + amount is always less than or equal to unbonding delegation + entry balance + creation_height: + type: string + format: int64 + description: creation_height is the height which the unbonding took place. + description: 'Since: cosmos-sdk 0.46' + title: >- + MsgCancelUnbondingDelegation defines the SDK message for + performing a cancel unbonding delegation for delegator + tags: + - Msg + /cosmos.staking.v1beta1.Msg/CreateValidator: + post: + summary: CreateValidator defines a method for creating a new validator. + operationId: CosmosStakingV1Beta1Msg_CreateValidator + responses: + '200': + description: A successful response. + schema: + type: object description: >- - QueryEvidenceResponse is the response type for the Query/Evidence - RPC method. + MsgCreateValidatorResponse defines the Msg/CreateValidator + response type. default: description: An unexpected error response. schema: @@ -11736,8 +7652,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -11747,7 +7667,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -11775,10 +7695,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -11816,119 +7734,278 @@ paths: "value": "1.212s" } parameters: - - name: hash - description: |- - hash defines the evidence hash of the requested evidence. - - Since: cosmos-sdk 0.47 - in: path + - name: body + description: >- + MsgCreateValidator defines a SDK message for creating a new + validator. + in: body required: true - type: string - - name: evidence_hash - description: |- - evidence_hash defines the hash of the requested evidence. - Deprecated: Use hash, a HEX encoded string, instead. - in: query - required: false - type: string - format: byte - tags: - - Query - /cosmos/feegrant/v1beta1/allowance/{granter}/{grantee}: - get: - summary: Allowance returns fee granted to the grantee by the granter. - operationId: CosmosFeegrantV1Beta1Allowance - responses: - '200': - description: A successful response. schema: type: object properties: - allowance: - description: allowance is a allowance granted for grantee by granter. + description: + type: object + properties: + moniker: + type: string + description: moniker defines a human-readable name for the validator. + identity: + type: string + description: >- + identity defines an optional identity signature (ex. UPort + or Keybase). + website: + type: string + description: website defines an optional website link. + security_contact: + type: string + description: >- + security_contact defines an optional email for security + contact. + details: + type: string + description: details define other optional details. + description: Description defines a validator description. + commission: type: object properties: - granter: + rate: type: string description: >- - granter is the address of the user granting an allowance - of their funds. - grantee: + rate is the commission rate charged to delegators, as a + fraction. + max_rate: type: string description: >- - grantee is the address of the user being granted an - allowance of another user's funds. - allowance: + max_rate defines the maximum commission rate which + validator can ever charge, as a fraction. + max_change_rate: + type: string description: >- - allowance can be any of basic, periodic, allowed fee - allowance. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized + max_change_rate defines the maximum daily increase of the + validator commission, as a fraction. + description: >- + CommissionRates defines the initial commission rates to be + used for creating - protocol buffer message. This string must contain at - least + a validator. + min_self_delegation: + type: string + delegator_address: + type: string + description: >- + Deprecated: Use of Delegator Address in MsgCreateValidator is + deprecated. - one "/" character. The last segment of the URL's path - must represent + The validator address bytes and delegator address bytes refer + to the same account while creating validator (defer - the fully qualified name of the type (as in + only in bech32 notation). + validator_address: + type: string + pubkey: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized - `path/google.protobuf.Duration`). The name should be - in a canonical form + protocol buffer message. This string must contain at least - (e.g., leading "." is not accepted). + one "/" character. The last segment of the URL's path must + represent + the fully qualified name of the type (as in - In practice, teams usually precompile into the binary - all types that they + `path/google.protobuf.Duration`). The name should be in a + canonical form - expect it to use in the context of Any. However, for - URLs which use the + (e.g., leading "." is not accepted). - scheme `http`, `https`, or no scheme, one can - optionally set up a type - server that maps type URLs to message definitions as - follows: + In practice, teams usually precompile into the binary all + types that they + expect it to use in the context of Any. However, for URLs + which use the - * If no scheme is provided, `https` is assumed. + scheme `http`, `https`, or no scheme, one can optionally + set up a type - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + server that maps type URLs to message definitions as + follows: - Note: this functionality is not currently available in - the official - protobuf release, and it is not used for type URLs - beginning with + * If no scheme is provided, `https` is assumed. - type.googleapis.com. + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + Note: this functionality is not currently available in the + official - Schemes other than `http`, `https` (or the empty - scheme) might be + protobuf release, and it is not used for type URLs + beginning with - used with implementation specific semantics. - additionalProperties: {} - title: >- - Grant is stored in the KVStore to record a grant with full - context + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message + along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in + the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default + use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the last + '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding a + field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + value: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. description: >- - QueryAllowanceResponse is the response type for the - Query/Allowance RPC method. + MsgCreateValidator defines a SDK message for creating a new + validator. + tags: + - Msg + /cosmos.staking.v1beta1.Msg/Delegate: + post: + summary: |- + Delegate defines a method for performing a delegation of coins + from a delegator to a validator. + operationId: CosmosStakingV1Beta1Msg_Delegate + responses: + '200': + description: A successful response. + schema: + type: object + description: MsgDelegateResponse defines the Msg/Delegate response type. default: description: An unexpected error response. schema: @@ -12035,8 +8112,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -12046,7 +8127,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -12074,10 +8155,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -12115,138 +8194,55 @@ paths: "value": "1.212s" } parameters: - - name: granter - description: >- - granter is the address of the user granting an allowance of their - funds. - in: path - required: true - type: string - - name: grantee + - name: body description: >- - grantee is the address of the user being granted an allowance of - another user's funds. - in: path + MsgDelegate defines a SDK message for performing a delegation of + coins + + from a delegator to a validator. + in: body required: true - type: string - tags: - - Query - /cosmos/feegrant/v1beta1/allowances/{grantee}: - get: - summary: Allowances returns all the grants for address. - operationId: CosmosFeegrantV1Beta1Allowances - responses: - '200': - description: A successful response. schema: type: object properties: - allowances: - type: array - items: - type: object - properties: - granter: - type: string - description: >- - granter is the address of the user granting an allowance - of their funds. - grantee: - type: string - description: >- - grantee is the address of the user being granted an - allowance of another user's funds. - allowance: - description: >- - allowance can be any of basic, periodic, allowed fee - allowance. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - title: >- - Grant is stored in the KVStore to record a grant with full - context - description: allowances are allowance's granted for grantee by granter. - pagination: - description: pagination defines an pagination for the response. + delegator_address: + type: string + validator_address: + type: string + amount: type: object properties: - next_key: + denom: type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: + amount: type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + description: >- + Coin defines a token with a denomination and an amount. - was set, its value is undefined otherwise + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + description: >- + MsgDelegate defines a SDK message for performing a delegation of + coins + + from a delegator to a validator. + tags: + - Msg + /cosmos.staking.v1beta1.Msg/EditValidator: + post: + summary: EditValidator defines a method for editing an existing validator. + operationId: CosmosStakingV1Beta1Msg_EditValidator + responses: + '200': + description: A successful response. + schema: + type: object description: >- - QueryAllowancesResponse is the response type for the - Query/Allowances RPC method. + MsgEditValidatorResponse defines the Msg/EditValidator response + type. default: description: An unexpected error response. schema: @@ -12353,8 +8349,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -12364,7 +8364,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -12392,10 +8392,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -12433,188 +8431,91 @@ paths: "value": "1.212s" } parameters: - - name: grantee - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total + - name: body description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key + MsgEditValidator defines a SDK message for editing an existing + validator. + in: body + required: true + schema: + type: object + properties: + description: + type: object + properties: + moniker: + type: string + description: moniker defines a human-readable name for the validator. + identity: + type: string + description: >- + identity defines an optional identity signature (ex. UPort + or Keybase). + website: + type: string + description: website defines an optional website link. + security_contact: + type: string + description: >- + security_contact defines an optional email for security + contact. + details: + type: string + description: details define other optional details. + description: Description defines a validator description. + validator_address: + type: string + commission_rate: + type: string + title: >- + We pass a reference to the new commission rate and min self + delegation as - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. + it's not mandatory to update. If not updated, the deserialized + rate will be + zero with no way to distinguish if an update was intended. - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean + REF: #2373 + min_self_delegation: + type: string + description: >- + MsgEditValidator defines a SDK message for editing an existing + validator. tags: - - Query - /cosmos/feegrant/v1beta1/issued/{granter}: - get: - summary: AllowancesByGranter returns all the grants given by an address - description: 'Since: cosmos-sdk 0.46' - operationId: CosmosFeegrantV1Beta1AllowancesByGranter + - Msg + /cosmos.staking.v1beta1.Msg/Undelegate: + post: + summary: |- + Undelegate defines a method for performing an undelegation from a + delegate and a validator. + operationId: CosmosStakingV1Beta1Msg_Undelegate responses: '200': description: A successful response. schema: type: object properties: - allowances: - type: array - items: - type: object - properties: - granter: - type: string - description: >- - granter is the address of the user granting an allowance - of their funds. - grantee: - type: string - description: >- - grantee is the address of the user being granted an - allowance of another user's funds. - allowance: - description: >- - allowance can be any of basic, periodic, allowed fee - allowance. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - title: >- - Grant is stored in the KVStore to record a grant with full - context - description: allowances that have been issued by the granter. - pagination: - description: pagination defines an pagination for the response. + completion_time: + type: string + format: date-time + amount: type: object properties: - next_key: + denom: type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: + amount: type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + description: >- + Coin defines a token with a denomination and an amount. - was set, its value is undefined otherwise - description: >- - QueryAllowancesByGranterResponse is the response type for the - Query/AllowancesByGranter RPC method. + NOTE: The amount field is an Int which implements the custom + method - Since: cosmos-sdk 0.46 + signatures required by gogoproto. + title: amount returns the amount of undelegated coins + description: MsgUndelegateResponse defines the Msg/Undelegate response type. default: description: An unexpected error response. schema: @@ -12721,8 +8622,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -12732,7 +8637,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -12760,10 +8665,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -12801,212 +8704,63 @@ paths: "value": "1.212s" } parameters: - - name: granter - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse + - name: body description: >- - reverse is set to true if results are to be returned in the - descending order. - + MsgUndelegate defines a SDK message for performing an undelegation + from a - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/gov/v1/params/{params_type}: - get: - summary: Params queries all parameters of the gov module. - operationId: CosmosGovV1Params - responses: - '200': - description: A successful response. + delegate and a validator. + in: body + required: true schema: type: object properties: - voting_params: - description: |- - Deprecated: Prefer to use `params` instead. - voting_params defines the parameters related to voting. - type: object - properties: - voting_period: - type: string - description: Duration of the voting period. - deposit_params: - description: |- - Deprecated: Prefer to use `params` instead. - deposit_params defines the parameters related to deposit. + delegator_address: + type: string + validator_address: + type: string + amount: type: object properties: - min_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: Minimum deposit for a proposal to enter voting period. - max_deposit_period: + denom: type: string - description: >- - Maximum period for Atom holders to deposit on a proposal. - Initial value: 2 - - months. - tally_params: - description: |- - Deprecated: Prefer to use `params` instead. - tally_params defines the parameters related to tally. - type: object - properties: - quorum: + amount: type: string - description: >- - Minimum percentage of total stake needed to vote for a - result to be + description: >- + Coin defines a token with a denomination and an amount. - considered valid. - threshold: - type: string - description: >- - Minimum proportion of Yes votes for proposal to pass. - Default value: 0.5. - veto_threshold: - type: string - description: >- - Minimum value of Veto votes to Total votes ratio for - proposal to be - vetoed. Default value: 1/3. - params: - description: |- - params defines all the paramaters of x/gov module. + NOTE: The amount field is an Int which implements the custom + method - Since: cosmos-sdk 0.47 - type: object - properties: - min_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. + signatures required by gogoproto. + description: >- + MsgUndelegate defines a SDK message for performing an undelegation + from a + delegate and a validator. + tags: + - Msg + /cosmos.staking.v1beta1.Msg/UpdateParams: + post: + summary: |- + UpdateParams defines an operation for updating the x/staking module + parameters. + Since: cosmos-sdk 0.47 + operationId: CosmosStakingV1Beta1Msg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a - NOTE: The amount field is an Int which implements the - custom method + MsgUpdateParams message. - signatures required by gogoproto. - description: Minimum deposit for a proposal to enter voting period. - max_deposit_period: - type: string - description: >- - Maximum period for Atom holders to deposit on a proposal. - Initial value: 2 - months. - voting_period: - type: string - description: Duration of the voting period. - quorum: - type: string - description: >- - Minimum percentage of total stake needed to vote for a - result to be - considered valid. - threshold: - type: string - description: >- - Minimum proportion of Yes votes for proposal to pass. - Default value: 0.5. - veto_threshold: - type: string - description: >- - Minimum value of Veto votes to Total votes ratio for - proposal to be - vetoed. Default value: 1/3. - min_initial_deposit_ratio: - type: string - description: >- - The ratio representing the proportion of the deposit value - that must be paid at proposal submission. - burn_vote_quorum: - type: boolean - title: burn deposits if a proposal does not meet quorum - burn_proposal_deposit_prevote: - type: boolean - title: burn deposits if the proposal does not enter voting period - burn_vote_veto: - type: boolean - title: burn deposits if quorum with vote type no_veto is met - description: >- - QueryParamsResponse is the response type for the Query/Params RPC - method. + Since: cosmos-sdk 0.47 default: description: An unexpected error response. schema: @@ -13113,8 +8867,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -13124,7 +8882,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -13152,10 +8910,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -13193,336 +8949,84 @@ paths: "value": "1.212s" } parameters: - - name: params_type - description: >- - params_type defines which parameters to query for, can be one of - "voting", + - name: body + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. - "tallying" or "deposit". - in: path + Since: cosmos-sdk 0.47 + in: body required: true - type: string - tags: - - Query - /cosmos/gov/v1/proposals: - get: - summary: Proposals queries all proposals based on given status. - operationId: CosmosGovV1Proposals - responses: - '200': - description: A successful response. schema: type: object properties: - proposals: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - description: id defines the unique id of the proposal. - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain - at least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should - be in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, - for URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions - as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently - available in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods - of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL - and the unpack - - methods only use the fully qualified type name after - the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message - [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages are the arbitrary messages to be executed if - the proposal passes. - status: - description: status defines the proposal status. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result is the final tally result of the - proposal. When - - querying a proposal via gRPC, this field is not - populated until the - - proposal's voting period has ended. - type: object - properties: - yes_count: - type: string - description: yes_count is the number of yes votes on a proposal. - abstain_count: - type: string - description: >- - abstain_count is the number of abstain votes on a - proposal. - no_count: - type: string - description: no_count is the number of no votes on a proposal. - no_with_veto_count: - type: string - description: >- - no_with_veto_count is the number of no with veto - votes on a proposal. - submit_time: - type: string - format: date-time - description: submit_time is the time of proposal submission. - deposit_end_time: - type: string - format: date-time - description: deposit_end_time is the end time for deposition. - total_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an - amount. - - - NOTE: The amount field is an Int which implements the - custom method + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + params: + description: |- + params defines the x/staking parameters to update. - signatures required by gogoproto. - description: total_deposit is the total deposit on the proposal. - voting_start_time: - type: string - format: date-time - description: >- - voting_start_time is the starting time to vote on a - proposal. - voting_end_time: - type: string - format: date-time - description: voting_end_time is the end time of voting on a proposal. - metadata: - type: string - description: >- - metadata is any arbitrary metadata attached to the - proposal. - title: - type: string - description: 'Since: cosmos-sdk 0.47' - title: title is the title of the proposal - summary: - type: string - description: 'Since: cosmos-sdk 0.47' - title: summary is a short summary of the proposal - proposer: - type: string - description: 'Since: cosmos-sdk 0.47' - title: Proposer is the address of the proposal sumbitter - description: >- - Proposal defines the core field members of a governance - proposal. - description: proposals defines all the requested governance proposals. - pagination: - description: pagination defines the pagination in the response. + NOTE: All parameters must be supplied. type: object properties: - next_key: + unbonding_time: type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: + description: unbonding_time is the time duration of unbonding. + max_validators: + type: integer + format: int64 + description: max_validators is the maximum number of validators. + max_entries: + type: integer + format: int64 + description: >- + max_entries is the max entries for either unbonding + delegation or redelegation (per pair/trio). + historical_entries: + type: integer + format: int64 + description: >- + historical_entries is the number of historical entries to + persist. + bond_denom: + type: string + description: bond_denom defines the bondable coin denomination. + min_commission_rate: type: string - format: uint64 title: >- - total is total number of results available if - PageRequest.count_total + min_commission_rate is the chain-wide minimum commission + rate that a validator can charge their delegators + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. - was set, its value is undefined otherwise - description: >- - QueryProposalsResponse is the response type for the - Query/Proposals RPC + Since: cosmos-sdk 0.47 + tags: + - Msg + /ibc.applications.fee.v1.Msg/PayPacketFee: + post: + summary: >- + PayPacketFee defines a rpc handler method for MsgPayPacketFee - method. + PayPacketFee is an open callback that may be called by any module/user + that wishes to escrow funds in order to + + incentivize the relaying of the packet at the next sequence + + NOTE: This method is intended to be used within a multi msg transaction, + where the subsequent msg that follows + + initiates the lifecycle of the incentivized packet + operationId: IbcApplicationsFeeV1Msg_PayPacketFee + responses: + '200': + description: A successful response. + schema: + type: object + title: >- + MsgPayPacketFeeResponse defines the response type for the + PayPacketFee rpc default: description: An unexpected error response. schema: @@ -13629,8 +9133,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -13640,7 +9148,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -13668,10 +9176,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -13709,345 +9215,55 @@ paths: "value": "1.212s" } parameters: - - name: proposal_status - description: |- - proposal_status defines the status of the proposals. - - - PROPOSAL_STATUS_UNSPECIFIED: PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. - - PROPOSAL_STATUS_DEPOSIT_PERIOD: PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit - period. - - PROPOSAL_STATUS_VOTING_PERIOD: PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting - period. - - PROPOSAL_STATUS_PASSED: PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has - passed. - - PROPOSAL_STATUS_REJECTED: PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has - been rejected. - - PROPOSAL_STATUS_FAILED: PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has - failed. - in: query - required: false - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - - name: voter - description: voter defines the voter address for the proposals. - in: query - required: false - type: string - - name: depositor - description: depositor defines the deposit addresses from the proposals. - in: query - required: false - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/gov/v1/proposals/{proposal_id}: - get: - summary: Proposal queries proposal details based on ProposalID. - operationId: CosmosGovV1Proposal - responses: - '200': - description: A successful response. + - name: body + in: body + required: true schema: type: object properties: - proposal: - description: proposal is the requested governance proposal. + fee: + title: >- + fee encapsulates the recv, ack and timeout fees associated + with an IBC packet type: object properties: - id: - type: string - format: uint64 - description: id defines the unique id of the proposal. - messages: + recv_fee: type: array items: type: object properties: - '@type': + denom: + type: string + amount: type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON + Coin defines a token with a denomination and an amount. - representation, that representation will be embedded - adding a field - `value` which holds the custom JSON in addition to the - `@type` + NOTE: The amount field is an Int which implements the + custom method - field. Example (for message - [google.protobuf.Duration][]): + signatures required by gogoproto. + title: the packet receive fee + ack_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages are the arbitrary messages to be executed if the - proposal passes. - status: - description: status defines the proposal status. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result is the final tally result of the - proposal. When - querying a proposal via gRPC, this field is not populated - until the + NOTE: The amount field is an Int which implements the + custom method - proposal's voting period has ended. - type: object - properties: - yes_count: - type: string - description: yes_count is the number of yes votes on a proposal. - abstain_count: - type: string - description: >- - abstain_count is the number of abstain votes on a - proposal. - no_count: - type: string - description: no_count is the number of no votes on a proposal. - no_with_veto_count: - type: string - description: >- - no_with_veto_count is the number of no with veto votes - on a proposal. - submit_time: - type: string - format: date-time - description: submit_time is the time of proposal submission. - deposit_end_time: - type: string - format: date-time - description: deposit_end_time is the end time for deposition. - total_deposit: + signatures required by gogoproto. + title: the packet acknowledgement fee + timeout_fee: type: array items: type: object @@ -14064,37 +9280,49 @@ paths: custom method signatures required by gogoproto. - description: total_deposit is the total deposit on the proposal. - voting_start_time: - type: string - format: date-time - description: >- - voting_start_time is the starting time to vote on a - proposal. - voting_end_time: - type: string - format: date-time - description: voting_end_time is the end time of voting on a proposal. - metadata: - type: string - description: >- - metadata is any arbitrary metadata attached to the - proposal. - title: - type: string - description: 'Since: cosmos-sdk 0.47' - title: title is the title of the proposal - summary: - type: string - description: 'Since: cosmos-sdk 0.47' - title: summary is a short summary of the proposal - proposer: - type: string - description: 'Since: cosmos-sdk 0.47' - title: Proposer is the address of the proposal sumbitter - description: >- - QueryProposalResponse is the response type for the Query/Proposal - RPC method. + title: the packet timeout fee + source_port_id: + type: string + title: the source port unique identifier + source_channel_id: + type: string + title: the source channel unique identifer + signer: + type: string + title: account address to refund fee if necessary + relayers: + type: array + items: + type: string + title: optional list of relayers permitted to the receive packet fees + title: >- + MsgPayPacketFee defines the request type for the PayPacketFee rpc + + This Msg can be used to pay for a packet at the next sequence send + & should be combined with the Msg that will be + + paid for + tags: + - Msg + /ibc.applications.fee.v1.Msg/PayPacketFeeAsync: + post: + summary: >- + PayPacketFeeAsync defines a rpc handler method for MsgPayPacketFeeAsync + + PayPacketFeeAsync is an open callback that may be called by any + module/user that wishes to escrow funds in order to + + incentivize the relaying of a known packet (i.e. at a particular + sequence) + operationId: IbcApplicationsFeeV1Msg_PayPacketFeeAsync + responses: + '200': + description: A successful response. + schema: + type: object + title: >- + MsgPayPacketFeeAsyncResponse defines the response type for the + PayPacketFeeAsync rpc default: description: An unexpected error response. schema: @@ -14201,8 +9429,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -14212,7 +9444,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -14240,10 +9472,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -14281,85 +9511,137 @@ paths: "value": "1.212s" } parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path + - name: body + in: body required: true - type: string - format: uint64 - tags: - - Query - /cosmos/gov/v1/proposals/{proposal_id}/deposits: - get: - summary: Deposits queries all deposits of a single proposal. - operationId: CosmosGovV1Deposits - responses: - '200': - description: A successful response. schema: type: object properties: - deposits: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - depositor: - type: string - description: >- - depositor defines the deposit addresses from the - proposals. - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an - amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: amount to be deposited by depositor. - description: >- - Deposit defines an amount deposited by an account address to - an active - - proposal. - description: deposits defines the requested deposits. - pagination: - description: pagination defines the pagination in the response. + packet_id: + title: >- + unique packet identifier comprised of the channel ID, port ID + and sequence type: object properties: - next_key: + port_id: type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: + title: channel port identifier + channel_id: + type: string + title: channel unique identifier + sequence: type: string format: uint64 + title: packet sequence + packet_fee: + title: the packet fee associated with a particular IBC packet + type: object + properties: + fee: title: >- - total is total number of results available if - PageRequest.count_total + fee encapsulates the recv, ack and timeout fees associated + with an IBC packet + type: object + properties: + recv_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. - was set, its value is undefined otherwise - description: >- - QueryDepositsResponse is the response type for the Query/Deposits - RPC method. + + NOTE: The amount field is an Int which implements + the custom method + + signatures required by gogoproto. + title: the packet receive fee + ack_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. + + + NOTE: The amount field is an Int which implements + the custom method + + signatures required by gogoproto. + title: the packet acknowledgement fee + timeout_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. + + + NOTE: The amount field is an Int which implements + the custom method + + signatures required by gogoproto. + title: the packet timeout fee + refund_address: + type: string + title: the refund address for unspent fees + relayers: + type: array + items: + type: string + title: optional list of relayers permitted to receive fees + title: >- + MsgPayPacketFeeAsync defines the request type for the + PayPacketFeeAsync rpc + + This Msg can be used to pay for a packet at a specified sequence + (instead of the next sequence send) + tags: + - Msg + /ibc.applications.fee.v1.Msg/RegisterCounterpartyPayee: + post: + summary: >- + RegisterCounterpartyPayee defines a rpc handler method for + MsgRegisterCounterpartyPayee + + RegisterCounterpartyPayee is called by the relayer on each channelEnd + and allows them to specify the counterparty + + payee address before relaying. This ensures they will be properly + compensated for forward relaying since + + the destination chain must include the registered counterparty payee + address in the acknowledgement. This function + + may be called more than once by a relayer, in which case, the latest + counterparty payee address is always used. + operationId: IbcApplicationsFeeV1Msg_RegisterCounterpartyPayee + responses: + '200': + description: A successful response. + schema: + type: object + title: >- + MsgRegisterCounterpartyPayeeResponse defines the response type for + the RegisterCounterpartyPayee rpc default: description: An unexpected error response. schema: @@ -14466,8 +9748,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -14477,7 +9763,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -14505,10 +9791,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -14546,116 +9830,54 @@ paths: "value": "1.212s" } parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path + - name: body + in: body required: true - type: string - format: uint64 - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. + schema: + type: object + properties: + port_id: + type: string + title: unique port identifier + channel_id: + type: string + title: unique channel identifier + relayer: + type: string + title: the relayer address + counterparty_payee: + type: string + title: the counterparty payee address + title: >- + MsgRegisterCounterpartyPayee defines the request type for the + RegisterCounterpartyPayee rpc + tags: + - Msg + /ibc.applications.fee.v1.Msg/RegisterPayee: + post: + summary: >- + RegisterPayee defines a rpc handler method for MsgRegisterPayee - count_total is only respected when offset is used. It is ignored - when key + RegisterPayee is called by the relayer on each channelEnd and allows + them to set an optional - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. + payee to which reverse and timeout relayer packet fees will be paid out. + The payee should be registered on + the source chain from which packets originate as this is where fee + distribution takes place. This function may be - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/gov/v1/proposals/{proposal_id}/deposits/{depositor}: - get: - summary: >- - Deposit queries single deposit information based proposalID, - depositAddr. - operationId: CosmosGovV1Deposit + called more than once by a relayer, in which case, the latest payee is + always used. + operationId: IbcApplicationsFeeV1Msg_RegisterPayee responses: '200': description: A successful response. schema: type: object - properties: - deposit: - description: deposit defines the requested deposit. - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - depositor: - type: string - description: >- - depositor defines the deposit addresses from the - proposals. - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: amount to be deposited by depositor. - description: >- - QueryDepositResponse is the response type for the Query/Deposit - RPC method. + title: >- + MsgRegisterPayeeResponse defines the response type for the + RegisterPayee rpc default: description: An unexpected error response. schema: @@ -14762,8 +9984,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -14773,7 +9999,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -14801,10 +10027,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -14842,52 +10066,49 @@ paths: "value": "1.212s" } parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path - required: true - type: string - format: uint64 - - name: depositor - description: depositor defines the deposit addresses from the proposals. - in: path + - name: body + in: body required: true - type: string + schema: + type: object + properties: + port_id: + type: string + title: unique port identifier + channel_id: + type: string + title: unique channel identifier + relayer: + type: string + title: the relayer address + payee: + type: string + title: the payee address + title: >- + MsgRegisterPayee defines the request type for the RegisterPayee + rpc tags: - - Query - /cosmos/gov/v1/proposals/{proposal_id}/tally: - get: - summary: TallyResult queries the tally of a proposal vote. - operationId: CosmosGovV1TallyResult + - Msg + /ibc.applications.interchain_accounts.controller.v1.Msg/RegisterInterchainAccount: + post: + summary: >- + RegisterInterchainAccount defines a rpc handler for + MsgRegisterInterchainAccount. + operationId: >- + IbcApplicationsInterchainAccountsControllerV1Msg_RegisterInterchainAccount responses: '200': description: A successful response. schema: type: object properties: - tally: - description: tally defines the requested tally. - type: object - properties: - yes_count: - type: string - description: yes_count is the number of yes votes on a proposal. - abstain_count: - type: string - description: >- - abstain_count is the number of abstain votes on a - proposal. - no_count: - type: string - description: no_count is the number of no votes on a proposal. - no_with_veto_count: - type: string - description: >- - no_with_veto_count is the number of no with veto votes on - a proposal. - description: >- - QueryTallyResultResponse is the response type for the Query/Tally - RPC method. + channel_id: + type: string + port_id: + type: string + title: >- + MsgRegisterInterchainAccountResponse defines the response for + Msg/RegisterAccount default: description: An unexpected error response. schema: @@ -14994,8 +10215,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -15005,7 +10230,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -15033,10 +10258,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -15074,95 +10297,37 @@ paths: "value": "1.212s" } parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path + - name: body + in: body required: true - type: string - format: uint64 + schema: + type: object + properties: + owner: + type: string + connection_id: + type: string + version: + type: string + title: >- + MsgRegisterInterchainAccount defines the payload for + Msg/RegisterAccount tags: - - Query - /cosmos/gov/v1/proposals/{proposal_id}/votes: - get: - summary: Votes queries votes of a given proposal. - operationId: CosmosGovV1Votes + - Msg + /ibc.applications.interchain_accounts.controller.v1.Msg/SendTx: + post: + summary: SendTx defines a rpc handler for MsgSendTx. + operationId: IbcApplicationsInterchainAccountsControllerV1Msg_SendTx responses: '200': description: A successful response. schema: type: object properties: - votes: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - voter: - type: string - description: voter is the voter address of the proposal. - options: - type: array - items: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not - contain duplicate vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: >- - weight is the vote weight associated with the vote - option. - description: >- - WeightedVoteOption defines a unit of vote for vote - split. - description: options is the weighted vote options. - metadata: - type: string - description: >- - metadata is any arbitrary metadata to attached to the - vote. - description: >- - Vote defines a vote on a governance proposal. - - A Vote consists of a proposal ID, the voter, and the vote - option. - description: votes defines the queried votes. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryVotesResponse is the response type for the Query/Votes RPC - method. + sequence: + type: string + format: uint64 + title: MsgSendTxResponse defines the response for MsgSendTx default: description: An unexpected error response. schema: @@ -15269,8 +10434,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -15280,7 +10449,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -15308,10 +10477,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -15349,125 +10516,62 @@ paths: "value": "1.212s" } parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path + - name: body + in: body required: true - type: string - format: uint64 - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/gov/v1/proposals/{proposal_id}/votes/{voter}: - get: - summary: Vote queries voted information based on proposalID, voterAddr. - operationId: CosmosGovV1Vote - responses: - '200': - description: A successful response. schema: type: object properties: - vote: - description: vote defines the queried vote. + owner: + type: string + connection_id: + type: string + packet_data: type: object properties: - proposal_id: + type: type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - voter: + enum: + - TYPE_UNSPECIFIED + - TYPE_EXECUTE_TX + default: TYPE_UNSPECIFIED + description: |- + - TYPE_UNSPECIFIED: Default zero value enumeration + - TYPE_EXECUTE_TX: Execute a transaction on an interchain accounts host chain + title: >- + Type defines a classification of message issued from a + controller chain to its associated interchain accounts + + host + data: type: string - description: voter is the voter address of the proposal. - options: - type: array - items: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not - contain duplicate vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: >- - weight is the vote weight associated with the vote - option. - description: >- - WeightedVoteOption defines a unit of vote for vote - split. - description: options is the weighted vote options. - metadata: + format: byte + memo: type: string - description: >- - metadata is any arbitrary metadata to attached to the - vote. - description: >- - QueryVoteResponse is the response type for the Query/Vote RPC - method. + description: >- + InterchainAccountPacketData is comprised of a raw transaction, + type of transaction and optional memo field. + relative_timeout: + type: string + format: uint64 + description: >- + Relative timeout timestamp provided will be added to the + current block time during transaction execution. + + The timeout timestamp must be non-zero. + title: MsgSendTx defines the payload for Msg/SendTx + tags: + - Msg + /ibc.applications.interchain_accounts.controller.v1.Msg/UpdateParams: + post: + summary: UpdateParams defines a rpc handler for MsgUpdateParams. + operationId: IbcApplicationsInterchainAccountsControllerV1Msg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + title: MsgUpdateParamsResponse defines the response for Msg/UpdateParams default: description: An unexpected error response. schema: @@ -15574,8 +10678,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -15585,7 +10693,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -15613,10 +10721,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -15654,94 +10760,107 @@ paths: "value": "1.212s" } parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path - required: true - type: string - format: uint64 - - name: voter - description: voter defines the voter address for the proposals. - in: path + - name: body + in: body required: true - type: string + schema: + type: object + properties: + signer: + type: string + title: signer address + params: + description: >- + params defines the 27-interchain-accounts/controller + parameters to update. + + + NOTE: All parameters must be supplied. + type: object + properties: + controller_enabled: + type: boolean + description: >- + controller_enabled enables or disables the controller + submodule. + title: MsgUpdateParams defines the payload for Msg/UpdateParams tags: - - Query - /cosmos/gov/v1beta1/params/{params_type}: - get: - summary: Params queries all parameters of the gov module. - operationId: CosmosGovV1Beta1Params + - Msg + /ibc.applications.interchain_accounts.host.v1.Msg/UpdateParams: + post: + summary: UpdateParams defines a rpc handler for MsgUpdateParams. + operationId: IbcApplicationsInterchainAccountsHostV1Msg_UpdateParams responses: '200': description: A successful response. + schema: + type: object + title: MsgUpdateParamsResponse defines the response for Msg/UpdateParams + default: + description: An unexpected error response. schema: type: object properties: - voting_params: - description: voting_params defines the parameters related to voting. - type: object - properties: - voting_period: - type: string - description: Duration of the voting period. - deposit_params: - description: deposit_params defines the parameters related to deposit. - type: object - properties: - min_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + signer: + type: string + title: signer address + params: + description: >- + params defines the 27-interchain-accounts/host parameters to + update. - signatures required by gogoproto. - description: Minimum deposit for a proposal to enter voting period. - max_deposit_period: - type: string - description: >- - Maximum period for Atom holders to deposit on a proposal. - Initial value: 2 - months. - tally_params: - description: tally_params defines the parameters related to tally. + NOTE: All parameters must be supplied. type: object properties: - quorum: - type: string - format: byte - description: >- - Minimum percentage of total stake needed to vote for a - result to be - - considered valid. - threshold: - type: string - format: byte - description: >- - Minimum proportion of Yes votes for proposal to pass. - Default value: 0.5. - veto_threshold: - type: string - format: byte + host_enabled: + type: boolean + description: host_enabled enables or disables the host submodule. + allow_messages: + type: array + items: + type: string description: >- - Minimum value of Veto votes to Total votes ratio for - proposal to be - - vetoed. Default value: 1/3. - description: >- - QueryParamsResponse is the response type for the Query/Params RPC - method. + allow_messages defines a list of sdk message typeURLs + allowed to be executed on a host chain. + title: MsgUpdateParams defines the payload for Msg/UpdateParams + tags: + - Msg + /ibc.applications.transfer.v1.Msg/Transfer: + post: + summary: Transfer defines a rpc handler method for MsgTransfer. + operationId: IbcApplicationsTransferV1Msg_Transfer + responses: + '200': + description: A successful response. + schema: + type: object + properties: + sequence: + type: string + format: uint64 + title: sequence number of the transfer packet sent + description: MsgTransferResponse defines the Msg/Transfer response type. default: description: An unexpected error response. schema: @@ -15848,8 +10967,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -15859,7 +10982,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -15887,10 +11010,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -15928,202 +11049,93 @@ paths: "value": "1.212s" } parameters: - - name: params_type - description: >- - params_type defines which parameters to query for, can be one of - "voting", - - "tallying" or "deposit". - in: path + - name: body + in: body required: true - type: string - tags: - - Query - /cosmos/gov/v1beta1/proposals: - get: - summary: Proposals queries all proposals based on given status. - operationId: CosmosGovV1Beta1Proposals - responses: - '200': - description: A successful response. schema: type: object properties: - proposals: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - content: - description: content is the proposal's content. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - status: - description: status defines the proposal status. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result is the final tally result of the - proposal. When - - querying a proposal via gRPC, this field is not - populated until the - - proposal's voting period has ended. - type: object - properties: - 'yes': - type: string - description: yes is the number of yes votes on a proposal. - abstain: - type: string - description: >- - abstain is the number of abstain votes on a - proposal. - 'no': - type: string - description: no is the number of no votes on a proposal. - no_with_veto: - type: string - description: >- - no_with_veto is the number of no with veto votes on - a proposal. - submit_time: - type: string - format: date-time - description: submit_time is the time of proposal submission. - deposit_end_time: - type: string - format: date-time - description: deposit_end_time is the end time for deposition. - total_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an - amount. + source_port: + type: string + title: the port on which the packet will be sent + source_channel: + type: string + title: the channel by which the packet will be sent + token: + title: the tokens to be transferred + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - NOTE: The amount field is an Int which implements the - custom method + NOTE: The amount field is an Int which implements the custom + method - signatures required by gogoproto. - description: total_deposit is the total deposit on the proposal. - voting_start_time: - type: string - format: date-time - description: >- - voting_start_time is the starting time to vote on a - proposal. - voting_end_time: - type: string - format: date-time - description: voting_end_time is the end time of voting on a proposal. - description: >- - Proposal defines the core field members of a governance - proposal. - description: proposals defines all the requested governance proposals. - pagination: - description: pagination defines the pagination in the response. + signatures required by gogoproto. + sender: + type: string + title: the sender address + receiver: + type: string + title: the recipient address on the destination chain + timeout_height: + description: |- + Timeout height relative to the current block height. + The timeout is disabled when set to 0. type: object properties: - next_key: + revision_number: type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: + format: uint64 + title: the revision that the client is currently on + revision_height: type: string format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + title: the height within the given revision + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes + of updating and + + freezing clients + timeout_timestamp: + type: string + format: uint64 + description: |- + Timeout timestamp in absolute nanoseconds since unix epoch. + The timeout is disabled when set to 0. + memo: + type: string + title: optional memo + title: >- + MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) + between - was set, its value is undefined otherwise + ICS20 enabled chains. See ICS Spec here: + + https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures + tags: + - Msg + /ibc.applications.transfer.v1.Msg/UpdateParams: + post: + summary: UpdateParams defines a rpc handler for MsgUpdateParams. + operationId: IbcApplicationsTransferV1Msg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object description: >- - QueryProposalsResponse is the response type for the - Query/Proposals RPC + MsgUpdateParamsResponse defines the response structure for + executing a - method. + MsgUpdateParams message. default: description: An unexpected error response. schema: @@ -16230,8 +11242,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -16241,7 +11257,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -16269,10 +11285,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -16310,258 +11324,68 @@ paths: "value": "1.212s" } parameters: - - name: proposal_status - description: |- - proposal_status defines the status of the proposals. - - - PROPOSAL_STATUS_UNSPECIFIED: PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. - - PROPOSAL_STATUS_DEPOSIT_PERIOD: PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit - period. - - PROPOSAL_STATUS_VOTING_PERIOD: PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting - period. - - PROPOSAL_STATUS_PASSED: PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has - passed. - - PROPOSAL_STATUS_REJECTED: PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has - been rejected. - - PROPOSAL_STATUS_FAILED: PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has - failed. - in: query - required: false - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - - name: voter - description: voter defines the voter address for the proposals. - in: query - required: false - type: string - - name: depositor - description: depositor defines the deposit addresses from the proposals. - in: query - required: false - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key + - name: body + description: MsgUpdateParams is the Msg/UpdateParams request type. + in: body + required: true + schema: + type: object + properties: + signer: + type: string + title: signer address + params: + description: |- + params defines the transfer parameters to update. - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. + NOTE: All parameters must be supplied. + type: object + properties: + send_enabled: + type: boolean + description: >- + send_enabled enables or disables all cross-chain token + transfers from this + chain. + receive_enabled: + type: boolean + description: >- + receive_enabled enables or disables all cross-chain token + transfers to this - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean + chain. + description: MsgUpdateParams is the Msg/UpdateParams request type. tags: - - Query - /cosmos/gov/v1beta1/proposals/{proposal_id}: - get: - summary: Proposal queries proposal details based on ProposalID. - operationId: CosmosGovV1Beta1Proposal + - Msg + /ibc.core.channel.v1.Msg/Acknowledgement: + post: + summary: Acknowledgement defines a rpc handler method for MsgAcknowledgement. + operationId: IbcCoreChannelV1Msg_Acknowledgement responses: '200': description: A successful response. schema: type: object properties: - proposal: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - content: - description: content is the proposal's content. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - status: - description: status defines the proposal status. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result is the final tally result of the - proposal. When - - querying a proposal via gRPC, this field is not populated - until the - - proposal's voting period has ended. - type: object - properties: - 'yes': - type: string - description: yes is the number of yes votes on a proposal. - abstain: - type: string - description: abstain is the number of abstain votes on a proposal. - 'no': - type: string - description: no is the number of no votes on a proposal. - no_with_veto: - type: string - description: >- - no_with_veto is the number of no with veto votes on a - proposal. - submit_time: - type: string - format: date-time - description: submit_time is the time of proposal submission. - deposit_end_time: - type: string - format: date-time - description: deposit_end_time is the end time for deposition. - total_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: total_deposit is the total deposit on the proposal. - voting_start_time: - type: string - format: date-time - description: >- - voting_start_time is the starting time to vote on a - proposal. - voting_end_time: - type: string - format: date-time - description: voting_end_time is the end time of voting on a proposal. + result: + type: string + enum: + - RESPONSE_RESULT_TYPE_UNSPECIFIED + - RESPONSE_RESULT_TYPE_NOOP + - RESPONSE_RESULT_TYPE_SUCCESS + default: RESPONSE_RESULT_TYPE_UNSPECIFIED description: >- - Proposal defines the core field members of a governance - proposal. + - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value + enumeration + - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) + - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully + title: >- + ResponseResultType defines the possible outcomes of the + execution of a message description: >- - QueryProposalResponse is the response type for the Query/Proposal - RPC method. + MsgAcknowledgementResponse defines the Msg/Acknowledgement + response type. default: description: An unexpected error response. schema: @@ -16668,8 +11492,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -16679,7 +11507,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -16707,10 +11535,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -16748,85 +11574,144 @@ paths: "value": "1.212s" } parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path + - name: body + in: body required: true - type: string - format: uint64 - tags: - - Query - /cosmos/gov/v1beta1/proposals/{proposal_id}/deposits: - get: - summary: Deposits queries all deposits of a single proposal. - operationId: CosmosGovV1Beta1Deposits - responses: - '200': - description: A successful response. schema: type: object properties: - deposits: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - depositor: - type: string - description: >- - depositor defines the deposit addresses from the - proposals. - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an - amount. + packet: + type: object + properties: + sequence: + type: string + format: uint64 + description: >- + number corresponds to the order of sends and receives, + where a Packet + with an earlier sequence number must be sent and received + before a Packet - NOTE: The amount field is an Int which implements the - custom method + with a later sequence number. + source_port: + type: string + description: identifies the port on the sending chain. + source_channel: + type: string + description: identifies the channel end on the sending chain. + destination_port: + type: string + description: identifies the port on the receiving chain. + destination_channel: + type: string + description: identifies the channel end on the receiving chain. + data: + type: string + format: byte + title: >- + actual opaque bytes transferred directly to the + application module + timeout_height: + title: block height after which the packet times out + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping - signatures required by gogoproto. - description: amount to be deposited by depositor. - description: >- - Deposit defines an amount deposited by an account address to - an active + RevisionNumber the same. However some consensus algorithms + may choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that - proposal. - description: deposits defines the requested deposits. - pagination: - description: pagination defines the pagination in the response. + height continues to be monitonically increasing even as + the RevisionHeight + + gets reset + timeout_timestamp: + type: string + format: uint64 + title: >- + block timestamp (in nanoseconds) after which the packet + times out + title: >- + Packet defines a type that carries data across different + chains through IBC + acknowledgement: + type: string + format: byte + proof_acked: + type: string + format: byte + proof_height: type: object properties: - next_key: + revision_number: type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: + format: uint64 + title: the revision that the client is currently on + revision_height: type: string format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping + + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as the + RevisionHeight - was set, its value is undefined otherwise + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes + of updating and + + freezing clients + signer: + type: string + title: MsgAcknowledgement receives incoming IBC acknowledgement + tags: + - Msg + /ibc.core.channel.v1.Msg/ChannelCloseConfirm: + post: + summary: |- + ChannelCloseConfirm defines a rpc handler method for + MsgChannelCloseConfirm. + operationId: IbcCoreChannelV1Msg_ChannelCloseConfirm + responses: + '200': + description: A successful response. + schema: + type: object description: >- - QueryDepositsResponse is the response type for the Query/Deposits - RPC method. + MsgChannelCloseConfirmResponse defines the Msg/ChannelCloseConfirm + response + + type. default: description: An unexpected error response. schema: @@ -16933,8 +11818,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -16944,7 +11833,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -16972,10 +11861,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -17013,116 +11900,76 @@ paths: "value": "1.212s" } parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path - required: true - type: string - format: uint64 - - name: pagination.key + - name: body description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should + MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B + to acknowledge the change of channel state to CLOSED on Chain A. + in: body + required: true + schema: + type: object + properties: + port_id: + type: string + channel_id: + type: string + proof_init: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. + RevisionNumber the same. However some consensus algorithms may + choose to - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include + reset the height in certain conditions e.g. hard forks, + state-machine - a count of the total number of items available for pagination in - UIs. + breaking changes In these cases, the RevisionNumber is + incremented so that - count_total is only respected when offset is used. It is ignored - when key + height continues to be monitonically increasing even as the + RevisionHeight - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. + gets reset + title: >- + Height is a monotonically increasing data type + that can be compared against another Height for the purposes + of updating and - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean + freezing clients + signer: + type: string + description: |- + MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B + to acknowledge the change of channel state to CLOSED on Chain A. tags: - - Query - /cosmos/gov/v1beta1/proposals/{proposal_id}/deposits/{depositor}: - get: - summary: >- - Deposit queries single deposit information based proposalID, - depositAddr. - operationId: CosmosGovV1Beta1Deposit + - Msg + /ibc.core.channel.v1.Msg/ChannelCloseInit: + post: + summary: ChannelCloseInit defines a rpc handler method for MsgChannelCloseInit. + operationId: IbcCoreChannelV1Msg_ChannelCloseInit responses: '200': description: A successful response. schema: type: object - properties: - deposit: - description: deposit defines the requested deposit. - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - depositor: - type: string - description: >- - depositor defines the deposit addresses from the - proposals. - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: amount to be deposited by depositor. description: >- - QueryDepositResponse is the response type for the Query/Deposit - RPC method. + MsgChannelCloseInitResponse defines the Msg/ChannelCloseInit + response type. default: description: An unexpected error response. schema: @@ -17229,8 +12076,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -17240,7 +12091,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -17268,10 +12119,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -17309,50 +12158,38 @@ paths: "value": "1.212s" } parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path - required: true - type: string - format: uint64 - - name: depositor - description: depositor defines the deposit addresses from the proposals. - in: path + - name: body + description: |- + MsgChannelCloseInit defines a msg sent by a Relayer to Chain A + to close a channel with Chain B. + in: body required: true - type: string + schema: + type: object + properties: + port_id: + type: string + channel_id: + type: string + signer: + type: string + description: |- + MsgChannelCloseInit defines a msg sent by a Relayer to Chain A + to close a channel with Chain B. tags: - - Query - /cosmos/gov/v1beta1/proposals/{proposal_id}/tally: - get: - summary: TallyResult queries the tally of a proposal vote. - operationId: CosmosGovV1Beta1TallyResult + - Msg + /ibc.core.channel.v1.Msg/ChannelOpenAck: + post: + summary: ChannelOpenAck defines a rpc handler method for MsgChannelOpenAck. + operationId: IbcCoreChannelV1Msg_ChannelOpenAck responses: '200': description: A successful response. schema: type: object - properties: - tally: - description: tally defines the requested tally. - type: object - properties: - 'yes': - type: string - description: yes is the number of yes votes on a proposal. - abstain: - type: string - description: abstain is the number of abstain votes on a proposal. - 'no': - type: string - description: no is the number of no votes on a proposal. - no_with_veto: - type: string - description: >- - no_with_veto is the number of no with veto votes on a - proposal. description: >- - QueryTallyResultResponse is the response type for the Query/Tally - RPC method. + MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response + type. default: description: An unexpected error response. schema: @@ -17459,8 +12296,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -17470,7 +12311,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -17498,10 +12339,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -17539,114 +12378,88 @@ paths: "value": "1.212s" } parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path + - name: body + description: >- + MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to + acknowledge + + the change of channel state to TRYOPEN on Chain B. + in: body required: true - type: string - format: uint64 - tags: - - Query - /cosmos/gov/v1beta1/proposals/{proposal_id}/votes: - get: - summary: Votes queries votes of a given proposal. - operationId: CosmosGovV1Beta1Votes - responses: - '200': - description: A successful response. schema: type: object properties: - votes: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - voter: - type: string - description: voter is the voter address of the proposal. - option: - description: >- - Deprecated: Prefer to use `options` instead. This field - is set in queries + port_id: + type: string + channel_id: + type: string + counterparty_channel_id: + type: string + counterparty_version: + type: string + proof_try: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping - if and only if `len(options) == 1` and that option has - weight 1. In all + RevisionNumber the same. However some consensus algorithms may + choose to - other cases, this field will default to - VOTE_OPTION_UNSPECIFIED. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - options: - type: array - items: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not - contain duplicate vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: >- - weight is the vote weight associated with the vote - option. - description: >- - WeightedVoteOption defines a unit of vote for vote - split. + reset the height in certain conditions e.g. hard forks, + state-machine + breaking changes In these cases, the RevisionNumber is + incremented so that - Since: cosmos-sdk 0.43 - description: |- - options is the weighted vote options. + height continues to be monitonically increasing even as the + RevisionHeight - Since: cosmos-sdk 0.43 - description: >- - Vote defines a vote on a governance proposal. + gets reset + title: >- + Height is a monotonically increasing data type - A Vote consists of a proposal ID, the voter, and the vote - option. - description: votes defines the queried votes. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + that can be compared against another Height for the purposes + of updating and - was set, its value is undefined otherwise + freezing clients + signer: + type: string description: >- - QueryVotesResponse is the response type for the Query/Votes RPC - method. + MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to + acknowledge + + the change of channel state to TRYOPEN on Chain B. + tags: + - Msg + /ibc.core.channel.v1.Msg/ChannelOpenConfirm: + post: + summary: >- + ChannelOpenConfirm defines a rpc handler method for + MsgChannelOpenConfirm. + operationId: IbcCoreChannelV1Msg_ChannelOpenConfirm + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgChannelOpenConfirmResponse defines the Msg/ChannelOpenConfirm + response + + type. default: description: An unexpected error response. schema: @@ -17753,8 +12566,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -17764,7 +12581,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -17792,10 +12609,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -17833,144 +12648,83 @@ paths: "value": "1.212s" } parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path - required: true - type: string - format: uint64 - - name: pagination.key + - name: body description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. + MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to + acknowledge the change of channel state to OPEN on Chain A. + in: body + required: true + schema: + type: object + properties: + port_id: + type: string + channel_id: + type: string + proof_ack: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping - It is less efficient than using key. Only one of offset or key - should + RevisionNumber the same. However some consensus algorithms may + choose to - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. + reset the height in certain conditions e.g. hard forks, + state-machine - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include + breaking changes In these cases, the RevisionNumber is + incremented so that - a count of the total number of items available for pagination in - UIs. + height continues to be monitonically increasing even as the + RevisionHeight - count_total is only respected when offset is used. It is ignored - when key + gets reset + title: >- + Height is a monotonically increasing data type - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. + that can be compared against another Height for the purposes + of updating and + freezing clients + signer: + type: string + description: >- + MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B + to - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean + acknowledge the change of channel state to OPEN on Chain A. tags: - - Query - /cosmos/gov/v1beta1/proposals/{proposal_id}/votes/{voter}: - get: - summary: Vote queries voted information based on proposalID, voterAddr. - operationId: CosmosGovV1Beta1Vote + - Msg + /ibc.core.channel.v1.Msg/ChannelOpenInit: + post: + summary: ChannelOpenInit defines a rpc handler method for MsgChannelOpenInit. + operationId: IbcCoreChannelV1Msg_ChannelOpenInit responses: '200': description: A successful response. schema: type: object properties: - vote: - description: vote defines the queried vote. - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - voter: - type: string - description: voter is the voter address of the proposal. - option: - description: >- - Deprecated: Prefer to use `options` instead. This field is - set in queries - - if and only if `len(options) == 1` and that option has - weight 1. In all - - other cases, this field will default to - VOTE_OPTION_UNSPECIFIED. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - options: - type: array - items: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not - contain duplicate vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: >- - weight is the vote weight associated with the vote - option. - description: >- - WeightedVoteOption defines a unit of vote for vote - split. - - - Since: cosmos-sdk 0.43 - description: |- - options is the weighted vote options. - - Since: cosmos-sdk 0.43 + channel_id: + type: string + version: + type: string description: >- - QueryVoteResponse is the response type for the Query/Vote RPC - method. + MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit + response type. default: description: An unexpected error response. schema: @@ -18077,8 +12831,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -18088,7 +12846,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -18116,10 +12874,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -18157,70 +12913,118 @@ paths: "value": "1.212s" } parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path - required: true - type: string - format: uint64 - - name: voter - description: voter defines the voter address for the proposals. - in: path + - name: body + description: >- + MsgChannelOpenInit defines an sdk.Msg to initialize a channel + handshake. It + + is called by a relayer on Chain A. + in: body required: true - type: string - tags: - - Query - /cosmos/group/v1/group_info/{group_id}: - get: - summary: GroupInfo queries group info based on group id. - operationId: CosmosGroupV1GroupInfo - responses: - '200': - description: A successful response. schema: type: object properties: - info: - description: info is the GroupInfo of the group. + port_id: + type: string + channel: type: object properties: - id: - type: string - format: uint64 - description: id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group's admin. - metadata: + state: + title: current state of the channel end type: string + enum: + - STATE_UNINITIALIZED_UNSPECIFIED + - STATE_INIT + - STATE_TRYOPEN + - STATE_OPEN + - STATE_CLOSED + default: STATE_UNINITIALIZED_UNSPECIFIED description: >- - metadata is any arbitrary metadata to attached to the - group. + State defines if a channel is in one of the following + states: + + CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. + + - STATE_UNINITIALIZED_UNSPECIFIED: Default State + - STATE_INIT: A channel has just started the opening handshake. + - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. + - STATE_OPEN: A channel has completed the handshake. Open channels are + ready to send and receive packets. + - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive + packets. + ordering: + title: whether the channel is ordered or unordered + type: string + enum: + - ORDER_NONE_UNSPECIFIED + - ORDER_UNORDERED + - ORDER_ORDERED + default: ORDER_NONE_UNSPECIFIED + description: |- + - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering + - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in + which they were sent. + - ORDER_ORDERED: packets are delivered exactly in the order which they were sent + counterparty: + title: counterparty channel end + type: object + properties: + port_id: + type: string + description: >- + port on the counterparty chain which owns the other + end of the channel. + channel_id: + type: string + title: channel end on the counterparty chain + connection_hops: + type: array + items: + type: string + title: >- + list of connection identifiers, in order, along which + packets sent on + + this channel will travel version: type: string - format: uint64 title: >- - version is used to track changes to a group's membership - structure that + opaque channel version, which is agreed upon during the + handshake + description: >- + Channel defines pipeline for exactly-once packet delivery + between specific - would break existing proposals. Whenever any members - weight is changed, + modules on separate blockchains, which has at least one end + capable of - or any member is added or removed this version is - incremented and will + sending packets and one end capable of receiving packets. + signer: + type: string + description: >- + MsgChannelOpenInit defines an sdk.Msg to initialize a channel + handshake. It - cause proposals based on older versions of this group to - fail - total_weight: - type: string - description: total_weight is the sum of the group members' weights. - created_at: - type: string - format: date-time - description: >- - created_at is a timestamp specifying when a group was - created. - description: QueryGroupInfoResponse is the Query/GroupInfo response type. + is called by a relayer on Chain A. + tags: + - Msg + /ibc.core.channel.v1.Msg/ChannelOpenTry: + post: + summary: ChannelOpenTry defines a rpc handler method for MsgChannelOpenTry. + operationId: IbcCoreChannelV1Msg_ChannelOpenTry + responses: + '200': + description: A successful response. + schema: + type: object + properties: + version: + type: string + channel_id: + type: string + description: >- + MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response + type. default: description: An unexpected error response. schema: @@ -18327,8 +13131,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -18338,7 +13146,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -18366,10 +13174,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -18407,82 +13213,178 @@ paths: "value": "1.212s" } parameters: - - name: group_id - description: group_id is the unique ID of the group. - in: path + - name: body + description: >- + MsgChannelOpenInit defines a msg sent by a Relayer to try to open a + channel + + on Chain B. The version field within the Channel field has been + deprecated. Its + + value will be ignored by core IBC. + in: body required: true - type: string - format: uint64 - tags: - - Query - /cosmos/group/v1/group_members/{group_id}: - get: - summary: GroupMembers queries members of a group by group id. - operationId: CosmosGroupV1GroupMembers - responses: - '200': - description: A successful response. schema: type: object properties: - members: - type: array - items: - type: object - properties: - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the group. - member: - description: member is the member data. - type: object - properties: - address: - type: string - description: address is the member's account address. - weight: - type: string - description: >- - weight is the member's voting weight that should be - greater than 0. - metadata: - type: string - description: >- - metadata is any arbitrary metadata attached to the - member. - added_at: - type: string - format: date-time - description: >- - added_at is a timestamp specifying when a member was - added. - description: >- - GroupMember represents the relationship between a group and - a member. - description: members are the members of the group with given group_id. - pagination: - description: pagination defines the pagination in the response. + port_id: + type: string + previous_channel_id: + type: string + description: >- + Deprecated: this field is unused. Crossing hello's are no + longer supported in core IBC. + channel: type: object properties: - next_key: + state: + title: current state of the channel end type: string - format: byte + enum: + - STATE_UNINITIALIZED_UNSPECIFIED + - STATE_INIT + - STATE_TRYOPEN + - STATE_OPEN + - STATE_CLOSED + default: STATE_UNINITIALIZED_UNSPECIFIED + description: >- + State defines if a channel is in one of the following + states: + + CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. + + - STATE_UNINITIALIZED_UNSPECIFIED: Default State + - STATE_INIT: A channel has just started the opening handshake. + - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. + - STATE_OPEN: A channel has completed the handshake. Open channels are + ready to send and receive packets. + - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive + packets. + ordering: + title: whether the channel is ordered or unordered + type: string + enum: + - ORDER_NONE_UNSPECIFIED + - ORDER_UNORDERED + - ORDER_ORDERED + default: ORDER_NONE_UNSPECIFIED description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: + - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering + - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in + which they were sent. + - ORDER_ORDERED: packets are delivered exactly in the order which they were sent + counterparty: + title: counterparty channel end + type: object + properties: + port_id: + type: string + description: >- + port on the counterparty chain which owns the other + end of the channel. + channel_id: + type: string + title: channel end on the counterparty chain + connection_hops: + type: array + items: + type: string + title: >- + list of connection identifiers, in order, along which + packets sent on + + this channel will travel + version: type: string - format: uint64 title: >- - total is total number of results available if - PageRequest.count_total + opaque channel version, which is agreed upon during the + handshake + description: >- + Channel defines pipeline for exactly-once packet delivery + between specific + + modules on separate blockchains, which has at least one end + capable of + + sending packets and one end capable of receiving packets. + counterparty_version: + type: string + proof_init: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping - was set, its value is undefined otherwise + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes + of updating and + + freezing clients + signer: + type: string description: >- - QueryGroupMembersResponse is the Query/GroupMembersResponse - response type. + MsgChannelOpenInit defines a msg sent by a Relayer to try to open + a channel + + on Chain B. The version field within the Channel field has been + deprecated. Its + + value will be ignored by core IBC. + tags: + - Msg + /ibc.core.channel.v1.Msg/RecvPacket: + post: + summary: RecvPacket defines a rpc handler method for MsgRecvPacket. + operationId: IbcCoreChannelV1Msg_RecvPacket + responses: + '200': + description: A successful response. + schema: + type: object + properties: + result: + type: string + enum: + - RESPONSE_RESULT_TYPE_UNSPECIFIED + - RESPONSE_RESULT_TYPE_NOOP + - RESPONSE_RESULT_TYPE_SUCCESS + default: RESPONSE_RESULT_TYPE_UNSPECIFIED + description: >- + - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value + enumeration + - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) + - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully + title: >- + ResponseResultType defines the possible outcomes of the + execution of a message + description: MsgRecvPacketResponse defines the Msg/RecvPacket response type. default: description: An unexpected error response. schema: @@ -18589,8 +13491,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -18600,7 +13506,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -18628,10 +13534,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -18669,212 +13573,151 @@ paths: "value": "1.212s" } parameters: - - name: group_id - description: group_id is the unique ID of the group. - in: path + - name: body + in: body required: true - type: string - format: uint64 - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/group/v1/group_policies_by_admin/{admin}: - get: - summary: GroupPoliciesByAdmin queries group policies by admin address. - operationId: CosmosGroupV1GroupPoliciesByAdmin - responses: - '200': - description: A successful response. schema: type: object properties: - group_policies: - type: array - items: - type: object - properties: - address: - type: string - description: address is the account address of group policy. - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group admin. - metadata: - type: string - title: >- - metadata is any arbitrary metadata attached to the group - policy. - - the recommended format of the metadata is to be found - here: - - https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 - version: - type: string - format: uint64 - description: >- - version is used to track changes to a group's - GroupPolicyInfo structure that - - would create a different result on a running proposal. - decision_policy: - description: >- - decision_policy specifies the group policy's decision - policy. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). + packet: + type: object + properties: + sequence: + type: string + format: uint64 + description: >- + number corresponds to the order of sends and receives, + where a Packet + with an earlier sequence number must be sent and received + before a Packet - In practice, teams usually precompile into the - binary all types that they + with a later sequence number. + source_port: + type: string + description: identifies the port on the sending chain. + source_channel: + type: string + description: identifies the channel end on the sending chain. + destination_port: + type: string + description: identifies the port on the receiving chain. + destination_channel: + type: string + description: identifies the channel end on the receiving chain. + data: + type: string + format: byte + title: >- + actual opaque bytes transferred directly to the + application module + timeout_height: + title: block height after which the packet times out + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping - expect it to use in the context of Any. However, for - URLs which use the + RevisionNumber the same. However some consensus algorithms + may choose to - scheme `http`, `https`, or no scheme, one can - optionally set up a type + reset the height in certain conditions e.g. hard forks, + state-machine - server that maps type URLs to message definitions as - follows: + breaking changes In these cases, the RevisionNumber is + incremented so that + height continues to be monitonically increasing even as + the RevisionHeight - * If no scheme is provided, `https` is assumed. + gets reset + timeout_timestamp: + type: string + format: uint64 + title: >- + block timestamp (in nanoseconds) after which the packet + times out + title: >- + Packet defines a type that carries data across different + chains through IBC + proof_commitment: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + RevisionNumber the same. However some consensus algorithms may + choose to - Note: this functionality is not currently available - in the official + reset the height in certain conditions e.g. hard forks, + state-machine - protobuf release, and it is not used for type URLs - beginning with + breaking changes In these cases, the RevisionNumber is + incremented so that - type.googleapis.com. + height continues to be monitonically increasing even as the + RevisionHeight + gets reset + title: >- + Height is a monotonically increasing data type - Schemes other than `http`, `https` (or the empty - scheme) might be + that can be compared against another Height for the purposes + of updating and - used with implementation specific semantics. - additionalProperties: {} - created_at: - type: string - format: date-time - description: >- - created_at is a timestamp specifying when a group policy - was created. - description: >- - GroupPolicyInfo represents the high-level on-chain - information for a group policy. + freezing clients + signer: + type: string + title: MsgRecvPacket receives incoming IBC packet + tags: + - Msg + /ibc.core.channel.v1.Msg/Timeout: + post: + summary: Timeout defines a rpc handler method for MsgTimeout. + operationId: IbcCoreChannelV1Msg_Timeout + responses: + '200': + description: A successful response. + schema: + type: object + properties: + result: + type: string + enum: + - RESPONSE_RESULT_TYPE_UNSPECIFIED + - RESPONSE_RESULT_TYPE_NOOP + - RESPONSE_RESULT_TYPE_SUCCESS + default: RESPONSE_RESULT_TYPE_UNSPECIFIED description: >- - group_policies are the group policies info with provided - admin. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGroupPoliciesByAdminResponse is the - Query/GroupPoliciesByAdmin response type. + - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value + enumeration + - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) + - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully + title: >- + ResponseResultType defines the possible outcomes of the + execution of a message + description: MsgTimeoutResponse defines the Msg/Timeout response type. default: description: An unexpected error response. schema: @@ -18981,8 +13824,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -18992,7 +13839,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -19020,10 +13867,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -19061,227 +13906,172 @@ paths: "value": "1.212s" } parameters: - - name: admin - description: admin is the admin address of the group policy. - in: path + - name: body + in: body required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. + schema: + type: object + properties: + packet: + type: object + properties: + sequence: + type: string + format: uint64 + description: >- + number corresponds to the order of sends and receives, + where a Packet - It is less efficient than using key. Only one of offset or key - should + with an earlier sequence number must be sent and received + before a Packet - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. + with a later sequence number. + source_port: + type: string + description: identifies the port on the sending chain. + source_channel: + type: string + description: identifies the channel end on the sending chain. + destination_port: + type: string + description: identifies the port on the receiving chain. + destination_channel: + type: string + description: identifies the channel end on the receiving chain. + data: + type: string + format: byte + title: >- + actual opaque bytes transferred directly to the + application module + timeout_height: + title: block height after which the packet times out + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include + RevisionNumber the same. However some consensus algorithms + may choose to - a count of the total number of items available for pagination in - UIs. + reset the height in certain conditions e.g. hard forks, + state-machine - count_total is only respected when offset is used. It is ignored - when key + breaking changes In these cases, the RevisionNumber is + incremented so that - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. + height continues to be monitonically increasing even as + the RevisionHeight + + gets reset + timeout_timestamp: + type: string + format: uint64 + title: >- + block timestamp (in nanoseconds) after which the packet + times out + title: >- + Packet defines a type that carries data across different + chains through IBC + proof_unreceived: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping + RevisionNumber the same. However some consensus algorithms may + choose to - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes + of updating and + + freezing clients + next_sequence_recv: + type: string + format: uint64 + signer: + type: string + title: MsgTimeout receives timed-out packet tags: - - Query - /cosmos/group/v1/group_policies_by_group/{group_id}: - get: - summary: GroupPoliciesByGroup queries group policies by group id. - operationId: CosmosGroupV1GroupPoliciesByGroup + - Msg + /ibc.core.channel.v1.Msg/TimeoutOnClose: + post: + summary: TimeoutOnClose defines a rpc handler method for MsgTimeoutOnClose. + operationId: IbcCoreChannelV1Msg_TimeoutOnClose responses: '200': description: A successful response. schema: type: object properties: - group_policies: + result: + type: string + enum: + - RESPONSE_RESULT_TYPE_UNSPECIFIED + - RESPONSE_RESULT_TYPE_NOOP + - RESPONSE_RESULT_TYPE_SUCCESS + default: RESPONSE_RESULT_TYPE_UNSPECIFIED + description: >- + - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value + enumeration + - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) + - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully + title: >- + ResponseResultType defines the possible outcomes of the + execution of a message + description: >- + MsgTimeoutOnCloseResponse defines the Msg/TimeoutOnClose response + type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: type: array items: type: object properties: - address: - type: string - description: address is the account address of group policy. - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group admin. - metadata: - type: string - title: >- - metadata is any arbitrary metadata attached to the group - policy. - - the recommended format of the metadata is to be found - here: - - https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 - version: - type: string - format: uint64 - description: >- - version is used to track changes to a group's - GroupPolicyInfo structure that - - would create a different result on a running proposal. - decision_policy: - description: >- - decision_policy specifies the group policy's decision - policy. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - created_at: - type: string - format: date-time - description: >- - created_at is a timestamp specifying when a group policy - was created. - description: >- - GroupPolicyInfo represents the high-level on-chain - information for a group policy. - description: >- - group_policies are the group policies info associated with the - provided group. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGroupPoliciesByGroupResponse is the - Query/GroupPoliciesByGroup response type. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': + '@type': type: string description: >- A URL/resource name that uniquely identifies the type of @@ -19372,8 +14162,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -19383,7 +14177,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -19411,10 +14205,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -19452,187 +14244,147 @@ paths: "value": "1.212s" } parameters: - - name: group_id - description: group_id is the unique ID of the group policy's group. - in: path - required: true - type: string - format: uint64 - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse + - name: body description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/group/v1/group_policy_info/{address}: - get: - summary: >- - GroupPolicyInfo queries group policy info based on account address of - group policy. - operationId: CosmosGroupV1GroupPolicyInfo - responses: - '200': - description: A successful response. + MsgTimeoutOnClose timed-out packet upon counterparty channel + closure. + in: body + required: true schema: type: object properties: - info: - description: info is the GroupPolicyInfo of the group policy. + packet: type: object properties: - address: - type: string - description: address is the account address of group policy. - group_id: + sequence: type: string format: uint64 - description: group_id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group admin. - metadata: - type: string - title: >- - metadata is any arbitrary metadata attached to the group - policy. + description: >- + number corresponds to the order of sends and receives, + where a Packet - the recommended format of the metadata is to be found - here: + with an earlier sequence number must be sent and received + before a Packet - https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 - version: + with a later sequence number. + source_port: type: string - format: uint64 - description: >- - version is used to track changes to a group's - GroupPolicyInfo structure that - - would create a different result on a running proposal. - decision_policy: - description: >- - decision_policy specifies the group policy's decision - policy. + description: identifies the port on the sending chain. + source_channel: + type: string + description: identifies the channel end on the sending chain. + destination_port: + type: string + description: identifies the port on the receiving chain. + destination_channel: + type: string + description: identifies the channel end on the receiving chain. + data: + type: string + format: byte + title: >- + actual opaque bytes transferred directly to the + application module + timeout_height: + title: block height after which the packet times out type: object properties: - '@type': + revision_number: type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping - expect it to use in the context of Any. However, for - URLs which use the + RevisionNumber the same. However some consensus algorithms + may choose to - scheme `http`, `https`, or no scheme, one can - optionally set up a type + reset the height in certain conditions e.g. hard forks, + state-machine - server that maps type URLs to message definitions as - follows: + breaking changes In these cases, the RevisionNumber is + incremented so that + height continues to be monitonically increasing even as + the RevisionHeight - * If no scheme is provided, `https` is assumed. + gets reset + timeout_timestamp: + type: string + format: uint64 + title: >- + block timestamp (in nanoseconds) after which the packet + times out + title: >- + Packet defines a type that carries data across different + chains through IBC + proof_unreceived: + type: string + format: byte + proof_close: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + RevisionNumber the same. However some consensus algorithms may + choose to - Note: this functionality is not currently available in - the official + reset the height in certain conditions e.g. hard forks, + state-machine - protobuf release, and it is not used for type URLs - beginning with + breaking changes In these cases, the RevisionNumber is + incremented so that - type.googleapis.com. + height continues to be monitonically increasing even as the + RevisionHeight + gets reset + title: >- + Height is a monotonically increasing data type - Schemes other than `http`, `https` (or the empty - scheme) might be + that can be compared against another Height for the purposes + of updating and - used with implementation specific semantics. - additionalProperties: {} - created_at: - type: string - format: date-time - description: >- - created_at is a timestamp specifying when a group policy - was created. + freezing clients + next_sequence_recv: + type: string + format: uint64 + signer: + type: string description: >- - QueryGroupPolicyInfoResponse is the Query/GroupPolicyInfo response + MsgTimeoutOnClose timed-out packet upon counterparty channel + closure. + tags: + - Msg + /ibc.core.client.v1.Msg/CreateClient: + post: + summary: CreateClient defines a rpc handler method for MsgCreateClient. + operationId: IbcCoreClientV1Msg_CreateClient + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgCreateClientResponse defines the Msg/CreateClient response type. default: description: An unexpected error response. @@ -19740,8 +14492,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -19751,7 +14507,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -19779,10 +14535,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -19820,92 +14574,270 @@ paths: "value": "1.212s" } parameters: - - name: address - description: address is the account address of the group policy. - in: path + - name: body + in: body required: true - type: string - tags: - - Query - /cosmos/group/v1/groups: - get: - summary: Groups queries all groups in state. - description: 'Since: cosmos-sdk 0.47.1' - operationId: CosmosGroupV1Groups - responses: - '200': - description: A successful response. schema: type: object properties: - groups: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group's admin. - metadata: - type: string - description: >- - metadata is any arbitrary metadata to attached to the - group. - version: - type: string - format: uint64 - title: >- - version is used to track changes to a group's membership - structure that + client_state: + title: light client state + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at least - would break existing proposals. Whenever any members - weight is changed, + one "/" character. The last segment of the URL's path must + represent - or any member is added or removed this version is - incremented and will + the fully qualified name of the type (as in - cause proposals based on older versions of this group to - fail - total_weight: - type: string - description: total_weight is the sum of the group members' weights. - created_at: - type: string - format: date-time - description: >- - created_at is a timestamp specifying when a group was - created. - description: >- - GroupInfo represents the high-level on-chain information for - a group. - description: '`groups` is all the groups present in state.' - pagination: - description: pagination defines the pagination in the response. + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all + types that they + + expect it to use in the context of Any. However, for URLs + which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message + along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in + the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default + use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the last + '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding a + field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + consensus_state: + description: >- + consensus state associated with the client that corresponds to + a given + + height. type: object properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: + '@type': type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + description: >- + A URL/resource name that uniquely identifies the type of + the serialized - was set, its value is undefined otherwise - description: |- - QueryGroupsResponse is the Query/Groups response type. + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all + types that they + + expect it to use in the context of Any. However, for URLs + which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be - Since: cosmos-sdk 0.47.1 + used with implementation specific semantics. + additionalProperties: {} + signer: + type: string + title: signer address + title: MsgCreateClient defines a message to create an IBC client + tags: + - Msg + /ibc.core.client.v1.Msg/IBCSoftwareUpgrade: + post: + summary: >- + IBCSoftwareUpgrade defines a rpc handler method for + MsgIBCSoftwareUpgrade. + operationId: IbcCoreClientV1Msg_IBCSoftwareUpgrade + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgIBCSoftwareUpgradeResponse defines the Msg/IBCSoftwareUpgrade + response type. default: description: An unexpected error response. schema: @@ -20012,8 +14944,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -20023,7 +14959,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -20051,10 +14987,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -20092,141 +15026,235 @@ paths: "value": "1.212s" } parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. + - name: body + in: body + required: true + schema: + type: object + properties: + plan: + type: object + properties: + name: + type: string + description: >- + Sets the name for the upgrade. This name will be used by + the upgraded - It is less efficient than using key. Only one of offset or key - should + version of the software to apply any special "on-upgrade" + commands during - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. + the first BeginBlock method after the upgrade is applied. + It is also used - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include + to detect whether a software version can handle a given + upgrade. If no - a count of the total number of items available for pagination in - UIs. + upgrade handler with this name has been set in the + software, it will be - count_total is only respected when offset is used. It is ignored - when key + assumed that the software is out-of-date when the upgrade + Time or Height is - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. + reached and the software will exit. + time: + type: string + format: date-time + description: >- + Deprecated: Time based upgrades have been deprecated. Time + based upgrade logic + has been removed from the SDK. - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/group/v1/groups_by_admin/{admin}: - get: - summary: GroupsByAdmin queries groups by admin address. - operationId: CosmosGroupV1GroupsByAdmin - responses: - '200': - description: A successful response. - schema: - type: object - properties: - groups: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group's admin. - metadata: - type: string - description: >- - metadata is any arbitrary metadata to attached to the - group. - version: - type: string - format: uint64 - title: >- - version is used to track changes to a group's membership - structure that + If this field is not empty, an error will be thrown. + height: + type: string + format: int64 + description: The height at which the upgrade must be performed. + info: + type: string + title: >- + Any application specific upgrade info to be included + on-chain - would break existing proposals. Whenever any members - weight is changed, + such as a git commit that validators could automatically + upgrade to + upgraded_client_state: + description: >- + Deprecated: UpgradedClientState field has been deprecated. + IBC upgrade logic has been - or any member is added or removed this version is - incremented and will + moved to the IBC module in the sub module 02-client. - cause proposals based on older versions of this group to - fail - total_weight: - type: string - description: total_weight is the sum of the group members' weights. - created_at: - type: string - format: date-time - description: >- - created_at is a timestamp specifying when a group was - created. - description: >- - GroupInfo represents the high-level on-chain information for - a group. - description: groups are the groups info with the provided admin. - pagination: - description: pagination defines the pagination in the response. + If this field is not empty, an error will be thrown. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type + of the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be + in a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can + optionally set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results + based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty + scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + Plan specifies information about a planned upgrade and when it + should occur. + upgraded_client_state: + description: >- + An UpgradedClientState must be provided to perform an IBC + breaking upgrade. + + This will make the chain commit to the correct upgraded (self) + client state + + before the upgrade occurs, so that connecting chains can + verify that the + + new upgraded client is valid by verifying a proof on the + previous version + + of the chain. This will allow IBC connections to persist + smoothly across + + planned chain upgrades. Correspondingly, the + UpgradedClientState field has been + + deprecated in the Cosmos SDK to allow for this logic to exist + solely in + + the 02-client module. type: object properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: + '@type': type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all + types that they + + expect it to use in the context of Any. However, for URLs + which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be - was set, its value is undefined otherwise + used with implementation specific semantics. + additionalProperties: {} + signer: + type: string + title: signer address + title: >- + MsgIBCSoftwareUpgrade defines the message used to schedule an + upgrade of an IBC client using a v1 governance proposal + tags: + - Msg + /ibc.core.client.v1.Msg/RecoverClient: + post: + summary: RecoverClient defines a rpc handler method for MsgRecoverClient. + operationId: IbcCoreClientV1Msg_RecoverClient + responses: + '200': + description: A successful response. + schema: + type: object description: >- - QueryGroupsByAdminResponse is the Query/GroupsByAdminResponse - response type. + MsgRecoverClientResponse defines the Msg/RecoverClient response + type. default: description: An unexpected error response. schema: @@ -20333,8 +15361,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -20344,7 +15376,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -20372,10 +15404,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -20413,145 +15443,50 @@ paths: "value": "1.212s" } parameters: - - name: admin - description: admin is the account address of a group's admin. - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse + - name: body description: >- - reverse is set to true if results are to be returned in the - descending order. - + MsgRecoverClient defines the message used to recover a frozen or + expired client. + in: body + required: true + schema: + type: object + properties: + subject_client_id: + type: string + title: >- + the client identifier for the client to be updated if the + proposal passes + substitute_client_id: + type: string + title: >- + the substitute client identifier for the client which will + replace the subject - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean + client + signer: + type: string + title: signer address + description: >- + MsgRecoverClient defines the message used to recover a frozen or + expired client. tags: - - Query - /cosmos/group/v1/groups_by_member/{address}: - get: - summary: GroupsByMember queries groups by member address. - operationId: CosmosGroupV1GroupsByMember + - Msg + /ibc.core.client.v1.Msg/SubmitMisbehaviour: + post: + summary: >- + SubmitMisbehaviour defines a rpc handler method for + MsgSubmitMisbehaviour. + operationId: IbcCoreClientV1Msg_SubmitMisbehaviour responses: '200': description: A successful response. schema: type: object - properties: - groups: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group's admin. - metadata: - type: string - description: >- - metadata is any arbitrary metadata to attached to the - group. - version: - type: string - format: uint64 - title: >- - version is used to track changes to a group's membership - structure that - - would break existing proposals. Whenever any members - weight is changed, - - or any member is added or removed this version is - incremented and will - - cause proposals based on older versions of this group to - fail - total_weight: - type: string - description: total_weight is the sum of the group members' weights. - created_at: - type: string - format: date-time - description: >- - created_at is a timestamp specifying when a group was - created. - description: >- - GroupInfo represents the high-level on-chain information for - a group. - description: groups are the groups info with the provided group member. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise description: >- - QueryGroupsByMemberResponse is the Query/GroupsByMember response + MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour + response + type. default: description: An unexpected error response. @@ -20659,8 +15594,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -20670,7 +15609,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -20698,10 +15637,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -20739,390 +15676,218 @@ paths: "value": "1.212s" } parameters: - - name: address - description: address is the group member address. - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse + - name: body description: >- - reverse is set to true if results are to be returned in the - descending order. + MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence + for + light client misbehaviour. - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/group/v1/proposal/{proposal_id}: - get: - summary: Proposal queries a proposal based on proposal id. - operationId: CosmosGroupV1Proposal - responses: - '200': - description: A successful response. + This message has been deprecated. Use MsgUpdateClient instead. + in: body + required: true schema: type: object properties: - proposal: - description: proposal is the proposal info. + client_id: + type: string + title: client unique identifier + misbehaviour: + title: misbehaviour used for freezing the light client type: object properties: - id: - type: string - format: uint64 - description: id is the unique id of the proposal. - group_policy_address: - type: string - description: >- - group_policy_address is the account address of group - policy. - metadata: - type: string - title: >- - metadata is any arbitrary metadata attached to the - proposal. - - the recommended format of the metadata is to be found - here: - - https://docs.cosmos.network/v0.47/modules/group#proposal-4 - proposers: - type: array - items: - type: string - description: proposers are the account addresses of the proposers. - submit_time: - type: string - format: date-time - description: >- - submit_time is a timestamp specifying when a proposal was - submitted. - group_version: - type: string - format: uint64 - description: >- - group_version tracks the version of the group at proposal - submission. - - This field is here for informational purposes only. - group_policy_version: - type: string - format: uint64 - description: >- - group_policy_version tracks the version of the group - policy at proposal submission. - - When a decision policy is changed, existing proposals from - previous policy - - versions will become invalid with the `ABORTED` status. - - This field is here for informational purposes only. - status: - description: >- - status represents the high level position in the life - cycle of the proposal. Initial value is Submitted. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_SUBMITTED - - PROPOSAL_STATUS_ACCEPTED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_ABORTED - - PROPOSAL_STATUS_WITHDRAWN - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result contains the sums of all weighted votes - for this - - proposal for each vote option. It is empty at submission, - and only - - populated after tallying, at voting period end or at - proposal execution, - - whichever happens first. - type: object - properties: - yes_count: - type: string - description: yes_count is the weighted sum of yes votes. - abstain_count: - type: string - description: abstain_count is the weighted sum of abstainers. - no_count: - type: string - description: no_count is the weighted sum of no votes. - no_with_veto_count: - type: string - description: no_with_veto_count is the weighted sum of veto. - voting_period_end: + '@type': type: string - format: date-time description: >- - voting_period_end is the timestamp before which voting - must be done. - - Unless a successful MsgExec is called before (to execute a - proposal whose - - tally is successful before the voting period ends), - tallying will be done - - at this point, and the `final_tally_result`and `status` - fields will be + A URL/resource name that uniquely identifies the type of + the serialized - accordingly updated. - executor_result: - description: >- - executor_result is the final result of the proposal - execution. Initial value is NotRun. - type: string - enum: - - PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - - PROPOSAL_EXECUTOR_RESULT_NOT_RUN - - PROPOSAL_EXECUTOR_RESULT_SUCCESS - - PROPOSAL_EXECUTOR_RESULT_FAILURE - default: PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized + protocol buffer message. This string must contain at least - protocol buffer message. This string must contain at - least + one "/" character. The last segment of the URL's path must + represent - one "/" character. The last segment of the URL's - path must represent + the fully qualified name of the type (as in - the fully qualified name of the type (as in + `path/google.protobuf.Duration`). The name should be in a + canonical form - `path/google.protobuf.Duration`). The name should be - in a canonical form + (e.g., leading "." is not accepted). - (e.g., leading "." is not accepted). + In practice, teams usually precompile into the binary all + types that they - In practice, teams usually precompile into the - binary all types that they + expect it to use in the context of Any. However, for URLs + which use the - expect it to use in the context of Any. However, for - URLs which use the + scheme `http`, `https`, or no scheme, one can optionally + set up a type - scheme `http`, `https`, or no scheme, one can - optionally set up a type + server that maps type URLs to message definitions as + follows: - server that maps type URLs to message definitions as - follows: + * If no scheme is provided, `https` is assumed. - * If no scheme is provided, `https` is assumed. + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + Note: this functionality is not currently available in the + official - Note: this functionality is not currently available - in the official + protobuf release, and it is not used for type URLs + beginning with - protobuf release, and it is not used for type URLs - beginning with + type.googleapis.com. - type.googleapis.com. + Schemes other than `http`, `https` (or the empty scheme) + might be - Schemes other than `http`, `https` (or the empty - scheme) might be + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message + along with a - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a + URL that describes the type of the serialized message. - URL that describes the type of the serialized message. + Protobuf library provides support to pack/unpack Any values in + the form - Protobuf library provides support to pack/unpack Any - values in the form + of utility functions or additional generated methods of the + Any type. - of utility functions or additional generated methods of - the Any type. + Example 1: Pack and unpack a message in C++. - Example 1: Pack and unpack a message in C++. + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } + Example 2: Pack and unpack a message in Java. - Example 2: Pack and unpack a message in Java. + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } + Example 3: Pack and unpack a message in Python. - Example 3: Pack and unpack a message in Python. + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... + Example 4: Pack and unpack a message in Go - Example 4: Pack and unpack a message in Go + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } + The pack methods provided by protobuf library will by default + use - The pack methods provided by protobuf library will by - default use + 'type.googleapis.com/full.type.name' as the type URL and the + unpack - 'type.googleapis.com/full.type.name' as the type URL and - the unpack + methods only use the fully qualified type name after the last + '/' - methods only use the fully qualified type name after the - last '/' + in the type URL, for example "foo.bar.com/x/y.z" will yield + type - in the type URL, for example "foo.bar.com/x/y.z" will - yield type + name "y.z". - name "y.z". + JSON - JSON + The JSON representation of an `Any` value uses the regular - ==== + representation of the deserialized, embedded message, with an - The JSON representation of an `Any` value uses the - regular + additional field `@type` which contains the type URL. Example: - representation of the deserialized, embedded message, - with an + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } - additional field `@type` which contains the type URL. - Example: + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } + If the embedded message type is well-known and has a custom + JSON - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + representation, that representation will be embedded adding a + field - If the embedded message type is well-known and has a - custom JSON + `value` which holds the custom JSON in addition to the `@type` - representation, that representation will be embedded - adding a field + field. Example (for message [google.protobuf.Duration][]): - `value` which holds the custom JSON in addition to the - `@type` + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + signer: + type: string + title: signer address + description: >- + MsgSubmitMisbehaviour defines an sdk.Msg type that submits + Evidence for - field. Example (for message - [google.protobuf.Duration][]): + light client misbehaviour. - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages is a list of `sdk.Msg`s that will be executed if - the proposal passes. - title: - type: string - description: 'Since: cosmos-sdk 0.47' - title: title is the title of the proposal - summary: - type: string - description: 'Since: cosmos-sdk 0.47' - title: summary is a short summary of the proposal - description: QueryProposalResponse is the Query/Proposal response type. + This message has been deprecated. Use MsgUpdateClient instead. + tags: + - Msg + /ibc.core.client.v1.Msg/UpdateClient: + post: + summary: UpdateClient defines a rpc handler method for MsgUpdateClient. + operationId: IbcCoreClientV1Msg_UpdateClient + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateClientResponse defines the Msg/UpdateClient response + type. default: description: An unexpected error response. schema: @@ -21229,8 +15994,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -21240,7 +16009,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -21268,10 +16037,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -21309,602 +16076,212 @@ paths: "value": "1.212s" } parameters: - - name: proposal_id - description: proposal_id is the unique ID of a proposal. - in: path - required: true - type: string - format: uint64 - tags: - - Query - /cosmos/group/v1/proposals/{proposal_id}/tally: - get: - summary: >- - TallyResult returns the tally result of a proposal. If the proposal is - - still in voting period, then this query computes the current tally - state, - - which might not be final. On the other hand, if the proposal is final, - - then it simply returns the `final_tally_result` state stored in the + - name: body + description: >- + MsgUpdateClient defines an sdk.Msg to update a IBC client state + using - proposal itself. - operationId: CosmosGroupV1TallyResult - responses: - '200': - description: A successful response. + the given client message. + in: body + required: true schema: type: object properties: - tally: - description: tally defines the requested tally. + client_id: + type: string + title: client unique identifier + client_message: + title: client message to update the light client type: object properties: - yes_count: - type: string - description: yes_count is the weighted sum of yes votes. - abstain_count: - type: string - description: abstain_count is the weighted sum of abstainers. - no_count: - type: string - description: no_count is the weighted sum of no votes. - no_with_veto_count: + '@type': type: string - description: no_with_veto_count is the weighted sum of veto. - description: QueryTallyResultResponse is the Query/TallyResult response type. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized + description: >- + A URL/resource name that uniquely identifies the type of + the serialized - protocol buffer message. This string must contain at - least + protocol buffer message. This string must contain at least - one "/" character. The last segment of the URL's path - must represent + one "/" character. The last segment of the URL's path must + represent - the fully qualified name of the type (as in + the fully qualified name of the type (as in - `path/google.protobuf.Duration`). The name should be in - a canonical form + `path/google.protobuf.Duration`). The name should be in a + canonical form - (e.g., leading "." is not accepted). + (e.g., leading "." is not accepted). - In practice, teams usually precompile into the binary - all types that they + In practice, teams usually precompile into the binary all + types that they - expect it to use in the context of Any. However, for - URLs which use the + expect it to use in the context of Any. However, for URLs + which use the - scheme `http`, `https`, or no scheme, one can optionally - set up a type + scheme `http`, `https`, or no scheme, one can optionally + set up a type - server that maps type URLs to message definitions as - follows: + server that maps type URLs to message definitions as + follows: - * If no scheme is provided, `https` is assumed. + * If no scheme is provided, `https` is assumed. - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - Note: this functionality is not currently available in - the official + Note: this functionality is not currently available in the + official - protobuf release, and it is not used for type URLs - beginning with + protobuf release, and it is not used for type URLs + beginning with - type.googleapis.com. + type.googleapis.com. - Schemes other than `http`, `https` (or the empty scheme) - might be + Schemes other than `http`, `https` (or the empty scheme) + might be - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message + along with a - URL that describes the type of the serialized message. + URL that describes the type of the serialized message. - Protobuf library provides support to pack/unpack Any values - in the form + Protobuf library provides support to pack/unpack Any values in + the form - of utility functions or additional generated methods of the - Any type. + of utility functions or additional generated methods of the + Any type. - Example 1: Pack and unpack a message in C++. + Example 1: Pack and unpack a message in C++. - Foo foo = ...; - Any any; - any.PackFrom(foo); + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { ... - if (any.UnpackTo(&foo)) { - ... - } + } - Example 2: Pack and unpack a message in Java. + Example 2: Pack and unpack a message in Java. - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. - foo = Foo(...) - any = Any() - any.Pack(foo) + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } - The pack methods provided by protobuf library will by - default use + The pack methods provided by protobuf library will by default + use - 'type.googleapis.com/full.type.name' as the type URL and the - unpack + 'type.googleapis.com/full.type.name' as the type URL and the + unpack - methods only use the fully qualified type name after the - last '/' + methods only use the fully qualified type name after the last + '/' - in the type URL, for example "foo.bar.com/x/y.z" will yield - type + in the type URL, for example "foo.bar.com/x/y.z" will yield + type - name "y.z". + name "y.z". + JSON - JSON - ==== + The JSON representation of an `Any` value uses the regular - The JSON representation of an `Any` value uses the regular + representation of the deserialized, embedded message, with an - representation of the deserialized, embedded message, with - an + additional field `@type` which contains the type URL. Example: - additional field `@type` which contains the type URL. - Example: + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + If the embedded message type is well-known and has a custom + JSON - If the embedded message type is well-known and has a custom - JSON + representation, that representation will be embedded adding a + field - representation, that representation will be embedded adding - a field + `value` which holds the custom JSON in addition to the `@type` - `value` which holds the custom JSON in addition to the - `@type` + field. Example (for message [google.protobuf.Duration][]): - field. Example (for message [google.protobuf.Duration][]): + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + signer: + type: string + title: signer address + description: >- + MsgUpdateClient defines an sdk.Msg to update a IBC client state + using - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: proposal_id - description: proposal_id is the unique id of a proposal. - in: path - required: true - type: string - format: uint64 + the given client message. tags: - - Query - /cosmos/group/v1/proposals_by_group_policy/{address}: - get: - summary: >- - ProposalsByGroupPolicy queries proposals based on account address of - group policy. - operationId: CosmosGroupV1ProposalsByGroupPolicy + - Msg + /ibc.core.client.v1.Msg/UpdateClientParams: + post: + summary: UpdateClientParams defines a rpc handler method for MsgUpdateParams. + operationId: IbcCoreClientV1Msg_UpdateClientParams responses: '200': description: A successful response. schema: type: object - properties: - proposals: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique id of the proposal. - group_policy_address: - type: string - description: >- - group_policy_address is the account address of group - policy. - metadata: - type: string - title: >- - metadata is any arbitrary metadata attached to the - proposal. - - the recommended format of the metadata is to be found - here: - - https://docs.cosmos.network/v0.47/modules/group#proposal-4 - proposers: - type: array - items: - type: string - description: proposers are the account addresses of the proposers. - submit_time: - type: string - format: date-time - description: >- - submit_time is a timestamp specifying when a proposal - was submitted. - group_version: - type: string - format: uint64 - description: >- - group_version tracks the version of the group at - proposal submission. - - This field is here for informational purposes only. - group_policy_version: - type: string - format: uint64 - description: >- - group_policy_version tracks the version of the group - policy at proposal submission. - - When a decision policy is changed, existing proposals - from previous policy - - versions will become invalid with the `ABORTED` status. - - This field is here for informational purposes only. - status: - description: >- - status represents the high level position in the life - cycle of the proposal. Initial value is Submitted. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_SUBMITTED - - PROPOSAL_STATUS_ACCEPTED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_ABORTED - - PROPOSAL_STATUS_WITHDRAWN - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result contains the sums of all weighted - votes for this - - proposal for each vote option. It is empty at - submission, and only - - populated after tallying, at voting period end or at - proposal execution, - - whichever happens first. - type: object - properties: - yes_count: - type: string - description: yes_count is the weighted sum of yes votes. - abstain_count: - type: string - description: abstain_count is the weighted sum of abstainers. - no_count: - type: string - description: no_count is the weighted sum of no votes. - no_with_veto_count: - type: string - description: no_with_veto_count is the weighted sum of veto. - voting_period_end: - type: string - format: date-time - description: >- - voting_period_end is the timestamp before which voting - must be done. - - Unless a successful MsgExec is called before (to execute - a proposal whose - - tally is successful before the voting period ends), - tallying will be done - - at this point, and the `final_tally_result`and `status` - fields will be - - accordingly updated. - executor_result: - description: >- - executor_result is the final result of the proposal - execution. Initial value is NotRun. - type: string - enum: - - PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - - PROPOSAL_EXECUTOR_RESULT_NOT_RUN - - PROPOSAL_EXECUTOR_RESULT_SUCCESS - - PROPOSAL_EXECUTOR_RESULT_FAILURE - default: PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain - at least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should - be in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, - for URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions - as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently - available in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods - of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL - and the unpack - - methods only use the fully qualified type name after - the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message - [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages is a list of `sdk.Msg`s that will be executed - if the proposal passes. - title: - type: string - description: 'Since: cosmos-sdk 0.47' - title: title is the title of the proposal - summary: - type: string - description: 'Since: cosmos-sdk 0.47' - title: summary is a short summary of the proposal - description: >- - Proposal defines a group proposal. Any member of a group can - submit a proposal - - for a group policy to decide upon. - - A proposal consists of a set of `sdk.Msg`s that will be - executed if the proposal - - passes as well as some optional metadata associated with the - proposal. - description: proposals are the proposals with given group policy. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryProposalsByGroupPolicyResponse is the - Query/ProposalByGroupPolicy response type. + description: MsgUpdateParamsResponse defines the MsgUpdateParams response type. default: description: An unexpected error response. schema: @@ -22011,8 +16388,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -22022,7 +16403,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -22050,10 +16431,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -22091,112 +16470,55 @@ paths: "value": "1.212s" } parameters: - - name: address + - name: body description: >- - address is the account address of the group policy related to - proposals. - in: path + MsgUpdateParams defines the sdk.Msg type to update the client + parameters. + in: body required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key + schema: + type: object + properties: + signer: + type: string + title: signer address + params: + description: |- + params defines the client parameters to update. - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. + NOTE: All parameters must be supplied. + type: object + properties: + allowed_clients: + type: array + items: + type: string + description: >- + allowed_clients defines the list of allowed client state + types which can be created + and interacted with. If a client type is removed from the + allowed clients list, usage - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean + of this client will be disabled until it is added again to + the list. + description: >- + MsgUpdateParams defines the sdk.Msg type to update the client + parameters. tags: - - Query - /cosmos/group/v1/vote_by_proposal_voter/{proposal_id}/{voter}: - get: - summary: VoteByProposalVoter queries a vote by proposal id and voter. - operationId: CosmosGroupV1VoteByProposalVoter + - Msg + /ibc.core.client.v1.Msg/UpgradeClient: + post: + summary: UpgradeClient defines a rpc handler method for MsgUpgradeClient. + operationId: IbcCoreClientV1Msg_UpgradeClient responses: '200': description: A successful response. schema: type: object - properties: - vote: - description: vote is the vote with given proposal_id and voter. - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal is the unique ID of the proposal. - voter: - type: string - description: voter is the account address of the voter. - option: - description: option is the voter's choice on the proposal. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - metadata: - type: string - description: metadata is any arbitrary metadata attached to the vote. - submit_time: - type: string - format: date-time - description: submit_time is the timestamp when the vote was submitted. description: >- - QueryVoteByProposalVoterResponse is the Query/VoteByProposalVoter - response type. + MsgUpgradeClientResponse defines the Msg/UpgradeClient response + type. default: description: An unexpected error response. schema: @@ -22303,8 +16625,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -22314,7 +16640,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -22342,10 +16668,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -22383,397 +16707,393 @@ paths: "value": "1.212s" } parameters: - - name: proposal_id - description: proposal_id is the unique ID of a proposal. - in: path - required: true - type: string - format: uint64 - - name: voter - description: voter is a proposal voter account address. - in: path + - name: body + in: body required: true - type: string - tags: - - Query - /cosmos/group/v1/votes_by_proposal/{proposal_id}: - get: - summary: VotesByProposal queries a vote by proposal id. - operationId: CosmosGroupV1VotesByProposal - responses: - '200': - description: A successful response. schema: type: object properties: - votes: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal is the unique ID of the proposal. - voter: - type: string - description: voter is the account address of the voter. - option: - description: option is the voter's choice on the proposal. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - metadata: - type: string - description: metadata is any arbitrary metadata attached to the vote. - submit_time: - type: string - format: date-time - description: >- - submit_time is the timestamp when the vote was - submitted. - description: Vote represents a vote for a proposal. - description: votes are the list of votes for given proposal_id. - pagination: - description: pagination defines the pagination in the response. + client_id: + type: string + title: client unique identifier + client_state: + title: upgraded client state type: object properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: + '@type': type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + description: >- + A URL/resource name that uniquely identifies the type of + the serialized - was set, its value is undefined otherwise - description: >- - QueryVotesByProposalResponse is the Query/VotesByProposal response - type. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized + protocol buffer message. This string must contain at least - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent + one "/" character. The last segment of the URL's path must + represent - the fully qualified name of the type (as in + the fully qualified name of the type (as in - `path/google.protobuf.Duration`). The name should be in - a canonical form + `path/google.protobuf.Duration`). The name should be in a + canonical form - (e.g., leading "." is not accepted). + (e.g., leading "." is not accepted). - In practice, teams usually precompile into the binary - all types that they + In practice, teams usually precompile into the binary all + types that they - expect it to use in the context of Any. However, for - URLs which use the + expect it to use in the context of Any. However, for URLs + which use the - scheme `http`, `https`, or no scheme, one can optionally - set up a type + scheme `http`, `https`, or no scheme, one can optionally + set up a type - server that maps type URLs to message definitions as - follows: + server that maps type URLs to message definitions as + follows: - * If no scheme is provided, `https` is assumed. + * If no scheme is provided, `https` is assumed. - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - Note: this functionality is not currently available in - the official + Note: this functionality is not currently available in the + official - protobuf release, and it is not used for type URLs - beginning with + protobuf release, and it is not used for type URLs + beginning with - type.googleapis.com. + type.googleapis.com. - Schemes other than `http`, `https` (or the empty scheme) - might be + Schemes other than `http`, `https` (or the empty scheme) + might be - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message + along with a - URL that describes the type of the serialized message. + URL that describes the type of the serialized message. - Protobuf library provides support to pack/unpack Any values - in the form + Protobuf library provides support to pack/unpack Any values in + the form - of utility functions or additional generated methods of the - Any type. + of utility functions or additional generated methods of the + Any type. - Example 1: Pack and unpack a message in C++. + Example 1: Pack and unpack a message in C++. - Foo foo = ...; - Any any; - any.PackFrom(foo); + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { ... - if (any.UnpackTo(&foo)) { - ... - } + } - Example 2: Pack and unpack a message in Java. + Example 2: Pack and unpack a message in Java. - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. - foo = Foo(...) - any = Any() - any.Pack(foo) + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } - The pack methods provided by protobuf library will by - default use + The pack methods provided by protobuf library will by default + use - 'type.googleapis.com/full.type.name' as the type URL and the - unpack + 'type.googleapis.com/full.type.name' as the type URL and the + unpack - methods only use the fully qualified type name after the - last '/' + methods only use the fully qualified type name after the last + '/' - in the type URL, for example "foo.bar.com/x/y.z" will yield - type + in the type URL, for example "foo.bar.com/x/y.z" will yield + type - name "y.z". + name "y.z". + JSON - JSON - ==== + The JSON representation of an `Any` value uses the regular - The JSON representation of an `Any` value uses the regular + representation of the deserialized, embedded message, with an - representation of the deserialized, embedded message, with - an + additional field `@type` which contains the type URL. Example: - additional field `@type` which contains the type URL. - Example: + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + If the embedded message type is well-known and has a custom + JSON - If the embedded message type is well-known and has a custom - JSON + representation, that representation will be embedded adding a + field - representation, that representation will be embedded adding - a field + `value` which holds the custom JSON in addition to the `@type` - `value` which holds the custom JSON in addition to the - `@type` + field. Example (for message [google.protobuf.Duration][]): - field. Example (for message [google.protobuf.Duration][]): + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + consensus_state: + title: >- + upgraded consensus state, only contains enough information to + serve as a - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: proposal_id - description: proposal_id is the unique ID of a proposal. - in: path - required: true - type: string - format: uint64 - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. + basis of trust in update logic + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized - It is less efficient than using key. Only one of offset or key - should + protocol buffer message. This string must contain at least - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. + one "/" character. The last segment of the URL's path must + represent - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form - a count of the total number of items available for pagination in - UIs. + (e.g., leading "." is not accepted). - count_total is only respected when offset is used. It is ignored - when key - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. + In practice, teams usually precompile into the binary all + types that they + expect it to use in the context of Any. However, for URLs + which use the - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message + along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in + the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default + use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the last + '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding a + field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + proof_upgrade_client: + type: string + format: byte + title: proof that old chain committed to new client + proof_upgrade_consensus_state: + type: string + format: byte + title: proof that old chain committed to new consensus state + signer: + type: string + title: signer address + title: >- + MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a + new client + + state tags: - - Query - /cosmos/group/v1/votes_by_voter/{voter}: - get: - summary: VotesByVoter queries a vote by voter. - operationId: CosmosGroupV1VotesByVoter + - Msg + /ibc.core.connection.v1.Msg/ConnectionOpenAck: + post: + summary: ConnectionOpenAck defines a rpc handler method for MsgConnectionOpenAck. + operationId: IbcCoreConnectionV1Msg_ConnectionOpenAck responses: '200': description: A successful response. schema: type: object - properties: - votes: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal is the unique ID of the proposal. - voter: - type: string - description: voter is the account address of the voter. - option: - description: option is the voter's choice on the proposal. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - metadata: - type: string - description: metadata is any arbitrary metadata attached to the vote. - submit_time: - type: string - format: date-time - description: >- - submit_time is the timestamp when the vote was - submitted. - description: Vote represents a vote for a proposal. - description: votes are the list of votes by given voter. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: QueryVotesByVoterResponse is the Query/VotesByVoter response type. + description: >- + MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck + response type. default: description: An unexpected error response. schema: @@ -22880,8 +17200,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -22891,7 +17215,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -22919,10 +17243,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -22960,224 +17282,321 @@ paths: "value": "1.212s" } parameters: - - name: voter - description: voter is a proposal voter account address. - in: path - required: true - type: string - - name: pagination.key + - name: body description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. + MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to + acknowledge the change of connection state to TRYOPEN on Chain B. + in: body + required: true + schema: + type: object + properties: + connection_id: + type: string + counterparty_connection_id: + type: string + version: + type: object + properties: + identifier: + type: string + title: unique version identifier + features: + type: array + items: + type: string + title: list of features compatible with the specified identifier + description: >- + Version defines the versioning scheme used to negotiate the + IBC verison in - It is less efficient than using key. Only one of offset or key - should + the connection handshake. + client_state: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. + protocol buffer message. This string must contain at least - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include + one "/" character. The last segment of the URL's path must + represent - a count of the total number of items available for pagination in - UIs. + the fully qualified name of the type (as in - count_total is only respected when offset is used. It is ignored - when key + `path/google.protobuf.Duration`). The name should be in a + canonical form - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. + (e.g., leading "." is not accepted). - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/mint/v1beta1/annual_provisions: - get: - summary: AnnualProvisions current minting annual provisions value. - operationId: CosmosMintV1Beta1AnnualProvisions - responses: - '200': - description: A successful response. - schema: - type: object - properties: - annual_provisions: - type: string - format: byte - description: >- - annual_provisions is the current minting annual provisions - value. - description: |- - QueryAnnualProvisionsResponse is the response type for the - Query/AnnualProvisions RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /cosmos/mint/v1beta1/inflation: - get: - summary: Inflation returns the current minting inflation value. - operationId: CosmosMintV1Beta1Inflation - responses: - '200': - description: A successful response. - schema: - type: object - properties: - inflation: + In practice, teams usually precompile into the binary all + types that they + + expect it to use in the context of Any. However, for URLs + which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message + along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in + the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default + use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the last + '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding a + field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping + + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes + of updating and + + freezing clients + proof_try: type: string format: byte - description: inflation is the current minting inflation value. - description: >- - QueryInflationResponse is the response type for the - Query/Inflation RPC + title: >- + proof of the initialization the connection on Chain B: + `UNITIALIZED -> - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: + TRYOPEN` + proof_client: type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /cosmos/mint/v1beta1/params: - get: - summary: Params returns the total set of minting parameters. - operationId: CosmosMintV1Beta1Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params defines the parameters of the module. + format: byte + title: proof of client state included in message + proof_consensus: + type: string + format: byte + title: proof of client consensus state + consensus_height: type: object properties: - mint_denom: - type: string - title: type of coin to mint - inflation_rate_change: - type: string - title: maximum annual change in inflation rate - inflation_max: - type: string - title: maximum inflation rate - inflation_min: - type: string - title: minimum inflation rate - goal_bonded: + revision_number: type: string - title: goal of percent bonded atoms - blocks_per_year: + format: uint64 + title: the revision that the client is currently on + revision_height: type: string format: uint64 - title: expected blocks per year - description: >- - QueryParamsResponse is the response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping + + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes + of updating and + + freezing clients + signer: type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} + host_consensus_state_proof: + type: string + format: byte + title: >- + optional proof data for host state machines that are unable to + introspect their own consensus state + description: |- + MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to + acknowledge the change of connection state to TRYOPEN on Chain B. tags: - - Query - /cosmos/nft/v1beta1/balance/{owner}/{class_id}: - get: - summary: >- - Balance queries the number of NFTs of a given class owned by the owner, - same as balanceOf in ERC721 - operationId: CosmosNftV1Beta1Balance + - Msg + /ibc.core.connection.v1.Msg/ConnectionOpenConfirm: + post: + summary: |- + ConnectionOpenConfirm defines a rpc handler method for + MsgConnectionOpenConfirm. + operationId: IbcCoreConnectionV1Msg_ConnectionOpenConfirm responses: '200': description: A successful response. schema: type: object - properties: - amount: - type: string - format: uint64 - title: >- - amount is the number of all NFTs of a given class owned by the - owner - title: >- - QueryBalanceResponse is the response type for the Query/Balance - RPC method + description: >- + MsgConnectionOpenConfirmResponse defines the + Msg/ConnectionOpenConfirm + + response type. default: description: An unexpected error response. schema: @@ -23284,8 +17703,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -23295,7 +17718,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -23323,10 +17746,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -23364,267 +17785,85 @@ paths: "value": "1.212s" } parameters: - - name: owner - description: owner is the owner address of the nft - in: path - required: true - type: string - - name: class_id - description: class_id associated with the nft - in: path + - name: body + description: >- + MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B + to + + acknowledge the change of connection state to OPEN on Chain A. + in: body required: true - type: string - tags: - - Query - /cosmos/nft/v1beta1/classes: - get: - summary: Classes queries all NFT classes - operationId: CosmosNftV1Beta1Classes - responses: - '200': - description: A successful response. schema: type: object properties: - classes: - type: array - items: - type: object - properties: - id: - type: string - title: >- - id defines the unique identifier of the NFT - classification, similar to the contract address of - ERC721 - name: - type: string - title: >- - name defines the human-readable name of the NFT - classification. Optional - symbol: - type: string - title: >- - symbol is an abbreviated name for nft classification. - Optional - description: - type: string - title: >- - description is a brief description of nft - classification. Optional - uri: - type: string - title: >- - uri for the class metadata stored off chain. It can - define schema for Class and NFT `Data` attributes. - Optional - uri_hash: - type: string - title: >- - uri_hash is a hash of the document pointed by uri. - Optional - data: - title: >- - data is the app specific metadata of the NFT class. - Optional - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an + connection_id: + type: string + proof_ack: + type: string + format: byte + title: >- + proof for the change of the connection state on Chain A: `INIT + -> OPEN` + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping - additional field `@type` which contains the type URL. - Example: + RevisionNumber the same. However some consensus algorithms may + choose to - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } + reset the height in certain conditions e.g. hard forks, + state-machine - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + breaking changes In these cases, the RevisionNumber is + incremented so that - If the embedded message type is well-known and has a - custom JSON + height continues to be monitonically increasing even as the + RevisionHeight - representation, that representation will be embedded - adding a field + gets reset + title: >- + Height is a monotonically increasing data type - `value` which holds the custom JSON in addition to the - `@type` + that can be compared against another Height for the purposes + of updating and - field. Example (for message - [google.protobuf.Duration][]): + freezing clients + signer: + type: string + description: >- + MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain + B to - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: Class defines the class of the nft type. - description: class defines the class of the nft type. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + acknowledge the change of connection state to OPEN on Chain A. + tags: + - Msg + /ibc.core.connection.v1.Msg/ConnectionOpenInit: + post: + summary: >- + ConnectionOpenInit defines a rpc handler method for + MsgConnectionOpenInit. + operationId: IbcCoreConnectionV1Msg_ConnectionOpenInit + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit + response - was set, its value is undefined otherwise - title: >- - QueryClassesResponse is the response type for the Query/Classes - RPC method + type. default: description: An unexpected error response. schema: @@ -23731,8 +17970,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -23742,7 +17985,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -23770,10 +18013,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -23811,287 +18052,93 @@ paths: "value": "1.212s" } parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse + - name: body description: >- - reverse is set to true if results are to be returned in the - descending order. - + MsgConnectionOpenInit defines the msg sent by an account on Chain A + to - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/nft/v1beta1/classes/{class_id}: - get: - summary: Class queries an NFT class based on its id - operationId: CosmosNftV1Beta1Class - responses: - '200': - description: A successful response. + initialize a connection with Chain B. + in: body + required: true schema: type: object properties: - class: - description: class defines the class of the nft type. + client_id: + type: string + counterparty: type: object properties: - id: - type: string - title: >- - id defines the unique identifier of the NFT - classification, similar to the contract address of ERC721 - name: - type: string - title: >- - name defines the human-readable name of the NFT - classification. Optional - symbol: - type: string - title: >- - symbol is an abbreviated name for nft classification. - Optional - description: - type: string - title: >- - description is a brief description of nft classification. - Optional - uri: + client_id: type: string - title: >- - uri for the class metadata stored off chain. It can define - schema for Class and NFT `Data` attributes. Optional - uri_hash: + description: >- + identifies the client on the counterparty chain associated + with a given + + connection. + connection_id: type: string - title: >- - uri_hash is a hash of the document pointed by uri. - Optional - data: - title: >- - data is the app specific metadata of the NFT class. - Optional + description: >- + identifies the connection end on the counterparty chain + associated with a + + given connection. + prefix: + description: commitment merkle prefix of the counterparty chain. type: object properties: - '@type': + key_prefix: type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized + format: byte + title: >- + MerklePrefix is merkle path prefixed to the key. - protocol buffer message. This string must contain at - least + The constructed key from the Path and the key will be + append(Path.KeyPath, - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` + append(Path.KeyPrefix, key...)) + description: >- + Counterparty defines the counterparty chain associated with a + connection end. + version: + type: object + properties: + identifier: + type: string + title: unique version identifier + features: + type: array + items: + type: string + title: list of features compatible with the specified identifier + description: >- + Version defines the versioning scheme used to negotiate the + IBC verison in - field. Example (for message [google.protobuf.Duration][]): + the connection handshake. + delay_period: + type: string + format: uint64 + signer: + type: string + description: >- + MsgConnectionOpenInit defines the msg sent by an account on Chain + A to - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - title: >- - QueryClassResponse is the response type for the Query/Class RPC - method + initialize a connection with Chain B. + tags: + - Msg + /ibc.core.connection.v1.Msg/ConnectionOpenTry: + post: + summary: ConnectionOpenTry defines a rpc handler method for MsgConnectionOpenTry. + operationId: IbcCoreConnectionV1Msg_ConnectionOpenTry + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry + response type. default: description: An unexpected error response. schema: @@ -24198,8 +18245,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -24209,7 +18260,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -24237,10 +18288,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -24278,246 +18327,365 @@ paths: "value": "1.212s" } parameters: - - name: class_id - description: class_id associated with the nft - in: path - required: true - type: string - tags: - - Query - /cosmos/nft/v1beta1/nfts: - get: - summary: >- - NFTs queries all NFTs of a given class or owner,choose at least one of - the two, similar to tokenByIndex in + - name: body + description: >- + MsgConnectionOpenTry defines a msg sent by a Relayer to try to open + a - ERC721Enumerable - operationId: CosmosNftV1Beta1NFTs - responses: - '200': - description: A successful response. + connection on Chain B. + in: body + required: true schema: type: object properties: - nfts: - type: array - items: - type: object - properties: - class_id: - type: string - title: >- - class_id associated with the NFT, similar to the - contract address of ERC721 - id: - type: string - title: id is a unique identifier of the NFT - uri: - type: string - title: uri for the NFT metadata stored off chain - uri_hash: - type: string - title: uri_hash is a hash of the document pointed by uri - data: - title: data is an app specific data of the NFT. Optional - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized + client_id: + type: string + previous_connection_id: + type: string + description: >- + Deprecated: this field is unused. Crossing hellos are no + longer supported in core IBC. + client_state: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized - protocol buffer message. This string must contain at - least + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all + types that they + + expect it to use in the context of Any. However, for URLs + which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - one "/" character. The last segment of the URL's - path must represent + Note: this functionality is not currently available in the + official - the fully qualified name of the type (as in + protobuf release, and it is not used for type URLs + beginning with - `path/google.protobuf.Duration`). The name should be - in a canonical form + type.googleapis.com. - (e.g., leading "." is not accepted). + Schemes other than `http`, `https` (or the empty scheme) + might be - In practice, teams usually precompile into the - binary all types that they + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message + along with a - expect it to use in the context of Any. However, for - URLs which use the + URL that describes the type of the serialized message. - scheme `http`, `https`, or no scheme, one can - optionally set up a type - server that maps type URLs to message definitions as - follows: + Protobuf library provides support to pack/unpack Any values in + the form + of utility functions or additional generated methods of the + Any type. - * If no scheme is provided, `https` is assumed. - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + Example 1: Pack and unpack a message in C++. - Note: this functionality is not currently available - in the official + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } - protobuf release, and it is not used for type URLs - beginning with + Example 2: Pack and unpack a message in Java. - type.googleapis.com. + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + Example 3: Pack and unpack a message in Python. - Schemes other than `http`, `https` (or the empty - scheme) might be + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a + Example 4: Pack and unpack a message in Go - URL that describes the type of the serialized message. + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + The pack methods provided by protobuf library will by default + use - Protobuf library provides support to pack/unpack Any - values in the form + 'type.googleapis.com/full.type.name' as the type URL and the + unpack - of utility functions or additional generated methods of - the Any type. + methods only use the fully qualified type name after the last + '/' + in the type URL, for example "foo.bar.com/x/y.z" will yield + type - Example 1: Pack and unpack a message in C++. + name "y.z". - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - Example 2: Pack and unpack a message in Java. + JSON - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - Example 3: Pack and unpack a message in Python. + The JSON representation of an `Any` value uses the regular - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... + representation of the deserialized, embedded message, with an - Example 4: Pack and unpack a message in Go + additional field `@type` which contains the type URL. Example: - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } - The pack methods provided by protobuf library will by - default use + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } - 'type.googleapis.com/full.type.name' as the type URL and - the unpack + If the embedded message type is well-known and has a custom + JSON - methods only use the fully qualified type name after the - last '/' + representation, that representation will be embedded adding a + field - in the type URL, for example "foo.bar.com/x/y.z" will - yield type + `value` which holds the custom JSON in addition to the `@type` - name "y.z". + field. Example (for message [google.protobuf.Duration][]): + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + counterparty: + type: object + properties: + client_id: + type: string + description: >- + identifies the client on the counterparty chain associated + with a given + connection. + connection_id: + type: string + description: >- + identifies the connection end on the counterparty chain + associated with a - JSON + given connection. + prefix: + description: commitment merkle prefix of the counterparty chain. + type: object + properties: + key_prefix: + type: string + format: byte + title: >- + MerklePrefix is merkle path prefixed to the key. - ==== + The constructed key from the Path and the key will be + append(Path.KeyPath, - The JSON representation of an `Any` value uses the - regular + append(Path.KeyPrefix, key...)) + description: >- + Counterparty defines the counterparty chain associated with a + connection end. + delay_period: + type: string + format: uint64 + counterparty_versions: + type: array + items: + type: object + properties: + identifier: + type: string + title: unique version identifier + features: + type: array + items: + type: string + title: >- + list of features compatible with the specified + identifier + description: >- + Version defines the versioning scheme used to negotiate the + IBC verison in - representation of the deserialized, embedded message, - with an + the connection handshake. + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping - additional field `@type` which contains the type URL. - Example: + RevisionNumber the same. However some consensus algorithms may + choose to - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } + reset the height in certain conditions e.g. hard forks, + state-machine - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + breaking changes In these cases, the RevisionNumber is + incremented so that - If the embedded message type is well-known and has a - custom JSON + height continues to be monitonically increasing even as the + RevisionHeight - representation, that representation will be embedded - adding a field + gets reset + title: >- + Height is a monotonically increasing data type - `value` which holds the custom JSON in addition to the - `@type` + that can be compared against another Height for the purposes + of updating and - field. Example (for message - [google.protobuf.Duration][]): + freezing clients + proof_init: + type: string + format: byte + title: >- + proof of the initialization the connection on Chain A: + `UNITIALIZED -> - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: NFT defines the NFT. - title: NFT defines the NFT - pagination: - description: pagination defines the pagination in the response. + INIT` + proof_client: + type: string + format: byte + title: proof of client state included in message + proof_consensus: + type: string + format: byte + title: proof of client consensus state + consensus_height: type: object properties: - next_key: + revision_number: type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: + format: uint64 + title: the revision that the client is currently on + revision_height: type: string format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping - was set, its value is undefined otherwise - title: >- - QueryNFTsResponse is the response type for the Query/NFTs RPC - methods + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes + of updating and + + freezing clients + signer: + type: string + host_consensus_state_proof: + type: string + format: byte + title: >- + optional proof data for host state machines that are unable to + introspect their own consensus state + description: >- + MsgConnectionOpenTry defines a msg sent by a Relayer to try to + open a + + connection on Chain B. + tags: + - Msg + /ibc.core.connection.v1.Msg/UpdateConnectionParams: + post: + summary: |- + UpdateConnectionParams defines a rpc handler method for + MsgUpdateParams. + operationId: IbcCoreConnectionV1Msg_UpdateConnectionParams + responses: + '200': + description: A successful response. + schema: + type: object + description: MsgUpdateParamsResponse defines the MsgUpdateParams response type. default: description: An unexpected error response. schema: @@ -24624,8 +18792,12 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -24635,7 +18807,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -24663,10 +18835,8 @@ paths: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -24704,47147 +18874,2293 @@ paths: "value": "1.212s" } parameters: - - name: class_id - description: class_id associated with the nft - in: query - required: false - type: string - - name: owner - description: owner is the owner address of the nft - in: query - required: false - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse + - name: body description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/nft/v1beta1/nfts/{class_id}/{id}: - get: - summary: NFT queries an NFT based on its class and id. - operationId: CosmosNftV1Beta1NFT - responses: - '200': - description: A successful response. + MsgUpdateParams defines the sdk.Msg type to update the connection + parameters. + in: body + required: true schema: type: object properties: - nft: - title: owner is the owner address of the nft + signer: + type: string + title: signer address + params: + description: |- + params defines the connection parameters to update. + + NOTE: All parameters must be supplied. type: object properties: - class_id: - type: string - title: >- - class_id associated with the NFT, similar to the contract - address of ERC721 - id: - type: string - title: id is a unique identifier of the NFT - uri: - type: string - title: uri for the NFT metadata stored off chain - uri_hash: + max_expected_time_per_block: type: string - title: uri_hash is a hash of the document pointed by uri - data: - title: data is an app specific data of the NFT. Optional - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized + format: uint64 + description: >- + maximum expected time per block (in nanoseconds), used to + enforce block delay. This parameter should reflect the - protocol buffer message. This string must contain at - least + largest amount of time that the chain might reasonably + take to produce the next block under normal operating - one "/" character. The last segment of the URL's path - must represent + conditions. A safe choice is 3-5x the expected time per + block. + description: >- + MsgUpdateParams defines the sdk.Msg type to update the connection + parameters. + tags: + - Msg +definitions: + cosmos.auth.v1beta1.MsgUpdateParams: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + params: + description: |- + params defines the x/auth parameters to update. - the fully qualified name of the type (as in + NOTE: All parameters must be supplied. + type: object + properties: + max_memo_characters: + type: string + format: uint64 + tx_sig_limit: + type: string + format: uint64 + tx_size_cost_per_byte: + type: string + format: uint64 + sig_verify_cost_ed25519: + type: string + format: uint64 + sig_verify_cost_secp256k1: + type: string + format: uint64 + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. - `path/google.protobuf.Duration`). The name should be - in a canonical form + Since: cosmos-sdk 0.47 + cosmos.auth.v1beta1.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. - (e.g., leading "." is not accepted). + Since: cosmos-sdk 0.47 + cosmos.auth.v1beta1.Params: + type: object + properties: + max_memo_characters: + type: string + format: uint64 + tx_sig_limit: + type: string + format: uint64 + tx_size_cost_per_byte: + type: string + format: uint64 + sig_verify_cost_ed25519: + type: string + format: uint64 + sig_verify_cost_secp256k1: + type: string + format: uint64 + description: Params defines the parameters for the auth module. + google.protobuf.Any: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + protocol buffer message. This string must contain at least - In practice, teams usually precompile into the binary - all types that they + one "/" character. The last segment of the URL's path must represent - expect it to use in the context of Any. However, for - URLs which use the + the fully qualified name of the type (as in - scheme `http`, `https`, or no scheme, one can - optionally set up a type + `path/google.protobuf.Duration`). The name should be in a canonical + form - server that maps type URLs to message definitions as - follows: + (e.g., leading "." is not accepted). - * If no scheme is provided, `https` is assumed. + In practice, teams usually precompile into the binary all types that + they - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + expect it to use in the context of Any. However, for URLs which use + the - Note: this functionality is not currently available in - the official + scheme `http`, `https`, or no scheme, one can optionally set up a type - protobuf release, and it is not used for type URLs - beginning with + server that maps type URLs to message definitions as follows: - type.googleapis.com. + * If no scheme is provided, `https` is assumed. - Schemes other than `http`, `https` (or the empty - scheme) might be + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a + Note: this functionality is not currently available in the official - URL that describes the type of the serialized message. + protobuf release, and it is not used for type URLs beginning with + type.googleapis.com. - Protobuf library provides support to pack/unpack Any - values in the form - of utility functions or additional generated methods of - the Any type. + Schemes other than `http`, `https` (or the empty scheme) might be + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message along with + a - Example 1: Pack and unpack a message in C++. + URL that describes the type of the serialized message. - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - Example 2: Pack and unpack a message in Java. + Protobuf library provides support to pack/unpack Any values in the form - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } + of utility functions or additional generated methods of the Any type. - Example 3: Pack and unpack a message in Python. - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... + Example 1: Pack and unpack a message in C++. - Example 4: Pack and unpack a message in Go + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } + Example 2: Pack and unpack a message in Java. - The pack methods provided by protobuf library will by - default use + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - 'type.googleapis.com/full.type.name' as the type URL and - the unpack + Example 3: Pack and unpack a message in Python. - methods only use the fully qualified type name after the - last '/' + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... - in the type URL, for example "foo.bar.com/x/y.z" will - yield type + Example 4: Pack and unpack a message in Go - name "y.z". + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + The pack methods provided by protobuf library will by default use + 'type.googleapis.com/full.type.name' as the type URL and the unpack - JSON + methods only use the fully qualified type name after the last '/' - ==== + in the type URL, for example "foo.bar.com/x/y.z" will yield type - The JSON representation of an `Any` value uses the regular + name "y.z". - representation of the deserialized, embedded message, with - an - additional field `@type` which contains the type URL. - Example: + JSON - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + The JSON representation of an `Any` value uses the regular - If the embedded message type is well-known and has a - custom JSON + representation of the deserialized, embedded message, with an - representation, that representation will be embedded - adding a field + additional field `@type` which contains the type URL. Example: - `value` which holds the custom JSON in addition to the - `@type` + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } - field. Example (for message [google.protobuf.Duration][]): + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: NFT defines the NFT. - title: QueryNFTResponse is the response type for the Query/NFT RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized + If the embedded message type is well-known and has a custom JSON - protocol buffer message. This string must contain at - least + representation, that representation will be embedded adding a field - one "/" character. The last segment of the URL's path - must represent + `value` which holds the custom JSON in addition to the `@type` - the fully qualified name of the type (as in + field. Example (for message [google.protobuf.Duration][]): - `path/google.protobuf.Duration`). The name should be in - a canonical form + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + google.rpc.Status: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized - (e.g., leading "." is not accepted). + protocol buffer message. This string must contain at least + one "/" character. The last segment of the URL's path must + represent - In practice, teams usually precompile into the binary - all types that they + the fully qualified name of the type (as in - expect it to use in the context of Any. However, for - URLs which use the + `path/google.protobuf.Duration`). The name should be in a + canonical form - scheme `http`, `https`, or no scheme, one can optionally - set up a type + (e.g., leading "." is not accepted). - server that maps type URLs to message definitions as - follows: + In practice, teams usually precompile into the binary all types + that they - * If no scheme is provided, `https` is assumed. + expect it to use in the context of Any. However, for URLs which + use the - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + scheme `http`, `https`, or no scheme, one can optionally set up + a type - Note: this functionality is not currently available in - the official + server that maps type URLs to message definitions as follows: - protobuf release, and it is not used for type URLs - beginning with - type.googleapis.com. + * If no scheme is provided, `https` is assumed. + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - Schemes other than `http`, `https` (or the empty scheme) - might be + Note: this functionality is not currently available in the + official - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a + protobuf release, and it is not used for type URLs beginning + with - URL that describes the type of the serialized message. + type.googleapis.com. - Protobuf library provides support to pack/unpack Any values - in the form + Schemes other than `http`, `https` (or the empty scheme) might + be - of utility functions or additional generated methods of the - Any type. + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message along + with a + URL that describes the type of the serialized message. - Example 1: Pack and unpack a message in C++. - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } + Protobuf library provides support to pack/unpack Any values in the + form - Example 2: Pack and unpack a message in Java. + of utility functions or additional generated methods of the Any + type. - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - Example 3: Pack and unpack a message in Python. + Example 1: Pack and unpack a message in C++. - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } - Example 4: Pack and unpack a message in Go + Example 2: Pack and unpack a message in Java. - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - The pack methods provided by protobuf library will by - default use + Example 3: Pack and unpack a message in Python. - 'type.googleapis.com/full.type.name' as the type URL and the - unpack + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... - methods only use the fully qualified type name after the - last '/' + Example 4: Pack and unpack a message in Go - in the type URL, for example "foo.bar.com/x/y.z" will yield - type + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } - name "y.z". + The pack methods provided by protobuf library will by default use + 'type.googleapis.com/full.type.name' as the type URL and the unpack + methods only use the fully qualified type name after the last '/' - JSON + in the type URL, for example "foo.bar.com/x/y.z" will yield type - ==== + name "y.z". - The JSON representation of an `Any` value uses the regular - representation of the deserialized, embedded message, with - an + JSON - additional field `@type` which contains the type URL. - Example: - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } + The JSON representation of an `Any` value uses the regular - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + representation of the deserialized, embedded message, with an - If the embedded message type is well-known and has a custom - JSON + additional field `@type` which contains the type URL. Example: - representation, that representation will be embedded adding - a field + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } - `value` which holds the custom JSON in addition to the - `@type` + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } - field. Example (for message [google.protobuf.Duration][]): + If the embedded message type is well-known and has a custom JSON - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: class_id - description: class_id associated with the nft - in: path - required: true - type: string - - name: id - description: id is a unique identifier of the NFT - in: path - required: true - type: string - tags: - - Query - /cosmos/nft/v1beta1/owner/{class_id}/{id}: - get: - summary: >- - Owner queries the owner of the NFT based on its class and id, same as - ownerOf in ERC721 - operationId: CosmosNftV1Beta1Owner - responses: - '200': - description: A successful response. - schema: - type: object - properties: - owner: - type: string - title: owner is the owner address of the nft - title: >- - QueryOwnerResponse is the response type for the Query/Owner RPC - method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least + representation, that representation will be embedded adding a field - one "/" character. The last segment of the URL's path - must represent + `value` which holds the custom JSON in addition to the `@type` - the fully qualified name of the type (as in + field. Example (for message [google.protobuf.Duration][]): - `path/google.protobuf.Duration`). The name should be in - a canonical form + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + cosmos.authz.v1beta1.Grant: + type: object + properties: + authorization: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized - (e.g., leading "." is not accepted). + protocol buffer message. This string must contain at least + one "/" character. The last segment of the URL's path must + represent - In practice, teams usually precompile into the binary - all types that they + the fully qualified name of the type (as in - expect it to use in the context of Any. However, for - URLs which use the + `path/google.protobuf.Duration`). The name should be in a + canonical form - scheme `http`, `https`, or no scheme, one can optionally - set up a type + (e.g., leading "." is not accepted). - server that maps type URLs to message definitions as - follows: + In practice, teams usually precompile into the binary all types + that they - * If no scheme is provided, `https` is assumed. + expect it to use in the context of Any. However, for URLs which + use the - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + scheme `http`, `https`, or no scheme, one can optionally set up a + type - Note: this functionality is not currently available in - the official + server that maps type URLs to message definitions as follows: - protobuf release, and it is not used for type URLs - beginning with - type.googleapis.com. + * If no scheme is provided, `https` is assumed. + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - Schemes other than `http`, `https` (or the empty scheme) - might be + Note: this functionality is not currently available in the + official - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a + protobuf release, and it is not used for type URLs beginning with - URL that describes the type of the serialized message. + type.googleapis.com. - Protobuf library provides support to pack/unpack Any values - in the form + Schemes other than `http`, `https` (or the empty scheme) might be - of utility functions or additional generated methods of the - Any type. + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message along + with a + URL that describes the type of the serialized message. - Example 1: Pack and unpack a message in C++. - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } + Protobuf library provides support to pack/unpack Any values in the + form - Example 2: Pack and unpack a message in Java. + of utility functions or additional generated methods of the Any type. - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - Example 3: Pack and unpack a message in Python. + Example 1: Pack and unpack a message in C++. - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } - Example 4: Pack and unpack a message in Go + Example 2: Pack and unpack a message in Java. - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - The pack methods provided by protobuf library will by - default use + Example 3: Pack and unpack a message in Python. - 'type.googleapis.com/full.type.name' as the type URL and the - unpack + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... - methods only use the fully qualified type name after the - last '/' + Example 4: Pack and unpack a message in Go - in the type URL, for example "foo.bar.com/x/y.z" will yield - type + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } - name "y.z". + The pack methods provided by protobuf library will by default use + 'type.googleapis.com/full.type.name' as the type URL and the unpack + methods only use the fully qualified type name after the last '/' - JSON + in the type URL, for example "foo.bar.com/x/y.z" will yield type - ==== + name "y.z". - The JSON representation of an `Any` value uses the regular - representation of the deserialized, embedded message, with - an + JSON - additional field `@type` which contains the type URL. - Example: - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } + The JSON representation of an `Any` value uses the regular - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + representation of the deserialized, embedded message, with an - If the embedded message type is well-known and has a custom - JSON + additional field `@type` which contains the type URL. Example: - representation, that representation will be embedded adding - a field + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } - `value` which holds the custom JSON in addition to the - `@type` + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } - field. Example (for message [google.protobuf.Duration][]): + If the embedded message type is well-known and has a custom JSON - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: class_id - description: class_id associated with the nft - in: path - required: true - type: string - - name: id - description: id is a unique identifier of the NFT - in: path - required: true - type: string - tags: - - Query - /cosmos/nft/v1beta1/supply/{class_id}: - get: - summary: >- - Supply queries the number of NFTs from the given class, same as - totalSupply of ERC721. - operationId: CosmosNftV1Beta1Supply - responses: - '200': - description: A successful response. - schema: - type: object - properties: - amount: - type: string - format: uint64 - title: amount is the number of all NFTs from the given class - title: >- - QuerySupplyResponse is the response type for the Query/Supply RPC - method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized + representation, that representation will be embedded adding a field - protocol buffer message. This string must contain at - least + `value` which holds the custom JSON in addition to the `@type` - one "/" character. The last segment of the URL's path - must represent + field. Example (for message [google.protobuf.Duration][]): - the fully qualified name of the type (as in + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + expiration: + type: string + format: date-time + title: >- + time when the grant will expire and will be pruned. If null, then the + grant - `path/google.protobuf.Duration`). The name should be in - a canonical form + doesn't have a time expiration (other conditions in `authorization` - (e.g., leading "." is not accepted). + may apply to invalidate the grant) + description: |- + Grant gives permissions to execute + the provide method with expiration time. + cosmos.authz.v1beta1.MsgExec: + type: object + properties: + grantee: + type: string + msgs: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + protocol buffer message. This string must contain at least - In practice, teams usually precompile into the binary - all types that they + one "/" character. The last segment of the URL's path must + represent - expect it to use in the context of Any. However, for - URLs which use the + the fully qualified name of the type (as in - scheme `http`, `https`, or no scheme, one can optionally - set up a type + `path/google.protobuf.Duration`). The name should be in a + canonical form - server that maps type URLs to message definitions as - follows: + (e.g., leading "." is not accepted). - * If no scheme is provided, `https` is assumed. + In practice, teams usually precompile into the binary all types + that they - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + expect it to use in the context of Any. However, for URLs which + use the - Note: this functionality is not currently available in - the official + scheme `http`, `https`, or no scheme, one can optionally set up + a type - protobuf release, and it is not used for type URLs - beginning with + server that maps type URLs to message definitions as follows: - type.googleapis.com. + * If no scheme is provided, `https` is assumed. - Schemes other than `http`, `https` (or the empty scheme) - might be + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a + Note: this functionality is not currently available in the + official - URL that describes the type of the serialized message. + protobuf release, and it is not used for type URLs beginning + with + type.googleapis.com. - Protobuf library provides support to pack/unpack Any values - in the form - of utility functions or additional generated methods of the - Any type. + Schemes other than `http`, `https` (or the empty scheme) might + be + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message along + with a - Example 1: Pack and unpack a message in C++. + URL that describes the type of the serialized message. - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - Example 2: Pack and unpack a message in Java. + Protobuf library provides support to pack/unpack Any values in the + form - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } + of utility functions or additional generated methods of the Any + type. - Example 3: Pack and unpack a message in Python. - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... + Example 1: Pack and unpack a message in C++. - Example 4: Pack and unpack a message in Go + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } + Example 2: Pack and unpack a message in Java. - The pack methods provided by protobuf library will by - default use + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - 'type.googleapis.com/full.type.name' as the type URL and the - unpack + Example 3: Pack and unpack a message in Python. - methods only use the fully qualified type name after the - last '/' + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... - in the type URL, for example "foo.bar.com/x/y.z" will yield - type + Example 4: Pack and unpack a message in Go - name "y.z". + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + The pack methods provided by protobuf library will by default use + 'type.googleapis.com/full.type.name' as the type URL and the unpack - JSON + methods only use the fully qualified type name after the last '/' - ==== + in the type URL, for example "foo.bar.com/x/y.z" will yield type - The JSON representation of an `Any` value uses the regular + name "y.z". - representation of the deserialized, embedded message, with - an - additional field `@type` which contains the type URL. - Example: + JSON - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + The JSON representation of an `Any` value uses the regular - If the embedded message type is well-known and has a custom - JSON + representation of the deserialized, embedded message, with an - representation, that representation will be embedded adding - a field + additional field `@type` which contains the type URL. Example: - `value` which holds the custom JSON in addition to the - `@type` + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } - field. Example (for message [google.protobuf.Duration][]): + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: class_id - description: class_id associated with the nft - in: path - required: true - type: string - tags: - - Query - /cosmos/params/v1beta1/params: - get: - summary: |- - Params queries a specific parameter of a module, given its subspace and - key. - operationId: CosmosParamsV1Beta1Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - param: - description: param defines the queried parameter. - type: object - properties: - subspace: - type: string - key: - type: string - value: - type: string - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: subspace - description: subspace defines the module to query the parameter for. - in: query - required: false - type: string - - name: key - description: key defines the key of the parameter in the subspace. - in: query - required: false - type: string - tags: - - Query - /cosmos/params/v1beta1/subspaces: - get: - summary: >- - Subspaces queries for all registered subspaces and all keys for a - subspace. - description: 'Since: cosmos-sdk 0.46' - operationId: CosmosParamsV1Beta1Subspaces - responses: - '200': - description: A successful response. - schema: - type: object - properties: - subspaces: - type: array - items: - type: object - properties: - subspace: - type: string - keys: - type: array - items: - type: string - description: >- - Subspace defines a parameter subspace name and all the keys - that exist for + If the embedded message type is well-known and has a custom JSON - the subspace. + representation, that representation will be embedded adding a field + `value` which holds the custom JSON in addition to the `@type` - Since: cosmos-sdk 0.46 - description: >- - QuerySubspacesResponse defines the response types for querying for - all + field. Example (for message [google.protobuf.Duration][]): - registered subspaces and all keys for a subspace. + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + description: >- + Execute Msg. + The x/authz will try to find a grant matching (msg.signers[0], + grantee, MsgTypeURL(msg)) - Since: cosmos-sdk 0.46 - default: - description: An unexpected error response. - schema: + triple and validate it. + description: |- + MsgExec attempts to execute the provided messages using + authorizations granted to the grantee. Each message should have only + one signer corresponding to the granter of the authorization. + cosmos.authz.v1beta1.MsgExecResponse: + type: object + properties: + results: + type: array + items: + type: string + format: byte + description: MsgExecResponse defines the Msg/MsgExecResponse response type. + cosmos.authz.v1beta1.MsgGrant: + type: object + properties: + granter: + type: string + grantee: + type: string + grant: + type: object + properties: + authorization: type: object properties: - code: - type: integer - format: int32 - message: + '@type': type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /cosmos/slashing/v1beta1/params: - get: - summary: Params queries the parameters of slashing module - operationId: CosmosSlashingV1Beta1Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - type: object - properties: - signed_blocks_window: - type: string - format: int64 - min_signed_per_window: - type: string - format: byte - downtime_jail_duration: - type: string - slash_fraction_double_sign: - type: string - format: byte - slash_fraction_downtime: - type: string - format: byte description: >- - Params represents the parameters used for by the slashing - module. - title: >- - QueryParamsResponse is the response type for the Query/Params RPC - method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /cosmos/slashing/v1beta1/signing_infos: - get: - summary: SigningInfos queries signing info of all validators - operationId: CosmosSlashingV1Beta1SigningInfos - responses: - '200': - description: A successful response. - schema: - type: object - properties: - info: - type: array - items: - type: object - properties: - address: - type: string - start_height: - type: string - format: int64 - title: >- - Height at which validator was first a candidate OR was - unjailed - index_offset: - type: string - format: int64 - description: >- - Index which is incremented each time the validator was a - bonded + A URL/resource name that uniquely identifies the type of the + serialized - in a block and may have signed a precommit or not. This - in conjunction with the + protocol buffer message. This string must contain at least - `SignedBlocksWindow` param determines the index in the - `MissedBlocksBitArray`. - jailed_until: - type: string - format: date-time - description: >- - Timestamp until which the validator is jailed due to - liveness downtime. - tombstoned: - type: boolean - description: >- - Whether or not a validator has been tombstoned (killed - out of validator set). It is set + one "/" character. The last segment of the URL's path must + represent - once the validator commits an equivocation or for any - other configured misbehiavor. - missed_blocks_counter: - type: string - format: int64 - description: >- - A counter kept to avoid unnecessary array reads. + the fully qualified name of the type (as in - Note that `Sum(MissedBlocksBitArray)` always equals - `MissedBlocksCounter`. - description: >- - ValidatorSigningInfo defines a validator's signing info for - monitoring their + `path/google.protobuf.Duration`). The name should be in a + canonical form - liveness activity. - title: info is the signing info of all validators - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + (e.g., leading "." is not accepted). - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - corresponding request message has used PageRequest. + In practice, teams usually precompile into the binary all + types that they - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - title: >- - QuerySigningInfosResponse is the response type for the - Query/SigningInfos RPC + expect it to use in the context of Any. However, for URLs + which use the - method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. + scheme `http`, `https`, or no scheme, one can optionally set + up a type - It is less efficient than using key. Only one of offset or key - should + server that maps type URLs to message definitions as follows: - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include + * If no scheme is provided, `https` is assumed. - a count of the total number of items available for pagination in - UIs. + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on + the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - count_total is only respected when offset is used. It is ignored - when key + Note: this functionality is not currently available in the + official - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. + protobuf release, and it is not used for type URLs beginning + with + type.googleapis.com. - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/slashing/v1beta1/signing_infos/{cons_address}: - get: - summary: SigningInfo queries the signing info of given cons address - operationId: CosmosSlashingV1Beta1SigningInfo - responses: - '200': - description: A successful response. - schema: - type: object - properties: - val_signing_info: - title: >- - val_signing_info is the signing info of requested val cons - address - type: object - properties: - address: - type: string - start_height: - type: string - format: int64 - title: >- - Height at which validator was first a candidate OR was - unjailed - index_offset: - type: string - format: int64 - description: >- - Index which is incremented each time the validator was a - bonded - in a block and may have signed a precommit or not. This in - conjunction with the + Schemes other than `http`, `https` (or the empty scheme) might + be - `SignedBlocksWindow` param determines the index in the - `MissedBlocksBitArray`. - jailed_until: - type: string - format: date-time - description: >- - Timestamp until which the validator is jailed due to - liveness downtime. - tombstoned: - type: boolean - description: >- - Whether or not a validator has been tombstoned (killed out - of validator set). It is set + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message + along with a - once the validator commits an equivocation or for any - other configured misbehiavor. - missed_blocks_counter: - type: string - format: int64 - description: >- - A counter kept to avoid unnecessary array reads. + URL that describes the type of the serialized message. - Note that `Sum(MissedBlocksBitArray)` always equals - `MissedBlocksCounter`. - description: >- - ValidatorSigningInfo defines a validator's signing info for - monitoring their - liveness activity. - title: >- - QuerySigningInfoResponse is the response type for the - Query/SigningInfo RPC + Protobuf library provides support to pack/unpack Any values in the + form - method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: cons_address - description: cons_address is the address to query signing info of - in: path - required: true - type: string - tags: - - Query - /cosmos/staking/v1beta1/delegations/{delegator_addr}: - get: - summary: >- - DelegatorDelegations queries all delegations of a given delegator - address. - description: >- - When called from another module, this query might consume a high amount - of - - gas if the pagination field is incorrectly set. - operationId: CosmosStakingV1Beta1DelegatorDelegations - responses: - '200': - description: A successful response. - schema: - type: object - properties: - delegation_responses: - type: array - items: - type: object - properties: - delegation: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of - the delegator. - validator_address: - type: string - description: >- - validator_address is the bech32-encoded address of - the validator. - shares: - type: string - description: shares define the delegation shares received. - description: >- - Delegation represents the bond with tokens held by an - account. It is + of utility functions or additional generated methods of the Any + type. - owned by one delegator, and is associated with the - voting power of one - validator. - balance: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. + Example 1: Pack and unpack a message in C++. + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } - NOTE: The amount field is an Int which implements the - custom method + Example 2: Pack and unpack a message in Java. - signatures required by gogoproto. - description: >- - DelegationResponse is equivalent to Delegation except that - it contains a + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - balance in addition to shares which is more suitable for - client responses. - description: >- - delegation_responses defines all the delegations' info of a - delegator. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + Example 3: Pack and unpack a message in Python. - was set, its value is undefined otherwise - description: |- - QueryDelegatorDelegationsResponse is response type for the - Query/DelegatorDelegations RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... - protocol buffer message. This string must contain at - least + Example 4: Pack and unpack a message in Go - one "/" character. The last segment of the URL's path - must represent + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } - the fully qualified name of the type (as in + The pack methods provided by protobuf library will by default use - `path/google.protobuf.Duration`). The name should be in - a canonical form + 'type.googleapis.com/full.type.name' as the type URL and the + unpack - (e.g., leading "." is not accepted). + methods only use the fully qualified type name after the last '/' + in the type URL, for example "foo.bar.com/x/y.z" will yield type - In practice, teams usually precompile into the binary - all types that they + name "y.z". - expect it to use in the context of Any. However, for - URLs which use the - scheme `http`, `https`, or no scheme, one can optionally - set up a type + JSON - server that maps type URLs to message definitions as - follows: + The JSON representation of an `Any` value uses the regular - * If no scheme is provided, `https` is assumed. + representation of the deserialized, embedded message, with an - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + additional field `@type` which contains the type URL. Example: - Note: this functionality is not currently available in - the official + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } - protobuf release, and it is not used for type URLs - beginning with + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. + If the embedded message type is well-known and has a custom JSON + representation, that representation will be embedded adding a + field - Protobuf library provides support to pack/unpack Any values - in the form + `value` which holds the custom JSON in addition to the `@type` - of utility functions or additional generated methods of the - Any type. + field. Example (for message [google.protobuf.Duration][]): + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + expiration: + type: string + format: date-time + title: >- + time when the grant will expire and will be pruned. If null, then + the grant - Example 1: Pack and unpack a message in C++. + doesn't have a time expiration (other conditions in + `authorization` - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } + may apply to invalidate the grant) + description: |- + Grant gives permissions to execute + the provide method with expiration time. + description: >- + MsgGrant is a request type for Grant method. It declares authorization to + the grantee - Example 2: Pack and unpack a message in Java. + on behalf of the granter with the provided expiration time. + cosmos.authz.v1beta1.MsgGrantResponse: + type: object + description: MsgGrantResponse defines the Msg/MsgGrant response type. + cosmos.authz.v1beta1.MsgRevoke: + type: object + properties: + granter: + type: string + grantee: + type: string + msg_type_url: + type: string + description: |- + MsgRevoke revokes any authorization with the provided sdk.Msg type on the + granter's account with that has been granted to the grantee. + cosmos.authz.v1beta1.MsgRevokeResponse: + type: object + description: MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. + cosmos.bank.v1beta1.Input: + type: object + properties: + address: + type: string + coins: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: Input models transaction input. + cosmos.bank.v1beta1.MsgMultiSend: + type: object + properties: + inputs: + type: array + items: + type: object + properties: + address: + type: string + coins: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - Example 3: Pack and unpack a message in Python. - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... + NOTE: The amount field is an Int which implements the custom + method - Example 4: Pack and unpack a message in Go + signatures required by gogoproto. + description: Input models transaction input. + description: >- + Inputs, despite being `repeated`, only allows one sender input. This + is - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } + checked in MsgMultiSend's ValidateBasic. + outputs: + type: array + items: + type: object + properties: + address: + type: string + coins: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - The pack methods provided by protobuf library will by - default use - 'type.googleapis.com/full.type.name' as the type URL and the - unpack + NOTE: The amount field is an Int which implements the custom + method - methods only use the fully qualified type name after the - last '/' + signatures required by gogoproto. + description: Output models transaction outputs. + description: MsgMultiSend represents an arbitrary multi-in, multi-out send message. + cosmos.bank.v1beta1.MsgMultiSendResponse: + type: object + description: MsgMultiSendResponse defines the Msg/MultiSend response type. + cosmos.bank.v1beta1.MsgSend: + type: object + properties: + from_address: + type: string + to_address: + type: string + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. - in the type URL, for example "foo.bar.com/x/y.z" will yield - type + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: MsgSend represents a message to send coins from one account to another. + cosmos.bank.v1beta1.MsgSendResponse: + type: object + description: MsgSendResponse defines the Msg/Send response type. + cosmos.bank.v1beta1.MsgSetSendEnabled: + type: object + properties: + authority: + type: string + description: authority is the address that controls the module. + send_enabled: + type: array + items: + type: object + properties: + denom: + type: string + enabled: + type: boolean + description: >- + SendEnabled maps coin denom to a send_enabled status (whether a + denom is - name "y.z". + sendable). + description: send_enabled is the list of entries to add or update. + use_default_for: + type: array + items: + type: string + description: >- + use_default_for is a list of denoms that should use the + params.default_send_enabled value. + Denoms listed here will have their SendEnabled entries deleted. + If a denom is included that doesn't have a SendEnabled entry, - JSON + it will be ignored. + description: |- + MsgSetSendEnabled is the Msg/SetSendEnabled request type. - ==== + Only entries to add/update/delete need to be included. + Existing SendEnabled entries that are not included in this + message are left unchanged. - The JSON representation of an `Any` value uses the regular + Since: cosmos-sdk 0.47 + cosmos.bank.v1beta1.MsgSetSendEnabledResponse: + type: object + description: |- + MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. - representation of the deserialized, embedded message, with - an + Since: cosmos-sdk 0.47 + cosmos.bank.v1beta1.MsgUpdateParams: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + params: + description: |- + params defines the x/bank parameters to update. - additional field `@type` which contains the type URL. - Example: + NOTE: All parameters must be supplied. + type: object + properties: + send_enabled: + type: array + items: + type: object + properties: + denom: + type: string + enabled: + type: boolean + description: >- + SendEnabled maps coin denom to a send_enabled status (whether a + denom is - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } + sendable). + description: >- + Deprecated: Use of SendEnabled in params is deprecated. - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + For genesis, use the newly added send_enabled field in the genesis + object. - If the embedded message type is well-known and has a custom - JSON + Storage, lookup, and manipulation of this information is now in + the keeper. - representation, that representation will be embedded adding - a field - `value` which holds the custom JSON in addition to the - `@type` + As of cosmos-sdk 0.47, this only exists for backwards + compatibility of genesis files. + default_send_enabled: + type: boolean + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. - field. Example (for message [google.protobuf.Duration][]): + Since: cosmos-sdk 0.47 + cosmos.bank.v1beta1.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: delegator_addr - description: delegator_addr defines the delegator address to query for. - in: path - required: true - type: string - - name: pagination.key + Since: cosmos-sdk 0.47 + cosmos.bank.v1beta1.Output: + type: object + properties: + address: + type: string + coins: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. + Coin defines a token with a denomination and an amount. - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: Output models transaction outputs. + cosmos.bank.v1beta1.Params: + type: object + properties: + send_enabled: + type: array + items: + type: object + properties: + denom: + type: string + enabled: + type: boolean description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key + SendEnabled maps coin denom to a send_enabled status (whether a + denom is - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. + sendable). + description: >- + Deprecated: Use of SendEnabled in params is deprecated. + For genesis, use the newly added send_enabled field in the genesis + object. - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/staking/v1beta1/delegators/{delegator_addr}/redelegations: - get: - summary: Redelegations queries redelegations of given address. - description: >- - When called from another module, this query might consume a high amount - of + Storage, lookup, and manipulation of this information is now in the + keeper. - gas if the pagination field is incorrectly set. - operationId: CosmosStakingV1Beta1Redelegations - responses: - '200': - description: A successful response. - schema: - type: object - properties: - redelegation_responses: - type: array - items: - type: object - properties: - redelegation: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of - the delegator. - validator_src_address: - type: string - description: >- - validator_src_address is the validator redelegation - source operator address. - validator_dst_address: - type: string - description: >- - validator_dst_address is the validator redelegation - destination operator address. - entries: - type: array - items: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height defines the height which the - redelegation took place. - completion_time: - type: string - format: date-time - description: >- - completion_time defines the unix time for - redelegation completion. - initial_balance: - type: string - description: >- - initial_balance defines the initial balance - when redelegation started. - shares_dst: - type: string - description: >- - shares_dst is the amount of - destination-validator shares created by - redelegation. - unbonding_id: - type: string - format: uint64 - title: >- - Incrementing id that uniquely identifies this - entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding - has been stopped by external modules - description: >- - RedelegationEntry defines a redelegation object - with relevant metadata. - description: |- - entries are the redelegation entries. - - redelegation entries - description: >- - Redelegation contains the list of a particular - delegator's redelegating bonds - from a particular source validator to a particular - destination validator. - entries: - type: array - items: - type: object - properties: - redelegation_entry: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height defines the height which the - redelegation took place. - completion_time: - type: string - format: date-time - description: >- - completion_time defines the unix time for - redelegation completion. - initial_balance: - type: string - description: >- - initial_balance defines the initial balance - when redelegation started. - shares_dst: - type: string - description: >- - shares_dst is the amount of - destination-validator shares created by - redelegation. - unbonding_id: - type: string - format: uint64 - title: >- - Incrementing id that uniquely identifies this - entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding - has been stopped by external modules - description: >- - RedelegationEntry defines a redelegation object - with relevant metadata. - balance: - type: string - description: >- - RedelegationEntryResponse is equivalent to a - RedelegationEntry except that it + As of cosmos-sdk 0.47, this only exists for backwards compatibility of + genesis files. + default_send_enabled: + type: boolean + description: Params defines the parameters for the bank module. + cosmos.bank.v1beta1.SendEnabled: + type: object + properties: + denom: + type: string + enabled: + type: boolean + description: |- + SendEnabled maps coin denom to a send_enabled status (whether a denom is + sendable). + cosmos.base.v1beta1.Coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. - contains a balance in addition to shares which is more - suitable for client + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + cosmos.base.node.v1beta1.ConfigResponse: + type: object + properties: + minimum_gas_price: + type: string + pruning_keep_recent: + type: string + title: pruning settings + pruning_interval: + type: string + description: ConfigResponse defines the response structure for the Config gRPC query. + cosmos.base.node.v1beta1.StatusResponse: + type: object + properties: + earliest_store_height: + type: string + format: uint64 + title: earliest block height available in the store + height: + type: string + format: uint64 + title: current block height + timestamp: + type: string + format: date-time + title: block height timestamp + app_hash: + type: string + format: byte + title: app hash of the current block + validator_hash: + type: string + format: byte + title: validator hash provided by the consensus header + description: StateResponse defines the response structure for the status of a node. + cosmos.consensus.v1.MsgUpdateParams: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + block: + description: |- + params defines the x/consensus parameters to update. + VersionsParams is not included in this Msg because it is tracked + separarately in x/upgrade. - responses. - description: >- - RedelegationResponse is equivalent to a Redelegation except - that its entries + NOTE: All parameters must be supplied. + type: object + properties: + max_bytes: + type: string + format: int64 + title: |- + Max block size, in bytes. + Note: must be greater than 0 + max_gas: + type: string + format: int64 + title: |- + Max gas per block. + Note: must be greater or equal to -1 + evidence: + type: object + properties: + max_age_num_blocks: + type: string + format: int64 + description: >- + Max age of evidence, in blocks. - contain a balance in addition to shares which is more - suitable for client - responses. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + The basic formula for calculating this is: MaxAgeDuration / + {average block - was set, its value is undefined otherwise + time}. + max_age_duration: + type: string description: >- - QueryRedelegationsResponse is response type for the - Query/Redelegations RPC + Max age of evidence, in time. - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - protocol buffer message. This string must contain at - least + It should correspond with an app's "unbonding period" or other + similar - one "/" character. The last segment of the URL's path - must represent + mechanism for handling [Nothing-At-Stake - the fully qualified name of the type (as in + attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + max_bytes: + type: string + format: int64 + title: >- + This sets the maximum size of total evidence in bytes that can be + committed in a single block. - `path/google.protobuf.Duration`). The name should be in - a canonical form + and should fall comfortably under the max block bytes. - (e.g., leading "." is not accepted). + Default is 1048576 or 1MB + description: EvidenceParams determine how we handle evidence of malfeasance. + validator: + type: object + properties: + pub_key_types: + type: array + items: + type: string + description: |- + ValidatorParams restrict the public key types validators can use. + NOTE: uses ABCI pubkey naming, not Amino names. + abci: + title: 'Since: cosmos-sdk 0.50' + type: object + properties: + vote_extensions_enable_height: + type: string + format: int64 + description: >- + vote_extensions_enable_height configures the first height during + which + vote extensions will be enabled. During this specified height, and + for all - In practice, teams usually precompile into the binary - all types that they + subsequent heights, precommit messages that do not contain valid + extension data - expect it to use in the context of Any. However, for - URLs which use the + will be considered invalid. Prior to this height, vote extensions + will not - scheme `http`, `https`, or no scheme, one can optionally - set up a type + be used or accepted by validators on the network. - server that maps type URLs to message definitions as - follows: + Once enabled, vote extensions will be created by the application + in ExtendVote, - * If no scheme is provided, `https` is assumed. + passed to the application for validation in VerifyVoteExtension + and given - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with + to the application to use when proposing a block during + PrepareProposal. + description: >- + ABCIParams configure functionality specific to the Application + Blockchain Interface. + description: MsgUpdateParams is the Msg/UpdateParams request type. + cosmos.consensus.v1.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. + tendermint.types.ABCIParams: + type: object + properties: + vote_extensions_enable_height: + type: string + format: int64 + description: >- + vote_extensions_enable_height configures the first height during which - type.googleapis.com. + vote extensions will be enabled. During this specified height, and for + all + subsequent heights, precommit messages that do not contain valid + extension data - Schemes other than `http`, `https` (or the empty scheme) - might be + will be considered invalid. Prior to this height, vote extensions will + not - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a + be used or accepted by validators on the network. - URL that describes the type of the serialized message. + Once enabled, vote extensions will be created by the application in + ExtendVote, - Protobuf library provides support to pack/unpack Any values - in the form + passed to the application for validation in VerifyVoteExtension and + given - of utility functions or additional generated methods of the - Any type. + to the application to use when proposing a block during + PrepareProposal. + description: >- + ABCIParams configure functionality specific to the Application Blockchain + Interface. + tendermint.types.BlockParams: + type: object + properties: + max_bytes: + type: string + format: int64 + title: |- + Max block size, in bytes. + Note: must be greater than 0 + max_gas: + type: string + format: int64 + title: |- + Max gas per block. + Note: must be greater or equal to -1 + description: BlockParams contains limits on the block size. + tendermint.types.EvidenceParams: + type: object + properties: + max_age_num_blocks: + type: string + format: int64 + description: >- + Max age of evidence, in blocks. - Example 1: Pack and unpack a message in C++. + The basic formula for calculating this is: MaxAgeDuration / {average + block - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } + time}. + max_age_duration: + type: string + description: >- + Max age of evidence, in time. - Example 2: Pack and unpack a message in Java. - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } + It should correspond with an app's "unbonding period" or other similar - Example 3: Pack and unpack a message in Python. + mechanism for handling [Nothing-At-Stake - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... + attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + max_bytes: + type: string + format: int64 + title: >- + This sets the maximum size of total evidence in bytes that can be + committed in a single block. - Example 4: Pack and unpack a message in Go + and should fall comfortably under the max block bytes. - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } + Default is 1048576 or 1MB + description: EvidenceParams determine how we handle evidence of malfeasance. + tendermint.types.ValidatorParams: + type: object + properties: + pub_key_types: + type: array + items: + type: string + description: |- + ValidatorParams restrict the public key types validators can use. + NOTE: uses ABCI pubkey naming, not Amino names. + cosmos.crisis.v1beta1.MsgUpdateParams: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + constant_fee: + description: constant_fee defines the x/crisis parameter. + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. - The pack methods provided by protobuf library will by - default use + Since: cosmos-sdk 0.47 + cosmos.crisis.v1beta1.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. - 'type.googleapis.com/full.type.name' as the type URL and the - unpack + Since: cosmos-sdk 0.47 + cosmos.crisis.v1beta1.MsgVerifyInvariant: + type: object + properties: + sender: + type: string + description: >- + sender is the account address of private key to send coins to fee + collector account. + invariant_module_name: + type: string + description: name of the invariant module. + invariant_route: + type: string + description: invariant_route is the msg's invariant route. + description: MsgVerifyInvariant represents a message to verify a particular invariance. + cosmos.crisis.v1beta1.MsgVerifyInvariantResponse: + type: object + description: MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type. + cosmos.distribution.v1beta1.MsgCommunityPoolSpend: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + recipient: + type: string + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. - methods only use the fully qualified type name after the - last '/' + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: >- + MsgCommunityPoolSpend defines a message for sending tokens from the + community - in the type URL, for example "foo.bar.com/x/y.z" will yield - type + pool to another account. This message is typically executed via a + governance - name "y.z". + proposal with the governance module being the executing authority. + Since: cosmos-sdk 0.47 + cosmos.distribution.v1beta1.MsgCommunityPoolSpendResponse: + type: object + description: |- + MsgCommunityPoolSpendResponse defines the response to executing a + MsgCommunityPoolSpend message. - JSON + Since: cosmos-sdk 0.47 + cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool: + type: object + properties: + depositor: + type: string + validator_address: + type: string + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. - ==== + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: |- + DepositValidatorRewardsPool defines the request structure to provide + additional rewards to delegators from a specific validator. - The JSON representation of an `Any` value uses the regular + Since: cosmos-sdk 0.50 + cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPoolResponse: + type: object + description: |- + MsgDepositValidatorRewardsPoolResponse defines the response to executing a + MsgDepositValidatorRewardsPool message. - representation of the deserialized, embedded message, with - an + Since: cosmos-sdk 0.50 + cosmos.distribution.v1beta1.MsgFundCommunityPool: + type: object + properties: + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. - additional field `@type` which contains the type URL. - Example: + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + depositor: + type: string + description: |- + MsgFundCommunityPool allows an account to directly + fund the community pool. + cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse: + type: object + description: >- + MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response + type. + cosmos.distribution.v1beta1.MsgSetWithdrawAddress: + type: object + properties: + delegator_address: + type: string + withdraw_address: + type: string + description: |- + MsgSetWithdrawAddress sets the withdraw address for + a delegator (or validator self-delegation). + cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse: + type: object + description: |- + MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response + type. + cosmos.distribution.v1beta1.MsgUpdateParams: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + params: + description: |- + params defines the x/distribution parameters to update. - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } + NOTE: All parameters must be supplied. + type: object + properties: + community_tax: + type: string + base_proposer_reward: + type: string + description: >- + Deprecated: The base_proposer_reward field is deprecated and is no + longer used - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + in the x/distribution module's reward mechanism. + bonus_proposer_reward: + type: string + description: >- + Deprecated: The bonus_proposer_reward field is deprecated and is + no longer used - If the embedded message type is well-known and has a custom - JSON + in the x/distribution module's reward mechanism. + withdraw_addr_enabled: + type: boolean + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. - representation, that representation will be embedded adding - a field + Since: cosmos-sdk 0.47 + cosmos.distribution.v1beta1.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. - `value` which holds the custom JSON in addition to the - `@type` + Since: cosmos-sdk 0.47 + cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward: + type: object + properties: + delegator_address: + type: string + validator_address: + type: string + description: |- + MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator + from a single validator. + cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse: + type: object + properties: + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. - field. Example (for message [google.protobuf.Duration][]): + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + title: 'Since: cosmos-sdk 0.46' + description: |- + MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + response type. + cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission: + type: object + properties: + validator_address: + type: string + description: >- + MsgWithdrawValidatorCommission withdraws the full commission to the + validator - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: delegator_addr - description: delegator_addr defines the delegator address to query for. - in: path - required: true - type: string - - name: src_validator_addr - description: src_validator_addr defines the validator address to redelegate from. - in: query - required: false - type: string - - name: dst_validator_addr - description: dst_validator_addr defines the validator address to redelegate to. - in: query - required: false - type: string - - name: pagination.key + address. + cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse: + type: object + properties: + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. + Coin defines a token with a denomination and an amount. - It is less efficient than using key. Only one of offset or key - should + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + title: 'Since: cosmos-sdk 0.46' + description: |- + MsgWithdrawValidatorCommissionResponse defines the + Msg/WithdrawValidatorCommission response type. + cosmos.distribution.v1beta1.Params: + type: object + properties: + community_tax: + type: string + base_proposer_reward: + type: string + description: >- + Deprecated: The base_proposer_reward field is deprecated and is no + longer used - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. + in the x/distribution module's reward mechanism. + bonus_proposer_reward: + type: string + description: >- + Deprecated: The bonus_proposer_reward field is deprecated and is no + longer used - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include + in the x/distribution module's reward mechanism. + withdraw_addr_enabled: + type: boolean + description: Params defines the set of params for the distribution module. + cosmos.evidence.v1beta1.MsgSubmitEvidence: + type: object + properties: + submitter: + type: string + description: submitter is the signer account address of evidence. + evidence: + description: evidence defines the evidence of misbehavior. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized - a count of the total number of items available for pagination in - UIs. + protocol buffer message. This string must contain at least - count_total is only respected when offset is used. It is ignored - when key + one "/" character. The last segment of the URL's path must + represent - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. + the fully qualified name of the type (as in + `path/google.protobuf.Duration`). The name should be in a + canonical form - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/staking/v1beta1/delegators/{delegator_addr}/unbonding_delegations: - get: - summary: >- - DelegatorUnbondingDelegations queries all unbonding delegations of a - given + (e.g., leading "." is not accepted). - delegator address. - description: >- - When called from another module, this query might consume a high amount - of - gas if the pagination field is incorrectly set. - operationId: CosmosStakingV1Beta1DelegatorUnbondingDelegations - responses: - '200': - description: A successful response. - schema: - type: object - properties: - unbonding_responses: - type: array - items: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. - validator_address: - type: string - description: >- - validator_address is the bech32-encoded address of the - validator. - entries: - type: array - items: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height is the height which the unbonding - took place. - completion_time: - type: string - format: date-time - description: >- - completion_time is the unix time for unbonding - completion. - initial_balance: - type: string - description: >- - initial_balance defines the tokens initially - scheduled to receive at completion. - balance: - type: string - description: >- - balance defines the tokens to receive at - completion. - unbonding_id: - type: string - format: uint64 - title: >- - Incrementing id that uniquely identifies this - entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has - been stopped by external modules - description: >- - UnbondingDelegationEntry defines an unbonding object - with relevant metadata. - description: |- - entries are the unbonding delegation entries. + In practice, teams usually precompile into the binary all types + that they - unbonding delegation entries - description: >- - UnbondingDelegation stores all of a single delegator's - unbonding bonds + expect it to use in the context of Any. However, for URLs which + use the - for a single validator in an time-ordered list. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + scheme `http`, `https`, or no scheme, one can optionally set up a + type - was set, its value is undefined otherwise - description: >- - QueryUnbondingDelegatorDelegationsResponse is response type for - the + server that maps type URLs to message definitions as follows: - Query/UnbondingDelegatorDelegations RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - protocol buffer message. This string must contain at - least + * If no scheme is provided, `https` is assumed. - one "/" character. The last segment of the URL's path - must represent + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - the fully qualified name of the type (as in + Note: this functionality is not currently available in the + official - `path/google.protobuf.Duration`). The name should be in - a canonical form + protobuf release, and it is not used for type URLs beginning with - (e.g., leading "." is not accepted). + type.googleapis.com. - In practice, teams usually precompile into the binary - all types that they + Schemes other than `http`, `https` (or the empty scheme) might be - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type + used with implementation specific semantics. + additionalProperties: {} + description: |- + MsgSubmitEvidence represents a message that supports submitting arbitrary + Evidence of misbehavior such as equivocation or counterfactual signing. + cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse: + type: object + properties: + hash: + type: string + format: byte + description: hash defines the hash of the evidence. + description: MsgSubmitEvidenceResponse defines the Msg/SubmitEvidence response type. + cosmos.feegrant.v1beta1.MsgGrantAllowance: + type: object + properties: + granter: + type: string + description: >- + granter is the address of the user granting an allowance of their + funds. + grantee: + type: string + description: >- + grantee is the address of the user being granted an allowance of + another user's funds. + allowance: + description: allowance can be any of basic, periodic, allowed fee allowance. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized - server that maps type URLs to message definitions as - follows: + protocol buffer message. This string must contain at least + one "/" character. The last segment of the URL's path must + represent - * If no scheme is provided, `https` is assumed. + the fully qualified name of the type (as in - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + `path/google.protobuf.Duration`). The name should be in a + canonical form - Note: this functionality is not currently available in - the official + (e.g., leading "." is not accepted). - protobuf release, and it is not used for type URLs - beginning with - type.googleapis.com. + In practice, teams usually precompile into the binary all types + that they + expect it to use in the context of Any. However, for URLs which + use the - Schemes other than `http`, `https` (or the empty scheme) - might be + scheme `http`, `https`, or no scheme, one can optionally set up a + type - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a + server that maps type URLs to message definitions as follows: - URL that describes the type of the serialized message. + * If no scheme is provided, `https` is assumed. - Protobuf library provides support to pack/unpack Any values - in the form + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - of utility functions or additional generated methods of the - Any type. + Note: this functionality is not currently available in the + official + protobuf release, and it is not used for type URLs beginning with - Example 1: Pack and unpack a message in C++. + type.googleapis.com. - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - Example 2: Pack and unpack a message in Java. + Schemes other than `http`, `https` (or the empty scheme) might be - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } + used with implementation specific semantics. + additionalProperties: {} + description: |- + MsgGrantAllowance adds permission for Grantee to spend up to Allowance + of fees from the account of Granter. + cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse: + type: object + description: >- + MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response + type. + cosmos.feegrant.v1beta1.MsgPruneAllowances: + type: object + properties: + pruner: + type: string + description: pruner is the address of the user pruning expired allowances. + description: |- + MsgPruneAllowances prunes expired fee allowances. - Example 3: Pack and unpack a message in Python. + Since cosmos-sdk 0.50 + cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse: + type: object + description: >- + MsgPruneAllowancesResponse defines the Msg/PruneAllowancesResponse + response type. - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - Example 4: Pack and unpack a message in Go + Since cosmos-sdk 0.50 + cosmos.feegrant.v1beta1.MsgRevokeAllowance: + type: object + properties: + granter: + type: string + description: >- + granter is the address of the user granting an allowance of their + funds. + grantee: + type: string + description: >- + grantee is the address of the user being granted an allowance of + another user's funds. + description: MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. + cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse: + type: object + description: >- + MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse + response type. + cosmos.gov.v1.MsgCancelProposal: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + proposer: + type: string + description: proposer is the account address of the proposer. + description: |- + MsgCancelProposal is the Msg/CancelProposal request type. - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } + Since: cosmos-sdk 0.50 + cosmos.gov.v1.MsgCancelProposalResponse: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + canceled_time: + type: string + format: date-time + description: canceled_time is the time when proposal is canceled. + canceled_height: + type: string + format: uint64 + description: >- + canceled_height defines the block height at which the proposal is + canceled. + description: |- + MsgCancelProposalResponse defines the response structure for executing a + MsgCancelProposal message. - The pack methods provided by protobuf library will by - default use + Since: cosmos-sdk 0.50 + cosmos.gov.v1.MsgDeposit: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + depositor: + type: string + description: depositor defines the deposit addresses from the proposals. + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. - 'type.googleapis.com/full.type.name' as the type URL and the - unpack + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: amount to be deposited by depositor. + description: MsgDeposit defines a message to submit a deposit to an existing proposal. + cosmos.gov.v1.MsgDepositResponse: + type: object + description: MsgDepositResponse defines the Msg/Deposit response type. + cosmos.gov.v1.MsgExecLegacyContent: + type: object + properties: + content: + description: content is the proposal's content. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized - methods only use the fully qualified type name after the - last '/' + protocol buffer message. This string must contain at least - in the type URL, for example "foo.bar.com/x/y.z" will yield - type + one "/" character. The last segment of the URL's path must + represent - name "y.z". + the fully qualified name of the type (as in + `path/google.protobuf.Duration`). The name should be in a + canonical form + (e.g., leading "." is not accepted). - JSON - ==== + In practice, teams usually precompile into the binary all types + that they - The JSON representation of an `Any` value uses the regular + expect it to use in the context of Any. However, for URLs which + use the - representation of the deserialized, embedded message, with - an + scheme `http`, `https`, or no scheme, one can optionally set up a + type - additional field `@type` which contains the type URL. - Example: + server that maps type URLs to message definitions as follows: - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + * If no scheme is provided, `https` is assumed. - If the embedded message type is well-known and has a custom - JSON + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - representation, that representation will be embedded adding - a field + Note: this functionality is not currently available in the + official - `value` which holds the custom JSON in addition to the - `@type` + protobuf release, and it is not used for type URLs beginning with - field. Example (for message [google.protobuf.Duration][]): + type.googleapis.com. - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: delegator_addr - description: delegator_addr defines the delegator address to query for. - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - It is less efficient than using key. Only one of offset or key - should + Schemes other than `http`, `https` (or the empty scheme) might be - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. + used with implementation specific semantics. + additionalProperties: {} + authority: + type: string + description: authority must be the gov module address. + description: >- + MsgExecLegacyContent is used to wrap the legacy content field into a + message. - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include + This ensures backwards compatibility with v1beta1.MsgSubmitProposal. + cosmos.gov.v1.MsgExecLegacyContentResponse: + type: object + description: >- + MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response + type. + cosmos.gov.v1.MsgSubmitProposal: + type: object + properties: + messages: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized - a count of the total number of items available for pagination in - UIs. + protocol buffer message. This string must contain at least - count_total is only respected when offset is used. It is ignored - when key + one "/" character. The last segment of the URL's path must + represent - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. + the fully qualified name of the type (as in + `path/google.protobuf.Duration`). The name should be in a + canonical form - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/staking/v1beta1/delegators/{delegator_addr}/validators: - get: - summary: |- - DelegatorValidators queries all validators info for given delegator - address. - description: >- - When called from another module, this query might consume a high amount - of - - gas if the pagination field is incorrectly set. - operationId: CosmosStakingV1Beta1DelegatorValidators - responses: - '200': - description: A successful response. - schema: - type: object - properties: - validators: - type: array - items: - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the validator's - operator; bech encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the - validator, as a Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized + (e.g., leading "." is not accepted). - protocol buffer message. This string must contain at - least - one "/" character. The last segment of the URL's - path must represent + In practice, teams usually precompile into the binary all types + that they - the fully qualified name of the type (as in + expect it to use in the context of Any. However, for URLs which + use the - `path/google.protobuf.Duration`). The name should be - in a canonical form + scheme `http`, `https`, or no scheme, one can optionally set up + a type - (e.g., leading "." is not accepted). + server that maps type URLs to message definitions as follows: - In practice, teams usually precompile into the - binary all types that they + * If no scheme is provided, `https` is assumed. - expect it to use in the context of Any. However, for - URLs which use the + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - scheme `http`, `https`, or no scheme, one can - optionally set up a type + Note: this functionality is not currently available in the + official - server that maps type URLs to message definitions as - follows: + protobuf release, and it is not used for type URLs beginning + with + type.googleapis.com. - * If no scheme is provided, `https` is assumed. - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + Schemes other than `http`, `https` (or the empty scheme) might + be - Note: this functionality is not currently available - in the official + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message along + with a - protobuf release, and it is not used for type URLs - beginning with + URL that describes the type of the serialized message. - type.googleapis.com. + Protobuf library provides support to pack/unpack Any values in the + form - Schemes other than `http`, `https` (or the empty - scheme) might be + of utility functions or additional generated methods of the Any + type. - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed - from bonded status or not. - status: - description: >- - status is the validator status - (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: >- - tokens define the delegated tokens (incl. - self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a - validator's delegators. - description: - description: >- - description defines the description terms for the - validator. - type: object - properties: - moniker: - type: string - description: >- - moniker defines a human-readable name for the - validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. - UPort or Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: >- - security_contact defines an optional email for - security contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height at - which this validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time for - the validator to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission - rates to be used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to - delegators, as a fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate - which validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily - increase of the validator commission, as a - fraction. - update_time: - type: string - format: date-time - description: >- - update_time is the last time the commission rate was - changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared - minimum self delegation. + Example 1: Pack and unpack a message in C++. - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has been - stopped by external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an - unbonding of this validator - description: >- - Validator defines a validator, together with the total - amount of the + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } - Validator's bond shares and their exchange rate to coins. - Slashing results in + Example 2: Pack and unpack a message in Java. - a decrease in the exchange rate, allowing correct - calculation of future + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - undelegations without iterating over delegators. When coins - are delegated to + Example 3: Pack and unpack a message in Python. - this validator, the validator is credited with a delegation - whose number of + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... - bond shares is based on the amount of coins delegated - divided by the current + Example 4: Pack and unpack a message in Go - exchange rate. Voting power can be calculated as total - bonded shares + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } - multiplied by exchange rate. - description: validators defines the validators' info of a delegator. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + The pack methods provided by protobuf library will by default use - was set, its value is undefined otherwise - description: |- - QueryDelegatorValidatorsResponse is response type for the - Query/DelegatorValidators RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized + 'type.googleapis.com/full.type.name' as the type URL and the unpack - protocol buffer message. This string must contain at - least + methods only use the fully qualified type name after the last '/' - one "/" character. The last segment of the URL's path - must represent + in the type URL, for example "foo.bar.com/x/y.z" will yield type - the fully qualified name of the type (as in + name "y.z". - `path/google.protobuf.Duration`). The name should be in - a canonical form - (e.g., leading "." is not accepted). + JSON - In practice, teams usually precompile into the binary - all types that they + The JSON representation of an `Any` value uses the regular - expect it to use in the context of Any. However, for - URLs which use the + representation of the deserialized, embedded message, with an - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: delegator_addr - description: delegator_addr defines the delegator address to query for. - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/staking/v1beta1/delegators/{delegator_addr}/validators/{validator_addr}: - get: - summary: |- - DelegatorValidator queries validator info for given delegator validator - pair. - operationId: CosmosStakingV1Beta1DelegatorValidator - responses: - '200': - description: A successful response. - schema: - type: object - properties: - validator: - description: validator defines the validator info. - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the validator's - operator; bech encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the - validator, as a Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed from - bonded status or not. - status: - description: >- - status is the validator status - (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: >- - tokens define the delegated tokens (incl. - self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a - validator's delegators. - description: - description: >- - description defines the description terms for the - validator. - type: object - properties: - moniker: - type: string - description: >- - moniker defines a human-readable name for the - validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. - UPort or Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: >- - security_contact defines an optional email for - security contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height at - which this validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time for the - validator to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates - to be used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to delegators, - as a fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which - validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase - of the validator commission, as a fraction. - update_time: - type: string - format: date-time - description: >- - update_time is the last time the commission rate was - changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared - minimum self delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has been - stopped by external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an - unbonding of this validator - description: |- - QueryDelegatorValidatorResponse response type for the - Query/DelegatorValidator RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: delegator_addr - description: delegator_addr defines the delegator address to query for. - in: path - required: true - type: string - - name: validator_addr - description: validator_addr defines the validator address to query for. - in: path - required: true - type: string - tags: - - Query - /cosmos/staking/v1beta1/historical_info/{height}: - get: - summary: HistoricalInfo queries the historical info for given height. - operationId: CosmosStakingV1Beta1HistoricalInfo - responses: - '200': - description: A successful response. - schema: - type: object - properties: - hist: - description: hist defines the historical info at the given height. - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing - a block in the blockchain, - - including all blockchain data structures and the rules - of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs from the - previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - valset: - type: array - items: - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the - validator's operator; bech encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the - validator, as a Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must - contain at least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name - should be in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, - for URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message - definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup - results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently - available in the official - - protobuf release, and it is not used for type - URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed - from bonded status or not. - status: - description: >- - status is the validator status - (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: >- - tokens define the delegated tokens (incl. - self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a - validator's delegators. - description: - description: >- - description defines the description terms for the - validator. - type: object - properties: - moniker: - type: string - description: >- - moniker defines a human-readable name for the - validator. - identity: - type: string - description: >- - identity defines an optional identity signature - (ex. UPort or Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: >- - security_contact defines an optional email for - security contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height - at which this validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time - for the validator to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission - rates to be used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to - delegators, as a fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate - which validator can ever charge, as a - fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily - increase of the validator commission, as a - fraction. - update_time: - type: string - format: date-time - description: >- - update_time is the last time the commission rate - was changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared - minimum self delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has - been stopped by external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an - unbonding of this validator - description: >- - Validator defines a validator, together with the total - amount of the - - Validator's bond shares and their exchange rate to - coins. Slashing results in - - a decrease in the exchange rate, allowing correct - calculation of future - - undelegations without iterating over delegators. When - coins are delegated to - - this validator, the validator is credited with a - delegation whose number of - - bond shares is based on the amount of coins delegated - divided by the current - - exchange rate. Voting power can be calculated as total - bonded shares - - multiplied by exchange rate. - description: >- - QueryHistoricalInfoResponse is response type for the - Query/HistoricalInfo RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: height - description: height defines at which height to query the historical info. - in: path - required: true - type: string - format: int64 - tags: - - Query - /cosmos/staking/v1beta1/params: - get: - summary: Parameters queries the staking parameters. - operationId: CosmosStakingV1Beta1Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - properties: - unbonding_time: - type: string - description: unbonding_time is the time duration of unbonding. - max_validators: - type: integer - format: int64 - description: max_validators is the maximum number of validators. - max_entries: - type: integer - format: int64 - description: >- - max_entries is the max entries for either unbonding - delegation or redelegation (per pair/trio). - historical_entries: - type: integer - format: int64 - description: >- - historical_entries is the number of historical entries to - persist. - bond_denom: - type: string - description: bond_denom defines the bondable coin denomination. - min_commission_rate: - type: string - title: >- - min_commission_rate is the chain-wide minimum commission - rate that a validator can charge their delegators - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /cosmos/staking/v1beta1/pool: - get: - summary: Pool queries the pool info. - operationId: CosmosStakingV1Beta1Pool - responses: - '200': - description: A successful response. - schema: - type: object - properties: - pool: - description: pool defines the pool info. - type: object - properties: - not_bonded_tokens: - type: string - bonded_tokens: - type: string - description: QueryPoolResponse is response type for the Query/Pool RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /cosmos/staking/v1beta1/validators: - get: - summary: Validators queries all validators that match the given status. - description: >- - When called from another module, this query might consume a high amount - of - - gas if the pagination field is incorrectly set. - operationId: CosmosStakingV1Beta1Validators - responses: - '200': - description: A successful response. - schema: - type: object - properties: - validators: - type: array - items: - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the validator's - operator; bech encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the - validator, as a Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed - from bonded status or not. - status: - description: >- - status is the validator status - (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: >- - tokens define the delegated tokens (incl. - self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a - validator's delegators. - description: - description: >- - description defines the description terms for the - validator. - type: object - properties: - moniker: - type: string - description: >- - moniker defines a human-readable name for the - validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. - UPort or Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: >- - security_contact defines an optional email for - security contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height at - which this validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time for - the validator to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission - rates to be used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to - delegators, as a fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate - which validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily - increase of the validator commission, as a - fraction. - update_time: - type: string - format: date-time - description: >- - update_time is the last time the commission rate was - changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared - minimum self delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has been - stopped by external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an - unbonding of this validator - description: >- - Validator defines a validator, together with the total - amount of the - - Validator's bond shares and their exchange rate to coins. - Slashing results in - - a decrease in the exchange rate, allowing correct - calculation of future - - undelegations without iterating over delegators. When coins - are delegated to - - this validator, the validator is credited with a delegation - whose number of - - bond shares is based on the amount of coins delegated - divided by the current - - exchange rate. Voting power can be calculated as total - bonded shares - - multiplied by exchange rate. - description: validators contains all the queried validators. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - title: >- - QueryValidatorsResponse is response type for the Query/Validators - RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: status - description: status enables to query for validators matching a given status. - in: query - required: false - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/staking/v1beta1/validators/{validator_addr}: - get: - summary: Validator queries validator info for given validator address. - operationId: CosmosStakingV1Beta1Validator - responses: - '200': - description: A successful response. - schema: - type: object - properties: - validator: - description: validator defines the validator info. - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the validator's - operator; bech encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the - validator, as a Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed from - bonded status or not. - status: - description: >- - status is the validator status - (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: >- - tokens define the delegated tokens (incl. - self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a - validator's delegators. - description: - description: >- - description defines the description terms for the - validator. - type: object - properties: - moniker: - type: string - description: >- - moniker defines a human-readable name for the - validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. - UPort or Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: >- - security_contact defines an optional email for - security contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height at - which this validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time for the - validator to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates - to be used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to delegators, - as a fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which - validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase - of the validator commission, as a fraction. - update_time: - type: string - format: date-time - description: >- - update_time is the last time the commission rate was - changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared - minimum self delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has been - stopped by external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an - unbonding of this validator - title: >- - QueryValidatorResponse is response type for the Query/Validator - RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: validator_addr - description: validator_addr defines the validator address to query for. - in: path - required: true - type: string - tags: - - Query - /cosmos/staking/v1beta1/validators/{validator_addr}/delegations: - get: - summary: ValidatorDelegations queries delegate info for given validator. - description: >- - When called from another module, this query might consume a high amount - of - - gas if the pagination field is incorrectly set. - operationId: CosmosStakingV1Beta1ValidatorDelegations - responses: - '200': - description: A successful response. - schema: - type: object - properties: - delegation_responses: - type: array - items: - type: object - properties: - delegation: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of - the delegator. - validator_address: - type: string - description: >- - validator_address is the bech32-encoded address of - the validator. - shares: - type: string - description: shares define the delegation shares received. - description: >- - Delegation represents the bond with tokens held by an - account. It is - - owned by one delegator, and is associated with the - voting power of one - - validator. - balance: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: >- - DelegationResponse is equivalent to Delegation except that - it contains a - - balance in addition to shares which is more suitable for - client responses. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - title: |- - QueryValidatorDelegationsResponse is response type for the - Query/ValidatorDelegations RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: validator_addr - description: validator_addr defines the validator address to query for. - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/staking/v1beta1/validators/{validator_addr}/delegations/{delegator_addr}: - get: - summary: Delegation queries delegate info for given validator delegator pair. - operationId: CosmosStakingV1Beta1Delegation - responses: - '200': - description: A successful response. - schema: - type: object - properties: - delegation_response: - description: >- - delegation_responses defines the delegation info of a - delegation. - type: object - properties: - delegation: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. - validator_address: - type: string - description: >- - validator_address is the bech32-encoded address of the - validator. - shares: - type: string - description: shares define the delegation shares received. - description: >- - Delegation represents the bond with tokens held by an - account. It is - - owned by one delegator, and is associated with the voting - power of one - - validator. - balance: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: >- - QueryDelegationResponse is response type for the Query/Delegation - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: validator_addr - description: validator_addr defines the validator address to query for. - in: path - required: true - type: string - - name: delegator_addr - description: delegator_addr defines the delegator address to query for. - in: path - required: true - type: string - tags: - - Query - /cosmos/staking/v1beta1/validators/{validator_addr}/delegations/{delegator_addr}/unbonding_delegation: - get: - summary: |- - UnbondingDelegation queries unbonding info for given validator delegator - pair. - operationId: CosmosStakingV1Beta1UnbondingDelegation - responses: - '200': - description: A successful response. - schema: - type: object - properties: - unbond: - description: unbond defines the unbonding information of a delegation. - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. - validator_address: - type: string - description: >- - validator_address is the bech32-encoded address of the - validator. - entries: - type: array - items: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height is the height which the unbonding - took place. - completion_time: - type: string - format: date-time - description: >- - completion_time is the unix time for unbonding - completion. - initial_balance: - type: string - description: >- - initial_balance defines the tokens initially - scheduled to receive at completion. - balance: - type: string - description: balance defines the tokens to receive at completion. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been - stopped by external modules - description: >- - UnbondingDelegationEntry defines an unbonding object - with relevant metadata. - description: |- - entries are the unbonding delegation entries. - - unbonding delegation entries - description: >- - QueryDelegationResponse is response type for the - Query/UnbondingDelegation - - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: validator_addr - description: validator_addr defines the validator address to query for. - in: path - required: true - type: string - - name: delegator_addr - description: delegator_addr defines the delegator address to query for. - in: path - required: true - type: string - tags: - - Query - /cosmos/staking/v1beta1/validators/{validator_addr}/unbonding_delegations: - get: - summary: >- - ValidatorUnbondingDelegations queries unbonding delegations of a - validator. - description: >- - When called from another module, this query might consume a high amount - of - - gas if the pagination field is incorrectly set. - operationId: CosmosStakingV1Beta1ValidatorUnbondingDelegations - responses: - '200': - description: A successful response. - schema: - type: object - properties: - unbonding_responses: - type: array - items: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. - validator_address: - type: string - description: >- - validator_address is the bech32-encoded address of the - validator. - entries: - type: array - items: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height is the height which the unbonding - took place. - completion_time: - type: string - format: date-time - description: >- - completion_time is the unix time for unbonding - completion. - initial_balance: - type: string - description: >- - initial_balance defines the tokens initially - scheduled to receive at completion. - balance: - type: string - description: >- - balance defines the tokens to receive at - completion. - unbonding_id: - type: string - format: uint64 - title: >- - Incrementing id that uniquely identifies this - entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has - been stopped by external modules - description: >- - UnbondingDelegationEntry defines an unbonding object - with relevant metadata. - description: |- - entries are the unbonding delegation entries. - - unbonding delegation entries - description: >- - UnbondingDelegation stores all of a single delegator's - unbonding bonds - - for a single validator in an time-ordered list. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryValidatorUnbondingDelegationsResponse is response type for - the - - Query/ValidatorUnbondingDelegations RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: validator_addr - description: validator_addr defines the validator address to query for. - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/tx/v1beta1/decode: - post: - summary: TxDecode decodes the transaction. - description: 'Since: cosmos-sdk 0.47' - operationId: CosmosTxV1Beta1TxDecode - responses: - '200': - description: A successful response. - schema: - $ref: '#/definitions/cosmos.tx.v1beta1.TxDecodeResponse' - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: body - description: |- - TxDecodeRequest is the request type for the Service.TxDecode - RPC method. - - Since: cosmos-sdk 0.47 - in: body - required: true - schema: - type: object - properties: - tx_bytes: - type: string - format: byte - description: tx_bytes is the raw transaction. - description: |- - TxDecodeRequest is the request type for the Service.TxDecode - RPC method. - - Since: cosmos-sdk 0.47 - tags: - - Service - /cosmos/tx/v1beta1/decode/amino: - post: - summary: TxDecodeAmino decodes an Amino transaction from encoded bytes to JSON. - description: 'Since: cosmos-sdk 0.47' - operationId: CosmosTxV1Beta1TxDecodeAmino - responses: - '200': - description: A successful response. - schema: - type: object - properties: - amino_json: - type: string - description: >- - TxDecodeAminoResponse is the response type for the - Service.TxDecodeAmino - - RPC method. - - - Since: cosmos-sdk 0.47 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: body - description: >- - TxDecodeAminoRequest is the request type for the - Service.TxDecodeAmino - - RPC method. - - - Since: cosmos-sdk 0.47 - in: body - required: true - schema: - type: object - properties: - amino_binary: - type: string - format: byte - description: >- - TxDecodeAminoRequest is the request type for the - Service.TxDecodeAmino - - RPC method. - - - Since: cosmos-sdk 0.47 - tags: - - Service - /cosmos/tx/v1beta1/encode: - post: - summary: TxEncode encodes the transaction. - description: 'Since: cosmos-sdk 0.47' - operationId: CosmosTxV1Beta1TxEncode - responses: - '200': - description: A successful response. - schema: - type: object - properties: - tx_bytes: - type: string - format: byte - description: tx_bytes is the encoded transaction bytes. - description: |- - TxEncodeResponse is the response type for the - Service.TxEncode method. - - Since: cosmos-sdk 0.47 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: body - description: |- - TxEncodeRequest is the request type for the Service.TxEncode - RPC method. - - Since: cosmos-sdk 0.47 - in: body - required: true - schema: - $ref: '#/definitions/cosmos.tx.v1beta1.TxEncodeRequest' - tags: - - Service - /cosmos/tx/v1beta1/encode/amino: - post: - summary: TxEncodeAmino encodes an Amino transaction from JSON to encoded bytes. - description: 'Since: cosmos-sdk 0.47' - operationId: CosmosTxV1Beta1TxEncodeAmino - responses: - '200': - description: A successful response. - schema: - type: object - properties: - amino_binary: - type: string - format: byte - description: >- - TxEncodeAminoResponse is the response type for the - Service.TxEncodeAmino - - RPC method. - - - Since: cosmos-sdk 0.47 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: body - description: >- - TxEncodeAminoRequest is the request type for the - Service.TxEncodeAmino - - RPC method. - - - Since: cosmos-sdk 0.47 - in: body - required: true - schema: - type: object - properties: - amino_json: - type: string - description: >- - TxEncodeAminoRequest is the request type for the - Service.TxEncodeAmino - - RPC method. - - - Since: cosmos-sdk 0.47 - tags: - - Service - /cosmos/tx/v1beta1/simulate: - post: - summary: Simulate simulates executing a transaction for estimating gas usage. - operationId: CosmosTxV1Beta1Simulate - responses: - '200': - description: A successful response. - schema: - type: object - properties: - gas_info: - description: gas_info is the information about gas used in the simulation. - type: object - properties: - gas_wanted: - type: string - format: uint64 - description: >- - GasWanted is the maximum units of work we allow this tx to - perform. - gas_used: - type: string - format: uint64 - description: GasUsed is the amount of gas actually consumed. - result: - description: result is the result of the simulation. - type: object - properties: - data: - type: string - format: byte - description: >- - Data is any data returned from message or handler - execution. It MUST be - - length prefixed in order to separate data from multiple - message executions. - - Deprecated. This field is still populated, but prefer - msg_response instead - - because it also contains the Msg response typeURL. - log: - type: string - description: >- - Log contains the log information from message or handler - execution. - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - index: - type: boolean - title: nondeterministic - description: >- - EventAttribute is a single key-value pair, - associated with an event. - description: >- - Event allows application developers to attach additional - information to - - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx - and ResponseDeliverTx. - - Later, transactions may be queried using these events. - description: >- - Events contains a slice of Event objects that were emitted - during message - - or handler execution. - msg_responses: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message - [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - msg_responses contains the Msg handler responses type - packed in Anys. - - - Since: cosmos-sdk 0.46 - description: |- - SimulateResponse is the response type for the - Service.SimulateRPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: body - description: |- - SimulateRequest is the request type for the Service.Simulate - RPC method. - in: body - required: true - schema: - $ref: '#/definitions/cosmos.tx.v1beta1.SimulateRequest' - tags: - - Service - /cosmos/tx/v1beta1/txs: - get: - summary: GetTxsEvent fetches txs by event. - operationId: CosmosTxV1Beta1GetTxsEvent - responses: - '200': - description: A successful response. - schema: - $ref: '#/definitions/cosmos.tx.v1beta1.GetTxsEventResponse' - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: events - description: events is the list of transaction event type. - in: query - required: false - type: array - items: - type: string - collectionFormat: multi - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - - name: order_by - description: |2- - - ORDER_BY_UNSPECIFIED: ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults to ASC in this case. - - ORDER_BY_ASC: ORDER_BY_ASC defines ascending order - - ORDER_BY_DESC: ORDER_BY_DESC defines descending order - in: query - required: false - type: string - enum: - - ORDER_BY_UNSPECIFIED - - ORDER_BY_ASC - - ORDER_BY_DESC - default: ORDER_BY_UNSPECIFIED - - name: page - description: >- - page is the page number to query, starts at 1. If not provided, will - default to first page. - in: query - required: false - type: string - format: uint64 - - name: limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - tags: - - Service - post: - summary: BroadcastTx broadcast transaction. - operationId: CosmosTxV1Beta1BroadcastTx - responses: - '200': - description: A successful response. - schema: - type: object - properties: - tx_response: - description: tx_response is the queried TxResponses. - type: object - properties: - height: - type: string - format: int64 - title: The block height - txhash: - type: string - description: The transaction hash. - codespace: - type: string - title: Namespace for the Code - code: - type: integer - format: int64 - description: Response code. - data: - type: string - description: Result bytes, if any. - raw_log: - type: string - description: >- - The output of the application's logger (raw string). May - be - - non-deterministic. - logs: - type: array - items: - type: object - properties: - msg_index: - type: integer - format: int64 - log: - type: string - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - description: >- - Attribute defines an attribute wrapper where - the key and value are - - strings instead of raw bytes. - description: >- - StringEvent defines en Event object wrapper where - all the attributes - - contain key/value pairs that are strings instead - of raw bytes. - description: >- - Events contains a slice of Event objects that were - emitted during some - - execution. - description: >- - ABCIMessageLog defines a structure containing an indexed - tx ABCI message log. - description: >- - The output of the application's logger (typed). May be - non-deterministic. - info: - type: string - description: Additional information. May be non-deterministic. - gas_wanted: - type: string - format: int64 - description: Amount of gas requested for transaction. - gas_used: - type: string - format: int64 - description: Amount of gas consumed by transaction. - tx: - description: The request transaction bytes. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - timestamp: - type: string - description: >- - Time of the previous block. For heights > 1, it's the - weighted median of - - the timestamps of the valid votes in the block.LastCommit. - For height == 1, - - it's genesis time. - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - index: - type: boolean - title: nondeterministic - description: >- - EventAttribute is a single key-value pair, - associated with an event. - description: >- - Event allows application developers to attach additional - information to - - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx - and ResponseDeliverTx. - - Later, transactions may be queried using these events. - description: >- - Events defines all the events emitted by processing a - transaction. Note, - - these events include those emitted by processing all the - messages and those - - emitted from the ante. Whereas Logs contains the events, - with - - additional metadata, emitted only by processing the - messages. - - - Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 - description: |- - BroadcastTxResponse is the response type for the - Service.BroadcastTx method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: body - description: >- - BroadcastTxRequest is the request type for the - Service.BroadcastTxRequest - - RPC method. - in: body - required: true - schema: - type: object - properties: - tx_bytes: - type: string - format: byte - description: tx_bytes is the raw transaction. - mode: - type: string - enum: - - BROADCAST_MODE_UNSPECIFIED - - BROADCAST_MODE_BLOCK - - BROADCAST_MODE_SYNC - - BROADCAST_MODE_ASYNC - default: BROADCAST_MODE_UNSPECIFIED - description: >- - BroadcastMode specifies the broadcast mode for the - TxService.Broadcast RPC method. - - - BROADCAST_MODE_UNSPECIFIED: zero-value for mode ordering - - BROADCAST_MODE_BLOCK: DEPRECATED: use BROADCAST_MODE_SYNC instead, - BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x - onwards. - - BROADCAST_MODE_SYNC: BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for - a CheckTx execution response only. - - BROADCAST_MODE_ASYNC: BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns - immediately. - description: >- - BroadcastTxRequest is the request type for the - Service.BroadcastTxRequest - - RPC method. - tags: - - Service - /cosmos/tx/v1beta1/txs/block/{height}: - get: - summary: GetBlockWithTxs fetches a block with decoded txs. - description: 'Since: cosmos-sdk 0.45.2' - operationId: CosmosTxV1Beta1GetBlockWithTxs - responses: - '200': - description: A successful response. - schema: - $ref: '#/definitions/cosmos.tx.v1beta1.GetBlockWithTxsResponse' - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: height - description: height is the height of the block to query. - in: path - required: true - type: string - format: int64 - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Service - /cosmos/tx/v1beta1/txs/{hash}: - get: - summary: GetTx fetches a tx by hash. - operationId: CosmosTxV1Beta1GetTx - responses: - '200': - description: A successful response. - schema: - $ref: '#/definitions/cosmos.tx.v1beta1.GetTxResponse' - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: hash - description: hash is the tx hash to query, encoded as a hex string. - in: path - required: true - type: string - tags: - - Service - /cosmos/upgrade/v1beta1/applied_plan/{name}: - get: - summary: AppliedPlan queries a previously applied upgrade plan by its name. - operationId: CosmosUpgradeV1Beta1AppliedPlan - responses: - '200': - description: A successful response. - schema: - type: object - properties: - height: - type: string - format: int64 - description: height is the block height at which the plan was applied. - description: >- - QueryAppliedPlanResponse is the response type for the - Query/AppliedPlan RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: name - description: name is the name of the applied plan to query for. - in: path - required: true - type: string - tags: - - Query - /cosmos/upgrade/v1beta1/authority: - get: - summary: Returns the account with authority to conduct upgrades - description: 'Since: cosmos-sdk 0.46' - operationId: CosmosUpgradeV1Beta1Authority - responses: - '200': - description: A successful response. - schema: - type: object - properties: - address: - type: string - description: 'Since: cosmos-sdk 0.46' - title: QueryAuthorityResponse is the response type for Query/Authority - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /cosmos/upgrade/v1beta1/current_plan: - get: - summary: CurrentPlan queries the current upgrade plan. - operationId: CosmosUpgradeV1Beta1CurrentPlan - responses: - '200': - description: A successful response. - schema: - type: object - properties: - plan: - description: plan is the current upgrade plan. - type: object - properties: - name: - type: string - description: >- - Sets the name for the upgrade. This name will be used by - the upgraded - - version of the software to apply any special "on-upgrade" - commands during - - the first BeginBlock method after the upgrade is applied. - It is also used - - to detect whether a software version can handle a given - upgrade. If no - - upgrade handler with this name has been set in the - software, it will be - - assumed that the software is out-of-date when the upgrade - Time or Height is - - reached and the software will exit. - time: - type: string - format: date-time - description: >- - Deprecated: Time based upgrades have been deprecated. Time - based upgrade logic - - has been removed from the SDK. - - If this field is not empty, an error will be thrown. - height: - type: string - format: int64 - description: The height at which the upgrade must be performed. - info: - type: string - title: >- - Any application specific upgrade info to be included - on-chain - - such as a git commit that validators could automatically - upgrade to - upgraded_client_state: - description: >- - Deprecated: UpgradedClientState field has been deprecated. - IBC upgrade logic has been - - moved to the IBC module in the sub module 02-client. - - If this field is not empty, an error will be thrown. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - QueryCurrentPlanResponse is the response type for the - Query/CurrentPlan RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /cosmos/upgrade/v1beta1/module_versions: - get: - summary: ModuleVersions queries the list of module versions from state. - description: 'Since: cosmos-sdk 0.43' - operationId: CosmosUpgradeV1Beta1ModuleVersions - responses: - '200': - description: A successful response. - schema: - type: object - properties: - module_versions: - type: array - items: - type: object - properties: - name: - type: string - title: name of the app module - version: - type: string - format: uint64 - title: consensus version of the app module - description: |- - ModuleVersion specifies a module and its consensus version. - - Since: cosmos-sdk 0.43 - description: >- - module_versions is a list of module names with their consensus - versions. - description: >- - QueryModuleVersionsResponse is the response type for the - Query/ModuleVersions - - RPC method. - - - Since: cosmos-sdk 0.43 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: module_name - description: |- - module_name is a field to query a specific module - consensus version from state. Leaving this empty will - fetch the full list of module versions from state - in: query - required: false - type: string - tags: - - Query - /cosmos/upgrade/v1beta1/upgraded_consensus_state/{last_height}: - get: - summary: >- - UpgradedConsensusState queries the consensus state that will serve - - as a trusted kernel for the next version of this chain. It will only be - - stored at the last height of this chain. - - UpgradedConsensusState RPC not supported with legacy querier - - This rpc is deprecated now that IBC has its own replacement - - (https://github.com/cosmos/ibc-go/blob/2c880a22e9f9cc75f62b527ca94aa75ce1106001/proto/ibc/core/client/v1/query.proto#L54) - operationId: CosmosUpgradeV1Beta1UpgradedConsensusState - responses: - '200': - description: A successful response. - schema: - type: object - properties: - upgraded_consensus_state: - type: string - format: byte - title: 'Since: cosmos-sdk 0.43' - description: >- - QueryUpgradedConsensusStateResponse is the response type for the - Query/UpgradedConsensusState - - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: last_height - description: |- - last height of the current chain must be sent in request - as this is the height under which next consensus state is stored - in: path - required: true - type: string - format: int64 - tags: - - Query - /ibc/apps/interchain_accounts/controller/v1/owners/{owner}/connections/{connection_id}: - get: - summary: >- - InterchainAccount returns the interchain account address for a given - owner address on a given connection - operationId: IbcApplicationsInterchainAccountsControllerV1InterchainAccount - responses: - '200': - description: A successful response. - schema: - type: object - properties: - address: - type: string - description: >- - QueryInterchainAccountResponse the response type for the - Query/InterchainAccount RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: owner - in: path - required: true - type: string - - name: connection_id - in: path - required: true - type: string - tags: - - Query - /ibc/apps/interchain_accounts/controller/v1/params: - get: - summary: Params queries all parameters of the ICA controller submodule. - operationId: IbcApplicationsInterchainAccountsControllerV1Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - controller_enabled: - type: boolean - description: >- - controller_enabled enables or disables the controller - submodule. - description: >- - QueryParamsResponse is the response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /ibc/apps/interchain_accounts/host/v1/params: - get: - summary: Params queries all parameters of the ICA host submodule. - operationId: IbcApplicationsInterchainAccountsHostV1Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - host_enabled: - type: boolean - description: host_enabled enables or disables the host submodule. - allow_messages: - type: array - items: - type: string - description: >- - allow_messages defines a list of sdk message typeURLs - allowed to be executed on a host chain. - description: >- - QueryParamsResponse is the response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /ibc/apps/transfer/v1/channels/{channel_id}/ports/{port_id}/escrow_address: - get: - summary: >- - EscrowAddress returns the escrow address for a particular port and - channel id. - operationId: IbcApplicationsTransferV1EscrowAddress - responses: - '200': - description: A successful response. - schema: - type: object - properties: - escrow_address: - type: string - title: the escrow account address - description: >- - QueryEscrowAddressResponse is the response type of the - EscrowAddress RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: unique channel identifier - in: path - required: true - type: string - - name: port_id - description: unique port identifier - in: path - required: true - type: string - tags: - - Query - /ibc/apps/transfer/v1/denom_hashes/{trace}: - get: - summary: DenomHash queries a denomination hash information. - operationId: IbcApplicationsTransferV1DenomHash - responses: - '200': - description: A successful response. - schema: - type: object - properties: - hash: - type: string - description: hash (in hex format) of the denomination trace information. - description: >- - QueryDenomHashResponse is the response type for the - Query/DenomHash RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: trace - description: The denomination trace ([port_id]/[channel_id])+/[denom] - in: path - required: true - type: string - pattern: .+ - tags: - - Query - /ibc/apps/transfer/v1/denom_traces: - get: - summary: DenomTraces queries all denomination traces. - operationId: IbcApplicationsTransferV1DenomTraces - responses: - '200': - description: A successful response. - schema: - type: object - properties: - denom_traces: - type: array - items: - type: object - properties: - path: - type: string - description: >- - path defines the chain of port/channel identifiers used - for tracing the - - source of the fungible token. - base_denom: - type: string - description: base denomination of the relayed fungible token. - description: >- - DenomTrace contains the base denomination for ICS20 fungible - tokens and the - - source tracing information path. - description: denom_traces returns all denominations trace information. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryConnectionsResponse is the response type for the - Query/DenomTraces RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /ibc/apps/transfer/v1/denom_traces/{hash}: - get: - summary: DenomTrace queries a denomination trace information. - operationId: IbcApplicationsTransferV1DenomTrace - responses: - '200': - description: A successful response. - schema: - type: object - properties: - denom_trace: - description: >- - denom_trace returns the requested denomination trace - information. - type: object - properties: - path: - type: string - description: >- - path defines the chain of port/channel identifiers used - for tracing the - - source of the fungible token. - base_denom: - type: string - description: base denomination of the relayed fungible token. - description: >- - QueryDenomTraceResponse is the response type for the - Query/DenomTrace RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: hash - description: >- - hash (in hex format) or denom (full denom with ibc prefix) of the - denomination trace information. - in: path - required: true - type: string - pattern: .+ - tags: - - Query - /ibc/apps/transfer/v1/denoms/{denom}/total_escrow: - get: - summary: >- - TotalEscrowForDenom returns the total amount of tokens in escrow based - on the denom. - operationId: IbcApplicationsTransferV1TotalEscrowForDenom - responses: - '200': - description: A successful response. - schema: - type: object - properties: - amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: >- - QueryTotalEscrowForDenomResponse is the response type for - TotalEscrowForDenom RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: denom - in: path - required: true - type: string - pattern: .+ - tags: - - Query - /ibc/apps/transfer/v1/params: - get: - summary: Params queries all parameters of the ibc-transfer module. - operationId: IbcApplicationsTransferV1Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - send_enabled: - type: boolean - description: >- - send_enabled enables or disables all cross-chain token - transfers from this - - chain. - receive_enabled: - type: boolean - description: >- - receive_enabled enables or disables all cross-chain token - transfers to this - - chain. - description: >- - QueryParamsResponse is the response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /ibc/core/channel/v1/channels: - get: - summary: Channels queries all the IBC channels of a chain. - operationId: IbcCoreChannelV1Channels - responses: - '200': - description: A successful response. - schema: - type: object - properties: - channels: - type: array - items: - type: object - properties: - state: - title: current state of the channel end - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - - STATE_CLOSED - default: STATE_UNINITIALIZED_UNSPECIFIED - description: >- - State defines if a channel is in one of the following - states: - - CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. - - - STATE_UNINITIALIZED_UNSPECIFIED: Default State - - STATE_INIT: A channel has just started the opening handshake. - - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. - - STATE_OPEN: A channel has completed the handshake. Open channels are - ready to send and receive packets. - - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive - packets. - ordering: - title: whether the channel is ordered or unordered - type: string - enum: - - ORDER_NONE_UNSPECIFIED - - ORDER_UNORDERED - - ORDER_ORDERED - default: ORDER_NONE_UNSPECIFIED - description: >- - - ORDER_NONE_UNSPECIFIED: zero-value for channel - ordering - - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in - which they were sent. - - ORDER_ORDERED: packets are delivered exactly in the order which they were sent - counterparty: - title: counterparty channel end - type: object - properties: - port_id: - type: string - description: >- - port on the counterparty chain which owns the other - end of the channel. - channel_id: - type: string - title: channel end on the counterparty chain - connection_hops: - type: array - items: - type: string - title: >- - list of connection identifiers, in order, along which - packets sent on - - this channel will travel - version: - type: string - title: >- - opaque channel version, which is agreed upon during the - handshake - port_id: - type: string - title: port identifier - channel_id: - type: string - title: channel identifier - description: >- - IdentifiedChannel defines a channel with additional port and - channel - - identifier fields. - description: list of stored channels of the chain. - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - description: >- - QueryChannelsResponse is the response type for the Query/Channels - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}: - get: - summary: Channel queries an IBC Channel. - operationId: IbcCoreChannelV1Channel - responses: - '200': - description: A successful response. - schema: - type: object - properties: - channel: - title: channel associated with the request identifiers - type: object - properties: - state: - title: current state of the channel end - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - - STATE_CLOSED - default: STATE_UNINITIALIZED_UNSPECIFIED - description: >- - State defines if a channel is in one of the following - states: - - CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. - - - STATE_UNINITIALIZED_UNSPECIFIED: Default State - - STATE_INIT: A channel has just started the opening handshake. - - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. - - STATE_OPEN: A channel has completed the handshake. Open channels are - ready to send and receive packets. - - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive - packets. - ordering: - title: whether the channel is ordered or unordered - type: string - enum: - - ORDER_NONE_UNSPECIFIED - - ORDER_UNORDERED - - ORDER_ORDERED - default: ORDER_NONE_UNSPECIFIED - description: |- - - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering - - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in - which they were sent. - - ORDER_ORDERED: packets are delivered exactly in the order which they were sent - counterparty: - title: counterparty channel end - type: object - properties: - port_id: - type: string - description: >- - port on the counterparty chain which owns the other - end of the channel. - channel_id: - type: string - title: channel end on the counterparty chain - connection_hops: - type: array - items: - type: string - title: >- - list of connection identifiers, in order, along which - packets sent on - - this channel will travel - version: - type: string - title: >- - opaque channel version, which is agreed upon during the - handshake - description: >- - Channel defines pipeline for exactly-once packet delivery - between specific - - modules on separate blockchains, which has at least one end - capable of - - sending packets and one end capable of receiving packets. - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - description: >- - QueryChannelResponse is the response type for the Query/Channel - RPC method. - - Besides the Channel end, it includes a proof and the height from - which the - - proof was retrieved. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: channel unique identifier - in: path - required: true - type: string - - name: port_id - description: port unique identifier - in: path - required: true - type: string - tags: - - Query - /ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}/client_state: - get: - summary: >- - ChannelClientState queries for the client state for the channel - associated - - with the provided channel identifiers. - operationId: IbcCoreChannelV1ChannelClientState - responses: - '200': - description: A successful response. - schema: - type: object - properties: - identified_client_state: - title: client state associated with the channel - type: object - properties: - client_id: - type: string - title: client identifier - client_state: - title: client state - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - IdentifiedClientState defines a client state with an - additional client - - identifier field. - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryChannelClientStateResponse is the Response type for the - Query/QueryChannelClientState RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: channel unique identifier - in: path - required: true - type: string - - name: port_id - description: port unique identifier - in: path - required: true - type: string - tags: - - Query - /ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}/consensus_state/revision/{revision_number}/height/{revision_height}: - get: - summary: |- - ChannelConsensusState queries for the consensus state for the channel - associated with the provided channel identifiers. - operationId: IbcCoreChannelV1ChannelConsensusState - responses: - '200': - description: A successful response. - schema: - type: object - properties: - consensus_state: - title: consensus state associated with the channel - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - client_id: - type: string - title: client ID associated with the consensus state - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryChannelClientStateResponse is the Response type for the - Query/QueryChannelClientState RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: channel unique identifier - in: path - required: true - type: string - - name: port_id - description: port unique identifier - in: path - required: true - type: string - - name: revision_number - description: revision number of the consensus state - in: path - required: true - type: string - format: uint64 - - name: revision_height - description: revision height of the consensus state - in: path - required: true - type: string - format: uint64 - tags: - - Query - /ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}/next_sequence: - get: - summary: >- - NextSequenceReceive returns the next receive sequence for a given - channel. - operationId: IbcCoreChannelV1NextSequenceReceive - responses: - '200': - description: A successful response. - schema: - type: object - properties: - next_sequence_receive: - type: string - format: uint64 - title: next sequence receive number - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QuerySequenceResponse is the request type for the - Query/QueryNextSequenceReceiveResponse RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: channel unique identifier - in: path - required: true - type: string - - name: port_id - description: port unique identifier - in: path - required: true - type: string - tags: - - Query - /ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}/packet_acknowledgements: - get: - summary: >- - PacketAcknowledgements returns all the packet acknowledgements - associated - - with a channel. - operationId: IbcCoreChannelV1PacketAcknowledgements - responses: - '200': - description: A successful response. - schema: - type: object - properties: - acknowledgements: - type: array - items: - type: object - properties: - port_id: - type: string - description: channel port identifier. - channel_id: - type: string - description: channel unique identifier. - sequence: - type: string - format: uint64 - description: packet sequence. - data: - type: string - format: byte - description: embedded data that represents packet state. - description: >- - PacketState defines the generic type necessary to retrieve - and store - - packet commitments, acknowledgements, and receipts. - - Caller is responsible for knowing the context necessary to - interpret this - - state as a commitment, acknowledgement, or a receipt. - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryPacketAcknowledgemetsResponse is the request type for the - Query/QueryPacketAcknowledgements RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: channel unique identifier - in: path - required: true - type: string - - name: port_id - description: port unique identifier - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - - name: packet_commitment_sequences - description: list of packet sequences - in: query - required: false - type: array - items: - type: string - format: uint64 - collectionFormat: multi - tags: - - Query - /ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}/packet_acks/{sequence}: - get: - summary: PacketAcknowledgement queries a stored packet acknowledgement hash. - operationId: IbcCoreChannelV1PacketAcknowledgement - responses: - '200': - description: A successful response. - schema: - type: object - properties: - acknowledgement: - type: string - format: byte - title: packet associated with the request fields - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: >- - QueryPacketAcknowledgementResponse defines the client query - response for a - - packet which also includes a proof and the height from which the - - proof was retrieved - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: channel unique identifier - in: path - required: true - type: string - - name: port_id - description: port unique identifier - in: path - required: true - type: string - - name: sequence - description: packet sequence - in: path - required: true - type: string - format: uint64 - tags: - - Query - /ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}/packet_commitments: - get: - summary: |- - PacketCommitments returns all the packet commitments hashes associated - with a channel. - operationId: IbcCoreChannelV1PacketCommitments - responses: - '200': - description: A successful response. - schema: - type: object - properties: - commitments: - type: array - items: - type: object - properties: - port_id: - type: string - description: channel port identifier. - channel_id: - type: string - description: channel unique identifier. - sequence: - type: string - format: uint64 - description: packet sequence. - data: - type: string - format: byte - description: embedded data that represents packet state. - description: >- - PacketState defines the generic type necessary to retrieve - and store - - packet commitments, acknowledgements, and receipts. - - Caller is responsible for knowing the context necessary to - interpret this - - state as a commitment, acknowledgement, or a receipt. - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryPacketCommitmentsResponse is the request type for the - Query/QueryPacketCommitments RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: channel unique identifier - in: path - required: true - type: string - - name: port_id - description: port unique identifier - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}/packet_commitments/{packet_ack_sequences}/unreceived_acks: - get: - summary: >- - UnreceivedAcks returns all the unreceived IBC acknowledgements - associated - - with a channel and sequences. - operationId: IbcCoreChannelV1UnreceivedAcks - responses: - '200': - description: A successful response. - schema: - type: object - properties: - sequences: - type: array - items: - type: string - format: uint64 - title: list of unreceived acknowledgement sequences - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryUnreceivedAcksResponse is the response type for the - Query/UnreceivedAcks RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: channel unique identifier - in: path - required: true - type: string - - name: port_id - description: port unique identifier - in: path - required: true - type: string - - name: packet_ack_sequences - description: list of acknowledgement sequences - in: path - required: true - type: array - items: - type: string - format: uint64 - collectionFormat: csv - minItems: 1 - tags: - - Query - /ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}/packet_commitments/{packet_commitment_sequences}/unreceived_packets: - get: - summary: >- - UnreceivedPackets returns all the unreceived IBC packets associated with - a - - channel and sequences. - operationId: IbcCoreChannelV1UnreceivedPackets - responses: - '200': - description: A successful response. - schema: - type: object - properties: - sequences: - type: array - items: - type: string - format: uint64 - title: list of unreceived packet sequences - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryUnreceivedPacketsResponse is the response type for the - Query/UnreceivedPacketCommitments RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: channel unique identifier - in: path - required: true - type: string - - name: port_id - description: port unique identifier - in: path - required: true - type: string - - name: packet_commitment_sequences - description: list of packet sequences - in: path - required: true - type: array - items: - type: string - format: uint64 - collectionFormat: csv - minItems: 1 - tags: - - Query - /ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}/packet_commitments/{sequence}: - get: - summary: PacketCommitment queries a stored packet commitment hash. - operationId: IbcCoreChannelV1PacketCommitment - responses: - '200': - description: A successful response. - schema: - type: object - properties: - commitment: - type: string - format: byte - title: packet associated with the request fields - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: >- - QueryPacketCommitmentResponse defines the client query response - for a packet - - which also includes a proof and the height from which the proof - was - - retrieved - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: channel unique identifier - in: path - required: true - type: string - - name: port_id - description: port unique identifier - in: path - required: true - type: string - - name: sequence - description: packet sequence - in: path - required: true - type: string - format: uint64 - tags: - - Query - /ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}/packet_receipts/{sequence}: - get: - summary: >- - PacketReceipt queries if a given packet sequence has been received on - the - - queried chain - operationId: IbcCoreChannelV1PacketReceipt - responses: - '200': - description: A successful response. - schema: - type: object - properties: - received: - type: boolean - title: success flag for if receipt exists - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: >- - QueryPacketReceiptResponse defines the client query response for a - packet - - receipt which also includes a proof, and the height from which the - proof was - - retrieved - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: channel unique identifier - in: path - required: true - type: string - - name: port_id - description: port unique identifier - in: path - required: true - type: string - - name: sequence - description: packet sequence - in: path - required: true - type: string - format: uint64 - tags: - - Query - /ibc/core/channel/v1/connections/{connection}/channels: - get: - summary: |- - ConnectionChannels queries all the channels associated with a connection - end. - operationId: IbcCoreChannelV1ConnectionChannels - responses: - '200': - description: A successful response. - schema: - type: object - properties: - channels: - type: array - items: - type: object - properties: - state: - title: current state of the channel end - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - - STATE_CLOSED - default: STATE_UNINITIALIZED_UNSPECIFIED - description: >- - State defines if a channel is in one of the following - states: - - CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. - - - STATE_UNINITIALIZED_UNSPECIFIED: Default State - - STATE_INIT: A channel has just started the opening handshake. - - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. - - STATE_OPEN: A channel has completed the handshake. Open channels are - ready to send and receive packets. - - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive - packets. - ordering: - title: whether the channel is ordered or unordered - type: string - enum: - - ORDER_NONE_UNSPECIFIED - - ORDER_UNORDERED - - ORDER_ORDERED - default: ORDER_NONE_UNSPECIFIED - description: >- - - ORDER_NONE_UNSPECIFIED: zero-value for channel - ordering - - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in - which they were sent. - - ORDER_ORDERED: packets are delivered exactly in the order which they were sent - counterparty: - title: counterparty channel end - type: object - properties: - port_id: - type: string - description: >- - port on the counterparty chain which owns the other - end of the channel. - channel_id: - type: string - title: channel end on the counterparty chain - connection_hops: - type: array - items: - type: string - title: >- - list of connection identifiers, in order, along which - packets sent on - - this channel will travel - version: - type: string - title: >- - opaque channel version, which is agreed upon during the - handshake - port_id: - type: string - title: port identifier - channel_id: - type: string - title: channel identifier - description: >- - IdentifiedChannel defines a channel with additional port and - channel - - identifier fields. - description: list of channels associated with a connection. - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryConnectionChannelsResponse is the Response type for the - Query/QueryConnectionChannels RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: connection - description: connection unique identifier - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /ibc/core/client/v1/client_states: - get: - summary: ClientStates queries all the IBC light clients of a chain. - operationId: IbcCoreClientV1ClientStates - responses: - '200': - description: A successful response. - schema: - type: object - properties: - client_states: - type: array - items: - type: object - properties: - client_id: - type: string - title: client identifier - client_state: - title: client state - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message - [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - IdentifiedClientState defines a client state with an - additional client - - identifier field. - description: list of stored ClientStates of the chain. - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - description: >- - QueryClientStatesResponse is the response type for the - Query/ClientStates RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /ibc/core/client/v1/client_states/{client_id}: - get: - summary: ClientState queries an IBC light client. - operationId: IbcCoreClientV1ClientState - responses: - '200': - description: A successful response. - schema: - type: object - properties: - client_state: - title: client state associated with the request identifier - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - description: >- - QueryClientStateResponse is the response type for the - Query/ClientState RPC - - method. Besides the client state, it includes a proof and the - height from - - which the proof was retrieved. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: client_id - description: client state unique identifier - in: path - required: true - type: string - tags: - - Query - /ibc/core/client/v1/client_status/{client_id}: - get: - summary: Status queries the status of an IBC client. - operationId: IbcCoreClientV1ClientStatus - responses: - '200': - description: A successful response. - schema: - type: object - properties: - status: - type: string - description: >- - QueryClientStatusResponse is the response type for the - Query/ClientStatus RPC - - method. It returns the current status of the IBC client. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: client_id - description: client unique identifier - in: path - required: true - type: string - tags: - - Query - /ibc/core/client/v1/consensus_states/{client_id}: - get: - summary: |- - ConsensusStates queries all the consensus state associated with a given - client. - operationId: IbcCoreClientV1ConsensusStates - responses: - '200': - description: A successful response. - schema: - type: object - properties: - consensus_states: - type: array - items: - type: object - properties: - height: - title: consensus state height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each - height while keeping - - RevisionNumber the same. However some consensus - algorithms may choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as - the RevisionHeight - - gets reset - consensus_state: - title: consensus state - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message - [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - ConsensusStateWithHeight defines a consensus state with an - additional height - - field. - title: consensus states associated with the identifier - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - title: |- - QueryConsensusStatesResponse is the response type for the - Query/ConsensusStates RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: client_id - description: client identifier - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /ibc/core/client/v1/consensus_states/{client_id}/heights: - get: - summary: >- - ConsensusStateHeights queries the height of every consensus states - associated with a given client. - operationId: IbcCoreClientV1ConsensusStateHeights - responses: - '200': - description: A successful response. - schema: - type: object - properties: - consensus_state_heights: - type: array - items: - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms - may choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: >- - Height is a monotonically increasing data type - - that can be compared against another Height for the purposes - of updating and - - freezing clients - title: consensus state heights - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - title: |- - QueryConsensusStateHeightsResponse is the response type for the - Query/ConsensusStateHeights RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: client_id - description: client identifier - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /ibc/core/client/v1/consensus_states/{client_id}/revision/{revision_number}/height/{revision_height}: - get: - summary: >- - ConsensusState queries a consensus state associated with a client state - at - - a given height. - operationId: IbcCoreClientV1ConsensusState - responses: - '200': - description: A successful response. - schema: - type: object - properties: - consensus_state: - title: >- - consensus state associated with the client identifier at the - given height - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: >- - QueryConsensusStateResponse is the response type for the - Query/ConsensusState - - RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: client_id - description: client identifier - in: path - required: true - type: string - - name: revision_number - description: consensus state revision number - in: path - required: true - type: string - format: uint64 - - name: revision_height - description: consensus state revision height - in: path - required: true - type: string - format: uint64 - - name: latest_height - description: >- - latest_height overrrides the height field and queries the latest - stored - - ConsensusState - in: query - required: false - type: boolean - tags: - - Query - /ibc/core/client/v1/params: - get: - summary: ClientParams queries all parameters of the ibc client submodule. - operationId: IbcCoreClientV1ClientParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - allowed_clients: - type: array - items: - type: string - description: >- - allowed_clients defines the list of allowed client state - types which can be created - - and interacted with. If a client type is removed from the - allowed clients list, usage - - of this client will be disabled until it is added again to - the list. - description: >- - QueryClientParamsResponse is the response type for the - Query/ClientParams RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /ibc/core/client/v1/upgraded_client_states: - get: - summary: UpgradedClientState queries an Upgraded IBC light client. - operationId: IbcCoreClientV1UpgradedClientState - responses: - '200': - description: A successful response. - schema: - type: object - properties: - upgraded_client_state: - title: client state associated with the request identifier - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: |- - QueryUpgradedClientStateResponse is the response type for the - Query/UpgradedClientState RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /ibc/core/client/v1/upgraded_consensus_states: - get: - summary: UpgradedConsensusState queries an Upgraded IBC consensus state. - operationId: IbcCoreClientV1UpgradedConsensusState - responses: - '200': - description: A successful response. - schema: - type: object - properties: - upgraded_consensus_state: - title: Consensus state associated with the request identifier - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: |- - QueryUpgradedConsensusStateResponse is the response type for the - Query/UpgradedConsensusState RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /ibc/core/connection/v1/client_connections/{client_id}: - get: - summary: |- - ClientConnections queries the connection paths associated with a client - state. - operationId: IbcCoreConnectionV1ClientConnections - responses: - '200': - description: A successful response. - schema: - type: object - properties: - connection_paths: - type: array - items: - type: string - description: slice of all the connection paths associated with a client. - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was generated - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryClientConnectionsResponse is the response type for the - Query/ClientConnections RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: client_id - description: client identifier associated with a connection - in: path - required: true - type: string - tags: - - Query - /ibc/core/connection/v1/connections: - get: - summary: Connections queries all the IBC connections of a chain. - operationId: IbcCoreConnectionV1Connections - responses: - '200': - description: A successful response. - schema: - type: object - properties: - connections: - type: array - items: - type: object - properties: - id: - type: string - description: connection identifier. - client_id: - type: string - description: client associated with this connection. - versions: - type: array - items: - type: object - properties: - identifier: - type: string - title: unique version identifier - features: - type: array - items: - type: string - title: >- - list of features compatible with the specified - identifier - description: >- - Version defines the versioning scheme used to - negotiate the IBC verison in - - the connection handshake. - title: >- - IBC version which can be utilised to determine encodings - or protocols for - - channels or packets utilising this connection - state: - description: current state of the connection end. - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - default: STATE_UNINITIALIZED_UNSPECIFIED - counterparty: - description: counterparty chain associated with this connection. - type: object - properties: - client_id: - type: string - description: >- - identifies the client on the counterparty chain - associated with a given - - connection. - connection_id: - type: string - description: >- - identifies the connection end on the counterparty - chain associated with a - - given connection. - prefix: - description: commitment merkle prefix of the counterparty chain. - type: object - properties: - key_prefix: - type: string - format: byte - title: >- - MerklePrefix is merkle path prefixed to the key. - - The constructed key from the Path and the key will - be append(Path.KeyPath, - - append(Path.KeyPrefix, key...)) - delay_period: - type: string - format: uint64 - description: delay period associated with this connection. - description: >- - IdentifiedConnection defines a connection with additional - connection - - identifier field. - description: list of stored connections of the chain. - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - description: >- - QueryConnectionsResponse is the response type for the - Query/Connections RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /ibc/core/connection/v1/connections/{connection_id}: - get: - summary: Connection queries an IBC connection end. - operationId: IbcCoreConnectionV1Connection - responses: - '200': - description: A successful response. - schema: - type: object - properties: - connection: - title: connection associated with the request identifier - type: object - properties: - client_id: - type: string - description: client associated with this connection. - versions: - type: array - items: - type: object - properties: - identifier: - type: string - title: unique version identifier - features: - type: array - items: - type: string - title: >- - list of features compatible with the specified - identifier - description: >- - Version defines the versioning scheme used to negotiate - the IBC verison in - - the connection handshake. - description: >- - IBC version which can be utilised to determine encodings - or protocols for - - channels or packets utilising this connection. - state: - description: current state of the connection end. - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - default: STATE_UNINITIALIZED_UNSPECIFIED - counterparty: - description: counterparty chain associated with this connection. - type: object - properties: - client_id: - type: string - description: >- - identifies the client on the counterparty chain - associated with a given - - connection. - connection_id: - type: string - description: >- - identifies the connection end on the counterparty - chain associated with a - - given connection. - prefix: - description: commitment merkle prefix of the counterparty chain. - type: object - properties: - key_prefix: - type: string - format: byte - title: >- - MerklePrefix is merkle path prefixed to the key. - - The constructed key from the Path and the key will be - append(Path.KeyPath, - - append(Path.KeyPrefix, key...)) - delay_period: - type: string - format: uint64 - description: >- - delay period that must pass before a consensus state can - be used for - - packet-verification NOTE: delay period logic is only - implemented by some - - clients. - description: >- - ConnectionEnd defines a stateful object on a chain connected - to another - - separate one. - - NOTE: there must only be 2 defined ConnectionEnds to establish - - a connection between two chains. - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - description: >- - QueryConnectionResponse is the response type for the - Query/Connection RPC - - method. Besides the connection end, it includes a proof and the - height from - - which the proof was retrieved. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: connection_id - description: connection unique identifier - in: path - required: true - type: string - tags: - - Query - /ibc/core/connection/v1/connections/{connection_id}/client_state: - get: - summary: |- - ConnectionClientState queries the client state associated with the - connection. - operationId: IbcCoreConnectionV1ConnectionClientState - responses: - '200': - description: A successful response. - schema: - type: object - properties: - identified_client_state: - title: client state associated with the channel - type: object - properties: - client_id: - type: string - title: client identifier - client_state: - title: client state - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - IdentifiedClientState defines a client state with an - additional client - - identifier field. - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryConnectionClientStateResponse is the response type for the - Query/ConnectionClientState RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: connection_id - description: connection identifier - in: path - required: true - type: string - tags: - - Query - /ibc/core/connection/v1/connections/{connection_id}/consensus_state/revision/{revision_number}/height/{revision_height}: - get: - summary: |- - ConnectionConsensusState queries the consensus state associated with the - connection. - operationId: IbcCoreConnectionV1ConnectionConsensusState - responses: - '200': - description: A successful response. - schema: - type: object - properties: - consensus_state: - title: consensus state associated with the channel - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - client_id: - type: string - title: client ID associated with the consensus state - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryConnectionConsensusStateResponse is the response type for the - Query/ConnectionConsensusState RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: connection_id - description: connection identifier - in: path - required: true - type: string - - name: revision_number - in: path - required: true - type: string - format: uint64 - - name: revision_height - in: path - required: true - type: string - format: uint64 - tags: - - Query - /ibc/core/connection/v1/params: - get: - summary: ConnectionParams queries all parameters of the ibc connection submodule. - operationId: IbcCoreConnectionV1ConnectionParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - max_expected_time_per_block: - type: string - format: uint64 - description: >- - maximum expected time per block (in nanoseconds), used to - enforce block delay. This parameter should reflect the - - largest amount of time that the chain might reasonably - take to produce the next block under normal operating - - conditions. A safe choice is 3-5x the expected time per - block. - description: >- - QueryConnectionParamsResponse is the response type for the - Query/ConnectionParams RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /pocket/application/application: - get: - operationId: PocketApplicationApplicationAll - responses: - '200': - description: A successful response. - schema: - type: object - properties: - application: - type: array - items: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the application has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - service_configs: - type: array - items: - type: object - properties: - service: - title: >- - The Service for which the application is - configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a - session for a certain service but with some - additional configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for - the service - title: >- - TODO_TECHDEBT: Name is currently unused but - acts as a reminder than an optional onchain - representation of the service is necessary - title: >- - ApplicationServiceConfig holds the service - configuration the application stakes for - title: >- - The list of services this appliccation is configured to - request service for - delegatee_gateway_addresses: - type: array - items: - type: string - title: >- - The Bech32 encoded addresses for all delegatee Gateways, - in a non-nullable slice - title: >- - Application defines the type used to store an on-chain - definition and state for an application - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /pocket/application/application/{address}: - get: - summary: Queries a list of Application items. - operationId: PocketApplicationApplication - responses: - '200': - description: A successful response. - schema: - type: object - properties: - application: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the application has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - service_configs: - type: array - items: - type: object - properties: - service: - title: The Service for which the application is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a - session for a certain service but with some - additional configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts - as a reminder than an optional onchain - representation of the service is necessary - title: >- - ApplicationServiceConfig holds the service configuration - the application stakes for - title: >- - The list of services this appliccation is configured to - request service for - delegatee_gateway_addresses: - type: array - items: - type: string - title: >- - The Bech32 encoded addresses for all delegatee Gateways, - in a non-nullable slice - title: >- - Application defines the type used to store an on-chain - definition and state for an application - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: address - in: path - required: true - type: string - tags: - - Query - /pocket/application/params: - get: - summary: Parameters queries the parameters of the module. - operationId: PocketApplicationParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - properties: - max_delegated_gateways: - type: string - format: int64 - title: >- - The maximum number of gateways an application can delegate - trust to - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /pocket/gateway/gateway: - get: - operationId: PocketGatewayGatewayAll - responses: - '200': - description: A successful response. - schema: - type: object - properties: - gateway: - type: array - items: - type: object - properties: - address: - type: string - title: The Bech32 address of the gateway - stake: - title: The total amount of uPOKT the gateway has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /pocket/gateway/gateway/{address}: - get: - summary: Queries a list of Gateway items. - operationId: PocketGatewayGateway - responses: - '200': - description: A successful response. - schema: - type: object - properties: - gateway: - type: object - properties: - address: - type: string - title: The Bech32 address of the gateway - stake: - title: The total amount of uPOKT the gateway has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: address - in: path - required: true - type: string - tags: - - Query - /pocket/gateway/params: - get: - summary: Parameters queries the parameters of the module. - operationId: PocketGatewayParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /pocket/pocket/params: - get: - summary: Parameters queries the parameters of the module. - operationId: PocketPocketParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /pocket/service/params: - get: - summary: Parameters queries the parameters of the module. - operationId: PocketServiceParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - properties: - add_service_fee: - type: string - format: uint64 - title: The amount of uPOKT required to add a new service - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /pocket/session/get_session: - get: - summary: Queries a list of GetSession items. - operationId: PocketSessionGetSession - responses: - '200': - description: A successful response. - schema: - type: object - properties: - session: - type: object - properties: - header: - title: The header of the session containing lightweight data - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session - for a certain service but with some additional - configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts - as a reminder than an optional onchain - representation of the service is necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values - using on-chain but is included in the header for - convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the - last block of the session - description: >- - SessionHeader is a lightweight header for a session that - can be passed around. - - It is the minimal amount of data required to hydrate & - retrieve all data relevant to the session. - session_id: - type: string - title: A unique pseudoranom ID for this session - session_number: - type: string - format: int64 - title: The session number since genesis - num_blocks_per_session: - type: string - format: int64 - title: The number of blocks per session when this session started - application: - title: A fully hydrated application object this session is for - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the application has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an - amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - service_configs: - type: array - items: - type: object - properties: - service: - title: >- - The Service for which the application is - configured for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a - session for a certain service but with some - additional configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for - the service - title: >- - TODO_TECHDEBT: Name is currently unused but - acts as a reminder than an optional onchain - representation of the service is necessary - title: >- - ApplicationServiceConfig holds the service - configuration the application stakes for - title: >- - The list of services this appliccation is configured - to request service for - delegatee_gateway_addresses: - type: array - items: - type: string - title: >- - The Bech32 encoded addresses for all delegatee - Gateways, in a non-nullable slice - suppliers: - type: array - items: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the supplier using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the supplier has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an - amount. - - - NOTE: The amount field is an Int which implements - the custom method - - signatures required by gogoproto. - services: - type: array - items: - type: object - properties: - service: - title: >- - The Service for which the supplier is - configured for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a - session for a certain service but with - some additional configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name - for the service - title: >- - TODO_TECHDEBT: Name is currently unused - but acts as a reminder than an optional - onchain representation of the service is - necessary - endpoints: - type: array - items: - type: object - properties: - url: - type: string - title: URL of the endpoint - rpc_type: - title: Type of RPC exposed on the url above - type: string - enum: - - UNKNOWN_RPC - - GRPC - - WEBSOCKET - - JSON_RPC - default: UNKNOWN_RPC - description: |- - - UNKNOWN_RPC: Undefined RPC type - - GRPC: gRPC - - WEBSOCKET: WebSocket - - JSON_RPC: JSON-RPC - configs: - type: array - items: - type: object - properties: - key: - title: Config option key - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options - - TODO_RESEARCH: Should these be configs, - SLAs or something else? There will be - more discussion once we get closer to - implementing on-chain QoS. - - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - value: - type: string - title: Config option value - title: >- - Key-value wrapper for config options, as - proto maps can't be keyed by enums - title: >- - Additional configuration options for the - endpoint - title: >- - SupplierEndpoint message to hold service - configuration details - title: List of endpoints for the service - title: >- - SupplierServiceConfig holds the service - configuration the supplier stakes for - title: The service configs this supplier can support - description: >- - Supplier is the type defining the actor in Pocket - Network that provides RPC services. - title: >- - A fully hydrated set of servicers that are serving the - application - description: >- - Session is a fully hydrated session object that contains all - the information for the Session - - and its parcipants. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: application_address - description: >- - The Bech32 address of the application using cosmos' ScalarDescriptor - to ensure deterministic encoding - in: query - required: false - type: string - - name: service.id - description: >- - For example, what if we want to request a session for a certain - service but with some additional configs that identify it? - - - Unique identifier for the service - in: query - required: false - type: string - - name: service.name - description: >- - TODO_TECHDEBT: Name is currently unused but acts as a reminder than - an optional onchain representation of the service is necessary - - - (Optional) Semantic human readable name for the service - in: query - required: false - type: string - - name: block_height - description: The block height to query the session for - in: query - required: false - type: string - format: int64 - tags: - - Query - /pocket/session/params: - get: - summary: Parameters queries the parameters of the module. - operationId: PocketSessionParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /pocket/supplier/claim/{session_id}/{supplier_address}: - get: - summary: Queries a list of Claim items. - operationId: PocketSupplierClaim - responses: - '200': - description: A successful response. - schema: - type: object - properties: - claim: - type: object - properties: - supplier_address: - type: string - title: the address of the supplier that submitted this claim - session_header: - description: The session header of the session that this claim is for. - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session - for a certain service but with some additional - configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts - as a reminder than an optional onchain - representation of the service is necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values - using on-chain but is included in the header for - convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the - last block of the session - root_hash: - type: string - format: byte - description: Root hash returned from smt.SMST#Root(). - title: >- - Claim is the serialized object stored on-chain for claims - pending to be proven - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: session_id - in: path - required: true - type: string - - name: supplier_address - in: path - required: true - type: string - tags: - - Query - /pocket/supplier/claims: - get: - operationId: PocketSupplierAllClaims - responses: - '200': - description: A successful response. - schema: - type: object - properties: - claim: - type: array - items: - type: object - properties: - supplier_address: - type: string - title: the address of the supplier that submitted this claim - session_header: - description: >- - The session header of the session that this claim is - for. - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a - session for a certain service but with some - additional configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts - as a reminder than an optional onchain - representation of the service is necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above - values using on-chain but is included in the header - for convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the - last block of the session - root_hash: - type: string - format: byte - description: Root hash returned from smt.SMST#Root(). - title: >- - Claim is the serialized object stored on-chain for claims - pending to be proven - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - - name: supplier_address - in: query - required: false - type: string - - name: session_id - in: query - required: false - type: string - - name: session_end_height - in: query - required: false - type: string - format: uint64 - tags: - - Query - /pocket/supplier/params: - get: - summary: Parameters queries the parameters of the module. - operationId: PocketSupplierParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /pocket/supplier/proof: - get: - operationId: PocketSupplierAllProofs - responses: - '200': - description: A successful response. - schema: - type: object - properties: - proof: - type: array - items: - type: object - properties: - supplier_address: - type: string - session_header: - description: >- - The session header of the session that this claim is - for. - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a - session for a certain service but with some - additional configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts - as a reminder than an optional onchain - representation of the service is necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above - values using on-chain but is included in the header - for convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the - last block of the session - closest_merkle_proof: - type: string - format: byte - description: >- - The serialized SMST proof from the `#ClosestProof()` - method. - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - - name: supplier_address - in: query - required: false - type: string - - name: session_id - in: query - required: false - type: string - - name: session_end_height - in: query - required: false - type: string - format: uint64 - tags: - - Query - /pocket/supplier/proof/{session_id}/{supplier_address}: - get: - summary: Queries a list of Proof items. - operationId: PocketSupplierProof - responses: - '200': - description: A successful response. - schema: - type: object - properties: - proof: - type: object - properties: - supplier_address: - type: string - session_header: - description: The session header of the session that this claim is for. - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session - for a certain service but with some additional - configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts - as a reminder than an optional onchain - representation of the service is necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values - using on-chain but is included in the header for - convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the - last block of the session - closest_merkle_proof: - type: string - format: byte - description: >- - The serialized SMST proof from the `#ClosestProof()` - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: session_id - in: path - required: true - type: string - - name: supplier_address - in: path - required: true - type: string - tags: - - Query - /pocket/supplier/supplier/{address}: - get: - summary: Queries a list of Supplier items. - operationId: PocketSupplierSupplier - responses: - '200': - description: A successful response. - schema: - type: object - properties: - supplier: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the supplier using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the supplier has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - services: - type: array - items: - type: object - properties: - service: - title: The Service for which the supplier is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a - session for a certain service but with some - additional configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts - as a reminder than an optional onchain - representation of the service is necessary - endpoints: - type: array - items: - type: object - properties: - url: - type: string - title: URL of the endpoint - rpc_type: - title: Type of RPC exposed on the url above - type: string - enum: - - UNKNOWN_RPC - - GRPC - - WEBSOCKET - - JSON_RPC - - REST - default: UNKNOWN_RPC - description: |- - - UNKNOWN_RPC: Undefined RPC type - - GRPC: gRPC - - WEBSOCKET: WebSocket - - JSON_RPC: JSON-RPC - - REST: REST - configs: - type: array - items: - type: object - properties: - key: - title: Config option key - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options - - TODO_RESEARCH: Should these be configs, - SLAs or something else? There will be - more discussion once we get closer to - implementing on-chain QoS. - - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - value: - type: string - title: Config option value - title: >- - Key-value wrapper for config options, as - proto maps can't be keyed by enums - title: >- - Additional configuration options for the - endpoint - title: >- - SupplierEndpoint message to hold service - configuration details - title: List of endpoints for the service - title: >- - SupplierServiceConfig holds the service configuration - the supplier stakes for - title: The service configs this supplier can support - description: >- - Supplier is the type defining the actor in Pocket Network that - provides RPC services. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: address - in: path - required: true - type: string - tags: - - Query - /pocket/supplier/suppliers: - get: - operationId: PocketSupplierSupplierAll - responses: - '200': - description: A successful response. - schema: - type: object - properties: - supplier: - type: array - items: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the supplier using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the supplier has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - services: - type: array - items: - type: object - properties: - service: - title: The Service for which the supplier is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a - session for a certain service but with some - additional configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for - the service - title: >- - TODO_TECHDEBT: Name is currently unused but - acts as a reminder than an optional onchain - representation of the service is necessary - endpoints: - type: array - items: - type: object - properties: - url: - type: string - title: URL of the endpoint - rpc_type: - title: Type of RPC exposed on the url above - type: string - enum: - - UNKNOWN_RPC - - GRPC - - WEBSOCKET - - JSON_RPC - - REST - default: UNKNOWN_RPC - description: |- - - UNKNOWN_RPC: Undefined RPC type - - GRPC: gRPC - - WEBSOCKET: WebSocket - - JSON_RPC: JSON-RPC - - REST: REST - configs: - type: array - items: - type: object - properties: - key: - title: Config option key - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options - - TODO_RESEARCH: Should these be configs, - SLAs or something else? There will be - more discussion once we get closer to - implementing on-chain QoS. - - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - value: - type: string - title: Config option value - title: >- - Key-value wrapper for config options, as - proto maps can't be keyed by enums - title: >- - Additional configuration options for the - endpoint - title: >- - SupplierEndpoint message to hold service - configuration details - title: List of endpoints for the service - title: >- - SupplierServiceConfig holds the service configuration - the supplier stakes for - title: The service configs this supplier can support - description: >- - Supplier is the type defining the actor in Pocket Network - that provides RPC services. - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /pokt-network/poktroll/tokenomics/params: - get: - summary: Parameters queries the parameters of the module. - operationId: PocketTokenomicsParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - compute_units_to_tokens_multiplier: - type: string - format: uint64 - description: >- - The amount of upokt that a compute unit should translate - to when settling a session. - - TODO_DOCUMENT(@Olshansk): Make sure to document the units - of this parameter (or the map) once finalized. - description: >- - QueryParamsResponse is the response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query -definitions: - cosmos.auth.v1beta1.AddressBytesToStringResponse: - type: object - properties: - address_string: - type: string - description: >- - AddressBytesToStringResponse is the response type for AddressString rpc - method. - - - Since: cosmos-sdk 0.46 - cosmos.auth.v1beta1.AddressStringToBytesResponse: - type: object - properties: - address_bytes: - type: string - format: byte - description: >- - AddressStringToBytesResponse is the response type for AddressBytes rpc - method. - - - Since: cosmos-sdk 0.46 - cosmos.auth.v1beta1.BaseAccount: - type: object - properties: - address: - type: string - pub_key: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - account_number: - type: string - format: uint64 - sequence: - type: string - format: uint64 - description: >- - BaseAccount defines a base account type. It contains all the necessary - fields - - for basic account functionality. Any custom account type should extend - this - - type for additional functionality (e.g. vesting). - cosmos.auth.v1beta1.Bech32PrefixResponse: - type: object - properties: - bech32_prefix: - type: string - description: |- - Bech32PrefixResponse is the response type for Bech32Prefix rpc method. - - Since: cosmos-sdk 0.46 - cosmos.auth.v1beta1.MsgUpdateParamsResponse: - type: object - description: |- - MsgUpdateParamsResponse defines the response structure for executing a - MsgUpdateParams message. - - Since: cosmos-sdk 0.47 - cosmos.auth.v1beta1.Params: - type: object - properties: - max_memo_characters: - type: string - format: uint64 - tx_sig_limit: - type: string - format: uint64 - tx_size_cost_per_byte: - type: string - format: uint64 - sig_verify_cost_ed25519: - type: string - format: uint64 - sig_verify_cost_secp256k1: - type: string - format: uint64 - description: Params defines the parameters for the auth module. - cosmos.auth.v1beta1.QueryAccountAddressByIDResponse: - type: object - properties: - account_address: - type: string - description: 'Since: cosmos-sdk 0.46.2' - title: >- - QueryAccountAddressByIDResponse is the response type for - AccountAddressByID rpc method - cosmos.auth.v1beta1.QueryAccountInfoResponse: - type: object - properties: - info: - description: info is the account info which is represented by BaseAccount. - type: object - properties: - address: - type: string - pub_key: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - account_number: - type: string - format: uint64 - sequence: - type: string - format: uint64 - description: |- - QueryAccountInfoResponse is the Query/AccountInfo response type. - - Since: cosmos-sdk 0.47 - cosmos.auth.v1beta1.QueryAccountResponse: - type: object - properties: - account: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - QueryAccountResponse is the response type for the Query/Account RPC - method. - cosmos.auth.v1beta1.QueryAccountsResponse: - type: object - properties: - accounts: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up - a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - title: accounts are the existing accounts - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryAccountsResponse is the response type for the Query/Accounts RPC - method. - - - Since: cosmos-sdk 0.43 - cosmos.auth.v1beta1.QueryModuleAccountByNameResponse: - type: object - properties: - account: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - QueryModuleAccountByNameResponse is the response type for the - Query/ModuleAccountByName RPC method. - cosmos.auth.v1beta1.QueryModuleAccountsResponse: - type: object - properties: - accounts: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up - a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - QueryModuleAccountsResponse is the response type for the - Query/ModuleAccounts RPC method. - - - Since: cosmos-sdk 0.46 - cosmos.auth.v1beta1.QueryParamsResponse: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - max_memo_characters: - type: string - format: uint64 - tx_sig_limit: - type: string - format: uint64 - tx_size_cost_per_byte: - type: string - format: uint64 - sig_verify_cost_ed25519: - type: string - format: uint64 - sig_verify_cost_secp256k1: - type: string - format: uint64 - description: QueryParamsResponse is the response type for the Query/Params RPC method. - cosmos.base.query.v1beta1.PageRequest: - type: object - properties: - key: - type: string - format: byte - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - offset: - type: string - format: uint64 - description: |- - offset is a numeric offset that can be used when key is unavailable. - It is less efficient than using key. Only one of offset or key should - be set. - limit: - type: string - format: uint64 - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - count_total: - type: boolean - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in UIs. - - count_total is only respected when offset is used. It is ignored when - key - - is set. - reverse: - type: boolean - description: >- - reverse is set to true if results are to be returned in the descending - order. - - - Since: cosmos-sdk 0.43 - description: |- - message SomeRequest { - Foo some_parameter = 1; - PageRequest pagination = 2; - } - title: |- - PageRequest is to be embedded in gRPC request messages for efficient - pagination. Ex: - cosmos.base.query.v1beta1.PageResponse: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: |- - total is total number of results available if PageRequest.count_total - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - google.protobuf.Any: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a canonical - form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types that - they - - expect it to use in the context of Any. However, for URLs which use - the - - scheme `http`, `https`, or no scheme, one can optionally set up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along with - a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - google.rpc.Status: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up - a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - cosmos.authz.v1beta1.Grant: - type: object - properties: - authorization: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - expiration: - type: string - format: date-time - title: >- - time when the grant will expire and will be pruned. If null, then the - grant - - doesn't have a time expiration (other conditions in `authorization` - - may apply to invalidate the grant) - description: |- - Grant gives permissions to execute - the provide method with expiration time. - cosmos.authz.v1beta1.GrantAuthorization: - type: object - properties: - granter: - type: string - grantee: - type: string - authorization: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - expiration: - type: string - format: date-time - title: >- - GrantAuthorization extends a grant with both the addresses of the grantee - and granter. - - It is used in genesis.proto and query.proto - cosmos.authz.v1beta1.MsgExecResponse: - type: object - properties: - results: - type: array - items: - type: string - format: byte - description: MsgExecResponse defines the Msg/MsgExecResponse response type. - cosmos.authz.v1beta1.MsgGrantResponse: - type: object - description: MsgGrantResponse defines the Msg/MsgGrant response type. - cosmos.authz.v1beta1.MsgRevokeResponse: - type: object - description: MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. - cosmos.authz.v1beta1.QueryGranteeGrantsResponse: - type: object - properties: - grants: - type: array - items: - type: object - properties: - granter: - type: string - grantee: - type: string - authorization: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - expiration: - type: string - format: date-time - title: >- - GrantAuthorization extends a grant with both the addresses of the - grantee and granter. - - It is used in genesis.proto and query.proto - description: grants is a list of grants granted to the grantee. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGranteeGrantsResponse is the response type for the - Query/GranteeGrants RPC method. - cosmos.authz.v1beta1.QueryGranterGrantsResponse: - type: object - properties: - grants: - type: array - items: - type: object - properties: - granter: - type: string - grantee: - type: string - authorization: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - expiration: - type: string - format: date-time - title: >- - GrantAuthorization extends a grant with both the addresses of the - grantee and granter. - - It is used in genesis.proto and query.proto - description: grants is a list of grants granted by the granter. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGranterGrantsResponse is the response type for the - Query/GranterGrants RPC method. - cosmos.authz.v1beta1.QueryGrantsResponse: - type: object - properties: - grants: - type: array - items: - type: object - properties: - authorization: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - expiration: - type: string - format: date-time - title: >- - time when the grant will expire and will be pruned. If null, - then the grant - - doesn't have a time expiration (other conditions in - `authorization` - - may apply to invalidate the grant) - description: |- - Grant gives permissions to execute - the provide method with expiration time. - description: authorizations is a list of grants granted for grantee by granter. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGrantsResponse is the response type for the Query/Authorizations RPC - method. - cosmos.bank.v1beta1.DenomOwner: - type: object - properties: - address: - type: string - description: address defines the address that owns a particular denomination. - balance: - description: balance is the balance of the denominated coin for an account. - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DenomOwner defines structure representing an account that owns or holds a - particular denominated token. It contains the account address and account - balance of the denominated token. - - Since: cosmos-sdk 0.46 - cosmos.bank.v1beta1.DenomUnit: - type: object - properties: - denom: - type: string - description: denom represents the string name of the given denom unit (e.g uatom). - exponent: - type: integer - format: int64 - description: >- - exponent represents power of 10 exponent that one must - - raise the base_denom to in order to equal the given DenomUnit's denom - - 1 denom = 10^exponent base_denom - - (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' - with - - exponent = 6, thus: 1 atom = 10^6 uatom). - aliases: - type: array - items: - type: string - title: aliases is a list of string aliases for the given denom - description: |- - DenomUnit represents a struct that describes a given - denomination unit of the basic token. - cosmos.bank.v1beta1.Input: - type: object - properties: - address: - type: string - coins: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: Input models transaction input. - cosmos.bank.v1beta1.Metadata: - type: object - properties: - description: - type: string - denom_units: - type: array - items: - type: object - properties: - denom: - type: string - description: >- - denom represents the string name of the given denom unit (e.g - uatom). - exponent: - type: integer - format: int64 - description: >- - exponent represents power of 10 exponent that one must - - raise the base_denom to in order to equal the given DenomUnit's - denom - - 1 denom = 10^exponent base_denom - - (e.g. with a base_denom of uatom, one can create a DenomUnit of - 'atom' with - - exponent = 6, thus: 1 atom = 10^6 uatom). - aliases: - type: array - items: - type: string - title: aliases is a list of string aliases for the given denom - description: |- - DenomUnit represents a struct that describes a given - denomination unit of the basic token. - title: denom_units represents the list of DenomUnit's for a given coin - base: - type: string - description: >- - base represents the base denom (should be the DenomUnit with exponent - = 0). - display: - type: string - description: |- - display indicates the suggested denom that should be - displayed in clients. - name: - type: string - description: 'Since: cosmos-sdk 0.43' - title: 'name defines the name of the token (eg: Cosmos Atom)' - symbol: - type: string - description: >- - symbol is the token symbol usually shown on exchanges (eg: ATOM). This - can - - be the same as the display. - - - Since: cosmos-sdk 0.43 - uri: - type: string - description: >- - URI to a document (on or off-chain) that contains additional - information. Optional. - - - Since: cosmos-sdk 0.46 - uri_hash: - type: string - description: >- - URIHash is a sha256 hash of a document pointed by URI. It's used to - verify that - - the document didn't change. Optional. - - - Since: cosmos-sdk 0.46 - description: |- - Metadata represents a struct that describes - a basic token. - cosmos.bank.v1beta1.MsgMultiSendResponse: - type: object - description: MsgMultiSendResponse defines the Msg/MultiSend response type. - cosmos.bank.v1beta1.MsgSendResponse: - type: object - description: MsgSendResponse defines the Msg/Send response type. - cosmos.bank.v1beta1.MsgSetSendEnabledResponse: - type: object - description: |- - MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. - - Since: cosmos-sdk 0.47 - cosmos.bank.v1beta1.MsgUpdateParamsResponse: - type: object - description: |- - MsgUpdateParamsResponse defines the response structure for executing a - MsgUpdateParams message. - - Since: cosmos-sdk 0.47 - cosmos.bank.v1beta1.Output: - type: object - properties: - address: - type: string - coins: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: Output models transaction outputs. - cosmos.bank.v1beta1.Params: - type: object - properties: - send_enabled: - type: array - items: - type: object - properties: - denom: - type: string - enabled: - type: boolean - description: >- - SendEnabled maps coin denom to a send_enabled status (whether a - denom is - - sendable). - description: >- - Deprecated: Use of SendEnabled in params is deprecated. - - For genesis, use the newly added send_enabled field in the genesis - object. - - Storage, lookup, and manipulation of this information is now in the - keeper. - - - As of cosmos-sdk 0.47, this only exists for backwards compatibility of - genesis files. - default_send_enabled: - type: boolean - description: Params defines the parameters for the bank module. - cosmos.bank.v1beta1.QueryAllBalancesResponse: - type: object - properties: - balances: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: balances is the balances of all the coins. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryAllBalancesResponse is the response type for the Query/AllBalances - RPC - - method. - cosmos.bank.v1beta1.QueryBalanceResponse: - type: object - properties: - balance: - description: balance is the balance of the coin. - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - QueryBalanceResponse is the response type for the Query/Balance RPC - method. - cosmos.bank.v1beta1.QueryDenomMetadataResponse: - type: object - properties: - metadata: - description: >- - metadata describes and provides all the client information for the - requested token. - type: object - properties: - description: - type: string - denom_units: - type: array - items: - type: object - properties: - denom: - type: string - description: >- - denom represents the string name of the given denom unit - (e.g uatom). - exponent: - type: integer - format: int64 - description: >- - exponent represents power of 10 exponent that one must - - raise the base_denom to in order to equal the given - DenomUnit's denom - - 1 denom = 10^exponent base_denom - - (e.g. with a base_denom of uatom, one can create a DenomUnit - of 'atom' with - - exponent = 6, thus: 1 atom = 10^6 uatom). - aliases: - type: array - items: - type: string - title: aliases is a list of string aliases for the given denom - description: |- - DenomUnit represents a struct that describes a given - denomination unit of the basic token. - title: denom_units represents the list of DenomUnit's for a given coin - base: - type: string - description: >- - base represents the base denom (should be the DenomUnit with - exponent = 0). - display: - type: string - description: |- - display indicates the suggested denom that should be - displayed in clients. - name: - type: string - description: 'Since: cosmos-sdk 0.43' - title: 'name defines the name of the token (eg: Cosmos Atom)' - symbol: - type: string - description: >- - symbol is the token symbol usually shown on exchanges (eg: ATOM). - This can - - be the same as the display. - - - Since: cosmos-sdk 0.43 - uri: - type: string - description: >- - URI to a document (on or off-chain) that contains additional - information. Optional. - - - Since: cosmos-sdk 0.46 - uri_hash: - type: string - description: >- - URIHash is a sha256 hash of a document pointed by URI. It's used - to verify that - - the document didn't change. Optional. - - - Since: cosmos-sdk 0.46 - description: >- - QueryDenomMetadataResponse is the response type for the - Query/DenomMetadata RPC - - method. - cosmos.bank.v1beta1.QueryDenomOwnersResponse: - type: object - properties: - denom_owners: - type: array - items: - type: object - properties: - address: - type: string - description: address defines the address that owns a particular denomination. - balance: - description: balance is the balance of the denominated coin for an account. - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DenomOwner defines structure representing an account that owns or - holds a - - particular denominated token. It contains the account address and - account - - balance of the denominated token. - - - Since: cosmos-sdk 0.46 - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC - query. - - - Since: cosmos-sdk 0.46 - cosmos.bank.v1beta1.QueryDenomsMetadataResponse: - type: object - properties: - metadatas: - type: array - items: - type: object - properties: - description: - type: string - denom_units: - type: array - items: - type: object - properties: - denom: - type: string - description: >- - denom represents the string name of the given denom unit - (e.g uatom). - exponent: - type: integer - format: int64 - description: >- - exponent represents power of 10 exponent that one must - - raise the base_denom to in order to equal the given - DenomUnit's denom - - 1 denom = 10^exponent base_denom - - (e.g. with a base_denom of uatom, one can create a - DenomUnit of 'atom' with - - exponent = 6, thus: 1 atom = 10^6 uatom). - aliases: - type: array - items: - type: string - title: aliases is a list of string aliases for the given denom - description: |- - DenomUnit represents a struct that describes a given - denomination unit of the basic token. - title: denom_units represents the list of DenomUnit's for a given coin - base: - type: string - description: >- - base represents the base denom (should be the DenomUnit with - exponent = 0). - display: - type: string - description: |- - display indicates the suggested denom that should be - displayed in clients. - name: - type: string - description: 'Since: cosmos-sdk 0.43' - title: 'name defines the name of the token (eg: Cosmos Atom)' - symbol: - type: string - description: >- - symbol is the token symbol usually shown on exchanges (eg: - ATOM). This can - - be the same as the display. - - - Since: cosmos-sdk 0.43 - uri: - type: string - description: >- - URI to a document (on or off-chain) that contains additional - information. Optional. - - - Since: cosmos-sdk 0.46 - uri_hash: - type: string - description: >- - URIHash is a sha256 hash of a document pointed by URI. It's used - to verify that - - the document didn't change. Optional. - - - Since: cosmos-sdk 0.46 - description: |- - Metadata represents a struct that describes - a basic token. - description: >- - metadata provides the client information for all the registered - tokens. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryDenomsMetadataResponse is the response type for the - Query/DenomsMetadata RPC - - method. - cosmos.bank.v1beta1.QueryParamsResponse: - type: object - properties: - params: - type: object - properties: - send_enabled: - type: array - items: - type: object - properties: - denom: - type: string - enabled: - type: boolean - description: >- - SendEnabled maps coin denom to a send_enabled status (whether a - denom is - - sendable). - description: >- - Deprecated: Use of SendEnabled in params is deprecated. - - For genesis, use the newly added send_enabled field in the genesis - object. - - Storage, lookup, and manipulation of this information is now in - the keeper. - - - As of cosmos-sdk 0.47, this only exists for backwards - compatibility of genesis files. - default_send_enabled: - type: boolean - description: Params defines the parameters for the bank module. - description: >- - QueryParamsResponse defines the response type for querying x/bank - parameters. - cosmos.bank.v1beta1.QuerySendEnabledResponse: - type: object - properties: - send_enabled: - type: array - items: - type: object - properties: - denom: - type: string - enabled: - type: boolean - description: >- - SendEnabled maps coin denom to a send_enabled status (whether a - denom is - - sendable). - pagination: - description: |- - pagination defines the pagination in the response. This field is only - populated if the denoms field in the request is empty. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QuerySendEnabledResponse defines the RPC response of a SendEnable query. - - Since: cosmos-sdk 0.47 - cosmos.bank.v1beta1.QuerySpendableBalanceByDenomResponse: - type: object - properties: - balance: - description: balance is the balance of the coin. - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - QuerySpendableBalanceByDenomResponse defines the gRPC response structure - for - - querying an account's spendable balance for a specific denom. - - - Since: cosmos-sdk 0.47 - cosmos.bank.v1beta1.QuerySpendableBalancesResponse: - type: object - properties: - balances: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: balances is the spendable balances of all the coins. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QuerySpendableBalancesResponse defines the gRPC response structure for - querying - - an account's spendable balances. - - - Since: cosmos-sdk 0.46 - cosmos.bank.v1beta1.QuerySupplyOfResponse: - type: object - properties: - amount: - description: amount is the supply of the coin. - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC - method. - cosmos.bank.v1beta1.QueryTotalSupplyResponse: - type: object - properties: - supply: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - title: supply is the supply of the coins - pagination: - description: |- - pagination defines the pagination in the response. - - Since: cosmos-sdk 0.43 - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - title: >- - QueryTotalSupplyResponse is the response type for the Query/TotalSupply - RPC - - method - cosmos.bank.v1beta1.SendEnabled: - type: object - properties: - denom: - type: string - enabled: - type: boolean - description: |- - SendEnabled maps coin denom to a send_enabled status (whether a denom is - sendable). - cosmos.base.v1beta1.Coin: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - cosmos.base.node.v1beta1.ConfigResponse: - type: object - properties: - minimum_gas_price: - type: string - description: ConfigResponse defines the response structure for the Config gRPC query. - cosmos.base.tendermint.v1beta1.ABCIQueryResponse: - type: object - properties: - code: - type: integer - format: int64 - log: - type: string - title: nondeterministic - info: - type: string - title: nondeterministic - index: - type: string - format: int64 - key: - type: string - format: byte - value: - type: string - format: byte - proof_ops: - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - description: >- - ProofOp defines an operation used for calculating Merkle root. - The data could - - be arbitrary format, providing necessary data for example - neighbouring node - - hash. - - - Note: This type is a duplicate of the ProofOp proto type defined - in Tendermint. - description: >- - ProofOps is Merkle proof defined by the list of ProofOps. - - - Note: This type is a duplicate of the ProofOps proto type defined in - Tendermint. - height: - type: string - format: int64 - codespace: - type: string - description: >- - ABCIQueryResponse defines the response structure for the ABCIQuery gRPC - query. - - - Note: This type is a duplicate of the ResponseQuery proto type defined in - - Tendermint. - cosmos.base.tendermint.v1beta1.Block: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block in - the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - description: >- - proposer_address is the original block proposer address, formatted - as a Bech32 string. - - In Tendermint, this type is `bytes`, but in the SDK, we convert it - to a Bech32 string - - for better UX. - - - original proposer of the block - description: Header defines the structure of a Tendermint block header. - data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. - - NOTE: not all txs here are valid. We're just agreeing on the - order first. - - This means that block.AppHash does not include these txs. - title: Data contains the set of transactions included in the block - evidence: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a validator - signed two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for - processing a block in the blockchain, - - including all blockchain data structures and - the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs from - the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included - in a Commit. - description: >- - Commit contains the evidence that a block was - committed by a set of validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use - with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use with - Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a set of - validators attempting to mislead a light client. - last_commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - description: >- - Commit contains the evidence that a block was committed by a set of - validators. - description: |- - Block is tendermint type Block, with the Header proposer address - field converted to bech32 string. - cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse: - type: object - properties: - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - block: - title: 'Deprecated: please use `sdk_block` instead' - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block - in the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. - - NOTE: not all txs here are valid. We're just agreeing on the - order first. - - This means that block.AppHash does not include these txs. - title: Data contains the set of transactions included in the block - evidence: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a validator - signed two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules - for processing a block in the - blockchain, - - including all blockchain data structures - and the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: >- - commit from validators from the last - block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs - from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: >- - Header defines the structure of a block - header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included - in a Commit. - description: >- - Commit contains the evidence that a block - was committed by a set of validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use - with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a set of - validators attempting to mislead a light client. - last_commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - description: >- - Commit contains the evidence that a block was committed by a set - of validators. - sdk_block: - title: 'Since: cosmos-sdk 0.47' - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block - in the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - description: >- - proposer_address is the original block proposer address, - formatted as a Bech32 string. - - In Tendermint, this type is `bytes`, but in the SDK, we - convert it to a Bech32 string - - for better UX. - - - original proposer of the block - description: Header defines the structure of a Tendermint block header. - data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. - - NOTE: not all txs here are valid. We're just agreeing on the - order first. - - This means that block.AppHash does not include these txs. - title: Data contains the set of transactions included in the block - evidence: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a validator - signed two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules - for processing a block in the - blockchain, - - including all blockchain data structures - and the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: >- - commit from validators from the last - block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs - from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: >- - Header defines the structure of a block - header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included - in a Commit. - description: >- - Commit contains the evidence that a block - was committed by a set of validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use - with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a set of - validators attempting to mislead a light client. - last_commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - description: >- - Commit contains the evidence that a block was committed by a set - of validators. - description: |- - Block is tendermint type Block, with the Header proposer address - field converted to bech32 string. - description: >- - GetBlockByHeightResponse is the response type for the - Query/GetBlockByHeight RPC method. - cosmos.base.tendermint.v1beta1.GetLatestBlockResponse: - type: object - properties: - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - block: - title: 'Deprecated: please use `sdk_block` instead' - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block - in the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. - - NOTE: not all txs here are valid. We're just agreeing on the - order first. - - This means that block.AppHash does not include these txs. - title: Data contains the set of transactions included in the block - evidence: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a validator - signed two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules - for processing a block in the - blockchain, - - including all blockchain data structures - and the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: >- - commit from validators from the last - block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs - from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: >- - Header defines the structure of a block - header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included - in a Commit. - description: >- - Commit contains the evidence that a block - was committed by a set of validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use - with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a set of - validators attempting to mislead a light client. - last_commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - description: >- - Commit contains the evidence that a block was committed by a set - of validators. - sdk_block: - title: 'Since: cosmos-sdk 0.47' - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block - in the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - description: >- - proposer_address is the original block proposer address, - formatted as a Bech32 string. - - In Tendermint, this type is `bytes`, but in the SDK, we - convert it to a Bech32 string - - for better UX. - - - original proposer of the block - description: Header defines the structure of a Tendermint block header. - data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. - - NOTE: not all txs here are valid. We're just agreeing on the - order first. - - This means that block.AppHash does not include these txs. - title: Data contains the set of transactions included in the block - evidence: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a validator - signed two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules - for processing a block in the - blockchain, - - including all blockchain data structures - and the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: >- - commit from validators from the last - block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs - from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: >- - Header defines the structure of a block - header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included - in a Commit. - description: >- - Commit contains the evidence that a block - was committed by a set of validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use - with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a set of - validators attempting to mislead a light client. - last_commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - description: >- - Commit contains the evidence that a block was committed by a set - of validators. - description: |- - Block is tendermint type Block, with the Header proposer address - field converted to bech32 string. - description: >- - GetLatestBlockResponse is the response type for the Query/GetLatestBlock - RPC method. - cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse: - type: object - properties: - block_height: - type: string - format: int64 - validators: - type: array - items: - type: object - properties: - address: - type: string - pub_key: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - description: Validator is the type for the validator-set. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - GetLatestValidatorSetResponse is the response type for the - Query/GetValidatorSetByHeight RPC method. - cosmos.base.tendermint.v1beta1.GetNodeInfoResponse: - type: object - properties: - default_node_info: - type: object - properties: - protocol_version: - type: object - properties: - p2p: - type: string - format: uint64 - block: - type: string - format: uint64 - app: - type: string - format: uint64 - default_node_id: - type: string - listen_addr: - type: string - network: - type: string - version: - type: string - channels: - type: string - format: byte - moniker: - type: string - other: - type: object - properties: - tx_index: - type: string - rpc_address: - type: string - application_version: - type: object - properties: - name: - type: string - app_name: - type: string - version: - type: string - git_commit: - type: string - build_tags: - type: string - go_version: - type: string - build_deps: - type: array - items: - type: object - properties: - path: - type: string - title: module path - version: - type: string - title: module version - sum: - type: string - title: checksum - title: Module is the type for VersionInfo - cosmos_sdk_version: - type: string - title: 'Since: cosmos-sdk 0.43' - description: VersionInfo is the type for the GetNodeInfoResponse message. - description: >- - GetNodeInfoResponse is the response type for the Query/GetNodeInfo RPC - method. - cosmos.base.tendermint.v1beta1.GetSyncingResponse: - type: object - properties: - syncing: - type: boolean - description: >- - GetSyncingResponse is the response type for the Query/GetSyncing RPC - method. - cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse: - type: object - properties: - block_height: - type: string - format: int64 - validators: - type: array - items: - type: object - properties: - address: - type: string - pub_key: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - description: Validator is the type for the validator-set. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - GetValidatorSetByHeightResponse is the response type for the - Query/GetValidatorSetByHeight RPC method. - cosmos.base.tendermint.v1beta1.Header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block in the - blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - description: >- - proposer_address is the original block proposer address, formatted as - a Bech32 string. - - In Tendermint, this type is `bytes`, but in the SDK, we convert it to - a Bech32 string - - for better UX. - - - original proposer of the block - description: Header defines the structure of a Tendermint block header. - cosmos.base.tendermint.v1beta1.Module: - type: object - properties: - path: - type: string - title: module path - version: - type: string - title: module version - sum: - type: string - title: checksum - title: Module is the type for VersionInfo - cosmos.base.tendermint.v1beta1.ProofOp: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - description: >- - ProofOp defines an operation used for calculating Merkle root. The data - could - - be arbitrary format, providing necessary data for example neighbouring - node - - hash. - - - Note: This type is a duplicate of the ProofOp proto type defined in - Tendermint. - cosmos.base.tendermint.v1beta1.ProofOps: - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - description: >- - ProofOp defines an operation used for calculating Merkle root. The - data could - - be arbitrary format, providing necessary data for example - neighbouring node - - hash. - - - Note: This type is a duplicate of the ProofOp proto type defined in - Tendermint. - description: >- - ProofOps is Merkle proof defined by the list of ProofOps. - - - Note: This type is a duplicate of the ProofOps proto type defined in - Tendermint. - cosmos.base.tendermint.v1beta1.Validator: - type: object - properties: - address: - type: string - pub_key: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - description: Validator is the type for the validator-set. - cosmos.base.tendermint.v1beta1.VersionInfo: - type: object - properties: - name: - type: string - app_name: - type: string - version: - type: string - git_commit: - type: string - build_tags: - type: string - go_version: - type: string - build_deps: - type: array - items: - type: object - properties: - path: - type: string - title: module path - version: - type: string - title: module version - sum: - type: string - title: checksum - title: Module is the type for VersionInfo - cosmos_sdk_version: - type: string - title: 'Since: cosmos-sdk 0.43' - description: VersionInfo is the type for the GetNodeInfoResponse message. - tendermint.crypto.PublicKey: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: PublicKey defines the keys available for use with Validators - tendermint.p2p.DefaultNodeInfo: - type: object - properties: - protocol_version: - type: object - properties: - p2p: - type: string - format: uint64 - block: - type: string - format: uint64 - app: - type: string - format: uint64 - default_node_id: - type: string - listen_addr: - type: string - network: - type: string - version: - type: string - channels: - type: string - format: byte - moniker: - type: string - other: - type: object - properties: - tx_index: - type: string - rpc_address: - type: string - tendermint.p2p.DefaultNodeInfoOther: - type: object - properties: - tx_index: - type: string - rpc_address: - type: string - tendermint.p2p.ProtocolVersion: - type: object - properties: - p2p: - type: string - format: uint64 - block: - type: string - format: uint64 - app: - type: string - format: uint64 - tendermint.types.Block: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block in - the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. - - NOTE: not all txs here are valid. We're just agreeing on the - order first. - - This means that block.AppHash does not include these txs. - title: Data contains the set of transactions included in the block - evidence: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a validator - signed two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for - processing a block in the blockchain, - - including all blockchain data structures and - the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs from - the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included - in a Commit. - description: >- - Commit contains the evidence that a block was - committed by a set of validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use - with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use with - Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a set of - validators attempting to mislead a light client. - last_commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - description: >- - Commit contains the evidence that a block was committed by a set of - validators. - tendermint.types.BlockID: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - tendermint.types.BlockIDFlag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - tendermint.types.Commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - description: >- - Commit contains the evidence that a block was committed by a set of - validators. - tendermint.types.CommitSig: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - tendermint.types.Data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. - - NOTE: not all txs here are valid. We're just agreeing on the order - first. - - This means that block.AppHash does not include these txs. - title: Data contains the set of transactions included in the block - tendermint.types.DuplicateVoteEvidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: |- - SignedMsgType is a type of signed message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote from validators - for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: |- - SignedMsgType is a type of signed message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote from validators - for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a validator signed two - conflicting votes. - tendermint.types.Evidence: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: |- - SignedMsgType is a type of signed message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote from - validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: |- - SignedMsgType is a type of signed message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote from - validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a validator signed two - conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing - a block in the blockchain, - - including all blockchain data structures and the rules - of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs from the - previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included in a - Commit. - description: >- - Commit contains the evidence that a block was committed by - a set of validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use with - Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use with - Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: PublicKey defines the keys available for use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a set of validators - attempting to mislead a light client. - tendermint.types.EvidenceList: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote from - validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote from - validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a validator signed - two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for - processing a block in the blockchain, - - including all blockchain data structures and the - rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs from the - previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included in a - Commit. - description: >- - Commit contains the evidence that a block was - committed by a set of validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use - with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use - with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use with - Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a set of - validators attempting to mislead a light client. - tendermint.types.Header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block in the - blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - tendermint.types.LightBlock: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block - in the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - description: >- - Commit contains the evidence that a block was committed by a set - of validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: PublicKey defines the keys available for use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: PublicKey defines the keys available for use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - tendermint.types.LightClientAttackEvidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a - block in the blockchain, - - including all blockchain data structures and the rules of - the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs from the previous - block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the signature is - for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - description: >- - Commit contains the evidence that a block was committed by a - set of validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use with - Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use with - Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: PublicKey defines the keys available for use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a set of validators - attempting to mislead a light client. - tendermint.types.PartSetHeader: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - tendermint.types.SignedHeader: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block in - the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - description: >- - Commit contains the evidence that a block was committed by a set of - validators. - tendermint.types.SignedMsgType: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: |- - SignedMsgType is a type of signed message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - tendermint.types.Validator: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: PublicKey defines the keys available for use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - tendermint.types.ValidatorSet: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: PublicKey defines the keys available for use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: PublicKey defines the keys available for use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - tendermint.types.Vote: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: |- - SignedMsgType is a type of signed message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: |- - Vote represents a prevote, precommit, or commit vote from validators for - consensus. - tendermint.version.Consensus: - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block in the - blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - cosmos.consensus.v1.MsgUpdateParamsResponse: - type: object - description: |- - MsgUpdateParamsResponse defines the response structure for executing a - MsgUpdateParams message. - cosmos.consensus.v1.QueryParamsResponse: - type: object - properties: - params: - description: >- - params are the tendermint consensus params stored in the consensus - module. - - Please note that `params.version` is not populated in this response, - it is - - tracked separately in the x/upgrade module. - type: object - properties: - block: - type: object - properties: - max_bytes: - type: string - format: int64 - title: |- - Max block size, in bytes. - Note: must be greater than 0 - max_gas: - type: string - format: int64 - title: |- - Max gas per block. - Note: must be greater or equal to -1 - description: BlockParams contains limits on the block size. - evidence: - type: object - properties: - max_age_num_blocks: - type: string - format: int64 - description: >- - Max age of evidence, in blocks. - - - The basic formula for calculating this is: MaxAgeDuration / - {average block - - time}. - max_age_duration: - type: string - description: >- - Max age of evidence, in time. - - - It should correspond with an app's "unbonding period" or other - similar - - mechanism for handling [Nothing-At-Stake - - attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). - max_bytes: - type: string - format: int64 - title: >- - This sets the maximum size of total evidence in bytes that can - be committed in a single block. - - and should fall comfortably under the max block bytes. - - Default is 1048576 or 1MB - description: EvidenceParams determine how we handle evidence of malfeasance. - validator: - type: object - properties: - pub_key_types: - type: array - items: - type: string - description: |- - ValidatorParams restrict the public key types validators can use. - NOTE: uses ABCI pubkey naming, not Amino names. - version: - type: object - properties: - app: - type: string - format: uint64 - description: VersionParams contains the ABCI application version. - description: >- - QueryParamsResponse defines the response type for querying x/consensus - parameters. - tendermint.types.BlockParams: - type: object - properties: - max_bytes: - type: string - format: int64 - title: |- - Max block size, in bytes. - Note: must be greater than 0 - max_gas: - type: string - format: int64 - title: |- - Max gas per block. - Note: must be greater or equal to -1 - description: BlockParams contains limits on the block size. - tendermint.types.ConsensusParams: - type: object - properties: - block: - type: object - properties: - max_bytes: - type: string - format: int64 - title: |- - Max block size, in bytes. - Note: must be greater than 0 - max_gas: - type: string - format: int64 - title: |- - Max gas per block. - Note: must be greater or equal to -1 - description: BlockParams contains limits on the block size. - evidence: - type: object - properties: - max_age_num_blocks: - type: string - format: int64 - description: >- - Max age of evidence, in blocks. - - - The basic formula for calculating this is: MaxAgeDuration / - {average block - - time}. - max_age_duration: - type: string - description: >- - Max age of evidence, in time. - - - It should correspond with an app's "unbonding period" or other - similar - - mechanism for handling [Nothing-At-Stake - - attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). - max_bytes: - type: string - format: int64 - title: >- - This sets the maximum size of total evidence in bytes that can be - committed in a single block. - - and should fall comfortably under the max block bytes. - - Default is 1048576 or 1MB - description: EvidenceParams determine how we handle evidence of malfeasance. - validator: - type: object - properties: - pub_key_types: - type: array - items: - type: string - description: |- - ValidatorParams restrict the public key types validators can use. - NOTE: uses ABCI pubkey naming, not Amino names. - version: - type: object - properties: - app: - type: string - format: uint64 - description: VersionParams contains the ABCI application version. - description: |- - ConsensusParams contains consensus critical parameters that determine the - validity of blocks. - tendermint.types.EvidenceParams: - type: object - properties: - max_age_num_blocks: - type: string - format: int64 - description: >- - Max age of evidence, in blocks. - - - The basic formula for calculating this is: MaxAgeDuration / {average - block - - time}. - max_age_duration: - type: string - description: >- - Max age of evidence, in time. - - - It should correspond with an app's "unbonding period" or other similar - - mechanism for handling [Nothing-At-Stake - - attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). - max_bytes: - type: string - format: int64 - title: >- - This sets the maximum size of total evidence in bytes that can be - committed in a single block. - - and should fall comfortably under the max block bytes. - - Default is 1048576 or 1MB - description: EvidenceParams determine how we handle evidence of malfeasance. - tendermint.types.ValidatorParams: - type: object - properties: - pub_key_types: - type: array - items: - type: string - description: |- - ValidatorParams restrict the public key types validators can use. - NOTE: uses ABCI pubkey naming, not Amino names. - tendermint.types.VersionParams: - type: object - properties: - app: - type: string - format: uint64 - description: VersionParams contains the ABCI application version. - cosmos.crisis.v1beta1.MsgUpdateParamsResponse: - type: object - description: |- - MsgUpdateParamsResponse defines the response structure for executing a - MsgUpdateParams message. - - Since: cosmos-sdk 0.47 - cosmos.crisis.v1beta1.MsgVerifyInvariantResponse: - type: object - description: MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type. - cosmos.base.v1beta1.DecCoin: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. - cosmos.distribution.v1beta1.DelegationDelegatorReward: - type: object - properties: - validator_address: - type: string - reward: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. - description: |- - DelegationDelegatorReward represents the properties - of a delegator's delegation reward. - cosmos.distribution.v1beta1.MsgCommunityPoolSpendResponse: - type: object - description: |- - MsgCommunityPoolSpendResponse defines the response to executing a - MsgCommunityPoolSpend message. - - Since: cosmos-sdk 0.47 - cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse: - type: object - description: >- - MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response - type. - cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse: - type: object - description: |- - MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response - type. - cosmos.distribution.v1beta1.MsgUpdateParamsResponse: - type: object - description: |- - MsgUpdateParamsResponse defines the response structure for executing a - MsgUpdateParams message. - - Since: cosmos-sdk 0.47 - cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse: - type: object - properties: - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - title: 'Since: cosmos-sdk 0.46' - description: |- - MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward - response type. - cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse: - type: object - properties: - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - title: 'Since: cosmos-sdk 0.46' - description: |- - MsgWithdrawValidatorCommissionResponse defines the - Msg/WithdrawValidatorCommission response type. - cosmos.distribution.v1beta1.Params: - type: object - properties: - community_tax: - type: string - base_proposer_reward: - type: string - description: >- - Deprecated: The base_proposer_reward field is deprecated and is no - longer used - - in the x/distribution module's reward mechanism. - bonus_proposer_reward: - type: string - description: >- - Deprecated: The bonus_proposer_reward field is deprecated and is no - longer used - - in the x/distribution module's reward mechanism. - withdraw_addr_enabled: - type: boolean - description: Params defines the set of params for the distribution module. - cosmos.distribution.v1beta1.QueryCommunityPoolResponse: - type: object - properties: - pool: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. - description: pool defines community pool's coins. - description: >- - QueryCommunityPoolResponse is the response type for the - Query/CommunityPool - - RPC method. - cosmos.distribution.v1beta1.QueryDelegationRewardsResponse: - type: object - properties: - rewards: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. - description: rewards defines the rewards accrued by a delegation. - description: |- - QueryDelegationRewardsResponse is the response type for the - Query/DelegationRewards RPC method. - cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse: - type: object - properties: - rewards: - type: array - items: - type: object - properties: - validator_address: - type: string - reward: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a decimal - amount. - - - NOTE: The amount field is an Dec which implements the custom - method - - signatures required by gogoproto. - description: |- - DelegationDelegatorReward represents the properties - of a delegator's delegation reward. - description: rewards defines all the rewards accrued by a delegator. - total: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. - description: total defines the sum of all the rewards. - description: |- - QueryDelegationTotalRewardsResponse is the response type for the - Query/DelegationTotalRewards RPC method. - cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse: - type: object - properties: - validators: - type: array - items: - type: string - description: validators defines the validators a delegator is delegating for. - description: |- - QueryDelegatorValidatorsResponse is the response type for the - Query/DelegatorValidators RPC method. - cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse: - type: object - properties: - withdraw_address: - type: string - description: withdraw_address defines the delegator address to query for. - description: |- - QueryDelegatorWithdrawAddressResponse is the response type for the - Query/DelegatorWithdrawAddress RPC method. - cosmos.distribution.v1beta1.QueryParamsResponse: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - community_tax: - type: string - base_proposer_reward: - type: string - description: >- - Deprecated: The base_proposer_reward field is deprecated and is no - longer used - - in the x/distribution module's reward mechanism. - bonus_proposer_reward: - type: string - description: >- - Deprecated: The bonus_proposer_reward field is deprecated and is - no longer used - - in the x/distribution module's reward mechanism. - withdraw_addr_enabled: - type: boolean - description: QueryParamsResponse is the response type for the Query/Params RPC method. - cosmos.distribution.v1beta1.QueryValidatorCommissionResponse: - type: object - properties: - commission: - description: commission defines the commission the validator received. - type: object - properties: - commission: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a decimal - amount. - - - NOTE: The amount field is an Dec which implements the custom - method - - signatures required by gogoproto. - title: |- - QueryValidatorCommissionResponse is the response type for the - Query/ValidatorCommission RPC method - cosmos.distribution.v1beta1.QueryValidatorDistributionInfoResponse: - type: object - properties: - operator_address: - type: string - description: operator_address defines the validator operator address. - self_bond_rewards: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. - description: self_bond_rewards defines the self delegations rewards. - commission: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. - description: commission defines the commission the validator received. - description: >- - QueryValidatorDistributionInfoResponse is the response type for the - Query/ValidatorDistributionInfo RPC method. - cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse: - type: object - properties: - rewards: - type: object - properties: - rewards: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a decimal - amount. - - - NOTE: The amount field is an Dec which implements the custom - method - - signatures required by gogoproto. - description: >- - ValidatorOutstandingRewards represents outstanding (un-withdrawn) - rewards - - for a validator inexpensive to track, allows simple sanity checks. - description: |- - QueryValidatorOutstandingRewardsResponse is the response type for the - Query/ValidatorOutstandingRewards RPC method. - cosmos.distribution.v1beta1.QueryValidatorSlashesResponse: - type: object - properties: - slashes: - type: array - items: - type: object - properties: - validator_period: - type: string - format: uint64 - fraction: - type: string - description: |- - ValidatorSlashEvent represents a validator slash event. - Height is implicit within the store key. - This is needed to calculate appropriate amount of staking tokens - for delegations which are withdrawn after a slash has occurred. - description: slashes defines the slashes the validator received. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryValidatorSlashesResponse is the response type for the - Query/ValidatorSlashes RPC method. - cosmos.distribution.v1beta1.ValidatorAccumulatedCommission: - type: object - properties: - commission: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. - description: |- - ValidatorAccumulatedCommission represents accumulated commission - for a validator kept as a running counter, can be withdrawn at any time. - cosmos.distribution.v1beta1.ValidatorOutstandingRewards: - type: object - properties: - rewards: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. - description: |- - ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards - for a validator inexpensive to track, allows simple sanity checks. - cosmos.distribution.v1beta1.ValidatorSlashEvent: - type: object - properties: - validator_period: - type: string - format: uint64 - fraction: - type: string - description: |- - ValidatorSlashEvent represents a validator slash event. - Height is implicit within the store key. - This is needed to calculate appropriate amount of staking tokens - for delegations which are withdrawn after a slash has occurred. - cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse: - type: object - properties: - hash: - type: string - format: byte - description: hash defines the hash of the evidence. - description: MsgSubmitEvidenceResponse defines the Msg/SubmitEvidence response type. - cosmos.evidence.v1beta1.QueryAllEvidenceResponse: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up - a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: evidence returns all evidences. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryAllEvidenceResponse is the response type for the Query/AllEvidence - RPC - - method. - cosmos.evidence.v1beta1.QueryEvidenceResponse: - type: object - properties: - evidence: - description: evidence returns the requested evidence. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - QueryEvidenceResponse is the response type for the Query/Evidence RPC - method. - cosmos.feegrant.v1beta1.Grant: - type: object - properties: - granter: - type: string - description: >- - granter is the address of the user granting an allowance of their - funds. - grantee: - type: string - description: >- - grantee is the address of the user being granted an allowance of - another user's funds. - allowance: - description: allowance can be any of basic, periodic, allowed fee allowance. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - title: Grant is stored in the KVStore to record a grant with full context - cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse: - type: object - description: >- - MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response - type. - cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse: - type: object - description: >- - MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse - response type. - cosmos.feegrant.v1beta1.QueryAllowanceResponse: - type: object - properties: - allowance: - description: allowance is a allowance granted for grantee by granter. - type: object - properties: - granter: - type: string - description: >- - granter is the address of the user granting an allowance of their - funds. - grantee: - type: string - description: >- - grantee is the address of the user being granted an allowance of - another user's funds. - allowance: - description: allowance can be any of basic, periodic, allowed fee allowance. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - title: Grant is stored in the KVStore to record a grant with full context - description: >- - QueryAllowanceResponse is the response type for the Query/Allowance RPC - method. - cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse: - type: object - properties: - allowances: - type: array - items: - type: object - properties: - granter: - type: string - description: >- - granter is the address of the user granting an allowance of - their funds. - grantee: - type: string - description: >- - grantee is the address of the user being granted an allowance of - another user's funds. - allowance: - description: allowance can be any of basic, periodic, allowed fee allowance. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - title: Grant is stored in the KVStore to record a grant with full context - description: allowances that have been issued by the granter. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryAllowancesByGranterResponse is the response type for the - Query/AllowancesByGranter RPC method. - - - Since: cosmos-sdk 0.46 - cosmos.feegrant.v1beta1.QueryAllowancesResponse: - type: object - properties: - allowances: - type: array - items: - type: object - properties: - granter: - type: string - description: >- - granter is the address of the user granting an allowance of - their funds. - grantee: - type: string - description: >- - grantee is the address of the user being granted an allowance of - another user's funds. - allowance: - description: allowance can be any of basic, periodic, allowed fee allowance. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - title: Grant is stored in the KVStore to record a grant with full context - description: allowances are allowance's granted for grantee by granter. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryAllowancesResponse is the response type for the Query/Allowances RPC - method. - cosmos.gov.v1.Deposit: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - depositor: - type: string - description: depositor defines the deposit addresses from the proposals. - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: amount to be deposited by depositor. - description: |- - Deposit defines an amount deposited by an account address to an active - proposal. - cosmos.gov.v1.DepositParams: - type: object - properties: - min_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: Minimum deposit for a proposal to enter voting period. - max_deposit_period: - type: string - description: >- - Maximum period for Atom holders to deposit on a proposal. Initial - value: 2 - - months. - description: DepositParams defines the params for deposits on governance proposals. - cosmos.gov.v1.MsgDepositResponse: - type: object - description: MsgDepositResponse defines the Msg/Deposit response type. - cosmos.gov.v1.MsgExecLegacyContentResponse: - type: object - description: >- - MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response - type. - cosmos.gov.v1.MsgSubmitProposalResponse: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - description: MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. - cosmos.gov.v1.MsgUpdateParamsResponse: - type: object - description: |- - MsgUpdateParamsResponse defines the response structure for executing a - MsgUpdateParams message. - - Since: cosmos-sdk 0.47 - cosmos.gov.v1.MsgVoteResponse: - type: object - description: MsgVoteResponse defines the Msg/Vote response type. - cosmos.gov.v1.MsgVoteWeightedResponse: - type: object - description: MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. - cosmos.gov.v1.Params: - type: object - properties: - min_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: Minimum deposit for a proposal to enter voting period. - max_deposit_period: - type: string - description: >- - Maximum period for Atom holders to deposit on a proposal. Initial - value: 2 - - months. - voting_period: - type: string - description: Duration of the voting period. - quorum: - type: string - description: |- - Minimum percentage of total stake needed to vote for a result to be - considered valid. - threshold: - type: string - description: >- - Minimum proportion of Yes votes for proposal to pass. Default value: - 0.5. - veto_threshold: - type: string - description: |- - Minimum value of Veto votes to Total votes ratio for proposal to be - vetoed. Default value: 1/3. - min_initial_deposit_ratio: - type: string - description: >- - The ratio representing the proportion of the deposit value that must - be paid at proposal submission. - burn_vote_quorum: - type: boolean - title: burn deposits if a proposal does not meet quorum - burn_proposal_deposit_prevote: - type: boolean - title: burn deposits if the proposal does not enter voting period - burn_vote_veto: - type: boolean - title: burn deposits if quorum with vote type no_veto is met - description: |- - Params defines the parameters for the x/gov module. - - Since: cosmos-sdk 0.47 - cosmos.gov.v1.Proposal: - type: object - properties: - id: - type: string - format: uint64 - description: id defines the unique id of the proposal. - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up - a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages are the arbitrary messages to be executed if the proposal - passes. - status: - description: status defines the proposal status. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: |- - final_tally_result is the final tally result of the proposal. When - querying a proposal via gRPC, this field is not populated until the - proposal's voting period has ended. - type: object - properties: - yes_count: - type: string - description: yes_count is the number of yes votes on a proposal. - abstain_count: - type: string - description: abstain_count is the number of abstain votes on a proposal. - no_count: - type: string - description: no_count is the number of no votes on a proposal. - no_with_veto_count: - type: string - description: >- - no_with_veto_count is the number of no with veto votes on a - proposal. - submit_time: - type: string - format: date-time - description: submit_time is the time of proposal submission. - deposit_end_time: - type: string - format: date-time - description: deposit_end_time is the end time for deposition. - total_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: total_deposit is the total deposit on the proposal. - voting_start_time: - type: string - format: date-time - description: voting_start_time is the starting time to vote on a proposal. - voting_end_time: - type: string - format: date-time - description: voting_end_time is the end time of voting on a proposal. - metadata: - type: string - description: metadata is any arbitrary metadata attached to the proposal. - title: - type: string - description: 'Since: cosmos-sdk 0.47' - title: title is the title of the proposal - summary: - type: string - description: 'Since: cosmos-sdk 0.47' - title: summary is a short summary of the proposal - proposer: - type: string - description: 'Since: cosmos-sdk 0.47' - title: Proposer is the address of the proposal sumbitter - description: Proposal defines the core field members of a governance proposal. - cosmos.gov.v1.ProposalStatus: - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - description: |- - ProposalStatus enumerates the valid statuses of a proposal. - - - PROPOSAL_STATUS_UNSPECIFIED: PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. - - PROPOSAL_STATUS_DEPOSIT_PERIOD: PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit - period. - - PROPOSAL_STATUS_VOTING_PERIOD: PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting - period. - - PROPOSAL_STATUS_PASSED: PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has - passed. - - PROPOSAL_STATUS_REJECTED: PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has - been rejected. - - PROPOSAL_STATUS_FAILED: PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has - failed. - cosmos.gov.v1.QueryDepositResponse: - type: object - properties: - deposit: - description: deposit defines the requested deposit. - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - depositor: - type: string - description: depositor defines the deposit addresses from the proposals. - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: amount to be deposited by depositor. - description: >- - QueryDepositResponse is the response type for the Query/Deposit RPC - method. - cosmos.gov.v1.QueryDepositsResponse: - type: object - properties: - deposits: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - depositor: - type: string - description: depositor defines the deposit addresses from the proposals. - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: amount to be deposited by depositor. - description: >- - Deposit defines an amount deposited by an account address to an - active - - proposal. - description: deposits defines the requested deposits. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryDepositsResponse is the response type for the Query/Deposits RPC - method. - cosmos.gov.v1.QueryParamsResponse: - type: object - properties: - voting_params: - description: |- - Deprecated: Prefer to use `params` instead. - voting_params defines the parameters related to voting. - type: object - properties: - voting_period: - type: string - description: Duration of the voting period. - deposit_params: - description: |- - Deprecated: Prefer to use `params` instead. - deposit_params defines the parameters related to deposit. - type: object - properties: - min_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: Minimum deposit for a proposal to enter voting period. - max_deposit_period: - type: string - description: >- - Maximum period for Atom holders to deposit on a proposal. Initial - value: 2 - - months. - tally_params: - description: |- - Deprecated: Prefer to use `params` instead. - tally_params defines the parameters related to tally. - type: object - properties: - quorum: - type: string - description: >- - Minimum percentage of total stake needed to vote for a result to - be - - considered valid. - threshold: - type: string - description: >- - Minimum proportion of Yes votes for proposal to pass. Default - value: 0.5. - veto_threshold: - type: string - description: >- - Minimum value of Veto votes to Total votes ratio for proposal to - be - - vetoed. Default value: 1/3. - params: - description: |- - params defines all the paramaters of x/gov module. - - Since: cosmos-sdk 0.47 - type: object - properties: - min_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: Minimum deposit for a proposal to enter voting period. - max_deposit_period: - type: string - description: >- - Maximum period for Atom holders to deposit on a proposal. Initial - value: 2 - - months. - voting_period: - type: string - description: Duration of the voting period. - quorum: - type: string - description: >- - Minimum percentage of total stake needed to vote for a result to - be - considered valid. - threshold: - type: string - description: >- - Minimum proportion of Yes votes for proposal to pass. Default - value: 0.5. - veto_threshold: - type: string - description: >- - Minimum value of Veto votes to Total votes ratio for proposal to - be - vetoed. Default value: 1/3. - min_initial_deposit_ratio: - type: string - description: >- - The ratio representing the proportion of the deposit value that - must be paid at proposal submission. - burn_vote_quorum: - type: boolean - title: burn deposits if a proposal does not meet quorum - burn_proposal_deposit_prevote: - type: boolean - title: burn deposits if the proposal does not enter voting period - burn_vote_veto: - type: boolean - title: burn deposits if quorum with vote type no_veto is met - description: QueryParamsResponse is the response type for the Query/Params RPC method. - cosmos.gov.v1.QueryProposalResponse: - type: object - properties: - proposal: - description: proposal is the requested governance proposal. - type: object - properties: - id: - type: string - format: uint64 - description: id defines the unique id of the proposal. - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages are the arbitrary messages to be executed if the proposal - passes. - status: - description: status defines the proposal status. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result is the final tally result of the proposal. When - - querying a proposal via gRPC, this field is not populated until - the - - proposal's voting period has ended. - type: object - properties: - yes_count: - type: string - description: yes_count is the number of yes votes on a proposal. - abstain_count: - type: string - description: abstain_count is the number of abstain votes on a proposal. - no_count: - type: string - description: no_count is the number of no votes on a proposal. - no_with_veto_count: - type: string - description: >- - no_with_veto_count is the number of no with veto votes on a - proposal. - submit_time: - type: string - format: date-time - description: submit_time is the time of proposal submission. - deposit_end_time: - type: string - format: date-time - description: deposit_end_time is the end time for deposition. - total_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: total_deposit is the total deposit on the proposal. - voting_start_time: - type: string - format: date-time - description: voting_start_time is the starting time to vote on a proposal. - voting_end_time: - type: string - format: date-time - description: voting_end_time is the end time of voting on a proposal. - metadata: - type: string - description: metadata is any arbitrary metadata attached to the proposal. - title: - type: string - description: 'Since: cosmos-sdk 0.47' - title: title is the title of the proposal - summary: - type: string - description: 'Since: cosmos-sdk 0.47' - title: summary is a short summary of the proposal - proposer: - type: string - description: 'Since: cosmos-sdk 0.47' - title: Proposer is the address of the proposal sumbitter - description: >- - QueryProposalResponse is the response type for the Query/Proposal RPC - method. - cosmos.gov.v1.QueryProposalsResponse: - type: object - properties: - proposals: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - description: id defines the unique id of the proposal. - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages are the arbitrary messages to be executed if the - proposal passes. - status: - description: status defines the proposal status. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result is the final tally result of the proposal. - When - - querying a proposal via gRPC, this field is not populated until - the - - proposal's voting period has ended. - type: object - properties: - yes_count: - type: string - description: yes_count is the number of yes votes on a proposal. - abstain_count: - type: string - description: abstain_count is the number of abstain votes on a proposal. - no_count: - type: string - description: no_count is the number of no votes on a proposal. - no_with_veto_count: - type: string - description: >- - no_with_veto_count is the number of no with veto votes on a - proposal. - submit_time: - type: string - format: date-time - description: submit_time is the time of proposal submission. - deposit_end_time: - type: string - format: date-time - description: deposit_end_time is the end time for deposition. - total_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: total_deposit is the total deposit on the proposal. - voting_start_time: - type: string - format: date-time - description: voting_start_time is the starting time to vote on a proposal. - voting_end_time: - type: string - format: date-time - description: voting_end_time is the end time of voting on a proposal. - metadata: - type: string - description: metadata is any arbitrary metadata attached to the proposal. - title: - type: string - description: 'Since: cosmos-sdk 0.47' - title: title is the title of the proposal - summary: - type: string - description: 'Since: cosmos-sdk 0.47' - title: summary is a short summary of the proposal - proposer: - type: string - description: 'Since: cosmos-sdk 0.47' - title: Proposer is the address of the proposal sumbitter - description: Proposal defines the core field members of a governance proposal. - description: proposals defines all the requested governance proposals. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryProposalsResponse is the response type for the Query/Proposals RPC - method. - cosmos.gov.v1.QueryTallyResultResponse: - type: object - properties: - tally: - description: tally defines the requested tally. - type: object - properties: - yes_count: - type: string - description: yes_count is the number of yes votes on a proposal. - abstain_count: - type: string - description: abstain_count is the number of abstain votes on a proposal. - no_count: - type: string - description: no_count is the number of no votes on a proposal. - no_with_veto_count: - type: string - description: >- - no_with_veto_count is the number of no with veto votes on a - proposal. - description: >- - QueryTallyResultResponse is the response type for the Query/Tally RPC - method. - cosmos.gov.v1.QueryVoteResponse: - type: object - properties: - vote: - description: vote defines the queried vote. - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - voter: - type: string - description: voter is the voter address of the proposal. - options: - type: array - items: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not contain - duplicate vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: weight is the vote weight associated with the vote option. - description: WeightedVoteOption defines a unit of vote for vote split. - description: options is the weighted vote options. - metadata: - type: string - description: metadata is any arbitrary metadata to attached to the vote. - description: QueryVoteResponse is the response type for the Query/Vote RPC method. - cosmos.gov.v1.QueryVotesResponse: - type: object - properties: - votes: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - voter: - type: string - description: voter is the voter address of the proposal. - options: - type: array - items: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not contain - duplicate vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: weight is the vote weight associated with the vote option. - description: WeightedVoteOption defines a unit of vote for vote split. - description: options is the weighted vote options. - metadata: - type: string - description: metadata is any arbitrary metadata to attached to the vote. - description: |- - Vote defines a vote on a governance proposal. - A Vote consists of a proposal ID, the voter, and the vote option. - description: votes defines the queried votes. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: QueryVotesResponse is the response type for the Query/Votes RPC method. - cosmos.gov.v1.TallyParams: - type: object - properties: - quorum: - type: string - description: |- - Minimum percentage of total stake needed to vote for a result to be - considered valid. - threshold: - type: string - description: >- - Minimum proportion of Yes votes for proposal to pass. Default value: - 0.5. - veto_threshold: - type: string - description: |- - Minimum value of Veto votes to Total votes ratio for proposal to be - vetoed. Default value: 1/3. - description: TallyParams defines the params for tallying votes on governance proposals. - cosmos.gov.v1.TallyResult: - type: object - properties: - yes_count: - type: string - description: yes_count is the number of yes votes on a proposal. - abstain_count: - type: string - description: abstain_count is the number of abstain votes on a proposal. - no_count: - type: string - description: no_count is the number of no votes on a proposal. - no_with_veto_count: - type: string - description: no_with_veto_count is the number of no with veto votes on a proposal. - description: TallyResult defines a standard tally for a governance proposal. - cosmos.gov.v1.Vote: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - voter: - type: string - description: voter is the voter address of the proposal. - options: - type: array - items: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not contain - duplicate vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: weight is the vote weight associated with the vote option. - description: WeightedVoteOption defines a unit of vote for vote split. - description: options is the weighted vote options. - metadata: - type: string - description: metadata is any arbitrary metadata to attached to the vote. - description: |- - Vote defines a vote on a governance proposal. - A Vote consists of a proposal ID, the voter, and the vote option. - cosmos.gov.v1.VoteOption: - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - description: >- - VoteOption enumerates the valid vote options for a given governance - proposal. - - - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option. - - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option. - - VOTE_OPTION_ABSTAIN: VOTE_OPTION_ABSTAIN defines an abstain vote option. - - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. - - VOTE_OPTION_NO_WITH_VETO: VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. - cosmos.gov.v1.VotingParams: - type: object - properties: - voting_period: - type: string - description: Duration of the voting period. - description: VotingParams defines the params for voting on governance proposals. - cosmos.gov.v1.WeightedVoteOption: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not contain duplicate - vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: weight is the vote weight associated with the vote option. - description: WeightedVoteOption defines a unit of vote for vote split. - cosmos.gov.v1beta1.Deposit: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - depositor: - type: string - description: depositor defines the deposit addresses from the proposals. - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: amount to be deposited by depositor. - description: |- - Deposit defines an amount deposited by an account address to an active - proposal. - cosmos.gov.v1beta1.DepositParams: - type: object - properties: - min_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: Minimum deposit for a proposal to enter voting period. - max_deposit_period: - type: string - description: >- - Maximum period for Atom holders to deposit on a proposal. Initial - value: 2 - - months. - description: DepositParams defines the params for deposits on governance proposals. - cosmos.gov.v1beta1.MsgDepositResponse: - type: object - description: MsgDepositResponse defines the Msg/Deposit response type. - cosmos.gov.v1beta1.MsgSubmitProposalResponse: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - description: MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. - cosmos.gov.v1beta1.MsgVoteResponse: - type: object - description: MsgVoteResponse defines the Msg/Vote response type. - cosmos.gov.v1beta1.MsgVoteWeightedResponse: - type: object - description: |- - MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. - - Since: cosmos-sdk 0.43 - cosmos.gov.v1beta1.Proposal: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - content: - description: content is the proposal's content. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - status: - description: status defines the proposal status. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: |- - final_tally_result is the final tally result of the proposal. When - querying a proposal via gRPC, this field is not populated until the - proposal's voting period has ended. - type: object - properties: - 'yes': - type: string - description: yes is the number of yes votes on a proposal. - abstain: - type: string - description: abstain is the number of abstain votes on a proposal. - 'no': - type: string - description: no is the number of no votes on a proposal. - no_with_veto: - type: string - description: no_with_veto is the number of no with veto votes on a proposal. - submit_time: - type: string - format: date-time - description: submit_time is the time of proposal submission. - deposit_end_time: - type: string - format: date-time - description: deposit_end_time is the end time for deposition. - total_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: total_deposit is the total deposit on the proposal. - voting_start_time: - type: string - format: date-time - description: voting_start_time is the starting time to vote on a proposal. - voting_end_time: - type: string - format: date-time - description: voting_end_time is the end time of voting on a proposal. - description: Proposal defines the core field members of a governance proposal. - cosmos.gov.v1beta1.ProposalStatus: - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - description: |- - ProposalStatus enumerates the valid statuses of a proposal. - - - PROPOSAL_STATUS_UNSPECIFIED: PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. - - PROPOSAL_STATUS_DEPOSIT_PERIOD: PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit - period. - - PROPOSAL_STATUS_VOTING_PERIOD: PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting - period. - - PROPOSAL_STATUS_PASSED: PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has - passed. - - PROPOSAL_STATUS_REJECTED: PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has - been rejected. - - PROPOSAL_STATUS_FAILED: PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has - failed. - cosmos.gov.v1beta1.QueryDepositResponse: - type: object - properties: - deposit: - description: deposit defines the requested deposit. - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - depositor: - type: string - description: depositor defines the deposit addresses from the proposals. - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: amount to be deposited by depositor. - description: >- - QueryDepositResponse is the response type for the Query/Deposit RPC - method. - cosmos.gov.v1beta1.QueryDepositsResponse: - type: object - properties: - deposits: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - depositor: - type: string - description: depositor defines the deposit addresses from the proposals. - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: amount to be deposited by depositor. - description: >- - Deposit defines an amount deposited by an account address to an - active - - proposal. - description: deposits defines the requested deposits. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryDepositsResponse is the response type for the Query/Deposits RPC - method. - cosmos.gov.v1beta1.QueryParamsResponse: - type: object - properties: - voting_params: - description: voting_params defines the parameters related to voting. - type: object - properties: - voting_period: - type: string - description: Duration of the voting period. - deposit_params: - description: deposit_params defines the parameters related to deposit. - type: object - properties: - min_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: Minimum deposit for a proposal to enter voting period. - max_deposit_period: - type: string - description: >- - Maximum period for Atom holders to deposit on a proposal. Initial - value: 2 - - months. - tally_params: - description: tally_params defines the parameters related to tally. - type: object - properties: - quorum: - type: string - format: byte - description: >- - Minimum percentage of total stake needed to vote for a result to - be - - considered valid. - threshold: - type: string - format: byte - description: >- - Minimum proportion of Yes votes for proposal to pass. Default - value: 0.5. - veto_threshold: - type: string - format: byte - description: >- - Minimum value of Veto votes to Total votes ratio for proposal to - be - - vetoed. Default value: 1/3. - description: QueryParamsResponse is the response type for the Query/Params RPC method. - cosmos.gov.v1beta1.QueryProposalResponse: - type: object - properties: - proposal: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - content: - description: content is the proposal's content. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - status: - description: status defines the proposal status. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result is the final tally result of the proposal. When - - querying a proposal via gRPC, this field is not populated until - the - - proposal's voting period has ended. - type: object - properties: - 'yes': - type: string - description: yes is the number of yes votes on a proposal. - abstain: - type: string - description: abstain is the number of abstain votes on a proposal. - 'no': - type: string - description: no is the number of no votes on a proposal. - no_with_veto: - type: string - description: >- - no_with_veto is the number of no with veto votes on a - proposal. - submit_time: - type: string - format: date-time - description: submit_time is the time of proposal submission. - deposit_end_time: - type: string - format: date-time - description: deposit_end_time is the end time for deposition. - total_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: total_deposit is the total deposit on the proposal. - voting_start_time: - type: string - format: date-time - description: voting_start_time is the starting time to vote on a proposal. - voting_end_time: - type: string - format: date-time - description: voting_end_time is the end time of voting on a proposal. - description: Proposal defines the core field members of a governance proposal. - description: >- - QueryProposalResponse is the response type for the Query/Proposal RPC - method. - cosmos.gov.v1beta1.QueryProposalsResponse: - type: object - properties: - proposals: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - content: - description: content is the proposal's content. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - status: - description: status defines the proposal status. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result is the final tally result of the proposal. - When - - querying a proposal via gRPC, this field is not populated until - the - - proposal's voting period has ended. - type: object - properties: - 'yes': - type: string - description: yes is the number of yes votes on a proposal. - abstain: - type: string - description: abstain is the number of abstain votes on a proposal. - 'no': - type: string - description: no is the number of no votes on a proposal. - no_with_veto: - type: string - description: >- - no_with_veto is the number of no with veto votes on a - proposal. - submit_time: - type: string - format: date-time - description: submit_time is the time of proposal submission. - deposit_end_time: - type: string - format: date-time - description: deposit_end_time is the end time for deposition. - total_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: total_deposit is the total deposit on the proposal. - voting_start_time: - type: string - format: date-time - description: voting_start_time is the starting time to vote on a proposal. - voting_end_time: - type: string - format: date-time - description: voting_end_time is the end time of voting on a proposal. - description: Proposal defines the core field members of a governance proposal. - description: proposals defines all the requested governance proposals. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryProposalsResponse is the response type for the Query/Proposals RPC - method. - cosmos.gov.v1beta1.QueryTallyResultResponse: - type: object - properties: - tally: - description: tally defines the requested tally. - type: object - properties: - 'yes': - type: string - description: yes is the number of yes votes on a proposal. - abstain: - type: string - description: abstain is the number of abstain votes on a proposal. - 'no': - type: string - description: no is the number of no votes on a proposal. - no_with_veto: - type: string - description: no_with_veto is the number of no with veto votes on a proposal. - description: >- - QueryTallyResultResponse is the response type for the Query/Tally RPC - method. - cosmos.gov.v1beta1.QueryVoteResponse: - type: object - properties: - vote: - description: vote defines the queried vote. - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - voter: - type: string - description: voter is the voter address of the proposal. - option: - description: >- - Deprecated: Prefer to use `options` instead. This field is set in - queries - - if and only if `len(options) == 1` and that option has weight 1. - In all - - other cases, this field will default to VOTE_OPTION_UNSPECIFIED. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - options: - type: array - items: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not contain - duplicate vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: weight is the vote weight associated with the vote option. - description: |- - WeightedVoteOption defines a unit of vote for vote split. - - Since: cosmos-sdk 0.43 - description: |- - options is the weighted vote options. - - Since: cosmos-sdk 0.43 - description: QueryVoteResponse is the response type for the Query/Vote RPC method. - cosmos.gov.v1beta1.QueryVotesResponse: - type: object - properties: - votes: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - voter: - type: string - description: voter is the voter address of the proposal. - option: - description: >- - Deprecated: Prefer to use `options` instead. This field is set - in queries - - if and only if `len(options) == 1` and that option has weight 1. - In all - - other cases, this field will default to VOTE_OPTION_UNSPECIFIED. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - options: - type: array - items: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not contain - duplicate vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: weight is the vote weight associated with the vote option. - description: |- - WeightedVoteOption defines a unit of vote for vote split. - - Since: cosmos-sdk 0.43 - description: |- - options is the weighted vote options. - - Since: cosmos-sdk 0.43 - description: |- - Vote defines a vote on a governance proposal. - A Vote consists of a proposal ID, the voter, and the vote option. - description: votes defines the queried votes. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: QueryVotesResponse is the response type for the Query/Votes RPC method. - cosmos.gov.v1beta1.TallyParams: - type: object - properties: - quorum: - type: string - format: byte - description: |- - Minimum percentage of total stake needed to vote for a result to be - considered valid. - threshold: - type: string - format: byte - description: >- - Minimum proportion of Yes votes for proposal to pass. Default value: - 0.5. - veto_threshold: - type: string - format: byte - description: |- - Minimum value of Veto votes to Total votes ratio for proposal to be - vetoed. Default value: 1/3. - description: TallyParams defines the params for tallying votes on governance proposals. - cosmos.gov.v1beta1.TallyResult: - type: object - properties: - 'yes': - type: string - description: yes is the number of yes votes on a proposal. - abstain: - type: string - description: abstain is the number of abstain votes on a proposal. - 'no': - type: string - description: no is the number of no votes on a proposal. - no_with_veto: - type: string - description: no_with_veto is the number of no with veto votes on a proposal. - description: TallyResult defines a standard tally for a governance proposal. - cosmos.gov.v1beta1.Vote: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - voter: - type: string - description: voter is the voter address of the proposal. - option: - description: >- - Deprecated: Prefer to use `options` instead. This field is set in - queries - - if and only if `len(options) == 1` and that option has weight 1. In - all - - other cases, this field will default to VOTE_OPTION_UNSPECIFIED. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - options: - type: array - items: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not contain - duplicate vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: weight is the vote weight associated with the vote option. - description: |- - WeightedVoteOption defines a unit of vote for vote split. - - Since: cosmos-sdk 0.43 - description: |- - options is the weighted vote options. - - Since: cosmos-sdk 0.43 - description: |- - Vote defines a vote on a governance proposal. - A Vote consists of a proposal ID, the voter, and the vote option. - cosmos.gov.v1beta1.VoteOption: - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - description: >- - VoteOption enumerates the valid vote options for a given governance - proposal. - - - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option. - - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option. - - VOTE_OPTION_ABSTAIN: VOTE_OPTION_ABSTAIN defines an abstain vote option. - - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. - - VOTE_OPTION_NO_WITH_VETO: VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. - cosmos.gov.v1beta1.VotingParams: - type: object - properties: - voting_period: - type: string - description: Duration of the voting period. - description: VotingParams defines the params for voting on governance proposals. - cosmos.gov.v1beta1.WeightedVoteOption: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not contain duplicate - vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: weight is the vote weight associated with the vote option. - description: |- - WeightedVoteOption defines a unit of vote for vote split. - - Since: cosmos-sdk 0.43 - cosmos.group.v1.Exec: - type: string - enum: - - EXEC_UNSPECIFIED - - EXEC_TRY - default: EXEC_UNSPECIFIED - description: |- - Exec defines modes of execution of a proposal on creation or on new vote. - - - EXEC_UNSPECIFIED: An empty value means that there should be a separate - MsgExec request for the proposal to execute. - - EXEC_TRY: Try to execute the proposal immediately. - If the proposal is not allowed per the DecisionPolicy, - the proposal will still be open and could - be executed at a later point. - cosmos.group.v1.GroupInfo: - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group's admin. - metadata: - type: string - description: metadata is any arbitrary metadata to attached to the group. - version: - type: string - format: uint64 - title: >- - version is used to track changes to a group's membership structure - that - - would break existing proposals. Whenever any members weight is - changed, - - or any member is added or removed this version is incremented and will - - cause proposals based on older versions of this group to fail - total_weight: - type: string - description: total_weight is the sum of the group members' weights. - created_at: - type: string - format: date-time - description: created_at is a timestamp specifying when a group was created. - description: GroupInfo represents the high-level on-chain information for a group. - cosmos.group.v1.GroupMember: - type: object - properties: - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the group. - member: - description: member is the member data. - type: object - properties: - address: - type: string - description: address is the member's account address. - weight: - type: string - description: >- - weight is the member's voting weight that should be greater than - 0. - metadata: - type: string - description: metadata is any arbitrary metadata attached to the member. - added_at: - type: string - format: date-time - description: added_at is a timestamp specifying when a member was added. - description: GroupMember represents the relationship between a group and a member. - cosmos.group.v1.GroupPolicyInfo: - type: object - properties: - address: - type: string - description: address is the account address of group policy. - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group admin. - metadata: - type: string - title: |- - metadata is any arbitrary metadata attached to the group policy. - the recommended format of the metadata is to be found here: - https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 - version: - type: string - format: uint64 - description: >- - version is used to track changes to a group's GroupPolicyInfo - structure that - - would create a different result on a running proposal. - decision_policy: - description: decision_policy specifies the group policy's decision policy. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - created_at: - type: string - format: date-time - description: created_at is a timestamp specifying when a group policy was created. - description: >- - GroupPolicyInfo represents the high-level on-chain information for a group - policy. - cosmos.group.v1.Member: - type: object - properties: - address: - type: string - description: address is the member's account address. - weight: - type: string - description: weight is the member's voting weight that should be greater than 0. - metadata: - type: string - description: metadata is any arbitrary metadata attached to the member. - added_at: - type: string - format: date-time - description: added_at is a timestamp specifying when a member was added. - description: |- - Member represents a group member with an account address, - non-zero weight, metadata and added_at timestamp. - cosmos.group.v1.MemberRequest: - type: object - properties: - address: - type: string - description: address is the member's account address. - weight: - type: string - description: weight is the member's voting weight that should be greater than 0. - metadata: - type: string - description: metadata is any arbitrary metadata attached to the member. - description: |- - MemberRequest represents a group member to be used in Msg server requests. - Contrary to `Member`, it doesn't have any `added_at` field - since this field cannot be set as part of requests. - cosmos.group.v1.MsgCreateGroupPolicyResponse: - type: object - properties: - address: - type: string - description: address is the account address of the newly created group policy. - description: MsgCreateGroupPolicyResponse is the Msg/CreateGroupPolicy response type. - cosmos.group.v1.MsgCreateGroupResponse: - type: object - properties: - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the newly created group. - description: MsgCreateGroupResponse is the Msg/CreateGroup response type. - cosmos.group.v1.MsgCreateGroupWithPolicyResponse: - type: object - properties: - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the newly created group with policy. - group_policy_address: - type: string - description: >- - group_policy_address is the account address of the newly created group - policy. - description: >- - MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response - type. - cosmos.group.v1.MsgExecResponse: - type: object - properties: - result: - description: result is the final result of the proposal execution. - type: string - enum: - - PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - - PROPOSAL_EXECUTOR_RESULT_NOT_RUN - - PROPOSAL_EXECUTOR_RESULT_SUCCESS - - PROPOSAL_EXECUTOR_RESULT_FAILURE - default: PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - description: MsgExecResponse is the Msg/Exec request type. - cosmos.group.v1.MsgLeaveGroupResponse: - type: object - description: MsgLeaveGroupResponse is the Msg/LeaveGroup response type. - cosmos.group.v1.MsgSubmitProposalResponse: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal is the unique ID of the proposal. - description: MsgSubmitProposalResponse is the Msg/SubmitProposal response type. - cosmos.group.v1.MsgUpdateGroupAdminResponse: - type: object - description: MsgUpdateGroupAdminResponse is the Msg/UpdateGroupAdmin response type. - cosmos.group.v1.MsgUpdateGroupMembersResponse: - type: object - description: MsgUpdateGroupMembersResponse is the Msg/UpdateGroupMembers response type. - cosmos.group.v1.MsgUpdateGroupMetadataResponse: - type: object - description: >- - MsgUpdateGroupMetadataResponse is the Msg/UpdateGroupMetadata response - type. - cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse: - type: object - description: >- - MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin - response type. - cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse: - type: object - description: >- - MsgUpdateGroupPolicyDecisionPolicyResponse is the - Msg/UpdateGroupPolicyDecisionPolicy response type. - cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse: - type: object - description: >- - MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata - response type. - cosmos.group.v1.MsgVoteResponse: - type: object - description: MsgVoteResponse is the Msg/Vote response type. - cosmos.group.v1.MsgWithdrawProposalResponse: - type: object - description: MsgWithdrawProposalResponse is the Msg/WithdrawProposal response type. - cosmos.group.v1.Proposal: - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique id of the proposal. - group_policy_address: - type: string - description: group_policy_address is the account address of group policy. - metadata: - type: string - title: |- - metadata is any arbitrary metadata attached to the proposal. - the recommended format of the metadata is to be found here: - https://docs.cosmos.network/v0.47/modules/group#proposal-4 - proposers: - type: array - items: - type: string - description: proposers are the account addresses of the proposers. - submit_time: - type: string - format: date-time - description: submit_time is a timestamp specifying when a proposal was submitted. - group_version: - type: string - format: uint64 - description: |- - group_version tracks the version of the group at proposal submission. - This field is here for informational purposes only. - group_policy_version: - type: string - format: uint64 - description: >- - group_policy_version tracks the version of the group policy at - proposal submission. - - When a decision policy is changed, existing proposals from previous - policy - - versions will become invalid with the `ABORTED` status. - - This field is here for informational purposes only. - status: - description: >- - status represents the high level position in the life cycle of the - proposal. Initial value is Submitted. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_SUBMITTED - - PROPOSAL_STATUS_ACCEPTED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_ABORTED - - PROPOSAL_STATUS_WITHDRAWN - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result contains the sums of all weighted votes for this - - proposal for each vote option. It is empty at submission, and only - - populated after tallying, at voting period end or at proposal - execution, - - whichever happens first. - type: object - properties: - yes_count: - type: string - description: yes_count is the weighted sum of yes votes. - abstain_count: - type: string - description: abstain_count is the weighted sum of abstainers. - no_count: - type: string - description: no_count is the weighted sum of no votes. - no_with_veto_count: - type: string - description: no_with_veto_count is the weighted sum of veto. - voting_period_end: - type: string - format: date-time - description: >- - voting_period_end is the timestamp before which voting must be done. - - Unless a successful MsgExec is called before (to execute a proposal - whose - - tally is successful before the voting period ends), tallying will be - done - - at this point, and the `final_tally_result`and `status` fields will be - - accordingly updated. - executor_result: - description: >- - executor_result is the final result of the proposal execution. Initial - value is NotRun. - type: string - enum: - - PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - - PROPOSAL_EXECUTOR_RESULT_NOT_RUN - - PROPOSAL_EXECUTOR_RESULT_SUCCESS - - PROPOSAL_EXECUTOR_RESULT_FAILURE - default: PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up - a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages is a list of `sdk.Msg`s that will be executed if the proposal - passes. - title: - type: string - description: 'Since: cosmos-sdk 0.47' - title: title is the title of the proposal - summary: - type: string - description: 'Since: cosmos-sdk 0.47' - title: summary is a short summary of the proposal - description: >- - Proposal defines a group proposal. Any member of a group can submit a - proposal - - for a group policy to decide upon. - - A proposal consists of a set of `sdk.Msg`s that will be executed if the - proposal - - passes as well as some optional metadata associated with the proposal. - cosmos.group.v1.ProposalExecutorResult: - type: string - enum: - - PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - - PROPOSAL_EXECUTOR_RESULT_NOT_RUN - - PROPOSAL_EXECUTOR_RESULT_SUCCESS - - PROPOSAL_EXECUTOR_RESULT_FAILURE - default: PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - description: |- - ProposalExecutorResult defines types of proposal executor results. - - - PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED: An empty value is not allowed. - - PROPOSAL_EXECUTOR_RESULT_NOT_RUN: We have not yet run the executor. - - PROPOSAL_EXECUTOR_RESULT_SUCCESS: The executor was successful and proposed action updated state. - - PROPOSAL_EXECUTOR_RESULT_FAILURE: The executor returned an error and proposed action didn't update state. - cosmos.group.v1.ProposalStatus: - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_SUBMITTED - - PROPOSAL_STATUS_ACCEPTED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_ABORTED - - PROPOSAL_STATUS_WITHDRAWN - default: PROPOSAL_STATUS_UNSPECIFIED - description: |- - ProposalStatus defines proposal statuses. - - - PROPOSAL_STATUS_UNSPECIFIED: An empty value is invalid and not allowed. - - PROPOSAL_STATUS_SUBMITTED: Initial status of a proposal when submitted. - - PROPOSAL_STATUS_ACCEPTED: Final status of a proposal when the final tally is done and the outcome - passes the group policy's decision policy. - - PROPOSAL_STATUS_REJECTED: Final status of a proposal when the final tally is done and the outcome - is rejected by the group policy's decision policy. - - PROPOSAL_STATUS_ABORTED: Final status of a proposal when the group policy is modified before the - final tally. - - PROPOSAL_STATUS_WITHDRAWN: A proposal can be withdrawn before the voting start time by the owner. - When this happens the final status is Withdrawn. - cosmos.group.v1.QueryGroupInfoResponse: - type: object - properties: - info: - description: info is the GroupInfo of the group. - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group's admin. - metadata: - type: string - description: metadata is any arbitrary metadata to attached to the group. - version: - type: string - format: uint64 - title: >- - version is used to track changes to a group's membership structure - that - - would break existing proposals. Whenever any members weight is - changed, - - or any member is added or removed this version is incremented and - will - - cause proposals based on older versions of this group to fail - total_weight: - type: string - description: total_weight is the sum of the group members' weights. - created_at: - type: string - format: date-time - description: created_at is a timestamp specifying when a group was created. - description: QueryGroupInfoResponse is the Query/GroupInfo response type. - cosmos.group.v1.QueryGroupMembersResponse: - type: object - properties: - members: - type: array - items: - type: object - properties: - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the group. - member: - description: member is the member data. - type: object - properties: - address: - type: string - description: address is the member's account address. - weight: - type: string - description: >- - weight is the member's voting weight that should be greater - than 0. - metadata: - type: string - description: metadata is any arbitrary metadata attached to the member. - added_at: - type: string - format: date-time - description: added_at is a timestamp specifying when a member was added. - description: >- - GroupMember represents the relationship between a group and a - member. - description: members are the members of the group with given group_id. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: QueryGroupMembersResponse is the Query/GroupMembersResponse response type. - cosmos.group.v1.QueryGroupPoliciesByAdminResponse: - type: object - properties: - group_policies: - type: array - items: - type: object - properties: - address: - type: string - description: address is the account address of group policy. - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group admin. - metadata: - type: string - title: >- - metadata is any arbitrary metadata attached to the group policy. - - the recommended format of the metadata is to be found here: - - https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 - version: - type: string - format: uint64 - description: >- - version is used to track changes to a group's GroupPolicyInfo - structure that - - would create a different result on a running proposal. - decision_policy: - description: decision_policy specifies the group policy's decision policy. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - created_at: - type: string - format: date-time - description: >- - created_at is a timestamp specifying when a group policy was - created. - description: >- - GroupPolicyInfo represents the high-level on-chain information for a - group policy. - description: group_policies are the group policies info with provided admin. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGroupPoliciesByAdminResponse is the Query/GroupPoliciesByAdmin - response type. - cosmos.group.v1.QueryGroupPoliciesByGroupResponse: - type: object - properties: - group_policies: - type: array - items: - type: object - properties: - address: - type: string - description: address is the account address of group policy. - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group admin. - metadata: - type: string - title: >- - metadata is any arbitrary metadata attached to the group policy. - - the recommended format of the metadata is to be found here: - - https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 - version: - type: string - format: uint64 - description: >- - version is used to track changes to a group's GroupPolicyInfo - structure that - - would create a different result on a running proposal. - decision_policy: - description: decision_policy specifies the group policy's decision policy. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - created_at: - type: string - format: date-time - description: >- - created_at is a timestamp specifying when a group policy was - created. - description: >- - GroupPolicyInfo represents the high-level on-chain information for a - group policy. - description: >- - group_policies are the group policies info associated with the - provided group. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGroupPoliciesByGroupResponse is the Query/GroupPoliciesByGroup - response type. - cosmos.group.v1.QueryGroupPolicyInfoResponse: - type: object - properties: - info: - description: info is the GroupPolicyInfo of the group policy. - type: object - properties: - address: - type: string - description: address is the account address of group policy. - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group admin. - metadata: - type: string - title: |- - metadata is any arbitrary metadata attached to the group policy. - the recommended format of the metadata is to be found here: - https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 - version: - type: string - format: uint64 - description: >- - version is used to track changes to a group's GroupPolicyInfo - structure that - - would create a different result on a running proposal. - decision_policy: - description: decision_policy specifies the group policy's decision policy. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - created_at: - type: string - format: date-time - description: >- - created_at is a timestamp specifying when a group policy was - created. - description: QueryGroupPolicyInfoResponse is the Query/GroupPolicyInfo response type. - cosmos.group.v1.QueryGroupsByAdminResponse: - type: object - properties: - groups: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group's admin. - metadata: - type: string - description: metadata is any arbitrary metadata to attached to the group. - version: - type: string - format: uint64 - title: >- - version is used to track changes to a group's membership - structure that - - would break existing proposals. Whenever any members weight is - changed, - - or any member is added or removed this version is incremented - and will - - cause proposals based on older versions of this group to fail - total_weight: - type: string - description: total_weight is the sum of the group members' weights. - created_at: - type: string - format: date-time - description: created_at is a timestamp specifying when a group was created. - description: >- - GroupInfo represents the high-level on-chain information for a - group. - description: groups are the groups info with the provided admin. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGroupsByAdminResponse is the Query/GroupsByAdminResponse response - type. - cosmos.group.v1.QueryGroupsByMemberResponse: - type: object - properties: - groups: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group's admin. - metadata: - type: string - description: metadata is any arbitrary metadata to attached to the group. - version: - type: string - format: uint64 - title: >- - version is used to track changes to a group's membership - structure that - - would break existing proposals. Whenever any members weight is - changed, - - or any member is added or removed this version is incremented - and will - - cause proposals based on older versions of this group to fail - total_weight: - type: string - description: total_weight is the sum of the group members' weights. - created_at: - type: string - format: date-time - description: created_at is a timestamp specifying when a group was created. - description: >- - GroupInfo represents the high-level on-chain information for a - group. - description: groups are the groups info with the provided group member. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: QueryGroupsByMemberResponse is the Query/GroupsByMember response type. - cosmos.group.v1.QueryGroupsResponse: - type: object - properties: - groups: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group's admin. - metadata: - type: string - description: metadata is any arbitrary metadata to attached to the group. - version: - type: string - format: uint64 - title: >- - version is used to track changes to a group's membership - structure that - - would break existing proposals. Whenever any members weight is - changed, - - or any member is added or removed this version is incremented - and will - - cause proposals based on older versions of this group to fail - total_weight: - type: string - description: total_weight is the sum of the group members' weights. - created_at: - type: string - format: date-time - description: created_at is a timestamp specifying when a group was created. - description: >- - GroupInfo represents the high-level on-chain information for a - group. - description: '`groups` is all the groups present in state.' - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryGroupsResponse is the Query/Groups response type. - - Since: cosmos-sdk 0.47.1 - cosmos.group.v1.QueryProposalResponse: - type: object - properties: - proposal: - description: proposal is the proposal info. - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique id of the proposal. - group_policy_address: - type: string - description: group_policy_address is the account address of group policy. - metadata: - type: string - title: |- - metadata is any arbitrary metadata attached to the proposal. - the recommended format of the metadata is to be found here: - https://docs.cosmos.network/v0.47/modules/group#proposal-4 - proposers: - type: array - items: - type: string - description: proposers are the account addresses of the proposers. - submit_time: - type: string - format: date-time - description: >- - submit_time is a timestamp specifying when a proposal was - submitted. - group_version: - type: string - format: uint64 - description: >- - group_version tracks the version of the group at proposal - submission. - - This field is here for informational purposes only. - group_policy_version: - type: string - format: uint64 - description: >- - group_policy_version tracks the version of the group policy at - proposal submission. - - When a decision policy is changed, existing proposals from - previous policy - - versions will become invalid with the `ABORTED` status. - - This field is here for informational purposes only. - status: - description: >- - status represents the high level position in the life cycle of the - proposal. Initial value is Submitted. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_SUBMITTED - - PROPOSAL_STATUS_ACCEPTED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_ABORTED - - PROPOSAL_STATUS_WITHDRAWN - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result contains the sums of all weighted votes for - this - - proposal for each vote option. It is empty at submission, and only - - populated after tallying, at voting period end or at proposal - execution, - - whichever happens first. - type: object - properties: - yes_count: - type: string - description: yes_count is the weighted sum of yes votes. - abstain_count: - type: string - description: abstain_count is the weighted sum of abstainers. - no_count: - type: string - description: no_count is the weighted sum of no votes. - no_with_veto_count: - type: string - description: no_with_veto_count is the weighted sum of veto. - voting_period_end: - type: string - format: date-time - description: >- - voting_period_end is the timestamp before which voting must be - done. - - Unless a successful MsgExec is called before (to execute a - proposal whose - - tally is successful before the voting period ends), tallying will - be done - - at this point, and the `final_tally_result`and `status` fields - will be - - accordingly updated. - executor_result: - description: >- - executor_result is the final result of the proposal execution. - Initial value is NotRun. - type: string - enum: - - PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - - PROPOSAL_EXECUTOR_RESULT_NOT_RUN - - PROPOSAL_EXECUTOR_RESULT_SUCCESS - - PROPOSAL_EXECUTOR_RESULT_FAILURE - default: PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages is a list of `sdk.Msg`s that will be executed if the - proposal passes. - title: - type: string - description: 'Since: cosmos-sdk 0.47' - title: title is the title of the proposal - summary: - type: string - description: 'Since: cosmos-sdk 0.47' - title: summary is a short summary of the proposal - description: QueryProposalResponse is the Query/Proposal response type. - cosmos.group.v1.QueryProposalsByGroupPolicyResponse: - type: object - properties: - proposals: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique id of the proposal. - group_policy_address: - type: string - description: group_policy_address is the account address of group policy. - metadata: - type: string - title: |- - metadata is any arbitrary metadata attached to the proposal. - the recommended format of the metadata is to be found here: - https://docs.cosmos.network/v0.47/modules/group#proposal-4 - proposers: - type: array - items: - type: string - description: proposers are the account addresses of the proposers. - submit_time: - type: string - format: date-time - description: >- - submit_time is a timestamp specifying when a proposal was - submitted. - group_version: - type: string - format: uint64 - description: >- - group_version tracks the version of the group at proposal - submission. - - This field is here for informational purposes only. - group_policy_version: - type: string - format: uint64 - description: >- - group_policy_version tracks the version of the group policy at - proposal submission. - - When a decision policy is changed, existing proposals from - previous policy - - versions will become invalid with the `ABORTED` status. - - This field is here for informational purposes only. - status: - description: >- - status represents the high level position in the life cycle of - the proposal. Initial value is Submitted. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_SUBMITTED - - PROPOSAL_STATUS_ACCEPTED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_ABORTED - - PROPOSAL_STATUS_WITHDRAWN - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result contains the sums of all weighted votes for - this - - proposal for each vote option. It is empty at submission, and - only - - populated after tallying, at voting period end or at proposal - execution, - - whichever happens first. - type: object - properties: - yes_count: - type: string - description: yes_count is the weighted sum of yes votes. - abstain_count: - type: string - description: abstain_count is the weighted sum of abstainers. - no_count: - type: string - description: no_count is the weighted sum of no votes. - no_with_veto_count: - type: string - description: no_with_veto_count is the weighted sum of veto. - voting_period_end: - type: string - format: date-time - description: >- - voting_period_end is the timestamp before which voting must be - done. - - Unless a successful MsgExec is called before (to execute a - proposal whose - - tally is successful before the voting period ends), tallying - will be done - - at this point, and the `final_tally_result`and `status` fields - will be - - accordingly updated. - executor_result: - description: >- - executor_result is the final result of the proposal execution. - Initial value is NotRun. - type: string - enum: - - PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - - PROPOSAL_EXECUTOR_RESULT_NOT_RUN - - PROPOSAL_EXECUTOR_RESULT_SUCCESS - - PROPOSAL_EXECUTOR_RESULT_FAILURE - default: PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages is a list of `sdk.Msg`s that will be executed if the - proposal passes. - title: - type: string - description: 'Since: cosmos-sdk 0.47' - title: title is the title of the proposal - summary: - type: string - description: 'Since: cosmos-sdk 0.47' - title: summary is a short summary of the proposal - description: >- - Proposal defines a group proposal. Any member of a group can submit - a proposal - - for a group policy to decide upon. - - A proposal consists of a set of `sdk.Msg`s that will be executed if - the proposal - - passes as well as some optional metadata associated with the - proposal. - description: proposals are the proposals with given group policy. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryProposalsByGroupPolicyResponse is the Query/ProposalByGroupPolicy - response type. - cosmos.group.v1.QueryTallyResultResponse: - type: object - properties: - tally: - description: tally defines the requested tally. - type: object - properties: - yes_count: - type: string - description: yes_count is the weighted sum of yes votes. - abstain_count: - type: string - description: abstain_count is the weighted sum of abstainers. - no_count: - type: string - description: no_count is the weighted sum of no votes. - no_with_veto_count: - type: string - description: no_with_veto_count is the weighted sum of veto. - description: QueryTallyResultResponse is the Query/TallyResult response type. - cosmos.group.v1.QueryVoteByProposalVoterResponse: - type: object - properties: - vote: - description: vote is the vote with given proposal_id and voter. - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal is the unique ID of the proposal. - voter: - type: string - description: voter is the account address of the voter. - option: - description: option is the voter's choice on the proposal. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - metadata: - type: string - description: metadata is any arbitrary metadata attached to the vote. - submit_time: - type: string - format: date-time - description: submit_time is the timestamp when the vote was submitted. - description: >- - QueryVoteByProposalVoterResponse is the Query/VoteByProposalVoter response - type. - cosmos.group.v1.QueryVotesByProposalResponse: - type: object - properties: - votes: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal is the unique ID of the proposal. - voter: - type: string - description: voter is the account address of the voter. - option: - description: option is the voter's choice on the proposal. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - metadata: - type: string - description: metadata is any arbitrary metadata attached to the vote. - submit_time: - type: string - format: date-time - description: submit_time is the timestamp when the vote was submitted. - description: Vote represents a vote for a proposal. - description: votes are the list of votes for given proposal_id. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: QueryVotesByProposalResponse is the Query/VotesByProposal response type. - cosmos.group.v1.QueryVotesByVoterResponse: - type: object - properties: - votes: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal is the unique ID of the proposal. - voter: - type: string - description: voter is the account address of the voter. - option: - description: option is the voter's choice on the proposal. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - metadata: - type: string - description: metadata is any arbitrary metadata attached to the vote. - submit_time: - type: string - format: date-time - description: submit_time is the timestamp when the vote was submitted. - description: Vote represents a vote for a proposal. - description: votes are the list of votes by given voter. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: QueryVotesByVoterResponse is the Query/VotesByVoter response type. - cosmos.group.v1.TallyResult: - type: object - properties: - yes_count: - type: string - description: yes_count is the weighted sum of yes votes. - abstain_count: - type: string - description: abstain_count is the weighted sum of abstainers. - no_count: - type: string - description: no_count is the weighted sum of no votes. - no_with_veto_count: - type: string - description: no_with_veto_count is the weighted sum of veto. - description: TallyResult represents the sum of weighted votes for each vote option. - cosmos.group.v1.Vote: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal is the unique ID of the proposal. - voter: - type: string - description: voter is the account address of the voter. - option: - description: option is the voter's choice on the proposal. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - metadata: - type: string - description: metadata is any arbitrary metadata attached to the vote. - submit_time: - type: string - format: date-time - description: submit_time is the timestamp when the vote was submitted. - description: Vote represents a vote for a proposal. - cosmos.group.v1.VoteOption: - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - description: |- - VoteOption enumerates the valid vote options for a given proposal. - - - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines an unspecified vote option which will - return an error. - - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option. - - VOTE_OPTION_ABSTAIN: VOTE_OPTION_ABSTAIN defines an abstain vote option. - - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. - - VOTE_OPTION_NO_WITH_VETO: VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. - cosmos.mint.v1beta1.MsgUpdateParamsResponse: - type: object - description: |- - MsgUpdateParamsResponse defines the response structure for executing a - MsgUpdateParams message. - - Since: cosmos-sdk 0.47 - cosmos.mint.v1beta1.Params: - type: object - properties: - mint_denom: - type: string - title: type of coin to mint - inflation_rate_change: - type: string - title: maximum annual change in inflation rate - inflation_max: - type: string - title: maximum inflation rate - inflation_min: - type: string - title: minimum inflation rate - goal_bonded: - type: string - title: goal of percent bonded atoms - blocks_per_year: - type: string - format: uint64 - title: expected blocks per year - description: Params defines the parameters for the x/mint module. - cosmos.mint.v1beta1.QueryAnnualProvisionsResponse: - type: object - properties: - annual_provisions: - type: string - format: byte - description: annual_provisions is the current minting annual provisions value. - description: |- - QueryAnnualProvisionsResponse is the response type for the - Query/AnnualProvisions RPC method. - cosmos.mint.v1beta1.QueryInflationResponse: - type: object - properties: - inflation: - type: string - format: byte - description: inflation is the current minting inflation value. - description: |- - QueryInflationResponse is the response type for the Query/Inflation RPC - method. - cosmos.mint.v1beta1.QueryParamsResponse: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - mint_denom: - type: string - title: type of coin to mint - inflation_rate_change: - type: string - title: maximum annual change in inflation rate - inflation_max: - type: string - title: maximum inflation rate - inflation_min: - type: string - title: minimum inflation rate - goal_bonded: - type: string - title: goal of percent bonded atoms - blocks_per_year: - type: string - format: uint64 - title: expected blocks per year - description: QueryParamsResponse is the response type for the Query/Params RPC method. - cosmos.nft.v1beta1.Class: - type: object - properties: - id: - type: string - title: >- - id defines the unique identifier of the NFT classification, similar to - the contract address of ERC721 - name: - type: string - title: >- - name defines the human-readable name of the NFT classification. - Optional - symbol: - type: string - title: symbol is an abbreviated name for nft classification. Optional - description: - type: string - title: description is a brief description of nft classification. Optional - uri: - type: string - title: >- - uri for the class metadata stored off chain. It can define schema for - Class and NFT `Data` attributes. Optional - uri_hash: - type: string - title: uri_hash is a hash of the document pointed by uri. Optional - data: - title: data is the app specific metadata of the NFT class. Optional - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: Class defines the class of the nft type. - cosmos.nft.v1beta1.MsgSendResponse: - type: object - description: MsgSendResponse defines the Msg/Send response type. - cosmos.nft.v1beta1.NFT: - type: object - properties: - class_id: - type: string - title: >- - class_id associated with the NFT, similar to the contract address of - ERC721 - id: - type: string - title: id is a unique identifier of the NFT - uri: - type: string - title: uri for the NFT metadata stored off chain - uri_hash: - type: string - title: uri_hash is a hash of the document pointed by uri - data: - title: data is an app specific data of the NFT. Optional - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: NFT defines the NFT. - cosmos.nft.v1beta1.QueryBalanceResponse: - type: object - properties: - amount: - type: string - format: uint64 - title: amount is the number of all NFTs of a given class owned by the owner - title: QueryBalanceResponse is the response type for the Query/Balance RPC method - cosmos.nft.v1beta1.QueryClassResponse: - type: object - properties: - class: - description: class defines the class of the nft type. - type: object - properties: - id: - type: string - title: >- - id defines the unique identifier of the NFT classification, - similar to the contract address of ERC721 - name: - type: string - title: >- - name defines the human-readable name of the NFT classification. - Optional - symbol: - type: string - title: symbol is an abbreviated name for nft classification. Optional - description: - type: string - title: description is a brief description of nft classification. Optional - uri: - type: string - title: >- - uri for the class metadata stored off chain. It can define schema - for Class and NFT `Data` attributes. Optional - uri_hash: - type: string - title: uri_hash is a hash of the document pointed by uri. Optional - data: - title: data is the app specific metadata of the NFT class. Optional - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - title: QueryClassResponse is the response type for the Query/Class RPC method - cosmos.nft.v1beta1.QueryClassesResponse: - type: object - properties: - classes: - type: array - items: - type: object - properties: - id: - type: string - title: >- - id defines the unique identifier of the NFT classification, - similar to the contract address of ERC721 - name: - type: string - title: >- - name defines the human-readable name of the NFT classification. - Optional - symbol: - type: string - title: symbol is an abbreviated name for nft classification. Optional - description: - type: string - title: >- - description is a brief description of nft classification. - Optional - uri: - type: string - title: >- - uri for the class metadata stored off chain. It can define - schema for Class and NFT `Data` attributes. Optional - uri_hash: - type: string - title: uri_hash is a hash of the document pointed by uri. Optional - data: - title: data is the app specific metadata of the NFT class. Optional - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: Class defines the class of the nft type. - description: class defines the class of the nft type. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - title: QueryClassesResponse is the response type for the Query/Classes RPC method - cosmos.nft.v1beta1.QueryNFTResponse: - type: object - properties: - nft: - title: owner is the owner address of the nft - type: object - properties: - class_id: - type: string - title: >- - class_id associated with the NFT, similar to the contract address - of ERC721 - id: - type: string - title: id is a unique identifier of the NFT - uri: - type: string - title: uri for the NFT metadata stored off chain - uri_hash: - type: string - title: uri_hash is a hash of the document pointed by uri - data: - title: data is an app specific data of the NFT. Optional - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: NFT defines the NFT. - title: QueryNFTResponse is the response type for the Query/NFT RPC method - cosmos.nft.v1beta1.QueryNFTsResponse: - type: object - properties: - nfts: - type: array - items: - type: object - properties: - class_id: - type: string - title: >- - class_id associated with the NFT, similar to the contract - address of ERC721 - id: - type: string - title: id is a unique identifier of the NFT - uri: - type: string - title: uri for the NFT metadata stored off chain - uri_hash: - type: string - title: uri_hash is a hash of the document pointed by uri - data: - title: data is an app specific data of the NFT. Optional - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: NFT defines the NFT. - title: NFT defines the NFT - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - title: QueryNFTsResponse is the response type for the Query/NFTs RPC methods - cosmos.nft.v1beta1.QueryOwnerResponse: - type: object - properties: - owner: - type: string - title: owner is the owner address of the nft - title: QueryOwnerResponse is the response type for the Query/Owner RPC method - cosmos.nft.v1beta1.QuerySupplyResponse: - type: object - properties: - amount: - type: string - format: uint64 - title: amount is the number of all NFTs from the given class - title: QuerySupplyResponse is the response type for the Query/Supply RPC method - cosmos.params.v1beta1.ParamChange: - type: object - properties: - subspace: - type: string - key: - type: string - value: - type: string - description: |- - ParamChange defines an individual parameter change, for use in - ParameterChangeProposal. - cosmos.params.v1beta1.QueryParamsResponse: - type: object - properties: - param: - description: param defines the queried parameter. - type: object - properties: - subspace: - type: string - key: - type: string - value: - type: string - description: QueryParamsResponse is response type for the Query/Params RPC method. - cosmos.params.v1beta1.QuerySubspacesResponse: - type: object - properties: - subspaces: - type: array - items: - type: object - properties: - subspace: - type: string - keys: - type: array - items: - type: string - description: >- - Subspace defines a parameter subspace name and all the keys that - exist for - - the subspace. - - - Since: cosmos-sdk 0.46 - description: |- - QuerySubspacesResponse defines the response types for querying for all - registered subspaces and all keys for a subspace. - - Since: cosmos-sdk 0.46 - cosmos.params.v1beta1.Subspace: - type: object - properties: - subspace: - type: string - keys: - type: array - items: - type: string - description: |- - Subspace defines a parameter subspace name and all the keys that exist for - the subspace. - - Since: cosmos-sdk 0.46 - cosmos.slashing.v1beta1.MsgUnjailResponse: - type: object - title: MsgUnjailResponse defines the Msg/Unjail response type - cosmos.slashing.v1beta1.MsgUpdateParamsResponse: - type: object - description: |- - MsgUpdateParamsResponse defines the response structure for executing a - MsgUpdateParams message. - - Since: cosmos-sdk 0.47 - cosmos.slashing.v1beta1.Params: - type: object - properties: - signed_blocks_window: - type: string - format: int64 - min_signed_per_window: - type: string - format: byte - downtime_jail_duration: - type: string - slash_fraction_double_sign: - type: string - format: byte - slash_fraction_downtime: - type: string - format: byte - description: Params represents the parameters used for by the slashing module. - cosmos.slashing.v1beta1.QueryParamsResponse: - type: object - properties: - params: - type: object - properties: - signed_blocks_window: - type: string - format: int64 - min_signed_per_window: - type: string - format: byte - downtime_jail_duration: - type: string - slash_fraction_double_sign: - type: string - format: byte - slash_fraction_downtime: - type: string - format: byte - description: Params represents the parameters used for by the slashing module. - title: QueryParamsResponse is the response type for the Query/Params RPC method - cosmos.slashing.v1beta1.QuerySigningInfoResponse: - type: object - properties: - val_signing_info: - title: val_signing_info is the signing info of requested val cons address - type: object - properties: - address: - type: string - start_height: - type: string - format: int64 - title: Height at which validator was first a candidate OR was unjailed - index_offset: - type: string - format: int64 - description: >- - Index which is incremented each time the validator was a bonded - - in a block and may have signed a precommit or not. This in - conjunction with the - - `SignedBlocksWindow` param determines the index in the - `MissedBlocksBitArray`. - jailed_until: - type: string - format: date-time - description: >- - Timestamp until which the validator is jailed due to liveness - downtime. - tombstoned: - type: boolean - description: >- - Whether or not a validator has been tombstoned (killed out of - validator set). It is set - - once the validator commits an equivocation or for any other - configured misbehiavor. - missed_blocks_counter: - type: string - format: int64 - description: >- - A counter kept to avoid unnecessary array reads. - - Note that `Sum(MissedBlocksBitArray)` always equals - `MissedBlocksCounter`. - description: >- - ValidatorSigningInfo defines a validator's signing info for monitoring - their - - liveness activity. - title: >- - QuerySigningInfoResponse is the response type for the Query/SigningInfo - RPC - - method - cosmos.slashing.v1beta1.QuerySigningInfosResponse: - type: object - properties: - info: - type: array - items: - type: object - properties: - address: - type: string - start_height: - type: string - format: int64 - title: Height at which validator was first a candidate OR was unjailed - index_offset: - type: string - format: int64 - description: >- - Index which is incremented each time the validator was a bonded - - in a block and may have signed a precommit or not. This in - conjunction with the - - `SignedBlocksWindow` param determines the index in the - `MissedBlocksBitArray`. - jailed_until: - type: string - format: date-time - description: >- - Timestamp until which the validator is jailed due to liveness - downtime. - tombstoned: - type: boolean - description: >- - Whether or not a validator has been tombstoned (killed out of - validator set). It is set - - once the validator commits an equivocation or for any other - configured misbehiavor. - missed_blocks_counter: - type: string - format: int64 - description: >- - A counter kept to avoid unnecessary array reads. - - Note that `Sum(MissedBlocksBitArray)` always equals - `MissedBlocksCounter`. - description: >- - ValidatorSigningInfo defines a validator's signing info for - monitoring their - - liveness activity. - title: info is the signing info of all validators - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - title: >- - QuerySigningInfosResponse is the response type for the Query/SigningInfos - RPC - - method - cosmos.slashing.v1beta1.ValidatorSigningInfo: - type: object - properties: - address: - type: string - start_height: - type: string - format: int64 - title: Height at which validator was first a candidate OR was unjailed - index_offset: - type: string - format: int64 - description: >- - Index which is incremented each time the validator was a bonded - - in a block and may have signed a precommit or not. This in conjunction - with the - - `SignedBlocksWindow` param determines the index in the - `MissedBlocksBitArray`. - jailed_until: - type: string - format: date-time - description: >- - Timestamp until which the validator is jailed due to liveness - downtime. - tombstoned: - type: boolean - description: >- - Whether or not a validator has been tombstoned (killed out of - validator set). It is set - - once the validator commits an equivocation or for any other configured - misbehiavor. - missed_blocks_counter: - type: string - format: int64 - description: >- - A counter kept to avoid unnecessary array reads. - - Note that `Sum(MissedBlocksBitArray)` always equals - `MissedBlocksCounter`. - description: >- - ValidatorSigningInfo defines a validator's signing info for monitoring - their - - liveness activity. - cosmos.staking.v1beta1.BondStatus: - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - description: |- - BondStatus is the status of a validator. - - - BOND_STATUS_UNSPECIFIED: UNSPECIFIED defines an invalid validator status. - - BOND_STATUS_UNBONDED: UNBONDED defines a validator that is not bonded. - - BOND_STATUS_UNBONDING: UNBONDING defines a validator that is unbonding. - - BOND_STATUS_BONDED: BONDED defines a validator that is bonded. - cosmos.staking.v1beta1.Commission: - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates to be used for - creating a validator. - type: object - properties: - rate: - type: string - description: rate is the commission rate charged to delegators, as a fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which validator can - ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase of the - validator commission, as a fraction. - update_time: - type: string - format: date-time - description: update_time is the last time the commission rate was changed. - description: Commission defines commission parameters for a given validator. - cosmos.staking.v1beta1.CommissionRates: - type: object - properties: - rate: - type: string - description: rate is the commission rate charged to delegators, as a fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which validator can ever - charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase of the validator - commission, as a fraction. - description: >- - CommissionRates defines the initial commission rates to be used for - creating - - a validator. - cosmos.staking.v1beta1.Delegation: - type: object - properties: - delegator_address: - type: string - description: delegator_address is the bech32-encoded address of the delegator. - validator_address: - type: string - description: validator_address is the bech32-encoded address of the validator. - shares: - type: string - description: shares define the delegation shares received. - description: |- - Delegation represents the bond with tokens held by an account. It is - owned by one delegator, and is associated with the voting power of one - validator. - cosmos.staking.v1beta1.DelegationResponse: - type: object - properties: - delegation: - type: object - properties: - delegator_address: - type: string - description: delegator_address is the bech32-encoded address of the delegator. - validator_address: - type: string - description: validator_address is the bech32-encoded address of the validator. - shares: - type: string - description: shares define the delegation shares received. - description: |- - Delegation represents the bond with tokens held by an account. It is - owned by one delegator, and is associated with the voting power of one - validator. - balance: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: |- - DelegationResponse is equivalent to Delegation except that it contains a - balance in addition to shares which is more suitable for client responses. - cosmos.staking.v1beta1.Description: - type: object - properties: - moniker: - type: string - description: moniker defines a human-readable name for the validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. UPort or - Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: security_contact defines an optional email for security contact. - details: - type: string - description: details define other optional details. - description: Description defines a validator description. - cosmos.staking.v1beta1.HistoricalInfo: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block in - the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - valset: - type: array - items: - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the validator's - operator; bech encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the validator, - as a Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed from bonded - status or not. - status: - description: status is the validator status (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: tokens define the delegated tokens (incl. self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a validator's - delegators. - description: - description: description defines the description terms for the validator. - type: object - properties: - moniker: - type: string - description: moniker defines a human-readable name for the validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. UPort - or Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: >- - security_contact defines an optional email for security - contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height at which this - validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time for the - validator to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates to be - used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to delegators, as a - fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which - validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase of - the validator commission, as a fraction. - update_time: - type: string - format: date-time - description: >- - update_time is the last time the commission rate was - changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared minimum - self delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has been stopped - by external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an unbonding of - this validator - description: >- - Validator defines a validator, together with the total amount of the - - Validator's bond shares and their exchange rate to coins. Slashing - results in - - a decrease in the exchange rate, allowing correct calculation of - future - - undelegations without iterating over delegators. When coins are - delegated to - - this validator, the validator is credited with a delegation whose - number of - - bond shares is based on the amount of coins delegated divided by the - current - - exchange rate. Voting power can be calculated as total bonded shares - - multiplied by exchange rate. - description: >- - HistoricalInfo contains header and validator information for a given - block. - - It is stored as part of staking module's state, which persists the `n` - most - - recent HistoricalInfo - - (`n` is set by the staking module's `historical_entries` parameter). - cosmos.staking.v1beta1.MsgBeginRedelegateResponse: - type: object - properties: - completion_time: - type: string - format: date-time - description: MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. - cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse: - type: object - description: 'Since: cosmos-sdk 0.46' - title: MsgCancelUnbondingDelegationResponse - cosmos.staking.v1beta1.MsgCreateValidatorResponse: - type: object - description: MsgCreateValidatorResponse defines the Msg/CreateValidator response type. - cosmos.staking.v1beta1.MsgDelegateResponse: - type: object - description: MsgDelegateResponse defines the Msg/Delegate response type. - cosmos.staking.v1beta1.MsgEditValidatorResponse: - type: object - description: MsgEditValidatorResponse defines the Msg/EditValidator response type. - cosmos.staking.v1beta1.MsgUndelegateResponse: - type: object - properties: - completion_time: - type: string - format: date-time - description: MsgUndelegateResponse defines the Msg/Undelegate response type. - cosmos.staking.v1beta1.MsgUpdateParamsResponse: - type: object - description: |- - MsgUpdateParamsResponse defines the response structure for executing a - MsgUpdateParams message. - - Since: cosmos-sdk 0.47 - cosmos.staking.v1beta1.Params: - type: object - properties: - unbonding_time: - type: string - description: unbonding_time is the time duration of unbonding. - max_validators: - type: integer - format: int64 - description: max_validators is the maximum number of validators. - max_entries: - type: integer - format: int64 - description: >- - max_entries is the max entries for either unbonding delegation or - redelegation (per pair/trio). - historical_entries: - type: integer - format: int64 - description: historical_entries is the number of historical entries to persist. - bond_denom: - type: string - description: bond_denom defines the bondable coin denomination. - min_commission_rate: - type: string - title: >- - min_commission_rate is the chain-wide minimum commission rate that a - validator can charge their delegators - description: Params defines the parameters for the x/staking module. - cosmos.staking.v1beta1.Pool: - type: object - properties: - not_bonded_tokens: - type: string - bonded_tokens: - type: string - description: |- - Pool is used for tracking bonded and not-bonded token supply of the bond - denomination. - cosmos.staking.v1beta1.QueryDelegationResponse: - type: object - properties: - delegation_response: - description: delegation_responses defines the delegation info of a delegation. - type: object - properties: - delegation: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. - validator_address: - type: string - description: >- - validator_address is the bech32-encoded address of the - validator. - shares: - type: string - description: shares define the delegation shares received. - description: >- - Delegation represents the bond with tokens held by an account. It - is - - owned by one delegator, and is associated with the voting power of - one - - validator. - balance: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: >- - QueryDelegationResponse is response type for the Query/Delegation RPC - method. - cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse: - type: object - properties: - delegation_responses: - type: array - items: - type: object - properties: - delegation: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. - validator_address: - type: string - description: >- - validator_address is the bech32-encoded address of the - validator. - shares: - type: string - description: shares define the delegation shares received. - description: >- - Delegation represents the bond with tokens held by an account. - It is - - owned by one delegator, and is associated with the voting power - of one - - validator. - balance: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: >- - DelegationResponse is equivalent to Delegation except that it - contains a - - balance in addition to shares which is more suitable for client - responses. - description: delegation_responses defines all the delegations' info of a delegator. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryDelegatorDelegationsResponse is response type for the - Query/DelegatorDelegations RPC method. - cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse: - type: object - properties: - unbonding_responses: - type: array - items: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. - validator_address: - type: string - description: >- - validator_address is the bech32-encoded address of the - validator. - entries: - type: array - items: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height is the height which the unbonding took - place. - completion_time: - type: string - format: date-time - description: completion_time is the unix time for unbonding completion. - initial_balance: - type: string - description: >- - initial_balance defines the tokens initially scheduled to - receive at completion. - balance: - type: string - description: balance defines the tokens to receive at completion. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been - stopped by external modules - description: >- - UnbondingDelegationEntry defines an unbonding object with - relevant metadata. - description: |- - entries are the unbonding delegation entries. - - unbonding delegation entries - description: >- - UnbondingDelegation stores all of a single delegator's unbonding - bonds - - for a single validator in an time-ordered list. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryUnbondingDelegatorDelegationsResponse is response type for the - Query/UnbondingDelegatorDelegations RPC method. - cosmos.staking.v1beta1.QueryDelegatorValidatorResponse: - type: object - properties: - validator: - description: validator defines the validator info. - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the validator's operator; - bech encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the validator, as - a Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed from bonded - status or not. - status: - description: status is the validator status (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: tokens define the delegated tokens (incl. self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a validator's - delegators. - description: - description: description defines the description terms for the validator. - type: object - properties: - moniker: - type: string - description: moniker defines a human-readable name for the validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. UPort or - Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: >- - security_contact defines an optional email for security - contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height at which this - validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time for the - validator to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates to be - used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to delegators, as a - fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which - validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase of the - validator commission, as a fraction. - update_time: - type: string - format: date-time - description: update_time is the last time the commission rate was changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared minimum self - delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has been stopped - by external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an unbonding of - this validator - description: |- - QueryDelegatorValidatorResponse response type for the - Query/DelegatorValidator RPC method. - cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse: - type: object - properties: - validators: - type: array - items: - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the validator's - operator; bech encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the validator, - as a Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed from bonded - status or not. - status: - description: status is the validator status (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: tokens define the delegated tokens (incl. self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a validator's - delegators. - description: - description: description defines the description terms for the validator. - type: object - properties: - moniker: - type: string - description: moniker defines a human-readable name for the validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. UPort - or Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: >- - security_contact defines an optional email for security - contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height at which this - validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time for the - validator to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates to be - used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to delegators, as a - fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which - validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase of - the validator commission, as a fraction. - update_time: - type: string - format: date-time - description: >- - update_time is the last time the commission rate was - changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared minimum - self delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has been stopped - by external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an unbonding of - this validator - description: >- - Validator defines a validator, together with the total amount of the - - Validator's bond shares and their exchange rate to coins. Slashing - results in - - a decrease in the exchange rate, allowing correct calculation of - future - - undelegations without iterating over delegators. When coins are - delegated to - - this validator, the validator is credited with a delegation whose - number of - - bond shares is based on the amount of coins delegated divided by the - current - - exchange rate. Voting power can be calculated as total bonded shares - - multiplied by exchange rate. - description: validators defines the validators' info of a delegator. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryDelegatorValidatorsResponse is response type for the - Query/DelegatorValidators RPC method. - cosmos.staking.v1beta1.QueryHistoricalInfoResponse: - type: object - properties: - hist: - description: hist defines the historical info at the given height. - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block - in the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - valset: - type: array - items: - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the validator's - operator; bech encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the - validator, as a Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed from - bonded status or not. - status: - description: status is the validator status (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: tokens define the delegated tokens (incl. self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a - validator's delegators. - description: - description: description defines the description terms for the validator. - type: object - properties: - moniker: - type: string - description: moniker defines a human-readable name for the validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. - UPort or Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: >- - security_contact defines an optional email for security - contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height at which - this validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time for the - validator to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates to - be used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to delegators, - as a fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which - validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase - of the validator commission, as a fraction. - update_time: - type: string - format: date-time - description: >- - update_time is the last time the commission rate was - changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared minimum - self delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has been - stopped by external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an unbonding - of this validator - description: >- - Validator defines a validator, together with the total amount of - the - - Validator's bond shares and their exchange rate to coins. - Slashing results in - - a decrease in the exchange rate, allowing correct calculation of - future - - undelegations without iterating over delegators. When coins are - delegated to - - this validator, the validator is credited with a delegation - whose number of - - bond shares is based on the amount of coins delegated divided by - the current - - exchange rate. Voting power can be calculated as total bonded - shares - - multiplied by exchange rate. - description: >- - QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo - RPC - - method. - cosmos.staking.v1beta1.QueryParamsResponse: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - properties: - unbonding_time: - type: string - description: unbonding_time is the time duration of unbonding. - max_validators: - type: integer - format: int64 - description: max_validators is the maximum number of validators. - max_entries: - type: integer - format: int64 - description: >- - max_entries is the max entries for either unbonding delegation or - redelegation (per pair/trio). - historical_entries: - type: integer - format: int64 - description: historical_entries is the number of historical entries to persist. - bond_denom: - type: string - description: bond_denom defines the bondable coin denomination. - min_commission_rate: - type: string - title: >- - min_commission_rate is the chain-wide minimum commission rate that - a validator can charge their delegators - description: QueryParamsResponse is response type for the Query/Params RPC method. - cosmos.staking.v1beta1.QueryPoolResponse: - type: object - properties: - pool: - description: pool defines the pool info. - type: object - properties: - not_bonded_tokens: - type: string - bonded_tokens: - type: string - description: QueryPoolResponse is response type for the Query/Pool RPC method. - cosmos.staking.v1beta1.QueryRedelegationsResponse: - type: object - properties: - redelegation_responses: - type: array - items: - type: object - properties: - redelegation: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. - validator_src_address: - type: string - description: >- - validator_src_address is the validator redelegation source - operator address. - validator_dst_address: - type: string - description: >- - validator_dst_address is the validator redelegation - destination operator address. - entries: - type: array - items: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height defines the height which the - redelegation took place. - completion_time: - type: string - format: date-time - description: >- - completion_time defines the unix time for redelegation - completion. - initial_balance: - type: string - description: >- - initial_balance defines the initial balance when - redelegation started. - shares_dst: - type: string - description: >- - shares_dst is the amount of destination-validator - shares created by redelegation. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been - stopped by external modules - description: >- - RedelegationEntry defines a redelegation object with - relevant metadata. - description: |- - entries are the redelegation entries. - - redelegation entries - description: >- - Redelegation contains the list of a particular delegator's - redelegating bonds - - from a particular source validator to a particular destination - validator. - entries: - type: array - items: - type: object - properties: - redelegation_entry: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height defines the height which the - redelegation took place. - completion_time: - type: string - format: date-time - description: >- - completion_time defines the unix time for redelegation - completion. - initial_balance: - type: string - description: >- - initial_balance defines the initial balance when - redelegation started. - shares_dst: - type: string - description: >- - shares_dst is the amount of destination-validator - shares created by redelegation. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been - stopped by external modules - description: >- - RedelegationEntry defines a redelegation object with - relevant metadata. - balance: - type: string - description: >- - RedelegationEntryResponse is equivalent to a RedelegationEntry - except that it - - contains a balance in addition to shares which is more - suitable for client - - responses. - description: >- - RedelegationResponse is equivalent to a Redelegation except that its - entries - - contain a balance in addition to shares which is more suitable for - client - - responses. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryRedelegationsResponse is response type for the Query/Redelegations - RPC - - method. - cosmos.staking.v1beta1.QueryUnbondingDelegationResponse: - type: object - properties: - unbond: - description: unbond defines the unbonding information of a delegation. - type: object - properties: - delegator_address: - type: string - description: delegator_address is the bech32-encoded address of the delegator. - validator_address: - type: string - description: validator_address is the bech32-encoded address of the validator. - entries: - type: array - items: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height is the height which the unbonding took - place. - completion_time: - type: string - format: date-time - description: completion_time is the unix time for unbonding completion. - initial_balance: - type: string - description: >- - initial_balance defines the tokens initially scheduled to - receive at completion. - balance: - type: string - description: balance defines the tokens to receive at completion. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been stopped - by external modules - description: >- - UnbondingDelegationEntry defines an unbonding object with - relevant metadata. - description: |- - entries are the unbonding delegation entries. - - unbonding delegation entries - description: |- - QueryDelegationResponse is response type for the Query/UnbondingDelegation - RPC method. - cosmos.staking.v1beta1.QueryValidatorDelegationsResponse: - type: object - properties: - delegation_responses: - type: array - items: - type: object - properties: - delegation: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. - validator_address: - type: string - description: >- - validator_address is the bech32-encoded address of the - validator. - shares: - type: string - description: shares define the delegation shares received. - description: >- - Delegation represents the bond with tokens held by an account. - It is - - owned by one delegator, and is associated with the voting power - of one - - validator. - balance: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: >- - DelegationResponse is equivalent to Delegation except that it - contains a - - balance in addition to shares which is more suitable for client - responses. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - title: |- - QueryValidatorDelegationsResponse is response type for the - Query/ValidatorDelegations RPC method - cosmos.staking.v1beta1.QueryValidatorResponse: - type: object - properties: - validator: - description: validator defines the validator info. - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the validator's operator; - bech encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the validator, as - a Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed from bonded - status or not. - status: - description: status is the validator status (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: tokens define the delegated tokens (incl. self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a validator's - delegators. - description: - description: description defines the description terms for the validator. - type: object - properties: - moniker: - type: string - description: moniker defines a human-readable name for the validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. UPort or - Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: >- - security_contact defines an optional email for security - contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height at which this - validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time for the - validator to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates to be - used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to delegators, as a - fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which - validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase of the - validator commission, as a fraction. - update_time: - type: string - format: date-time - description: update_time is the last time the commission rate was changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared minimum self - delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has been stopped - by external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an unbonding of - this validator - title: QueryValidatorResponse is response type for the Query/Validator RPC method - cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse: - type: object - properties: - unbonding_responses: - type: array - items: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. - validator_address: - type: string - description: >- - validator_address is the bech32-encoded address of the - validator. - entries: - type: array - items: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height is the height which the unbonding took - place. - completion_time: - type: string - format: date-time - description: completion_time is the unix time for unbonding completion. - initial_balance: - type: string - description: >- - initial_balance defines the tokens initially scheduled to - receive at completion. - balance: - type: string - description: balance defines the tokens to receive at completion. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been - stopped by external modules - description: >- - UnbondingDelegationEntry defines an unbonding object with - relevant metadata. - description: |- - entries are the unbonding delegation entries. - - unbonding delegation entries - description: >- - UnbondingDelegation stores all of a single delegator's unbonding - bonds - - for a single validator in an time-ordered list. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryValidatorUnbondingDelegationsResponse is response type for the - Query/ValidatorUnbondingDelegations RPC method. - cosmos.staking.v1beta1.QueryValidatorsResponse: - type: object - properties: - validators: - type: array - items: - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the validator's - operator; bech encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the validator, - as a Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed from bonded - status or not. - status: - description: status is the validator status (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: tokens define the delegated tokens (incl. self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a validator's - delegators. - description: - description: description defines the description terms for the validator. - type: object - properties: - moniker: - type: string - description: moniker defines a human-readable name for the validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. UPort - or Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: >- - security_contact defines an optional email for security - contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height at which this - validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time for the - validator to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates to be - used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to delegators, as a - fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which - validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase of - the validator commission, as a fraction. - update_time: - type: string - format: date-time - description: >- - update_time is the last time the commission rate was - changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared minimum - self delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has been stopped - by external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an unbonding of - this validator - description: >- - Validator defines a validator, together with the total amount of the - - Validator's bond shares and their exchange rate to coins. Slashing - results in - - a decrease in the exchange rate, allowing correct calculation of - future - - undelegations without iterating over delegators. When coins are - delegated to - - this validator, the validator is credited with a delegation whose - number of - - bond shares is based on the amount of coins delegated divided by the - current - - exchange rate. Voting power can be calculated as total bonded shares - - multiplied by exchange rate. - description: validators contains all the queried validators. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - title: >- - QueryValidatorsResponse is response type for the Query/Validators RPC - method - cosmos.staking.v1beta1.Redelegation: - type: object - properties: - delegator_address: - type: string - description: delegator_address is the bech32-encoded address of the delegator. - validator_src_address: - type: string - description: >- - validator_src_address is the validator redelegation source operator - address. - validator_dst_address: - type: string - description: >- - validator_dst_address is the validator redelegation destination - operator address. - entries: - type: array - items: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height defines the height which the redelegation took - place. - completion_time: - type: string - format: date-time - description: >- - completion_time defines the unix time for redelegation - completion. - initial_balance: - type: string - description: >- - initial_balance defines the initial balance when redelegation - started. - shares_dst: - type: string - description: >- - shares_dst is the amount of destination-validator shares created - by redelegation. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been stopped by - external modules - description: >- - RedelegationEntry defines a redelegation object with relevant - metadata. - description: |- - entries are the redelegation entries. - - redelegation entries - description: >- - Redelegation contains the list of a particular delegator's redelegating - bonds - - from a particular source validator to a particular destination validator. - cosmos.staking.v1beta1.RedelegationEntry: - type: object - properties: - creation_height: - type: string - format: int64 - description: creation_height defines the height which the redelegation took place. - completion_time: - type: string - format: date-time - description: completion_time defines the unix time for redelegation completion. - initial_balance: - type: string - description: initial_balance defines the initial balance when redelegation started. - shares_dst: - type: string - description: >- - shares_dst is the amount of destination-validator shares created by - redelegation. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been stopped by - external modules - description: RedelegationEntry defines a redelegation object with relevant metadata. - cosmos.staking.v1beta1.RedelegationEntryResponse: - type: object - properties: - redelegation_entry: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height defines the height which the redelegation took - place. - completion_time: - type: string - format: date-time - description: completion_time defines the unix time for redelegation completion. - initial_balance: - type: string - description: >- - initial_balance defines the initial balance when redelegation - started. - shares_dst: - type: string - description: >- - shares_dst is the amount of destination-validator shares created - by redelegation. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been stopped by - external modules - description: >- - RedelegationEntry defines a redelegation object with relevant - metadata. - balance: - type: string - description: >- - RedelegationEntryResponse is equivalent to a RedelegationEntry except that - it - - contains a balance in addition to shares which is more suitable for client - - responses. - cosmos.staking.v1beta1.RedelegationResponse: - type: object - properties: - redelegation: - type: object - properties: - delegator_address: - type: string - description: delegator_address is the bech32-encoded address of the delegator. - validator_src_address: - type: string - description: >- - validator_src_address is the validator redelegation source - operator address. - validator_dst_address: - type: string - description: >- - validator_dst_address is the validator redelegation destination - operator address. - entries: - type: array - items: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height defines the height which the redelegation - took place. - completion_time: - type: string - format: date-time - description: >- - completion_time defines the unix time for redelegation - completion. - initial_balance: - type: string - description: >- - initial_balance defines the initial balance when - redelegation started. - shares_dst: - type: string - description: >- - shares_dst is the amount of destination-validator shares - created by redelegation. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been stopped - by external modules - description: >- - RedelegationEntry defines a redelegation object with relevant - metadata. - description: |- - entries are the redelegation entries. - - redelegation entries - description: >- - Redelegation contains the list of a particular delegator's - redelegating bonds - - from a particular source validator to a particular destination - validator. - entries: - type: array - items: - type: object - properties: - redelegation_entry: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height defines the height which the redelegation - took place. - completion_time: - type: string - format: date-time - description: >- - completion_time defines the unix time for redelegation - completion. - initial_balance: - type: string - description: >- - initial_balance defines the initial balance when - redelegation started. - shares_dst: - type: string - description: >- - shares_dst is the amount of destination-validator shares - created by redelegation. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been stopped - by external modules - description: >- - RedelegationEntry defines a redelegation object with relevant - metadata. - balance: - type: string - description: >- - RedelegationEntryResponse is equivalent to a RedelegationEntry - except that it - - contains a balance in addition to shares which is more suitable for - client - - responses. - description: >- - RedelegationResponse is equivalent to a Redelegation except that its - entries - - contain a balance in addition to shares which is more suitable for client - - responses. - cosmos.staking.v1beta1.UnbondingDelegation: - type: object - properties: - delegator_address: - type: string - description: delegator_address is the bech32-encoded address of the delegator. - validator_address: - type: string - description: validator_address is the bech32-encoded address of the validator. - entries: - type: array - items: - type: object - properties: - creation_height: - type: string - format: int64 - description: creation_height is the height which the unbonding took place. - completion_time: - type: string - format: date-time - description: completion_time is the unix time for unbonding completion. - initial_balance: - type: string - description: >- - initial_balance defines the tokens initially scheduled to - receive at completion. - balance: - type: string - description: balance defines the tokens to receive at completion. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been stopped by - external modules - description: >- - UnbondingDelegationEntry defines an unbonding object with relevant - metadata. - description: |- - entries are the unbonding delegation entries. - - unbonding delegation entries - description: |- - UnbondingDelegation stores all of a single delegator's unbonding bonds - for a single validator in an time-ordered list. - cosmos.staking.v1beta1.UnbondingDelegationEntry: - type: object - properties: - creation_height: - type: string - format: int64 - description: creation_height is the height which the unbonding took place. - completion_time: - type: string - format: date-time - description: completion_time is the unix time for unbonding completion. - initial_balance: - type: string - description: >- - initial_balance defines the tokens initially scheduled to receive at - completion. - balance: - type: string - description: balance defines the tokens to receive at completion. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been stopped by - external modules - description: >- - UnbondingDelegationEntry defines an unbonding object with relevant - metadata. - cosmos.staking.v1beta1.Validator: - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the validator's operator; bech - encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the validator, as a - Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed from bonded - status or not. - status: - description: status is the validator status (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: tokens define the delegated tokens (incl. self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a validator's - delegators. - description: - description: description defines the description terms for the validator. - type: object - properties: - moniker: - type: string - description: moniker defines a human-readable name for the validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. UPort or - Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: security_contact defines an optional email for security contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height at which this - validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time for the validator - to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates to be used - for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to delegators, as a - fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which validator - can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase of the - validator commission, as a fraction. - update_time: - type: string - format: date-time - description: update_time is the last time the commission rate was changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared minimum self - delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has been stopped by - external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an unbonding of this - validator - description: >- - Validator defines a validator, together with the total amount of the - - Validator's bond shares and their exchange rate to coins. Slashing results - in - - a decrease in the exchange rate, allowing correct calculation of future - - undelegations without iterating over delegators. When coins are delegated - to - - this validator, the validator is credited with a delegation whose number - of - - bond shares is based on the amount of coins delegated divided by the - current - - exchange rate. Voting power can be calculated as total bonded shares - - multiplied by exchange rate. - cosmos.base.abci.v1beta1.ABCIMessageLog: - type: object - properties: - msg_index: - type: integer - format: int64 - log: - type: string - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - description: >- - Attribute defines an attribute wrapper where the key and value - are - - strings instead of raw bytes. - description: |- - StringEvent defines en Event object wrapper where all the attributes - contain key/value pairs that are strings instead of raw bytes. - description: |- - Events contains a slice of Event objects that were emitted during some - execution. - description: >- - ABCIMessageLog defines a structure containing an indexed tx ABCI message - log. - cosmos.base.abci.v1beta1.Attribute: - type: object - properties: - key: - type: string - value: - type: string - description: |- - Attribute defines an attribute wrapper where the key and value are - strings instead of raw bytes. - cosmos.base.abci.v1beta1.GasInfo: - type: object - properties: - gas_wanted: - type: string - format: uint64 - description: GasWanted is the maximum units of work we allow this tx to perform. - gas_used: - type: string - format: uint64 - description: GasUsed is the amount of gas actually consumed. - description: GasInfo defines tx execution gas context. - cosmos.base.abci.v1beta1.Result: - type: object - properties: - data: - type: string - format: byte - description: >- - Data is any data returned from message or handler execution. It MUST - be - - length prefixed in order to separate data from multiple message - executions. - - Deprecated. This field is still populated, but prefer msg_response - instead - - because it also contains the Msg response typeURL. - log: - type: string - description: Log contains the log information from message or handler execution. - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - index: - type: boolean - title: nondeterministic - description: >- - EventAttribute is a single key-value pair, associated with an - event. - description: >- - Event allows application developers to attach additional information - to - - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and - ResponseDeliverTx. - - Later, transactions may be queried using these events. - description: >- - Events contains a slice of Event objects that were emitted during - message - - or handler execution. - msg_responses: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up - a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: |- - msg_responses contains the Msg handler responses type packed in Anys. - - Since: cosmos-sdk 0.46 - description: Result is the union of ResponseFormat and ResponseCheckTx. - cosmos.base.abci.v1beta1.StringEvent: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - description: |- - Attribute defines an attribute wrapper where the key and value are - strings instead of raw bytes. - description: |- - StringEvent defines en Event object wrapper where all the attributes - contain key/value pairs that are strings instead of raw bytes. - cosmos.base.abci.v1beta1.TxResponse: - type: object - properties: - height: - type: string - format: int64 - title: The block height - txhash: - type: string - description: The transaction hash. - codespace: - type: string - title: Namespace for the Code - code: - type: integer - format: int64 - description: Response code. - data: - type: string - description: Result bytes, if any. - raw_log: - type: string - description: |- - The output of the application's logger (raw string). May be - non-deterministic. - logs: - type: array - items: - type: object - properties: - msg_index: - type: integer - format: int64 - log: - type: string - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - description: >- - Attribute defines an attribute wrapper where the key and - value are - - strings instead of raw bytes. - description: >- - StringEvent defines en Event object wrapper where all the - attributes - - contain key/value pairs that are strings instead of raw bytes. - description: >- - Events contains a slice of Event objects that were emitted - during some - - execution. - description: >- - ABCIMessageLog defines a structure containing an indexed tx ABCI - message log. - description: >- - The output of the application's logger (typed). May be - non-deterministic. - info: - type: string - description: Additional information. May be non-deterministic. - gas_wanted: - type: string - format: int64 - description: Amount of gas requested for transaction. - gas_used: - type: string - format: int64 - description: Amount of gas consumed by transaction. - tx: - description: The request transaction bytes. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - timestamp: - type: string - description: >- - Time of the previous block. For heights > 1, it's the weighted median - of - - the timestamps of the valid votes in the block.LastCommit. For height - == 1, - - it's genesis time. - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - index: - type: boolean - title: nondeterministic - description: >- - EventAttribute is a single key-value pair, associated with an - event. - description: >- - Event allows application developers to attach additional information - to - - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and - ResponseDeliverTx. - - Later, transactions may be queried using these events. - description: >- - Events defines all the events emitted by processing a transaction. - Note, - - these events include those emitted by processing all the messages and - those - - emitted from the ante. Whereas Logs contains the events, with - - additional metadata, emitted only by processing the messages. - - - Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 - description: >- - TxResponse defines a structure containing relevant tx data and metadata. - The - - tags are stringified and the log is JSON decoded. - cosmos.crypto.multisig.v1beta1.CompactBitArray: - type: object - properties: - extra_bits_stored: - type: integer - format: int64 - elems: - type: string - format: byte - description: |- - CompactBitArray is an implementation of a space efficient bit array. - This is used to ensure that the encoded data takes up a minimal amount of - space after proto encoding. - This is not thread safe, and is not intended for concurrent usage. - cosmos.tx.signing.v1beta1.SignMode: - type: string - enum: - - SIGN_MODE_UNSPECIFIED - - SIGN_MODE_DIRECT - - SIGN_MODE_TEXTUAL - - SIGN_MODE_DIRECT_AUX - - SIGN_MODE_LEGACY_AMINO_JSON - - SIGN_MODE_EIP_191 - default: SIGN_MODE_UNSPECIFIED - description: |- - SignMode represents a signing mode with its own security guarantees. - - This enum should be considered a registry of all known sign modes - in the Cosmos ecosystem. Apps are not expected to support all known - sign modes. Apps that would like to support custom sign modes are - encouraged to open a small PR against this file to add a new case - to this SignMode enum describing their sign mode so that different - apps have a consistent version of this enum. - - - SIGN_MODE_UNSPECIFIED: SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be - rejected. - - SIGN_MODE_DIRECT: SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is - verified with raw bytes from Tx. - - SIGN_MODE_TEXTUAL: SIGN_MODE_TEXTUAL is a future signing mode that will verify some - human-readable textual representation on top of the binary representation - from SIGN_MODE_DIRECT. It is currently not supported. - - SIGN_MODE_DIRECT_AUX: SIGN_MODE_DIRECT_AUX specifies a signing mode which uses - SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode does not - require signers signing over other signers' `signer_info`. It also allows - for adding Tips in transactions. - - Since: cosmos-sdk 0.46 - - SIGN_MODE_LEGACY_AMINO_JSON: SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses - Amino JSON and will be removed in the future. - - SIGN_MODE_EIP_191: SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos - SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 - - Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant, - but is not implemented on the SDK by default. To enable EIP-191, you need - to pass a custom `TxConfig` that has an implementation of - `SignModeHandler` for EIP-191. The SDK may decide to fully support - EIP-191 in the future. - - Since: cosmos-sdk 0.45.2 - cosmos.tx.v1beta1.AuthInfo: - type: object - properties: - signer_infos: - type: array - items: - type: object - $ref: '#/definitions/cosmos.tx.v1beta1.SignerInfo' - description: >- - signer_infos defines the signing modes for the required signers. The - number - - and order of elements must match the required signers from TxBody's - - messages. The first element is the primary signer and the one which - pays - - the fee. - fee: - description: >- - Fee is the fee and gas limit for the transaction. The first signer is - the - - primary signer and the one which pays the fee. The fee can be - calculated - - based on the cost of evaluating the body and doing signature - verification - - of the signers. This can be estimated via simulation. - type: object - properties: - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - title: amount is the amount of coins to be paid as a fee - gas_limit: - type: string - format: uint64 - title: >- - gas_limit is the maximum gas that can be used in transaction - processing - - before an out of gas error occurs - payer: - type: string - description: >- - if unset, the first signer is responsible for paying the fees. If - set, the specified account must pay the fees. - - the payer must be a tx signer (and thus have signed this field in - AuthInfo). - - setting this field does *not* change the ordering of required - signers for the transaction. - granter: - type: string - title: >- - if set, the fee payer (either the first signer or the value of the - payer field) requests that a fee grant be used - - to pay fees instead of the fee payer's own balance. If an - appropriate fee grant does not exist or the chain does - - not support fee grants, this will fail - tip: - description: >- - Tip is the optional tip used for transactions fees paid in another - denom. - - - This field is ignored if the chain didn't enable tips, i.e. didn't add - the - - `TipDecorator` in its posthandler. - - - Since: cosmos-sdk 0.46 - type: object - properties: - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - title: amount is the amount of the tip - tipper: - type: string - title: tipper is the address of the account paying for the tip - description: |- - AuthInfo describes the fee and signer modes that are used to sign a - transaction. - cosmos.tx.v1beta1.BroadcastMode: - type: string - enum: - - BROADCAST_MODE_UNSPECIFIED - - BROADCAST_MODE_BLOCK - - BROADCAST_MODE_SYNC - - BROADCAST_MODE_ASYNC - default: BROADCAST_MODE_UNSPECIFIED - description: >- - BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC - method. - - - BROADCAST_MODE_UNSPECIFIED: zero-value for mode ordering - - BROADCAST_MODE_BLOCK: DEPRECATED: use BROADCAST_MODE_SYNC instead, - BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards. - - BROADCAST_MODE_SYNC: BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for - a CheckTx execution response only. - - BROADCAST_MODE_ASYNC: BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns - immediately. - cosmos.tx.v1beta1.BroadcastTxRequest: - type: object - properties: - tx_bytes: - type: string - format: byte - description: tx_bytes is the raw transaction. - mode: - type: string - enum: - - BROADCAST_MODE_UNSPECIFIED - - BROADCAST_MODE_BLOCK - - BROADCAST_MODE_SYNC - - BROADCAST_MODE_ASYNC - default: BROADCAST_MODE_UNSPECIFIED - description: >- - BroadcastMode specifies the broadcast mode for the TxService.Broadcast - RPC method. - - - BROADCAST_MODE_UNSPECIFIED: zero-value for mode ordering - - BROADCAST_MODE_BLOCK: DEPRECATED: use BROADCAST_MODE_SYNC instead, - BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards. - - BROADCAST_MODE_SYNC: BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for - a CheckTx execution response only. - - BROADCAST_MODE_ASYNC: BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns - immediately. - description: |- - BroadcastTxRequest is the request type for the Service.BroadcastTxRequest - RPC method. - cosmos.tx.v1beta1.BroadcastTxResponse: - type: object - properties: - tx_response: - description: tx_response is the queried TxResponses. - type: object - properties: - height: - type: string - format: int64 - title: The block height - txhash: - type: string - description: The transaction hash. - codespace: - type: string - title: Namespace for the Code - code: - type: integer - format: int64 - description: Response code. - data: - type: string - description: Result bytes, if any. - raw_log: - type: string - description: |- - The output of the application's logger (raw string). May be - non-deterministic. - logs: - type: array - items: - type: object - properties: - msg_index: - type: integer - format: int64 - log: - type: string - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - description: >- - Attribute defines an attribute wrapper where the key - and value are - - strings instead of raw bytes. - description: >- - StringEvent defines en Event object wrapper where all the - attributes - - contain key/value pairs that are strings instead of raw - bytes. - description: >- - Events contains a slice of Event objects that were emitted - during some - - execution. - description: >- - ABCIMessageLog defines a structure containing an indexed tx ABCI - message log. - description: >- - The output of the application's logger (typed). May be - non-deterministic. - info: - type: string - description: Additional information. May be non-deterministic. - gas_wanted: - type: string - format: int64 - description: Amount of gas requested for transaction. - gas_used: - type: string - format: int64 - description: Amount of gas consumed by transaction. - tx: - description: The request transaction bytes. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - timestamp: - type: string - description: >- - Time of the previous block. For heights > 1, it's the weighted - median of - - the timestamps of the valid votes in the block.LastCommit. For - height == 1, - - it's genesis time. - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - index: - type: boolean - title: nondeterministic - description: >- - EventAttribute is a single key-value pair, associated with - an event. - description: >- - Event allows application developers to attach additional - information to - - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and - ResponseDeliverTx. - - Later, transactions may be queried using these events. - description: >- - Events defines all the events emitted by processing a transaction. - Note, - - these events include those emitted by processing all the messages - and those - - emitted from the ante. Whereas Logs contains the events, with - - additional metadata, emitted only by processing the messages. - - - Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 - description: |- - BroadcastTxResponse is the response type for the - Service.BroadcastTx method. - cosmos.tx.v1beta1.Fee: - type: object - properties: - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - title: amount is the amount of coins to be paid as a fee - gas_limit: - type: string - format: uint64 - title: >- - gas_limit is the maximum gas that can be used in transaction - processing - - before an out of gas error occurs - payer: - type: string - description: >- - if unset, the first signer is responsible for paying the fees. If set, - the specified account must pay the fees. - - the payer must be a tx signer (and thus have signed this field in - AuthInfo). - - setting this field does *not* change the ordering of required signers - for the transaction. - granter: - type: string - title: >- - if set, the fee payer (either the first signer or the value of the - payer field) requests that a fee grant be used - - to pay fees instead of the fee payer's own balance. If an appropriate - fee grant does not exist or the chain does - - not support fee grants, this will fail - description: >- - Fee includes the amount of coins paid in fees and the maximum - - gas to be used by the transaction. The ratio yields an effective - "gasprice", - - which must be above some miminum to be accepted into the mempool. - cosmos.tx.v1beta1.GetBlockWithTxsResponse: - type: object - properties: - txs: - type: array - items: - type: object - $ref: '#/definitions/cosmos.tx.v1beta1.Tx' - description: txs are the transactions in the block. - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - block: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block - in the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. - - NOTE: not all txs here are valid. We're just agreeing on the - order first. - - This means that block.AppHash does not include these txs. - title: Data contains the set of transactions included in the block - evidence: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a validator - signed two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules - for processing a block in the - blockchain, - - including all blockchain data structures - and the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: >- - commit from validators from the last - block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs - from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: >- - Header defines the structure of a block - header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included - in a Commit. - description: >- - Commit contains the evidence that a block - was committed by a set of validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use - with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a set of - validators attempting to mislead a light client. - last_commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - description: >- - Commit contains the evidence that a block was committed by a set - of validators. - pagination: - description: pagination defines a pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - GetBlockWithTxsResponse is the response type for the - Service.GetBlockWithTxs method. - - - Since: cosmos-sdk 0.45.2 - cosmos.tx.v1beta1.GetTxResponse: - type: object - properties: - tx: - $ref: '#/definitions/cosmos.tx.v1beta1.Tx' - description: tx is the queried transaction. - tx_response: - description: tx_response is the queried TxResponses. - type: object - properties: - height: - type: string - format: int64 - title: The block height - txhash: - type: string - description: The transaction hash. - codespace: - type: string - title: Namespace for the Code - code: - type: integer - format: int64 - description: Response code. - data: - type: string - description: Result bytes, if any. - raw_log: - type: string - description: |- - The output of the application's logger (raw string). May be - non-deterministic. - logs: - type: array - items: - type: object - properties: - msg_index: - type: integer - format: int64 - log: - type: string - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - description: >- - Attribute defines an attribute wrapper where the key - and value are - - strings instead of raw bytes. - description: >- - StringEvent defines en Event object wrapper where all the - attributes - - contain key/value pairs that are strings instead of raw - bytes. - description: >- - Events contains a slice of Event objects that were emitted - during some - - execution. - description: >- - ABCIMessageLog defines a structure containing an indexed tx ABCI - message log. - description: >- - The output of the application's logger (typed). May be - non-deterministic. - info: - type: string - description: Additional information. May be non-deterministic. - gas_wanted: - type: string - format: int64 - description: Amount of gas requested for transaction. - gas_used: - type: string - format: int64 - description: Amount of gas consumed by transaction. - tx: - description: The request transaction bytes. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - timestamp: - type: string - description: >- - Time of the previous block. For heights > 1, it's the weighted - median of - - the timestamps of the valid votes in the block.LastCommit. For - height == 1, - - it's genesis time. - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - index: - type: boolean - title: nondeterministic - description: >- - EventAttribute is a single key-value pair, associated with - an event. - description: >- - Event allows application developers to attach additional - information to - - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and - ResponseDeliverTx. - - Later, transactions may be queried using these events. - description: >- - Events defines all the events emitted by processing a transaction. - Note, - - these events include those emitted by processing all the messages - and those - - emitted from the ante. Whereas Logs contains the events, with - - additional metadata, emitted only by processing the messages. - - - Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 - description: GetTxResponse is the response type for the Service.GetTx method. - cosmos.tx.v1beta1.GetTxsEventResponse: - type: object - properties: - txs: - type: array - items: - type: object - $ref: '#/definitions/cosmos.tx.v1beta1.Tx' - description: txs is the list of queried transactions. - tx_responses: - type: array - items: - type: object - properties: - height: - type: string - format: int64 - title: The block height - txhash: - type: string - description: The transaction hash. - codespace: - type: string - title: Namespace for the Code - code: - type: integer - format: int64 - description: Response code. - data: - type: string - description: Result bytes, if any. - raw_log: - type: string - description: |- - The output of the application's logger (raw string). May be - non-deterministic. - logs: - type: array - items: - type: object - properties: - msg_index: - type: integer - format: int64 - log: - type: string - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - description: >- - Attribute defines an attribute wrapper where the - key and value are - - strings instead of raw bytes. - description: >- - StringEvent defines en Event object wrapper where all - the attributes - - contain key/value pairs that are strings instead of raw - bytes. - description: >- - Events contains a slice of Event objects that were emitted - during some - - execution. - description: >- - ABCIMessageLog defines a structure containing an indexed tx - ABCI message log. - description: >- - The output of the application's logger (typed). May be - non-deterministic. - info: - type: string - description: Additional information. May be non-deterministic. - gas_wanted: - type: string - format: int64 - description: Amount of gas requested for transaction. - gas_used: - type: string - format: int64 - description: Amount of gas consumed by transaction. - tx: - description: The request transaction bytes. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - timestamp: - type: string - description: >- - Time of the previous block. For heights > 1, it's the weighted - median of - - the timestamps of the valid votes in the block.LastCommit. For - height == 1, - - it's genesis time. - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - index: - type: boolean - title: nondeterministic - description: >- - EventAttribute is a single key-value pair, associated - with an event. - description: >- - Event allows application developers to attach additional - information to - - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and - ResponseDeliverTx. - - Later, transactions may be queried using these events. - description: >- - Events defines all the events emitted by processing a - transaction. Note, - - these events include those emitted by processing all the - messages and those - - emitted from the ante. Whereas Logs contains the events, with - - additional metadata, emitted only by processing the messages. - - - Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 - description: >- - TxResponse defines a structure containing relevant tx data and - metadata. The - - tags are stringified and the log is JSON decoded. - description: tx_responses is the list of queried TxResponses. - pagination: - description: |- - pagination defines a pagination for the response. - Deprecated post v0.46.x: use total instead. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - total: - type: string - format: uint64 - title: total is total number of results available - description: |- - GetTxsEventResponse is the response type for the Service.TxsByEvents - RPC method. - cosmos.tx.v1beta1.ModeInfo: - type: object - properties: - single: - title: single represents a single signer - type: object - properties: - mode: - title: mode is the signing mode of the single signer - type: string - enum: - - SIGN_MODE_UNSPECIFIED - - SIGN_MODE_DIRECT - - SIGN_MODE_TEXTUAL - - SIGN_MODE_DIRECT_AUX - - SIGN_MODE_LEGACY_AMINO_JSON - - SIGN_MODE_EIP_191 - default: SIGN_MODE_UNSPECIFIED - description: >- - SignMode represents a signing mode with its own security - guarantees. - - - This enum should be considered a registry of all known sign modes - - in the Cosmos ecosystem. Apps are not expected to support all - known - - sign modes. Apps that would like to support custom sign modes are - - encouraged to open a small PR against this file to add a new case - - to this SignMode enum describing their sign mode so that different - - apps have a consistent version of this enum. - - - SIGN_MODE_UNSPECIFIED: SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be - rejected. - - SIGN_MODE_DIRECT: SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is - verified with raw bytes from Tx. - - SIGN_MODE_TEXTUAL: SIGN_MODE_TEXTUAL is a future signing mode that will verify some - human-readable textual representation on top of the binary - representation - - from SIGN_MODE_DIRECT. It is currently not supported. - - SIGN_MODE_DIRECT_AUX: SIGN_MODE_DIRECT_AUX specifies a signing mode which uses - SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode - does not - - require signers signing over other signers' `signer_info`. It also - allows - - for adding Tips in transactions. - - - Since: cosmos-sdk 0.46 - - SIGN_MODE_LEGACY_AMINO_JSON: SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses - Amino JSON and will be removed in the future. - - SIGN_MODE_EIP_191: SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos - SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 - - - Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum - variant, - - but is not implemented on the SDK by default. To enable EIP-191, - you need - - to pass a custom `TxConfig` that has an implementation of - - `SignModeHandler` for EIP-191. The SDK may decide to fully support - - EIP-191 in the future. - - - Since: cosmos-sdk 0.45.2 - multi: - $ref: '#/definitions/cosmos.tx.v1beta1.ModeInfo.Multi' - title: multi represents a nested multisig signer - description: ModeInfo describes the signing mode of a single or nested multisig signer. - cosmos.tx.v1beta1.ModeInfo.Multi: - type: object - properties: - bitarray: - title: bitarray specifies which keys within the multisig are signing - type: object - properties: - extra_bits_stored: - type: integer - format: int64 - elems: - type: string - format: byte - description: >- - CompactBitArray is an implementation of a space efficient bit array. - - This is used to ensure that the encoded data takes up a minimal amount - of - - space after proto encoding. - - This is not thread safe, and is not intended for concurrent usage. - mode_infos: - type: array - items: - type: object - $ref: '#/definitions/cosmos.tx.v1beta1.ModeInfo' - title: |- - mode_infos is the corresponding modes of the signers of the multisig - which could include nested multisig public keys - title: Multi is the mode info for a multisig public key - cosmos.tx.v1beta1.ModeInfo.Single: - type: object - properties: - mode: - title: mode is the signing mode of the single signer - type: string - enum: - - SIGN_MODE_UNSPECIFIED - - SIGN_MODE_DIRECT - - SIGN_MODE_TEXTUAL - - SIGN_MODE_DIRECT_AUX - - SIGN_MODE_LEGACY_AMINO_JSON - - SIGN_MODE_EIP_191 - default: SIGN_MODE_UNSPECIFIED - description: >- - SignMode represents a signing mode with its own security guarantees. - - - This enum should be considered a registry of all known sign modes - - in the Cosmos ecosystem. Apps are not expected to support all known - - sign modes. Apps that would like to support custom sign modes are - - encouraged to open a small PR against this file to add a new case - - to this SignMode enum describing their sign mode so that different - - apps have a consistent version of this enum. - - - SIGN_MODE_UNSPECIFIED: SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be - rejected. - - SIGN_MODE_DIRECT: SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is - verified with raw bytes from Tx. - - SIGN_MODE_TEXTUAL: SIGN_MODE_TEXTUAL is a future signing mode that will verify some - human-readable textual representation on top of the binary - representation - - from SIGN_MODE_DIRECT. It is currently not supported. - - SIGN_MODE_DIRECT_AUX: SIGN_MODE_DIRECT_AUX specifies a signing mode which uses - SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode does - not - - require signers signing over other signers' `signer_info`. It also - allows - - for adding Tips in transactions. - - - Since: cosmos-sdk 0.46 - - SIGN_MODE_LEGACY_AMINO_JSON: SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses - Amino JSON and will be removed in the future. - - SIGN_MODE_EIP_191: SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos - SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 - - - Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant, - - but is not implemented on the SDK by default. To enable EIP-191, you - need - - to pass a custom `TxConfig` that has an implementation of - - `SignModeHandler` for EIP-191. The SDK may decide to fully support - - EIP-191 in the future. - - - Since: cosmos-sdk 0.45.2 - title: |- - Single is the mode info for a single signer. It is structured as a message - to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the - future - cosmos.tx.v1beta1.OrderBy: - type: string - enum: - - ORDER_BY_UNSPECIFIED - - ORDER_BY_ASC - - ORDER_BY_DESC - default: ORDER_BY_UNSPECIFIED - description: >- - - ORDER_BY_UNSPECIFIED: ORDER_BY_UNSPECIFIED specifies an unknown sorting - order. OrderBy defaults to ASC in this case. - - ORDER_BY_ASC: ORDER_BY_ASC defines ascending order - - ORDER_BY_DESC: ORDER_BY_DESC defines descending order - title: OrderBy defines the sorting order - cosmos.tx.v1beta1.SignerInfo: - type: object - properties: - public_key: - description: >- - public_key is the public key of the signer. It is optional for - accounts - - that already exist in state. If unset, the verifier can use the - required \ - - signer address for this position and lookup the public key. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - mode_info: - $ref: '#/definitions/cosmos.tx.v1beta1.ModeInfo' - title: |- - mode_info describes the signing mode of the signer and is a nested - structure to support nested multisig pubkey's - sequence: - type: string - format: uint64 - description: >- - sequence is the sequence of the account, which describes the - - number of committed transactions signed by a given address. It is used - to - - prevent replay attacks. - description: |- - SignerInfo describes the public key and signing mode of a single top-level - signer. - cosmos.tx.v1beta1.SimulateRequest: - type: object - properties: - tx: - $ref: '#/definitions/cosmos.tx.v1beta1.Tx' - description: |- - tx is the transaction to simulate. - Deprecated. Send raw tx bytes instead. - tx_bytes: - type: string - format: byte - description: |- - tx_bytes is the raw transaction. - - Since: cosmos-sdk 0.43 - description: |- - SimulateRequest is the request type for the Service.Simulate - RPC method. - cosmos.tx.v1beta1.SimulateResponse: - type: object - properties: - gas_info: - description: gas_info is the information about gas used in the simulation. - type: object - properties: - gas_wanted: - type: string - format: uint64 - description: >- - GasWanted is the maximum units of work we allow this tx to - perform. - gas_used: - type: string - format: uint64 - description: GasUsed is the amount of gas actually consumed. - result: - description: result is the result of the simulation. - type: object - properties: - data: - type: string - format: byte - description: >- - Data is any data returned from message or handler execution. It - MUST be - - length prefixed in order to separate data from multiple message - executions. - - Deprecated. This field is still populated, but prefer msg_response - instead - - because it also contains the Msg response typeURL. - log: - type: string - description: >- - Log contains the log information from message or handler - execution. - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - index: - type: boolean - title: nondeterministic - description: >- - EventAttribute is a single key-value pair, associated with - an event. - description: >- - Event allows application developers to attach additional - information to - - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and - ResponseDeliverTx. - - Later, transactions may be queried using these events. - description: >- - Events contains a slice of Event objects that were emitted during - message - - or handler execution. - msg_responses: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - msg_responses contains the Msg handler responses type packed in - Anys. - - - Since: cosmos-sdk 0.46 - description: |- - SimulateResponse is the response type for the - Service.SimulateRPC method. - cosmos.tx.v1beta1.Tip: - type: object - properties: - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - title: amount is the amount of the tip - tipper: - type: string - title: tipper is the address of the account paying for the tip - description: |- - Tip is the tip used for meta-transactions. - - Since: cosmos-sdk 0.46 - cosmos.tx.v1beta1.Tx: - type: object - properties: - body: - title: body is the processable content of the transaction - type: object - properties: - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages is a list of messages to be executed. The required - signers of - - those messages define the number and order of elements in - AuthInfo's - - signer_infos and Tx's signatures. Each required signer address is - added to - - the list only the first time it occurs. - - By convention, the first required signer (usually from the first - message) - - is referred to as the primary signer and pays the fee for the - whole - - transaction. - memo: - type: string - description: >- - memo is any arbitrary note/comment to be added to the transaction. - - WARNING: in clients, any publicly exposed text should not be - called memo, - - but should be called `note` instead (see - https://github.com/cosmos/cosmos-sdk/issues/9122). - timeout_height: - type: string - format: uint64 - title: |- - timeout is the block height after which this transaction will not - be processed by the chain - extension_options: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - title: >- - extension_options are arbitrary options that can be added by - chains - - when the default options are not sufficient. If any of these are - present - - and can't be handled, the transaction will be rejected - non_critical_extension_options: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - title: >- - extension_options are arbitrary options that can be added by - chains - - when the default options are not sufficient. If any of these are - present - - and can't be handled, they will be ignored - description: TxBody is the body of a transaction that all signers sign over. - auth_info: - $ref: '#/definitions/cosmos.tx.v1beta1.AuthInfo' - title: |- - auth_info is the authorization related content of the transaction, - specifically signers, signer modes and fee - signatures: - type: array - items: - type: string - format: byte - description: >- - signatures is a list of signatures that matches the length and order - of - - AuthInfo's signer_infos to allow connecting signature meta information - like - - public key and signing mode by position. - description: Tx is the standard type used for broadcasting transactions. - cosmos.tx.v1beta1.TxBody: - type: object - properties: - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up - a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: + additional field `@type` which contains the type URL. Example: package google.profile; message Person { @@ -71870,1750 +21186,1031 @@ definitions: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } - description: >- - messages is a list of messages to be executed. The required signers of - - those messages define the number and order of elements in AuthInfo's - - signer_infos and Tx's signatures. Each required signer address is - added to - - the list only the first time it occurs. - - By convention, the first required signer (usually from the first - message) - - is referred to as the primary signer and pays the fee for the whole - - transaction. - memo: - type: string - description: >- - memo is any arbitrary note/comment to be added to the transaction. - - WARNING: in clients, any publicly exposed text should not be called - memo, - - but should be called `note` instead (see - https://github.com/cosmos/cosmos-sdk/issues/9122). - timeout_height: - type: string - format: uint64 - title: |- - timeout is the block height after which this transaction will not - be processed by the chain - extension_options: + description: messages are the arbitrary messages to be executed if proposal passes. + initial_deposit: type: array items: type: object properties: - '@type': + denom: type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up - a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - title: >- - extension_options are arbitrary options that can be added by chains - - when the default options are not sufficient. If any of these are - present - - and can't be handled, the transaction will be rejected - non_critical_extension_options: - type: array - items: - type: object - properties: - '@type': + amount: type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up - a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... + description: |- + Coin defines a token with a denomination and an amount. - Example 4: Pack and unpack a message in Go + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: >- + initial_deposit is the deposit value that must be paid at proposal + submission. + proposer: + type: string + description: proposer is the account address of the proposer. + metadata: + type: string + description: metadata is any arbitrary metadata attached to the proposal. + title: + type: string + description: |- + title is the title of the proposal. - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } + Since: cosmos-sdk 0.47 + summary: + type: string + description: 'Since: cosmos-sdk 0.47' + title: summary is the summary of the proposal + expedited: + type: boolean + description: 'Since: cosmos-sdk 0.50' + title: expedited defines if the proposal is expedited or not + description: >- + MsgSubmitProposal defines an sdk.Msg type that supports submitting + arbitrary - The pack methods provided by protobuf library will by default use + proposal Content. + cosmos.gov.v1.MsgSubmitProposalResponse: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + description: MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. + cosmos.gov.v1.MsgUpdateParams: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + params: + description: |- + params defines the x/gov parameters to update. - 'type.googleapis.com/full.type.name' as the type URL and the unpack + NOTE: All parameters must be supplied. + type: object + properties: + min_deposit: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - methods only use the fully qualified type name after the last '/' - in the type URL, for example "foo.bar.com/x/y.z" will yield type + NOTE: The amount field is an Int which implements the custom + method - name "y.z". + signatures required by gogoproto. + description: Minimum deposit for a proposal to enter voting period. + max_deposit_period: + type: string + description: >- + Maximum period for Atom holders to deposit on a proposal. Initial + value: 2 + months. + voting_period: + type: string + description: Duration of the voting period. + quorum: + type: string + description: >- + Minimum percentage of total stake needed to vote for a result to + be + considered valid. + threshold: + type: string + description: >- + Minimum proportion of Yes votes for proposal to pass. Default + value: 0.5. + veto_threshold: + type: string + description: >- + Minimum value of Veto votes to Total votes ratio for proposal to + be + vetoed. Default value: 1/3. + min_initial_deposit_ratio: + type: string + description: >- + The ratio representing the proportion of the deposit value that + must be paid at proposal submission. + proposal_cancel_ratio: + type: string + description: >- + The cancel ratio which will not be returned back to the depositors + when a proposal is cancelled. - JSON + Since: cosmos-sdk 0.50 + proposal_cancel_dest: + type: string + description: >- + The address which will receive (proposal_cancel_ratio * deposit) + proposal deposits. - ==== + If empty, the (proposal_cancel_ratio * deposit) proposal deposits + will be burned. - The JSON representation of an `Any` value uses the regular - representation of the deserialized, embedded message, with an + Since: cosmos-sdk 0.50 + expedited_voting_period: + type: string + description: |- + Duration of the voting period of an expedited proposal. - additional field `@type` which contains the type URL. Example: + Since: cosmos-sdk 0.50 + expedited_threshold: + type: string + description: >- + Minimum proportion of Yes votes for proposal to pass. Default + value: 0.67. - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + Since: cosmos-sdk 0.50 + expedited_min_deposit: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - If the embedded message type is well-known and has a custom JSON - representation, that representation will be embedded adding a field + NOTE: The amount field is an Int which implements the custom + method - `value` which holds the custom JSON in addition to the `@type` + signatures required by gogoproto. + description: Minimum expedited deposit for a proposal to enter voting period. + burn_vote_quorum: + type: boolean + title: burn deposits if a proposal does not meet quorum + burn_proposal_deposit_prevote: + type: boolean + title: burn deposits if the proposal does not enter voting period + burn_vote_veto: + type: boolean + title: burn deposits if quorum with vote type no_veto is met + min_deposit_ratio: + type: string + description: >- + The ratio representing the proportion of the deposit value minimum + that must be met when making a deposit. - field. Example (for message [google.protobuf.Duration][]): + Default value: 0.01. Meaning that for a chain with a min_deposit + of 100stake, a deposit of 1stake would be - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - title: >- - extension_options are arbitrary options that can be added by chains + required. - when the default options are not sufficient. If any of these are - present - and can't be handled, they will be ignored - description: TxBody is the body of a transaction that all signers sign over. - cosmos.tx.v1beta1.TxDecodeAminoRequest: - type: object - properties: - amino_binary: - type: string - format: byte + Since: cosmos-sdk 0.50 description: |- - TxDecodeAminoRequest is the request type for the Service.TxDecodeAmino - RPC method. + MsgUpdateParams is the Msg/UpdateParams request type. Since: cosmos-sdk 0.47 - cosmos.tx.v1beta1.TxDecodeAminoResponse: + cosmos.gov.v1.MsgUpdateParamsResponse: type: object - properties: - amino_json: - type: string description: |- - TxDecodeAminoResponse is the response type for the Service.TxDecodeAmino - RPC method. + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. Since: cosmos-sdk 0.47 - cosmos.tx.v1beta1.TxDecodeRequest: + cosmos.gov.v1.MsgVote: type: object properties: - tx_bytes: + proposal_id: type: string - format: byte - description: tx_bytes is the raw transaction. - description: |- - TxDecodeRequest is the request type for the Service.TxDecode - RPC method. - - Since: cosmos-sdk 0.47 - cosmos.tx.v1beta1.TxDecodeResponse: - type: object - properties: - tx: - $ref: '#/definitions/cosmos.tx.v1beta1.Tx' - description: tx is the decoded transaction. - description: |- - TxDecodeResponse is the response type for the - Service.TxDecode method. - - Since: cosmos-sdk 0.47 - cosmos.tx.v1beta1.TxEncodeAminoRequest: - type: object - properties: - amino_json: + format: uint64 + description: proposal_id defines the unique id of the proposal. + voter: type: string - description: |- - TxEncodeAminoRequest is the request type for the Service.TxEncodeAmino - RPC method. - - Since: cosmos-sdk 0.47 - cosmos.tx.v1beta1.TxEncodeAminoResponse: - type: object - properties: - amino_binary: + description: voter is the voter address for the proposal. + option: + description: option defines the vote option. type: string - format: byte - description: |- - TxEncodeAminoResponse is the response type for the Service.TxEncodeAmino - RPC method. - - Since: cosmos-sdk 0.47 - cosmos.tx.v1beta1.TxEncodeRequest: + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + metadata: + type: string + description: metadata is any arbitrary metadata attached to the Vote. + description: MsgVote defines a message to cast a vote. + cosmos.gov.v1.MsgVoteResponse: type: object - properties: - tx: - $ref: '#/definitions/cosmos.tx.v1beta1.Tx' - description: tx is the transaction to encode. - description: |- - TxEncodeRequest is the request type for the Service.TxEncode - RPC method. - - Since: cosmos-sdk 0.47 - cosmos.tx.v1beta1.TxEncodeResponse: + description: MsgVoteResponse defines the Msg/Vote response type. + cosmos.gov.v1.MsgVoteWeighted: type: object properties: - tx_bytes: + proposal_id: type: string - format: byte - description: tx_bytes is the encoded transaction bytes. - description: |- - TxEncodeResponse is the response type for the - Service.TxEncode method. - - Since: cosmos-sdk 0.47 - tendermint.abci.Event: + format: uint64 + description: proposal_id defines the unique id of the proposal. + voter: + type: string + description: voter is the voter address for the proposal. + options: + type: array + items: + type: object + properties: + option: + description: >- + option defines the valid vote options, it must not contain + duplicate vote options. + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + weight: + type: string + description: weight is the vote weight associated with the vote option. + description: WeightedVoteOption defines a unit of vote for vote split. + description: options defines the weighted vote options. + metadata: + type: string + description: metadata is any arbitrary metadata attached to the VoteWeighted. + description: MsgVoteWeighted defines a message to cast a vote. + cosmos.gov.v1.MsgVoteWeightedResponse: + type: object + description: MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. + cosmos.gov.v1.Params: type: object properties: - type: - type: string - attributes: + min_deposit: type: array items: type: object properties: - key: + denom: type: string - value: + amount: type: string - index: - type: boolean - title: nondeterministic - description: EventAttribute is a single key-value pair, associated with an event. - description: >- - Event allows application developers to attach additional information to + description: |- + Coin defines a token with a denomination and an amount. - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and - ResponseDeliverTx. + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: Minimum deposit for a proposal to enter voting period. + max_deposit_period: + type: string + description: >- + Maximum period for Atom holders to deposit on a proposal. Initial + value: 2 - Later, transactions may be queried using these events. - tendermint.abci.EventAttribute: - type: object - properties: - key: + months. + voting_period: type: string - value: + description: Duration of the voting period. + quorum: type: string - index: - type: boolean - title: nondeterministic - description: EventAttribute is a single key-value pair, associated with an event. - cosmos.upgrade.v1beta1.ModuleVersion: - type: object - properties: - name: + description: |- + Minimum percentage of total stake needed to vote for a result to be + considered valid. + threshold: type: string - title: name of the app module - version: + description: >- + Minimum proportion of Yes votes for proposal to pass. Default value: + 0.5. + veto_threshold: type: string - format: uint64 - title: consensus version of the app module - description: |- - ModuleVersion specifies a module and its consensus version. - - Since: cosmos-sdk 0.43 - cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse: - type: object - description: |- - MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. - - Since: cosmos-sdk 0.46 - cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse: - type: object - description: |- - MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. - - Since: cosmos-sdk 0.46 - cosmos.upgrade.v1beta1.Plan: - type: object - properties: - name: + description: |- + Minimum value of Veto votes to Total votes ratio for proposal to be + vetoed. Default value: 1/3. + min_initial_deposit_ratio: type: string description: >- - Sets the name for the upgrade. This name will be used by the upgraded - - version of the software to apply any special "on-upgrade" commands - during - - the first BeginBlock method after the upgrade is applied. It is also - used - - to detect whether a software version can handle a given upgrade. If no - - upgrade handler with this name has been set in the software, it will - be - - assumed that the software is out-of-date when the upgrade Time or - Height is - - reached and the software will exit. - time: + The ratio representing the proportion of the deposit value that must + be paid at proposal submission. + proposal_cancel_ratio: type: string - format: date-time description: >- - Deprecated: Time based upgrades have been deprecated. Time based - upgrade logic + The cancel ratio which will not be returned back to the depositors + when a proposal is cancelled. - has been removed from the SDK. - If this field is not empty, an error will be thrown. - height: - type: string - format: int64 - description: The height at which the upgrade must be performed. - info: + Since: cosmos-sdk 0.50 + proposal_cancel_dest: type: string - title: |- - Any application specific upgrade info to be included on-chain - such as a git commit that validators could automatically upgrade to - upgraded_client_state: description: >- - Deprecated: UpgradedClientState field has been deprecated. IBC upgrade - logic has been - - moved to the IBC module in the sub module 02-client. - - If this field is not empty, an error will be thrown. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in + The address which will receive (proposal_cancel_ratio * deposit) + proposal deposits. - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they + If empty, the (proposal_cancel_ratio * deposit) proposal deposits will + be burned. - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - server that maps type URLs to message definitions as follows: + Since: cosmos-sdk 0.50 + expedited_voting_period: + type: string + description: |- + Duration of the voting period of an expedited proposal. + Since: cosmos-sdk 0.50 + expedited_threshold: + type: string + description: >- + Minimum proportion of Yes votes for proposal to pass. Default value: + 0.67. - * If no scheme is provided, `https` is assumed. - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + Since: cosmos-sdk 0.50 + expedited_min_deposit: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. - Note: this functionality is not currently available in the - official + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: Minimum expedited deposit for a proposal to enter voting period. + burn_vote_quorum: + type: boolean + title: burn deposits if a proposal does not meet quorum + burn_proposal_deposit_prevote: + type: boolean + title: burn deposits if the proposal does not enter voting period + burn_vote_veto: + type: boolean + title: burn deposits if quorum with vote type no_veto is met + min_deposit_ratio: + type: string + description: >- + The ratio representing the proportion of the deposit value minimum + that must be met when making a deposit. - protobuf release, and it is not used for type URLs beginning with + Default value: 0.01. Meaning that for a chain with a min_deposit of + 100stake, a deposit of 1stake would be - type.googleapis.com. + required. - Schemes other than `http`, `https` (or the empty scheme) might be + Since: cosmos-sdk 0.50 + description: |- + Params defines the parameters for the x/gov module. - used with implementation specific semantics. - additionalProperties: {} + Since: cosmos-sdk 0.47 + cosmos.gov.v1.VoteOption: + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED description: >- - Plan specifies information about a planned upgrade and when it should - occur. - cosmos.upgrade.v1beta1.QueryAppliedPlanResponse: + VoteOption enumerates the valid vote options for a given governance + proposal. + + - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option. + - VOTE_OPTION_ABSTAIN: VOTE_OPTION_ABSTAIN defines an abstain vote option. + - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. + - VOTE_OPTION_NO_WITH_VETO: VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. + cosmos.gov.v1.WeightedVoteOption: type: object properties: - height: + option: + description: >- + option defines the valid vote options, it must not contain duplicate + vote options. type: string - format: int64 - description: height is the block height at which the plan was applied. - description: >- - QueryAppliedPlanResponse is the response type for the Query/AppliedPlan - RPC - - method. - cosmos.upgrade.v1beta1.QueryAuthorityResponse: + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + weight: + type: string + description: weight is the vote weight associated with the vote option. + description: WeightedVoteOption defines a unit of vote for vote split. + cosmos.gov.v1beta1.MsgDeposit: type: object properties: - address: + proposal_id: type: string - description: 'Since: cosmos-sdk 0.46' - title: QueryAuthorityResponse is the response type for Query/Authority - cosmos.upgrade.v1beta1.QueryCurrentPlanResponse: + format: uint64 + description: proposal_id defines the unique id of the proposal. + depositor: + type: string + description: depositor defines the deposit addresses from the proposals. + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: amount to be deposited by depositor. + description: MsgDeposit defines a message to submit a deposit to an existing proposal. + cosmos.gov.v1beta1.MsgDepositResponse: + type: object + description: MsgDepositResponse defines the Msg/Deposit response type. + cosmos.gov.v1beta1.MsgSubmitProposal: type: object properties: - plan: - description: plan is the current upgrade plan. + content: + description: content is the proposal's content. type: object properties: - name: - type: string - description: >- - Sets the name for the upgrade. This name will be used by the - upgraded - - version of the software to apply any special "on-upgrade" commands - during - - the first BeginBlock method after the upgrade is applied. It is - also used - - to detect whether a software version can handle a given upgrade. - If no - - upgrade handler with this name has been set in the software, it - will be - - assumed that the software is out-of-date when the upgrade Time or - Height is - - reached and the software will exit. - time: - type: string - format: date-time - description: >- - Deprecated: Time based upgrades have been deprecated. Time based - upgrade logic - - has been removed from the SDK. - - If this field is not empty, an error will be thrown. - height: - type: string - format: int64 - description: The height at which the upgrade must be performed. - info: + '@type': type: string - title: >- - Any application specific upgrade info to be included on-chain - - such as a git commit that validators could automatically upgrade - to - upgraded_client_state: description: >- - Deprecated: UpgradedClientState field has been deprecated. IBC - upgrade logic has been - - moved to the IBC module in the sub module 02-client. - - If this field is not empty, an error will be thrown. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least + A URL/resource name that uniquely identifies the type of the + serialized - one "/" character. The last segment of the URL's path must - represent + protocol buffer message. This string must contain at least - the fully qualified name of the type (as in + one "/" character. The last segment of the URL's path must + represent - `path/google.protobuf.Duration`). The name should be in a - canonical form + the fully qualified name of the type (as in - (e.g., leading "." is not accepted). + `path/google.protobuf.Duration`). The name should be in a + canonical form + (e.g., leading "." is not accepted). - In practice, teams usually precompile into the binary all - types that they - expect it to use in the context of Any. However, for URLs - which use the + In practice, teams usually precompile into the binary all types + that they - scheme `http`, `https`, or no scheme, one can optionally set - up a type + expect it to use in the context of Any. However, for URLs which + use the - server that maps type URLs to message definitions as follows: + scheme `http`, `https`, or no scheme, one can optionally set up a + type + server that maps type URLs to message definitions as follows: - * If no scheme is provided, `https` is assumed. - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + * If no scheme is provided, `https` is assumed. - Note: this functionality is not currently available in the - official + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - protobuf release, and it is not used for type URLs beginning - with + Note: this functionality is not currently available in the + official - type.googleapis.com. + protobuf release, and it is not used for type URLs beginning with + type.googleapis.com. - Schemes other than `http`, `https` (or the empty scheme) might - be - used with implementation specific semantics. - additionalProperties: {} - description: >- - QueryCurrentPlanResponse is the response type for the Query/CurrentPlan - RPC + Schemes other than `http`, `https` (or the empty scheme) might be - method. - cosmos.upgrade.v1beta1.QueryModuleVersionsResponse: - type: object - properties: - module_versions: + used with implementation specific semantics. + additionalProperties: {} + initial_deposit: type: array items: type: object properties: - name: + denom: type: string - title: name of the app module - version: + amount: type: string - format: uint64 - title: consensus version of the app module description: |- - ModuleVersion specifies a module and its consensus version. + Coin defines a token with a denomination and an amount. - Since: cosmos-sdk 0.43 + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. description: >- - module_versions is a list of module names with their consensus - versions. + initial_deposit is the deposit value that must be paid at proposal + submission. + proposer: + type: string + description: proposer is the account address of the proposer. description: >- - QueryModuleVersionsResponse is the response type for the - Query/ModuleVersions + MsgSubmitProposal defines an sdk.Msg type that supports submitting + arbitrary - RPC method. - - - Since: cosmos-sdk 0.43 - cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse: + proposal Content. + cosmos.gov.v1beta1.MsgSubmitProposalResponse: type: object properties: - upgraded_consensus_state: + proposal_id: type: string - format: byte - title: 'Since: cosmos-sdk 0.43' - description: >- - QueryUpgradedConsensusStateResponse is the response type for the - Query/UpgradedConsensusState - - RPC method. - cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse: - type: object - description: >- - MsgCreateVestingAccountResponse defines the - Msg/CreatePeriodicVestingAccount - - response type. - - - Since: cosmos-sdk 0.46 - cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse: + format: uint64 + description: proposal_id defines the unique id of the proposal. + description: MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. + cosmos.gov.v1beta1.MsgVote: type: object - description: >- - MsgCreatePermanentLockedAccountResponse defines the - Msg/CreatePermanentLockedAccount response type. - - - Since: cosmos-sdk 0.46 - cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse: + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + voter: + type: string + description: voter is the voter address for the proposal. + option: + description: option defines the vote option. + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + description: MsgVote defines a message to cast a vote. + cosmos.gov.v1beta1.MsgVoteResponse: type: object - description: >- - MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount - response type. - cosmos.vesting.v1beta1.Period: + description: MsgVoteResponse defines the Msg/Vote response type. + cosmos.gov.v1beta1.MsgVoteWeighted: type: object properties: - length: + proposal_id: type: string - format: int64 - description: Period duration in seconds. - amount: + format: uint64 + description: proposal_id defines the unique id of the proposal. + voter: + type: string + description: voter is the voter address for the proposal. + options: type: array items: type: object properties: - denom: + option: + description: >- + option defines the valid vote options, it must not contain + duplicate vote options. type: string - amount: + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + weight: type: string + description: weight is the vote weight associated with the vote option. description: |- - Coin defines a token with a denomination and an amount. + WeightedVoteOption defines a unit of vote for vote split. - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: Period defines a length of time and amount of coins that will vest. - ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccountResponse: - type: object - properties: - channel_id: - type: string - port_id: - type: string - title: >- - MsgRegisterInterchainAccountResponse defines the response for - Msg/RegisterAccount - ibc.applications.interchain_accounts.controller.v1.MsgSendTxResponse: - type: object - properties: - sequence: - type: string - format: uint64 - title: MsgSendTxResponse defines the response for MsgSendTx - ibc.applications.interchain_accounts.controller.v1.Params: - type: object - properties: - controller_enabled: - type: boolean - description: controller_enabled enables or disables the controller submodule. + Since: cosmos-sdk 0.43 + description: options defines the weighted vote options. description: |- - Params defines the set of on-chain interchain accounts parameters. - The following parameters may be used to disable the controller submodule. - ibc.applications.interchain_accounts.controller.v1.QueryInterchainAccountResponse: + MsgVoteWeighted defines a message to cast a vote. + + Since: cosmos-sdk 0.43 + cosmos.gov.v1beta1.MsgVoteWeightedResponse: type: object - properties: - address: - type: string + description: |- + MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. + + Since: cosmos-sdk 0.43 + cosmos.gov.v1beta1.VoteOption: + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED description: >- - QueryInterchainAccountResponse the response type for the - Query/InterchainAccount RPC method. - ibc.applications.interchain_accounts.controller.v1.QueryParamsResponse: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - controller_enabled: - type: boolean - description: controller_enabled enables or disables the controller submodule. - description: QueryParamsResponse is the response type for the Query/Params RPC method. - ibc.applications.interchain_accounts.v1.InterchainAccountPacketData: + VoteOption enumerates the valid vote options for a given governance + proposal. + + - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option. + - VOTE_OPTION_ABSTAIN: VOTE_OPTION_ABSTAIN defines an abstain vote option. + - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. + - VOTE_OPTION_NO_WITH_VETO: VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. + cosmos.gov.v1beta1.WeightedVoteOption: type: object properties: - type: + option: + description: >- + option defines the valid vote options, it must not contain duplicate + vote options. type: string enum: - - TYPE_UNSPECIFIED - - TYPE_EXECUTE_TX - default: TYPE_UNSPECIFIED - description: |- - - TYPE_UNSPECIFIED: Default zero value enumeration - - TYPE_EXECUTE_TX: Execute a transaction on an interchain accounts host chain - title: >- - Type defines a classification of message issued from a controller - chain to its associated interchain accounts - - host - data: - type: string - format: byte - memo: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + weight: type: string - description: >- - InterchainAccountPacketData is comprised of a raw transaction, type of - transaction and optional memo field. - ibc.applications.interchain_accounts.v1.Type: - type: string - enum: - - TYPE_UNSPECIFIED - - TYPE_EXECUTE_TX - default: TYPE_UNSPECIFIED + description: weight is the vote weight associated with the vote option. description: |- - - TYPE_UNSPECIFIED: Default zero value enumeration - - TYPE_EXECUTE_TX: Execute a transaction on an interchain accounts host chain - title: >- - Type defines a classification of message issued from a controller chain to - its associated interchain accounts + WeightedVoteOption defines a unit of vote for vote split. - host - ibc.applications.interchain_accounts.host.v1.Params: + Since: cosmos-sdk 0.43 + cosmos.mint.v1beta1.MsgUpdateParams: type: object properties: - host_enabled: - type: boolean - description: host_enabled enables or disables the host submodule. - allow_messages: - type: array - items: - type: string + authority: + type: string description: >- - allow_messages defines a list of sdk message typeURLs allowed to be - executed on a host chain. - description: |- - Params defines the set of on-chain interchain accounts parameters. - The following parameters may be used to disable the host submodule. - ibc.applications.interchain_accounts.host.v1.QueryParamsResponse: - type: object - properties: + authority is the address that controls the module (defaults to x/gov + unless overwritten). params: - description: params defines the parameters of the module. + description: |- + params defines the x/mint parameters to update. + + NOTE: All parameters must be supplied. type: object properties: - host_enabled: - type: boolean - description: host_enabled enables or disables the host submodule. - allow_messages: - type: array - items: - type: string - description: >- - allow_messages defines a list of sdk message typeURLs allowed to - be executed on a host chain. - description: QueryParamsResponse is the response type for the Query/Params RPC method. - ibc.applications.transfer.v1.DenomTrace: - type: object - properties: - path: - type: string - description: >- - path defines the chain of port/channel identifiers used for tracing - the + mint_denom: + type: string + title: type of coin to mint + inflation_rate_change: + type: string + title: maximum annual change in inflation rate + inflation_max: + type: string + title: maximum inflation rate + inflation_min: + type: string + title: minimum inflation rate + goal_bonded: + type: string + title: goal of percent bonded atoms + blocks_per_year: + type: string + format: uint64 + title: expected blocks per year + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. - source of the fungible token. - base_denom: - type: string - description: base denomination of the relayed fungible token. - description: >- - DenomTrace contains the base denomination for ICS20 fungible tokens and - the + Since: cosmos-sdk 0.47 + cosmos.mint.v1beta1.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. - source tracing information path. - ibc.applications.transfer.v1.MsgTransferResponse: + Since: cosmos-sdk 0.47 + cosmos.mint.v1beta1.Params: type: object properties: - sequence: + mint_denom: + type: string + title: type of coin to mint + inflation_rate_change: + type: string + title: maximum annual change in inflation rate + inflation_max: + type: string + title: maximum inflation rate + inflation_min: + type: string + title: minimum inflation rate + goal_bonded: + type: string + title: goal of percent bonded atoms + blocks_per_year: type: string format: uint64 - title: sequence number of the transfer packet sent - description: MsgTransferResponse defines the Msg/Transfer response type. - ibc.applications.transfer.v1.Params: - type: object - properties: - send_enabled: - type: boolean - description: >- - send_enabled enables or disables all cross-chain token transfers from - this - - chain. - receive_enabled: - type: boolean - description: >- - receive_enabled enables or disables all cross-chain token transfers to - this - - chain. - description: >- - Params defines the set of IBC transfer parameters. - - NOTE: To prevent a single token from being transferred, set the - - TransfersEnabled parameter to true and then set the bank module's - SendEnabled - - parameter for the denomination to false. - ibc.applications.transfer.v1.QueryDenomHashResponse: + title: expected blocks per year + description: Params defines the parameters for the x/mint module. + cosmos.params.v1beta1.ParamChange: type: object properties: - hash: + subspace: + type: string + key: + type: string + value: type: string - description: hash (in hex format) of the denomination trace information. description: |- - QueryDenomHashResponse is the response type for the Query/DenomHash RPC - method. - ibc.applications.transfer.v1.QueryDenomTraceResponse: + ParamChange defines an individual parameter change, for use in + ParameterChangeProposal. + cosmos.params.v1beta1.QueryParamsResponse: type: object properties: - denom_trace: - description: denom_trace returns the requested denomination trace information. + param: + description: param defines the queried parameter. type: object properties: - path: + subspace: type: string - description: >- - path defines the chain of port/channel identifiers used for - tracing the - - source of the fungible token. - base_denom: + key: type: string - description: base denomination of the relayed fungible token. - description: |- - QueryDenomTraceResponse is the response type for the Query/DenomTrace RPC - method. - ibc.applications.transfer.v1.QueryDenomTracesResponse: + value: + type: string + description: QueryParamsResponse is response type for the Query/Params RPC method. + cosmos.params.v1beta1.QuerySubspacesResponse: type: object properties: - denom_traces: + subspaces: type: array items: type: object properties: - path: - type: string - description: >- - path defines the chain of port/channel identifiers used for - tracing the - - source of the fungible token. - base_denom: + subspace: type: string - description: base denomination of the relayed fungible token. + keys: + type: array + items: + type: string description: >- - DenomTrace contains the base denomination for ICS20 fungible tokens - and the - - source tracing information path. - description: denom_traces returns all denominations trace information. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryConnectionsResponse is the response type for the Query/DenomTraces - RPC - - method. - ibc.applications.transfer.v1.QueryEscrowAddressResponse: - type: object - properties: - escrow_address: - type: string - title: the escrow account address - description: >- - QueryEscrowAddressResponse is the response type of the EscrowAddress RPC - method. - ibc.applications.transfer.v1.QueryParamsResponse: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - send_enabled: - type: boolean - description: >- - send_enabled enables or disables all cross-chain token transfers - from this + Subspace defines a parameter subspace name and all the keys that + exist for - chain. - receive_enabled: - type: boolean - description: >- - receive_enabled enables or disables all cross-chain token - transfers to this + the subspace. - chain. - description: QueryParamsResponse is the response type for the Query/Params RPC method. - ibc.applications.transfer.v1.QueryTotalEscrowForDenomResponse: - type: object - properties: - amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: >- - QueryTotalEscrowForDenomResponse is the response type for - TotalEscrowForDenom RPC method. - ibc.core.client.v1.Height: - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision + Since: cosmos-sdk 0.46 description: |- - Normally the RevisionHeight is incremented at each height while keeping - RevisionNumber the same. However some consensus algorithms may choose to - reset the height in certain conditions e.g. hard forks, state-machine - breaking changes In these cases, the RevisionNumber is incremented so that - height continues to be monitonically increasing even as the RevisionHeight - gets reset - title: >- - Height is a monotonically increasing data type - - that can be compared against another Height for the purposes of updating - and - - freezing clients - ibc.core.channel.v1.Channel: - type: object - properties: - state: - title: current state of the channel end - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - - STATE_CLOSED - default: STATE_UNINITIALIZED_UNSPECIFIED - description: |- - State defines if a channel is in one of the following states: - CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. + QuerySubspacesResponse defines the response types for querying for all + registered subspaces and all keys for a subspace. - - STATE_UNINITIALIZED_UNSPECIFIED: Default State - - STATE_INIT: A channel has just started the opening handshake. - - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. - - STATE_OPEN: A channel has completed the handshake. Open channels are - ready to send and receive packets. - - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive - packets. - ordering: - title: whether the channel is ordered or unordered - type: string - enum: - - ORDER_NONE_UNSPECIFIED - - ORDER_UNORDERED - - ORDER_ORDERED - default: ORDER_NONE_UNSPECIFIED - description: |- - - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering - - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in - which they were sent. - - ORDER_ORDERED: packets are delivered exactly in the order which they were sent - counterparty: - title: counterparty channel end - type: object - properties: - port_id: - type: string - description: >- - port on the counterparty chain which owns the other end of the - channel. - channel_id: - type: string - title: channel end on the counterparty chain - connection_hops: + Since: cosmos-sdk 0.46 + cosmos.params.v1beta1.Subspace: + type: object + properties: + subspace: + type: string + keys: type: array items: type: string - title: |- - list of connection identifiers, in order, along which packets sent on - this channel will travel - version: - type: string - title: opaque channel version, which is agreed upon during the handshake description: |- - Channel defines pipeline for exactly-once packet delivery between specific - modules on separate blockchains, which has at least one end capable of - sending packets and one end capable of receiving packets. - ibc.core.channel.v1.Counterparty: + Subspace defines a parameter subspace name and all the keys that exist for + the subspace. + + Since: cosmos-sdk 0.46 + cosmos.slashing.v1beta1.MsgUnjail: type: object properties: - port_id: - type: string - description: >- - port on the counterparty chain which owns the other end of the - channel. - channel_id: + validator_addr: type: string - title: channel end on the counterparty chain - title: Counterparty defines a channel end counterparty - ibc.core.channel.v1.IdentifiedChannel: + title: MsgUnjail defines the Msg/Unjail request type + cosmos.slashing.v1beta1.MsgUnjailResponse: + type: object + title: MsgUnjailResponse defines the Msg/Unjail response type + cosmos.slashing.v1beta1.MsgUpdateParams: type: object properties: - state: - title: current state of the channel end + authority: type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - - STATE_CLOSED - default: STATE_UNINITIALIZED_UNSPECIFIED + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + params: description: |- - State defines if a channel is in one of the following states: - CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. + params defines the x/slashing parameters to update. - - STATE_UNINITIALIZED_UNSPECIFIED: Default State - - STATE_INIT: A channel has just started the opening handshake. - - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. - - STATE_OPEN: A channel has completed the handshake. Open channels are - ready to send and receive packets. - - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive - packets. - ordering: - title: whether the channel is ordered or unordered - type: string - enum: - - ORDER_NONE_UNSPECIFIED - - ORDER_UNORDERED - - ORDER_ORDERED - default: ORDER_NONE_UNSPECIFIED - description: |- - - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering - - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in - which they were sent. - - ORDER_ORDERED: packets are delivered exactly in the order which they were sent - counterparty: - title: counterparty channel end + NOTE: All parameters must be supplied. type: object properties: - port_id: + signed_blocks_window: type: string - description: >- - port on the counterparty chain which owns the other end of the - channel. - channel_id: + format: int64 + min_signed_per_window: type: string - title: channel end on the counterparty chain - connection_hops: - type: array - items: - type: string - title: |- - list of connection identifiers, in order, along which packets sent on - this channel will travel - version: - type: string - title: opaque channel version, which is agreed upon during the handshake - port_id: - type: string - title: port identifier - channel_id: - type: string - title: channel identifier + format: byte + downtime_jail_duration: + type: string + slash_fraction_double_sign: + type: string + format: byte + slash_fraction_downtime: + type: string + format: byte description: |- - IdentifiedChannel defines a channel with additional port and channel - identifier fields. - ibc.core.channel.v1.MsgAcknowledgementResponse: - type: object - properties: - result: - type: string - enum: - - RESPONSE_RESULT_TYPE_UNSPECIFIED - - RESPONSE_RESULT_TYPE_NOOP - - RESPONSE_RESULT_TYPE_SUCCESS - default: RESPONSE_RESULT_TYPE_UNSPECIFIED - description: |- - - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value enumeration - - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) - - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully - title: >- - ResponseResultType defines the possible outcomes of the execution of a - message - description: MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. - ibc.core.channel.v1.MsgChannelCloseConfirmResponse: - type: object - description: >- - MsgChannelCloseConfirmResponse defines the Msg/ChannelCloseConfirm - response + MsgUpdateParams is the Msg/UpdateParams request type. - type. - ibc.core.channel.v1.MsgChannelCloseInitResponse: - type: object - description: >- - MsgChannelCloseInitResponse defines the Msg/ChannelCloseInit response - type. - ibc.core.channel.v1.MsgChannelOpenAckResponse: - type: object - description: MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response type. - ibc.core.channel.v1.MsgChannelOpenConfirmResponse: + Since: cosmos-sdk 0.47 + cosmos.slashing.v1beta1.MsgUpdateParamsResponse: type: object description: |- - MsgChannelOpenConfirmResponse defines the Msg/ChannelOpenConfirm response - type. - ibc.core.channel.v1.MsgChannelOpenInitResponse: + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. + + Since: cosmos-sdk 0.47 + cosmos.slashing.v1beta1.Params: type: object properties: - channel_id: + signed_blocks_window: type: string - version: + format: int64 + min_signed_per_window: type: string - description: MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. - ibc.core.channel.v1.MsgChannelOpenTryResponse: - type: object - properties: - version: + format: byte + downtime_jail_duration: type: string - channel_id: + slash_fraction_double_sign: type: string - description: MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. - ibc.core.channel.v1.MsgRecvPacketResponse: - type: object - properties: - result: + format: byte + slash_fraction_downtime: type: string - enum: - - RESPONSE_RESULT_TYPE_UNSPECIFIED - - RESPONSE_RESULT_TYPE_NOOP - - RESPONSE_RESULT_TYPE_SUCCESS - default: RESPONSE_RESULT_TYPE_UNSPECIFIED - description: |- - - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value enumeration - - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) - - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully - title: >- - ResponseResultType defines the possible outcomes of the execution of a - message - description: MsgRecvPacketResponse defines the Msg/RecvPacket response type. - ibc.core.channel.v1.MsgTimeoutOnCloseResponse: + format: byte + description: Params represents the parameters used for by the slashing module. + cosmos.staking.v1beta1.CommissionRates: type: object properties: - result: + rate: type: string - enum: - - RESPONSE_RESULT_TYPE_UNSPECIFIED - - RESPONSE_RESULT_TYPE_NOOP - - RESPONSE_RESULT_TYPE_SUCCESS - default: RESPONSE_RESULT_TYPE_UNSPECIFIED - description: |- - - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value enumeration - - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) - - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully - title: >- - ResponseResultType defines the possible outcomes of the execution of a - message - description: MsgTimeoutOnCloseResponse defines the Msg/TimeoutOnClose response type. - ibc.core.channel.v1.MsgTimeoutResponse: - type: object - properties: - result: + description: rate is the commission rate charged to delegators, as a fraction. + max_rate: type: string - enum: - - RESPONSE_RESULT_TYPE_UNSPECIFIED - - RESPONSE_RESULT_TYPE_NOOP - - RESPONSE_RESULT_TYPE_SUCCESS - default: RESPONSE_RESULT_TYPE_UNSPECIFIED - description: |- - - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value enumeration - - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) - - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully - title: >- - ResponseResultType defines the possible outcomes of the execution of a - message - description: MsgTimeoutResponse defines the Msg/Timeout response type. - ibc.core.channel.v1.Order: - type: string - enum: - - ORDER_NONE_UNSPECIFIED - - ORDER_UNORDERED - - ORDER_ORDERED - default: ORDER_NONE_UNSPECIFIED - description: |- - - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering - - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in - which they were sent. - - ORDER_ORDERED: packets are delivered exactly in the order which they were sent - title: Order defines if a channel is ORDERED or UNORDERED - ibc.core.channel.v1.Packet: + description: >- + max_rate defines the maximum commission rate which validator can ever + charge, as a fraction. + max_change_rate: + type: string + description: >- + max_change_rate defines the maximum daily increase of the validator + commission, as a fraction. + description: >- + CommissionRates defines the initial commission rates to be used for + creating + + a validator. + cosmos.staking.v1beta1.Description: type: object properties: - sequence: + moniker: + type: string + description: moniker defines a human-readable name for the validator. + identity: type: string - format: uint64 description: >- - number corresponds to the order of sends and receives, where a Packet - - with an earlier sequence number must be sent and received before a - Packet - - with a later sequence number. - source_port: + identity defines an optional identity signature (ex. UPort or + Keybase). + website: type: string - description: identifies the port on the sending chain. - source_channel: + description: website defines an optional website link. + security_contact: type: string - description: identifies the channel end on the sending chain. - destination_port: + description: security_contact defines an optional email for security contact. + details: type: string - description: identifies the port on the receiving chain. - destination_channel: + description: details define other optional details. + description: Description defines a validator description. + cosmos.staking.v1beta1.MsgBeginRedelegate: + type: object + properties: + delegator_address: type: string - description: identifies the channel end on the receiving chain. - data: + validator_src_address: type: string - format: byte - title: actual opaque bytes transferred directly to the application module - timeout_height: - title: block height after which the packet times out + validator_dst_address: + type: string + amount: type: object properties: - revision_number: + denom: type: string - format: uint64 - title: the revision that the client is currently on - revision_height: + amount: type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight + description: |- + Coin defines a token with a denomination and an amount. - gets reset - timeout_timestamp: - type: string - format: uint64 - title: block timestamp (in nanoseconds) after which the packet times out - title: >- - Packet defines a type that carries data across different chains through - IBC - ibc.core.channel.v1.PacketState: + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: |- + MsgBeginRedelegate defines a SDK message for performing a redelegation + of coins from a delegator and source validator to a destination validator. + cosmos.staking.v1beta1.MsgBeginRedelegateResponse: type: object properties: - port_id: - type: string - description: channel port identifier. - channel_id: - type: string - description: channel unique identifier. - sequence: - type: string - format: uint64 - description: packet sequence. - data: + completion_time: type: string - format: byte - description: embedded data that represents packet state. - description: |- - PacketState defines the generic type necessary to retrieve and store - packet commitments, acknowledgements, and receipts. - Caller is responsible for knowing the context necessary to interpret this - state as a commitment, acknowledgement, or a receipt. - ibc.core.channel.v1.QueryChannelClientStateResponse: + format: date-time + description: MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. + cosmos.staking.v1beta1.MsgCancelUnbondingDelegation: type: object properties: - identified_client_state: - title: client state associated with the channel + delegator_address: + type: string + validator_address: + type: string + amount: type: object properties: - client_id: + denom: + type: string + amount: type: string - title: client identifier - client_state: - title: client state - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } description: |- - IdentifiedClientState defines a client state with an additional client - identifier field. - proof: + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + title: >- + amount is always less than or equal to unbonding delegation entry + balance + creation_height: type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved + format: int64 + description: creation_height is the height which the unbonding took place. + description: 'Since: cosmos-sdk 0.46' + title: >- + MsgCancelUnbondingDelegation defines the SDK message for performing a + cancel unbonding delegation for delegator + cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse: + type: object + description: 'Since: cosmos-sdk 0.46' + title: MsgCancelUnbondingDelegationResponse + cosmos.staking.v1beta1.MsgCreateValidator: + type: object + properties: + description: type: object properties: - revision_number: + moniker: type: string - format: uint64 - title: the revision that the client is currently on - revision_height: + description: moniker defines a human-readable name for the validator. + identity: type: string - format: uint64 - title: the height within the given revision + description: >- + identity defines an optional identity signature (ex. UPort or + Keybase). + website: + type: string + description: website defines an optional website link. + security_contact: + type: string + description: security_contact defines an optional email for security contact. + details: + type: string + description: details define other optional details. + description: Description defines a validator description. + commission: + type: object + properties: + rate: + type: string + description: rate is the commission rate charged to delegators, as a fraction. + max_rate: + type: string + description: >- + max_rate defines the maximum commission rate which validator can + ever charge, as a fraction. + max_change_rate: + type: string + description: >- + max_change_rate defines the maximum daily increase of the + validator commission, as a fraction. description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine + CommissionRates defines the initial commission rates to be used for + creating - breaking changes In these cases, the RevisionNumber is incremented so - that + a validator. + min_self_delegation: + type: string + delegator_address: + type: string + description: >- + Deprecated: Use of Delegator Address in MsgCreateValidator is + deprecated. - height continues to be monitonically increasing even as the - RevisionHeight + The validator address bytes and delegator address bytes refer to the + same account while creating validator (defer - gets reset - title: |- - QueryChannelClientStateResponse is the Response type for the - Query/QueryChannelClientState RPC method - ibc.core.channel.v1.QueryChannelConsensusStateResponse: - type: object - properties: - consensus_state: - title: consensus state associated with the channel + only in bech32 notation). + validator_address: + type: string + pubkey: type: object properties: '@type': @@ -73700,8 +22297,12 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -73711,7 +22312,7 @@ definitions: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -73735,10 +22336,8 @@ definitions: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -73770,572 +22369,799 @@ definitions: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } - client_id: + value: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: MsgCreateValidator defines a SDK message for creating a new validator. + cosmos.staking.v1beta1.MsgCreateValidatorResponse: + type: object + description: MsgCreateValidatorResponse defines the Msg/CreateValidator response type. + cosmos.staking.v1beta1.MsgDelegate: + type: object + properties: + delegator_address: type: string - title: client ID associated with the consensus state - proof: + validator_address: type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved + amount: type: object properties: - revision_number: + denom: type: string - format: uint64 - title: the revision that the client is currently on - revision_height: + amount: type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping + description: |- + Coin defines a token with a denomination and an amount. - RevisionNumber the same. However some consensus algorithms may choose - to + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: |- + MsgDelegate defines a SDK message for performing a delegation of coins + from a delegator to a validator. + cosmos.staking.v1beta1.MsgDelegateResponse: + type: object + description: MsgDelegateResponse defines the Msg/Delegate response type. + cosmos.staking.v1beta1.MsgEditValidator: + type: object + properties: + description: + type: object + properties: + moniker: + type: string + description: moniker defines a human-readable name for the validator. + identity: + type: string + description: >- + identity defines an optional identity signature (ex. UPort or + Keybase). + website: + type: string + description: website defines an optional website link. + security_contact: + type: string + description: security_contact defines an optional email for security contact. + details: + type: string + description: details define other optional details. + description: Description defines a validator description. + validator_address: + type: string + commission_rate: + type: string + title: >- + We pass a reference to the new commission rate and min self delegation + as - reset the height in certain conditions e.g. hard forks, state-machine + it's not mandatory to update. If not updated, the deserialized rate + will be - breaking changes In these cases, the RevisionNumber is incremented so - that + zero with no way to distinguish if an update was intended. - height continues to be monitonically increasing even as the - RevisionHeight + REF: #2373 + min_self_delegation: + type: string + description: MsgEditValidator defines a SDK message for editing an existing validator. + cosmos.staking.v1beta1.MsgEditValidatorResponse: + type: object + description: MsgEditValidatorResponse defines the Msg/EditValidator response type. + cosmos.staking.v1beta1.MsgUndelegate: + type: object + properties: + delegator_address: + type: string + validator_address: + type: string + amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. - gets reset - title: |- - QueryChannelClientStateResponse is the Response type for the - Query/QueryChannelClientState RPC method - ibc.core.channel.v1.QueryChannelResponse: + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: |- + MsgUndelegate defines a SDK message for performing an undelegation from a + delegate and a validator. + cosmos.staking.v1beta1.MsgUndelegateResponse: type: object properties: - channel: - title: channel associated with the request identifiers + completion_time: + type: string + format: date-time + amount: type: object properties: - state: - title: current state of the channel end + denom: type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - - STATE_CLOSED - default: STATE_UNINITIALIZED_UNSPECIFIED - description: |- - State defines if a channel is in one of the following states: - CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. - - STATE_UNINITIALIZED_UNSPECIFIED: Default State - - STATE_INIT: A channel has just started the opening handshake. - - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. - - STATE_OPEN: A channel has completed the handshake. Open channels are - ready to send and receive packets. - - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive - packets. - ordering: - title: whether the channel is ordered or unordered + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + title: amount returns the amount of undelegated coins + description: MsgUndelegateResponse defines the Msg/Undelegate response type. + cosmos.staking.v1beta1.MsgUpdateParams: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + params: + description: |- + params defines the x/staking parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + unbonding_time: + type: string + description: unbonding_time is the time duration of unbonding. + max_validators: + type: integer + format: int64 + description: max_validators is the maximum number of validators. + max_entries: + type: integer + format: int64 + description: >- + max_entries is the max entries for either unbonding delegation or + redelegation (per pair/trio). + historical_entries: + type: integer + format: int64 + description: historical_entries is the number of historical entries to persist. + bond_denom: + type: string + description: bond_denom defines the bondable coin denomination. + min_commission_rate: type: string - enum: - - ORDER_NONE_UNSPECIFIED - - ORDER_UNORDERED - - ORDER_ORDERED - default: ORDER_NONE_UNSPECIFIED - description: |- - - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering - - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in - which they were sent. - - ORDER_ORDERED: packets are delivered exactly in the order which they were sent - counterparty: - title: counterparty channel end - type: object - properties: - port_id: - type: string - description: >- - port on the counterparty chain which owns the other end of the - channel. - channel_id: - type: string - title: channel end on the counterparty chain - connection_hops: - type: array - items: - type: string title: >- - list of connection identifiers, in order, along which packets sent - on + min_commission_rate is the chain-wide minimum commission rate that + a validator can charge their delegators + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. - this channel will travel - version: - type: string - title: opaque channel version, which is agreed upon during the handshake + Since: cosmos-sdk 0.47 + cosmos.staking.v1beta1.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. + + Since: cosmos-sdk 0.47 + cosmos.staking.v1beta1.Params: + type: object + properties: + unbonding_time: + type: string + description: unbonding_time is the time duration of unbonding. + max_validators: + type: integer + format: int64 + description: max_validators is the maximum number of validators. + max_entries: + type: integer + format: int64 description: >- - Channel defines pipeline for exactly-once packet delivery between - specific + max_entries is the max entries for either unbonding delegation or + redelegation (per pair/trio). + historical_entries: + type: integer + format: int64 + description: historical_entries is the number of historical entries to persist. + bond_denom: + type: string + description: bond_denom defines the bondable coin denomination. + min_commission_rate: + type: string + title: >- + min_commission_rate is the chain-wide minimum commission rate that a + validator can charge their delegators + description: Params defines the parameters for the x/staking module. + ibc.applications.fee.v1.Fee: + type: object + properties: + recv_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. - modules on separate blockchains, which has at least one end capable of + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + title: the packet receive fee + ack_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. - sending packets and one end capable of receiving packets. - proof: + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + title: the packet acknowledgement fee + timeout_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + title: the packet timeout fee + title: Fee defines the ICS29 receive, acknowledgement and timeout fees + ibc.applications.fee.v1.MsgPayPacketFee: + type: object + properties: + fee: + title: >- + fee encapsulates the recv, ack and timeout fees associated with an IBC + packet + type: object + properties: + recv_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: the packet receive fee + ack_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: the packet acknowledgement fee + timeout_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: the packet timeout fee + source_port_id: type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved + title: the source port unique identifier + source_channel_id: + type: string + title: the source channel unique identifer + signer: + type: string + title: account address to refund fee if necessary + relayers: + type: array + items: + type: string + title: optional list of relayers permitted to the receive packet fees + title: >- + MsgPayPacketFee defines the request type for the PayPacketFee rpc + + This Msg can be used to pay for a packet at the next sequence send & + should be combined with the Msg that will be + + paid for + ibc.applications.fee.v1.MsgPayPacketFeeAsync: + type: object + properties: + packet_id: + title: >- + unique packet identifier comprised of the channel ID, port ID and + sequence type: object properties: - revision_number: + port_id: type: string - format: uint64 - title: the revision that the client is currently on - revision_height: + title: channel port identifier + channel_id: + type: string + title: channel unique identifier + sequence: type: string format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping + title: packet sequence + packet_fee: + title: the packet fee associated with a particular IBC packet + type: object + properties: + fee: + title: >- + fee encapsulates the recv, ack and timeout fees associated with an + IBC packet + type: object + properties: + recv_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - RevisionNumber the same. However some consensus algorithms may choose - to - reset the height in certain conditions e.g. hard forks, state-machine + NOTE: The amount field is an Int which implements the custom + method - breaking changes In these cases, the RevisionNumber is incremented so - that + signatures required by gogoproto. + title: the packet receive fee + ack_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - height continues to be monitonically increasing even as the - RevisionHeight - gets reset - description: >- - QueryChannelResponse is the response type for the Query/Channel RPC - method. + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: the packet acknowledgement fee + timeout_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method - Besides the Channel end, it includes a proof and the height from which the + signatures required by gogoproto. + title: the packet timeout fee + refund_address: + type: string + title: the refund address for unspent fees + relayers: + type: array + items: + type: string + title: optional list of relayers permitted to receive fees + title: >- + MsgPayPacketFeeAsync defines the request type for the PayPacketFeeAsync + rpc - proof was retrieved. - ibc.core.channel.v1.QueryChannelsResponse: + This Msg can be used to pay for a packet at a specified sequence (instead + of the next sequence send) + ibc.applications.fee.v1.MsgPayPacketFeeAsyncResponse: + type: object + title: >- + MsgPayPacketFeeAsyncResponse defines the response type for the + PayPacketFeeAsync rpc + ibc.applications.fee.v1.MsgPayPacketFeeResponse: + type: object + title: MsgPayPacketFeeResponse defines the response type for the PayPacketFee rpc + ibc.applications.fee.v1.MsgRegisterCounterpartyPayee: + type: object + properties: + port_id: + type: string + title: unique port identifier + channel_id: + type: string + title: unique channel identifier + relayer: + type: string + title: the relayer address + counterparty_payee: + type: string + title: the counterparty payee address + title: >- + MsgRegisterCounterpartyPayee defines the request type for the + RegisterCounterpartyPayee rpc + ibc.applications.fee.v1.MsgRegisterCounterpartyPayeeResponse: + type: object + title: >- + MsgRegisterCounterpartyPayeeResponse defines the response type for the + RegisterCounterpartyPayee rpc + ibc.applications.fee.v1.MsgRegisterPayee: + type: object + properties: + port_id: + type: string + title: unique port identifier + channel_id: + type: string + title: unique channel identifier + relayer: + type: string + title: the relayer address + payee: + type: string + title: the payee address + title: MsgRegisterPayee defines the request type for the RegisterPayee rpc + ibc.applications.fee.v1.MsgRegisterPayeeResponse: + type: object + title: >- + MsgRegisterPayeeResponse defines the response type for the RegisterPayee + rpc + ibc.applications.fee.v1.PacketFee: type: object properties: - channels: - type: array - items: - type: object - properties: - state: - title: current state of the channel end - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - - STATE_CLOSED - default: STATE_UNINITIALIZED_UNSPECIFIED - description: |- - State defines if a channel is in one of the following states: - CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. - - - STATE_UNINITIALIZED_UNSPECIFIED: Default State - - STATE_INIT: A channel has just started the opening handshake. - - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. - - STATE_OPEN: A channel has completed the handshake. Open channels are - ready to send and receive packets. - - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive - packets. - ordering: - title: whether the channel is ordered or unordered - type: string - enum: - - ORDER_NONE_UNSPECIFIED - - ORDER_UNORDERED - - ORDER_ORDERED - default: ORDER_NONE_UNSPECIFIED - description: |- - - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering - - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in - which they were sent. - - ORDER_ORDERED: packets are delivered exactly in the order which they were sent - counterparty: - title: counterparty channel end + fee: + title: >- + fee encapsulates the recv, ack and timeout fees associated with an IBC + packet + type: object + properties: + recv_fee: + type: array + items: type: object properties: - port_id: + denom: type: string - description: >- - port on the counterparty chain which owns the other end of - the channel. - channel_id: + amount: type: string - title: channel end on the counterparty chain - connection_hops: - type: array - items: - type: string - title: >- - list of connection identifiers, in order, along which packets - sent on - - this channel will travel - version: - type: string - title: >- - opaque channel version, which is agreed upon during the - handshake - port_id: - type: string - title: port identifier - channel_id: - type: string - title: channel identifier - description: |- - IdentifiedChannel defines a channel with additional port and channel - identifier fields. - description: list of stored channels of the chain. - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. + description: >- + Coin defines a token with a denomination and an amount. - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - RevisionNumber the same. However some consensus algorithms may choose - to + NOTE: The amount field is an Int which implements the custom + method - reset the height in certain conditions e.g. hard forks, state-machine + signatures required by gogoproto. + title: the packet receive fee + ack_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - breaking changes In these cases, the RevisionNumber is incremented so - that - height continues to be monitonically increasing even as the - RevisionHeight + NOTE: The amount field is an Int which implements the custom + method - gets reset - description: >- - QueryChannelsResponse is the response type for the Query/Channels RPC - method. - ibc.core.channel.v1.QueryConnectionChannelsResponse: - type: object - properties: - channels: - type: array - items: - type: object - properties: - state: - title: current state of the channel end - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - - STATE_CLOSED - default: STATE_UNINITIALIZED_UNSPECIFIED - description: |- - State defines if a channel is in one of the following states: - CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. - - - STATE_UNINITIALIZED_UNSPECIFIED: Default State - - STATE_INIT: A channel has just started the opening handshake. - - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. - - STATE_OPEN: A channel has completed the handshake. Open channels are - ready to send and receive packets. - - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive - packets. - ordering: - title: whether the channel is ordered or unordered - type: string - enum: - - ORDER_NONE_UNSPECIFIED - - ORDER_UNORDERED - - ORDER_ORDERED - default: ORDER_NONE_UNSPECIFIED - description: |- - - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering - - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in - which they were sent. - - ORDER_ORDERED: packets are delivered exactly in the order which they were sent - counterparty: - title: counterparty channel end + signatures required by gogoproto. + title: the packet acknowledgement fee + timeout_fee: + type: array + items: type: object properties: - port_id: + denom: type: string - description: >- - port on the counterparty chain which owns the other end of - the channel. - channel_id: + amount: type: string - title: channel end on the counterparty chain - connection_hops: - type: array - items: - type: string - title: >- - list of connection identifiers, in order, along which packets - sent on + description: >- + Coin defines a token with a denomination and an amount. - this channel will travel - version: - type: string - title: >- - opaque channel version, which is agreed upon during the - handshake - port_id: - type: string - title: port identifier - channel_id: - type: string - title: channel identifier - description: |- - IdentifiedChannel defines a channel with additional port and channel - identifier fields. - description: list of channels associated with a connection. - pagination: - title: pagination response + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: the packet timeout fee + refund_address: + type: string + title: the refund address for unspent fees + relayers: + type: array + items: + type: string + title: optional list of relayers permitted to receive fees + title: >- + PacketFee contains ICS29 relayer fees, refund address and optional list of + permitted relayers + ibc.core.channel.v1.PacketId: + type: object + properties: + port_id: + type: string + title: channel port identifier + channel_id: + type: string + title: channel unique identifier + sequence: + type: string + format: uint64 + title: packet sequence + title: |- + PacketId is an identifer for a unique Packet + Source chains refer to packets by source port/channel + Destination chains refer to packets by destination port/channel + ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount: + type: object + properties: + owner: + type: string + connection_id: + type: string + version: + type: string + title: MsgRegisterInterchainAccount defines the payload for Msg/RegisterAccount + ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccountResponse: + type: object + properties: + channel_id: + type: string + port_id: + type: string + title: >- + MsgRegisterInterchainAccountResponse defines the response for + Msg/RegisterAccount + ibc.applications.interchain_accounts.controller.v1.MsgSendTx: + type: object + properties: + owner: + type: string + connection_id: + type: string + packet_data: type: object properties: - next_key: + type: type: string - format: byte + enum: + - TYPE_UNSPECIFIED + - TYPE_EXECUTE_TX + default: TYPE_UNSPECIFIED description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 + - TYPE_UNSPECIFIED: Default zero value enumeration + - TYPE_EXECUTE_TX: Execute a transaction on an interchain accounts host chain title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. + Type defines a classification of message issued from a controller + chain to its associated interchain accounts - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - height: - title: query block height - type: object - properties: - revision_number: + host + data: type: string - format: uint64 - title: the revision that the client is currently on - revision_height: + format: byte + memo: type: string - format: uint64 - title: the height within the given revision description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight + InterchainAccountPacketData is comprised of a raw transaction, type of + transaction and optional memo field. + relative_timeout: + type: string + format: uint64 + description: >- + Relative timeout timestamp provided will be added to the current block + time during transaction execution. - gets reset - title: |- - QueryConnectionChannelsResponse is the Response type for the - Query/QueryConnectionChannels RPC method - ibc.core.channel.v1.QueryNextSequenceReceiveResponse: + The timeout timestamp must be non-zero. + title: MsgSendTx defines the payload for Msg/SendTx + ibc.applications.interchain_accounts.controller.v1.MsgSendTxResponse: type: object properties: - next_sequence_receive: + sequence: type: string format: uint64 - title: next sequence receive number - proof: + title: MsgSendTxResponse defines the response for MsgSendTx + ibc.applications.interchain_accounts.controller.v1.MsgUpdateParams: + type: object + properties: + signer: type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision + title: signer address + params: description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine + params defines the 27-interchain-accounts/controller parameters to + update. - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - gets reset - title: |- - QuerySequenceResponse is the request type for the - Query/QueryNextSequenceReceiveResponse RPC method - ibc.core.channel.v1.QueryPacketAcknowledgementResponse: + NOTE: All parameters must be supplied. + type: object + properties: + controller_enabled: + type: boolean + description: controller_enabled enables or disables the controller submodule. + title: MsgUpdateParams defines the payload for Msg/UpdateParams + ibc.applications.interchain_accounts.controller.v1.MsgUpdateParamsResponse: + type: object + title: MsgUpdateParamsResponse defines the response for Msg/UpdateParams + ibc.applications.interchain_accounts.controller.v1.Params: type: object properties: - acknowledgement: + controller_enabled: + type: boolean + description: controller_enabled enables or disables the controller submodule. + description: |- + Params defines the set of on-chain interchain accounts parameters. + The following parameters may be used to disable the controller submodule. + ibc.applications.interchain_accounts.v1.InterchainAccountPacketData: + type: object + properties: + type: type: string - format: byte - title: packet associated with the request fields - proof: + enum: + - TYPE_UNSPECIFIED + - TYPE_EXECUTE_TX + default: TYPE_UNSPECIFIED + description: |- + - TYPE_UNSPECIFIED: Default zero value enumeration + - TYPE_EXECUTE_TX: Execute a transaction on an interchain accounts host chain + title: >- + Type defines a classification of message issued from a controller + chain to its associated interchain accounts + + host + data: type: string format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that + memo: + type: string + description: >- + InterchainAccountPacketData is comprised of a raw transaction, type of + transaction and optional memo field. + ibc.applications.interchain_accounts.v1.Type: + type: string + enum: + - TYPE_UNSPECIFIED + - TYPE_EXECUTE_TX + default: TYPE_UNSPECIFIED + description: |- + - TYPE_UNSPECIFIED: Default zero value enumeration + - TYPE_EXECUTE_TX: Execute a transaction on an interchain accounts host chain + title: >- + Type defines a classification of message issued from a controller chain to + its associated interchain accounts - height continues to be monitonically increasing even as the - RevisionHeight + host + ibc.applications.interchain_accounts.host.v1.MsgUpdateParams: + type: object + properties: + signer: + type: string + title: signer address + params: + description: |- + params defines the 27-interchain-accounts/host parameters to update. - gets reset - title: |- - QueryPacketAcknowledgementResponse defines the client query response for a - packet which also includes a proof and the height from which the - proof was retrieved - ibc.core.channel.v1.QueryPacketAcknowledgementsResponse: + NOTE: All parameters must be supplied. + type: object + properties: + host_enabled: + type: boolean + description: host_enabled enables or disables the host submodule. + allow_messages: + type: array + items: + type: string + description: >- + allow_messages defines a list of sdk message typeURLs allowed to + be executed on a host chain. + title: MsgUpdateParams defines the payload for Msg/UpdateParams + ibc.applications.interchain_accounts.host.v1.MsgUpdateParamsResponse: + type: object + title: MsgUpdateParamsResponse defines the response for Msg/UpdateParams + ibc.applications.interchain_accounts.host.v1.Params: type: object properties: - acknowledgements: + host_enabled: + type: boolean + description: host_enabled enables or disables the host submodule. + allow_messages: type: array items: - type: object - properties: - port_id: - type: string - description: channel port identifier. - channel_id: - type: string - description: channel unique identifier. - sequence: - type: string - format: uint64 - description: packet sequence. - data: - type: string - format: byte - description: embedded data that represents packet state. - description: >- - PacketState defines the generic type necessary to retrieve and store - - packet commitments, acknowledgements, and receipts. - - Caller is responsible for knowing the context necessary to interpret - this - - state as a commitment, acknowledgement, or a receipt. - pagination: - title: pagination response + type: string + description: >- + allow_messages defines a list of sdk message typeURLs allowed to be + executed on a host chain. + description: |- + Params defines the set of on-chain interchain accounts parameters. + The following parameters may be used to disable the host submodule. + ibc.applications.transfer.v1.MsgTransfer: + type: object + properties: + source_port: + type: string + title: the port on which the packet will be sent + source_channel: + type: string + title: the channel by which the packet will be sent + token: + title: the tokens to be transferred type: object properties: - next_key: + denom: type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: + amount: type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. + Coin defines a token with a denomination and an amount. - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - height: - title: query block height + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + sender: + type: string + title: the sender address + receiver: + type: string + title: the recipient address on the destination chain + timeout_height: + description: |- + Timeout height relative to the current block height. + The timeout is disabled when set to 0. type: object properties: revision_number: @@ -74346,256 +23172,271 @@ definitions: type: string format: uint64 title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to + title: >- + Height is a monotonically increasing data type - reset the height in certain conditions e.g. hard forks, state-machine + that can be compared against another Height for the purposes of + updating and - breaking changes In these cases, the RevisionNumber is incremented so - that + freezing clients + timeout_timestamp: + type: string + format: uint64 + description: |- + Timeout timestamp in absolute nanoseconds since unix epoch. + The timeout is disabled when set to 0. + memo: + type: string + title: optional memo + title: >- + MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between - height continues to be monitonically increasing even as the - RevisionHeight + ICS20 enabled chains. See ICS Spec here: - gets reset - title: |- - QueryPacketAcknowledgemetsResponse is the request type for the - Query/QueryPacketAcknowledgements RPC method - ibc.core.channel.v1.QueryPacketCommitmentResponse: + https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures + ibc.applications.transfer.v1.MsgTransferResponse: type: object properties: - commitment: + sequence: type: string - format: byte - title: packet associated with the request fields - proof: + format: uint64 + title: sequence number of the transfer packet sent + description: MsgTransferResponse defines the Msg/Transfer response type. + ibc.applications.transfer.v1.MsgUpdateParams: + type: object + properties: + signer: type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved + title: signer address + params: + description: |- + params defines the transfer parameters to update. + + NOTE: All parameters must be supplied. type: object properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping + send_enabled: + type: boolean + description: >- + send_enabled enables or disables all cross-chain token transfers + from this - RevisionNumber the same. However some consensus algorithms may choose - to + chain. + receive_enabled: + type: boolean + description: >- + receive_enabled enables or disables all cross-chain token + transfers to this - reset the height in certain conditions e.g. hard forks, state-machine + chain. + description: MsgUpdateParams is the Msg/UpdateParams request type. + ibc.applications.transfer.v1.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. + ibc.applications.transfer.v1.Params: + type: object + properties: + send_enabled: + type: boolean + description: >- + send_enabled enables or disables all cross-chain token transfers from + this - breaking changes In these cases, the RevisionNumber is incremented so - that + chain. + receive_enabled: + type: boolean + description: >- + receive_enabled enables or disables all cross-chain token transfers to + this - height continues to be monitonically increasing even as the - RevisionHeight + chain. + description: >- + Params defines the set of IBC transfer parameters. - gets reset - title: >- - QueryPacketCommitmentResponse defines the client query response for a - packet + NOTE: To prevent a single token from being transferred, set the - which also includes a proof and the height from which the proof was + TransfersEnabled parameter to true and then set the bank module's + SendEnabled - retrieved - ibc.core.channel.v1.QueryPacketCommitmentsResponse: + parameter for the denomination to false. + ibc.core.client.v1.Height: type: object properties: - commitments: - type: array - items: - type: object - properties: - port_id: - type: string - description: channel port identifier. - channel_id: - type: string - description: channel unique identifier. - sequence: - type: string - format: uint64 - description: packet sequence. - data: - type: string - format: byte - description: embedded data that represents packet state. - description: >- - PacketState defines the generic type necessary to retrieve and store - - packet commitments, acknowledgements, and receipts. + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: |- + Normally the RevisionHeight is incremented at each height while keeping + RevisionNumber the same. However some consensus algorithms may choose to + reset the height in certain conditions e.g. hard forks, state-machine + breaking changes In these cases, the RevisionNumber is incremented so that + height continues to be monitonically increasing even as the RevisionHeight + gets reset + title: >- + Height is a monotonically increasing data type - Caller is responsible for knowing the context necessary to interpret - this + that can be compared against another Height for the purposes of updating + and - state as a commitment, acknowledgement, or a receipt. - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + freezing clients + ibc.core.channel.v1.Channel: + type: object + properties: + state: + title: current state of the channel end + type: string + enum: + - STATE_UNINITIALIZED_UNSPECIFIED + - STATE_INIT + - STATE_TRYOPEN + - STATE_OPEN + - STATE_CLOSED + default: STATE_UNINITIALIZED_UNSPECIFIED + description: |- + State defines if a channel is in one of the following states: + CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. - was set, its value is undefined otherwise + - STATE_UNINITIALIZED_UNSPECIFIED: Default State + - STATE_INIT: A channel has just started the opening handshake. + - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. + - STATE_OPEN: A channel has completed the handshake. Open channels are + ready to send and receive packets. + - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive + packets. + ordering: + title: whether the channel is ordered or unordered + type: string + enum: + - ORDER_NONE_UNSPECIFIED + - ORDER_UNORDERED + - ORDER_ORDERED + default: ORDER_NONE_UNSPECIFIED description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - height: - title: query block height + - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering + - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in + which they were sent. + - ORDER_ORDERED: packets are delivered exactly in the order which they were sent + counterparty: + title: counterparty channel end type: object properties: - revision_number: + port_id: type: string - format: uint64 - title: the revision that the client is currently on - revision_height: + description: >- + port on the counterparty chain which owns the other end of the + channel. + channel_id: type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryPacketCommitmentsResponse is the request type for the - Query/QueryPacketCommitments RPC method - ibc.core.channel.v1.QueryPacketReceiptResponse: + title: channel end on the counterparty chain + connection_hops: + type: array + items: + type: string + title: |- + list of connection identifiers, in order, along which packets sent on + this channel will travel + version: + type: string + title: opaque channel version, which is agreed upon during the handshake + description: |- + Channel defines pipeline for exactly-once packet delivery between specific + modules on separate blockchains, which has at least one end capable of + sending packets and one end capable of receiving packets. + ibc.core.channel.v1.Counterparty: type: object properties: - received: - type: boolean - title: success flag for if receipt exists - proof: + port_id: type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: >- - QueryPacketReceiptResponse defines the client query response for a packet - - receipt which also includes a proof, and the height from which the proof - was - - retrieved - ibc.core.channel.v1.QueryUnreceivedAcksResponse: + port on the counterparty chain which owns the other end of the + channel. + channel_id: + type: string + title: channel end on the counterparty chain + title: Counterparty defines a channel end counterparty + ibc.core.channel.v1.MsgAcknowledgement: type: object properties: - sequences: - type: array - items: - type: string - format: uint64 - title: list of unreceived acknowledgement sequences - height: - title: query block height + packet: type: object properties: - revision_number: + sequence: type: string format: uint64 - title: the revision that the client is currently on - revision_height: + description: >- + number corresponds to the order of sends and receives, where a + Packet + + with an earlier sequence number must be sent and received before a + Packet + + with a later sequence number. + source_port: type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping + description: identifies the port on the sending chain. + source_channel: + type: string + description: identifies the channel end on the sending chain. + destination_port: + type: string + description: identifies the port on the receiving chain. + destination_channel: + type: string + description: identifies the channel end on the receiving chain. + data: + type: string + format: byte + title: actual opaque bytes transferred directly to the application module + timeout_height: + title: block height after which the packet times out + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping - RevisionNumber the same. However some consensus algorithms may choose - to + RevisionNumber the same. However some consensus algorithms may + choose to - reset the height in certain conditions e.g. hard forks, state-machine + reset the height in certain conditions e.g. hard forks, + state-machine - breaking changes In these cases, the RevisionNumber is incremented so - that + breaking changes In these cases, the RevisionNumber is incremented + so that - height continues to be monitonically increasing even as the - RevisionHeight + height continues to be monitonically increasing even as the + RevisionHeight - gets reset - title: |- - QueryUnreceivedAcksResponse is the response type for the - Query/UnreceivedAcks RPC method - ibc.core.channel.v1.QueryUnreceivedPacketsResponse: - type: object - properties: - sequences: - type: array - items: - type: string - format: uint64 - title: list of unreceived packet sequences - height: - title: query block height + gets reset + timeout_timestamp: + type: string + format: uint64 + title: block timestamp (in nanoseconds) after which the packet times out + title: >- + Packet defines a type that carries data across different chains + through IBC + acknowledgement: + type: string + format: byte + proof_acked: + type: string + format: byte + proof_height: type: object properties: revision_number: @@ -74622,215 +23463,45 @@ definitions: RevisionHeight gets reset - title: |- - QueryUnreceivedPacketsResponse is the response type for the - Query/UnreceivedPacketCommitments RPC method - ibc.core.channel.v1.ResponseResultType: - type: string - enum: - - RESPONSE_RESULT_TYPE_UNSPECIFIED - - RESPONSE_RESULT_TYPE_NOOP - - RESPONSE_RESULT_TYPE_SUCCESS - default: RESPONSE_RESULT_TYPE_UNSPECIFIED - description: |- - - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value enumeration - - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) - - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully - title: >- - ResponseResultType defines the possible outcomes of the execution of a - message - ibc.core.channel.v1.State: - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - - STATE_CLOSED - default: STATE_UNINITIALIZED_UNSPECIFIED - description: |- - State defines if a channel is in one of the following states: - CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. + title: >- + Height is a monotonically increasing data type - - STATE_UNINITIALIZED_UNSPECIFIED: Default State - - STATE_INIT: A channel has just started the opening handshake. - - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. - - STATE_OPEN: A channel has completed the handshake. Open channels are - ready to send and receive packets. - - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive - packets. - ibc.core.client.v1.IdentifiedClientState: + that can be compared against another Height for the purposes of + updating and + + freezing clients + signer: + type: string + title: MsgAcknowledgement receives incoming IBC acknowledgement + ibc.core.channel.v1.MsgAcknowledgementResponse: type: object properties: - client_id: + result: type: string - title: client identifier - client_state: - title: client state - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: |- - IdentifiedClientState defines a client state with an additional client - identifier field. - ibc.core.client.v1.ConsensusStateWithHeight: + enum: + - RESPONSE_RESULT_TYPE_UNSPECIFIED + - RESPONSE_RESULT_TYPE_NOOP + - RESPONSE_RESULT_TYPE_SUCCESS + default: RESPONSE_RESULT_TYPE_UNSPECIFIED + description: |- + - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value enumeration + - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) + - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully + title: >- + ResponseResultType defines the possible outcomes of the execution of a + message + description: MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. + ibc.core.channel.v1.MsgChannelCloseConfirm: type: object properties: - height: - title: consensus state height + port_id: + type: string + channel_id: + type: string + proof_init: + type: string + format: byte + proof_height: type: object properties: revision_number: @@ -74850,398 +23521,584 @@ definitions: reset the height in certain conditions e.g. hard forks, state-machine - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - consensus_state: - title: consensus state - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON + breaking changes In these cases, the RevisionNumber is incremented so + that - representation, that representation will be embedded adding a field + height continues to be monitonically increasing even as the + RevisionHeight - `value` which holds the custom JSON in addition to the `@type` + gets reset + title: >- + Height is a monotonically increasing data type - field. Example (for message [google.protobuf.Duration][]): + that can be compared against another Height for the purposes of + updating and - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } + freezing clients + signer: + type: string + description: |- + MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B + to acknowledge the change of channel state to CLOSED on Chain A. + ibc.core.channel.v1.MsgChannelCloseConfirmResponse: + type: object description: >- - ConsensusStateWithHeight defines a consensus state with an additional - height + MsgChannelCloseConfirmResponse defines the Msg/ChannelCloseConfirm + response - field. - ibc.core.client.v1.MsgCreateClientResponse: - type: object - description: MsgCreateClientResponse defines the Msg/CreateClient response type. - ibc.core.client.v1.MsgSubmitMisbehaviourResponse: - type: object - description: |- - MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response type. - ibc.core.client.v1.MsgUpdateClientResponse: + ibc.core.channel.v1.MsgChannelCloseInit: type: object - description: MsgUpdateClientResponse defines the Msg/UpdateClient response type. - ibc.core.client.v1.MsgUpgradeClientResponse: + properties: + port_id: + type: string + channel_id: + type: string + signer: + type: string + description: |- + MsgChannelCloseInit defines a msg sent by a Relayer to Chain A + to close a channel with Chain B. + ibc.core.channel.v1.MsgChannelCloseInitResponse: type: object - description: MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. - ibc.core.client.v1.Params: + description: >- + MsgChannelCloseInitResponse defines the Msg/ChannelCloseInit response + type. + ibc.core.channel.v1.MsgChannelOpenAck: type: object properties: - allowed_clients: - type: array - items: - type: string + port_id: + type: string + channel_id: + type: string + counterparty_channel_id: + type: string + counterparty_version: + type: string + proof_try: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision description: >- - allowed_clients defines the list of allowed client state types which - can be created + Normally the RevisionHeight is incremented at each height while + keeping - and interacted with. If a client type is removed from the allowed - clients list, usage + RevisionNumber the same. However some consensus algorithms may choose + to - of this client will be disabled until it is added again to the list. - description: Params defines the set of IBC light client parameters. - ibc.core.client.v1.QueryClientParamsResponse: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - allowed_clients: - type: array - items: - type: string - description: >- - allowed_clients defines the list of allowed client state types - which can be created + reset the height in certain conditions e.g. hard forks, state-machine - and interacted with. If a client type is removed from the allowed - clients list, usage + breaking changes In these cases, the RevisionNumber is incremented so + that - of this client will be disabled until it is added again to the - list. + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes of + updating and + + freezing clients + signer: + type: string description: >- - QueryClientParamsResponse is the response type for the Query/ClientParams - RPC + MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to + acknowledge - method. - ibc.core.client.v1.QueryClientStateResponse: + the change of channel state to TRYOPEN on Chain B. + ibc.core.channel.v1.MsgChannelOpenAckResponse: + type: object + description: MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response type. + ibc.core.channel.v1.MsgChannelOpenConfirm: type: object properties: - client_state: - title: client state associated with the request identifier + port_id: + type: string + channel_id: + type: string + proof_ack: + type: string + format: byte + proof_height: type: object properties: - '@type': + revision_number: type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + RevisionNumber the same. However some consensus algorithms may choose + to - In practice, teams usually precompile into the binary all types - that they + reset the height in certain conditions e.g. hard forks, state-machine - expect it to use in the context of Any. However, for URLs which - use the + breaking changes In these cases, the RevisionNumber is incremented so + that - scheme `http`, `https`, or no scheme, one can optionally set up a - type + height continues to be monitonically increasing even as the + RevisionHeight - server that maps type URLs to message definitions as follows: + gets reset + title: >- + Height is a monotonically increasing data type + that can be compared against another Height for the purposes of + updating and - * If no scheme is provided, `https` is assumed. + freezing clients + signer: + type: string + description: |- + MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to + acknowledge the change of channel state to OPEN on Chain A. + ibc.core.channel.v1.MsgChannelOpenConfirmResponse: + type: object + description: |- + MsgChannelOpenConfirmResponse defines the Msg/ChannelOpenConfirm response + type. + ibc.core.channel.v1.MsgChannelOpenInit: + type: object + properties: + port_id: + type: string + channel: + type: object + properties: + state: + title: current state of the channel end + type: string + enum: + - STATE_UNINITIALIZED_UNSPECIFIED + - STATE_INIT + - STATE_TRYOPEN + - STATE_OPEN + - STATE_CLOSED + default: STATE_UNINITIALIZED_UNSPECIFIED + description: |- + State defines if a channel is in one of the following states: + CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + - STATE_UNINITIALIZED_UNSPECIFIED: Default State + - STATE_INIT: A channel has just started the opening handshake. + - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. + - STATE_OPEN: A channel has completed the handshake. Open channels are + ready to send and receive packets. + - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive + packets. + ordering: + title: whether the channel is ordered or unordered + type: string + enum: + - ORDER_NONE_UNSPECIFIED + - ORDER_UNORDERED + - ORDER_ORDERED + default: ORDER_NONE_UNSPECIFIED + description: |- + - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering + - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in + which they were sent. + - ORDER_ORDERED: packets are delivered exactly in the order which they were sent + counterparty: + title: counterparty channel end + type: object + properties: + port_id: + type: string + description: >- + port on the counterparty chain which owns the other end of the + channel. + channel_id: + type: string + title: channel end on the counterparty chain + connection_hops: + type: array + items: + type: string + title: >- + list of connection identifiers, in order, along which packets sent + on - Note: this functionality is not currently available in the - official + this channel will travel + version: + type: string + title: opaque channel version, which is agreed upon during the handshake + description: >- + Channel defines pipeline for exactly-once packet delivery between + specific - protobuf release, and it is not used for type URLs beginning with + modules on separate blockchains, which has at least one end capable of - type.googleapis.com. + sending packets and one end capable of receiving packets. + signer: + type: string + description: >- + MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. + It + is called by a relayer on Chain A. + ibc.core.channel.v1.MsgChannelOpenInitResponse: + type: object + properties: + channel_id: + type: string + version: + type: string + description: MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. + ibc.core.channel.v1.MsgChannelOpenTry: + type: object + properties: + port_id: + type: string + previous_channel_id: + type: string + description: >- + Deprecated: this field is unused. Crossing hello's are no longer + supported in core IBC. + channel: + type: object + properties: + state: + title: current state of the channel end + type: string + enum: + - STATE_UNINITIALIZED_UNSPECIFIED + - STATE_INIT + - STATE_TRYOPEN + - STATE_OPEN + - STATE_CLOSED + default: STATE_UNINITIALIZED_UNSPECIFIED + description: |- + State defines if a channel is in one of the following states: + CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. - Schemes other than `http`, `https` (or the empty scheme) might be + - STATE_UNINITIALIZED_UNSPECIFIED: Default State + - STATE_INIT: A channel has just started the opening handshake. + - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. + - STATE_OPEN: A channel has completed the handshake. Open channels are + ready to send and receive packets. + - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive + packets. + ordering: + title: whether the channel is ordered or unordered + type: string + enum: + - ORDER_NONE_UNSPECIFIED + - ORDER_UNORDERED + - ORDER_ORDERED + default: ORDER_NONE_UNSPECIFIED + description: |- + - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering + - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in + which they were sent. + - ORDER_ORDERED: packets are delivered exactly in the order which they were sent + counterparty: + title: counterparty channel end + type: object + properties: + port_id: + type: string + description: >- + port on the counterparty chain which owns the other end of the + channel. + channel_id: + type: string + title: channel end on the counterparty chain + connection_hops: + type: array + items: + type: string + title: >- + list of connection identifiers, in order, along which packets sent + on - used with implementation specific semantics. - additionalProperties: {} + this channel will travel + version: + type: string + title: opaque channel version, which is agreed upon during the handshake description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a + Channel defines pipeline for exactly-once packet delivery between + specific - URL that describes the type of the serialized message. + modules on separate blockchains, which has at least one end capable of + sending packets and one end capable of receiving packets. + counterparty_version: + type: string + proof_init: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping - Protobuf library provides support to pack/unpack Any values in the - form + RevisionNumber the same. However some consensus algorithms may choose + to - of utility functions or additional generated methods of the Any type. + reset the height in certain conditions e.g. hard forks, state-machine + breaking changes In these cases, the RevisionNumber is incremented so + that - Example 1: Pack and unpack a message in C++. + height continues to be monitonically increasing even as the + RevisionHeight - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } + gets reset + title: >- + Height is a monotonically increasing data type - Example 2: Pack and unpack a message in Java. + that can be compared against another Height for the purposes of + updating and - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } + freezing clients + signer: + type: string + description: >- + MsgChannelOpenInit defines a msg sent by a Relayer to try to open a + channel - Example 3: Pack and unpack a message in Python. + on Chain B. The version field within the Channel field has been + deprecated. Its - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... + value will be ignored by core IBC. + ibc.core.channel.v1.MsgChannelOpenTryResponse: + type: object + properties: + version: + type: string + channel_id: + type: string + description: MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. + ibc.core.channel.v1.MsgRecvPacket: + type: object + properties: + packet: + type: object + properties: + sequence: + type: string + format: uint64 + description: >- + number corresponds to the order of sends and receives, where a + Packet - Example 4: Pack and unpack a message in Go + with an earlier sequence number must be sent and received before a + Packet - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } + with a later sequence number. + source_port: + type: string + description: identifies the port on the sending chain. + source_channel: + type: string + description: identifies the channel end on the sending chain. + destination_port: + type: string + description: identifies the port on the receiving chain. + destination_channel: + type: string + description: identifies the channel end on the receiving chain. + data: + type: string + format: byte + title: actual opaque bytes transferred directly to the application module + timeout_height: + title: block height after which the packet times out + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping - The pack methods provided by protobuf library will by default use + RevisionNumber the same. However some consensus algorithms may + choose to - 'type.googleapis.com/full.type.name' as the type URL and the unpack + reset the height in certain conditions e.g. hard forks, + state-machine - methods only use the fully qualified type name after the last '/' + breaking changes In these cases, the RevisionNumber is incremented + so that - in the type URL, for example "foo.bar.com/x/y.z" will yield type + height continues to be monitonically increasing even as the + RevisionHeight - name "y.z". + gets reset + timeout_timestamp: + type: string + format: uint64 + title: block timestamp (in nanoseconds) after which the packet times out + title: >- + Packet defines a type that carries data across different chains + through IBC + proof_commitment: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + RevisionNumber the same. However some consensus algorithms may choose + to + reset the height in certain conditions e.g. hard forks, state-machine - JSON + breaking changes In these cases, the RevisionNumber is incremented so + that - ==== + height continues to be monitonically increasing even as the + RevisionHeight - The JSON representation of an `Any` value uses the regular + gets reset + title: >- + Height is a monotonically increasing data type - representation of the deserialized, embedded message, with an + that can be compared against another Height for the purposes of + updating and - additional field `@type` which contains the type URL. Example: + freezing clients + signer: + type: string + title: MsgRecvPacket receives incoming IBC packet + ibc.core.channel.v1.MsgRecvPacketResponse: + type: object + properties: + result: + type: string + enum: + - RESPONSE_RESULT_TYPE_UNSPECIFIED + - RESPONSE_RESULT_TYPE_NOOP + - RESPONSE_RESULT_TYPE_SUCCESS + default: RESPONSE_RESULT_TYPE_UNSPECIFIED + description: |- + - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value enumeration + - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) + - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully + title: >- + ResponseResultType defines the possible outcomes of the execution of a + message + description: MsgRecvPacketResponse defines the Msg/RecvPacket response type. + ibc.core.channel.v1.MsgTimeout: + type: object + properties: + packet: + type: object + properties: + sequence: + type: string + format: uint64 + description: >- + number corresponds to the order of sends and receives, where a + Packet - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } + with an earlier sequence number must be sent and received before a + Packet - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + with a later sequence number. + source_port: + type: string + description: identifies the port on the sending chain. + source_channel: + type: string + description: identifies the channel end on the sending chain. + destination_port: + type: string + description: identifies the port on the receiving chain. + destination_channel: + type: string + description: identifies the channel end on the receiving chain. + data: + type: string + format: byte + title: actual opaque bytes transferred directly to the application module + timeout_height: + title: block height after which the packet times out + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping - If the embedded message type is well-known and has a custom JSON + RevisionNumber the same. However some consensus algorithms may + choose to - representation, that representation will be embedded adding a field + reset the height in certain conditions e.g. hard forks, + state-machine - `value` which holds the custom JSON in addition to the `@type` + breaking changes In these cases, the RevisionNumber is incremented + so that - field. Example (for message [google.protobuf.Duration][]): + height continues to be monitonically increasing even as the + RevisionHeight - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - proof: + gets reset + timeout_timestamp: + type: string + format: uint64 + title: block timestamp (in nanoseconds) after which the packet times out + title: >- + Packet defines a type that carries data across different chains + through IBC + proof_unreceived: type: string format: byte - title: merkle proof of existence proof_height: - title: height at which the proof was retrieved type: object properties: revision_number: @@ -75268,318 +24125,394 @@ definitions: RevisionHeight gets reset - description: >- - QueryClientStateResponse is the response type for the Query/ClientState - RPC + title: >- + Height is a monotonically increasing data type - method. Besides the client state, it includes a proof and the height from + that can be compared against another Height for the purposes of + updating and - which the proof was retrieved. - ibc.core.client.v1.QueryClientStatesResponse: + freezing clients + next_sequence_recv: + type: string + format: uint64 + signer: + type: string + title: MsgTimeout receives timed-out packet + ibc.core.channel.v1.MsgTimeoutOnClose: type: object properties: - client_states: - type: array - items: - type: object - properties: - client_id: - type: string - title: client identifier - client_state: - title: client state - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form + packet: + type: object + properties: + sequence: + type: string + format: uint64 + description: >- + number corresponds to the order of sends and receives, where a + Packet - (e.g., leading "." is not accepted). + with an earlier sequence number must be sent and received before a + Packet + with a later sequence number. + source_port: + type: string + description: identifies the port on the sending chain. + source_channel: + type: string + description: identifies the channel end on the sending chain. + destination_port: + type: string + description: identifies the port on the receiving chain. + destination_channel: + type: string + description: identifies the channel end on the receiving chain. + data: + type: string + format: byte + title: actual opaque bytes transferred directly to the application module + timeout_height: + title: block height after which the packet times out + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping - In practice, teams usually precompile into the binary all - types that they + RevisionNumber the same. However some consensus algorithms may + choose to - expect it to use in the context of Any. However, for URLs - which use the + reset the height in certain conditions e.g. hard forks, + state-machine - scheme `http`, `https`, or no scheme, one can optionally set - up a type + breaking changes In these cases, the RevisionNumber is incremented + so that - server that maps type URLs to message definitions as - follows: + height continues to be monitonically increasing even as the + RevisionHeight + gets reset + timeout_timestamp: + type: string + format: uint64 + title: block timestamp (in nanoseconds) after which the packet times out + title: >- + Packet defines a type that carries data across different chains + through IBC + proof_unreceived: + type: string + format: byte + proof_close: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping - * If no scheme is provided, `https` is assumed. + RevisionNumber the same. However some consensus algorithms may choose + to - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + reset the height in certain conditions e.g. hard forks, state-machine - Note: this functionality is not currently available in the - official + breaking changes In these cases, the RevisionNumber is incremented so + that - protobuf release, and it is not used for type URLs beginning - with + height continues to be monitonically increasing even as the + RevisionHeight - type.googleapis.com. + gets reset + title: >- + Height is a monotonically increasing data type + that can be compared against another Height for the purposes of + updating and - Schemes other than `http`, `https` (or the empty scheme) - might be + freezing clients + next_sequence_recv: + type: string + format: uint64 + signer: + type: string + description: MsgTimeoutOnClose timed-out packet upon counterparty channel closure. + ibc.core.channel.v1.MsgTimeoutOnCloseResponse: + type: object + properties: + result: + type: string + enum: + - RESPONSE_RESULT_TYPE_UNSPECIFIED + - RESPONSE_RESULT_TYPE_NOOP + - RESPONSE_RESULT_TYPE_SUCCESS + default: RESPONSE_RESULT_TYPE_UNSPECIFIED + description: |- + - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value enumeration + - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) + - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully + title: >- + ResponseResultType defines the possible outcomes of the execution of a + message + description: MsgTimeoutOnCloseResponse defines the Msg/TimeoutOnClose response type. + ibc.core.channel.v1.MsgTimeoutResponse: + type: object + properties: + result: + type: string + enum: + - RESPONSE_RESULT_TYPE_UNSPECIFIED + - RESPONSE_RESULT_TYPE_NOOP + - RESPONSE_RESULT_TYPE_SUCCESS + default: RESPONSE_RESULT_TYPE_UNSPECIFIED + description: |- + - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value enumeration + - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) + - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully + title: >- + ResponseResultType defines the possible outcomes of the execution of a + message + description: MsgTimeoutResponse defines the Msg/Timeout response type. + ibc.core.channel.v1.Order: + type: string + enum: + - ORDER_NONE_UNSPECIFIED + - ORDER_UNORDERED + - ORDER_ORDERED + default: ORDER_NONE_UNSPECIFIED + description: |- + - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering + - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in + which they were sent. + - ORDER_ORDERED: packets are delivered exactly in the order which they were sent + title: Order defines if a channel is ORDERED or UNORDERED + ibc.core.channel.v1.Packet: + type: object + properties: + sequence: + type: string + format: uint64 + description: >- + number corresponds to the order of sends and receives, where a Packet - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a + with an earlier sequence number must be sent and received before a + Packet - URL that describes the type of the serialized message. + with a later sequence number. + source_port: + type: string + description: identifies the port on the sending chain. + source_channel: + type: string + description: identifies the channel end on the sending chain. + destination_port: + type: string + description: identifies the port on the receiving chain. + destination_channel: + type: string + description: identifies the channel end on the receiving chain. + data: + type: string + format: byte + title: actual opaque bytes transferred directly to the application module + timeout_height: + title: block height after which the packet times out + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + RevisionNumber the same. However some consensus algorithms may choose + to - Protobuf library provides support to pack/unpack Any values in - the form + reset the height in certain conditions e.g. hard forks, state-machine - of utility functions or additional generated methods of the Any - type. + breaking changes In these cases, the RevisionNumber is incremented so + that + height continues to be monitonically increasing even as the + RevisionHeight - Example 1: Pack and unpack a message in C++. + gets reset + timeout_timestamp: + type: string + format: uint64 + title: block timestamp (in nanoseconds) after which the packet times out + title: >- + Packet defines a type that carries data across different chains through + IBC + ibc.core.channel.v1.ResponseResultType: + type: string + enum: + - RESPONSE_RESULT_TYPE_UNSPECIFIED + - RESPONSE_RESULT_TYPE_NOOP + - RESPONSE_RESULT_TYPE_SUCCESS + default: RESPONSE_RESULT_TYPE_UNSPECIFIED + description: |- + - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value enumeration + - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) + - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully + title: >- + ResponseResultType defines the possible outcomes of the execution of a + message + ibc.core.channel.v1.State: + type: string + enum: + - STATE_UNINITIALIZED_UNSPECIFIED + - STATE_INIT + - STATE_TRYOPEN + - STATE_OPEN + - STATE_CLOSED + default: STATE_UNINITIALIZED_UNSPECIFIED + description: |- + State defines if a channel is in one of the following states: + CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } + - STATE_UNINITIALIZED_UNSPECIFIED: Default State + - STATE_INIT: A channel has just started the opening handshake. + - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. + - STATE_OPEN: A channel has completed the handshake. Open channels are + ready to send and receive packets. + - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive + packets. + cosmos.upgrade.v1beta1.Plan: + type: object + properties: + name: + type: string + description: >- + Sets the name for the upgrade. This name will be used by the upgraded - Example 2: Pack and unpack a message in Java. + version of the software to apply any special "on-upgrade" commands + during - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } + the first BeginBlock method after the upgrade is applied. It is also + used - Example 3: Pack and unpack a message in Python. + to detect whether a software version can handle a given upgrade. If no - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... + upgrade handler with this name has been set in the software, it will + be - Example 4: Pack and unpack a message in Go + assumed that the software is out-of-date when the upgrade Time or + Height is - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } + reached and the software will exit. + time: + type: string + format: date-time + description: >- + Deprecated: Time based upgrades have been deprecated. Time based + upgrade logic - The pack methods provided by protobuf library will by default - use + has been removed from the SDK. - 'type.googleapis.com/full.type.name' as the type URL and the - unpack + If this field is not empty, an error will be thrown. + height: + type: string + format: int64 + description: The height at which the upgrade must be performed. + info: + type: string + title: |- + Any application specific upgrade info to be included on-chain + such as a git commit that validators could automatically upgrade to + upgraded_client_state: + description: >- + Deprecated: UpgradedClientState field has been deprecated. IBC upgrade + logic has been - methods only use the fully qualified type name after the last - '/' + moved to the IBC module in the sub module 02-client. - in the type URL, for example "foo.bar.com/x/y.z" will yield type + If this field is not empty, an error will be thrown. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized - name "y.z". + protocol buffer message. This string must contain at least + one "/" character. The last segment of the URL's path must + represent + the fully qualified name of the type (as in - JSON + `path/google.protobuf.Duration`). The name should be in a + canonical form - ==== + (e.g., leading "." is not accepted). - The JSON representation of an `Any` value uses the regular - representation of the deserialized, embedded message, with an + In practice, teams usually precompile into the binary all types + that they - additional field `@type` which contains the type URL. Example: + expect it to use in the context of Any. However, for URLs which + use the - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } + scheme `http`, `https`, or no scheme, one can optionally set up a + type - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + server that maps type URLs to message definitions as follows: - If the embedded message type is well-known and has a custom JSON - representation, that representation will be embedded adding a - field + * If no scheme is provided, `https` is assumed. - `value` which holds the custom JSON in addition to the `@type` + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - field. Example (for message [google.protobuf.Duration][]): + Note: this functionality is not currently available in the + official - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - IdentifiedClientState defines a client state with an additional - client + protobuf release, and it is not used for type URLs beginning with - identifier field. - description: list of stored ClientStates of the chain. - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + type.googleapis.com. - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - description: >- - QueryClientStatesResponse is the response type for the Query/ClientStates - RPC + Schemes other than `http`, `https` (or the empty scheme) might be - method. - ibc.core.client.v1.QueryClientStatusResponse: - type: object - properties: - status: - type: string + used with implementation specific semantics. + additionalProperties: {} description: >- - QueryClientStatusResponse is the response type for the Query/ClientStatus - RPC - - method. It returns the current status of the IBC client. - ibc.core.client.v1.QueryConsensusStateHeightsResponse: - type: object - properties: - consensus_state_heights: - type: array - items: - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is incremented - so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: >- - Height is a monotonically increasing data type - - that can be compared against another Height for the purposes of - updating and - - freezing clients - title: consensus state heights - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - title: |- - QueryConsensusStateHeightsResponse is the response type for the - Query/ConsensusStateHeights RPC method - ibc.core.client.v1.QueryConsensusStateResponse: + Plan specifies information about a planned upgrade and when it should + occur. + ibc.core.client.v1.MsgCreateClient: type: object properties: - consensus_state: - title: >- - consensus state associated with the client identifier at the given - height + client_state: + title: light client state type: object properties: '@type': @@ -75666,8 +24599,12 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -75677,7 +24614,7 @@ definitions: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -75701,10 +24638,8 @@ definitions: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -75736,289 +24671,312 @@ definitions: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved + consensus_state: + description: |- + consensus state associated with the client that corresponds to a given + height. type: object properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: + '@type': type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping + description: >- + A URL/resource name that uniquely identifies the type of the + serialized - RevisionNumber the same. However some consensus algorithms may choose - to + protocol buffer message. This string must contain at least - reset the height in certain conditions e.g. hard forks, state-machine + one "/" character. The last segment of the URL's path must + represent - breaking changes In these cases, the RevisionNumber is incremented so - that + the fully qualified name of the type (as in - height continues to be monitonically increasing even as the - RevisionHeight + `path/google.protobuf.Duration`). The name should be in a + canonical form - gets reset - title: >- - QueryConsensusStateResponse is the response type for the - Query/ConsensusState + (e.g., leading "." is not accepted). - RPC method - ibc.core.client.v1.QueryConsensusStatesResponse: - type: object - properties: - consensus_states: - type: array - items: - type: object - properties: - height: - title: consensus state height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - RevisionNumber the same. However some consensus algorithms may - choose to + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the - reset the height in certain conditions e.g. hard forks, - state-machine + scheme `http`, `https`, or no scheme, one can optionally set up a + type - breaking changes In these cases, the RevisionNumber is - incremented so that + server that maps type URLs to message definitions as follows: - height continues to be monitonically increasing even as the - RevisionHeight - gets reset - consensus_state: - title: consensus state - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + signer: + type: string + title: signer address + title: MsgCreateClient defines a message to create an IBC client + ibc.core.client.v1.MsgCreateClientResponse: + type: object + description: MsgCreateClientResponse defines the Msg/CreateClient response type. + ibc.core.client.v1.MsgIBCSoftwareUpgrade: + type: object + properties: + plan: + type: object + properties: + name: + type: string + description: >- + Sets the name for the upgrade. This name will be used by the + upgraded + + version of the software to apply any special "on-upgrade" commands + during + + the first BeginBlock method after the upgrade is applied. It is + also used + + to detect whether a software version can handle a given upgrade. + If no - protocol buffer message. This string must contain at least + upgrade handler with this name has been set in the software, it + will be - one "/" character. The last segment of the URL's path must - represent + assumed that the software is out-of-date when the upgrade Time or + Height is - the fully qualified name of the type (as in + reached and the software will exit. + time: + type: string + format: date-time + description: >- + Deprecated: Time based upgrades have been deprecated. Time based + upgrade logic - `path/google.protobuf.Duration`). The name should be in a - canonical form + has been removed from the SDK. - (e.g., leading "." is not accepted). + If this field is not empty, an error will be thrown. + height: + type: string + format: int64 + description: The height at which the upgrade must be performed. + info: + type: string + title: >- + Any application specific upgrade info to be included on-chain + such as a git commit that validators could automatically upgrade + to + upgraded_client_state: + description: >- + Deprecated: UpgradedClientState field has been deprecated. IBC + upgrade logic has been - In practice, teams usually precompile into the binary all - types that they + moved to the IBC module in the sub module 02-client. - expect it to use in the context of Any. However, for URLs - which use the + If this field is not empty, an error will be thrown. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized - scheme `http`, `https`, or no scheme, one can optionally set - up a type + protocol buffer message. This string must contain at least - server that maps type URLs to message definitions as - follows: + one "/" character. The last segment of the URL's path must + represent + the fully qualified name of the type (as in - * If no scheme is provided, `https` is assumed. + `path/google.protobuf.Duration`). The name should be in a + canonical form - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + (e.g., leading "." is not accepted). - Note: this functionality is not currently available in the - official - protobuf release, and it is not used for type URLs beginning - with + In practice, teams usually precompile into the binary all + types that they - type.googleapis.com. + expect it to use in the context of Any. However, for URLs + which use the + scheme `http`, `https`, or no scheme, one can optionally set + up a type - Schemes other than `http`, `https` (or the empty scheme) - might be + server that maps type URLs to message definitions as follows: - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - URL that describes the type of the serialized message. + * If no scheme is provided, `https` is assumed. + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on + the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - Protobuf library provides support to pack/unpack Any values in - the form + Note: this functionality is not currently available in the + official - of utility functions or additional generated methods of the Any - type. + protobuf release, and it is not used for type URLs beginning + with + type.googleapis.com. - Example 1: Pack and unpack a message in C++. - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } + Schemes other than `http`, `https` (or the empty scheme) might + be - Example 2: Pack and unpack a message in Java. + used with implementation specific semantics. + additionalProperties: {} + description: >- + Plan specifies information about a planned upgrade and when it should + occur. + upgraded_client_state: + description: >- + An UpgradedClientState must be provided to perform an IBC breaking + upgrade. - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } + This will make the chain commit to the correct upgraded (self) client + state - Example 3: Pack and unpack a message in Python. + before the upgrade occurs, so that connecting chains can verify that + the - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... + new upgraded client is valid by verifying a proof on the previous + version - Example 4: Pack and unpack a message in Go + of the chain. This will allow IBC connections to persist smoothly + across - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } + planned chain upgrades. Correspondingly, the UpgradedClientState field + has been - The pack methods provided by protobuf library will by default - use + deprecated in the Cosmos SDK to allow for this logic to exist solely + in - 'type.googleapis.com/full.type.name' as the type URL and the - unpack + the 02-client module. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized - methods only use the fully qualified type name after the last - '/' + protocol buffer message. This string must contain at least - in the type URL, for example "foo.bar.com/x/y.z" will yield type + one "/" character. The last segment of the URL's path must + represent - name "y.z". + the fully qualified name of the type (as in + `path/google.protobuf.Duration`). The name should be in a + canonical form + (e.g., leading "." is not accepted). - JSON - ==== + In practice, teams usually precompile into the binary all types + that they - The JSON representation of an `Any` value uses the regular + expect it to use in the context of Any. However, for URLs which + use the - representation of the deserialized, embedded message, with an + scheme `http`, `https`, or no scheme, one can optionally set up a + type - additional field `@type` which contains the type URL. Example: + server that maps type URLs to message definitions as follows: - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + * If no scheme is provided, `https` is assumed. - If the embedded message type is well-known and has a custom JSON + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - representation, that representation will be embedded adding a - field + Note: this functionality is not currently available in the + official - `value` which holds the custom JSON in addition to the `@type` + protobuf release, and it is not used for type URLs beginning with - field. Example (for message [google.protobuf.Duration][]): + type.googleapis.com. - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - ConsensusStateWithHeight defines a consensus state with an - additional height - field. - title: consensus states associated with the identifier - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + Schemes other than `http`, `https` (or the empty scheme) might be - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. + used with implementation specific semantics. + additionalProperties: {} + signer: + type: string + title: signer address + title: >- + MsgIBCSoftwareUpgrade defines the message used to schedule an upgrade of + an IBC client using a v1 governance proposal + ibc.core.client.v1.MsgIBCSoftwareUpgradeResponse: + type: object + description: >- + MsgIBCSoftwareUpgradeResponse defines the Msg/IBCSoftwareUpgrade response + type. + ibc.core.client.v1.MsgRecoverClient: + type: object + properties: + subject_client_id: + type: string + title: >- + the client identifier for the client to be updated if the proposal + passes + substitute_client_id: + type: string + title: >- + the substitute client identifier for the client which will replace the + subject - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - title: |- - QueryConsensusStatesResponse is the response type for the - Query/ConsensusStates RPC method - ibc.core.client.v1.QueryUpgradedClientStateResponse: + client + signer: + type: string + title: signer address + description: >- + MsgRecoverClient defines the message used to recover a frozen or expired + client. + ibc.core.client.v1.MsgRecoverClientResponse: + type: object + description: MsgRecoverClientResponse defines the Msg/RecoverClient response type. + ibc.core.client.v1.MsgSubmitMisbehaviour: type: object properties: - upgraded_client_state: - title: client state associated with the request identifier + client_id: + type: string + title: client unique identifier + misbehaviour: + title: misbehaviour used for freezing the light client type: object properties: '@type': @@ -76105,8 +25063,12 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -76116,7 +25078,7 @@ definitions: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -76140,10 +25102,8 @@ definitions: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -76175,14 +25135,26 @@ definitions: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } + signer: + type: string + title: signer address + description: |- + MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for + light client misbehaviour. + This message has been deprecated. Use MsgUpdateClient instead. + ibc.core.client.v1.MsgSubmitMisbehaviourResponse: + type: object description: |- - QueryUpgradedClientStateResponse is the response type for the - Query/UpgradedClientState RPC method. - ibc.core.client.v1.QueryUpgradedConsensusStateResponse: + MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response + type. + ibc.core.client.v1.MsgUpdateClient: type: object properties: - upgraded_consensus_state: - title: Consensus state associated with the request identifier + client_id: + type: string + title: client unique identifier + client_message: + title: client message to update the light client type: object properties: '@type': @@ -76269,8 +25241,12 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -76280,7 +25256,7 @@ definitions: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -76304,10 +25280,8 @@ definitions: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -76339,513 +25313,217 @@ definitions: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } + signer: + type: string + title: signer address description: |- - QueryUpgradedConsensusStateResponse is the response type for the - Query/UpgradedConsensusState RPC method. - ibc.core.commitment.v1.MerklePrefix: + MsgUpdateClient defines an sdk.Msg to update a IBC client state using + the given client message. + ibc.core.client.v1.MsgUpdateClientResponse: type: object - properties: - key_prefix: - type: string - format: byte - title: |- - MerklePrefix is merkle path prefixed to the key. - The constructed key from the Path and the key will be append(Path.KeyPath, - append(Path.KeyPrefix, key...)) - ibc.core.connection.v1.ConnectionEnd: + description: MsgUpdateClientResponse defines the Msg/UpdateClient response type. + ibc.core.client.v1.MsgUpdateParams: type: object properties: - client_id: + signer: type: string - description: client associated with this connection. - versions: - type: array - items: - type: object - properties: - identifier: - type: string - title: unique version identifier - features: - type: array - items: - type: string - title: list of features compatible with the specified identifier - description: >- - Version defines the versioning scheme used to negotiate the IBC - verison in - - the connection handshake. - description: >- - IBC version which can be utilised to determine encodings or protocols - for + title: signer address + params: + description: |- + params defines the client parameters to update. - channels or packets utilising this connection. - state: - description: current state of the connection end. - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - default: STATE_UNINITIALIZED_UNSPECIFIED - counterparty: - description: counterparty chain associated with this connection. + NOTE: All parameters must be supplied. type: object properties: - client_id: - type: string - description: >- - identifies the client on the counterparty chain associated with a - given - - connection. - connection_id: - type: string + allowed_clients: + type: array + items: + type: string description: >- - identifies the connection end on the counterparty chain associated - with a - - given connection. - prefix: - description: commitment merkle prefix of the counterparty chain. - type: object - properties: - key_prefix: - type: string - format: byte - title: >- - MerklePrefix is merkle path prefixed to the key. - - The constructed key from the Path and the key will be - append(Path.KeyPath, - - append(Path.KeyPrefix, key...)) - delay_period: - type: string - format: uint64 - description: >- - delay period that must pass before a consensus state can be used for + allowed_clients defines the list of allowed client state types + which can be created - packet-verification NOTE: delay period logic is only implemented by - some + and interacted with. If a client type is removed from the allowed + clients list, usage - clients. - description: |- - ConnectionEnd defines a stateful object on a chain connected to another - separate one. - NOTE: there must only be 2 defined ConnectionEnds to establish - a connection between two chains. - ibc.core.connection.v1.Counterparty: + of this client will be disabled until it is added again to the + list. + description: MsgUpdateParams defines the sdk.Msg type to update the client parameters. + ibc.core.client.v1.MsgUpdateParamsResponse: type: object - properties: - client_id: - type: string - description: >- - identifies the client on the counterparty chain associated with a - given - - connection. - connection_id: - type: string - description: >- - identifies the connection end on the counterparty chain associated - with a - - given connection. - prefix: - description: commitment merkle prefix of the counterparty chain. - type: object - properties: - key_prefix: - type: string - format: byte - title: >- - MerklePrefix is merkle path prefixed to the key. - - The constructed key from the Path and the key will be - append(Path.KeyPath, - - append(Path.KeyPrefix, key...)) - description: >- - Counterparty defines the counterparty chain associated with a connection - end. - ibc.core.connection.v1.IdentifiedConnection: + description: MsgUpdateParamsResponse defines the MsgUpdateParams response type. + ibc.core.client.v1.MsgUpgradeClient: type: object properties: - id: - type: string - description: connection identifier. client_id: type: string - description: client associated with this connection. - versions: - type: array - items: - type: object - properties: - identifier: - type: string - title: unique version identifier - features: - type: array - items: - type: string - title: list of features compatible with the specified identifier - description: >- - Version defines the versioning scheme used to negotiate the IBC - verison in - - the connection handshake. - title: >- - IBC version which can be utilised to determine encodings or protocols - for - - channels or packets utilising this connection - state: - description: current state of the connection end. - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - default: STATE_UNINITIALIZED_UNSPECIFIED - counterparty: - description: counterparty chain associated with this connection. + title: client unique identifier + client_state: + title: upgraded client state type: object properties: - client_id: - type: string - description: >- - identifies the client on the counterparty chain associated with a - given - - connection. - connection_id: + '@type': type: string description: >- - identifies the connection end on the counterparty chain associated - with a - - given connection. - prefix: - description: commitment merkle prefix of the counterparty chain. - type: object - properties: - key_prefix: - type: string - format: byte - title: >- - MerklePrefix is merkle path prefixed to the key. - - The constructed key from the Path and the key will be - append(Path.KeyPath, - - append(Path.KeyPrefix, key...)) - delay_period: - type: string - format: uint64 - description: delay period associated with this connection. - description: |- - IdentifiedConnection defines a connection with additional connection - identifier field. - ibc.core.connection.v1.MsgConnectionOpenAckResponse: - type: object - description: >- - MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response - type. - ibc.core.connection.v1.MsgConnectionOpenConfirmResponse: - type: object - description: |- - MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm - response type. - ibc.core.connection.v1.MsgConnectionOpenInitResponse: - type: object - description: |- - MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit response - type. - ibc.core.connection.v1.MsgConnectionOpenTryResponse: - type: object - description: >- - MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response - type. - ibc.core.connection.v1.Params: - type: object - properties: - max_expected_time_per_block: - type: string - format: uint64 - description: >- - maximum expected time per block (in nanoseconds), used to enforce - block delay. This parameter should reflect the - - largest amount of time that the chain might reasonably take to produce - the next block under normal operating - - conditions. A safe choice is 3-5x the expected time per block. - description: Params defines the set of Connection parameters. - ibc.core.connection.v1.QueryClientConnectionsResponse: - type: object - properties: - connection_paths: - type: array - items: - type: string - description: slice of all the connection paths associated with a client. - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was generated - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryClientConnectionsResponse is the response type for the - Query/ClientConnections RPC method - ibc.core.connection.v1.QueryConnectionClientStateResponse: - type: object - properties: - identified_client_state: - title: client state associated with the channel - type: object - properties: - client_id: - type: string - title: client identifier - client_state: - title: client state - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - + A URL/resource name that uniquely identifies the type of the + serialized - In practice, teams usually precompile into the binary all - types that they + protocol buffer message. This string must contain at least - expect it to use in the context of Any. However, for URLs - which use the + one "/" character. The last segment of the URL's path must + represent - scheme `http`, `https`, or no scheme, one can optionally set - up a type + the fully qualified name of the type (as in - server that maps type URLs to message definitions as follows: + `path/google.protobuf.Duration`). The name should be in a + canonical form + (e.g., leading "." is not accepted). - * If no scheme is provided, `https` is assumed. - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + In practice, teams usually precompile into the binary all types + that they - Note: this functionality is not currently available in the - official + expect it to use in the context of Any. However, for URLs which + use the - protobuf release, and it is not used for type URLs beginning - with + scheme `http`, `https`, or no scheme, one can optionally set up a + type - type.googleapis.com. + server that maps type URLs to message definitions as follows: - Schemes other than `http`, `https` (or the empty scheme) might - be + * If no scheme is provided, `https` is assumed. - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - URL that describes the type of the serialized message. + Note: this functionality is not currently available in the + official + protobuf release, and it is not used for type URLs beginning with - Protobuf library provides support to pack/unpack Any values in the - form + type.googleapis.com. - of utility functions or additional generated methods of the Any - type. + Schemes other than `http`, `https` (or the empty scheme) might be - Example 1: Pack and unpack a message in C++. + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message along + with a - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } + URL that describes the type of the serialized message. - Example 2: Pack and unpack a message in Java. - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } + Protobuf library provides support to pack/unpack Any values in the + form - Example 3: Pack and unpack a message in Python. + of utility functions or additional generated methods of the Any type. - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - Example 4: Pack and unpack a message in Go + Example 1: Pack and unpack a message in C++. - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } - The pack methods provided by protobuf library will by default use + Example 2: Pack and unpack a message in Java. - 'type.googleapis.com/full.type.name' as the type URL and the - unpack + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - methods only use the fully qualified type name after the last '/' + Example 3: Pack and unpack a message in Python. - in the type URL, for example "foo.bar.com/x/y.z" will yield type + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... - name "y.z". + Example 4: Pack and unpack a message in Go + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + The pack methods provided by protobuf library will by default use - JSON + 'type.googleapis.com/full.type.name' as the type URL and the unpack - ==== + methods only use the fully qualified type name after the last '/' - The JSON representation of an `Any` value uses the regular + in the type URL, for example "foo.bar.com/x/y.z" will yield type - representation of the deserialized, embedded message, with an + name "y.z". - additional field `@type` which contains the type URL. Example: - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } + JSON - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - If the embedded message type is well-known and has a custom JSON + The JSON representation of an `Any` value uses the regular - representation, that representation will be embedded adding a - field + representation of the deserialized, embedded message, with an - `value` which holds the custom JSON in addition to the `@type` + additional field `@type` which contains the type URL. Example: - field. Example (for message [google.protobuf.Duration][]): + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: |- - IdentifiedClientState defines a client state with an additional client - identifier field. - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } - RevisionNumber the same. However some consensus algorithms may choose - to + If the embedded message type is well-known and has a custom JSON - reset the height in certain conditions e.g. hard forks, state-machine + representation, that representation will be embedded adding a field - breaking changes In these cases, the RevisionNumber is incremented so - that + `value` which holds the custom JSON in addition to the `@type` - height continues to be monitonically increasing even as the - RevisionHeight + field. Example (for message [google.protobuf.Duration][]): - gets reset - title: |- - QueryConnectionClientStateResponse is the response type for the - Query/ConnectionClientState RPC method - ibc.core.connection.v1.QueryConnectionConsensusStateResponse: - type: object - properties: + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } consensus_state: - title: consensus state associated with the channel + title: >- + upgraded consensus state, only contains enough information to serve as + a + + basis of trust in update logic type: object properties: '@type': @@ -76932,8 +25610,12 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -76943,7 +25625,7 @@ definitions: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -76967,10 +25649,8 @@ definitions: name "y.z". - JSON - ==== The JSON representation of an `Any` value uses the regular @@ -77002,2348 +25682,866 @@ definitions: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } - client_id: + proof_upgrade_client: type: string - title: client ID associated with the consensus state - proof: + format: byte + title: proof that old chain committed to new client + proof_upgrade_consensus_state: type: string format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine + title: proof that old chain committed to new consensus state + signer: + type: string + title: signer address + title: >- + MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new + client - breaking changes In these cases, the RevisionNumber is incremented so - that + state + ibc.core.client.v1.MsgUpgradeClientResponse: + type: object + description: MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. + ibc.core.client.v1.Params: + type: object + properties: + allowed_clients: + type: array + items: + type: string + description: >- + allowed_clients defines the list of allowed client state types which + can be created - height continues to be monitonically increasing even as the - RevisionHeight + and interacted with. If a client type is removed from the allowed + clients list, usage - gets reset + of this client will be disabled until it is added again to the list. + description: Params defines the set of IBC light client parameters. + ibc.core.commitment.v1.MerklePrefix: + type: object + properties: + key_prefix: + type: string + format: byte title: |- - QueryConnectionConsensusStateResponse is the response type for the - Query/ConnectionConsensusState RPC method - ibc.core.connection.v1.QueryConnectionParamsResponse: + MerklePrefix is merkle path prefixed to the key. + The constructed key from the Path and the key will be append(Path.KeyPath, + append(Path.KeyPrefix, key...)) + ibc.core.connection.v1.Counterparty: type: object properties: - params: - description: params defines the parameters of the module. + client_id: + type: string + description: >- + identifies the client on the counterparty chain associated with a + given + + connection. + connection_id: + type: string + description: >- + identifies the connection end on the counterparty chain associated + with a + + given connection. + prefix: + description: commitment merkle prefix of the counterparty chain. type: object properties: - max_expected_time_per_block: + key_prefix: type: string - format: uint64 - description: >- - maximum expected time per block (in nanoseconds), used to enforce - block delay. This parameter should reflect the + format: byte + title: >- + MerklePrefix is merkle path prefixed to the key. - largest amount of time that the chain might reasonably take to - produce the next block under normal operating + The constructed key from the Path and the key will be + append(Path.KeyPath, - conditions. A safe choice is 3-5x the expected time per block. + append(Path.KeyPrefix, key...)) description: >- - QueryConnectionParamsResponse is the response type for the - Query/ConnectionParams RPC method. - ibc.core.connection.v1.QueryConnectionResponse: + Counterparty defines the counterparty chain associated with a connection + end. + ibc.core.connection.v1.MsgConnectionOpenAck: type: object properties: - connection: - title: connection associated with the request identifier + connection_id: + type: string + counterparty_connection_id: + type: string + version: type: object properties: - client_id: + identifier: type: string - description: client associated with this connection. - versions: + title: unique version identifier + features: type: array items: - type: object - properties: - identifier: - type: string - title: unique version identifier - features: - type: array - items: - type: string - title: list of features compatible with the specified identifier - description: >- - Version defines the versioning scheme used to negotiate the IBC - verison in + type: string + title: list of features compatible with the specified identifier + description: >- + Version defines the versioning scheme used to negotiate the IBC + verison in - the connection handshake. + the connection handshake. + client_state: + type: object + properties: + '@type': + type: string description: >- - IBC version which can be utilised to determine encodings or - protocols for + A URL/resource name that uniquely identifies the type of the + serialized - channels or packets utilising this connection. - state: - description: current state of the connection end. - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - default: STATE_UNINITIALIZED_UNSPECIFIED - counterparty: - description: counterparty chain associated with this connection. - type: object - properties: - client_id: - type: string - description: >- - identifies the client on the counterparty chain associated - with a given + protocol buffer message. This string must contain at least - connection. - connection_id: - type: string - description: >- - identifies the connection end on the counterparty chain - associated with a + one "/" character. The last segment of the URL's path must + represent - given connection. - prefix: - description: commitment merkle prefix of the counterparty chain. - type: object - properties: - key_prefix: - type: string - format: byte - title: >- - MerklePrefix is merkle path prefixed to the key. + the fully qualified name of the type (as in - The constructed key from the Path and the key will be - append(Path.KeyPath, + `path/google.protobuf.Duration`). The name should be in a + canonical form - append(Path.KeyPrefix, key...)) - delay_period: - type: string - format: uint64 - description: >- - delay period that must pass before a consensus state can be used - for + (e.g., leading "." is not accepted). - packet-verification NOTE: delay period logic is only implemented - by some - clients. - description: >- - ConnectionEnd defines a stateful object on a chain connected to - another + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up a + type - separate one. + server that maps type URLs to message definitions as follows: - NOTE: there must only be 2 defined ConnectionEnds to establish - a connection between two chains. - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} description: >- - Normally the RevisionHeight is incremented at each height while - keeping + `Any` contains an arbitrary serialized protocol buffer message along + with a - RevisionNumber the same. However some consensus algorithms may choose - to + URL that describes the type of the serialized message. - reset the height in certain conditions e.g. hard forks, state-machine - breaking changes In these cases, the RevisionNumber is incremented so - that + Protobuf library provides support to pack/unpack Any values in the + form - height continues to be monitonically increasing even as the - RevisionHeight + of utility functions or additional generated methods of the Any type. - gets reset - description: >- - QueryConnectionResponse is the response type for the Query/Connection RPC - method. Besides the connection end, it includes a proof and the height - from + Example 1: Pack and unpack a message in C++. - which the proof was retrieved. - ibc.core.connection.v1.QueryConnectionsResponse: - type: object - properties: - connections: - type: array - items: - type: object - properties: - id: - type: string - description: connection identifier. - client_id: - type: string - description: client associated with this connection. - versions: - type: array - items: - type: object - properties: - identifier: - type: string - title: unique version identifier - features: - type: array - items: - type: string - title: list of features compatible with the specified identifier - description: >- - Version defines the versioning scheme used to negotiate the - IBC verison in + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } - the connection handshake. - title: >- - IBC version which can be utilised to determine encodings or - protocols for + Example 2: Pack and unpack a message in Java. - channels or packets utilising this connection - state: - description: current state of the connection end. - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - default: STATE_UNINITIALIZED_UNSPECIFIED - counterparty: - description: counterparty chain associated with this connection. - type: object - properties: - client_id: - type: string - description: >- - identifies the client on the counterparty chain associated - with a given + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - connection. - connection_id: - type: string - description: >- - identifies the connection end on the counterparty chain - associated with a + Example 3: Pack and unpack a message in Python. - given connection. - prefix: - description: commitment merkle prefix of the counterparty chain. - type: object - properties: - key_prefix: - type: string - format: byte - title: >- - MerklePrefix is merkle path prefixed to the key. + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... - The constructed key from the Path and the key will be - append(Path.KeyPath, + Example 4: Pack and unpack a message in Go - append(Path.KeyPrefix, key...)) - delay_period: - type: string - format: uint64 - description: delay period associated with this connection. - description: |- - IdentifiedConnection defines a connection with additional connection - identifier field. - description: list of stored connections of the chain. - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. + The pack methods provided by protobuf library will by default use - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping + 'type.googleapis.com/full.type.name' as the type URL and the unpack - RevisionNumber the same. However some consensus algorithms may choose - to + methods only use the fully qualified type name after the last '/' - reset the height in certain conditions e.g. hard forks, state-machine + in the type URL, for example "foo.bar.com/x/y.z" will yield type - breaking changes In these cases, the RevisionNumber is incremented so - that + name "y.z". - height continues to be monitonically increasing even as the - RevisionHeight - gets reset - description: >- - QueryConnectionsResponse is the response type for the Query/Connections - RPC + JSON - method. - ibc.core.connection.v1.State: - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - default: STATE_UNINITIALIZED_UNSPECIFIED - description: |- - State defines if a connection is in one of the following states: - INIT, TRYOPEN, OPEN or UNINITIALIZED. - - STATE_UNINITIALIZED_UNSPECIFIED: Default State - - STATE_INIT: A connection end has just started the opening handshake. - - STATE_TRYOPEN: A connection end has acknowledged the handshake step on the counterparty - chain. - - STATE_OPEN: A connection end has completed the handshake. - ibc.core.connection.v1.Version: - type: object - properties: - identifier: - type: string - title: unique version identifier - features: - type: array - items: - type: string - title: list of features compatible with the specified identifier - description: |- - Version defines the versioning scheme used to negotiate the IBC verison in - the connection handshake. - pocket.application.Application: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the application using cosmos' ScalarDescriptor - to ensure deterministic encoding - stake: - title: The total amount of uPOKT the application has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. + The JSON representation of an `Any` value uses the regular - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - service_configs: - type: array - items: - type: object - properties: - service: - title: The Service for which the application is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that - identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of the - service is necessary - title: >- - ApplicationServiceConfig holds the service configuration the - application stakes for - title: >- - The list of services this appliccation is configured to request - service for - delegatee_gateway_addresses: - type: array - items: - type: string - title: >- - The Bech32 encoded addresses for all delegatee Gateways, in a - non-nullable slice - title: >- - Application defines the type used to store an on-chain definition and - state for an application - pocket.application.MsgDelegateToGatewayResponse: - type: object - pocket.application.MsgStakeApplicationResponse: - type: object - pocket.application.MsgUndelegateFromGatewayResponse: - type: object - pocket.application.MsgUnstakeApplicationResponse: - type: object - pocket.application.Params: - type: object - properties: - max_delegated_gateways: - type: string - format: int64 - title: The maximum number of gateways an application can delegate trust to - description: Params defines the parameters for the module. - pocket.application.QueryAllApplicationResponse: - type: object - properties: - application: - type: array - items: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the application has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. + representation of the deserialized, embedded message, with an + additional field `@type` which contains the type URL. Example: - NOTE: The amount field is an Int which implements the custom - method + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } - signatures required by gogoproto. - service_configs: - type: array - items: - type: object - properties: - service: - title: The Service for which the application is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for - a certain service but with some additional configs - that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of - the service is necessary - title: >- - ApplicationServiceConfig holds the service configuration the - application stakes for - title: >- - The list of services this appliccation is configured to request - service for - delegatee_gateway_addresses: - type: array - items: - type: string - title: >- - The Bech32 encoded addresses for all delegatee Gateways, in a - non-nullable slice - title: >- - Application defines the type used to store an on-chain definition - and state for an application - pagination: + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom JSON + + representation, that representation will be embedded adding a field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + proof_height: type: object properties: - next_key: + revision_number: type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: + format: uint64 + title: the revision that the client is currently on + revision_height: type: string format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. + RevisionNumber the same. However some consensus algorithms may choose + to - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - pocket.application.QueryGetApplicationResponse: - type: object - properties: - application: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the application has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. + reset the height in certain conditions e.g. hard forks, state-machine + breaking changes In these cases, the RevisionNumber is incremented so + that - NOTE: The amount field is an Int which implements the custom - method + height continues to be monitonically increasing even as the + RevisionHeight - signatures required by gogoproto. - service_configs: - type: array - items: - type: object - properties: - service: - title: The Service for which the application is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that - identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of the - service is necessary - title: >- - ApplicationServiceConfig holds the service configuration the - application stakes for - title: >- - The list of services this appliccation is configured to request - service for - delegatee_gateway_addresses: - type: array - items: - type: string - title: >- - The Bech32 encoded addresses for all delegatee Gateways, in a - non-nullable slice + gets reset title: >- - Application defines the type used to store an on-chain definition and - state for an application - pocket.application.QueryParamsResponse: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - properties: - max_delegated_gateways: - type: string - format: int64 - title: >- - The maximum number of gateways an application can delegate trust - to - description: QueryParamsResponse is response type for the Query/Params RPC method. - pocket.shared.ApplicationServiceConfig: - type: object - properties: - service: - title: The Service for which the application is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a certain - service but with some additional configs that identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a reminder - than an optional onchain representation of the service is - necessary - title: >- - ApplicationServiceConfig holds the service configuration the application - stakes for - pocket.shared.Service: - type: object - properties: - id: + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes of + updating and + + freezing clients + proof_try: type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a certain - service but with some additional configs that identify it? - name: + format: byte + title: |- + proof of the initialization the connection on Chain B: `UNITIALIZED -> + TRYOPEN` + proof_client: type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a reminder than an - optional onchain representation of the service is necessary - title: >- - Service message to encapsulate unique and semantic identifiers for a - service on the network - pocket.gateway.Gateway: - type: object - properties: - address: + format: byte + title: proof of client state included in message + proof_consensus: type: string - title: The Bech32 address of the gateway - stake: - title: The total amount of uPOKT the gateway has staked + format: byte + title: proof of client consensus state + consensus_height: type: object properties: - denom: + revision_number: type: string - amount: + format: uint64 + title: the revision that the client is currently on + revision_height: type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - pocket.gateway.MsgStakeGatewayResponse: - type: object - pocket.gateway.MsgUnstakeGatewayResponse: - type: object - pocket.gateway.Params: - type: object - description: Params defines the parameters for the module. - pocket.gateway.QueryAllGatewayResponse: - type: object - properties: - gateway: - type: array - items: - type: object - properties: - address: - type: string - title: The Bech32 address of the gateway - stake: - title: The total amount of uPOKT the gateway has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping - NOTE: The amount field is an Int which implements the custom - method + RevisionNumber the same. However some consensus algorithms may choose + to - signatures required by gogoproto. - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + reset the height in certain conditions e.g. hard forks, state-machine - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. + breaking changes In these cases, the RevisionNumber is incremented so + that - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - pocket.gateway.QueryGetGatewayResponse: - type: object - properties: - gateway: - type: object - properties: - address: - type: string - title: The Bech32 address of the gateway - stake: - title: The total amount of uPOKT the gateway has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. + height continues to be monitonically increasing even as the + RevisionHeight + gets reset + title: >- + Height is a monotonically increasing data type - NOTE: The amount field is an Int which implements the custom - method + that can be compared against another Height for the purposes of + updating and - signatures required by gogoproto. - pocket.gateway.QueryParamsResponse: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: QueryParamsResponse is response type for the Query/Params RPC method. - pocket.pocket.Params: - type: object - description: Params defines the parameters for the module. - pocket.pocket.QueryParamsResponse: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: QueryParamsResponse is response type for the Query/Params RPC method. - pocket.service.MsgAddServiceResponse: + freezing clients + signer: + type: string + host_consensus_state_proof: + type: string + format: byte + title: >- + optional proof data for host state machines that are unable to + introspect their own consensus state + description: |- + MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to + acknowledge the change of connection state to TRYOPEN on Chain B. + ibc.core.connection.v1.MsgConnectionOpenAckResponse: type: object - pocket.service.Params: + description: >- + MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response + type. + ibc.core.connection.v1.MsgConnectionOpenConfirm: type: object properties: - add_service_fee: + connection_id: type: string - format: uint64 - title: The amount of uPOKT required to add a new service - description: Params defines the parameters for the module. - pocket.service.QueryParamsResponse: - type: object - properties: - params: - description: params holds all the parameters of this module. + proof_ack: + type: string + format: byte + title: >- + proof for the change of the connection state on Chain A: `INIT -> + OPEN` + proof_height: type: object properties: - add_service_fee: + revision_number: type: string format: uint64 - title: The amount of uPOKT required to add a new service - description: QueryParamsResponse is response type for the Query/Params RPC method. - pocket.session.Params: - type: object - description: Params defines the parameters for the module. - pocket.session.QueryGetSessionResponse: - type: object - properties: - session: - type: object - properties: - header: - title: The header of the session containing lightweight data - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that - identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of the - service is necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values using - on-chain but is included in the header for convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the last block - of the session - description: >- - SessionHeader is a lightweight header for a session that can be - passed around. - - It is the minimal amount of data required to hydrate & retrieve - all data relevant to the session. - session_id: - type: string - title: A unique pseudoranom ID for this session - session_number: - type: string - format: int64 - title: The session number since genesis - num_blocks_per_session: + title: the revision that the client is currently on + revision_height: type: string - format: int64 - title: The number of blocks per session when this session started - application: - title: A fully hydrated application object this session is for - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the application has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + RevisionNumber the same. However some consensus algorithms may choose + to - NOTE: The amount field is an Int which implements the custom - method + reset the height in certain conditions e.g. hard forks, state-machine - signatures required by gogoproto. - service_configs: - type: array - items: - type: object - properties: - service: - title: The Service for which the application is configured for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session - for a certain service but with some additional - configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as - a reminder than an optional onchain representation - of the service is necessary - title: >- - ApplicationServiceConfig holds the service configuration the - application stakes for - title: >- - The list of services this appliccation is configured to - request service for - delegatee_gateway_addresses: - type: array - items: - type: string - title: >- - The Bech32 encoded addresses for all delegatee Gateways, in a - non-nullable slice - suppliers: - type: array - items: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the supplier using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the supplier has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. + breaking changes In these cases, the RevisionNumber is incremented so + that + height continues to be monitonically increasing even as the + RevisionHeight - NOTE: The amount field is an Int which implements the custom - method + gets reset + title: >- + Height is a monotonically increasing data type - signatures required by gogoproto. - services: - type: array - items: - type: object - properties: - service: - title: The Service for which the supplier is configured for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session - for a certain service but with some additional - configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts - as a reminder than an optional onchain - representation of the service is necessary - endpoints: - type: array - items: - type: object - properties: - url: - type: string - title: URL of the endpoint - rpc_type: - title: Type of RPC exposed on the url above - type: string - enum: - - UNKNOWN_RPC - - GRPC - - WEBSOCKET - - JSON_RPC - default: UNKNOWN_RPC - description: |- - - UNKNOWN_RPC: Undefined RPC type - - GRPC: gRPC - - WEBSOCKET: WebSocket - - JSON_RPC: JSON-RPC - configs: - type: array - items: - type: object - properties: - key: - title: Config option key - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options - - TODO_RESEARCH: Should these be configs, - SLAs or something else? There will be more - discussion once we get closer to - implementing on-chain QoS. - - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - value: - type: string - title: Config option value - title: >- - Key-value wrapper for config options, as proto - maps can't be keyed by enums - title: >- - Additional configuration options for the - endpoint - title: >- - SupplierEndpoint message to hold service - configuration details - title: List of endpoints for the service - title: >- - SupplierServiceConfig holds the service configuration the - supplier stakes for - title: The service configs this supplier can support - description: >- - Supplier is the type defining the actor in Pocket Network that - provides RPC services. - title: A fully hydrated set of servicers that are serving the application - description: >- - Session is a fully hydrated session object that contains all the - information for the Session + that can be compared against another Height for the purposes of + updating and - and its parcipants. - pocket.session.QueryParamsResponse: + freezing clients + signer: + type: string + description: |- + MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to + acknowledge the change of connection state to OPEN on Chain A. + ibc.core.connection.v1.MsgConnectionOpenConfirmResponse: type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: QueryParamsResponse is response type for the Query/Params RPC method. - pocket.session.Session: + description: |- + MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm + response type. + ibc.core.connection.v1.MsgConnectionOpenInit: type: object properties: - header: - title: The header of the session containing lightweight data + client_id: + type: string + counterparty: type: object properties: - application_address: + client_id: type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for + description: >- + identifies the client on the counterparty chain associated with a + given + + connection. + connection_id: + type: string + description: >- + identifies the connection end on the counterparty chain associated + with a + + given connection. + prefix: + description: commitment merkle prefix of the counterparty chain. type: object properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that identify - it? - name: + key_prefix: type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a reminder - than an optional onchain representation of the service is - necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session + format: byte title: >- - NOTE: session_id can be derived from the above values using - on-chain but is included in the header for convenience - session_end_block_height: + MerklePrefix is merkle path prefixed to the key. + + The constructed key from the Path and the key will be + append(Path.KeyPath, + + append(Path.KeyPrefix, key...)) + description: >- + Counterparty defines the counterparty chain associated with a + connection end. + version: + type: object + properties: + identifier: type: string - format: int64 - title: >- - The height at which this session ended, this is the last block of - the session + title: unique version identifier + features: + type: array + items: + type: string + title: list of features compatible with the specified identifier description: >- - SessionHeader is a lightweight header for a session that can be passed - around. + Version defines the versioning scheme used to negotiate the IBC + verison in - It is the minimal amount of data required to hydrate & retrieve all - data relevant to the session. - session_id: + the connection handshake. + delay_period: type: string - title: A unique pseudoranom ID for this session - session_number: + format: uint64 + signer: type: string - format: int64 - title: The session number since genesis - num_blocks_per_session: + description: |- + MsgConnectionOpenInit defines the msg sent by an account on Chain A to + initialize a connection with Chain B. + ibc.core.connection.v1.MsgConnectionOpenInitResponse: + type: object + description: |- + MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit response + type. + ibc.core.connection.v1.MsgConnectionOpenTry: + type: object + properties: + client_id: type: string - format: int64 - title: The number of blocks per session when this session started - application: - title: A fully hydrated application object this session is for + previous_connection_id: + type: string + description: >- + Deprecated: this field is unused. Crossing hellos are no longer + supported in core IBC. + client_state: type: object properties: - address: + '@type': type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the application has staked - type: object - properties: - denom: - type: string - amount: - type: string description: >- - Coin defines a token with a denomination and an amount. + A URL/resource name that uniquely identifies the type of the + serialized + protocol buffer message. This string must contain at least - NOTE: The amount field is an Int which implements the custom - method + one "/" character. The last segment of the URL's path must + represent - signatures required by gogoproto. - service_configs: - type: array - items: - type: object - properties: - service: - title: The Service for which the application is configured for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that - identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of the - service is necessary - title: >- - ApplicationServiceConfig holds the service configuration the - application stakes for - title: >- - The list of services this appliccation is configured to request - service for - delegatee_gateway_addresses: - type: array - items: - type: string - title: >- - The Bech32 encoded addresses for all delegatee Gateways, in a - non-nullable slice - suppliers: - type: array - items: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the supplier using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the supplier has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up a + type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message along + with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in the + form + + of utility functions or additional generated methods of the Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default use + + 'type.googleapis.com/full.type.name' as the type URL and the unpack + + methods only use the fully qualified type name after the last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield type + name "y.z". - NOTE: The amount field is an Int which implements the custom - method - signatures required by gogoproto. - services: - type: array - items: - type: object - properties: - service: - title: The Service for which the supplier is configured for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for - a certain service but with some additional configs - that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of - the service is necessary - endpoints: - type: array - items: - type: object - properties: - url: - type: string - title: URL of the endpoint - rpc_type: - title: Type of RPC exposed on the url above - type: string - enum: - - UNKNOWN_RPC - - GRPC - - WEBSOCKET - - JSON_RPC - default: UNKNOWN_RPC - description: |- - - UNKNOWN_RPC: Undefined RPC type - - GRPC: gRPC - - WEBSOCKET: WebSocket - - JSON_RPC: JSON-RPC - configs: - type: array - items: - type: object - properties: - key: - title: Config option key - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options - - TODO_RESEARCH: Should these be configs, SLAs - or something else? There will be more - discussion once we get closer to implementing - on-chain QoS. - - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - value: - type: string - title: Config option value - title: >- - Key-value wrapper for config options, as proto - maps can't be keyed by enums - title: Additional configuration options for the endpoint - title: >- - SupplierEndpoint message to hold service configuration - details - title: List of endpoints for the service - title: >- - SupplierServiceConfig holds the service configuration the - supplier stakes for - title: The service configs this supplier can support - description: >- - Supplier is the type defining the actor in Pocket Network that - provides RPC services. - title: A fully hydrated set of servicers that are serving the application - description: >- - Session is a fully hydrated session object that contains all the - information for the Session + JSON - and its parcipants. - pocket.session.SessionHeader: - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' ScalarDescriptor - to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a certain - service but with some additional configs that identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a reminder - than an optional onchain representation of the service is - necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values using on-chain - but is included in the header for convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the last block of the - session - description: >- - SessionHeader is a lightweight header for a session that can be passed - around. - It is the minimal amount of data required to hydrate & retrieve all data - relevant to the session. - pocket.shared.ConfigOption: - type: object - properties: - key: - title: Config option key - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options + The JSON representation of an `Any` value uses the regular - TODO_RESEARCH: Should these be configs, SLAs or something else? There - will be more discussion once we get closer to implementing on-chain - QoS. + representation of the deserialized, embedded message, with an - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - value: - type: string - title: Config option value - title: >- - Key-value wrapper for config options, as proto maps can't be keyed by - enums - pocket.shared.ConfigOptions: - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options + additional field `@type` which contains the type URL. Example: - TODO_RESEARCH: Should these be configs, SLAs or something else? There will - be more discussion once we get closer to implementing on-chain QoS. + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - pocket.shared.RPCType: - type: string - enum: - - UNKNOWN_RPC - - GRPC - - WEBSOCKET - - JSON_RPC - - REST - default: UNKNOWN_RPC - description: |- - - UNKNOWN_RPC: Undefined RPC type - - GRPC: gRPC - - WEBSOCKET: WebSocket - - JSON_RPC: JSON-RPC - title: Enum to define RPC types - pocket.shared.Supplier: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the supplier using cosmos' ScalarDescriptor to - ensure deterministic encoding - stake: - title: The total amount of uPOKT the supplier has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - services: - type: array - items: - type: object - properties: - service: - title: The Service for which the supplier is configured for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that - identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of the - service is necessary - endpoints: - type: array - items: - type: object - properties: - url: - type: string - title: URL of the endpoint - rpc_type: - title: Type of RPC exposed on the url above - type: string - enum: - - UNKNOWN_RPC - - GRPC - - WEBSOCKET - - JSON_RPC - - REST - default: UNKNOWN_RPC - description: |- - - UNKNOWN_RPC: Undefined RPC type - - GRPC: gRPC - - WEBSOCKET: WebSocket - - JSON_RPC: JSON-RPC - configs: - type: array - items: - type: object - properties: - key: - title: Config option key - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options + If the embedded message type is well-known and has a custom JSON - TODO_RESEARCH: Should these be configs, SLAs or - something else? There will be more discussion once - we get closer to implementing on-chain QoS. + representation, that representation will be embedded adding a field - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - value: - type: string - title: Config option value - title: >- - Key-value wrapper for config options, as proto maps - can't be keyed by enums - title: Additional configuration options for the endpoint - title: SupplierEndpoint message to hold service configuration details - title: List of endpoints for the service - title: >- - SupplierServiceConfig holds the service configuration the supplier - stakes for - title: The service configs this supplier can support - description: >- - Supplier is the type defining the actor in Pocket Network that provides - RPC services. - pocket.shared.SupplierEndpoint: - type: object - properties: - url: - type: string - title: URL of the endpoint - rpc_type: - title: Type of RPC exposed on the url above - type: string - enum: - - UNKNOWN_RPC - - GRPC - - WEBSOCKET - - JSON_RPC - - REST - default: UNKNOWN_RPC - description: |- - - UNKNOWN_RPC: Undefined RPC type - - GRPC: gRPC - - WEBSOCKET: WebSocket - - JSON_RPC: JSON-RPC - configs: - type: array - items: - type: object - properties: - key: - title: Config option key - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options + `value` which holds the custom JSON in addition to the `@type` - TODO_RESEARCH: Should these be configs, SLAs or something else? - There will be more discussion once we get closer to implementing - on-chain QoS. + field. Example (for message [google.protobuf.Duration][]): - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - value: - type: string - title: Config option value - title: >- - Key-value wrapper for config options, as proto maps can't be keyed - by enums - title: Additional configuration options for the endpoint - title: SupplierEndpoint message to hold service configuration details - pocket.shared.SupplierServiceConfig: - type: object - properties: - service: - title: The Service for which the supplier is configured for + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + counterparty: type: object properties: - id: + client_id: type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a certain - service but with some additional configs that identify it? - name: + description: >- + identifies the client on the counterparty chain associated with a + given + + connection. + connection_id: type: string - description: (Optional) Semantic human readable name for the service + description: >- + identifies the connection end on the counterparty chain associated + with a + + given connection. + prefix: + description: commitment merkle prefix of the counterparty chain. + type: object + properties: + key_prefix: + type: string + format: byte title: >- - TODO_TECHDEBT: Name is currently unused but acts as a reminder - than an optional onchain representation of the service is - necessary - endpoints: + MerklePrefix is merkle path prefixed to the key. + + The constructed key from the Path and the key will be + append(Path.KeyPath, + + append(Path.KeyPrefix, key...)) + description: >- + Counterparty defines the counterparty chain associated with a + connection end. + delay_period: + type: string + format: uint64 + counterparty_versions: type: array items: type: object properties: - url: - type: string - title: URL of the endpoint - rpc_type: - title: Type of RPC exposed on the url above + identifier: type: string - enum: - - UNKNOWN_RPC - - GRPC - - WEBSOCKET - - JSON_RPC - - REST - default: UNKNOWN_RPC - description: |- - - UNKNOWN_RPC: Undefined RPC type - - GRPC: gRPC - - WEBSOCKET: WebSocket - - JSON_RPC: JSON-RPC - configs: + title: unique version identifier + features: type: array items: - type: object - properties: - key: - title: Config option key - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options - - TODO_RESEARCH: Should these be configs, SLAs or something - else? There will be more discussion once we get closer to - implementing on-chain QoS. + type: string + title: list of features compatible with the specified identifier + description: >- + Version defines the versioning scheme used to negotiate the IBC + verison in - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - value: - type: string - title: Config option value - title: >- - Key-value wrapper for config options, as proto maps can't be - keyed by enums - title: Additional configuration options for the endpoint - title: SupplierEndpoint message to hold service configuration details - title: List of endpoints for the service - title: >- - SupplierServiceConfig holds the service configuration the supplier stakes - for - pocket.supplier.Claim: - type: object - properties: - supplier_address: - type: string - title: the address of the supplier that submitted this claim - session_header: - description: The session header of the session that this claim is for. + the connection handshake. + proof_height: type: object properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that identify - it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a reminder - than an optional onchain representation of the service is - necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: + revision_number: type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values using - on-chain but is included in the header for convenience - session_end_block_height: + format: uint64 + title: the revision that the client is currently on + revision_height: type: string - format: int64 - title: >- - The height at which this session ended, this is the last block of - the session - root_hash: + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + + RevisionNumber the same. However some consensus algorithms may choose + to + + reset the height in certain conditions e.g. hard forks, state-machine + + breaking changes In these cases, the RevisionNumber is incremented so + that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes of + updating and + + freezing clients + proof_init: type: string format: byte - description: Root hash returned from smt.SMST#Root(). - title: >- - Claim is the serialized object stored on-chain for claims pending to be - proven - pocket.supplier.MsgCreateClaimResponse: - type: object - pocket.supplier.MsgStakeSupplierResponse: - type: object - pocket.supplier.MsgSubmitProofResponse: - type: object - pocket.supplier.MsgUnstakeSupplierResponse: - type: object - pocket.supplier.Params: - type: object - description: Params defines the parameters for the module. - pocket.supplier.Proof: - type: object - properties: - supplier_address: + title: |- + proof of the initialization the connection on Chain A: `UNITIALIZED -> + INIT` + proof_client: type: string - session_header: - description: The session header of the session that this claim is for. - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that identify - it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a reminder - than an optional onchain representation of the service is - necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values using - on-chain but is included in the header for convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the last block of - the session - closest_merkle_proof: + format: byte + title: proof of client state included in message + proof_consensus: type: string format: byte - description: The serialized SMST proof from the `#ClosestProof()` method. - pocket.supplier.QueryAllClaimsResponse: - type: object - properties: - claim: - type: array - items: - type: object - properties: - supplier_address: - type: string - title: the address of the supplier that submitted this claim - session_header: - description: The session header of the session that this claim is for. - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that - identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of the - service is necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values using - on-chain but is included in the header for convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the last - block of the session - root_hash: - type: string - format: byte - description: Root hash returned from smt.SMST#Root(). - title: >- - Claim is the serialized object stored on-chain for claims pending to - be proven - pagination: + title: proof of client consensus state + consensus_height: type: object properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: + revision_number: type: string format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - pocket.supplier.QueryAllProofsResponse: - type: object - properties: - proof: - type: array - items: - type: object - properties: - supplier_address: - type: string - session_header: - description: The session header of the session that this claim is for. - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that - identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of the - service is necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values using - on-chain but is included in the header for convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the last - block of the session - closest_merkle_proof: - type: string - format: byte - description: The serialized SMST proof from the `#ClosestProof()` method. - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: + title: the revision that the client is currently on + revision_height: type: string format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. + RevisionNumber the same. However some consensus algorithms may choose + to - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - pocket.supplier.QueryAllSupplierResponse: - type: object - properties: - supplier: - type: array - items: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the supplier using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the supplier has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. + reset the height in certain conditions e.g. hard forks, state-machine + breaking changes In these cases, the RevisionNumber is incremented so + that - NOTE: The amount field is an Int which implements the custom - method + height continues to be monitonically increasing even as the + RevisionHeight - signatures required by gogoproto. - services: - type: array - items: - type: object - properties: - service: - title: The Service for which the supplier is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for - a certain service but with some additional configs - that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of - the service is necessary - endpoints: - type: array - items: - type: object - properties: - url: - type: string - title: URL of the endpoint - rpc_type: - title: Type of RPC exposed on the url above - type: string - enum: - - UNKNOWN_RPC - - GRPC - - WEBSOCKET - - JSON_RPC - - REST - default: UNKNOWN_RPC - description: |- - - UNKNOWN_RPC: Undefined RPC type - - GRPC: gRPC - - WEBSOCKET: WebSocket - - JSON_RPC: JSON-RPC - - REST: REST - configs: - type: array - items: - type: object - properties: - key: - title: Config option key - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options - - TODO_RESEARCH: Should these be configs, SLAs - or something else? There will be more - discussion once we get closer to implementing - on-chain QoS. - - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - value: - type: string - title: Config option value - title: >- - Key-value wrapper for config options, as proto - maps can't be keyed by enums - title: Additional configuration options for the endpoint - title: >- - SupplierEndpoint message to hold service configuration - details - title: List of endpoints for the service - title: >- - SupplierServiceConfig holds the service configuration the - supplier stakes for - title: The service configs this supplier can support - description: >- - Supplier is the type defining the actor in Pocket Network that - provides RPC services. - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + gets reset + title: >- + Height is a monotonically increasing data type - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. + that can be compared against another Height for the purposes of + updating and - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - pocket.supplier.QueryGetClaimResponse: - type: object - properties: - claim: - type: object - properties: - supplier_address: - type: string - title: the address of the supplier that submitted this claim - session_header: - description: The session header of the session that this claim is for. - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that - identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of the - service is necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values using - on-chain but is included in the header for convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the last block - of the session - root_hash: - type: string - format: byte - description: Root hash returned from smt.SMST#Root(). + freezing clients + signer: + type: string + host_consensus_state_proof: + type: string + format: byte title: >- - Claim is the serialized object stored on-chain for claims pending to - be proven - pocket.supplier.QueryGetProofResponse: + optional proof data for host state machines that are unable to + introspect their own consensus state + description: |- + MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a + connection on Chain B. + ibc.core.connection.v1.MsgConnectionOpenTryResponse: type: object - properties: - proof: - type: object - properties: - supplier_address: - type: string - session_header: - description: The session header of the session that this claim is for. - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that - identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of the - service is necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values using - on-chain but is included in the header for convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the last block - of the session - closest_merkle_proof: - type: string - format: byte - description: The serialized SMST proof from the `#ClosestProof()` method. - pocket.supplier.QueryGetSupplierResponse: + description: >- + MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response + type. + ibc.core.connection.v1.MsgUpdateParams: type: object properties: - supplier: + signer: + type: string + title: signer address + params: + description: |- + params defines the connection parameters to update. + + NOTE: All parameters must be supplied. type: object properties: - address: + max_expected_time_per_block: type: string - title: >- - The Bech32 address of the supplier using cosmos' ScalarDescriptor - to ensure deterministic encoding - stake: - title: The total amount of uPOKT the supplier has staked - type: object - properties: - denom: - type: string - amount: - type: string + format: uint64 description: >- - Coin defines a token with a denomination and an amount. - + maximum expected time per block (in nanoseconds), used to enforce + block delay. This parameter should reflect the - NOTE: The amount field is an Int which implements the custom - method + largest amount of time that the chain might reasonably take to + produce the next block under normal operating - signatures required by gogoproto. - services: - type: array - items: - type: object - properties: - service: - title: The Service for which the supplier is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that - identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of the - service is necessary - endpoints: - type: array - items: - type: object - properties: - url: - type: string - title: URL of the endpoint - rpc_type: - title: Type of RPC exposed on the url above - type: string - enum: - - UNKNOWN_RPC - - GRPC - - WEBSOCKET - - JSON_RPC - - REST - default: UNKNOWN_RPC - description: |- - - UNKNOWN_RPC: Undefined RPC type - - GRPC: gRPC - - WEBSOCKET: WebSocket - - JSON_RPC: JSON-RPC - - REST: REST - configs: - type: array - items: - type: object - properties: - key: - title: Config option key - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options - - TODO_RESEARCH: Should these be configs, SLAs or - something else? There will be more discussion - once we get closer to implementing on-chain QoS. - - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - value: - type: string - title: Config option value - title: >- - Key-value wrapper for config options, as proto maps - can't be keyed by enums - title: Additional configuration options for the endpoint - title: >- - SupplierEndpoint message to hold service configuration - details - title: List of endpoints for the service - title: >- - SupplierServiceConfig holds the service configuration the - supplier stakes for - title: The service configs this supplier can support - description: >- - Supplier is the type defining the actor in Pocket Network that - provides RPC services. - pocket.supplier.QueryParamsResponse: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: QueryParamsResponse is response type for the Query/Params RPC method. - pocket.tokenomics.MsgUpdateParamsResponse: - type: object + conditions. A safe choice is 3-5x the expected time per block. description: >- - MsgUpdateParamsResponse defines the response structure for executing a - MsgUpdateParams message. - pocket.tokenomics.Params: + MsgUpdateParams defines the sdk.Msg type to update the connection + parameters. + ibc.core.connection.v1.MsgUpdateParamsResponse: + type: object + description: MsgUpdateParamsResponse defines the MsgUpdateParams response type. + ibc.core.connection.v1.Params: type: object properties: - compute_units_to_tokens_multiplier: + max_expected_time_per_block: type: string format: uint64 description: >- - The amount of upokt that a compute unit should translate to when - settling a session. + maximum expected time per block (in nanoseconds), used to enforce + block delay. This parameter should reflect the - TODO_DOCUMENT(@Olshansk): Make sure to document the units of this - parameter (or the map) once finalized. - description: >- - TODO_DOCUMENT(@Olshansk): Document all of the on-chain governance - parameters. + largest amount of time that the chain might reasonably take to produce + the next block under normal operating - Params defines the parameters for the tokenomics module. - pocket.tokenomics.QueryParamsResponse: + conditions. A safe choice is 3-5x the expected time per block. + description: Params defines the set of Connection parameters. + ibc.core.connection.v1.Version: type: object properties: - params: - description: params defines the parameters of the module. - type: object - properties: - compute_units_to_tokens_multiplier: - type: string - format: uint64 - description: >- - The amount of upokt that a compute unit should translate to when - settling a session. - - TODO_DOCUMENT(@Olshansk): Make sure to document the units of this - parameter (or the map) once finalized. - description: QueryParamsResponse is the response type for the Query/Params RPC method. + identifier: + type: string + title: unique version identifier + features: + type: array + items: + type: string + title: list of features compatible with the specified identifier + description: |- + Version defines the versioning scheme used to negotiate the IBC verison in + the connection handshake. diff --git a/docs/template/pkg/README.md b/docs/template/pkg/README.md deleted file mode 100644 index 10fdc2755..000000000 --- a/docs/template/pkg/README.md +++ /dev/null @@ -1,88 +0,0 @@ -# Package [PackageName] - -> Brief one-liner or quote about what this package does. - -## Overview - -Provide a few sentences about the purpose and functionality of this package. Consider: -- What problems does it solve? -- Why would someone use this package as opposed to others or implementing their own solution? -- Any unique features or aspects that stand out. - -## Architecture Diagrams - -Visual representations often make it easier to understand the design and flow of a package. Below are the architecture diagrams that explain the high-level structure and interactions in this package: - -```mermaid ---- -title: Architecture Overview ---- -flowchart -``` - -> **Figure 1**: Brief description about what this diagram represents. - -```mermaid ---- -title: Another Diagram ---- -flowchart -``` - -> **Figure 2**: Brief description about what this other diagram represents. - -If you have multiple diagrams, you can explain each one separately or provide a list. - -## Installation - -```bash -go get github.com/yourusername/yourproject/[PackageName] -``` - -## Features - -- **Feature 1**: A brief description. -- **Feature 2**: Another description. -- ... - -## Usage - -### Basic Example - -```go -// A simple and concise code example showing the most common use case. -``` - -### Advanced Usage - -For complex features or functionalities, it's good to have a separate section: - -```go -// Advanced code example or usage. -``` - -### Configuration - -If the package can be configured in some way, describe it here: - -- **Config Option 1**: Explanation. -- **Config Option 2**: Explanation. - -## API Reference - -For the complete API details, see the [godoc](https://pkg.go.dev/github.com/pokt-network/poktroll/[PackageName]). - -## Best Practices - -- **Practice 1**: Description and rationale. -- **Practice 2**: Another helpful practice. - -## FAQ - -#### Question 1? - -Answer for question 1. - -#### Question 2? - -Answer for question 2. \ No newline at end of file diff --git a/e2e/tests/help.feature b/e2e/tests/help.feature deleted file mode 100644 index 7d0867f99..000000000 --- a/e2e/tests/help.feature +++ /dev/null @@ -1,7 +0,0 @@ -Feature: Root Namespace - - Scenario: User Needs Help - Given the user has the pocketd binary installed - When the user runs the command "help" - Then the user should be able to see standard output containing "Available Commands" - And the pocketd binary should exit without error diff --git a/e2e/tests/init_test.go b/e2e/tests/init_test.go deleted file mode 100644 index c97017c2c..000000000 --- a/e2e/tests/init_test.go +++ /dev/null @@ -1,421 +0,0 @@ -//go:build e2e - -package e2e - -import ( - "flag" - "fmt" - "io/ioutil" - "log" - "os" - "regexp" - "strconv" - "strings" - "testing" - "time" - - tmcli "github.com/cometbft/cometbft/libs/cli" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/pokt-network/poktroll/app" - "github.com/pokt-network/poktroll/testutil/testclient" - apptypes "github.com/pokt-network/poktroll/x/application/types" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" - "github.com/regen-network/gocuke" - "github.com/stretchr/testify/require" -) - -var ( - addrRe *regexp.Regexp - amountRe *regexp.Regexp - - accNameToAddrMap = make(map[string]string) - accAddrToNameMap = make(map[string]string) - accNameToAppMap = make(map[string]apptypes.Application) - accNameToSupplierMap = make(map[string]sharedtypes.Supplier) - - flagFeaturesPath string - keyRingFlag = "--keyring-backend=test" - appGateServerUrl = "http://localhost:42069" // Keeping localhost by default because that is how we run the tests on our machines locally -) - -func init() { - addrRe = regexp.MustCompile(`address:\s+(\S+)\s+name:\s+(\S+)`) - amountRe = regexp.MustCompile(`amount:\s+"(.+?)"\s+denom:\s+upokt`) - - flag.StringVar(&flagFeaturesPath, "features-path", "*.feature", "Specifies glob paths for the runner to look up .feature files") - - // If "APPGATE_SERVER_URL" envar is present, use it for appGateServerUrl - if url := os.Getenv("APPGATE_SERVER_URL"); url != "" { - appGateServerUrl = url - } -} - -func TestMain(m *testing.M) { - flag.Parse() - log.Printf("features path: %s", flagFeaturesPath) - m.Run() -} - -type suite struct { - gocuke.TestingT - // TODO_TECHDEBT: rename to `poktrolld`. - pocketd *pocketdBin - scenarioState map[string]any // temporary state for each scenario - cdc codec.Codec - supplierQueryClient suppliertypes.QueryClient -} - -func (s *suite) Before() { - s.pocketd = new(pocketdBin) - s.scenarioState = make(map[string]any) - s.cdc = app.MakeEncodingConfig().Marshaler - s.buildAddrMap() - s.buildAppMap() - s.buildSupplierMap() - - flagSet := testclient.NewLocalnetFlagSet(s) - clientCtx := testclient.NewLocalnetClientCtx(s, flagSet) - s.supplierQueryClient = suppliertypes.NewQueryClient(clientCtx) -} - -// TestFeatures runs the e2e tests specified in any .features files in this directory -// * This test suite assumes that a LocalNet is running -func TestFeatures(t *testing.T) { - gocuke.NewRunner(t, &suite{}).Path(flagFeaturesPath).Run() -} - -// TODO_TECHDEBT: rename `pocketd` to `poktrolld`. -func (s *suite) TheUserHasThePocketdBinaryInstalled() { - s.TheUserRunsTheCommand("help") -} - -func (s *suite) ThePocketdBinaryShouldExitWithoutError() { - require.NoError(s, s.pocketd.result.Err) -} - -func (s *suite) TheUserRunsTheCommand(cmd string) { - cmds := strings.Split(cmd, " ") - res, err := s.pocketd.RunCommand(cmds...) - s.pocketd.result = res - if err != nil { - s.Fatalf("error running command %s: %s", cmd, err) - } -} - -func (s *suite) TheUserShouldBeAbleToSeeStandardOutputContaining(arg1 string) { - if !strings.Contains(s.pocketd.result.Stdout, arg1) { - s.Fatalf("stdout must contain %s", arg1) - } -} - -func (s *suite) TheUserSendsUpoktFromAccountToAccount(amount int64, accName1, accName2 string) { - args := []string{ - "tx", - "bank", - "send", - accNameToAddrMap[accName1], - accNameToAddrMap[accName2], - fmt.Sprintf("%dupokt", amount), - keyRingFlag, - "-y", - } - res, err := s.pocketd.RunCommandOnHost("", args...) - if err != nil { - s.Fatalf("error sending upokt: %s", err) - } - s.pocketd.result = res -} - -func (s *suite) TheAccountHasABalanceGreaterThanUpokt(accName string, amount int64) { - bal := s.getAccBalance(accName) - if int64(bal) < amount { - s.Fatalf("account %s does not have enough upokt: %d < %d", accName, bal, amount) - } - s.scenarioState[accName] = bal // save the balance for later -} - -func (s *suite) AnAccountExistsFor(accName string) { - bal := s.getAccBalance(accName) - s.scenarioState[accName] = bal // save the balance for later -} - -func (s *suite) TheAccountBalanceOfShouldBeUpoktThanBefore(accName string, amount int64, condition string) { - prev, ok := s.scenarioState[accName] - if !ok { - s.Fatalf("no previous balance found for %s", accName) - } - - bal := s.getAccBalance(accName) - switch condition { - case "more": - if bal <= prev.(int) { - s.Fatalf("account %s expected to have more upokt but: %d <= %d", accName, bal, prev) - } - case "less": - if bal >= prev.(int) { - s.Fatalf("account %s expected to have less upokt but: %d >= %d", accName, bal, prev) - } - default: - s.Fatalf("unknown condition %s", condition) - } -} - -func (s *suite) TheUserShouldWaitForSeconds(dur int64) { - time.Sleep(time.Duration(dur) * time.Second) -} - -func (s *suite) TheUserStakesAWithUpoktFromTheAccount(actorType string, amount int64, accName string) { - // Create a temporary config file - configPathPattern := fmt.Sprintf("%s_stake_config_*.yaml", accName) - configContent := fmt.Sprintf(`stake_amount: %d upokt`, amount) - configFile, err := ioutil.TempFile("", configPathPattern) - if err != nil { - s.Fatalf("error creating config file: %q", err) - } - if _, err = configFile.Write([]byte(configContent)); err != nil { - s.Fatalf("error writing config file: %q", err) - } - - args := []string{ - "tx", - actorType, - fmt.Sprintf("stake-%s", actorType), - "--config", - configFile.Name(), - "--from", - accName, - keyRingFlag, - "-y", - } - res, err := s.pocketd.RunCommandOnHost("", args...) - - // Remove the temporary config file - err = os.Remove(configFile.Name()) - if err != nil { - s.Fatalf("error removing config file: %q", err) - } - - if err != nil { - s.Fatalf("error staking %s: %s", actorType, err) - } - s.pocketd.result = res -} - -func (s *suite) TheUserUnstakesAFromTheAccount(actorType string, accName string) { - args := []string{ - "tx", - actorType, - fmt.Sprintf("unstake-%s", actorType), - "--from", - accName, - keyRingFlag, - "-y", - } - res, err := s.pocketd.RunCommandOnHost("", args...) - if err != nil { - s.Fatalf("error unstaking %s: %s", actorType, err) - } - s.pocketd.result = res -} - -func (s *suite) TheForAccountIsNotStaked(actorType, accName string) { - found, _ := s.getStakedAmount(actorType, accName) - if found { - s.Fatalf("account %s should not be staked", accName) - } -} - -func (s *suite) TheForAccountIsStakedWithUpokt(actorType, accName string, amount int64) { - found, stakeAmount := s.getStakedAmount(actorType, accName) - if !found { - s.Fatalf("account %s should be staked", accName) - } - if int64(stakeAmount) != amount { - s.Fatalf("account %s stake amount is not %d", accName, amount) - } -} - -func (s *suite) TheApplicationIsStakedForService(appName string, serviceId string) { - for _, serviceConfig := range accNameToAppMap[appName].ServiceConfigs { - if serviceConfig.Service.Id == serviceId { - return - } - } - s.Fatalf("application %s is not staked for service %s", appName, serviceId) -} - -func (s *suite) TheSupplierIsStakedForService(supplierName string, serviceId string) { - for _, serviceConfig := range accNameToSupplierMap[supplierName].Services { - if serviceConfig.Service.Id == serviceId { - return - } - } - s.Fatalf("supplier %s is not staked for service %s", supplierName, serviceId) -} - -func (s *suite) TheSessionForApplicationAndServiceContainsTheSupplier(appName string, serviceId string, supplierName string) { - app, found := accNameToAppMap[appName] - if !found { - s.Fatalf("application %s not found", appName) - } - expectedSupplier, found := accNameToSupplierMap[supplierName] - if !found { - s.Fatalf("supplier %s not found", supplierName) - } - argsAndFlags := []string{ - "query", - "session", - "get-session", - app.Address, - serviceId, - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - res, err := s.pocketd.RunCommandOnHost("", argsAndFlags...) - if err != nil { - s.Fatalf("error getting session for app %s and service %s: %s", appName, serviceId, err) - } - var resp sessiontypes.QueryGetSessionResponse - responseBz := []byte(strings.TrimSpace(res.Stdout)) - s.cdc.MustUnmarshalJSON(responseBz, &resp) - for _, supplier := range resp.Session.Suppliers { - if supplier.Address == expectedSupplier.Address { - return - } - } - s.Fatalf("session for app %s and service %s does not contain supplier %s", appName, serviceId, supplierName) -} - -func (s *suite) TheApplicationSendsTheSupplierARequestForServiceWithData(appName, supplierName, serviceId, requestData string) { - res, err := s.pocketd.RunCurl(appGateServerUrl, serviceId, requestData) - if err != nil { - s.Fatalf("error sending relay request from app %s to supplier %s for service %s: %v", appName, supplierName, serviceId, err) - } - - relayKey := relayReferenceKey(appName, supplierName) - s.scenarioState[relayKey] = res.Stdout -} - -func (s *suite) TheApplicationReceivesASuccessfulRelayResponseSignedBy(appName string, supplierName string) { - relayKey := relayReferenceKey(appName, supplierName) - stdout, ok := s.scenarioState[relayKey] - - require.Truef(s, ok, "no relay response found for %s", relayKey) - require.Contains(s, stdout, `"result":"0x`) -} - -func (s *suite) getStakedAmount(actorType, accName string) (bool, int) { - s.Helper() - args := []string{ - "query", - actorType, - fmt.Sprintf("list-%s", actorType), - } - res, err := s.pocketd.RunCommandOnHost("", args...) - if err != nil { - s.Fatalf("error getting %s: %s", actorType, err) - } - s.pocketd.result = res - found := strings.Contains(res.Stdout, accNameToAddrMap[accName]) - amount := 0 - if found { - escapedAddress := regexp.QuoteMeta(accNameToAddrMap[accName]) - stakedAmountRe := regexp.MustCompile(`address: ` + escapedAddress + `\s+stake:\s+amount: "(\d+)"`) - matches := stakedAmountRe.FindStringSubmatch(res.Stdout) - if len(matches) < 2 { - s.Fatalf("no stake amount found for %s", accName) - } - amount, err = strconv.Atoi(matches[1]) - require.NoError(s, err) - } - return found, amount -} - -func (s *suite) buildAddrMap() { - s.Helper() - res, err := s.pocketd.RunCommand( - "keys", "list", keyRingFlag, - ) - if err != nil { - s.Fatalf("error getting keys: %s", err) - } - s.pocketd.result = res - matches := addrRe.FindAllStringSubmatch(res.Stdout, -1) - for _, match := range matches { - name := match[2] - address := match[1] - accNameToAddrMap[name] = address - accAddrToNameMap[address] = name - } -} - -func (s *suite) buildAppMap() { - s.Helper() - argsAndFlags := []string{ - "query", - "application", - "list-application", - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - res, err := s.pocketd.RunCommandOnHost("", argsAndFlags...) - if err != nil { - s.Fatalf("error getting application list: %s", err) - } - s.pocketd.result = res - var resp apptypes.QueryAllApplicationResponse - responseBz := []byte(strings.TrimSpace(res.Stdout)) - s.cdc.MustUnmarshalJSON(responseBz, &resp) - for _, app := range resp.Application { - accNameToAppMap[accAddrToNameMap[app.Address]] = app - } -} - -func (s *suite) buildSupplierMap() { - s.Helper() - argsAndFlags := []string{ - "query", - "supplier", - "list-supplier", - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - res, err := s.pocketd.RunCommandOnHost("", argsAndFlags...) - if err != nil { - s.Fatalf("error getting supplier list: %s", err) - } - s.pocketd.result = res - var resp suppliertypes.QueryAllSupplierResponse - responseBz := []byte(strings.TrimSpace(res.Stdout)) - s.cdc.MustUnmarshalJSON(responseBz, &resp) - for _, supplier := range resp.Supplier { - accNameToSupplierMap[accAddrToNameMap[supplier.Address]] = supplier - } -} - -func (s *suite) getAccBalance(accName string) int { - s.Helper() - args := []string{ - "query", - "bank", - "balances", - accNameToAddrMap[accName], - } - res, err := s.pocketd.RunCommandOnHost("", args...) - if err != nil { - s.Fatalf("error getting balance: %s", err) - } - s.pocketd.result = res - match := amountRe.FindStringSubmatch(res.Stdout) - if len(match) < 2 { - s.Fatalf("no balance found for %s", accName) - } - found, err := strconv.Atoi(match[1]) - require.NoError(s, err) - return found -} - -// TODO_IMPROVE: use `sessionId` and `supplierName` since those are the two values -// used to create the primary composite key on-chain to uniquely distinguish relays. -func relayReferenceKey(appName, supplierName string) string { - return fmt.Sprintf("%s/%s", appName, supplierName) -} diff --git a/e2e/tests/node.go b/e2e/tests/node.go deleted file mode 100644 index 5bf187556..000000000 --- a/e2e/tests/node.go +++ /dev/null @@ -1,154 +0,0 @@ -//go:build e2e - -package e2e - -import ( - "bytes" - "fmt" - "os" - "os/exec" - "strings" -) - -// TODO_TECHDEBT(https://github.com/ignite/cli/issues/3737): We're using a combination -// of `pocketd` (legacy) and `poktrolld` (current) because of an issue of how ignite works. -var ( - // defaultRPCURL used by pocketdBin to run remote commands - defaultRPCURL = os.Getenv("POCKET_NODE") - // defaultRPCPort is the default RPC port that pocketd listens on - defaultRPCPort = 36657 - // defaultRPCHost is the default RPC host that pocketd listens on - defaultRPCHost = "127.0.0.1" - // defaultHome is the default home directory for pocketd - defaultHome = os.Getenv("POKTROLLD_HOME") - // defaultAppGateServerURL used by curl commands to send relay requests - defaultAppGateServerURL = os.Getenv("APPGATE_SERVER") - // defaultDebugOutput provides verbose output on manipulations with binaries (cli command, stdout, stderr) - defaultDebugOutput = os.Getenv("E2E_DEBUG_OUTPUT") -) - -func init() { - if defaultRPCURL == "" { - defaultRPCURL = fmt.Sprintf("tcp://%s:%d", defaultRPCHost, defaultRPCPort) - } - if defaultHome == "" { - defaultHome = "../../localnet/poktrolld" - } -} - -// commandResult combines the stdout, stderr, and err of an operation -type commandResult struct { - Command string // the command that was executed - Stdout string // standard output - Stderr string // standard error - Err error // execution error, if any -} - -// PocketClient is a single function interface for interacting with a node -type PocketClient interface { - RunCommand(args ...string) (*commandResult, error) - RunCommandOnHost(rpcUrl string, args ...string) (*commandResult, error) - RunCurl(rpcUrl, service, data string, args ...string) (*commandResult, error) -} - -// Ensure that pocketdBin struct fulfills PocketClient -var _ PocketClient = (*pocketdBin)(nil) - -// pocketdBin holds the reults of the last command that was run -type pocketdBin struct { - result *commandResult // stores the result of the last command that was run -} - -// RunCommand runs a command on the local machine using the pocketd binary -func (p *pocketdBin) RunCommand(args ...string) (*commandResult, error) { - return p.runPocketCmd(args...) -} - -// RunCommandOnHost runs a command on specified host with the given args -func (p *pocketdBin) RunCommandOnHost(rpcUrl string, args ...string) (*commandResult, error) { - if rpcUrl == "" { - rpcUrl = defaultRPCURL - } - args = append(args, "--node", rpcUrl) - return p.runPocketCmd(args...) -} - -// RunCurl runs a curl command on the local machine -func (p *pocketdBin) RunCurl(rpcUrl, service, data string, args ...string) (*commandResult, error) { - if rpcUrl == "" { - rpcUrl = defaultAppGateServerURL - } - return p.runCurlPostCmd(rpcUrl, service, data, args...) -} - -// runPocketCmd is a helper to run a command using the local pocketd binary with the flags provided -func (p *pocketdBin) runPocketCmd(args ...string) (*commandResult, error) { - base := []string{"--home", defaultHome} - args = append(base, args...) - commandStr := "poktrolld " + strings.Join(args, " ") // Create a string representation of the command - cmd := exec.Command("poktrolld", args...) - - var stdoutBuf, stderrBuf bytes.Buffer - cmd.Stdout = &stdoutBuf - cmd.Stderr = &stderrBuf - - err := cmd.Run() - r := &commandResult{ - Command: commandStr, // Set the command string - Stdout: stdoutBuf.String(), - Stderr: stderrBuf.String(), - Err: err, - } - p.result = r - - if err != nil { - // Include the command executed in the error message for context - err = fmt.Errorf("error running command [%s]: %v, stderr: %s", commandStr, err, stderrBuf.String()) - } - - if defaultDebugOutput == "true" { - fmt.Printf("%#v\n", r) - } - - return r, err -} - -// runCurlPostCmd is a helper to run a command using the local pocketd binary with the flags provided -func (p *pocketdBin) runCurlPostCmd(rpcUrl string, service string, data string, args ...string) (*commandResult, error) { - dataStr := fmt.Sprintf("%s", data) - urlStr := fmt.Sprintf("%s/%s", rpcUrl, service) - base := []string{ - "-v", // verbose output - "-sS", // silent with error - "-X", "POST", // HTTP method - "-H", "Content-Type: application/json", // HTTP headers - "--data", dataStr, urlStr, // POST data - } - args = append(base, args...) - commandStr := "curl " + strings.Join(args, " ") // Create a string representation of the command - cmd := exec.Command("curl", args...) - - var stdoutBuf, stderrBuf bytes.Buffer - cmd.Stdout = &stdoutBuf - cmd.Stderr = &stderrBuf - - err := cmd.Run() - r := &commandResult{ - Command: commandStr, // Set the command string - Stdout: stdoutBuf.String(), - Stderr: stderrBuf.String(), - Err: err, - } - p.result = r - - if defaultDebugOutput == "true" { - fmt.Printf("%#v\n", r) - } - - if err != nil { - // Include the command executed in the error message for context - err = fmt.Errorf("error running command [%s]: %v, stderr: %s", commandStr, err, stderrBuf.String()) - } - - return r, err -} diff --git a/e2e/tests/relay.feature b/e2e/tests/relay.feature deleted file mode 100644 index 32f965bb9..000000000 --- a/e2e/tests/relay.feature +++ /dev/null @@ -1,21 +0,0 @@ -Feature: Relay Namespace - - # TODO_TECHDEBT(@Olshansk, #180): This test requires you to run `make supplier1_stake && make app1_stake` first - # As a shorter workaround, we can also add steps that stake the application and supplier as part of the scenario. - Scenario: App can send relay to Supplier - Given the user has the pocketd binary installed - And the application "app1" is staked for service "anvil" - And the supplier "supplier1" is staked for service "anvil" - And the session for application "app1" and service "anvil" contains the supplier "supplier1" - When the application "app1" sends the supplier "supplier1" a request for service "anvil" with data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' - Then the application "app1" receives a successful relay response signed by "supplier1" - - # TODO_TEST(@Olshansk): - # - Successful relay if using a gateway to proxy the relay - # - Succeedful relays when using multiple suppliers for app in some session - # - Successful deduction of app's balance after claim & proof lifecycle (requires querying claims, proofs, session start/end) - # - Successful inflatino of supplier's balance after claim & proof lifecycle (requires querying claims, proofs, session start/end) - # - Error if app1 is not staked for svc1 but relay is sent - # - Error if supplier is not staked for svc1 but relay is sent - # - Error if claiming the session too early - # - Error if proving the session too early \ No newline at end of file diff --git a/e2e/tests/send.feature b/e2e/tests/send.feature deleted file mode 100644 index 4df818bf2..000000000 --- a/e2e/tests/send.feature +++ /dev/null @@ -1,13 +0,0 @@ -Feature: Tx Namespace - - Scenario: User can send uPOKT - Given the user has the pocketd binary installed - And the account "app1" has a balance greater than "1000" uPOKT - And an account exists for "app2" - When the user sends "1000" uPOKT from account "app1" to account "app2" - Then the user should be able to see standard output containing "txhash:" - And the user should be able to see standard output containing "code: 0" - And the pocketd binary should exit without error - And the user should wait for "5" seconds - And the account balance of "app1" should be "1000" uPOKT "less" than before - And the account balance of "app2" should be "1000" uPOKT "more" than before diff --git a/e2e/tests/session.feature b/e2e/tests/session.feature deleted file mode 100644 index 3163eb471..000000000 --- a/e2e/tests/session.feature +++ /dev/null @@ -1,10 +0,0 @@ -Feature: Session Namespace - - Scenario: Supplier completes claim/proof lifecycle for a valid session - Given the user has the pocketd binary installed - When the supplier "supplier1" has serviced a session with "5" relays for service "svc1" for application "app1" - And after the supplier creates a claim for the session for service "svc1" for application "app1" - Then the claim created by supplier "supplier1" for service "svc1" for application "app1" should be persisted on-chain -# TODO_IMPROVE: ... -# And an event should be emitted... -# TODO_INCOMPLETE: add step(s) for proof validation. diff --git a/e2e/tests/session_steps_test.go b/e2e/tests/session_steps_test.go deleted file mode 100644 index 96248e243..000000000 --- a/e2e/tests/session_steps_test.go +++ /dev/null @@ -1,165 +0,0 @@ -//go:build e2e - -package e2e - -import ( - "context" - "encoding/json" - "fmt" - "strconv" - "strings" - "time" - - abci "github.com/cometbft/cometbft/abci/types" - "github.com/pokt-network/poktroll/pkg/client/events" - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/testutil/testclient" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" - "github.com/stretchr/testify/require" -) - -const ( - createClaimTimeoutDuration = 10 * time.Second - eitherEventsReplayBufferSize = 100 - msgClaimSenderQueryFmt = "tm.event='Tx' AND message.sender='%s' AND message.action='/pocket.supplier.MsgCreateClaim'" - testServiceId = "anvil" - eitherEventsBzReplayObsKey = "eitherEventsBzReplayObsKey" - preExistingClaimsKey = "preExistingClaimsKey" -) - -func (s *suite) AfterTheSupplierCreatesAClaimForTheSessionForServiceForApplication(serviceId, appName string) { - ctx, done := context.WithCancel(context.Background()) - - // TODO_CONSIDERATION: if this test suite gets more complex, it might make - // sense to refactor this key into a function that takes serviceId and appName - // as arguments and returns the key. - eitherEventsBzReplayObs := s.scenarioState[eitherEventsBzReplayObsKey].(observable.ReplayObservable[either.Bytes]) - - // TODO(#220): refactor to use EventsReplayClient once available. - channel.ForEach[either.Bytes]( - ctx, eitherEventsBzReplayObs, - func(_ context.Context, eitherEventBz either.Bytes) { - eventBz, err := eitherEventBz.ValueOrError() - require.NoError(s, err) - - if strings.Contains(string(eventBz), "jsonrpc") { - return - } - - // Unmarshal event data into a TxEventResponse object. - txEvent := &abci.TxResult{} - err = json.Unmarshal(eventBz, txEvent) - require.NoError(s, err) - - var found bool - for _, event := range txEvent.Result.Events { - for _, attribute := range event.Attributes { - if attribute.Key == "action" { - require.Equal( - s, "/pocket.supplier.MsgCreateClaim", - attribute.Value, - ) - found = true - break - } - } - if found { - break - } - } - require.Truef(s, found, "unable to find event action attribute") - - done() - }, - ) - - select { - case <-ctx.Done(): - case <-time.After(createClaimTimeoutDuration): - s.Fatal("timed out waiting for claim to be created") - } -} - -func (s *suite) TheClaimCreatedBySupplierForServiceForApplicationShouldBePersistedOnchain(supplierName, serviceId, appName string) { - ctx := context.Background() - - allClaimsRes, err := s.supplierQueryClient.AllClaims(ctx, &suppliertypes.QueryAllClaimsRequest{ - Filter: &suppliertypes.QueryAllClaimsRequest_SupplierAddress{ - SupplierAddress: accNameToAddrMap[supplierName], - }, - }) - require.NoError(s, err) - require.NotNil(s, allClaimsRes) - - // Assert that the number of claims has increased by one. - preExistingClaims := s.scenarioState[preExistingClaimsKey].([]suppliertypes.Claim) - // NB: We are avoiding the use of require.Len here because it provides unreadable output - // TODO_TECHDEBT: Due to the speed of the blocks of the LocalNet sequencer, along with the small number - // of blocks per session, multiple claims may be created throughout the duration of the test. Until - // these values are appropriately adjusted - require.Greater(s, len(allClaimsRes.Claim), len(preExistingClaims), "number of claims must have increased") - - // TODO_IMPROVE: assert that the root hash of the claim contains the correct - // SMST sum. The sum can be retrieved by parsing the last 8 bytes as a - // binary-encoded uint64; e.g. something like: - // `binary.Uvarint(claim.RootHash[len(claim.RootHash-8):])` - - // TODO_IMPROVE: add assertions about serviceId and appName and/or incorporate - // them into the scenarioState key(s). - - claim := allClaimsRes.Claim[0] - require.Equal(s, accNameToAddrMap[supplierName], claim.SupplierAddress) -} - -func (s *suite) TheSupplierHasServicedASessionWithRelaysForServiceForApplication(supplierName, relayCountStr, serviceId, appName string) { - ctx := context.Background() - - relayCount, err := strconv.Atoi(relayCountStr) - require.NoError(s, err) - - // Query for any existing claims so that we can compensate for them in the - // future assertions about changes in on-chain claims. - allClaimsRes, err := s.supplierQueryClient.AllClaims(ctx, &suppliertypes.QueryAllClaimsRequest{}) - require.NoError(s, err) - s.scenarioState[preExistingClaimsKey] = allClaimsRes.Claim - - // Construct an events query client to listen for tx events from the supplier. - msgSenderQuery := fmt.Sprintf(msgClaimSenderQueryFmt, accNameToAddrMap[supplierName]) - - // TODO_TECHDEBT(#220): refactor to use EventsReplayClient once available. - eventsQueryClient := events.NewEventsQueryClient(testclient.CometLocalWebsocketURL) - eitherEventsBzObs, err := eventsQueryClient.EventsBytes(ctx, msgSenderQuery) - require.NoError(s, err) - - eitherEventsBytesObs := observable.Observable[either.Bytes](eitherEventsBzObs) - eitherEventsBzRelayObs := channel.ToReplayObservable(ctx, eitherEventsReplayBufferSize, eitherEventsBytesObs) - s.scenarioState[eitherEventsBzReplayObsKey] = eitherEventsBzRelayObs - - s.sendRelaysForSession( - appName, - supplierName, - testServiceId, - relayCount, - ) -} - -func (s *suite) sendRelaysForSession( - appName string, - supplierName string, - serviceId string, - relayLimit int, -) { - s.TheApplicationIsStakedForService(appName, serviceId) - s.TheSupplierIsStakedForService(supplierName, serviceId) - s.TheSessionForApplicationAndServiceContainsTheSupplier(appName, serviceId, supplierName) - - // TODO_IMPROVE/TODO_COMMUNITY: hard-code a default set of RPC calls to iterate over for coverage. - data := `{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}` - - for i := 0; i < relayLimit; i++ { - s.TheApplicationSendsTheSupplierARequestForServiceWithData(appName, supplierName, serviceId, data) - s.TheApplicationReceivesASuccessfulRelayResponseSignedBy(appName, supplierName) - } -} diff --git a/e2e/tests/stake.feature b/e2e/tests/stake.feature deleted file mode 100644 index 1171ef3d6..000000000 --- a/e2e/tests/stake.feature +++ /dev/null @@ -1,25 +0,0 @@ -Feature: Stake Namespaces - - Scenario: User can stake a Gateway - Given the user has the pocketd binary installed - And the "gateway" for account "gateway1" is not staked - And the account "gateway1" has a balance greater than "1000" uPOKT - When the user stakes a "gateway" with "1000" uPOKT from the account "gateway1" - Then the user should be able to see standard output containing "txhash:" - And the user should be able to see standard output containing "code: 0" - And the pocketd binary should exit without error - And the user should wait for "5" seconds - And the "gateway" for account "gateway1" is staked with "1000" uPOKT - And the account balance of "gateway1" should be "1000" uPOKT "less" than before - - Scenario: User can unstake a Gateway - Given the user has the pocketd binary installed - And the "gateway" for account "gateway1" is staked with "1000" uPOKT - And an account exists for "gateway1" - When the user unstakes a "gateway" from the account "gateway1" - Then the user should be able to see standard output containing "txhash:" - And the user should be able to see standard output containing "code: 0" - And the pocketd binary should exit without error - And the user should wait for "5" seconds - And the "gateway" for account "gateway1" is not staked - And the account balance of "gateway1" should be "1000" uPOKT "more" than before diff --git a/go.mod b/go.mod index 374e41d8e..5ad018f52 100644 --- a/go.mod +++ b/go.mod @@ -1,178 +1,190 @@ -// NB: Since this repostiory was scaffolded using `ignite s chain pocket` -// but the module was later renamed to github.com/pokt-network/poktroll, we -// need to swap the two lines below only during the scaffolding operation. -// NOTE that the operation is expected to error out but all the necesary -// types and functions will be scaffolded correctly. -// Ref: https://github.com/ignite/cli/issues/3737 -// -// The following will need to be done manually after the scaffold: -// - Reverting the module name in go.mod (this file) -// - Manually updating imports in .go files: "pocket/x/" => "github.com/pokt-network/pocket/x/" -// - Manually `option go_package` in .proto files: `option go_package = "pocket` => `option go_package = "github.com/pokt-network/poktroll` -// - If an empty `service Msg {}` is generated in a `tx.proto` file, remove it - -// module pocket module github.com/pokt-network/poktroll -go 1.20 +go 1.21.1 + +toolchain go1.21.6 + +replace ( + // fix upstream GHSA-h395-qcrw-5vmq vulnerability. + github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0 + // replace broken goleveldb + github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 +) require ( - cosmossdk.io/api v0.3.1 + cosmossdk.io/api v0.7.2 + cosmossdk.io/client/v2 v2.0.0-beta.1 + cosmossdk.io/core v0.11.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 - cosmossdk.io/math v1.1.2 - github.com/athanorlabs/go-dleq v0.1.0 - github.com/cometbft/cometbft v0.37.2 - github.com/cometbft/cometbft-db v0.8.0 - github.com/cosmos/cosmos-sdk v0.47.5 + cosmossdk.io/log v1.2.1 + cosmossdk.io/math v1.2.0 + cosmossdk.io/store v1.0.1 + cosmossdk.io/tools/confix v0.1.1 + cosmossdk.io/x/circuit v0.1.0 + cosmossdk.io/x/evidence v0.1.0 + cosmossdk.io/x/feegrant v0.1.0 + cosmossdk.io/x/upgrade v0.1.1 + github.com/bufbuild/buf v1.29.0 + github.com/cometbft/cometbft v0.38.2 + github.com/cosmos/cosmos-db v1.0.0 + github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-sdk v0.50.2 github.com/cosmos/gogoproto v1.4.11 - github.com/cosmos/ibc-go/v7 v7.3.1 - github.com/gogo/status v1.1.1 + github.com/cosmos/ibc-go/modules/capability v1.0.0 + github.com/cosmos/ibc-go/v8 v8.0.0 github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.3 - github.com/gorilla/mux v1.8.0 - github.com/gorilla/websocket v1.5.0 + github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 - github.com/noot/ring-go v0.0.0-20231019173746-6c4b33bcf03f - github.com/pokt-network/smt v0.9.2 - github.com/pokt-network/smt/kvstore/badger v0.0.0-20240104123447-abb5c71c14ce - github.com/regen-network/gocuke v0.6.2 - github.com/rs/zerolog v1.30.0 - github.com/spf13/cast v1.5.1 - github.com/spf13/cobra v1.7.0 + github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 + github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 + github.com/spf13/viper v1.18.2 github.com/stretchr/testify v1.8.4 - go.uber.org/multierr v1.11.0 - golang.org/x/crypto v0.15.0 - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 - golang.org/x/sync v0.5.0 - google.golang.org/grpc v1.59.0 - gopkg.in/yaml.v2 v2.4.0 + golang.org/x/tools v0.17.0 + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 + google.golang.org/protobuf v1.32.0 ) require ( - cloud.google.com/go v0.110.7 // indirect - cloud.google.com/go/compute v1.23.0 // indirect + buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.32.0-20231115204500-e097f827e652.1 // indirect + cloud.google.com/go v0.111.0 // indirect + cloud.google.com/go/compute v1.23.3 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v1.1.1 // indirect - cloud.google.com/go/storage v1.30.1 // indirect - cosmossdk.io/core v0.5.1 // indirect - cosmossdk.io/log v1.2.1 // indirect - cosmossdk.io/tools/rosetta v0.2.1 // indirect + cloud.google.com/go/iam v1.1.5 // indirect + cloud.google.com/go/storage v1.35.1 // indirect + connectrpc.com/connect v1.14.0 // indirect + connectrpc.com/otelconnect v0.7.0 // indirect + cosmossdk.io/collections v0.4.0 // indirect + cosmossdk.io/x/tx v0.12.0 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect - github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect - github.com/alecthomas/participle/v2 v2.0.0-alpha7 // indirect - github.com/armon/go-metrics v0.4.1 // indirect - github.com/aws/aws-sdk-go v1.44.203 // indirect + github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect + github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/antlr4-go/antlr/v4 v4.13.0 // indirect + github.com/aws/aws-sdk-go v1.44.224 // indirect github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect + github.com/bits-and-blooms/bitset v1.8.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect - github.com/celestiaorg/go-fraud v0.2.0 // indirect - github.com/celestiaorg/go-header v0.4.1 // indirect + github.com/bufbuild/protocompile v0.8.0 // indirect + github.com/bufbuild/protovalidate-go v0.5.0 // indirect + github.com/bufbuild/protoyaml-go v0.1.7 // indirect + github.com/celestiaorg/go-header v0.5.1 // indirect github.com/celestiaorg/go-libp2p-messenger v0.2.0 // indirect - github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 // indirect - github.com/celestiaorg/nmt v0.20.0 // indirect - github.com/celestiaorg/rsmt2d v0.11.0 // indirect github.com/celestiaorg/utils v0.1.0 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect - github.com/cockroachdb/apd/v3 v3.1.0 // indirect - github.com/cockroachdb/errors v1.10.0 // indirect + github.com/cockroachdb/errors v1.11.1 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect + github.com/cockroachdb/pebble v0.0.0-20231102162011-844f0582c2eb // indirect github.com/cockroachdb/redact v1.1.5 // indirect - github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect - github.com/confio/ics23/go v0.9.0 // indirect + github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect + github.com/cometbft/cometbft-db v0.9.1 // indirect github.com/containerd/cgroups v1.1.0 // indirect + github.com/containerd/stargz-snapshotter/estargz v0.15.1 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v0.20.0 // indirect + github.com/cosmos/iavl v1.0.0 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect - github.com/cosmos/ledger-cosmos-go v0.12.1 // indirect - github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect - github.com/creachadair/taskgroup v0.6.1 // indirect - github.com/cucumber/common/gherkin/go/v22 v22.0.0 // indirect - github.com/cucumber/common/messages/go/v17 v17.1.1 // indirect - github.com/danieljoos/wincred v1.1.2 // indirect + github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect + github.com/creachadair/atomicfile v0.3.1 // indirect + github.com/creachadair/tomledit v0.0.24 // indirect + github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.4 // indirect - github.com/dgraph-io/badger/v3 v3.2103.5 // indirect - github.com/dgraph-io/badger/v4 v4.2.0 // indirect + github.com/dgraph-io/badger/v4 v4.2.1-0.20231013074411-fb1b00959581 // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect + github.com/distribution/reference v0.5.0 // indirect + github.com/docker/cli v24.0.7+incompatible // indirect + github.com/docker/distribution v2.8.3+incompatible // indirect + github.com/docker/docker v25.0.0+incompatible // indirect + github.com/docker/docker-credential-helpers v0.8.1 // indirect + github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.5.0 // indirect github.com/elastic/gosigar v0.14.2 // indirect - github.com/felixge/httpsnoop v1.0.2 // indirect - github.com/filecoin-project/go-jsonrpc v0.3.1 // indirect + github.com/emicklei/dot v1.6.0 // indirect + github.com/fatih/color v1.15.0 // indirect + github.com/felixge/fgprof v0.9.3 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect github.com/flynn/noise v1.0.0 // indirect github.com/francoispqt/gojay v1.2.13 // indirect - github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/getsentry/sentry-go v0.23.0 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/getsentry/sentry-go v0.25.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect + github.com/go-chi/chi/v5 v5.0.11 // indirect github.com/go-kit/kit v0.13.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect - github.com/gofrs/uuid v4.3.1+incompatible // indirect + github.com/gofrs/uuid/v5 v5.0.0 // indirect github.com/gogo/googleapis v1.4.1 // indirect - github.com/gogo/protobuf v1.3.3 // indirect - github.com/golang/glog v1.1.2 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/glog v1.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect - github.com/google/flatbuffers v2.0.0+incompatible // indirect - github.com/google/go-cmp v0.5.9 // indirect + github.com/google/cel-go v0.19.0 // indirect + github.com/google/flatbuffers v1.12.1 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/google/go-containerregistry v0.18.0 // indirect github.com/google/gopacket v1.1.19 // indirect github.com/google/orderedcode v0.0.1 // indirect - github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b // indirect + github.com/google/pprof v0.0.0-20240117000934-35fc243c5815 // indirect github.com/google/s2a-go v0.1.7 // indirect - github.com/google/uuid v1.3.1 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.3.1 // indirect + github.com/google/uuid v1.4.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.0 // indirect - github.com/gorilla/handlers v1.5.1 // indirect - github.com/gorilla/rpc v1.2.0 // indirect - github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect + github.com/gorilla/handlers v1.5.2 // indirect + github.com/gorilla/rpc v1.2.1 // indirect + github.com/gorilla/websocket v1.5.1 // indirect + github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect - github.com/gtank/merlin v0.1.1 // indirect - github.com/gtank/ristretto255 v0.1.2 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-getter v1.7.1 // indirect + github.com/hashicorp/go-getter v1.7.3 // indirect + github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect + github.com/hashicorp/go-metrics v0.5.2 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-plugin v1.5.2 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect github.com/hashicorp/go-version v1.6.0 // indirect - github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect + github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/golang-lru/v2 v2.0.5 // indirect github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hashicorp/yamux v0.1.1 // indirect github.com/hdevalence/ed25519consensus v0.1.0 // indirect github.com/huandu/skiplist v1.2.0 // indirect github.com/huin/goupnp v1.2.0 // indirect + github.com/iancoleman/strcase v0.3.0 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/ipfs/boxo v0.8.0 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/ipfs/go-datastore v0.6.0 // indirect - github.com/ipfs/go-ds-badger3 v0.0.2 // indirect + github.com/ipfs/go-ds-badger4 v0.1.5 // indirect github.com/ipfs/go-ipfs-util v0.0.2 // indirect github.com/ipfs/go-log v1.0.5 // indirect github.com/ipfs/go-log/v2 v2.5.1 // indirect @@ -180,11 +192,12 @@ require ( github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect github.com/jbenet/goprocess v0.1.4 // indirect + github.com/jdx/go-netrc v1.0.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.0 // indirect + github.com/klauspost/compress v1.17.4 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect - github.com/klauspost/reedsolomon v1.11.8 // indirect + github.com/klauspost/pgzip v1.2.6 // indirect github.com/koron/go-ssdp v0.0.4 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect @@ -203,27 +216,28 @@ require ( github.com/libp2p/go-netroute v0.2.1 // indirect github.com/libp2p/go-reuseport v0.4.0 // indirect github.com/libp2p/go-yamux/v4 v4.0.1 // indirect - github.com/linxGnu/grocksdb v1.7.16 // indirect + github.com/linxGnu/grocksdb v1.8.6 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/miekg/dns v1.1.55 // indirect github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect - github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect github.com/minio/highwayhash v1.0.2 // indirect github.com/minio/sha256-simd v1.0.1 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/moby/term v0.5.0 // indirect + github.com/morikuni/aec v1.0.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/mtibben/percent v0.2.1 // indirect github.com/multiformats/go-base32 v0.1.0 // indirect github.com/multiformats/go-base36 v0.2.0 // indirect - github.com/multiformats/go-multiaddr v0.12.0 // indirect + github.com/multiformats/go-multiaddr v0.12.1 // indirect github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect github.com/multiformats/go-multibase v0.2.0 // indirect @@ -231,82 +245,96 @@ require ( github.com/multiformats/go-multihash v0.2.3 // indirect github.com/multiformats/go-multistream v0.4.1 // indirect github.com/multiformats/go-varint v0.0.7 // indirect + github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect + github.com/oklog/run v1.1.0 // indirect github.com/onsi/ginkgo/v2 v2.11.0 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.1.0-rc5 // indirect github.com/opencontainers/runtime-spec v1.1.0 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect - github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect + github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect github.com/pkg/errors v0.9.1 // indirect + github.com/pkg/profile v1.7.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/polydawn/refmt v0.89.0 // indirect - github.com/prometheus/client_golang v1.17.0 // indirect - github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect - github.com/prometheus/common v0.44.0 // indirect - github.com/prometheus/procfs v0.11.1 // indirect + github.com/prometheus/client_golang v1.18.0 // indirect + github.com/prometheus/client_model v0.5.0 // indirect + github.com/prometheus/common v0.45.0 // indirect + github.com/prometheus/procfs v0.12.0 // indirect github.com/quic-go/qpack v0.4.0 // indirect github.com/quic-go/qtls-go1-20 v0.3.2 // indirect github.com/quic-go/quic-go v0.37.6 // indirect github.com/quic-go/webtransport-go v0.5.3 // indirect - github.com/rakyll/statik v0.1.7 // indirect github.com/raulk/go-watchdog v1.3.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - github.com/rollkit/celestia-openrpc v0.3.0 // indirect - github.com/rollkit/rollkit v0.10.6 // indirect + github.com/rollkit/go-da v0.2.0 // indirect + github.com/rollkit/rollkit v0.11.19 // indirect github.com/rs/cors v1.10.1 // indirect - github.com/sagikazarmark/locafero v0.3.0 // indirect + github.com/rs/zerolog v1.31.0 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - github.com/spf13/afero v1.10.0 // indirect - github.com/spf13/viper v1.17.0 // indirect - github.com/stretchr/objx v0.5.0 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/cast v1.6.0 // indirect + github.com/stoewer/go-strcase v1.3.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect github.com/tendermint/tendermint v0.35.9 // indirect - github.com/tidwall/btree v1.6.0 // indirect + github.com/tetratelabs/wazero v1.6.0 // indirect + github.com/tidwall/btree v1.7.0 // indirect github.com/ulikunitz/xz v0.5.11 // indirect + github.com/vbatts/tar-split v0.11.5 // indirect github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect - github.com/zondax/hid v0.9.1 // indirect - github.com/zondax/ledger-go v0.14.1 // indirect - go.etcd.io/bbolt v1.3.7 // indirect + github.com/zondax/hid v0.9.2 // indirect + github.com/zondax/ledger-go v0.14.3 // indirect + go.etcd.io/bbolt v1.3.8 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/otel v1.16.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect - go.opentelemetry.io/otel/trace v1.16.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect + go.opentelemetry.io/otel v1.22.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/sdk v1.22.0 // indirect + go.opentelemetry.io/otel/trace v1.22.0 // indirect + go.opentelemetry.io/proto/otlp v1.0.0 // indirect + go.uber.org/atomic v1.11.0 // indirect go.uber.org/dig v1.17.0 // indirect go.uber.org/fx v1.20.0 // indirect - go.uber.org/zap v1.25.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.26.0 // indirect + golang.org/x/crypto v0.18.0 // indirect + golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 // indirect golang.org/x/mod v0.14.0 // indirect - golang.org/x/net v0.18.0 // indirect - golang.org/x/oauth2 v0.12.0 // indirect - golang.org/x/sys v0.14.0 // indirect - golang.org/x/term v0.14.0 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/oauth2 v0.15.0 // indirect + golang.org/x/sync v0.6.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/term v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect - golang.org/x/tools v0.15.0 // indirect - golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - gonum.org/v1/gonum v0.11.0 // indirect - google.golang.org/api v0.143.0 // indirect - google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect - google.golang.org/protobuf v1.31.0 // indirect + golang.org/x/time v0.5.0 // indirect + gonum.org/v1/gonum v0.12.0 // indirect + google.golang.org/api v0.153.0 // indirect + google.golang.org/appengine v1.6.8 // indirect + google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240116215550-a9fa1716bcac // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac // indirect + google.golang.org/grpc v1.60.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - gotest.tools/v3 v3.5.0 // indirect + gotest.tools/v3 v3.5.1 // indirect lukechampine.com/blake3 v1.2.1 // indirect nhooyr.io/websocket v1.8.7 // indirect - pgregory.net/rapid v0.5.5 // indirect - sigs.k8s.io/yaml v1.3.0 // indirect + pgregory.net/rapid v1.1.0 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect ) -replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 - -// TODO_DOCUMENT(@okdas): Updating this line alone bumps the rest of the dependencies -replace github.com/cosmos/cosmos-sdk => github.com/rollkit/cosmos-sdk v0.47.3-rollkit-v0.10.6-no-fraud-proofs - -replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 +replace github.com/cosmos/cosmos-sdk => github.com/rollkit/cosmos-sdk v0.50.1-rollkit-v0.11.19-no-fraud-proofs diff --git a/go.sum b/go.sum index e7d4f8937..bda8d18ab 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ 4d63.com/gochecknoglobals v0.1.0/go.mod h1:wfdC5ZjKSPr7CybKEcgJhUOgeAQW1+7WcyK8OvUilfo= bitbucket.org/creachadair/shell v0.0.6/go.mod h1:8Qqi/cYk7vPnsOePHroKXDJYmb5x7ENhtiFtfZq8K+M= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.32.0-20231115204500-e097f827e652.1 h1:u0olL4yf2p7Tl5jfsAK5keaFi+JFJuv1CDHrbiXkxkk= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.32.0-20231115204500-e097f827e652.1/go.mod h1:tiTMKD8j6Pd/D2WzREoweufjzaJKHZg35f/VGcZ2v3I= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.31.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= @@ -38,8 +40,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.110.7 h1:rJyC7nWRg2jWGZ4wSJ5nY65GTdYJkg0cd/uXb+ACI6o= -cloud.google.com/go v0.110.7/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= +cloud.google.com/go v0.111.0 h1:YHLKNupSD1KqjDbQ3+LVdQ81h/UJbJyZG203cEfnQgM= +cloud.google.com/go v0.111.0/go.mod h1:0mibmpKP1TyOOFYQY5izo0LnT+ecvOQ0Sg3OdmMiNRU= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= @@ -76,8 +78,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= -cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= +cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= +cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= @@ -118,8 +120,8 @@ cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y97 cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= -cloud.google.com/go/iam v1.1.1 h1:lW7fzj15aVIXYHREOqjRBV9PsH0Z6u8Y46a1YGvQP4Y= -cloud.google.com/go/iam v1.1.1/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= +cloud.google.com/go/iam v1.1.5 h1:1jTsCu4bcsNsE4iiqNT5SHwrDRCfRmIaaaVFhRveTJI= +cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXEbzv8= cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= @@ -183,8 +185,8 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= -cloud.google.com/go/storage v1.30.1 h1:uOdMxAs8HExqBlnLtnQyP0YkvbiDpdGShGKtx6U/oNM= -cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7BiccwkR7+P7gN8E= +cloud.google.com/go/storage v1.35.1 h1:B59ahL//eDfx2IIKFBeT5Atm9wnNmj3+8xG/W4WB//w= +cloud.google.com/go/storage v1.35.1/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYEsng2xgOs8= cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= @@ -196,21 +198,41 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= +connectrpc.com/connect v1.14.0 h1:PDS+J7uoz5Oui2VEOMcfz6Qft7opQM9hPiKvtGC01pA= +connectrpc.com/connect v1.14.0/go.mod h1:uoAq5bmhhn43TwhaKdGKN/bZcGtzPW1v+ngDTn5u+8s= +connectrpc.com/otelconnect v0.7.0 h1:ZH55ZZtcJOTKWWLy3qmL4Pam4RzRWBJFOqTPyAqCXkY= +connectrpc.com/otelconnect v0.7.0/go.mod h1:Bt2ivBymHZHqxvo4HkJ0EwHuUzQN6k2l0oH+mp/8nwc= contrib.go.opencensus.io/exporter/stackdriver v0.13.4/go.mod h1:aXENhDJ1Y4lIg4EUaVTwzvYETVNZk10Pu26tevFKLUc= -cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= -cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= -cosmossdk.io/core v0.5.1 h1:vQVtFrIYOQJDV3f7rw4pjjVqc1id4+mE0L9hHP66pyI= -cosmossdk.io/core v0.5.1/go.mod h1:KZtwHCLjcFuo0nmDc24Xy6CRNEL9Vl/MeimQ2aC7NLE= +cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= +cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/client/v2 v2.0.0-beta.1 h1:XkHh1lhrLYIT9zKl7cIOXUXg2hdhtjTPBUfqERNA1/Q= +cosmossdk.io/client/v2 v2.0.0-beta.1/go.mod h1:JEUSu9moNZQ4kU3ir1DKD5eU4bllmAexrGWjmb9k8qU= +cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= +cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= +cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= +cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= cosmossdk.io/log v1.2.1 h1:Xc1GgTCicniwmMiKwDxUjO4eLhPxoVdI9vtMW8Ti/uk= cosmossdk.io/log v1.2.1/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= -cosmossdk.io/math v1.1.2 h1:ORZetZCTyWkI5GlZ6CZS28fMHi83ZYf+A2vVnHNzZBM= -cosmossdk.io/math v1.1.2/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= -cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= -cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= +cosmossdk.io/math v1.2.0 h1:8gudhTkkD3NxOP2YyyJIYYmt6dQ55ZfJkDOaxXpy7Ig= +cosmossdk.io/math v1.2.0/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= +cosmossdk.io/store v1.0.1 h1:XBDhCqlL+2MUgE8CHWwndKVJ4beX+TyaPIjB5SV62dM= +cosmossdk.io/store v1.0.1/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +cosmossdk.io/tools/confix v0.1.1 h1:aexyRv9+y15veH3Qw16lxQwo+ki7r2I+g0yNTEFEQM8= +cosmossdk.io/tools/confix v0.1.1/go.mod h1:nQVvP1tHsGXS83PonPVWJtSbddIqyjEw99L4M3rPJyQ= +cosmossdk.io/x/circuit v0.1.0 h1:IAej8aRYeuOMritczqTlljbUVHq1E85CpBqaCTwYgXs= +cosmossdk.io/x/circuit v0.1.0/go.mod h1:YDzblVE8+E+urPYQq5kq5foRY/IzhXovSYXb4nwd39w= +cosmossdk.io/x/evidence v0.1.0 h1:J6OEyDl1rbykksdGynzPKG5R/zm6TacwW2fbLTW4nCk= +cosmossdk.io/x/evidence v0.1.0/go.mod h1:hTaiiXsoiJ3InMz1uptgF0BnGqROllAN8mwisOMMsfw= +cosmossdk.io/x/feegrant v0.1.0 h1:c7s3oAq/8/UO0EiN1H5BIjwVntujVTkYs35YPvvrdQk= +cosmossdk.io/x/feegrant v0.1.0/go.mod h1:4r+FsViJRpcZif/yhTn+E0E6OFfg4n0Lx+6cCtnZElU= +cosmossdk.io/x/tx v0.12.0 h1:Ry2btjQdrfrje9qZ3iZeZSmDArjgxUJMMcLMrX4wj5U= +cosmossdk.io/x/tx v0.12.0/go.mod h1:qTth2coAGkwCwOCjqQ8EAQg+9udXNRzcnSbMgGKGEI0= +cosmossdk.io/x/upgrade v0.1.1 h1:aoPe2gNvH+Gwt/Pgq3dOxxQVU3j5P6Xf+DaUJTDZATc= +cosmossdk.io/x/upgrade v0.1.1/go.mod h1:MNLptLPcIFK9CWt7Ra//8WUZAxweyRDNcbs5nkOcQy0= dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= @@ -232,15 +254,16 @@ github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2 github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= -github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= +github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/GaijinEntertainment/go-exhaustruct/v2 v2.2.0/go.mod h1:n/vLeA7V+QY84iYAGwMkkUUp9ooeuftMEvaDrSVch+Q= github.com/HdrHistogram/hdrhistogram-go v1.1.0/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= @@ -253,6 +276,7 @@ github.com/Masterminds/sprig v2.15.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuN github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= @@ -268,10 +292,6 @@ github.com/adlio/schema v1.3.3/go.mod h1:1EsRssiv9/Ce2CMzq5DoL7RiMshhuigQxrR4DMV github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= -github.com/alecthomas/participle/v2 v2.0.0-alpha7 h1:cK4vjj0VSgb3lN1nuKA5F7dw+1s1pWBe5bx7nNCnN+c= -github.com/alecthomas/participle/v2 v2.0.0-alpha7/go.mod h1:NumScqsC42o9x+dGj8/YqsIfhrIQjFEOFovxotbBirA= -github.com/alecthomas/repr v0.0.0-20181024024818-d37bc2a10ba1 h1:GDQdwm/gAcJcLAKQQZGOJ4knlw+7rfEQQcmwTbt4p5E= -github.com/alecthomas/repr v0.0.0-20181024024818-d37bc2a10ba1/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -284,6 +304,8 @@ github.com/andybalholm/brotli v1.0.3/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHG github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI= +github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g= github.com/aokoli/goutils v1.0.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= @@ -292,15 +314,11 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5 github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-metrics v0.3.9/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= -github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA= -github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= github.com/ashanbrown/forbidigo v1.3.0/go.mod h1:vVW7PEdqEFqapJe95xHkTfB1+XvZXBFg8t0sG2FIxmI= github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI= -github.com/athanorlabs/go-dleq v0.1.0 h1:0/llWZG8fz2uintMBKOiBC502zCsDA8nt8vxI73W9Qc= -github.com/athanorlabs/go-dleq v0.1.0/go.mod h1:DWry6jSD7A13MKmeZA0AX3/xBeQCXDoygX99VPwL3yU= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.23.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.25.37/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= @@ -308,8 +326,8 @@ github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN github.com/aws/aws-sdk-go v1.36.30/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/aws/aws-sdk-go v1.40.45/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= -github.com/aws/aws-sdk-go v1.44.203 h1:pcsP805b9acL3wUqa4JR2vg1k2wnItkDYNvfmcy6F+U= -github.com/aws/aws-sdk-go v1.44.203/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.44.224 h1:09CiaaF35nRmxrzWZ2uRq5v6Ghg/d2RiPjZnSgtt+RQ= +github.com/aws/aws-sdk-go v1.44.224/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/aws/aws-sdk-go-v2 v1.9.1/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.8.1/go.mod h1:CM+19rL1+4dFWnOQKwDc7H1KwXTz+h61oUSHyhV0b3o= @@ -327,6 +345,8 @@ github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5MS5JVb4c= +github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/bkielbasa/cyclop v1.2.0/go.mod h1:qOI0yy6A7dYC4Zgsa72Ppm9kONl0RoIlPbzot9mhmeI= github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= github.com/bombsimon/wsl/v3 v3.3.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc= @@ -341,9 +361,11 @@ github.com/btcsuite/btcd v0.22.1 h1:CnwP9LM/M9xuRrGSCGeMVs9iv09uMqwsVX7EeIpgV2c= github.com/btcsuite/btcd v0.22.1/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= -github.com/btcsuite/btcd/btcutil v1.1.2 h1:XLMbX8JQEiwMcYft2EGi8zPUkoa0abKIU6/BJSRsjzQ= +github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= +github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 h1:KdUfX2zKommPRa+PD0sWZUyXe9w277ABlgELO7H04IM= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= @@ -356,23 +378,22 @@ github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/bufbuild/buf v1.3.1/go.mod h1:CTRUb23N+zlm1U8ZIBKz0Sqluk++qQloB2i/MZNZHIs= -github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= +github.com/bufbuild/buf v1.29.0 h1:llP6HqOcCaSGBxOfnrp/mwvcY1O/dciEOl1QaMEOB3M= +github.com/bufbuild/buf v1.29.0/go.mod h1:UTjvPXTObvKQiGqxod32wt9zRz70TJsMpaigpbIZGuc= +github.com/bufbuild/protocompile v0.8.0 h1:9Kp1q6OkS9L4nM3FYbr8vlJnEwtbpDPQlQOVXfR+78s= +github.com/bufbuild/protocompile v0.8.0/go.mod h1:+Etjg4guZoAqzVk2czwEQP12yaxLJ8DxuqCJ9qHdH94= +github.com/bufbuild/protovalidate-go v0.5.0 h1:xFery2RlLh07FQTvB7hlasKqPrDK2ug+uw6DUiuadjo= +github.com/bufbuild/protovalidate-go v0.5.0/go.mod h1:3XAwFeJ2x9sXyPLgkxufH9sts1tQRk8fdt1AW93NiUU= +github.com/bufbuild/protoyaml-go v0.1.7 h1:3uKIoNb/l5zrZ93u+Xzsg6cdAO06lveZE/K7UUbUQLw= +github.com/bufbuild/protoyaml-go v0.1.7/go.mod h1:R8vE2+l49bSiIExP4VJpxOXleHE+FDzZ6HVxr3cYunw= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/butuzov/ireturn v0.1.1/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/casbin/casbin/v2 v2.37.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= -github.com/celestiaorg/go-fraud v0.2.0 h1:aaq2JiW0gTnhEdac3l51UCqSyJ4+VjFGTTpN83V4q7I= -github.com/celestiaorg/go-fraud v0.2.0/go.mod h1:lNY1i4K6kUeeE60Z2VK8WXd+qXb8KRzfBhvwPkK6aUc= -github.com/celestiaorg/go-header v0.4.1 h1:bjbUcKDnhrJJ9EoE7vtPpgleNLVjc2S+cB4/qe8nQmo= -github.com/celestiaorg/go-header v0.4.1/go.mod h1:H8xhnDLDLbkpwmWPhCaZyTnIV3dlVxBHPnxNXS2Qu6c= +github.com/celestiaorg/go-header v0.5.1 h1:1s1lw4fcCHalNK0qw/0a3cxg3ezx3Hl020znIxPZvtk= +github.com/celestiaorg/go-header v0.5.1/go.mod h1:H8xhnDLDLbkpwmWPhCaZyTnIV3dlVxBHPnxNXS2Qu6c= github.com/celestiaorg/go-libp2p-messenger v0.2.0 h1:/0MuPDcFamQMbw9xTZ73yImqgTO3jHV7wKHvWD/Irao= github.com/celestiaorg/go-libp2p-messenger v0.2.0/go.mod h1:s9PIhMi7ApOauIsfBcQwbr7m+HBzmVfDIS+QLdgzDSo= -github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 h1:CJdIpo8n5MFP2MwK0gSRcOVlDlFdQJO1p+FqdxYzmvc= -github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4/go.mod h1:fzuHnhzj1pUygGz+1ZkB3uQbEUL4htqCGJ4Qs2LwMZA= -github.com/celestiaorg/nmt v0.20.0 h1:9i7ultZ8Wv5ytt8ZRaxKQ5KOOMo4A2K2T/aPGjIlSas= -github.com/celestiaorg/nmt v0.20.0/go.mod h1:Oz15Ub6YPez9uJV0heoU4WpFctxazuIhKyUtaYNio7E= -github.com/celestiaorg/rsmt2d v0.11.0 h1:lcto/637WyTEZR3dLRoNvyuExfnUbxvdvKi3qz/2V4k= -github.com/celestiaorg/rsmt2d v0.11.0/go.mod h1:6Y580I3gVr0+OVFfW6m2JTwnCCmvW3WfbwSLfuT+HCA= github.com/celestiaorg/utils v0.1.0 h1:WsP3O8jF7jKRgLNFmlDCwdThwOFMFxg0MnqhkLFVxPo= github.com/celestiaorg/utils v0.1.0/go.mod h1:vQTh7MHnvpIeCQZ2/Ph+w7K1R2UerDheZbgJEJD2hSU= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= @@ -423,24 +444,24 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= -github.com/cockroachdb/apd/v3 v3.1.0 h1:MK3Ow7LH0W8zkd5GMKA1PvS9qG3bWFI95WaVNfyZJ/w= -github.com/cockroachdb/apd/v3 v3.1.0/go.mod h1:6qgPBMXjATAdD/VefbRP9NoSLKjbB4LCoA7gN4LpHs4= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/cockroachdb/errors v1.10.0 h1:lfxS8zZz1+OjtV4MtNWgboi/W5tyLEB6VQZBXN+0VUU= -github.com/cockroachdb/errors v1.10.0/go.mod h1:lknhIsEVQ9Ss/qKDBQS/UqFSvPQjOwNq2qyKAxtHRqE= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= +github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= +github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/pebble v0.0.0-20231102162011-844f0582c2eb h1:6Po+YYKT5B5ZXN0wd2rwFBaebM0LufPf8p4zxOd48Kg= +github.com/cockroachdb/pebble v0.0.0-20231102162011-844f0582c2eb/go.mod h1:acMRUGd/BK8AUmQNK3spUCCGzFLZU2bSST3NMXSq2Kc= github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA= -github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= -github.com/cometbft/cometbft v0.37.2 h1:XB0yyHGT0lwmJlFmM4+rsRnczPlHoAKFX6K8Zgc2/Jc= -github.com/cometbft/cometbft v0.37.2/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs= -github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo= -github.com/cometbft/cometbft-db v0.8.0/go.mod h1:6ASCP4pfhmrCBpfk01/9E1SI29nD3HfVHrY4PG8x5c0= -github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= -github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= +github.com/cometbft/cometbft v0.38.2 h1:io0JCh5EPxINKN5ZMI5hCdpW3QVZRy+o8qWe3mlJa/8= +github.com/cometbft/cometbft v0.38.2/go.mod h1:PIi48BpzwlHqtV3mzwPyQgOyOnU94BNBimLS2ebBHOg= +github.com/cometbft/cometbft-db v0.9.1 h1:MIhVX5ja5bXNHF8EYrThkG9F7r9kSfv8BX4LWaxWJ4M= +github.com/cometbft/cometbft-db v0.9.1/go.mod h1:iliyWaoV0mRwBJoizElCwwRA9Tf7jZJOURcRZF9m60U= github.com/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= github.com/containerd/cgroups v1.0.3/go.mod h1:/ofk34relqNjSGyqPrmEULrO4Sc8LJhvJmWbUCUKqj8= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= @@ -448,6 +469,11 @@ github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHq github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= github.com/containerd/continuity v0.4.1 h1:wQnVrjIyQ8vhU2sgOiL5T07jo+ouqc2bnKsv5/EqGhU= +github.com/containerd/continuity v0.4.1/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= +github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= +github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= +github.com/containerd/stargz-snapshotter/estargz v0.15.1 h1:eXJjw9RbkLFgioVaTG+G/ZW/0kEe2oEKCdS/ZxIyoCU= +github.com/containerd/stargz-snapshotter/estargz v0.15.1/go.mod h1:gr2RNwukQ/S9Nv33Lt6UC7xEx58C+LHRdoqbEKjz1Kk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -464,9 +490,10 @@ github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfc github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= -github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= -github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= +github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= +github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= +github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= +github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= @@ -474,38 +501,40 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR2g= github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y= -github.com/cosmos/iavl v0.20.0 h1:fTVznVlepH0KK8NyKq8w+U7c2L6jofa27aFX6YGlm38= -github.com/cosmos/iavl v0.20.0/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= -github.com/cosmos/ibc-go/v7 v7.3.1 h1:bil1IjnHdyWDASFYKfwdRiNtFP6WK3osW7QFEAgU4I8= -github.com/cosmos/ibc-go/v7 v7.3.1/go.mod h1:wvx4pPBofe5ZdMNV3OFRxSI4auEP5Qfqf8JXLLNV04g= +github.com/cosmos/iavl v1.0.0 h1:bw6t0Mv/mVCJvlMTOPHWLs5uUE3BRBfVWCRelOzl+so= +github.com/cosmos/iavl v1.0.0/go.mod h1:CmTGqMnRnucjxbjduneZXT+0vPgNElYvdefjX2q9tYc= +github.com/cosmos/ibc-go/modules/capability v1.0.0 h1:r/l++byFtn7jHYa09zlAdSeevo8ci1mVZNO9+V0xsLE= +github.com/cosmos/ibc-go/modules/capability v1.0.0/go.mod h1:D81ZxzjZAe0ZO5ambnvn1qedsFQ8lOwtqicG6liLBco= +github.com/cosmos/ibc-go/v8 v8.0.0 h1:QKipnr/NGwc+9L7NZipURvmSIu+nw9jOIWTJuDBqOhg= +github.com/cosmos/ibc-go/v8 v8.0.0/go.mod h1:C6IiJom0F3cIQCD5fKwVPDrDK9j/xTu563AWuOmXois= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= -github.com/cosmos/ledger-cosmos-go v0.12.1 h1:sMBxza5p/rNK/06nBSNmsI/WDqI0pVJFVNihy1Y984w= -github.com/cosmos/ledger-cosmos-go v0.12.1/go.mod h1:dhO6kj+Y+AHIOgAe4L9HL/6NDdyyth4q238I9yFpD2g= -github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzUGSKFTcM= -github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFgWl/ENIznEoYQI4= +github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= +github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creachadair/atomicfile v0.2.6/go.mod h1:BRq8Une6ckFneYXZQ+kO7p1ZZP3I2fzVzf28JxrIkBc= +github.com/creachadair/atomicfile v0.3.1 h1:yQORkHjSYySh/tv5th1dkKcn02NEW5JleB84sjt+W4Q= +github.com/creachadair/atomicfile v0.3.1/go.mod h1:mwfrkRxFKwpNAflYZzytbSwxvbK6fdGRRlp0KEQc0qU= github.com/creachadair/command v0.0.0-20220426235536-a748effdf6a1/go.mod h1:bAM+qFQb/KwWyCc9MLC4U1jvn3XyakqP5QRkds5T6cY= github.com/creachadair/taskgroup v0.3.2/go.mod h1:wieWwecHVzsidg2CsUnFinW1faVN4+kq+TDlRJQ0Wbk= -github.com/creachadair/taskgroup v0.6.1 h1:KQfRG4VhSj2qoXPkzXrsTaT8oZsMCZD0+KRll2jbF78= -github.com/creachadair/taskgroup v0.6.1/go.mod h1:2vCkZ5a+HVcvDl3llMpox2lTw0+MSzrkGsddxRAHXOo= github.com/creachadair/tomledit v0.0.22/go.mod h1:cIu/4x5L855oSRejIqr+WRFh+mv9g4fWLiUFaApYn/Y= +github.com/creachadair/tomledit v0.0.24 h1:5Xjr25R2esu1rKCbQEmjZYlrhFkDspoAbAKb6QKQDhQ= +github.com/creachadair/tomledit v0.0.24/go.mod h1:9qHbShRWQzSCcn617cMzg4eab1vbLCOjOshAWSzWr8U= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/cucumber/common/gherkin/go/v22 v22.0.0 h1:4K8NqptbvdOrjL9DEea6HFjSpbdT9+Q5kgLpmmsHYl0= -github.com/cucumber/common/gherkin/go/v22 v22.0.0/go.mod h1:3mJT10B2GGn3MvVPd3FwR7m2u4tLhSRhWUqJU4KN4Fg= -github.com/cucumber/common/messages/go/v17 v17.1.1 h1:RNqopvIFyLWnKv0LfATh34SWBhXeoFTJnSrgm9cT/Ts= -github.com/cucumber/common/messages/go/v17 v17.1.1/go.mod h1:bpGxb57tDE385Rb2EohgUadLkAbhoC4IyCFi89u/JQI= +github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= +github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/daixiang0/gci v0.4.2/go.mod h1:d0f+IJhr9loBtIq+ebwhRoTt1LGbPH96ih8bKlsRT9E= -github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= -github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= +github.com/danieljoos/wincred v1.2.1 h1:dl9cBrupW8+r5250DYkYxocLeZ1Y4vB1kxgtjxw8GQs= +github.com/danieljoos/wincred v1.2.1/go.mod h1:uGaFL9fDn3OLTvzCGulzE+SzjEe5NGlh5FdCcyfPwps= github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -516,6 +545,7 @@ github.com/davidlazar/go-crypto v0.0.0-20170701192655-dcfb0a7ac018/go.mod h1:rQY github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR6AkioZ1ySsx5yxlDQZ8stG2b88gTPxgJU= github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U= github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= +github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= @@ -527,10 +557,8 @@ github.com/dgraph-io/badger v1.6.2/go.mod h1:JW2yswe3V058sS0kZ2h/AXeDSqFjxnZcRrV github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk= -github.com/dgraph-io/badger/v3 v3.2103.5 h1:ylPa6qzbjYRQMU6jokoj4wzcaweHylt//CH0AKt0akg= -github.com/dgraph-io/badger/v3 v3.2103.5/go.mod h1:4MPiseMeDQ3FNCYwRbbcBOGJLf5jsE0PPFzRiKjtcdw= -github.com/dgraph-io/badger/v4 v4.2.0 h1:kJrlajbXXL9DFTNuhhu9yCx7JJa4qpYWxtE8BzuWsEs= -github.com/dgraph-io/badger/v4 v4.2.0/go.mod h1:qfCqhPoWDFJRx1gp5QwwyGo8xk1lbHUxvK9nK0OGAak= +github.com/dgraph-io/badger/v4 v4.2.1-0.20231013074411-fb1b00959581 h1:yy45brf1ktmnkTCZlHynP1gRlVwZ9g19oz5D9wG81v4= +github.com/dgraph-io/badger/v4 v4.2.1-0.20231013074411-fb1b00959581/go.mod h1:T/uWAYxrXdaXw64ihI++9RMbKTCpKd/yE9+saARew7k= github.com/dgraph-io/ristretto v0.0.2/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= @@ -539,15 +567,24 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= +github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= github.com/docker/cli v20.10.14+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/cli v20.10.17+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= -github.com/docker/cli v24.0.2+incompatible h1:QdqR7znue1mtkXIJ+ruQMGQhpw2JzMJLRXp6zpzF6tM= +github.com/docker/cli v24.0.7+incompatible h1:wa/nIwYFW7BVTGa7SWPVyyXU9lgORqUb1xfI36MSkFg= +github.com/docker/cli v24.0.7+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= +github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v20.10.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v20.10.17+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v24.0.2+incompatible h1:eATx+oLz9WdNVkQrr0qjQ8HvRJ4bOOxfzEo8R+dA3cg= -github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/docker v25.0.0+incompatible h1:g9b6wZTblhMgzOT2tspESstfw6ySZ9kdm94BLDKaZac= +github.com/docker/docker v25.0.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker-credential-helpers v0.8.1 h1:j/eKUktUltBtMzKqmfLB0PAgqYyMHOp5vfsD1807oKo= +github.com/docker/docker-credential-helpers v0.8.1/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= +github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= @@ -564,6 +601,8 @@ github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaB github.com/elastic/gosigar v0.12.0/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4= github.com/elastic/gosigar v0.14.2/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= +github.com/emicklei/dot v1.6.0 h1:vUzuoVE8ipzS7QkES4UfxdpCwdU2U97m2Pb2tQCoYRY= +github.com/emicklei/dot v1.6.0/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -578,6 +617,8 @@ github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go. github.com/envoyproxy/protoc-gen-validate v0.0.14/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws= +github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= +github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= @@ -588,12 +629,13 @@ github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= +github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= -github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o= -github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/filecoin-project/go-jsonrpc v0.3.1 h1:qwvAUc5VwAkooquKJmfz9R2+F8znhiqcNHYjEp/NM10= -github.com/filecoin-project/go-jsonrpc v0.3.1/go.mod h1:jBSvPTl8V1N7gSTuCR4bis8wnQnIjHbRPpROol6iQKM= +github.com/felixge/fgprof v0.9.3 h1:VvyZxILNuCiUCSXtPtYmmtGvb65nqXh2QFWc0Wpf2/g= +github.com/felixge/fgprof v0.9.3/go.mod h1:RdbpDgzqYVh/T9fPELJyV7EYJuHB55UTEULNun8eiPw= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/firefart/nonamedreturns v1.0.4/go.mod h1:TDhe/tjI1BXo48CmYbUduTV7BdIga8MAO/xbKdcVsGI= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/flynn/noise v1.0.0 h1:DlTHqmzmvcEiKj+4RYo/imoswx/4r6iBlCMfVtrMXpQ= @@ -609,27 +651,31 @@ github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2 github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/frankban/quicktest v1.14.2/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= -github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fullstorydev/grpcurl v1.6.0/go.mod h1:ZQ+ayqbKMJNhzLmbpCiurTVlaK2M/3nqZCxaQ2Ze/sM= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= -github.com/getsentry/sentry-go v0.23.0 h1:dn+QRCeJv4pPt9OjVXiMcGIBIefaTJPw/h0bZWO05nE= -github.com/getsentry/sentry-go v0.23.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= +github.com/getsentry/sentry-go v0.25.0 h1:q6Eo+hS+yoJlTO3uu/azhQadsD8V+jQn2D8VvX1eOyI= +github.com/getsentry/sentry-go v0.25.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= -github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= +github.com/gin-gonic/gin v1.7.0 h1:jGB9xAJQ12AIGNB4HguylppmDK1Am9ppF7XnGXXJuoU= +github.com/gin-gonic/gin v1.7.0/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= +github.com/go-chi/chi/v5 v5.0.11 h1:BnpYbFZ3T3S1WMpD79r7R5ThWX40TaFB7L31Y8xqSwA= +github.com/go-chi/chi/v5 v5.0.11/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-critic/go-critic v0.6.3/go.mod h1:c6b3ZP1MQ7o6lPR7Rv3lEf7pYQUmAcx8ABHgdZCQt/k= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= +github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -650,18 +696,21 @@ github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KE github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= -github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= +github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= +github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= +github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= github.com/go-redis/redis v6.15.8+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= @@ -685,11 +734,13 @@ github.com/go-zookeeper/zk v1.0.2/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/httphead v0.1.0 h1:exrUm0f4YX0L7EBwZHuCF4GDp8aJfVeBrlLQrs6NqWU= +github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og= +github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/gobwas/ws v1.2.1 h1:F2aeBZrm2NDsc7vbovKrWSogd4wvfAxg0FQ89/iqOTk= -github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= +github.com/gobwas/ws v1.2.1/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -697,25 +748,29 @@ github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= -github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gofrs/uuid v4.3.1+incompatible h1:0/KbAdpx3UXAx1kEOWHJeOkpbgRFGHVgv+CFIY7dBJI= -github.com/gofrs/uuid v4.3.1+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/gofrs/uuid/v5 v5.0.0 h1:p544++a97kEL+svbcFbCQVM9KFu0Yo25UoISXGNNH9M= +github.com/gofrs/uuid/v5 v5.0.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= -github.com/gogo/status v1.1.1 h1:DuHXlSFHNKqTQ+/ACf5Vs6r4X/dH2EgIzR9Vr+H65kg= -github.com/gogo/status v1.1.1/go.mod h1:jpG3dM5QPcqu19Hg8lkUhBFBa3TcLs1DG7+2Jqci7oU= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang-sql/sqlexp v0.0.0-20170517235910-f1bb20e5a188/go.mod h1:vXjM/+wXQnTPR4KqTKDgJukSZ6amVRtWMPEjE6sQoK8= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= -github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= +github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= +github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -773,11 +828,12 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= +github.com/google/cel-go v0.19.0 h1:vVgaZoHPBDd1lXCYGQOh5A06L4EtuIfmqQ/qnSXSKiU= +github.com/google/cel-go v0.19.0/go.mod h1:kWcIzTsPX0zmQ+H3TirHstLLf9ep5QTsZBN9u4dOYLg= github.com/google/certificate-transparency-go v1.0.21/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg= github.com/google/certificate-transparency-go v1.1.1/go.mod h1:FDKqPvSXawb2ecErVRrD+nfy23RCzyl7eqVCEmlT1Zs= +github.com/google/flatbuffers v1.12.1 h1:MVlul7pQNoDzWRLTw5imwYsl+usrS1TXG2H4jg6ImGw= github.com/google/flatbuffers v1.12.1/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= -github.com/google/flatbuffers v2.0.0+incompatible h1:dicJ2oXwypfwUGnB2/TYWYEKiuk9eYQlQO/AnOHl5mI= -github.com/google/flatbuffers v2.0.0+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -792,13 +848,17 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-containerregistry v0.18.0 h1:ShE7erKNPqRh5ue6Z9DUOlk04WsnFWPO6YGr3OxnfoQ= +github.com/google/go-containerregistry v0.18.0/go.mod h1:u0qB2l7mvtWVR5kNcbFIhFY1hLbf8eeGapA+vbFDCtQ= github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gopacket v1.1.17/go.mod h1:UdDNZ1OO62aGYVnPhxT1U6aI7ukYtA/kB8vaU0diBUM= github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= @@ -808,6 +868,7 @@ github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIG github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= +github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -827,12 +888,12 @@ github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b h1:h9U78+dx9a4BKdQkBBos92HalKpaGKHrp+3Uo6yTodo= -github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= +github.com/google/pprof v0.0.0-20211214055906-6f57359322fd/go.mod h1:KgnwoLYCZ8IQu3XUZ8Nc/bM9CCZFOyjUNOSygVozoDg= +github.com/google/pprof v0.0.0-20240117000934-35fc243c5815 h1:WzfWbQz/Ze8v6l++GGbGNFZnUShVpP/0xffCPLL+ax8= +github.com/google/pprof v0.0.0-20240117000934-35fc243c5815/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= -github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/trillian v1.3.11/go.mod h1:0tPraVHrSDkA3BO6vKX67zgLXs6SsOAbHEivX+9mPgw= github.com/google/uuid v0.0.0-20161128191214-064e2069ce9c/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -840,13 +901,13 @@ github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= +github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= -github.com/googleapis/enterprise-certificate-proxy v0.3.1 h1:SBWmZhjUDRorQxrN0nwzf+AHBxnbFjViHQS4P0yVpmQ= -github.com/googleapis/enterprise-certificate-proxy v0.3.1/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= +github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= +github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= @@ -865,23 +926,26 @@ github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8 github.com/gookit/color v1.5.1/go.mod h1:wZFzea4X8qN6vHOSP2apMb4/+w/orMznEzYsIHPaqKM= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f h1:KMlcu9X58lhTA/KrfX8Bi1LQSO4pzoVjTiL3h4Jk+Zk= +github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75/go.mod h1:g2644b03hfBX9Ov0ZBDgXXens4rxSxmqFBbhvKv2yVA= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= -github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= +github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= +github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/gorilla/rpc v1.2.0 h1:WvvdC2lNeT1SP32zrIce5l0ECBfbAlmrmSBsuc57wfk= -github.com/gorilla/rpc v1.2.0/go.mod h1:V4h9r+4sF5HnzqbwIez0fKSpANP0zlYd3qR7p36jkTQ= +github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= +github.com/gorilla/rpc v1.2.1 h1:yC+LMV5esttgpVvNORL/xX4jvTTEUE30UZhZ5JF7K9k= +github.com/gorilla/rpc v1.2.1/go.mod h1:uNpOihAlF5xRFLuTYhfR0yfCTm0WTQSQttkMSptRfGk= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= +github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= github.com/gostaticanalysis/analysisutil v0.0.3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= github.com/gostaticanalysis/analysisutil v0.1.0/go.mod h1:dMhHRU9KTiDcuLGdy87/2gTR8WruwYZrKdRq9m1O6uw= @@ -899,23 +963,19 @@ github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:Fecb github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.12.1/go.mod h1:8XEsbTttt/W+VvjtQhLACqCisSPWTxCZ7sBRjU6iH9c= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 h1:gDLXvp5S9izjldquuoAhDzccbskOL6tDC5jMSyx3zxE= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2/go.mod h1:7pdNwVWBBHGiCxa9lAszqCJMbfTISJ7oMftp8+UGV08= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 h1:6UKoz5ujsI55KNpsJH3UwCq3T8kKbZwNZBNPuTTje8U= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1/go.mod h1:YvJ2f6MplWDhfxiUC3KpyTy76kYUZA4W3pTv/wdKQ9Y= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= -github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= -github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= -github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= @@ -931,20 +991,26 @@ github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-getter v1.7.1 h1:SWiSWN/42qdpR0MdhaOc/bLR48PLuP1ZQtYLRlM69uY= -github.com/hashicorp/go-getter v1.7.1/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-getter v1.7.3 h1:bN2+Fw9XPFvOCjB0UOevFIMICZ7G2XSQHzfvLUyOM5E= +github.com/hashicorp/go-getter v1.7.3/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-hclog v1.0.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= +github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-metrics v0.5.2 h1:ErEYO2f//CjKsUDw4SmLzelsK6L3ZmOAR/4P9iS7ruY= +github.com/hashicorp/go-metrics v0.5.2/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/go-plugin v1.5.2 h1:aWv8eimFqWlsEiMrYZdPYl+FdHaBJSN4AWwGWfT1G2Y= +github.com/hashicorp/go-plugin v1.5.2/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= @@ -953,8 +1019,9 @@ github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoD github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= +github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= @@ -963,8 +1030,8 @@ github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= +github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/golang-lru/v2 v2.0.5 h1:wW7h1TG88eUIJ2i69gaE3uNVtEPIagzhGvHgwfx2Vm4= github.com/hashicorp/golang-lru/v2 v2.0.5/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= @@ -980,6 +1047,8 @@ github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/J github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= github.com/hashicorp/serf v0.9.7/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= +github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= +github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7HsjsjeEZ6auqU= github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= @@ -998,13 +1067,15 @@ github.com/huin/goupnp v1.2.0 h1:uOKW26NG1hsSSbXIZ1IR7XP9Gjd1U8pnLaCMgntmkmY= github.com/huin/goupnp v1.2.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= +github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= +github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= github.com/imdario/mergo v0.3.4/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= -github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= @@ -1028,8 +1099,8 @@ github.com/ipfs/go-datastore v0.6.0/go.mod h1:rt5M3nNbSO/8q1t4LNkLyUwRs8HupMeN/8 github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= github.com/ipfs/go-ds-badger v0.3.0/go.mod h1:1ke6mXNqeV8K3y5Ak2bAA0osoTfmxUdupVCGm4QUIek= -github.com/ipfs/go-ds-badger3 v0.0.2 h1:+pME0YfRnbUKhvySnakNMuCMsUUhmGfwIsH/nnHZ7QY= -github.com/ipfs/go-ds-badger3 v0.0.2/go.mod h1:6/yjF1KaOU+IpCaqMV43yoWIdxHqOAJlO9EhWLnZSkI= +github.com/ipfs/go-ds-badger4 v0.1.5 h1:MwrTsIUJIqH/ChuDdUOzxwxMxHx/Li1ECoSCKsCUxiA= +github.com/ipfs/go-ds-badger4 v0.1.5/go.mod h1:LUU2FbhNdmhAbJmMeoahVRbe4GsduAODSJHWJJh2Vo4= github.com/ipfs/go-ds-leveldb v0.5.0/go.mod h1:d3XG9RUDzQ6V4SHi8+Xgj9j1XuEk1z82lquxrVbml/Q= github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2POp8= @@ -1056,6 +1127,8 @@ github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPw github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o= github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= +github.com/jdx/go-netrc v1.0.0 h1:QbLMLyCZGj0NA8glAhxUpf1zDg6cxnWgMBbjq40W0gQ= +github.com/jdx/go-netrc v1.0.0/go.mod h1:Gh9eFQJnoTNIRHXl2j5bJXA1u84hQWJWgGh569zF3v8= github.com/jdxcode/netrc v0.0.0-20210204082910-926c7f70242a/go.mod h1:Zi/ZFkEqFHTm7qkjyNJjaWH4LQA9LQhGJyF0lTYGpxw= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= @@ -1064,7 +1137,8 @@ github.com/jgautheron/goconst v1.5.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7H github.com/jhump/protocompile v0.0.0-20220216033700-d705409f108f/go.mod h1:qr2b5kx4HbFS7/g4uYO5qv9ei8303JMsC7ESbYiqr2Q= github.com/jhump/protoreflect v1.6.1/go.mod h1:RZQ/lnuN+zqeRVpQigTwO6o0AJUkxbnSnpuG7toUTG4= github.com/jhump/protoreflect v1.11.1-0.20220213155251-0c2aedc66cf4/go.mod h1:U7aMIjN0NWq9swDP7xDdoMfRHb35uiuTd3Z9nFXJf5E= -github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= +github.com/jhump/protoreflect v1.15.4 h1:mrwJhfQGGljwvR/jPEocli8KA6G9afbQpH8NY2wORcI= +github.com/jhump/protoreflect v1.15.4/go.mod h1:2B+zwrnMY3TTIqEK01OG/d3pyUycQBfDf+bx8fE2DNg= github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= @@ -1099,6 +1173,8 @@ github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSX github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2viExyCEfeWGU259JnaQ34Inuec4R38JCyBx2edgD0= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/errcheck v1.6.1/go.mod h1:nXw/i/MfnvRHqXa7XXmQMUB0oNFGuBrNI8d8NLy0LPw= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -1111,16 +1187,16 @@ github.com/klauspost/compress v1.13.5/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47e github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.15.1/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= -github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= -github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4= +github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c= github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= -github.com/klauspost/reedsolomon v1.11.8 h1:s8RpUW5TK4hjr+djiOpbZJB4ksx+TdYbRH7vHQpwPOY= -github.com/klauspost/reedsolomon v1.11.8/go.mod h1:4bXRN+cVzMdml6ti7qLouuYi32KHJ5MGv0Qd8a47h6A= +github.com/klauspost/pgzip v1.2.6 h1:8RXeL5crjEUFnR2/Sn6GJNWtSQ3Dk8pq4CL3jvdDyjU= +github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -1149,6 +1225,7 @@ github.com/ldez/gomoddirectives v0.2.3/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdB github.com/ldez/tagliatelle v0.3.1/go.mod h1:8s6WJQwEYHbKZDsp/LjArytKOG8qaMrKQQ3mFukHs88= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= +github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/leonklingele/grouper v1.1.0/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= github.com/letsencrypt/pkcs11key/v4 v4.0.0/go.mod h1:EFUvBDay26dErnNb70Nd0/VW3tJiIbETBPTl9ATXQag= github.com/lib/pq v0.0.0-20180327071824-d34b9ff171c2/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= @@ -1224,6 +1301,7 @@ github.com/libp2p/go-libp2p-testing v0.7.0/go.mod h1:OLbdn9DbgdMwv00v+tlp1l3oe2C github.com/libp2p/go-libp2p-testing v0.9.0/go.mod h1:Td7kbdkWqYTJYQGTwzlgXwaqldraIanyjuRiAbK/XQU= github.com/libp2p/go-libp2p-testing v0.9.2/go.mod h1:Td7kbdkWqYTJYQGTwzlgXwaqldraIanyjuRiAbK/XQU= github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA= +github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg= github.com/libp2p/go-libp2p-tls v0.3.0/go.mod h1:fwF5X6PWGxm6IDRwF3V8AVCCj/hOd5oFlg+wo2FxJDY= github.com/libp2p/go-libp2p-tls v0.4.1/go.mod h1:EKCixHEysLNDlLUoKxv+3f/Lp90O2EXNjTr0UQDnrIw= github.com/libp2p/go-libp2p-transport-upgrader v0.5.0/go.mod h1:Rc+XODlB3yce7dvFV4q/RmyJGsFcCZRkeZMu/Zdg0mo= @@ -1274,8 +1352,8 @@ github.com/libp2p/go-yamux/v4 v4.0.1/go.mod h1:NWjl8ZTLOGlozrXSOZ/HlfG++39iKNnM5 github.com/libp2p/zeroconf/v2 v2.1.1/go.mod h1:fuJqLnUwZTshS3U/bMRJ3+ow/v9oid1n0DmyYyNO1Xs= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= -github.com/linxGnu/grocksdb v1.7.16 h1:Q2co1xrpdkr5Hx3Fp+f+f7fRGhQFQhvi/+226dtLmA8= -github.com/linxGnu/grocksdb v1.7.16/go.mod h1:JkS7pl5qWpGpuVb3bPqTz8nC12X3YtPZT+Xq7+QfQo4= +github.com/linxGnu/grocksdb v1.8.6 h1:O7I6SIGPrypf3f/gmrrLUBQDKfO8uOoYdWf4gLS06tc= +github.com/linxGnu/grocksdb v1.8.6/go.mod h1:xZCIb5Muw+nhbDK4Y5UJuOrin5MceOuiXkVUR7vp4WY= github.com/lucas-clemente/quic-go v0.23.0/go.mod h1:paZuzjXCE5mj6sikVLMvqXk8lJV2AsqtJ6bDhjEfxx0= github.com/lucas-clemente/quic-go v0.25.0/go.mod h1:YtzP8bxRVCBlO77yRanE264+fY/T2U9ZlW1AaHOsMOg= github.com/lucas-clemente/quic-go v0.27.0/go.mod h1:AzgQoPda7N+3IqMMMkywBKggIFo2KT6pfnlrQ2QieeI= @@ -1325,6 +1403,7 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= @@ -1334,8 +1413,8 @@ github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.14.9/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517/go.mod h1:KQ7+USdGKfpPjXk4Ga+5XxQM4Lm4e3gAogrreFAYpOg= github.com/mgechev/revive v1.2.1/go.mod h1:+Ro3wqY4vakcYNtkBWdZC7dBg1xSB6sp054wWwmeFm0= @@ -1357,9 +1436,6 @@ github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b h1:z78hV3sbSMAUoyUM github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b/go.mod h1:lxPUiZwKoFL8DUUmalo2yJJUCxbPKtm8OKfqr2/FTNU= github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc h1:PTfri+PuQmWDqERdnNMiD9ZejrlswWrCpBEZgWOiTrc= github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc/go.mod h1:cGKTAVKx4SxOuR/czcZ/E2RSJ3sfHs8FpHhQ5CWMf9s= -github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= -github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 h1:QRUSJEgZn2Snx0EmT/QLXibWjSUDjKWvXIT19NBVp94= -github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= @@ -1397,6 +1473,7 @@ github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdx github.com/moby/term v0.0.0-20201216013528-df9cb8a40635/go.mod h1:FBS0z0QWA44HXygs7VXDUOGoN/1TV3RuWkLO04am3wc= github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= +github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -1407,6 +1484,8 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/moricho/tparallel v0.2.1/go.mod h1:fXEIZxG2vdfl0ZF8b42f5a78EhjjD5mX8qUplsoSU4k= +github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mozilla/scribe v0.0.0-20180711195314-fb71baf557c1/go.mod h1:FIczTrinKo8VaLxe6PWTPEXRXDIHz2QAwiaBaP5/4a8= github.com/mozilla/tls-observatory v0.0.0-20210609171429-7bc42856d2e5/go.mod h1:FUqVoUPHSEdDR0MnFM3Dh8AU0pZHLXUD127SAJGER/s= github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= @@ -1436,8 +1515,8 @@ github.com/multiformats/go-multiaddr v0.3.3/go.mod h1:lCKNGP1EQ1eZ35Za2wlqnabm9x github.com/multiformats/go-multiaddr v0.4.0/go.mod h1:YcpyLH8ZPudLxQlemYBPhSm0/oCXAT8Z4mzFpyoPyRc= github.com/multiformats/go-multiaddr v0.4.1/go.mod h1:3afI9HfVW8csiF8UZqtpYRiDyew8pRX7qLIGHu9FLuM= github.com/multiformats/go-multiaddr v0.5.0/go.mod h1:3KAxNkUqLTJ20AAwN4XVX4kZar+bR+gh4zgbfr3SNug= -github.com/multiformats/go-multiaddr v0.12.0 h1:1QlibTFkoXJuDjjYsMHhE73TnzJQl8FSWatk/0gxGzE= -github.com/multiformats/go-multiaddr v0.12.0/go.mod h1:WmZXgObOQOYp9r3cslLlppkrz1FYSHmE834dfz/lWu8= +github.com/multiformats/go-multiaddr v0.12.1 h1:vm+BA/WZA8QZDp1pF1FWhi5CT3g1tbi5GJmqpb6wnlk= +github.com/multiformats/go-multiaddr v0.12.1/go.mod h1:7mPkiBMmLeFipt+nNSq9pHZUeJSt8lHBgH6yhj0YQzE= github.com/multiformats/go-multiaddr-dns v0.3.1 h1:QgQgR+LQVt3NPTjbrLLpsaT2ufAA2y0Mkk+QRVJbW3A= github.com/multiformats/go-multiaddr-dns v0.3.1/go.mod h1:G/245BRQ6FJGmryJCrOuTdB37AMA5AMOVuO6NY3JwTk= github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= @@ -1499,14 +1578,16 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA github.com/nishanths/exhaustive v0.8.1/go.mod h1:qj+zJJUgJ76tR92+25+03oYUhzF4R7/2Wk7fGTfCHmg= github.com/nishanths/predeclared v0.0.0-20190419143655-18a43bb90ffc/go.mod h1:62PewwiQTlm/7Rj+cxVYqZvDIUc+JjZq6GHAC1fsObQ= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/noot/ring-go v0.0.0-20231019173746-6c4b33bcf03f h1:1+NP/H13eFAqBYrGpRkbJUWVWIO2Zr2eP7a/q0UtZVQ= -github.com/noot/ring-go v0.0.0-20231019173746-6c4b33bcf03f/go.mod h1:0t3gzoSfW2bkTce1E/Jis3MQpjiKGhAgqieFK+nkQsI= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oasisprotocol/curve25519-voi v0.0.0-20210609091139-0a56a4bca00b/go.mod h1:TLJifjWF6eotcfzDjKZsDqWJ+73Uvj/N85MvVyrvynM= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= +github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= github.com/oklog/ulid/v2 v2.0.2/go.mod h1:mtBL0Qe/0HAx6/a4Z30qxVIAL1eQDweXq5lxOEiwQ68= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= @@ -1535,14 +1616,17 @@ github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je4 github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc= +github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= +github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= +github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= github.com/opencontainers/runc v1.1.2/go.mod h1:Tj1hFw6eFWp/o33uxGf5yF2BX5yz2Z6iptFpuvbbKqc= github.com/opencontainers/runc v1.1.3/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= github.com/opencontainers/runc v1.1.7 h1:y2EZDS8sNng4Ksf0GUYNhKbTShZJPJg1FiXJNH/uoCk= +github.com/opencontainers/runc v1.1.7/go.mod h1:CbUumNnWCuTGFukNXahoo/RFBZvDAgRh/smNYNOhA50= github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg= @@ -1563,7 +1647,6 @@ github.com/openzipkin/zipkin-go v0.2.5/go.mod h1:KpXfKdgRDnnhsxw4pNIH9Md5lyFqKUa github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/ory/dockertest/v3 v3.9.1/go.mod h1:42Ir9hmvaAPm0Mgibk6mBPi7SFvTXxEcnztDYOJ//uM= -github.com/ory/dockertest/v3 v3.10.0 h1:4K3z2VMe8Woe++invjaTB7VRyQXQy5UY+loujO4aNE4= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= @@ -1588,15 +1671,18 @@ github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9 github.com/performancecopilot/speed/v4 v4.0.0/go.mod h1:qxrSyuDGrTOWfV+uKRFhfxw6h/4HXRGUiZiufxo49BM= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 h1:hDSdbBuw3Lefr6R18ax0tZ2BJeNB3NehB3trOwYBsdU= -github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc h1:8bQZVK1X6BJR/6nYUPxQEP+ReTsceJTKizeuwjWOPUA= +github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw= github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -1604,16 +1690,14 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= github.com/pkg/profile v1.6.0/go.mod h1:qBsxPvzyUincmltOk6iyRVxHYg4adc0OFOv72ZdLa18= +github.com/pkg/profile v1.7.0 h1:hnbDkaNWPCLMO9wGLdBFTIZvzDrDfBM2072E1S9gJkA= +github.com/pkg/profile v1.7.0/go.mod h1:8Uer0jas47ZQMJ7VD+OHknK4YDY07LPUC6dEvqDjvNo= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pokt-network/smt v0.9.2 h1:h/GnFm1F6mNBbF1hopr+9+y7nr173SU55NX7NxTVU0Y= -github.com/pokt-network/smt v0.9.2/go.mod h1:S4Ho4OPkK2v2vUCHNtA49XDjqUC/OFYpBbynRVYmxvA= -github.com/pokt-network/smt/kvstore/badger v0.0.0-20240104123447-abb5c71c14ce h1:JCpmaD35pHq9VWbePNuysIVOX5ybmVzThNY2BcurjVE= -github.com/pokt-network/smt/kvstore/badger v0.0.0-20240104123447-abb5c71c14ce/go.mod h1:VG/uGRf6wmiDnSxee8rmVtmtLXrVM2SK4/xXtrBFeZ0= github.com/polydawn/refmt v0.89.0 h1:ADJTApkvkeBZsN0tBTx8QjpD9JkmxbKp0cxfr9qszm4= github.com/polydawn/refmt v0.89.0/go.mod h1:/zvteZs/GwLtCgZ4BL6CBsk9IKIlexP43ObX9AxTqTw= github.com/polyfloyd/go-errorlint v1.0.0/go.mod h1:KZy4xxPJyy88/gldCe5OdW6OQRtNO3EZE7hXzmnebgA= @@ -1633,16 +1717,16 @@ github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqr github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= -github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= +github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= +github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 h1:v7DLqVdK4VrYkVD5diGdl4sxJurKJEMnODWRJlxV9oM= -github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= +github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= +github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= @@ -1655,8 +1739,8 @@ github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9 github.com/prometheus/common v0.30.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.33.0/go.mod h1:gB3sOl7P0TvJabZpLY5uQMpUqRCPPCyRLCZYc7JZTNE= -github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= -github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= +github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= +github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= @@ -1667,8 +1751,8 @@ github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= -github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= +github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= +github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/pseudomuto/protoc-gen-doc v1.3.2/go.mod h1:y5+P6n3iGrbKG+9O04V5ld71in3v/bX88wUwgt+U8EA= github.com/pseudomuto/protokit v0.2.0/go.mod h1:2PdH30hxVHsup8KpBTOXTBeMVhJZVio3Q8ViKSAXT0Q= github.com/quasilyte/go-ruleguard v0.3.1-0.20210203134552-1b5a410e1cc8/go.mod h1:KsAh3x0e7Fkpgs+Q9pNLS5XpFSvYCEVl5gP9Pp1xp30= @@ -1689,8 +1773,6 @@ github.com/quic-go/quic-go v0.37.6 h1:2IIUmQzT5YNxAiaPGjs++Z4hGOtIR0q79uS5qE9ccf github.com/quic-go/quic-go v0.37.6/go.mod h1:YsbH1r4mSHPJcLF4k4zruUkLBqctEMBDR6VPvcYjIsU= github.com/quic-go/webtransport-go v0.5.3 h1:5XMlzemqB4qmOlgIus5zB45AcZ2kCgCy2EptUrfOPWU= github.com/quic-go/webtransport-go v0.5.3/go.mod h1:OhmmgJIzTTqXK5xvtuX0oBpLV2GkLWNDA+UeTGJXErU= -github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= -github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= github.com/raulk/clock v1.1.0/go.mod h1:3MpVxdZ/ODBQDxbN+kzshf5OSZwPjtMDx6BBXBmOeY0= github.com/raulk/go-watchdog v1.2.0/go.mod h1:lzSbAl5sh4rtI8tYHU01BWIDzgzqaQLj6RcA1i4mlqI= github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtBsk= @@ -1699,10 +1781,6 @@ github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqn github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/regen-network/gocuke v0.6.2 h1:pHviZ0kKAq2U2hN2q3smKNxct6hS0mGByFMHGnWA97M= -github.com/regen-network/gocuke v0.6.2/go.mod h1:zYaqIHZobHyd0xOrHGPQjbhGJsuZ1oElx150u2o1xuk= -github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= -github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= github.com/remyoudompheng/go-dbus v0.0.0-20121104212943-b7232d34b1d5/go.mod h1:+u151txRmLpwxBmpYn9z3d1sdJdjRPQpsXuYeY9jNls= github.com/remyoudompheng/go-liblzma v0.0.0-20190506200333-81bf2d431b96/go.mod h1:90HvCY7+oHHUKkbeMCiHt1WuFR2/hPJ9QrljDG+v6ls= github.com/remyoudompheng/go-misc v0.0.0-20190427085024-2d6ac652a50e/go.mod h1:80FQABjoFzZ2M5uEa6FUaJYEmqU2UOKojlFVak1UAwI= @@ -1714,12 +1792,12 @@ github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4 github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= -github.com/rollkit/celestia-openrpc v0.3.0 h1:jMLsdLNQ7T20yiNDlisBhlyurFOpN1gZ6vC068FPrQA= -github.com/rollkit/celestia-openrpc v0.3.0/go.mod h1:2ZhU01YF2hsHIROWzxfMZOYM09Kgyy4roH5JWoNJzp0= -github.com/rollkit/cosmos-sdk v0.47.3-rollkit-v0.10.6-no-fraud-proofs h1:D9O/mnXjjIAF0mOsANByeWRwSDaVH587SjO6kgWVRyM= -github.com/rollkit/cosmos-sdk v0.47.3-rollkit-v0.10.6-no-fraud-proofs/go.mod h1:PNGEX1lXPh8yeJ6rYD6WkKJ6cwg4FuPh3OJzqpedKak= -github.com/rollkit/rollkit v0.10.6 h1:90EU4jSbIVGRhSmSfen5paJ92d2RtB9A84bbXX0cjCA= -github.com/rollkit/rollkit v0.10.6/go.mod h1:CfgrLRPIPXYH3gcxeanQM8QjLP26Q1NWHzI7lXGoU40= +github.com/rollkit/cosmos-sdk v0.50.1-rollkit-v0.11.19-no-fraud-proofs h1:ZtbgC7yOv0Rw2efD7v3xyOSTRpAuJcLtxNCI8Mvy+U4= +github.com/rollkit/cosmos-sdk v0.50.1-rollkit-v0.11.19-no-fraud-proofs/go.mod h1:FEBYsCT6onxNk7eNAdU8+O7jDrbn+XJAkO4S1zFoQv0= +github.com/rollkit/go-da v0.2.0 h1:rNpWBa2inczgZ955ky3wy8FbrMajzVbm0UfbBGzm5UE= +github.com/rollkit/go-da v0.2.0/go.mod h1:Kef0XI5ecEKd3TXzI8S+9knAUJnZg0svh2DuXoCsPlM= +github.com/rollkit/rollkit v0.11.19 h1:MVOHw8pYFyvSS+eFx4v3IrUQTnFKatbo/GbLG768nUI= +github.com/rollkit/rollkit v0.11.19/go.mod h1:7qJgRT0LJCOrW5PgVUfufD09MVTvuZ4NLQAKA8Zcrak= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo= @@ -1727,18 +1805,19 @@ github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.27.0/go.mod h1:7frBqO0oezxmnO7GF86FY++uy8I0Tk/If5ni1G9Qc0U= -github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c= -github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w= +github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A= +github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryancurrah/gomodguard v1.2.3/go.mod h1:rYbA/4Tg5c54mV1sv4sQTP5WOPBcoLtnBZ7/TEhXAbg= github.com/ryanrolds/sqlclosecheck v0.3.0/go.mod h1:1gREqxyTGR3lVtpngyFo3hZAgk0KCtEdgEkHwDbigdA= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig= github.com/sagikazarmark/crypt v0.6.0/go.mod h1:U8+INwJo3nBv1m6A/8OBXAq7Jnpspk5AxSgDyEQcea8= -github.com/sagikazarmark/locafero v0.3.0 h1:zT7VEGWC2DTflmccN/5T1etyKvxSxpHsjb9cJvm4SvQ= -github.com/sagikazarmark/locafero v0.3.0/go.mod h1:w+v7UsPNFwzF1cHuOajOOzoq4U7v/ig1mpRjqV+Bu1U= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= @@ -1783,6 +1862,7 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sivchari/containedctx v1.0.2/go.mod h1:PwZOeqm4/DLoJOqMSIJs3aKqXRX4YO+uXww087KZ7Bw= github.com/sivchari/nosnakecase v1.5.0/go.mod h1:CwDzrzPea40/GB6uynrNLiorAlgFRvRbFSgJx2Gs+QY= github.com/sivchari/tenv v1.6.0/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= @@ -1811,20 +1891,20 @@ github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= -github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY= -github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= -github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= -github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= +github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= +github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= -github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= @@ -1834,11 +1914,13 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM= github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= -github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI= -github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI= +github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= +github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc= github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= github.com/stbenjam/no-sprintf-host-port v0.1.1/go.mod h1:TLhvtIvONRzdmkFiio4O8LHsN9N74I+PhRquPsxpL0I= +github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs= +github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= @@ -1884,11 +1966,10 @@ github.com/tendermint/tm-db v0.6.6/go.mod h1:wP8d49A85B7/erz/r4YbKssKw6ylsO/hKtF github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8= -github.com/tidwall/btree v1.6.0 h1:LDZfKfQIBHGHWSwckhXI0RPSXzlo+KYdjK7FWSqOzzg= -github.com/tidwall/btree v1.6.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= -github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM= -github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= -github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= +github.com/tetratelabs/wazero v1.6.0 h1:z0H1iikCdP8t+q341xqepY4EWvHEw8Es7tlqiVzlP3g= +github.com/tetratelabs/wazero v1.6.0/go.mod h1:0U0G41+ochRKoPKCJlh0jMg1CHkyfK8kDqiirMmKY8A= +github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= +github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg= github.com/tj/assert v0.0.3/go.mod h1:Ne6X72Q+TB1AteidzQncjw9PabbMp4PBMZ1k+vd1Pvk= @@ -1906,7 +1987,8 @@ github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= +github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= +github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= @@ -1921,6 +2003,8 @@ github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyC github.com/valyala/fasthttp v1.30.0/go.mod h1:2rsYD01CKFrjjsvFxx75KlEUNpWNBY9JWD3K/7o2Cus= github.com/valyala/quicktemplate v1.7.0/go.mod h1:sqKJnoaOF88V07vkO+9FL8fb9uZg/VPSJnLYn+LmLk8= github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= +github.com/vbatts/tar-split v0.11.5 h1:3bHCTIheBm1qFTcgh9oPu+nNBtX+XJIupG/vacinCts= +github.com/vbatts/tar-split v0.11.5/go.mod h1:yZbwRsSeGjusneWgA781EKej9HF8vme8okylkAeNKLk= github.com/vektra/mockery/v2 v2.14.0/go.mod h1:bnD1T8tExSgPD1ripLkDbr60JA9VtQeu12P3wgLZd7M= github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= @@ -1936,11 +2020,8 @@ github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9/go.mod h1:j4l84 github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= -github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= @@ -1959,20 +2040,16 @@ github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= -github.com/zondax/hid v0.9.1 h1:gQe66rtmyZ8VeGFcOpbuH3r7erYtNEAezCAYu8LdkJo= -github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= -github.com/zondax/ledger-go v0.14.1 h1:Pip65OOl4iJ84WTpA4BKChvOufMhhbxED3BaihoZN4c= -github.com/zondax/ledger-go v0.14.1/go.mod h1:fZ3Dqg6qcdXWSOJFKMG8GCTnD7slO/RL2feOQv8K320= -gitlab.com/NebulousLabs/errors v0.0.0-20171229012116-7ead97ef90b8/go.mod h1:ZkMZ0dpQyWwlENaeZVBiQRjhMEZvk6VTXquzl3FOFP8= -gitlab.com/NebulousLabs/errors v0.0.0-20200929122200-06c536cf6975 h1:L/ENs/Ar1bFzUeKx6m3XjlmBgIUlykX9dzvp5k9NGxc= -gitlab.com/NebulousLabs/fastrand v0.0.0-20181126182046-603482d69e40 h1:dizWJqTWjwyD8KGcMOwgrkqu1JIkofYgKkmDeNE7oAs= -gitlab.com/NebulousLabs/fastrand v0.0.0-20181126182046-603482d69e40/go.mod h1:rOnSnoRyxMI3fe/7KIbVcsHRGxe30OONv8dEgo+vCfA= +github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= +github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= +github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= +github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= gitlab.com/bosi/decorder v0.2.2/go.mod h1:9K1RB5+VPNQYtXtTDAzd2OEftsZb1oV0IrJrzChSdGE= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= -go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= -go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= +go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.etcd.io/etcd v0.0.0-20200513171258-e048e166ab9c/go.mod h1:xCI7ZzBfRuGgBXyXO6yfWfDmlWd35khcWpUa4L0xI/k= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= @@ -1999,13 +2076,25 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s= -go.opentelemetry.io/otel v1.16.0/go.mod h1:vl0h9NUa1D5s1nv3A5vZOYWn8av4K8Ml6JDeHrT/bx4= -go.opentelemetry.io/otel/metric v1.16.0 h1:RbrpwVG1Hfv85LgnZ7+txXioPDoh6EdbZHo26Q3hqOo= -go.opentelemetry.io/otel/metric v1.16.0/go.mod h1:QE47cpOmkwipPiefDwo2wDzwJrlfxxNYodqc4xnGCo4= -go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs= -go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLkqr2QVwea0ef0= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 h1:sv9kVfal0MK0wBMCOGr+HeJm9v803BkJxGrk2au7j08= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0/go.mod h1:SK2UL73Zy1quvRPonmOmRDiWk1KBV3LyIeeIxcEApWw= +go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y= +go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 h1:9M3+rhx7kZCIQQhQRYaZCdNu1V73tm4TvXs2ntl98C4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0/go.mod h1:noq80iT8rrHP1SfybmPiRGc9dc5M8RPmGvtwo7Oo7tc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0 h1:FyjCyI9jVEfqhUh2MoSkmolPjfh5fp2hnV0b0irxH4Q= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0/go.mod h1:hYwym2nDEeZfG/motx0p7L7J1N1vyzIThemQsb4g2qY= +go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg= +go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY= +go.opentelemetry.io/otel/sdk v1.22.0 h1:6coWHw9xw7EfClIC/+O31R8IY3/+EiRFHevmHafB2Gw= +go.opentelemetry.io/otel/sdk v1.22.0/go.mod h1:iu7luyVGYovrRpe2fmj3CVKouQNdTOkxtLzPvPz1DOc= +go.opentelemetry.io/otel/sdk/metric v1.19.0 h1:EJoTO5qysMsYCa+w4UghwFV/ptQgqSL/8Ni+hx+8i1k= +go.opentelemetry.io/otel/sdk/metric v1.19.0/go.mod h1:XjG0jQyFJrv2PbMvwND7LwCEhsJzCzV5210euduKcKY= +go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= +go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= +go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -2013,6 +2102,7 @@ go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= +go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/dig v1.17.0 h1:5Chju+tUvcC+N7N6EV08BJz41UZuO3BmHcN4A287ZLI= go.uber.org/dig v1.17.0/go.mod h1:rTxpf7l5I0eBTlE6/9RL+lDybC7WFwY2QH55ZSjy1mU= go.uber.org/fx v1.20.0 h1:ZMC/pnRvhsthOZh9MZjMq5U8Or3mA9zBSPaLnzs3ihQ= @@ -2022,6 +2112,7 @@ go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpK go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= +go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= @@ -2038,10 +2129,11 @@ go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= +go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= -go.uber.org/zap v1.25.0 h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c= -go.uber.org/zap v1.25.0/go.mod h1:JIAUzQIH94IC4fOJQm7gMmBJP5k7wQfdcnYdPoEXJYk= +go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= +go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -2062,8 +2154,6 @@ golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200109152110-61a87790db17/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -2086,9 +2176,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= -golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -2103,8 +2192,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= +golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 h1:hNQpMuAJe5CtcUqCXaWga3FHu+kQvCqcsoVaQgSV60o= +golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= @@ -2222,8 +2311,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= -golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -2252,8 +2341,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4= -golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4= +golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ= +golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -2271,8 +2360,8 @@ golang.org/x/sync v0.0.0-20220513210516-0976fa681c29/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -2375,7 +2464,6 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -2409,23 +2497,24 @@ golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.14.0 h1:LGK9IlZ8T9jvdy6cTdfKUCltatMFOehAQo9SRC46UQ8= -golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww= +golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= +golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -2435,6 +2524,7 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= @@ -2444,10 +2534,14 @@ golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181130052023-1c3d964395ce/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -2552,8 +2646,8 @@ golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E golang.org/x/tools v0.1.11-0.20220513221640-090b14e8501f/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8= -golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk= +golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= +golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -2565,8 +2659,8 @@ golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3j golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= -gonum.org/v1/gonum v0.11.0 h1:f1IJhK4Km5tBJmaiJXtk/PkL4cdVX6J+tGiM187uT5E= -gonum.org/v1/gonum v0.11.0/go.mod h1:fSG4YDCxxUZQJ7rKsQrj0gMOg00Il0Z96/qMA4bVQhA= +gonum.org/v1/gonum v0.12.0 h1:xKuo6hzt+gMav00meVPUlXwSdoEJP46BR+wdxQEFK2o= +gonum.org/v1/gonum v0.12.0/go.mod h1:73TDxJfAAHeA8Mk9mf8NlIppyhQNo5GLTcYeqgo2lvY= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= @@ -2625,8 +2719,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.143.0 h1:o8cekTkqhywkbZT6p1UHJPZ9+9uuCAJs/KYomxZB8fA= -google.golang.org/api v0.143.0/go.mod h1:FoX9DO9hT7DLNn97OuoZAGSDuNAXdJRuGK98rSUgurk= +google.golang.org/api v0.153.0 h1:N1AwGhielyKFaUqH07/ZSIQR3uNPcV7NVw0vj+j4iR4= +google.golang.org/api v0.153.0/go.mod h1:3qNJX5eOmhiWYc67jRA/3GsDw97UFb5ivv7Y2PrriAY= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -2636,10 +2730,10 @@ google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww google.golang.org/appengine v1.6.2/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= +google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto v0.0.0-20170818010345-ee236bd376b0/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= @@ -2667,7 +2761,6 @@ google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= @@ -2762,14 +2855,13 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb h1:XFBgcDwm7irdHTbz4Zk2h7Mh+eis4nfJEFQFYzJzuIA= -google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= -google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb h1:lK0oleSc7IQsUxO3U5TjL9DWlsxpEBemh+zpB7IqhWI= -google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 h1:N3bU/SQDCDyD6R528GJ/PwW9KjYcJA3dgyH+MovAkIM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:KSqppvjFjtoCI+KGd4PELB0qLNxdJHRGqRI09mB6pQA= +google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 h1:nz5NESFLZbJGPFxDT/HCn+V1mZ8JGNoY4nUpmW/Y2eg= +google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917/go.mod h1:pZqR+glSb11aJ+JQcczCvgf47+duRuzNSKqE8YAQnV0= +google.golang.org/genproto/googleapis/api v0.0.0-20240116215550-a9fa1716bcac h1:OZkkudMUu9LVQMCoRUbI/1p5VCo9BOrlvkqMvWtqa6s= +google.golang.org/genproto/googleapis/api v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:B5xPO//w8qmBDjGReYLpR6UJPnkldGkCSMoH/2vxJeg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac h1:nUQEQmH/csSvFECKYRv6HWEyypysidKl2I6Qpsglq/0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= @@ -2817,8 +2909,9 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= +google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 h1:M1YKkFIboKNieVO5DLUEVzQfGwJD30Nv2jfUgzb5UcE= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -2836,8 +2929,8 @@ google.golang.org/protobuf v1.27.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -2884,8 +2977,8 @@ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= gotest.tools/v3 v3.2.0/go.mod h1:Mcr9QNxkg0uMvy/YElmo4SpXgJKWgQvYrT7Kw5RzJ1A= -gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY= -gotest.tools/v3 v3.5.0/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= +gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= +gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -2908,16 +3001,16 @@ nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0 nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= pgregory.net/rapid v0.4.8/go.mod h1:Z5PbWqjvWR1I3UGjvboUuan4fe4ZYEYNLNQLExzCoUs= -pgregory.net/rapid v0.5.5 h1:jkgx1TjbQPD/feRoK+S/mXw9e1uj6WilpHrXJowi6oA= -pgregory.net/rapid v0.5.5/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= +pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= +pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= -sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= -sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= diff --git a/localnet/kubernetes/celestia-rollkit.yaml b/localnet/kubernetes/celestia-rollkit.yaml index 25e81f46a..a836109cd 100644 --- a/localnet/kubernetes/celestia-rollkit.yaml +++ b/localnet/kubernetes/celestia-rollkit.yaml @@ -18,6 +18,10 @@ spec: name: gateway port: 26659 targetPort: 26659 + - protocol: TCP + name: grpc-da + port: 26650 + targetPort: 26650 --- apiVersion: apps/v1 kind: Deployment @@ -37,31 +41,13 @@ spec: # TODO: Add resource limits containers: - name: celestia - image: ghcr.io/rollkit/local-celestia-devnet:v0.12.1 + image: ghcr.io/rollkit/local-celestia-devnet:v0.12.7 ports: + # https://github.com/rollkit/local-celestia-devnet?tab=readme-ov-file#exposed-ports - containerPort: 26657 - containerPort: 26658 - containerPort: 26659 - volumeMounts: - - name: bridge-volume - mountPath: /home/celestia/bridge - - name: secret-update-sidecar - image: ghcr.io/rollkit/local-celestia-devnet:v0.12.1 - command: ["/bin/bash", "-c", "--"] - # TODO(@okdas): Very scary line. Basically, waits until the node key (NJ3XILLTMVRXEZLUFZVHO5A) exists, signs the JWT and pushes it to k8s secret. - args: - [ - 'while true; do if [ -f /home/celestia/bridge/keys/NJ3XILLTMVRXEZLUFZVHO5A ]; then OUTPUT=$(celestia bridge --node.store /home/celestia/bridge auth admin); BASE64_OUTPUT=$(echo -n $OUTPUT | base64 -w 0); TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token); PAYLOAD=$(echo -n ''{"apiVersion":"v1","kind":"Secret","metadata":{"name":"celestia-secret"},"data":{"auth_token":"''${BASE64_OUTPUT}''"}}''); RESPONSE=$(curl -k -H "Authorization: Bearer $TOKEN" -H ''Content-Type: application/json'' -X PUT -d "$PAYLOAD" https://kubernetes.default.svc.cluster.local/api/v1/namespaces/default/secrets/celestia-secret); echo $RESPONSE | grep ''"code": 404'' >/dev/null && curl -k -H "Authorization: Bearer $TOKEN" -H ''Content-Type: application/json'' -X POST -d "$PAYLOAD" https://kubernetes.default.svc.cluster.local/api/v1/namespaces/default/secrets; while true; do sleep 86400; done; fi; sleep 2; done;', - ] - volumeMounts: - - name: bridge-volume - mountPath: /home/celestia/bridge - volumes: - - name: bridge-volume - emptyDir: {} - - name: localnet-celestia-tokens - secret: - secretName: localnet-celestia-tokens + - containerPort: 26650 --- apiVersion: v1 kind: ServiceAccount diff --git a/localnet/poktrolld/config/app.toml b/localnet/poktrolld/config/app.toml index 6b84cd3fd..6578424da 100644 --- a/localnet/poktrolld/config/app.toml +++ b/localnet/poktrolld/config/app.toml @@ -1,264 +1,58 @@ -# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -############################################################################### -### Base Configuration ### -############################################################################### - -# The minimum gas prices a validator is willing to accept for processing a -# transaction. A transaction's fees must meet the minimum of any denomination -# specified in this config (e.g. 0.25token1;0.0001token2). -minimum-gas-prices = "0upokt" - -# default: the last 362880 states are kept, pruning at 10 block intervals -# nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) -# everything: 2 latest states will be kept; pruning at 10 block intervals. -# custom: allow pruning options to be manually specified through 'pruning-keep-recent', and 'pruning-interval' -pruning = "default" - -# These are applied if and only if the pruning strategy is custom. -pruning-keep-recent = "0" -pruning-interval = "0" - -# HaltHeight contains a non-zero block height at which a node will gracefully -# halt and shutdown that can be used to assist upgrades and testing. -# -# Note: Commitment of state will be attempted on the corresponding block. +app-db-backend = "" halt-height = 0 - -# HaltTime contains a non-zero minimum block time (in Unix seconds) at which -# a node will gracefully halt and shutdown that can be used to assist upgrades -# and testing. -# -# Note: Commitment of state will be attempted on the corresponding block. halt-time = 0 - -# MinRetainBlocks defines the minimum block height offset from the current -# block being committed, such that all blocks past this offset are pruned -# from Tendermint. It is used as part of the process of determining the -# ResponseCommit.RetainHeight value during ABCI Commit. A value of 0 indicates -# that no blocks should be pruned. -# -# This configuration value is only responsible for pruning Tendermint blocks. -# It has no bearing on application state pruning which is determined by the -# "pruning-*" configurations. -# -# Note: Tendermint block pruning is dependant on this parameter in conunction -# with the unbonding (safety threshold) period, state pruning and state sync -# snapshot parameters to determine the correct minimum value of -# ResponseCommit.RetainHeight. -min-retain-blocks = 0 - -# InterBlockCache enables inter-block caching. -inter-block-cache = true - -# IndexEvents defines the set of events in the form {eventType}.{attributeKey}, -# which informs Tendermint what to index. If empty, all events will be indexed. -# -# Example: -# ["message.sender", "message.recipient"] -index-events = [] - -# IavlCacheSize set the size of the iavl tree cache (in number of nodes). iavl-cache-size = 781250 - -# IAVLDisableFastNode enables or disables the fast node feature of IAVL. -# Default is false. iavl-disable-fastnode = false - -# IAVLLazyLoading enable/disable the lazy loading of iavl store. -# Default is false. -iavl-lazy-loading = false - -# AppDBBackend defines the database backend type to use for the application and snapshots DBs. -# An empty string indicates that a fallback will be used. -# First fallback is the deprecated compile-time types.DBBackend value. -# Second fallback (if the types.DBBackend also isn't set), is the db-backend value set in Tendermint's config.toml. -app-db-backend = "" - -############################################################################### -### Telemetry Configuration ### -############################################################################### - -[telemetry] - -# Prefixed with keys to separate services. -service-name = "" - -# Enabled enables the application telemetry functionality. When enabled, -# an in-memory sink is also enabled by default. Operators may also enabled -# other sinks such as Prometheus. -enabled = false - -# Enable prefixing gauge values with hostname. -enable-hostname = false - -# Enable adding hostname to labels. -enable-hostname-label = false - -# Enable adding service to labels. -enable-service-label = false - -# PrometheusRetentionTime, when positive, enables a Prometheus metrics sink. -prometheus-retention-time = 0 - -# GlobalLabels defines a global set of name/value label tuples applied to all -# metrics emitted using the wrapper functions defined in telemetry package. -# -# Example: -# [["chain_id", "cosmoshub-1"]] -global-labels = [ -] - -############################################################################### -### API Configuration ### -############################################################################### +index-events = [] +inter-block-cache = true +min-retain-blocks = 0 +minimum-gas-prices = "0upokt" +pruning = "default" +pruning-interval = "0" +pruning-keep-recent = "0" +query-gas-limit = "0" [api] - -# Enable defines if the API server should be enabled. -enable = false - -# Swagger defines if swagger documentation should automatically be registered. -swagger = false - -# Address defines the API server to listen on. -address = "tcp://localhost:1317" - -# MaxOpenConnections defines the number of maximum open connections. -max-open-connections = 1000 - -# RPCReadTimeout defines the Tendermint RPC read timeout (in seconds). -rpc-read-timeout = 10 - -# RPCWriteTimeout defines the Tendermint RPC write timeout (in seconds). -rpc-write-timeout = 0 - -# RPCMaxBodyBytes defines the Tendermint maximum request body (in bytes). -rpc-max-body-bytes = 1000000 - -# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk). -enabled-unsafe-cors = false - -############################################################################### -### Rosetta Configuration ### -############################################################################### - -[rosetta] - -# Enable defines if the Rosetta API server should be enabled. -enable = false - -# Address defines the Rosetta API server to listen on. -address = ":8080" - -# Network defines the name of the blockchain that will be returned by Rosetta. -blockchain = "app" - -# Network defines the name of the network that will be returned by Rosetta. -network = "network" - -# Retries defines the number of retries when connecting to the node before failing. -retries = 3 - -# Offline defines if Rosetta server should run in offline mode. -offline = false - -# EnableDefaultSuggestedFee defines if the server should suggest fee by default. -# If 'construction/medata' is called without gas limit and gas price, -# suggested fee based on gas-to-suggest and denom-to-suggest will be given. -enable-fee-suggestion = false - -# GasToSuggest defines gas limit when calculating the fee -gas-to-suggest = 200000 - -# DenomToSuggest defines the defult denom for fee suggestion. -# Price must be in minimum-gas-prices. -denom-to-suggest = "uatom" - -############################################################################### -### gRPC Configuration ### -############################################################################### + address = "tcp://0.0.0.0:1317" + enable = true + enabled-unsafe-cors = true + max-open-connections = 1000 + rpc-max-body-bytes = 1000000 + rpc-read-timeout = 10 + rpc-write-timeout = 0 + swagger = false [grpc] - -# Enable defines if the gRPC server should be enabled. -enable = true - -# Address defines the gRPC server address to bind to. -address = "localhost:9090" - -# MaxRecvMsgSize defines the max message size in bytes the server can receive. -# The default value is 10MB. -max-recv-msg-size = "10485760" - -# MaxSendMsgSize defines the max message size in bytes the server can send. -# The default value is math.MaxInt32. -max-send-msg-size = "2147483647" - -############################################################################### -### gRPC Web Configuration ### -############################################################################### + address = "localhost:9090" + enable = true + max-recv-msg-size = "10485760" + max-send-msg-size = "2147483647" [grpc-web] + enable = true -# GRPCWebEnable defines if the gRPC-web should be enabled. -# NOTE: gRPC must also be enabled, otherwise, this configuration is a no-op. -enable = true - -# Address defines the gRPC-web server address to bind to. -address = "localhost:9091" - -# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk). -enable-unsafe-cors = false +[mempool] + max-txs = 5000 -############################################################################### -### State Sync Configuration ### -############################################################################### +[rpc] + cors_allowed_origins = ["*"] -# State sync snapshots allow other nodes to rapidly join the network without replaying historical -# blocks, instead downloading and applying a snapshot of the application state at a given height. [state-sync] + snapshot-interval = 0 + snapshot-keep-recent = 2 -# snapshot-interval specifies the block interval at which local state sync snapshots are -# taken (0 to disable). -snapshot-interval = 0 +[streaming] -# snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all). -snapshot-keep-recent = 2 + [streaming.abci] + keys = [] + plugin = "" + stop-node-on-err = true -############################################################################### -### Store / State Streaming ### -############################################################################### - -[store] -streamers = [] - -[streamers] -[streamers.file] -keys = ["*", ] -write_dir = "" -prefix = "" - -# output-metadata specifies if output the metadata file which includes the abci request/responses -# during processing the block. -output-metadata = "true" - -# stop-node-on-error specifies if propagate the file streamer errors to consensus state machine. -stop-node-on-error = "true" - -# fsync specifies if call fsync after writing the files. -fsync = "false" - -############################################################################### -### Mempool ### -############################################################################### - -[mempool] -# Setting max-txs to 0 will allow for a unbounded amount of transactions in the mempool. -# Setting max_txs to negative 1 (-1) will disable transactions from being inserted into the mempool. -# Setting max_txs to a positive number (> 0) will limit the number of transactions in the mempool, by the specified amount. -# -# Note, this configuration only applies to SDK built-in app-side mempool -# implementations. -max-txs = "5000" +[telemetry] + enable-hostname = false + enable-hostname-label = false + enable-service-label = false + enabled = false + global-labels = [] + prometheus-retention-time = 0 + service-name = "" diff --git a/localnet/poktrolld/config/client.toml b/localnet/poktrolld/config/client.toml index 4da12cd84..7e41c8b68 100644 --- a/localnet/poktrolld/config/client.toml +++ b/localnet/poktrolld/config/client.toml @@ -1,17 +1,5 @@ -# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -############################################################################### -### Client Configuration ### -############################################################################### - -# The network chain ID -chain-id = "poktroll" -# The keyring's backend, where the keys are stored (os|file|kwallet|pass|test|memory) +broadcast-mode = "sync" +chain-id = "" keyring-backend = "test" -# CLI output format (text|json) -output = "text" -# : to Tendermint RPC interface for this chain node = "tcp://localhost:26657" -# Transaction broadcasting mode (sync|async) -broadcast-mode = "sync" +output = "text" diff --git a/localnet/poktrolld/config/config.toml b/localnet/poktrolld/config/config.toml index 2d4cfd233..928e31592 100644 --- a/localnet/poktrolld/config/config.toml +++ b/localnet/poktrolld/config/config.toml @@ -6,6 +6,10 @@ # "$HOME/.cometbft" by default, but could be changed via $CMTHOME env variable # or --home cmd flag. +# The version of the CometBFT binary that created or +# last modified the config file. Do not modify this. +version = "0.38.2" + ####################################################################### ### Main Base Config Options ### ####################################################################### @@ -17,14 +21,6 @@ proxy_app = "tcp://127.0.0.1:26658" # A custom human readable name for this node moniker = "sequencer1" -# If this node is many blocks behind the tip of the chain, BlockSync -# allows them to catchup quickly by downloading blocks in parallel -# and verifying their commits -# -# Deprecated: this key will be removed and BlockSync will be enabled -# unconditionally in the next major release. -block_sync = true - # Database backend: goleveldb | cleveldb | boltdb | rocksdb | badgerdb # * goleveldb (github.com/syndtr/goleveldb - most popular implementation) # - pure go @@ -91,12 +87,12 @@ filter_peers = false [rpc] # TCP or UNIX socket address for the RPC server to listen on -laddr = "tcp://127.0.0.1:26657" +laddr = "tcp://0.0.0.0:26657" # A list of origins a cross-domain request can be executed from # Default value '[]' disables cors support # Use '["*"]' to allow any origin -cors_allowed_origins = [] +cors_allowed_origins = ["*", ] # A list of methods the client is allowed to use with cross-domain requests cors_allowed_methods = ["HEAD", "GET", "POST", ] @@ -204,11 +200,9 @@ pprof_laddr = "localhost:6060" # Address to listen for incoming connections laddr = "tcp://0.0.0.0:26656" -# Address to advertise to peers for them to dial -# If empty, will use the same port as the laddr, -# and will introspect on the listener or use UPnP -# to figure out the address. ip and port are required -# example: 159.89.10.97:26656 +# Address to advertise to peers for them to dial. If empty, will use the same +# port as the laddr, and will introspect on the listener to figure out the +# address. IP and port are required. Example: 159.89.10.97:26656 external_address = "" # Comma separated list of seed nodes to connect to @@ -217,9 +211,6 @@ seeds = "" # Comma separated list of nodes to keep persistent connections to persistent_peers = "" -# UPNP port forwarding -upnp = false - # Path to address book addr_book_file = "config/addrbook.json" @@ -275,13 +266,34 @@ dial_timeout = "3s" ####################################################### [mempool] -# Mempool version to use: -# 1) "v0" - (default) FIFO mempool. -# 2) "v1" - prioritized mempool (deprecated; will be removed in the next release). -version = "v0" - +# The type of mempool for this node to use. +# +# Possible types: +# - "flood" : concurrent linked list mempool with flooding gossip protocol +# (default) +# - "nop" : nop-mempool (short for no operation; the ABCI app is responsible +# for storing, disseminating and proposing txs). "create_empty_blocks=false" is +# not supported. +type = "flood" + +# Recheck (default: true) defines whether CometBFT should recheck the +# validity for all remaining transaction in the mempool after a block. +# Since a block affects the application state, some transactions in the +# mempool may become invalid. If this does not apply to your application, +# you can disable rechecking. recheck = true + +# Broadcast (default: true) defines whether the mempool should relay +# transactions to other peers. Setting this to false will stop the mempool +# from relaying transactions to other peers until they are included in a +# block. In other words, if Broadcast is disabled, only the peer you send +# the tx to will see it until it is included in a block. broadcast = true + +# WalPath (default: "") configures the location of the Write Ahead Log +# (WAL) for the mempool. The WAL is disabled by default. To enable, set +# WalPath to where you want the WAL to be written (e.g. +# "data/mempool.wal"). wal_dir = "" # Maximum number of transactions in the mempool @@ -309,21 +321,20 @@ max_tx_bytes = 1048576 # XXX: Unused due to https://github.com/tendermint/tendermint/issues/5796 max_batch_bytes = 0 -# ttl-duration, if non-zero, defines the maximum amount of time a transaction -# can exist for in the mempool. -# -# Note, if ttl-num-blocks is also defined, a transaction will be removed if it -# has existed in the mempool at least ttl-num-blocks number of blocks or if it's -# insertion time into the mempool is beyond ttl-duration. -ttl-duration = "0s" - -# ttl-num-blocks, if non-zero, defines the maximum number of blocks a transaction -# can exist for in the mempool. -# -# Note, if ttl-duration is also defined, a transaction will be removed if it -# has existed in the mempool at least ttl-num-blocks number of blocks or if -# it's insertion time into the mempool is beyond ttl-duration. -ttl-num-blocks = 0 +# Experimental parameters to limit gossiping txs to up to the specified number of peers. +# We use two independent upper values for persistent and non-persistent peers. +# Unconditional peers are not affected by this feature. +# If we are connected to more than the specified number of persistent peers, only send txs to +# ExperimentalMaxGossipConnectionsToPersistentPeers of them. If one of those +# persistent peers disconnects, activate another persistent peer. +# Similarly for non-persistent peers, with an upper limit of +# ExperimentalMaxGossipConnectionsToNonPersistentPeers. +# If set to 0, the feature is disabled for the corresponding group of peers, that is, the +# number of active connections to that group of peers is not bounded. +# For non-persistent peers, if enabled, a value of 10 is recommended based on experimental +# performance results using the default P2P configuration. +experimental_max_gossip_connections_to_persistent_peers = 0 +experimental_max_gossip_connections_to_non_persistent_peers = 0 ####################################################### ### State Sync Configuration Options ### @@ -367,7 +378,7 @@ chunk_fetchers = "4" [blocksync] # Block Sync version to use: -# +# # In v0.37, v1 and v2 of the block sync protocols were deprecated. # Please use v0 instead. # @@ -382,7 +393,7 @@ version = "v0" wal_file = "data/cs.wal/wal" # How long we wait for a proposal block before prevoting nil -timeout_propose = "3s" +timeout_propose = "1s" # How much timeout_propose increases with each round timeout_propose_delta = "500ms" # How long we wait after receiving +2/3 prevotes for “anything” (ie. not a single block or nil) @@ -396,7 +407,7 @@ timeout_precommit_delta = "500ms" # How long we wait after committing a block, before starting on the new # height (this gives us a chance to receive some more precommits, even # though we already have +2/3). -timeout_commit = "5s" +timeout_commit = "1s" # How many blocks to look back to check existence of the node's consensus votes before joining consensus # When non-zero, the node will panic upon restart diff --git a/pkg/appgateserver/cmd/cmd.go b/pkg/appgateserver/cmd/cmd.go deleted file mode 100644 index 9488f82dd..000000000 --- a/pkg/appgateserver/cmd/cmd.go +++ /dev/null @@ -1,193 +0,0 @@ -package cmd - -import ( - "context" - "errors" - "fmt" - "net/http" - "net/url" - "os" - - "cosmossdk.io/depinject" - cosmosflags "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/rs/zerolog" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/cmd/signals" - "github.com/pokt-network/poktroll/pkg/appgateserver" - appgateconfig "github.com/pokt-network/poktroll/pkg/appgateserver/config" - "github.com/pokt-network/poktroll/pkg/deps/config" - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/polylog/polyzero" -) - -// We're `explicitly omitting default` so that the appgateserver crashes if these aren't specified. -const omittedDefaultFlagValue = "explicitly omitting default" - -var ( - // flagAppGateConfig is the variable containing the AppGate config filepath - // sourced from the `--config` flag. - flagAppGateConfig string - // flagNodeRPCURL is the variable containing the Cosmos node RPC URL flag value. - flagNodeRPCURL string - // flagNodeGRPCURL is the variable containing the Cosmos node GRPC URL flag value. - flagNodeGRPCURL string -) - -// AppGateServerCmd returns the Cobra command for running the AppGate server. -func AppGateServerCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "appgate-server", - Short: "Starts the AppGate server", - Long: `Starts the AppGate server that listens for incoming relay requests and handles -the necessary on-chain interactions (sessions, suppliers, etc) to receive the -respective relay response. - --- App Mode -- -If the server is started with a defined 'self-signing' configuration directive, -it will behave as an Application. Any incoming requests will be signed by using -the private key and ring associated with the 'signing_key' configuration directive. - --- Gateway Mode -- -If the 'self_signing' configuration directive is not provided, the server will -behave as a Gateway. -It will sign relays on behalf of any Application sending it relays, provided -that the address associated with 'signing_key' has been delegated to. This is -necessary for the application<->gateway ring signature to function. - --- App Mode (HTTP) -- -If an application doesn't provide the 'self_signing' configuration directive, -it can still send relays to the AppGate server and function as an Application, -provided that: -1. Each request contains the '?senderAddress=[address]' query parameter -2. The key associated with the 'signing_key' configuration directive belongs - to the address provided in the request, otherwise the ring signature will not be valid.`, - Args: cobra.NoArgs, - RunE: runAppGateServer, - } - - // Custom flags - cmd.Flags().StringVar(&flagAppGateConfig, "config", "", "The path to the appgate config file") - - // Cosmos flags - // TODO_TECHDEBT(#256): Remove unneeded cosmos flags. - cmd.Flags().String(cosmosflags.FlagKeyringBackend, "", "Select keyring's backend (os|file|kwallet|pass|test)") - cmd.Flags().StringVar(&flagNodeRPCURL, cosmosflags.FlagNode, omittedDefaultFlagValue, "Register the default Cosmos node flag, which is needed to initialize the Cosmos query context correctly. It can be used to override the `QueryNodeUrl` field in the config file if specified.") - cmd.Flags().StringVar(&flagNodeGRPCURL, cosmosflags.FlagGRPC, omittedDefaultFlagValue, "Register the default Cosmos node grpc flag, which is needed to initialize the Cosmos query context with grpc correctly. It can be used to override the `QueryNodeGRPCUrl` field in the config file if specified.") - cmd.Flags().Bool(cosmosflags.FlagGRPCInsecure, true, "Used to initialize the Cosmos query context with grpc security options. It can be used to override the `QueryNodeGRPCInsecure` field in the config file if specified.") - - return cmd -} - -func runAppGateServer(cmd *cobra.Command, _ []string) error { - // Create a context that is canceled when the command is interrupted - ctx, cancelCtx := context.WithCancel(cmd.Context()) - defer cancelCtx() - - // Handle interrupt and kill signals asynchronously. - signals.GoOnExitSignal(cancelCtx) - - configContent, err := os.ReadFile(flagAppGateConfig) - if err != nil { - return err - } - - // TODO_TECHDEBT: add logger level and output options to the config. - appGateConfigs, err := appgateconfig.ParseAppGateServerConfigs(configContent) - if err != nil { - return err - } - - // TODO_TECHDEBT: populate logger from the config (ideally, from viper). - loggerOpts := []polylog.LoggerOption{ - polyzero.WithLevel(zerolog.DebugLevel), - polyzero.WithOutput(os.Stderr), - } - - // Construct a logger and associate it with the command context. - logger := polyzero.NewLogger(loggerOpts...) - ctx = logger.WithContext(ctx) - cmd.SetContext(ctx) - - // Setup the AppGate server dependencies. - appGateServerDeps, err := setupAppGateServerDependencies(ctx, cmd, appGateConfigs) - if err != nil { - return fmt.Errorf("failed to setup AppGate server dependencies: %w", err) - } - - logger.Info().Msg("Creating AppGate server...") - - // Create the AppGate server. - appGateServer, err := appgateserver.NewAppGateServer( - appGateServerDeps, - appgateserver.WithSigningInformation(&appgateserver.SigningInformation{ - // provide the name of the key to use for signing all incoming requests - SigningKeyName: appGateConfigs.SigningKey, - // provide whether the appgate server should sign all incoming requests - // with its own ring (for applications) or not (for gateways) - SelfSigning: appGateConfigs.SelfSigning, - }), - appgateserver.WithListeningUrl(appGateConfigs.ListeningEndpoint), - ) - if err != nil { - return fmt.Errorf("failed to create AppGate server: %w", err) - } - - logger.Info(). - Str("listening_endpoint", appGateConfigs.ListeningEndpoint.String()). - Msg("Starting AppGate server...") - - // Start the AppGate server. - if err := appGateServer.Start(ctx); err != nil && !errors.Is(err, http.ErrServerClosed) { - return fmt.Errorf("failed to start app gate server: %w", err) - } else if errors.Is(err, http.ErrServerClosed) { - logger.Info().Msg("AppGate server stopped") - } - - return nil -} - -func setupAppGateServerDependencies( - ctx context.Context, - cmd *cobra.Command, - appGateConfig *appgateconfig.AppGateServerConfig, -) (_ depinject.Config, err error) { - queryNodeRPCURL := appGateConfig.QueryNodeRPCUrl - queryNodeGRPCURL := appGateConfig.QueryNodeGRPCUrl - - // Override the config file's `QueryNodeGRPCUrl` field - // with the `--grpc-addr` flag if it was specified. - // TODO_TECHDEBT(#223) Remove this check once viper is used as SoT for overridable config values. - if flagNodeGRPCURL != omittedDefaultFlagValue { - queryNodeGRPCURL, err = url.Parse(flagNodeGRPCURL) - if err != nil { - return nil, fmt.Errorf("failed to parse grpc query URL: %w", err) - } - } - - // Override the config file's `QueryNodeRPCURL` field - // with the `--node` flag if it was specified. - // TODO_TECHDEBT(#223) Remove this check once viper is used as SoT for overridable config values. - if flagNodeRPCURL != omittedDefaultFlagValue { - queryNodeRPCURL, err = url.Parse(flagNodeRPCURL) - if err != nil { - return nil, fmt.Errorf("failed to parse rpc query URL: %w", err) - } - } - - supplierFuncs := []config.SupplierFn{ - config.NewSupplyLoggerFromCtx(ctx), - config.NewSupplyEventsQueryClientFn(queryNodeRPCURL), // leaf - config.NewSupplyBlockClientFn(), // leaf - config.NewSupplyQueryClientContextFn(queryNodeGRPCURL), // leaf - config.NewSupplyDelegationClientFn(), // leaf - config.NewSupplyAccountQuerierFn(), // leaf - config.NewSupplyApplicationQuerierFn(), // leaf - config.NewSupplySessionQuerierFn(), // leaf - config.NewSupplyRingCacheFn(), - - config.NewSupplyPOKTRollSDKFn(appGateConfig.SigningKey), - } - - return config.SupplyConfig(ctx, cmd, supplierFuncs) -} diff --git a/pkg/appgateserver/config/appgate_configs_reader.go b/pkg/appgateserver/config/appgate_configs_reader.go deleted file mode 100644 index 706c0b926..000000000 --- a/pkg/appgateserver/config/appgate_configs_reader.go +++ /dev/null @@ -1,83 +0,0 @@ -package config - -import ( - "net/url" - - "gopkg.in/yaml.v2" -) - -// YAMLAppGateServerConfig is the structure used to unmarshal the AppGateServer config file -// TODO_DOCUMENT(@red-0ne): Add proper README documentation for yaml config files. -type YAMLAppGateServerConfig struct { - QueryNodeRPCUrl string `yaml:"query_node_rpc_url"` - QueryNodeGRPCUrl string `yaml:"query_node_grpc_url"` - SigningKey string `yaml:"signing_key"` - SelfSigning bool `yaml:"self_signing"` - ListeningEndpoint string `yaml:"listening_endpoint"` -} - -// AppGateServerConfig is the structure describing the AppGateServer config -type AppGateServerConfig struct { - QueryNodeRPCUrl *url.URL - QueryNodeGRPCUrl *url.URL - SigningKey string - SelfSigning bool - ListeningEndpoint *url.URL -} - -// ParseAppGateServerConfigs parses the stake config file into a AppGateConfig -// NOTE: If SelfSigning is not defined in the config file, it will default to false -func ParseAppGateServerConfigs(configContent []byte) (*AppGateServerConfig, error) { - var yamlAppGateServerConfig YAMLAppGateServerConfig - - if len(configContent) == 0 { - return nil, ErrAppGateConfigEmpty - } - - // Unmarshal the stake config file into a yamlAppGateConfig - if err := yaml.Unmarshal(configContent, &yamlAppGateServerConfig); err != nil { - return nil, ErrAppGateConfigUnmarshalYAML.Wrap(err.Error()) - } - - if len(yamlAppGateServerConfig.SigningKey) == 0 { - return nil, ErrAppGateConfigEmptySigningKey - } - - if len(yamlAppGateServerConfig.ListeningEndpoint) == 0 { - return nil, ErrAppGateConfigInvalidListeningEndpoint - } - - listeningEndpoint, err := url.Parse(yamlAppGateServerConfig.ListeningEndpoint) - if err != nil { - return nil, ErrAppGateConfigInvalidListeningEndpoint.Wrap(err.Error()) - } - - if len(yamlAppGateServerConfig.QueryNodeGRPCUrl) == 0 { - return nil, ErrAppGateConfigInvalidQueryNodeGRPCUrl - } - - queryNodeGRPCUrl, err := url.Parse(yamlAppGateServerConfig.QueryNodeGRPCUrl) - if err != nil { - return nil, ErrAppGateConfigInvalidQueryNodeGRPCUrl.Wrap(err.Error()) - } - - if len(yamlAppGateServerConfig.QueryNodeRPCUrl) == 0 { - return nil, ErrAppGateConfigInvalidQueryNodeRPCUrl - } - - queryNodeRPCUrl, err := url.Parse(yamlAppGateServerConfig.QueryNodeRPCUrl) - if err != nil { - return nil, ErrAppGateConfigInvalidQueryNodeRPCUrl.Wrap(err.Error()) - } - - // Populate the appGateServerConfig with the values from the yamlAppGateServerConfig - appGateServerConfig := &AppGateServerConfig{ - QueryNodeRPCUrl: queryNodeRPCUrl, - QueryNodeGRPCUrl: queryNodeGRPCUrl, - SigningKey: yamlAppGateServerConfig.SigningKey, - SelfSigning: yamlAppGateServerConfig.SelfSigning, - ListeningEndpoint: listeningEndpoint, - } - - return appGateServerConfig, nil -} diff --git a/pkg/appgateserver/config/appgate_configs_reader_test.go b/pkg/appgateserver/config/appgate_configs_reader_test.go deleted file mode 100644 index 82ee6e53f..000000000 --- a/pkg/appgateserver/config/appgate_configs_reader_test.go +++ /dev/null @@ -1,176 +0,0 @@ -package config_test - -import ( - "net/url" - "testing" - - sdkerrors "cosmossdk.io/errors" - "github.com/gogo/status" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/appgateserver/config" - "github.com/pokt-network/poktroll/testutil/yaml" -) - -func Test_ParseAppGateConfigs(t *testing.T) { - tests := []struct { - desc string - - inputConfigYAML string - - expectedError *sdkerrors.Error - expectedConfig *config.AppGateServerConfig - }{ - // Valid Configs - { - desc: "valid: AppGateServer config", - - inputConfigYAML: ` - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - signing_key: app1 - self_signing: true - listening_endpoint: http://localhost:42069 - `, - - expectedError: nil, - expectedConfig: &config.AppGateServerConfig{ - QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, - QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, - SigningKey: "app1", - SelfSigning: true, - ListeningEndpoint: &url.URL{Scheme: "http", Host: "localhost:42069"}, - }, - }, - { - desc: "valid: AppGateServer config with undefined self signing", - - inputConfigYAML: ` - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - signing_key: app1 - listening_endpoint: http://localhost:42069 - `, - - expectedError: nil, - expectedConfig: &config.AppGateServerConfig{ - QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, - QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, - SigningKey: "app1", - SelfSigning: false, - ListeningEndpoint: &url.URL{Scheme: "http", Host: "localhost:42069"}, - }, - }, - // Invalid Configs - { - desc: "invalid: empty AppGateServer config", - - inputConfigYAML: ``, - - expectedError: config.ErrAppGateConfigEmpty, - }, - { - desc: "invalid: no signing key", - - inputConfigYAML: ` - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - # NB: explicitly missing signing key - self_signing: true - listening_endpoint: http://localhost:42069 - `, - - expectedError: config.ErrAppGateConfigEmptySigningKey, - }, - { - desc: "invalid: invalid listening endpoint", - - inputConfigYAML: ` - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - signing_key: app1 - self_signing: true - listening_endpoint: l&ocalhost:42069 - `, - - expectedError: config.ErrAppGateConfigInvalidListeningEndpoint, - }, - { - desc: "invalid: invalid query node grpc url", - - inputConfigYAML: ` - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: 1&27.0.0.1:36658 - signing_key: app1 - self_signing: true - listening_endpoint: http://localhost:42069 - `, - - expectedError: config.ErrAppGateConfigInvalidQueryNodeGRPCUrl, - }, - { - desc: "invalid: missing query node grpc url", - - inputConfigYAML: ` - query_node_rpc_url: tcp://127.0.0.1:36657 - # NB: explicitly missing query_node_grpc_url - signing_key: app1 - self_signing: true - listening_endpoint: http://localhost:42069 - `, - - expectedError: config.ErrAppGateConfigInvalidQueryNodeGRPCUrl, - }, - { - desc: "invalid: invalid query node rpc url", - - inputConfigYAML: ` - query_node_rpc_url: 1&27.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - signing_key: app1 - self_signing: true - listening_endpoint: http://localhost:42069 - `, - - expectedError: config.ErrAppGateConfigInvalidQueryNodeRPCUrl, - }, - { - desc: "invalid: missing query node rpc url", - - inputConfigYAML: ` - # NB: explicitly missing query_node_rpc_url - query_node_grpc_url: tcp://127.0.0.1:36658 - signing_key: app1 - self_signing: true - listening_endpoint: http://localhost:42069 - `, - - expectedError: config.ErrAppGateConfigInvalidQueryNodeRPCUrl, - }, - } - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - normalizedConfig := yaml.NormalizeYAMLIndentation(tt.inputConfigYAML) - config, err := config.ParseAppGateServerConfigs([]byte(normalizedConfig)) - - if tt.expectedError != nil { - require.ErrorIs(t, err, tt.expectedError) - require.Nil(t, config) - stat, ok := status.FromError(tt.expectedError) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.expectedError.Error()) - require.Nil(t, config) - return - } - - require.NoError(t, err) - - require.Equal(t, tt.expectedConfig.SelfSigning, config.SelfSigning) - require.Equal(t, tt.expectedConfig.SigningKey, config.SigningKey) - require.Equal(t, tt.expectedConfig.ListeningEndpoint.String(), config.ListeningEndpoint.String()) - require.Equal(t, tt.expectedConfig.QueryNodeGRPCUrl.String(), config.QueryNodeGRPCUrl.String()) - require.Equal(t, tt.expectedConfig.QueryNodeGRPCUrl.String(), config.QueryNodeGRPCUrl.String()) - }) - } -} diff --git a/pkg/appgateserver/config/errors.go b/pkg/appgateserver/config/errors.go deleted file mode 100644 index 450c75378..000000000 --- a/pkg/appgateserver/config/errors.go +++ /dev/null @@ -1,13 +0,0 @@ -package config - -import sdkerrors "cosmossdk.io/errors" - -var ( - codespace = "appgate_config" - ErrAppGateConfigUnmarshalYAML = sdkerrors.Register(codespace, 1, "config reader cannot unmarshal yaml content") - ErrAppGateConfigEmptySigningKey = sdkerrors.Register(codespace, 2, "empty signing key in AppGateServer config") - ErrAppGateConfigInvalidListeningEndpoint = sdkerrors.Register(codespace, 3, "invalid listening endpoint in AppGateServer config") - ErrAppGateConfigInvalidQueryNodeGRPCUrl = sdkerrors.Register(codespace, 4, "invalid query node grpc url in AppGateServer config") - ErrAppGateConfigInvalidQueryNodeRPCUrl = sdkerrors.Register(codespace, 5, "invalid query node rpc url in AppGateServer config") - ErrAppGateConfigEmpty = sdkerrors.Register(codespace, 6, "empty AppGateServer config") -) diff --git a/pkg/appgateserver/endpoint_selector.go b/pkg/appgateserver/endpoint_selector.go deleted file mode 100644 index 821b18018..000000000 --- a/pkg/appgateserver/endpoint_selector.go +++ /dev/null @@ -1,35 +0,0 @@ -package appgateserver - -import ( - "context" - - "github.com/pokt-network/poktroll/pkg/sdk" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// TODO_IMPROVE: This implements a naive greedy approach that defaults to the -// first available supplier. -// Future optimizations (e.g. Quality-of-Service) can be introduced here. -// TODO(@h5law): Look into different endpoint selection depending on their suitability. -// getRelayerUrl gets the URL of the relayer for the given service. -func (app *appGateServer) getRelayerUrl( - ctx context.Context, - serviceId string, - rpcType sharedtypes.RPCType, - supplierEndpoints []*sdk.SingleSupplierEndpoint, -) (supplierEndpoint *sdk.SingleSupplierEndpoint, err error) { - for _, supplierEndpoint := range supplierEndpoints { - // Skip services that don't match the requested serviceId. - if supplierEndpoint.Header.Service.Id != serviceId { - continue - } - - // Return the first endpoint url that matches the request's RpcType. - if supplierEndpoint.RpcType == rpcType { - return supplierEndpoint, nil - } - } - - // Return an error if no relayer endpoints were found. - return nil, ErrAppGateNoRelayEndpoints -} diff --git a/pkg/appgateserver/error_reply.go b/pkg/appgateserver/error_reply.go deleted file mode 100644 index d049fd481..000000000 --- a/pkg/appgateserver/error_reply.go +++ /dev/null @@ -1,30 +0,0 @@ -package appgateserver - -import ( - "context" - "net/http" - - "github.com/pokt-network/poktroll/pkg/partials" -) - -// replyWithError replies to the application with an error response and writes -// it to the writer provided. -// NOTE: This method is used to reply with an "internal" error that is related -// to the appgateserver itself and not to the relay request. -func (app *appGateServer) replyWithError( - ctx context.Context, - payloadBz []byte, - writer http.ResponseWriter, - err error, -) { - responseBz, err := partials.GetErrorReply(ctx, payloadBz, err) - if err != nil { - app.logger.Error().Err(err).Msg("failed getting error reply") - return - } - - if _, err = writer.Write(responseBz); err != nil { - app.logger.Error().Err(err).Msg("failed writing relay response") - return - } -} diff --git a/pkg/appgateserver/errors.go b/pkg/appgateserver/errors.go deleted file mode 100644 index 17f5456d6..000000000 --- a/pkg/appgateserver/errors.go +++ /dev/null @@ -1,12 +0,0 @@ -package appgateserver - -import sdkerrors "cosmossdk.io/errors" - -var ( - codespace = "appgateserver" - ErrAppGateNoRelayEndpoints = sdkerrors.Register(codespace, 1, "no relay endpoints found") - ErrAppGateMissingAppAddress = sdkerrors.Register(codespace, 2, "missing application address") - ErrAppGateMissingSigningInformation = sdkerrors.Register(codespace, 3, "missing app client signing information") - ErrAppGateMissingListeningEndpoint = sdkerrors.Register(codespace, 4, "missing app client listening endpoint") - ErrAppGateHandleRelay = sdkerrors.Register(codespace, 5, "internal error handling relay request") -) diff --git a/pkg/appgateserver/options.go b/pkg/appgateserver/options.go deleted file mode 100644 index fb164029b..000000000 --- a/pkg/appgateserver/options.go +++ /dev/null @@ -1,19 +0,0 @@ -package appgateserver - -import ( - "net/url" -) - -// WithSigningInformation sets the signing information for the appgate server. -func WithSigningInformation(signingInfo *SigningInformation) appGateServerOption { - return func(appGateServer *appGateServer) { - appGateServer.signingInformation = signingInfo - } -} - -// WithListeningUrl sets the listening URL for the appgate server. -func WithListeningUrl(listeningUrl *url.URL) appGateServerOption { - return func(appGateServer *appGateServer) { - appGateServer.listeningEndpoint = listeningUrl - } -} diff --git a/pkg/appgateserver/server.go b/pkg/appgateserver/server.go deleted file mode 100644 index 6c3494a06..000000000 --- a/pkg/appgateserver/server.go +++ /dev/null @@ -1,215 +0,0 @@ -package appgateserver - -import ( - "bytes" - "context" - "fmt" - "io" - "net/http" - "net/url" - "strings" - - "cosmossdk.io/depinject" - - querytypes "github.com/pokt-network/poktroll/pkg/client/query/types" - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/sdk" -) - -// SigningInformation is a struct that holds information related to the signing -// of relay requests, used by the appGateServer to determine how they will sign -// relay requests (with either their own ring or the rign of the application). -type SigningInformation struct { - // SelfSigning indicates whether the server is running in self-signing mode - SelfSigning bool - - // SigningKeyName is the name of the key in the keyring that corresponds to the - // private key used to sign relay requests. - SigningKeyName string - - // AppAddress is the address of the application that the server is serving if - // If it is nil, then the application address must be included in each request via a query parameter. - AppAddress string -} - -// appGateServer is the server that listens for application requests and relays them to the supplier. -// It is responsible for maintaining the current session for the application, signing the requests, -// and verifying the response signatures. -// The appGateServer is the basis for both applications and gateways, depending on whether the application -// is running their own instance of the appGateServer or they are sending requests to a gateway running an -// instance of the appGateServer, they will need to either include the application address in the request or not. -type appGateServer struct { - logger polylog.Logger - - // signing information holds the signing key and application address for the server - signingInformation *SigningInformation - - // clientCtx is the client context for the application. - // It is used to query for the application's account to unmarshal the supplier's account - // and get the public key to verify the relay response signature. - clientCtx querytypes.Context - - // sdk is the POKTRollSDK that the appGateServer uses to query for the current session - // and send relay requests to the supplier. - sdk sdk.POKTRollSDK - - // listeningEndpoint is the endpoint that the appGateServer will listen on. - listeningEndpoint *url.URL - - // server is the HTTP server that will be used capture application requests - // so that they can be signed and relayed to the supplier. - server *http.Server -} - -// NewAppGateServer creates a new appGateServer instance with the given dependencies. -// -// Required dependencies: -// - polylog.Logger -// - sdkclient.Context -// - client.BlockClient -// - client.AccountQueryClient -// - crypto.RingCache -func NewAppGateServer( - deps depinject.Config, - opts ...appGateServerOption, -) (*appGateServer, error) { - app := &appGateServer{} - - if err := depinject.Inject( - deps, - &app.logger, - &app.clientCtx, - &app.sdk, - ); err != nil { - return nil, err - } - - for _, opt := range opts { - opt(app) - } - - if err := app.validateConfig(); err != nil { - return nil, err - } - - keyRecord, err := app.clientCtx.Keyring.Key(app.signingInformation.SigningKeyName) - if err != nil { - return nil, fmt.Errorf("failed to get key from keyring: %w", err) - } - - appAddress, err := keyRecord.GetAddress() - if err != nil { - return nil, fmt.Errorf("failed to get address from key: %w", err) - } - if app.signingInformation.SelfSigning { - app.signingInformation.AppAddress = appAddress.String() - } - - // TODO_CONSIDERATION: Use app.listeningEndpoint scheme to determine which - // kind of server to create (HTTP, HTTPS, TCP, UNIX, etc...) - app.server = &http.Server{Addr: app.listeningEndpoint.Host} - - return app, nil -} - -// Start starts the appgate server and blocks until the context is done -// or the server returns an error. -func (app *appGateServer) Start(ctx context.Context) error { - // Shutdown the HTTP server when the context is done. - go func() { - <-ctx.Done() - app.server.Shutdown(ctx) - }() - - // Set the HTTP handler. - app.server.Handler = app - - // Start the HTTP server. - return app.server.ListenAndServe() -} - -// Stop stops the appgate server and returns any error that occurred. -func (app *appGateServer) Stop(ctx context.Context) error { - return app.server.Shutdown(ctx) -} - -// ServeHTTP is the HTTP handler for the appgate server. -// It captures the application request, signs it, and sends it to the supplier. -// After receiving the response from the supplier, it verifies the response signature -// before returning the response to the application. -// The serviceId is extracted from the request path. -// The request's path should be of the form: -// -// "://host:port/serviceId[/other/path/segments]?senderAddr=" -// -// where the serviceId is the id of the service that the application is requesting -// and the other (possible) path segments are the JSON RPC request path. -// TODO_TECHDEBT: Revisit the requestPath above based on the SDK that'll be exposed in the future. -func (app *appGateServer) ServeHTTP(writer http.ResponseWriter, request *http.Request) { - ctx := app.logger.WithContext(request.Context()) - - // Extract the serviceId from the request path. - path := request.URL.Path - serviceId := strings.Split(path, "/")[1] - - // Read the request body bytes. - requestPayloadBz, err := io.ReadAll(request.Body) - if err != nil { - app.replyWithError( - ctx, - requestPayloadBz, - writer, - ErrAppGateHandleRelay.Wrapf("reading relay request body: %s", err), - ) - // TODO_TECHDEBT: log additional info? - app.logger.Error().Err(err).Msg("failed reading relay request body") - return - } - app.logger.Debug(). - Str("service_id", serviceId). - Str("payload", string(requestPayloadBz)). - Msg("handling relay") - - // Determine the application address. - appAddress := app.signingInformation.AppAddress - if appAddress == "" { - appAddress = request.URL.Query().Get("senderAddr") - } - if appAddress == "" { - app.replyWithError(ctx, requestPayloadBz, writer, ErrAppGateMissingAppAddress) - // TODO_TECHDEBT: log additional info? - app.logger.Error().Msg("no application address provided") - return - } - - // Put the request body bytes back into the request body. - request.Body = io.NopCloser(bytes.NewBuffer(requestPayloadBz)) - - // TODO(@h5law, @red0ne): Add support for asynchronous relays, and switch on - // the request type here. - // TODO_RESEARCH: Should this be started in a goroutine, to allow for - // concurrent requests from numerous applications? - if err := app.handleSynchronousRelay(ctx, appAddress, serviceId, requestPayloadBz, request, writer); err != nil { - // Reply with an error response if there was an error handling the relay. - app.replyWithError(ctx, requestPayloadBz, writer, err) - // TODO_TECHDEBT: log additional info? - app.logger.Error().Err(err).Msg("failed handling relay") - return - } - - // TODO_TECHDEBT: log additional info? - app.logger.Info().Msg("request serviced successfully") -} - -// validateConfig validates the appGateServer configuration. -func (app *appGateServer) validateConfig() error { - if app.signingInformation == nil { - return ErrAppGateMissingSigningInformation - } - if app.listeningEndpoint == nil { - return ErrAppGateMissingListeningEndpoint - } - return nil -} - -type appGateServerOption func(*appGateServer) diff --git a/pkg/appgateserver/synchronous.go b/pkg/appgateserver/synchronous.go deleted file mode 100644 index 5d0b46a5a..000000000 --- a/pkg/appgateserver/synchronous.go +++ /dev/null @@ -1,66 +0,0 @@ -package appgateserver - -import ( - "context" - "net/http" - - "github.com/pokt-network/poktroll/pkg/partials" -) - -// handleSynchronousRelay handles relay requests for synchronous protocols, where -// there is a one-to-one correspondance between the request and response. -// It does everything from preparing, signing and sending the request. -// It then blocks on the response to come back and forward it to the provided writer. -func (app *appGateServer) handleSynchronousRelay( - ctx context.Context, - appAddress, serviceId string, - payloadBz []byte, - request *http.Request, - writer http.ResponseWriter, -) error { - // TODO_TECHDEBT: log additional info? - app.logger.Debug().Msg("determining request type") - - // Get the type of the request by doing a partial unmarshal of the payload - requestType, err := partials.GetRequestType(ctx, payloadBz) - if err != nil { - return ErrAppGateHandleRelay.Wrapf("getting request type: %s", err) - } - - // TODO_TECHDEBT: log additional info? - app.logger.Debug(). - Str("request_type", requestType.String()). - Msg("got request type") - - sessionSuppliers, err := app.sdk.GetSessionSupplierEndpoints(ctx, appAddress, serviceId) - if err != nil { - return ErrAppGateHandleRelay.Wrapf("getting current session: %s", err) - } - - // Get a supplier URL and address for the given service and session. - supplierEndpoint, err := app.getRelayerUrl( - ctx, - serviceId, - requestType, - sessionSuppliers.SuppliersEndpoints, - ) - if err != nil { - return ErrAppGateHandleRelay.Wrapf("getting supplier URL: %s", err) - } - - relayResponse, err := app.sdk.SendRelay(ctx, supplierEndpoint, request) - if err != nil { - return err - } - - app.logger.Debug(). - Str("relay_response_payload", string(relayResponse.Payload)). - Msg("writing relay response payload") - - // Reply with the RelayResponse payload. - if _, err := writer.Write(relayResponse.Payload); err != nil { - return ErrAppGateHandleRelay.Wrapf("writing relay response payload: %s", err) - } - - return nil -} diff --git a/pkg/client/block/block.go b/pkg/client/block/block.go deleted file mode 100644 index 82c34aa2b..000000000 --- a/pkg/client/block/block.go +++ /dev/null @@ -1,48 +0,0 @@ -package block - -import ( - "encoding/json" - - "github.com/cometbft/cometbft/types" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/events" -) - -// cometBlockEvent is used to deserialize incoming committed block event messages -// from the respective events query subscription. It implements the client.Block -// interface by loosely wrapping cometbft's block type, into which messages are -// deserialized. -type cometBlockEvent struct { - Block types.Block `json:"block"` -} - -// Height returns the block's height. -func (blockEvent *cometBlockEvent) Height() int64 { - return blockEvent.Block.Height -} - -// Hash returns the binary representation of the block's hash as a byte slice. -func (blockEvent *cometBlockEvent) Hash() []byte { - return blockEvent.Block.LastBlockID.Hash.Bytes() -} - -// newCometBlockEvent is a function that attempts to deserialize the given bytes -// into a comet block. If the resulting block has a height of zero, assume the event -// was not a block event and return an ErrUnmarshalBlockEvent error. -func newCometBlockEvent(blockMsgBz []byte) (client.Block, error) { - blockMsg := new(cometBlockEvent) - if err := json.Unmarshal(blockMsgBz, blockMsg); err != nil { - return nil, err - } - - // The header height should never be zero. If it is, it means that blockMsg - // does not match the expected format which led unmarshaling to fail, - // and blockHeader.height to have a default value. - if blockMsg.Block.Header.Height == 0 { - return nil, events.ErrEventsUnmarshalEvent. - Wrapf("with block data: %s", string(blockMsgBz)) - } - - return blockMsg, nil -} diff --git a/pkg/client/block/client.go b/pkg/client/block/client.go deleted file mode 100644 index 1e3bd21ea..000000000 --- a/pkg/client/block/client.go +++ /dev/null @@ -1,77 +0,0 @@ -package block - -import ( - "context" - - "cosmossdk.io/depinject" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/events" -) - -const ( - // committedBlocksQuery is the query used to subscribe to new committed block - // events used by the EventsQueryClient to subscribe to new block events from - // the chain. - // See: https://docs.cosmos.network/v0.47/learn/advanced/events#default-events - committedBlocksQuery = "tm.event='NewBlock'" - - // defaultBlocksReplayLimit is the number of blocks that the replay - // observable returned by LastNBlocks() will be able to replay. - // TODO_TECHDEBT/TODO_FUTURE: add a `blocksReplayLimit` field to the blockClient - // struct that defaults to this but can be overridden via an option. - defaultBlocksReplayLimit = 100 -) - -// NewBlockClient creates a new block client from the given dependencies and -// cometWebsocketURL. It uses a pre-defined committedBlocksQuery to subscribe to -// newly committed block events which are mapped to Block objects. -// -// This lightly wraps the EventsReplayClient[Block] generic to correctly mock -// the interface. -// -// Required dependencies: -// - client.EventsQueryClient -func NewBlockClient( - ctx context.Context, - deps depinject.Config, -) (client.BlockClient, error) { - client, err := events.NewEventsReplayClient[client.Block]( - ctx, - deps, - committedBlocksQuery, - newCometBlockEvent, - defaultBlocksReplayLimit, - ) - if err != nil { - return nil, err - } - return &blockClient{eventsReplayClient: client}, nil -} - -// blockClient is a wrapper around an EventsReplayClient that implements the -// BlockClient interface for use with cosmos-sdk networks. -type blockClient struct { - // eventsReplayClient is the underlying EventsReplayClient that is used to - // subscribe to new committed block events. It uses both the Block type - // and the BlockReplayObservable type as its generic types. - // These enable the EventsReplayClient to correctly map the raw event bytes - // to Block objects and to correctly return a BlockReplayObservable - eventsReplayClient client.EventsReplayClient[client.Block] -} - -// CommittedBlocksSequence returns a replay observable of new block events. -func (b *blockClient) CommittedBlocksSequence(ctx context.Context) client.BlockReplayObservable { - return b.eventsReplayClient.EventsSequence(ctx) -} - -// LatestsNBlocks returns the last n blocks observed by the BockClient. -func (b *blockClient) LastNBlocks(ctx context.Context, n int) []client.Block { - return b.eventsReplayClient.LastNEvents(ctx, n) -} - -// Close closes the underlying websocket connection for the EventsQueryClient -// and closes all downstream connections. -func (b *blockClient) Close() { - b.eventsReplayClient.Close() -} diff --git a/pkg/client/block/client_integration_test.go b/pkg/client/block/client_integration_test.go deleted file mode 100644 index 375142f36..000000000 --- a/pkg/client/block/client_integration_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package block_test - -import ( - "context" - "fmt" - "sync" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/testutil/testclient/testblock" -) - -// TODO(#255): Refactor this integration test to use an in-memory simulated network - -const blockIntegrationSubTimeout = 5 * time.Second - -func TestBlockClient_LastNBlocks(t *testing.T) { - t.Skip("TODO(@h5law): Figure out how to subscribe to events on the simulated localnet") - ctx := context.Background() - - blockClient := testblock.NewLocalnetClient(ctx, t) - require.NotNil(t, blockClient) - - block := blockClient.LastNBlocks(ctx, 1) - require.NotEmpty(t, block) -} - -func TestBlockClient_BlocksObservable(t *testing.T) { - t.Skip("TODO(@h5law): Figure out how to subscribe to events on the simulated localnet") - ctx := context.Background() - - blockClient := testblock.NewLocalnetClient(ctx, t) - require.NotNil(t, blockClient) - - blockSub := blockClient.CommittedBlocksSequence(ctx).Subscribe(ctx) - - var ( - blockMu sync.Mutex - blockCounter int - blocksToRecv = 2 - errCh = make(chan error, 1) - ) - go func() { - var previousBlock client.Block - for block := range blockSub.Ch() { - if previousBlock != nil { - if !assert.Equal(t, previousBlock.Height()+1, block.Height()) { - errCh <- fmt.Errorf("expected block height %d, got %d", previousBlock.Height()+1, block.Height()) - return - } - } - previousBlock = block - - require.NotEmpty(t, block) - blockMu.Lock() - blockCounter++ - if blockCounter >= blocksToRecv { - errCh <- nil - return - } - blockMu.Unlock() - } - }() - - select { - case err := <-errCh: - require.NoError(t, err) - require.Equal(t, blocksToRecv, blockCounter) - case <-time.After(blockIntegrationSubTimeout): - t.Fatalf( - "timed out waiting for block subscription; expected %d blocks, got %d", - blocksToRecv, blockCounter, - ) - } -} diff --git a/pkg/client/block/client_test.go b/pkg/client/block/client_test.go deleted file mode 100644 index e44c8f32f..000000000 --- a/pkg/client/block/client_test.go +++ /dev/null @@ -1,130 +0,0 @@ -package block_test - -import ( - "context" - "encoding/json" - "testing" - "time" - - "cosmossdk.io/depinject" - comettypes "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/block" - "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" -) - -const ( - testTimeoutDuration = 100 * time.Millisecond - - // duplicates pkg/client/block/client.go's committedBlocksQuery for testing purposes - committedBlocksQuery = "tm.event='NewBlock'" -) - -func TestBlockClient(t *testing.T) { - var ( - expectedHeight = int64(1) - expectedHash = []byte("test_hash") - expectedBlockEvent = &testBlockEvent{ - Block: comettypes.Block{ - Header: comettypes.Header{ - Height: 1, - Time: time.Now(), - LastBlockID: comettypes.BlockID{ - Hash: expectedHash, - }, - }, - }, - } - ctx = context.Background() - ) - - expectedEventBz, err := json.Marshal(expectedBlockEvent) - require.NoError(t, err) - - eventsQueryClient := testeventsquery.NewAnyTimesEventsBytesEventsQueryClient( - ctx, t, - committedBlocksQuery, - expectedEventBz, - ) - - deps := depinject.Supply(eventsQueryClient) - - // Set up block client. - blockClient, err := block.NewBlockClient(ctx, deps) - require.NoError(t, err) - require.NotNil(t, blockClient) - - tests := []struct { - name string - fn func() client.Block - }{ - { - name: "LastNBlocks(1) successfully returns latest block", - fn: func() client.Block { - lastBlock := blockClient.LastNBlocks(ctx, 1)[0] - return lastBlock - }, - }, - { - name: "CommittedBlocksSequence successfully returns latest block", - fn: func() client.Block { - blockObservable := blockClient.CommittedBlocksSequence(ctx) - require.NotNil(t, blockObservable) - - // Ensure that the observable is replayable via Last. - lastBlock := blockObservable.Last(ctx, 1)[0] - require.Equal(t, expectedHeight, lastBlock.Height()) - require.Equal(t, expectedHash, lastBlock.Hash()) - - return lastBlock - }, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - actualBlockCh := make(chan client.Block, 10) - - // Run test functions asynchronously because they can block, leading - // to an unresponsive test. If any of the methods under test hang, - // the test will time out in the select statement that follows. - go func(fn func() client.Block) { - actualBlockCh <- fn() - close(actualBlockCh) - }(tt.fn) - - select { - case actualBlock := <-actualBlockCh: - require.Equal(t, expectedHeight, actualBlock.Height()) - require.Equal(t, expectedHash, actualBlock.Hash()) - case <-time.After(testTimeoutDuration): - t.Fatal("timed out waiting for block event") - } - }) - } - - blockClient.Close() -} - -/* -TODO_TECHDEBT/TODO_CONSIDERATION(#XXX): this duplicates the unexported block event - -type from pkg/client/block/block.go. We seem to have some conflicting preferences -which result in the need for this duplication until a preferred direction is -identified: - - - We should prefer tests being in their own pkgs (e.g. block_test) - - this would resolve if this test were in the block package instead. - - We should prefer to not export types which don't require exporting for API - consumption. - - This test is the only external (to the block pkg) dependency of cometBlockEvent. - - We could use the //go:build test constraint on a new file which exports it - for testing purposes. - - This would imply that we also add -tags=test to all applicable tooling - and add a test which fails if the tag is absent. -*/ -type testBlockEvent struct { - Block comettypes.Block `json:"block"` -} diff --git a/pkg/client/block/godoc.go b/pkg/client/block/godoc.go deleted file mode 100644 index 01d829f2e..000000000 --- a/pkg/client/block/godoc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package block contains a light wrapper of the EventsReplayClient[Block] -// generic which listens for committed block events on chain and emits them -// through a ReplayObservable. This enables consumers to listen for newly -// committed blocks and react to them asynchronously. -package block diff --git a/pkg/client/delegation/client.go b/pkg/client/delegation/client.go deleted file mode 100644 index 013b094df..000000000 --- a/pkg/client/delegation/client.go +++ /dev/null @@ -1,89 +0,0 @@ -package delegation - -import ( - "context" - - "cosmossdk.io/depinject" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/events" -) - -const ( - // delegationEventQuery is the query used by the EventsQueryClient to subscribe - // to all application module events in order to filter for redelegation events. - // See: https://docs.cosmos.network/v0.47/learn/advanced/events#subscribing-to-events - // And: https://docs.cosmos.network/v0.47/learn/advanced/events#default-events - // TODO_HACK(#280): Instead of listening to all events and doing a verbose - // filter, we should subscribe to both MsgDelegateToGateway and MsgUndelegateFromGateway - // messages directly, and filter those for the EventRedelegation event types. - // This would save the delegation client from listening to a lot of unnecessary - // events, that it filters out. - // NB: This is not currently possible because the observer pattern does not - // support multiplexing multiple observables into a single observable, that - // can supply the EventsReplayClient with both the MsgDelegateToGateway and - // MsgUndelegateFromGateway events. - delegationEventQuery = "tm.event='Tx' AND message.module='application'" - - // defaultRedelegationsReplayLimit is the number of redelegations that the - // replay observable returned by LastNRedelegations() will be able to replay. - // TODO_TECHDEBT/TODO_FUTURE: add a `redelegationsReplayLimit` field to the - // delegation client struct that defaults to this but can be overridden via - // an option in future work. - defaultRedelegationsReplayLimit = 100 -) - -// NewDelegationClient creates a new delegation client from the given -// dependencies and cometWebsocketURL. It uses a pre-defined delegationEventQuery -// to subscribe to newly emitted redelegation events which are mapped to -// Redelegation objects. -// -// This lightly wraps the EventsReplayClient[Redelegation] generic to -// correctly mock the interface. -// -// Required dependencies: -// - client.EventsQueryClient -func NewDelegationClient( - ctx context.Context, - deps depinject.Config, -) (client.DelegationClient, error) { - client, err := events.NewEventsReplayClient[client.Redelegation]( - ctx, - deps, - delegationEventQuery, - newRedelegationEventFactoryFn(), - defaultRedelegationsReplayLimit, - ) - if err != nil { - return nil, err - } - return &delegationClient{eventsReplayClient: client}, nil -} - -// delegationClient is a wrapper around an EventsReplayClient that implements -// the DelegationClient interface for use with cosmos-sdk networks. -type delegationClient struct { - // eventsReplayClient is the underlying EventsReplayClient that is used to - // subscribe to new delegation events. It uses both the Redelegation type - // and the RedelegationReplayObservable type as its generic types. - // These enable the EventsReplayClient to correctly map the raw event bytes - // to Redelegation objects and to correctly return a RedelegationReplayObservable - eventsReplayClient client.EventsReplayClient[client.Redelegation] -} - -// RedelegationsSequence returns a replay observable of Redelgation events -// observed by the DelegationClient. -func (b *delegationClient) RedelegationsSequence(ctx context.Context) client.RedelegationReplayObservable { - return b.eventsReplayClient.EventsSequence(ctx) -} - -// LastNRedelegations returns the latest n redelegation events from the DelegationClient. -func (b *delegationClient) LastNRedelegations(ctx context.Context, n int) []client.Redelegation { - return b.eventsReplayClient.LastNEvents(ctx, n) -} - -// Close closes the underlying websocket connection for the EventsQueryClient -// and closes all downstream connections. -func (b *delegationClient) Close() { - b.eventsReplayClient.Close() -} diff --git a/pkg/client/delegation/client_integration_test.go b/pkg/client/delegation/client_integration_test.go deleted file mode 100644 index 1ea3cbaec..000000000 --- a/pkg/client/delegation/client_integration_test.go +++ /dev/null @@ -1,171 +0,0 @@ -package delegation_test - -// TODO(@h5law): Figure out how to use real components of the localnet -// - Create app and gateway actors -// - Stake them -// - Delegate to the gateway -// - Undelegate from the gateway -// Currently this test doesn't work, because (I think) it is using a mock -// keeper etc and this isn't actually interacting with the localnet where -// the DelegationClient is listening for events from. - -import ( - "context" - "sync" - "testing" - "time" - - "cosmossdk.io/depinject" - "github.com/cosmos/cosmos-sdk/testutil" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/delegation" - "github.com/pokt-network/poktroll/pkg/client/events" - "github.com/pokt-network/poktroll/testutil/network" - apptypes "github.com/pokt-network/poktroll/x/application/types" - gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" -) - -const ( - delegationIntegrationSubTimeout = 180 * time.Second -) - -// TODO_UPNEXT(@h5law): Figure out the correct way to subscribe to events on the -// simulated localnet. Currently this test doesn't work. Although the delegation -// client subscribes it doesn't receive any events. -func TestDelegationClient_RedelegationsObservables(t *testing.T) { - t.Skip("TODO(@h5law): Figure out how to subscribe to events on the simulated localnet") - // Create the network with 2 applications and 1 gateway - net, appAddresses, gatewayAddr := createNetworkWithApplicationsAndGateways(t) - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - // Create the delegation client - evtQueryClient := events.NewEventsQueryClient("ws://localhost:26657/websocket") - deps := depinject.Supply(evtQueryClient) - delegationClient, err := delegation.NewDelegationClient(ctx, deps) - require.NoError(t, err) - require.NotNil(t, delegationClient) - t.Cleanup(func() { - delegationClient.Close() - }) - - // Subscribe to the delegation events - delegationSub := delegationClient.RedelegationsSequence(ctx).Subscribe(ctx) - - var ( - delegationMu = sync.Mutex{} // mutext to protect delegationChangeCounter - delegationChangeCounter int // counter to keep track of the number of delegation changes - expectedChanges = 4 // expected number of delegation changes - errCh = make(chan error, 1) // channel to signal the test to stop - ) - go func() { - // The test will delegate from app1 to gateway, then from app2 to gateway - // and then undelegate app1 from gateway and then undelegate app2 from gateway - // We expect to receive 4 delegation changes where the address of the - // Redelegation event alternates between app1 and app2 - var previousRedelegation client.Redelegation - for change := range delegationSub.Ch() { - t.Logf("received delegation change: %+v", change) - // Verify that the Redelegation event is valid and that the address - // of the Redelegation event alternates between app1 and app2 - if previousRedelegation != nil { - require.NotEqual(t, previousRedelegation.GetAppAddress(), change.GetAppAddress()) - if previousRedelegation.GetAppAddress() == appAddresses[0] { - require.Equal(t, appAddresses[1], change.GetAppAddress()) - } else { - require.Equal(t, appAddresses[0], change.GetAppAddress()) - } - } - previousRedelegation = change - - require.NotEmpty(t, change) - delegationMu.Lock() - delegationChangeCounter++ - if delegationChangeCounter >= expectedChanges { - errCh <- nil - return - } - delegationMu.Unlock() - } - }() - - // Delegate from app1 to gateway - t.Log(time.Now().String()) - t.Logf("delegating from app %s to gateway %s", appAddresses[0], gatewayAddr) - network.DelegateAppToGateway(t, net, appAddresses[0], gatewayAddr) - // need to wait for the account to be initialized in the next block - require.NoError(t, net.WaitForNextBlock()) - // Delegate from app2 to gateway - t.Logf("delegating from app %s to gateway %s", appAddresses[1], gatewayAddr) - network.DelegateAppToGateway(t, net, appAddresses[1], gatewayAddr) - // need to wait for the account to be initialized in the next block - require.NoError(t, net.WaitForNextBlock()) - // Undelegate from app1 to gateway - t.Logf("undelegating from app %s to gateway %s", appAddresses[0], gatewayAddr) - network.UndelegateAppFromGateway(t, net, appAddresses[0], gatewayAddr) - // need to wait for the account to be initialized in the next block - require.NoError(t, net.WaitForNextBlock()) - // Undelegate from app2 to gateway - t.Logf("undelegating from app %s to gateway %s", appAddresses[1], gatewayAddr) - network.UndelegateAppFromGateway(t, net, appAddresses[1], gatewayAddr) - // need to wait for the account to be initialized in the next block - require.NoError(t, net.WaitForNextBlock()) - - select { - case err := <-errCh: - require.NoError(t, err) - require.Equal(t, expectedChanges, delegationChangeCounter) - case <-time.After(delegationIntegrationSubTimeout): - t.Log(time.Now().String()) - t.Fatalf( - "timed out waiting for delegation subscription; expected %d delegation events, got %d", - expectedChanges, delegationChangeCounter, - ) - } -} - -// createNetworkWithApplicationsAndGateways creates a network with 2 applications -// and 1 gateway. It returns the network with all accounts initialized via a -// transaction from the first validator. -func createNetworkWithApplicationsAndGateways( - t *testing.T, -) (net *network.Network, appAddresses []string, gatewayAddress string) { - // Prepare the network - cfg := network.DefaultConfig() - net = network.New(t, cfg) - ctx := net.Validators[0].ClientCtx - - // Prepare the keyring for the 2 applications and 1 gateway account - kr := ctx.Keyring - accounts := testutil.CreateKeyringAccounts(t, kr, 3) - ctx = ctx.WithKeyring(kr) - - // Initialize all the accounts - for i, account := range accounts { - signatureSequenceNumber := i + 1 - network.InitAccountWithSequence(t, net, account.Address, signatureSequenceNumber) - } - // need to wait for the account to be initialized in the next block - require.NoError(t, net.WaitForNextBlock()) - - addresses := make([]string, len(accounts)) - for i, account := range accounts { - addresses[i] = account.Address.String() - } - - // Create two applications - appGenesisState := network.ApplicationModuleGenesisStateWithAddresses(t, addresses[0:2]) - buf, err := cfg.Codec.MarshalJSON(appGenesisState) - require.NoError(t, err) - cfg.GenesisState[apptypes.ModuleName] = buf - - // Create a single gateway - gatewayGenesisState := network.GatewayModuleGenesisStateWithAddresses(t, addresses[2:3]) - buf, err = cfg.Codec.MarshalJSON(gatewayGenesisState) - require.NoError(t, err) - cfg.GenesisState[gatewaytypes.ModuleName] = buf - - return net, addresses[0:2], addresses[2] -} diff --git a/pkg/client/delegation/client_test.go b/pkg/client/delegation/client_test.go deleted file mode 100644 index f9b82ffb5..000000000 --- a/pkg/client/delegation/client_test.go +++ /dev/null @@ -1,100 +0,0 @@ -package delegation_test - -import ( - "context" - "testing" - "time" - - "cosmossdk.io/depinject" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/delegation" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/testutil/testclient/testdelegation" - "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" -) - -const ( - testTimeoutDuration = 100 * time.Millisecond - - // duplicates pkg/client/delegation/client.go's delegationEventQuery for testing purposes. - delegationEventQuery = "tm.event='Tx' AND message.module='application'" -) - -func TestDelegationClient(t *testing.T) { - var ( - expectedAppAddress = sample.AccAddress() - expectedGatewayAddress = sample.AccAddress() - ctx = context.Background() - ) - - expectedEventBz := testdelegation.NewRedelegationEventBytes(t, expectedAppAddress, expectedGatewayAddress) - - eventsQueryClient := testeventsquery.NewAnyTimesEventsBytesEventsQueryClient( - ctx, t, - delegationEventQuery, - expectedEventBz, - ) - - deps := depinject.Supply(eventsQueryClient) - - // Set up delegation client. - // NB: the URL passed to `NewDelegationClient` is irrelevant here because `eventsQueryClient` is a mock. - delegationClient, err := delegation.NewDelegationClient(ctx, deps) - require.NoError(t, err) - require.NotNil(t, delegationClient) - - tests := []struct { - name string - fn func() client.Redelegation - }{ - { - name: "LastNRedelegations successfully returns latest redelegation", - fn: func() client.Redelegation { - lastRedelegation := delegationClient.LastNRedelegations(ctx, 1)[0] - require.Equal(t, expectedAppAddress, lastRedelegation.GetAppAddress()) - require.Equal(t, expectedGatewayAddress, lastRedelegation.GetGatewayAddress()) - return lastRedelegation - }, - }, - { - name: "RedelegationsSequence successfully returns latest redelegation", - fn: func() client.Redelegation { - redelegationObs := delegationClient.RedelegationsSequence(ctx) - require.NotNil(t, redelegationObs) - - // Ensure that the observable is replayable via Last. - lastRedelegation := redelegationObs.Last(ctx, 1)[0] - require.Equal(t, expectedAppAddress, lastRedelegation.GetAppAddress()) - require.Equal(t, expectedGatewayAddress, lastRedelegation.GetGatewayAddress()) - - return lastRedelegation - }, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - actualRedelegationCh := make(chan client.Redelegation, 10) - - // Run test functions asynchronously because they can block, leading - // to an unresponsive test. If any of the methods under test hang, - // the test will time out in the select statement that follows. - go func(fn func() client.Redelegation) { - actualRedelegationCh <- fn() - close(actualRedelegationCh) - }(tt.fn) - - select { - case actualRedelegation := <-actualRedelegationCh: - require.Equal(t, expectedAppAddress, actualRedelegation.GetAppAddress()) - require.Equal(t, expectedGatewayAddress, actualRedelegation.GetGatewayAddress()) - case <-time.After(testTimeoutDuration): - t.Fatal("timed out waiting for redelegation event") - } - }) - } - - delegationClient.Close() -} diff --git a/pkg/client/delegation/godoc.go b/pkg/client/delegation/godoc.go deleted file mode 100644 index 1d5b00139..000000000 --- a/pkg/client/delegation/godoc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package delegation contains a light wrapper of the EventsReplayClient[Redelegation] -// generic which listens for redelegation events on chain and emits them -// through a ReplayObservable. This enables consumers to listen for on-chain -// application redelegation events and react to them asynchronously. -package delegation diff --git a/pkg/client/delegation/redelegation.go b/pkg/client/delegation/redelegation.go deleted file mode 100644 index 86af6906f..000000000 --- a/pkg/client/delegation/redelegation.go +++ /dev/null @@ -1,99 +0,0 @@ -package delegation - -// TODO_TECHDEBT(#280): Refactor to use merged observables and subscribe to -// MsgDelegateToGateway and MsgUndelegateFromGateway messages directly, instead -// of listening to all events and doing a verbose filter. - -import ( - "encoding/json" - "strconv" - - "cosmossdk.io/api/tendermint/abci" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/events" -) - -// redelegationEventType is the type of the EventRedelegation event emitted by -// both the MsgDelegateToGateway and MsgUndelegateFromGateway messages. -const redelegationEventType = "pocket.application.EventRedelegation" - -var _ client.Redelegation = (*redelegation)(nil) - -// TxEvent is an alias for the CometBFT TxResult type used to decode the -// response bytes from the EventsQueryClient's subscription -type TxEvent = abci.TxResult - -// redelegation wraps the EventRedelegation event emitted by the application -// module, for use in the observable, it is one of the log entries embedded -// within the log field of the response struct from the app module's query. -type redelegation struct { - AppAddress string `json:"app_address"` - GatewayAddress string `json:"gateway_address"` -} - -// GetAppAddress returns the application address of the redelegation event -func (d redelegation) GetAppAddress() string { - return d.AppAddress -} - -// GetGatewayAddress returns the gateway address of the redelegation event -func (d redelegation) GetGatewayAddress() string { - return d.GatewayAddress -} - -// newRedelegationEventFactoryFn is a factory function that returns a -// function that attempts to deserialize the given bytes into a redelegation -// struct. If the delegate struct has an empty app address then an -// ErrUnmarshalRedelegation error is returned. Otherwise if deserialisation -// fails then the error is returned. -func newRedelegationEventFactoryFn() events.NewEventsFn[client.Redelegation] { - return func(eventBz []byte) (client.Redelegation, error) { - txEvent := new(TxEvent) - // Try to deserialize the provided bytes into a TxEvent. - if err := json.Unmarshal(eventBz, txEvent); err != nil { - return nil, err - } - // Check if the TxEvent has empty transaction bytes, which indicates - // the message is probably not a valid transaction event. - if len(txEvent.Tx) == 0 { - return nil, events.ErrEventsUnmarshalEvent.Wrap("empty transaction bytes") - } - // Iterate through the log entries to find EventRedelegation - for _, event := range txEvent.Result.Events { - if event.GetType_() != redelegationEventType { - continue - } - var redelegationEvent redelegation - for _, attr := range event.Attributes { - switch attr.Key { - case "app_address": - appAddr, err := unescape(attr.Value) - if err != nil { - return nil, events.ErrEventsUnmarshalEvent.Wrapf("cannot retrieve app address: %v", err) - } - redelegationEvent.AppAddress = appAddr - case "gateway_address": - gatewayAddr, err := unescape(attr.Value) - if err != nil { - return nil, events.ErrEventsUnmarshalEvent.Wrapf("cannot retrieve gateway address: %v", err) - } - redelegationEvent.GatewayAddress = gatewayAddr - default: - return nil, events.ErrEventsUnmarshalEvent.Wrapf("unknown attribute key: %s", attr.Key) - } - } - // Handle the redelegation event - if redelegationEvent.AppAddress == "" || redelegationEvent.GatewayAddress == "" { - return nil, events.ErrEventsUnmarshalEvent. - Wrapf("empty redelegation event: %s", string(eventBz)) - } - return redelegationEvent, nil - } - return nil, events.ErrEventsUnmarshalEvent.Wrap("no redelegation event found") - } -} - -func unescape(s string) (string, error) { - return strconv.Unquote(s) -} diff --git a/pkg/client/events/errors.go b/pkg/client/events/errors.go deleted file mode 100644 index 838b9dbec..000000000 --- a/pkg/client/events/errors.go +++ /dev/null @@ -1,15 +0,0 @@ -package events - -import ( - sdkerrors "cosmossdk.io/errors" -) - -var ( - codespace = "events" - - ErrEventsDial = sdkerrors.Register(codespace, 1, "dialing for connection failed") - ErrEventsConnClosed = sdkerrors.Register(codespace, 2, "connection closed") - ErrEventsSubscribe = sdkerrors.Register(codespace, 3, "failed to subscribe to events") - ErrEventsUnmarshalEvent = sdkerrors.Register(codespace, 4, "failed to unmarshal event bytes") - ErrEventsConsClosed = sdkerrors.Register(codespace, 5, "eventsqueryclient connection closed") -) diff --git a/pkg/client/events/godoc.go b/pkg/client/events/godoc.go deleted file mode 100644 index b5bbf685f..000000000 --- a/pkg/client/events/godoc.go +++ /dev/null @@ -1,12 +0,0 @@ -// Package events provides a generic client for subscribing to on-chain events -// via an EventsQueryClient and transforming the received events into the type -// defined by the EventsReplayClient's generic type parameter. -// -// The EventsQueryClient emits ReplayObservables which are of the type defined -// by the EventsReplayClient's generic type parameter. -// -// The usage of of ReplayObservables allows the EventsReplayClient to be always -// provide the latest event data to the caller, even if the connection to the -// EventsQueryClient is lost and re-established, without the caller having to -// re-subscribe to the EventsQueryClient. -package events diff --git a/pkg/client/events/options.go b/pkg/client/events/options.go deleted file mode 100644 index 41fca7548..000000000 --- a/pkg/client/events/options.go +++ /dev/null @@ -1,11 +0,0 @@ -package events - -import "github.com/pokt-network/poktroll/pkg/client" - -// WithDialer returns a client.EventsQueryClientOption which sets the given dialer on the -// resulting eventsQueryClient when passed to NewEventsQueryClient(). -func WithDialer(dialer client.Dialer) client.EventsQueryClientOption { - return func(evtClient client.EventsQueryClient) { - evtClient.(*eventsQueryClient).dialer = dialer - } -} diff --git a/pkg/client/events/query_client.go b/pkg/client/events/query_client.go deleted file mode 100644 index 5524f52dc..000000000 --- a/pkg/client/events/query_client.go +++ /dev/null @@ -1,293 +0,0 @@ -package events - -import ( - "context" - "crypto/rand" - "encoding/base64" - "encoding/json" - "errors" - "fmt" - "sync" - - "go.uber.org/multierr" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/events/websocket" - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" -) - -var _ client.EventsQueryClient = (*eventsQueryClient)(nil) - -// TODO_TECHDEBT: the cosmos-sdk CLI code seems to use a cometbft RPC client -// which includes a `#Subscribe()` method for a similar purpose. Perhaps we could -// replace this custom websocket client with that. -// See: -// - https://github.com/cometbft/cometbft/blob/main/rpc/client/http/http.go#L110 -// - https://github.com/cometbft/cometbft/blob/main/rpc/client/http/http.go#L656 -// - https://github.com/cosmos/cosmos-sdk/blob/main/client/rpc/tx.go#L114 -// - https://github.com/pokt-network/poktroll/pull/64#discussion_r1372378241 - -// eventsQueryClient implements the EventsQueryClient interface. -type eventsQueryClient struct { - // cometWebsocketURL is the websocket URL for the cometbft node. It is assigned - // in NewEventsQueryClient. - cometWebsocketURL string - // dialer is responsible for creating the connection instance which - // facilitates communication with the cometbft node via message passing. - dialer client.Dialer - // eventsBytesAndConnsMu protects the eventsBytesAndConns map. - eventsBytesAndConnsMu sync.RWMutex - // eventsBytesAndConns maps event subscription queries to their respective - // eventsBytes observable, connection, and isClosed status. - eventsBytesAndConns map[string]*eventsBytesAndConn -} - -// eventsBytesAndConn is a struct which holds an eventsBytes observable & the -// corresponding connection which produces its inputs. -type eventsBytesAndConn struct { - // eventsBytes is an observable which is notified about chain event messages - // matching the given query. It receives an either.Bytes which is - // either an error or the event message bytes. - eventsBytes observable.Observable[either.Bytes] - conn client.Connection - isClosed bool -} - -// Close unsubscribes all observers of eventsBytesAndConn's observable and also -// closes its connection. -func (ebc *eventsBytesAndConn) Close() { - ebc.eventsBytes.UnsubscribeAll() - _ = ebc.conn.Close() -} - -// NewEventsQueryClient returns a new events query client which is used to -// subscribe to on-chain events matching the given query. -// -// Available options: -// - WithDialer -func NewEventsQueryClient(cometWebsocketURL string, opts ...client.EventsQueryClientOption) client.EventsQueryClient { - evtClient := &eventsQueryClient{ - cometWebsocketURL: cometWebsocketURL, - eventsBytesAndConns: make(map[string]*eventsBytesAndConn), - } - - for _, opt := range opts { - opt(evtClient) - } - - if evtClient.dialer == nil { - // default to using the websocket dialer - evtClient.dialer = websocket.NewWebsocketDialer() - } - - return evtClient -} - -// EventsBytes returns an eventsBytes observable which is notified about chain -// event messages matching the given query. It receives an either.Bytes -// which is either an error or the event message bytes. -// (see: https://pkg.go.dev/github.com/cometbft/cometbft/types#pkg-constants) -// (see: https://docs.cosmos.network/v0.47/core/events#subscribing-to-events) -func (eqc *eventsQueryClient) EventsBytes( - ctx context.Context, - query string, -) (client.EventsBytesObservable, error) { - // Must (write) lock eventsBytesAndConnsMu so that we can safely check for - // existing subscriptions to the given query or add a new eventsBytes to the - // observableConns map. - // The lock must be held for both checking and adding to prevent concurrent - // calls to this function from racing. - eqc.eventsBytesAndConnsMu.Lock() - // Deferred (write) unlock. - defer eqc.eventsBytesAndConnsMu.Unlock() - - // Check if an event subscription already exists for the given query. - if eventsBzConn := eqc.eventsBytesAndConns[query]; eventsBzConn != nil { - // If found it is returned. - return eventsBzConn.eventsBytes, nil - } - - // Otherwise, create a new event subscription for the given query. - eventsBzConn, err := eqc.newEventsBytesAndConn(ctx, query) - if err != nil { - return nil, err - } - - // Insert the new eventsBytes into the eventsBytesAndConns map. - eqc.eventsBytesAndConns[query] = eventsBzConn - - // Unsubscribe from the eventsBytes when the context is done. - go eqc.goUnsubscribeOnDone(ctx, query) - - // Return the new eventsBytes observable for the given query. - return eventsBzConn.eventsBytes, nil -} - -// Close unsubscribes all observers from all event subscription observables. -func (eqc *eventsQueryClient) Close() { - eqc.close() -} - -// close unsubscribes all observers from all event subscription observables. -func (eqc *eventsQueryClient) close() { - eqc.eventsBytesAndConnsMu.Lock() - defer eqc.eventsBytesAndConnsMu.Unlock() - - for query, eventsBzConn := range eqc.eventsBytesAndConns { - // Unsubscribe all observers of the eventsBzConn observable and close the - // connection for the given query. - eventsBzConn.Close() - // remove isClosed eventsBytesAndConns - delete(eqc.eventsBytesAndConns, query) - } -} - -// newEventwsBzAndConn creates a new eventsBytes and connection for the given query. -func (eqc *eventsQueryClient) newEventsBytesAndConn( - ctx context.Context, - query string, -) (*eventsBytesAndConn, error) { - // Get a connection for the query. - conn, err := eqc.openEventsBytesAndConn(ctx, query) - if err != nil { - return nil, err - } - - // Construct an eventsBytes for the given query. - eventsBzObservable, eventsBzPublishCh := channel.NewObservable[either.Bytes]() - - // Publish either events bytes or an error received from the connection to - // the eventsBz observable. - // NB: intentionally not retrying on error, leaving that to the caller. - // (see: https://github.com/pokt-network/poktroll/pull/64#discussion_r1373826542) - go eqc.goPublishEventsBz(ctx, conn, eventsBzPublishCh) - - return &eventsBytesAndConn{ - eventsBytes: eventsBzObservable, - conn: conn, - }, nil -} - -// openEventsBytesAndConn gets a connection using the configured dialer and sends -// an event subscription request on it, returning the connection. -func (eqc *eventsQueryClient) openEventsBytesAndConn( - ctx context.Context, - query string, -) (client.Connection, error) { - // Get a request for subscribing to events matching the given query. - req, err := eqc.eventSubscriptionRequest(query) - if err != nil { - return nil, err - } - - // Get a connection from the dialer. - conn, err := eqc.dialer.DialContext(ctx, eqc.cometWebsocketURL) - if err != nil { - return nil, ErrEventsDial.Wrapf("%s", err) - } - - // Send the event subscription request on the connection. - if err := conn.Send(req); err != nil { - subscribeErr := ErrEventsSubscribe.Wrapf("%s", err) - // assume the connection is bad - closeErr := conn.Close() - return nil, multierr.Combine(subscribeErr, closeErr) - } - return conn, nil -} - -// goPublishEventsBz blocks on reading messages from a websocket connection. -// It is intended to be called from within a go routine. -func (eqc *eventsQueryClient) goPublishEventsBz( - ctx context.Context, - conn client.Connection, - eventsBzPublishCh chan<- either.Bytes, -) { - // Read and handle messages from the websocket. This loop will exit when the - // websocket connection is isClosed and/or returns an error. - for { - eventBz, err := conn.Receive() - if err != nil { - // TODO_CONSIDERATION: should we close the publish channel here too? - - // Stop this goroutine if there's an error. - // - // See gorilla websocket `Conn#NextReader()` docs: - // | Applications must break out of the application's read loop when this method - // | returns a non-nil error value. Errors returned from this method are - // | permanent. Once this method returns a non-nil error, all subsequent calls to - // | this method return the same error. - - // Only propagate error if it's not a context cancellation error. - if !errors.Is(ctx.Err(), context.Canceled) { - // Populate the error side (left) of the either and publish it. - eventsBzPublishCh <- either.Error[[]byte](err) - } - - eqc.close() - - return - } - - // Populate the []byte side (right) of the either and publish it. - eventsBzPublishCh <- either.Success(eventBz) - } -} - -// goUnsubscribeOnDone unsubscribes from the subscription when the context is done. -// It is intended to be called in a goroutine. -func (eqc *eventsQueryClient) goUnsubscribeOnDone( - ctx context.Context, - query string, -) { - // Wait for the context to be done. - <-ctx.Done() - // Only close the eventsBytes for the given query. - eqc.eventsBytesAndConnsMu.Lock() - defer eqc.eventsBytesAndConnsMu.Unlock() - - if eventsBzConn, ok := eqc.eventsBytesAndConns[query]; ok { - // Unsubscribe all observers of the given query's eventsBzConn's observable - // and close its connection. - eventsBzConn.Close() - // Remove the eventsBytesAndConn for the given query. - delete(eqc.eventsBytesAndConns, query) - } -} - -// eventSubscriptionRequest returns a JSON-RPC request for subscribing to events -// matching the given query. The request is serialized as JSON to a byte slice. -// (see: https://github.com/cometbft/cometbft/blob/main/rpc/client/http/http.go#L110) -// (see: https://github.com/cosmos/cosmos-sdk/blob/main/client/rpc/tx.go#L114) -func (eqc *eventsQueryClient) eventSubscriptionRequest(query string) ([]byte, error) { - requestJson := map[string]any{ - "jsonrpc": "2.0", - "method": "subscribe", - "id": randRequestId(), - "params": map[string]interface{}{ - "query": query, - }, - } - requestBz, err := json.Marshal(requestJson) - if err != nil { - return nil, err - } - return requestBz, nil -} - -// randRequestId returns a random 8 byte, base64 request ID which is intended -// for in JSON-RPC requests to uniquely identify distinct RPC requests. -// These request IDs only need to be unique to the extent that they are useful -// to this client for identifying distinct RPC requests. Their size and keyspace -// are arbitrary. -func randRequestId() string { - requestIdBz := make([]byte, 8) // 8 bytes = 64 bits = uint64 - if _, err := rand.Read(requestIdBz); err != nil { - panic(fmt.Sprintf( - "failed to generate random request ID: %s", err, - )) - } - return base64.StdEncoding.EncodeToString(requestIdBz) -} diff --git a/pkg/client/events/query_client_integration_test.go b/pkg/client/events/query_client_integration_test.go deleted file mode 100644 index cbd9c426b..000000000 --- a/pkg/client/events/query_client_integration_test.go +++ /dev/null @@ -1,60 +0,0 @@ -//go:build integration - -package events_test - -import ( - "context" - "testing" - "time" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" -) - -// The query use to subscribe for new block events on the websocket endpoint exposed by CometBFT nodes -const committedBlockEventsQuery = "tm.event='NewBlock'" - -func TestQueryClient_EventsObservable_Integration(t *testing.T) { - const ( - eventReceiveTimeout = 5 * time.Second - observedEventsLimit = 3 - ) - ctx := context.Background() - - queryClient := testeventsquery.NewLocalnetClient(t) - require.NotNil(t, queryClient) - - // Start a subscription to the committed block events query. This begins - // publishing events to the returned observable. - eventsObservable, err := queryClient.EventsBytes(ctx, committedBlockEventsQuery) - require.NoError(t, err) - - eventsObserver := eventsObservable.Subscribe(ctx) - - var ( - eventCounter int - done = make(chan struct{}, 1) - ) - go func() { - for range eventsObserver.Ch() { - eventCounter++ - - if eventCounter >= observedEventsLimit { - done <- struct{}{} - return - } - } - }() - - select { - case <-done: - require.NoError(t, err) - require.Equal(t, observedEventsLimit, eventCounter) - case <-time.After(eventReceiveTimeout): - t.Fatalf( - "timed out waiting for block subscription; expected %d blocks, got %d", - observedEventsLimit, eventCounter, - ) - } -} diff --git a/pkg/client/events/query_client_test.go b/pkg/client/events/query_client_test.go deleted file mode 100644 index 2c868ac42..000000000 --- a/pkg/client/events/query_client_test.go +++ /dev/null @@ -1,392 +0,0 @@ -package events_test - -import ( - "context" - "errors" - "fmt" - "sync" - "sync/atomic" - "testing" - "time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client/events" - "github.com/pokt-network/poktroll/pkg/client/events/websocket" - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/testutil/mockclient" - "github.com/pokt-network/poktroll/testutil/testchannel" - "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" - "github.com/pokt-network/poktroll/testutil/testerrors" -) - -func TestEventsQueryClient_Subscribe_Succeeds(t *testing.T) { - var ( - readObserverEventsTimeout = time.Second - queryCounter int - queryLimit = 5 - connMocks = make([]*mockclient.MockConnection, queryLimit) - ctrl = gomock.NewController(t) - rootCtx, cancelRoot = context.WithCancel(context.Background()) - ) - t.Cleanup(cancelRoot) - - dialerMock := mockclient.NewMockDialer(ctrl) - // `Dialer#DialContext()` should be called once for each subscription (subtest). - dialerMock.EXPECT().DialContext(gomock.Any(), gomock.Any()). - DoAndReturn(func(_ context.Context, _ string) (*mockclient.MockConnection, error) { - // Return the connection mock for the subscription with the given query. - // It should've been created in the respective test function. - connMock := connMocks[queryCounter] - queryCounter++ - return connMock, nil - }). - Times(queryLimit) - - // Set up events query client. - dialerOpt := events.WithDialer(dialerMock) - queryClient := events.NewEventsQueryClient("", dialerOpt) - t.Cleanup(queryClient.Close) - - for queryIdx := 0; queryIdx < queryLimit; queryIdx++ { - t.Run(testQuery(queryIdx), func(t *testing.T) { - var ( - // ReadEventCounter is the number of eventsBytesAndConns which have been - // received from the connection since the subtest started. - readEventCounter int - // HandleEventsLimit is the total number of eventsBytesAndConns to send and - // receive through the query client's eventsBytes for this subtest. - handleEventsLimit = 250 - // delayFirstEvent runs once (per test case) to delay the first event - // published by the mocked connection's Receive method to give the test - // ample time to subscribe to the events bytes observable before it - // starts receiving events, otherwise they will be dropped. - delayFirstEvent sync.Once - connClosed atomic.Bool - queryCtx, cancelQuery = context.WithCancel(rootCtx) - ) - - // Must set up connection mock before calling EventsBytes() - connMock := mockclient.NewMockConnection(ctrl) - // `Connection#Close()` should be called once for each subscription. - connMock.EXPECT().Close(). - DoAndReturn(func() error { - // Simulate closing the connection. - connClosed.CompareAndSwap(false, true) - return nil - }). - Times(1) - // `Connection#Send()` should be called once for each subscription. - connMock.EXPECT().Send(gomock.Any()). - Return(nil). - Times(1) - // `Connection#Receive()` should be called once for each message plus - // one as it blocks in the loop which calls msgHandler after reading the - // last message. - connMock.EXPECT().Receive(). - DoAndReturn(func() (any, error) { - delayFirstEvent.Do(func() { time.Sleep(50 * time.Millisecond) }) - - // Simulate ErrConnClosed if connection is isClosed. - if connClosed.Load() { - return nil, events.ErrEventsConnClosed - } - - event := testEvent(int32(readEventCounter)) - readEventCounter++ - - // Simulate IO delay between sequential events. - time.Sleep(10 * time.Microsecond) - - return event, nil - }). - MinTimes(handleEventsLimit) - connMocks[queryIdx] = connMock - - // Set up events bytes observer for this query. - eventObservable, err := queryClient.EventsBytes(queryCtx, testQuery(queryIdx)) - require.NoError(t, err) - - eventObserver := eventObservable.Subscribe(queryCtx) - - onLimit := func() { - // Cancelling the context should close the connection. - cancelQuery() - // Closing the connection happens asynchronously, so we need to wait a bit - // for the connection to close to satisfy the connection mock expectations. - time.Sleep(10 * time.Millisecond) - - // Drain the observer channel and assert that it's isClosed. - err := testchannel.DrainChannel(eventObserver.Ch()) - require.NoError(t, err, "eventsBytesAndConns observer channel should be isClosed") - } - - // Concurrently consume eventsBytesAndConns from the observer channel. - behavesLikeEitherObserver( - t, eventObserver, - handleEventsLimit, - events.ErrEventsConnClosed, - readObserverEventsTimeout, - onLimit, - ) - }) - } -} - -func TestEventsQueryClient_Subscribe_Close(t *testing.T) { - var ( - firstEventDelay = 50 * time.Millisecond - readAllEventsTimeout = 50*time.Millisecond + firstEventDelay - handleEventsLimit = 10 - readEventCounter int - // delayFirstEvent runs once (per test case) to delay the first event - // published by the mocked connection's Receive method to give the test - // ample time to subscribe to the events bytes observable before it - // starts receiving events, otherwise they will be dropped. - delayFirstEvent sync.Once - connClosed atomic.Bool - ctx = context.Background() - ) - - connMock, dialerMock := testeventsquery.NewOneTimeMockConnAndDialer(t) - connMock.EXPECT().Send(gomock.Any()).Return(nil). - Times(1) - connMock.EXPECT().Receive(). - DoAndReturn(func() (any, error) { - delayFirstEvent.Do(func() { time.Sleep(firstEventDelay) }) - - if connClosed.Load() { - return nil, events.ErrEventsConnClosed - } - - event := testEvent(int32(readEventCounter)) - readEventCounter++ - - // Simulate IO delay between sequential events. - time.Sleep(10 * time.Microsecond) - - return event, nil - }). - MinTimes(handleEventsLimit) - - dialerOpt := events.WithDialer(dialerMock) - queryClient := events.NewEventsQueryClient("", dialerOpt) - - // set up query observer - eventsObservable, err := queryClient.EventsBytes(ctx, testQuery(0)) - require.NoError(t, err) - - eventsObserver := eventsObservable.Subscribe(ctx) - - onLimit := func() { - // cancelling the context should close the connection - queryClient.Close() - // closing the connection happens asynchronously, so we need to wait a bit - // for the connection to close to satisfy the connection mock expectations. - time.Sleep(10 * time.Millisecond) - } - - // concurrently consume eventsBytesAndConns from the observer channel - behavesLikeEitherObserver( - t, eventsObserver, - handleEventsLimit, - events.ErrEventsConnClosed, - readAllEventsTimeout, - onLimit, - ) -} - -func TestEventsQueryClient_Subscribe_DialError(t *testing.T) { - ctx := context.Background() - - eitherErrDial := either.Error[*mockclient.MockConnection](events.ErrEventsDial) - dialerMock := testeventsquery.NewOneTimeMockDialer(t, eitherErrDial) - - dialerOpt := events.WithDialer(dialerMock) - queryClient := events.NewEventsQueryClient("", dialerOpt) - eventsObservable, err := queryClient.EventsBytes(ctx, testQuery(0)) - require.Nil(t, eventsObservable) - require.True(t, errors.Is(err, events.ErrEventsDial)) -} - -func TestEventsQueryClient_Subscribe_RequestError(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - - connMock, dialerMock := testeventsquery.NewOneTimeMockConnAndDialer(t) - connMock.EXPECT().Send(gomock.Any()). - Return(fmt.Errorf("mock send error")). - Times(1) - - dialerOpt := events.WithDialer(dialerMock) - queryClient := events.NewEventsQueryClient("url_ignored", dialerOpt) - eventsObservable, err := queryClient.EventsBytes(ctx, testQuery(0)) - require.Nil(t, eventsObservable) - require.True(t, errors.Is(err, events.ErrEventsSubscribe)) - - // cancelling the context should close the connection - cancel() - // closing the connection happens asynchronously, so we need to wait a bit - // for the connection to close to satisfy the connection mock expectations. - time.Sleep(10 * time.Millisecond) -} - -// TODO_INVESTIGATE: why this test fails? -func TestEventsQueryClient_Subscribe_ReceiveError(t *testing.T) { - t.Skip("TODO_INVESTIGATE: why this test fails") - - var ( - handleEventLimit = 10 - readAllEventsTimeout = 100 * time.Millisecond - readEventCounter int - ) - - ctx, cancel := context.WithCancel(context.Background()) - t.Cleanup(cancel) - - connMock, dialerMock := testeventsquery.NewOneTimeMockConnAndDialer(t) - connMock.EXPECT().Send(gomock.Any()).Return(nil). - Times(1) - connMock.EXPECT().Receive(). - DoAndReturn(func() (any, error) { - if readEventCounter >= handleEventLimit { - return nil, websocket.ErrEventsWebsocketReceive - } - - event := testEvent(int32(readEventCounter)) - readEventCounter++ - time.Sleep(10 * time.Microsecond) - - return event, nil - }). - MinTimes(handleEventLimit) - - dialerOpt := events.WithDialer(dialerMock) - queryClient := events.NewEventsQueryClient("", dialerOpt) - - // set up query observer - eventsObservable, err := queryClient.EventsBytes(ctx, testQuery(0)) - require.NoError(t, err) - - eventsObserver := eventsObservable.Subscribe(ctx) - // concurrently consume eventsBytesAndConns from the observer channel - behavesLikeEitherObserver( - t, eventsObserver, - handleEventLimit, - websocket.ErrEventsWebsocketReceive, - readAllEventsTimeout, - nil, - ) -} - -// TODO_TECHDEBT: add test coverage for multiple observers with distinct and overlapping queries -func TestEventsQueryClient_EventsBytes_MultipleObservers(t *testing.T) { - t.Skip("TODO_TECHDEBT: add test coverage for multiple observers with distinct and overlapping queries") -} - -// behavesLikeEitherObserver asserts that the given observer behaves like an -// observable.Observer[either.Either[V]] by consuming notifications from the -// observer channel and asserting that they match the expected notification. -// It also asserts that the observer channel is isClosed after the expected number -// of eventsBytes have been received. -// If onLimit is not nil, it is called when the expected number of events have -// been received. -// Otherwise, the observer channel is drained and the test fails if it is not -// isClosed after the timeout duration. -func behavesLikeEitherObserver[V any]( - t *testing.T, - observer observable.Observer[either.Either[V]], - notificationsLimit int, - expectedErr error, - timeout time.Duration, - onLimit func(), -) { - t.Helper() - - var ( - // eventsCounter is the number of events which have been received from the - // eventsBytes since this function was called. - eventsCounter int32 - // errCh is used to signal when the test completes and/or produces an error - errCh = make(chan error, 1) - ) - - go func() { - for eitherEvent := range observer.Ch() { - event, err := eitherEvent.ValueOrError() - if err != nil { - switch expectedErr { - case nil: - if !assert.NoError(t, err) { - errCh <- testerrors.ErrAsync - return - } - default: - if !assert.ErrorIs(t, err, expectedErr) { - errCh <- testerrors.ErrAsync - return - } - } - } - - currentEventCount := atomic.LoadInt32(&eventsCounter) - if int(currentEventCount) >= notificationsLimit { - // signal completion - errCh <- nil - return - } - - // TODO_IMPROVE: to make this test helper more generic, it should accept - // a generic function which generates the expected event for the given - // index. Perhaps this function could use an either type which could be - // used to consolidate the expectedErr and expectedEvent arguments. - expectedEvent := testEvent(currentEventCount) - // Require calls t.Fatal internally, which shouldn't happen in a - // goroutine other than the test function's. - // Use assert instead and stop the test by sending on errCh and - // returning. - if !assert.Equal(t, expectedEvent, event) { - errCh <- testerrors.ErrAsync - return - } - - atomic.AddInt32(&eventsCounter, 1) - - // unbounded consumption here can result in the condition below never - // being met due to the connection being isClosed before the "last" event - // is received - time.Sleep(10 * time.Microsecond) - } - }() - - select { - case err := <-errCh: - require.NoError(t, err) - require.Equal(t, notificationsLimit, int(atomic.LoadInt32(&eventsCounter))) - - // TODO_THIS_COMMIT: is this necessary? - time.Sleep(10 * time.Millisecond) - - if onLimit != nil { - onLimit() - } - case <-time.After(timeout): - t.Fatalf( - "timed out waiting for next event; expected %d events, got %d", - notificationsLimit, atomic.LoadInt32(&eventsCounter), - ) - } - - err := testchannel.DrainChannel(observer.Ch()) - require.NoError(t, err, "eventsBytesAndConns observer should be isClosed") -} - -func testEvent(idx int32) []byte { - return []byte(fmt.Sprintf("message_%d", idx)) -} - -func testQuery(idx int) string { - return fmt.Sprintf("query_%d", idx) -} diff --git a/pkg/client/events/replay_client.go b/pkg/client/events/replay_client.go deleted file mode 100644 index 4313213e5..000000000 --- a/pkg/client/events/replay_client.go +++ /dev/null @@ -1,302 +0,0 @@ -package events - -import ( - "context" - "fmt" - "time" - - "cosmossdk.io/depinject" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/retry" -) - -const ( - // eventsBytesRetryDelay is the delay between retry attempts when the events - // bytes observable returns an error. - eventsBytesRetryDelay = time.Second - // eventsBytesRetryLimit is the maximum number of times to attempt to - // re-establish the events query bytes subscription when the events bytes - // observable returns an error or closes. - eventsBytesRetryLimit = 10 - eventsBytesRetryResetTimeout = 10 * time.Second - // replayObsCacheBufferSize is the replay buffer size of the - // replayObsCache replay observable which is used to cache the replay - // observable that is notified of new events. - // It, replayObsCache, is updated with a new "active" observable when a new - // events query subscription is created, for example, after a non-persistent - // connection error. - replayObsCacheBufferSize = 1 -) - -// Enforce the EventsReplayClient interface is implemented by the replayClient type. -var _ client.EventsReplayClient[any] = (*replayClient[any])(nil) - -// NewEventsFn is a function that takes a byte slice and returns a new instance -// of the generic type T. -type NewEventsFn[T any] func([]byte) (T, error) - -// replayClient implements the EventsReplayClient interface for a generic type T, -// and replay observable for type T. -type replayClient[T any] struct { - // queryString is the query string used to subscribe to events of the - // desired type. - // See: https://docs.cosmos.network/main/learn/advanced/events#subscribing-to-events - // and: https://docs.cosmos.network/main/learn/advanced/events#default-events - queryString string - // eventsClient is the events query client which is used to subscribe to - // newly committed block events. It emits an either value which may contain - // an error, at most, once and closes immediately after if it does. - eventsClient client.EventsQueryClient - // eventDecoder is a function which decodes event subscription - // message bytes into the type defined by the EventsReplayClient's generic type - // parameter. - eventDecoder NewEventsFn[T] - // replayObsBufferSize is the buffer size for the replay observable returned - // by EventsSequence, this can be any integer and it refers to the number of - // notifications the replay observable will hold in its buffer, that can be - // replayed to new observers. - // NB: This is not the buffer size of the replayObsCache - replayObsBufferSize int - // replayObsCache is a replay observable with a buffer size of 1, which - // holds the "active latest replay observable" which is notified when new - // events are received by the events query client subscription created in - // goPublishEvents. This observable (and the one it emits) closes when the - // events bytes observable returns an error and is updated with a new - // "active" observable after a new events query subscription is created. - // - // TODO_REFACTOR(@h5law): Look into making this a regular observable as - // we may no longer depend on it being replayable. - replayObsCache observable.ReplayObservable[observable.ReplayObservable[T]] - // replayObsCachePublishCh is the publish channel for replayObsCache. - // It's used to set and subsequently update replayObsCache the events replay - // observable; - // For example when the connection is re-established after erroring. - replayObsCachePublishCh chan<- observable.ReplayObservable[T] -} - -// NewEventsReplayClient creates a new EventsReplayClient from the given -// dependencies, cometWebsocketURL and subscription query string. It requires a -// decoder function to be provided which decodes event subscription message -// bytes into the type defined by the EventsReplayClient's generic type parameter. -// The replayObsBufferSize is the replay buffer size of the replay observable -// which is notified of new events. -// -// Required dependencies: -// - client.EventsQueryClient -func NewEventsReplayClient[T any]( - ctx context.Context, - deps depinject.Config, - queryString string, - newEventFn NewEventsFn[T], - replayObsBufferSize int, -) (client.EventsReplayClient[T], error) { - // Initialize the replay client - rClient := &replayClient[T]{ - queryString: queryString, - eventDecoder: newEventFn, - replayObsBufferSize: replayObsBufferSize, - } - // TODO_REFACTOR(@h5law): Look into making this a regular observable as - // we may no longer depend on it being replayable. - replayObsCache, replayObsCachePublishCh := channel.NewReplayObservable[observable.ReplayObservable[T]]( - ctx, - // Buffer size of 1 as the cache only needs to hold the latest - // active replay observable. - replayObsCacheBufferSize, - ) - rClient.replayObsCache = replayObsCache - rClient.replayObsCachePublishCh = replayObsCachePublishCh - - // Inject dependencies - if err := depinject.Inject(deps, &rClient.eventsClient); err != nil { - return nil, err - } - - // Concurrently publish events to the observable emitted by replayObsCache. - go rClient.goPublishEvents(ctx) - - return rClient, nil -} - -// EventsSequence returns a new ReplayObservable, with the buffer size provided -// during the EventsReplayClient construction, which is notified when new -// events are received by the encapsulated EventsQueryClient. -func (rClient *replayClient[T]) EventsSequence(ctx context.Context) observable.ReplayObservable[T] { - // Create a new replay observable and publish channel for event type T with - // a buffer size matching that provided during the EventsReplayClient - // construction. - eventTypeObs, replayEventTypeObsPublishCh := channel.NewReplayObservable[T]( - ctx, - rClient.replayObsBufferSize, - ) - - // Ensure that the subscribers of the returned eventTypeObs receive - // notifications from the latest open replay observable. - go rClient.goRemapEventsSequence(ctx, replayEventTypeObsPublishCh) - - // Return the event type observable. - return eventTypeObs -} - -// goRemapEventsSequence publishes events observed by the most recent cached -// events type replay observable to the given publishCh -func (rClient *replayClient[T]) goRemapEventsSequence(ctx context.Context, publishCh chan<- T) { - var prevEventTypeObs observable.ReplayObservable[T] - channel.ForEach[observable.ReplayObservable[T]]( - ctx, - rClient.replayObsCache, - func(ctx context.Context, eventTypeObs observable.ReplayObservable[T]) { - if prevEventTypeObs != nil { - // Just in case the assumption that all transport errors are - // persistent (i.e. they occur once and do not repeat) does not - // hold, unsubscribe from the previous event type observable in - // order to prevent unexpected and/or duplicate notifications - // on the observable returned by this function. - prevEventTypeObs.UnsubscribeAll() - } else { - prevEventTypeObs = eventTypeObs - } - eventObserver := eventTypeObs.Subscribe(ctx) - for event := range eventObserver.Ch() { - publishCh <- event - } - }, - ) -} - -// LastNEvents returns the last N typed events that have been received by the -// corresponding events query subscription. -// It blocks until at least one event has been received. -func (rClient *replayClient[T]) LastNEvents(ctx context.Context, n int) []T { - return rClient.EventsSequence(ctx).Last(ctx, n) -} - -// Close unsubscribes all observers of the committed blocks sequence observable -// and closes the events query client. -func (rClient *replayClient[T]) Close() { - // Closing eventsClient will cascade unsubscribe and close downstream observers. - rClient.eventsClient.Close() -} - -// goPublishEvents runs the work function returned by retryPublishEventsFactory, -// re-invoking it according to the arguments to retry.OnError when the events bytes -// observable returns an asynchronous error. -// This function is intended to be called in a goroutine. -func (rClient *replayClient[T]) goPublishEvents(ctx context.Context) { - // React to errors by getting a new events bytes observable, re-mapping it, - // and send it to replayObsCachePublishCh such that - // replayObsCache.Last(ctx, 1) will return it. - publishError := retry.OnError( - ctx, - eventsBytesRetryLimit, - eventsBytesRetryDelay, - eventsBytesRetryResetTimeout, - "goPublishEvents", - rClient.retryPublishEventsFactory(ctx), - ) - - // If we get here, the retry limit was reached and the retry loop exited. - // Since this function runs in a goroutine, we can't return the error to the - // caller. Instead, we panic. - if publishError != nil { - panic(fmt.Errorf("EventsReplayClient[%T].goPublishEvents should never reach this spot: %w", *new(T), publishError)) - } -} - -// retryPublishEventsFactory returns a function which is intended to be passed -// to retry.OnError. The returned function pipes event bytes from the events -// query client, maps them to typed events, and publishes them to the -// replayObsCache replay observable. -func (rClient *replayClient[T]) retryPublishEventsFactory(ctx context.Context) func() chan error { - return func() chan error { - errCh := make(chan error, 1) - eventsBytesObs, err := rClient.eventsClient.EventsBytes(ctx, rClient.queryString) - if err != nil { - errCh <- err - return errCh - } - - // NB: must cast back to generic observable type to use with Map. - eventsBzObs := observable.Observable[either.Either[[]byte]](eventsBytesObs) - typedObs := channel.MapReplay( - ctx, - replayObsCacheBufferSize, - eventsBzObs, - rClient.newMapEventsBytesToTFn(errCh), - ) - - // Subscribe to the eventBzObs and block until the channel closes. - // Then pass this as an error to force the retry.OnError to resubscribe. - go func() { - eventsBzObserver := eventsBzObs.Subscribe(ctx) - for range eventsBzObserver.Ch() { - // Wait for the channel to close. - continue - } - // UnsubscribeAll downstream observers, as the source observable has - // closed and will not emit any more values. - typedObs.UnsubscribeAll() - // Publish an error to the error channel to initiate a retry - errCh <- ErrEventsConsClosed - }() - - // Initially set replayObsCache and update if after retrying on error. - rClient.replayObsCachePublishCh <- typedObs - - return errCh - } -} - -// newMapEventsBytesToTFn is a factory for a function which is intended -// to be used as a transformFn in a channel.Map() call. Since the map function -// is called asynchronously, this factory creates a closure around an error -// channel which can be used for asynchronous error signaling from within the -// map function, and handling from the Map call context. -// -// The map function itself attempts to deserialize the given byte slice as a -// the EventsReplayClient's generic typed event, using the decoder function provided. -// If the events bytes observable contained an error, this value is not emitted -// (skipped) on the destination observable of the map operation. -// -// If deserialisation failed because the event bytes were for a different event -// type, this value is also skipped. If deserialisation failed for some other -// reason, this function panics. -func (rClient *replayClient[T]) newMapEventsBytesToTFn(errCh chan<- error) func( - context.Context, - either.Bytes, -) (T, bool) { - return func( - _ context.Context, - eitherEventBz either.Bytes, - ) (_ T, skip bool) { - eventBz, err := eitherEventBz.ValueOrError() - if err != nil { - errCh <- err - // Don't publish (skip) if eitherEventBz contained an error. - // eitherEventBz should automatically close itself in this case. - // (i.e. no more values should be mapped to this transformFn's respective - // dstObservable). - return *new(T), true - } - - // attempt to decode the event bytes using the decoder function provided - // during the EventsReplayClient's construction. - event, err := rClient.eventDecoder(eventBz) - if err != nil { - if ErrEventsUnmarshalEvent.Is(err) { - // Don't publish (skip) if the message was not the correct event. - return *new(T), true - } - - panic(fmt.Sprintf( - "unexpected error deserialising event: %v; eventBz: %s", - err, string(eventBz), - )) - } - return event, false - } -} diff --git a/pkg/client/events/replay_client_example_test.go b/pkg/client/events/replay_client_example_test.go deleted file mode 100644 index d11685de2..000000000 --- a/pkg/client/events/replay_client_example_test.go +++ /dev/null @@ -1,105 +0,0 @@ -package events_test - -import ( - "context" - "encoding/json" - "fmt" - - "cosmossdk.io/depinject" - - "github.com/pokt-network/poktroll/pkg/client/events" - "github.com/pokt-network/poktroll/pkg/polylog" -) - -const ( - // Define a query string to provide to the EventsQueryClient - // See: https://docs.cosmos.network/v0.47/learn/advanced/events#subscribing-to-events - // And: https://docs.cosmos.network/v0.47/learn/advanced/events#default-events - eventQueryString = "message.action='messageActionName'" - // Define the websocket URL the EventsQueryClient will subscribe to - cometWebsocketURL = "ws://example.com:36657/websocket" - // the amount of events we want before they are emitted - replayObsBufferSize = 1 -) - -var _ EventType = (*eventType)(nil) - -// Define an interface to represent the onchain event -type EventType interface { - GetName() string // Illustrative only; arbitrary interfaces are supported. -} - -// Define the event type that implements the interface -type eventType struct { - Name string `json:"name"` -} - -// See: https://pkg.go.dev/github.com/pokt-network/poktroll/pkg/client/events/#NewEventsFn -func eventTypeFactory(ctx context.Context) events.NewEventsFn[EventType] { - // Define a decoder function that can take the raw event bytes - // received from the EventsQueryClient and convert them into - // the desired type for the EventsReplayClient - return func(eventBz []byte) (EventType, error) { - eventMsg := new(eventType) - logger := polylog.Ctx(ctx) - - if err := json.Unmarshal(eventBz, eventMsg); err != nil { - return nil, err - } - - // Confirm the event is correct by checking its fields - if eventMsg.Name == "" { - logger.Error().Str("eventBz", string(eventBz)).Msg("event type is not correct") - return nil, events.ErrEventsUnmarshalEvent. - Wrapf("with eventType data: %s", string(eventBz)) - } - - return eventMsg, nil - } -} - -func (e *eventType) GetName() string { return e.Name } - -func ExampleNewEventsReplayClient() { - // Create the events query client and a depinject config to supply - // it into the EventsReplayClient - // See: https://pkg.go.dev/github.com/pokt-network/poktroll/pkg/client/events/#NewEventsQueryClient - evtClient := events.NewEventsQueryClient(cometWebsocketURL) - depConfig := depinject.Supply(evtClient) - - // Create a context (this should be cancellable to close the EventsReplayClient) - ctx, cancel := context.WithCancel(context.Background()) - - // Create a new instance of the EventsReplayClient - // See: https://pkg.go.dev/github.com/pokt-network/poktroll/pkg/client/events/#NewEventsReplayClient - client, err := events.NewEventsReplayClient[EventType]( - ctx, - depConfig, - eventQueryString, - eventTypeFactory(ctx), - replayObsBufferSize, - ) - if err != nil { - panic(fmt.Errorf("unable to create EventsReplayClient %v", err)) - } - - // Assume events the lastest event emitted of type EventType has the name "testEvent" - - // Retrieve the latest emitted event - lastEventType := client.LastNEvents(ctx, 1)[0] - fmt.Printf("Last Event: '%s'\n", lastEventType.GetName()) - - // Get the latest replay observable from the EventsReplayClient - // In order to get the latest events from the sequence - latestEventsObs := client.EventsSequence(ctx) - // Get the latest events from the sequence - lastEventType = latestEventsObs.Last(ctx, 1)[0] - fmt.Printf("Last Event: '%s'\n", lastEventType.GetName()) - - // Cancel the context which will call client.Close and close all - // subscriptions and the EventsQueryClient - cancel() - // Output - // Last Event: 'testEvent' - // Last Event: 'testEvent' -} diff --git a/pkg/client/events/replay_client_integration_test.go b/pkg/client/events/replay_client_integration_test.go deleted file mode 100644 index 30fe639be..000000000 --- a/pkg/client/events/replay_client_integration_test.go +++ /dev/null @@ -1,146 +0,0 @@ -package events_test - -import ( - "context" - "encoding/json" - "fmt" - "sync/atomic" - "testing" - "time" - - "cosmossdk.io/depinject" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client/events" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" -) - -// Create the generic event type and decoder for the replay client - -var _ messageEvent = (*tEvent)(nil) - -type messageEvent interface { - EventMessage() string -} - -type tEvent struct { - Message string `json:"message"` -} - -type messageEventReplayObs observable.ReplayObservable[messageEvent] - -func (t *tEvent) EventMessage() string { - return t.Message -} - -func newDecodeEventMessageFn() events.NewEventsFn[messageEvent] { - return func(eventBz []byte) (messageEvent, error) { - t := new(tEvent) - if err := json.Unmarshal(eventBz, t); err != nil { - return nil, err - } - if t.Message == "" { - return nil, events.ErrEventsUnmarshalEvent - } - return t, nil - } -} - -// newMessageEventBz returns a new message event in JSON format -func newMessageEventBz(eventNum int32) []byte { - return []byte(fmt.Sprintf(`{"message":"message_%d"}`, eventNum)) -} - -func TestReplayClient_Remapping(t *testing.T) { - var ( - ctx = context.Background() - connClosed atomic.Bool - firstEventDelayed atomic.Bool - readEventCounter atomic.Int32 - eventsReceived atomic.Int32 - eventsToRecv = int32(10) - errCh = make(chan error, 1) - timeoutAfter = 3 * time.Second // 1 second delay on retry.OnError - ) - - // Setup the mock connection and dialer - connMock, dialerMock := testeventsquery.NewNTimesReconnectMockConnAndDialer(t, 2, &connClosed, &firstEventDelayed) - // Mock the connection receiving events - connMock.EXPECT().Receive(). - // Receive is called in the tightest loop possible (max speed limited - // by a goroutine) and as such the sleep's within are used to slow down - // the time between events to prevent unexpected behavior. As in this - // test environment, there are no "real" delays between "#Receive" calls - // (events being emitted) and as such the sleep's enable the publishing - // of notifications to observers to occur in a flake-free manner. - DoAndReturn(func() (any, error) { - // Simulate ErrConnClosed if connection is isClosed. - if connClosed.Load() { - return nil, events.ErrEventsConnClosed - } - - // Delay the event if needed, this is to allow for the events query - // client to subscribe and receive the first event. - if !firstEventDelayed.CompareAndSwap(false, true) { - time.Sleep(50 * time.Millisecond) - } - - eventNum := readEventCounter.Add(1) - 1 - event := newMessageEventBz(eventNum) - // After an arbitrary number of events (2 in this case), simulate - // the connection closing so that the replay client can remap the - // events it receives without the caller having to resubscribe. - if eventNum == 2 { - // Simulate the connection closing - connMock.Close() - } - - // Simulate IO delay between sequential events. - time.Sleep(50 * time.Microsecond) - - return event, nil - }). - MinTimes(int(eventsToRecv)) - - // Setup the events query client dependency - dialerOpt := events.WithDialer(dialerMock) - queryClient := events.NewEventsQueryClient("", dialerOpt) - deps := depinject.Supply(queryClient) - - // Create the replay client - replayClient, err := events.NewEventsReplayClient[messageEvent]( - ctx, - deps, - "", // subscription query string - newDecodeEventMessageFn(), - 100, // replay buffer size - ) - require.NoError(t, err) - - channel.ForEach( - ctx, - observable.Observable[messageEvent](replayClient.EventsSequence(ctx)), - func(ctx context.Context, event messageEvent) { - require.NotEmpty(t, event) - received := eventsReceived.Add(1) - if received >= eventsToRecv { - errCh <- nil - return - } - }, - ) - - select { - case err := <-errCh: - require.NoError(t, err) - eventsRecv := eventsReceived.Load() - require.Equalf(t, eventsToRecv, eventsRecv, "received %d events, want: %d", eventsReceived.Load(), eventsRecv) - case <-time.After(timeoutAfter): - t.Fatalf( - "timed out waiting for events subscription; expected %d messages, got %d", - eventsToRecv, eventsReceived.Load(), - ) - } -} diff --git a/pkg/client/events/websocket/connection.go b/pkg/client/events/websocket/connection.go deleted file mode 100644 index 5f34aba4e..000000000 --- a/pkg/client/events/websocket/connection.go +++ /dev/null @@ -1,35 +0,0 @@ -package websocket - -import ( - gorillaws "github.com/gorilla/websocket" - - "github.com/pokt-network/poktroll/pkg/client" -) - -var _ client.Connection = (*websocketConn)(nil) - -// websocketConn implements the Connection interface using the gorilla websocket -// transport implementation. -type websocketConn struct { - conn *gorillaws.Conn -} - -// Receive implements the respective interface method using the underlying websocket. -func (wsConn *websocketConn) Receive() ([]byte, error) { - _, msg, err := wsConn.conn.ReadMessage() - if err != nil { - return nil, ErrEventsWebsocketReceive.Wrapf("%s", err) - } - return msg, nil -} - -// Send implements the respective interface method using the underlying websocket. -func (wsConn *websocketConn) Send(msg []byte) error { - // Using the TextMessage message to indicate that msg is UTF-8 encoded. - return wsConn.conn.WriteMessage(gorillaws.TextMessage, msg) -} - -// Close implements the respective interface method using the underlying websocket. -func (wsConn *websocketConn) Close() error { - return wsConn.conn.Close() -} diff --git a/pkg/client/events/websocket/dialer.go b/pkg/client/events/websocket/dialer.go deleted file mode 100644 index bd0597d03..000000000 --- a/pkg/client/events/websocket/dialer.go +++ /dev/null @@ -1,35 +0,0 @@ -package websocket - -import ( - "context" - - "github.com/gorilla/websocket" - - "github.com/pokt-network/poktroll/pkg/client" -) - -var _ client.Dialer = (*websocketDialer)(nil) - -// websocketDialer implements the Dialer interface using the gorilla websocket -// transport implementation. -type websocketDialer struct{} - -// NewWebsocketDialer creates a new websocketDialer. -func NewWebsocketDialer() client.Dialer { - return &websocketDialer{} -} - -// DialContext implements the respective interface method using the default gorilla -// websocket dialer. -func (wsDialer *websocketDialer) DialContext( - ctx context.Context, - urlString string, -) (client.Connection, error) { - // TODO_IMPROVE: check http response status and potential err - // TODO_TECHDEBT: add test coverage and ensure support for a 3xx responses - conn, _, err := websocket.DefaultDialer.DialContext(ctx, urlString, nil) - if err != nil { - return nil, err - } - return &websocketConn{conn: conn}, nil -} diff --git a/pkg/client/events/websocket/errors.go b/pkg/client/events/websocket/errors.go deleted file mode 100644 index 85f8953fd..000000000 --- a/pkg/client/events/websocket/errors.go +++ /dev/null @@ -1,11 +0,0 @@ -package websocket - -import ( - sdkerrors "cosmossdk.io/errors" -) - -var ( - codespace = "events_query_client_websocket_connection" - - ErrEventsWebsocketReceive = sdkerrors.Register(codespace, 1, "failed to receive event over websocket connection to pocket node") -) diff --git a/pkg/client/events/websocket/godoc.go b/pkg/client/events/websocket/godoc.go deleted file mode 100644 index 6ac7e3f04..000000000 --- a/pkg/client/events/websocket/godoc.go +++ /dev/null @@ -1,3 +0,0 @@ -// Package websocket provides a websocket client used to connect to a cosmos-sdk -// based chain node and subscribe to events via the EventsQueryClient. -package websocket diff --git a/pkg/client/godoc.go b/pkg/client/godoc.go deleted file mode 100644 index 66da550dd..000000000 --- a/pkg/client/godoc.go +++ /dev/null @@ -1,12 +0,0 @@ -// Package client defines interfaces and types that facilitate interactions -// with blockchain functionalities, both transactional and observational. It is -// built to provide an abstraction layer for sending, receiving, and querying -// blockchain data, thereby offering a standardized way of integrating with -// various blockchain platforms. -// -// The client package leverages external libraries like cosmos-sdk and cometbft, -// but there is a preference to minimize direct dependencies on these external -// libraries, when defining interfaces, aiming for a cleaner decoupling. -// It seeks to provide a flexible and comprehensive interface layer, adaptable to -// different blockchain configurations and requirements. -package client diff --git a/pkg/client/interface.go b/pkg/client/interface.go deleted file mode 100644 index 8b6519053..000000000 --- a/pkg/client/interface.go +++ /dev/null @@ -1,261 +0,0 @@ -//go:generate mockgen -destination=../../testutil/mockclient/events_query_client_mock.go -package=mockclient . Dialer,Connection,EventsQueryClient -//go:generate mockgen -destination=../../testutil/mockclient/block_client_mock.go -package=mockclient . Block,BlockClient -//go:generate mockgen -destination=../../testutil/mockclient/delegation_client_mock.go -package=mockclient . Redelegation,DelegationClient -//go:generate mockgen -destination=../../testutil/mockclient/tx_client_mock.go -package=mockclient . TxContext,TxClient -//go:generate mockgen -destination=../../testutil/mockclient/supplier_client_mock.go -package=mockclient . SupplierClient -//go:generate mockgen -destination=../../testutil/mockclient/account_query_client_mock.go -package=mockclient . AccountQueryClient -//go:generate mockgen -destination=../../testutil/mockclient/application_query_client_mock.go -package=mockclient . ApplicationQueryClient -//go:generate mockgen -destination=../../testutil/mockclient/supplier_query_client_mock.go -package=mockclient . SupplierQueryClient -//go:generate mockgen -destination=../../testutil/mockclient/session_query_client_mock.go -package=mockclient . SessionQueryClient -//go:generate mockgen -destination=../../testutil/mockclient/cosmos_tx_builder_mock.go -package=mockclient github.com/cosmos/cosmos-sdk/client TxBuilder -//go:generate mockgen -destination=../../testutil/mockclient/cosmos_keyring_mock.go -package=mockclient github.com/cosmos/cosmos-sdk/crypto/keyring Keyring -//go:generate mockgen -destination=../../testutil/mockclient/cosmos_client_mock.go -package=mockclient github.com/cosmos/cosmos-sdk/client AccountRetriever - -package client - -import ( - "context" - - comettypes "github.com/cometbft/cometbft/rpc/core/types" - cosmosclient "github.com/cosmos/cosmos-sdk/client" - cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" - cosmostypes "github.com/cosmos/cosmos-sdk/types" - accounttypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/pokt-network/smt" - - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/pkg/observable" - apptypes "github.com/pokt-network/poktroll/x/application/types" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// SupplierClient is an interface for sufficient for a supplier operator to be -// able to construct blockchain transactions from pocket protocol-specific messages -// related to its role. -type SupplierClient interface { - // CreateClaim sends a claim message which creates an on-chain commitment by - // calling supplier to the given smt.SparseMerkleSumTree root hash of the given - // session's mined relays. - CreateClaim( - ctx context.Context, - sessionHeader sessiontypes.SessionHeader, - rootHash []byte, - ) error - // SubmitProof sends a proof message which contains the - // smt.SparseMerkleClosestProof, corresponding to some previously created claim - // for the same session. The proof is validated on-chain as part of the pocket - // protocol. - SubmitProof( - ctx context.Context, - sessionHeader sessiontypes.SessionHeader, - proof *smt.SparseMerkleClosestProof, - ) error -} - -// TxClient provides a synchronous interface initiating and waiting for transactions -// derived from cosmos-sdk messages, in a cosmos-sdk based blockchain network. -type TxClient interface { - SignAndBroadcast( - ctx context.Context, - msgs ...cosmostypes.Msg, - ) either.AsyncError -} - -// TxContext provides an interface which consolidates the operational dependencies -// required to facilitate the sender side of the transaction lifecycle: build, sign, -// encode, broadcast, and query (optional). -// -// TODO_IMPROVE: Avoid depending on cosmos-sdk structs or interfaces; add Pocket -// interface types to substitute: -// - ResultTx -// - TxResponse -// - Keyring -// - TxBuilder -type TxContext interface { - // GetKeyring returns the associated key management mechanism for the transaction context. - GetKeyring() cosmoskeyring.Keyring - - // NewTxBuilder creates and returns a new transaction builder instance. - NewTxBuilder() cosmosclient.TxBuilder - - // SignTx signs a transaction using the specified key name. It can operate in offline mode, - // and can overwrite any existing signatures based on the provided flags. - SignTx( - keyName string, - txBuilder cosmosclient.TxBuilder, - offline, overwriteSig bool, - ) error - - // EncodeTx takes a transaction builder and encodes it, returning its byte representation. - EncodeTx(txBuilder cosmosclient.TxBuilder) ([]byte, error) - - // BroadcastTx broadcasts the given transaction to the network. - BroadcastTx(txBytes []byte) (*cosmostypes.TxResponse, error) - - // QueryTx retrieves a transaction status based on its hash and optionally provides - // proof of the transaction. - QueryTx( - ctx context.Context, - txHash []byte, - prove bool, - ) (*comettypes.ResultTx, error) -} - -// Block is an interface which abstracts the details of a block to its minimal -// necessary components. -type Block interface { - Height() int64 - Hash() []byte -} - -// Redelegation is an interface which wraps the EventRedelegation event -// emitted by the application module. -// See: proto/pocket/application/types/event.proto#EventRedelegation -type Redelegation interface { - GetAppAddress() string - GetGatewayAddress() string -} - -// EventsObservable is a replay observable for events of some type T. -// NB: This cannot be an alias due to gomock's lack of support for generic types. -type EventsObservable[T any] observable.ReplayObservable[T] - -// EventsReplayClient is an interface which provides notifications about newly received -// events as well as direct access to the latest event via some blockchain API. -type EventsReplayClient[T any] interface { - // EventsSequence returns an observable which emits new events. - EventsSequence(context.Context) observable.ReplayObservable[T] - // LastNEvents returns the latest N events that has been received. - LastNEvents(ctx context.Context, n int) []T - // Close unsubscribes all observers of the events sequence observable - // and closes the events query client. - Close() -} - -// BlockReplayObservable is a defined type which is a replay observable of type Block. -// NB: This cannot be an alias due to gomock's lack of support for generic types. -type BlockReplayObservable EventsObservable[Block] - -// BlockClient is an interface that wraps the EventsReplayClient interface -// specific for the EventsReplayClient[Block] implementation -type BlockClient interface { - // CommittedBlocksSequence returns a BlockObservable that emits the - // latest blocks that have been committed to the chain. - CommittedBlocksSequence(context.Context) BlockReplayObservable - // LastNBlocks returns the latest N blocks that have been committed to - // the chain. - LastNBlocks(context.Context, int) []Block - // Close unsubscribes all observers of the committed block sequence - // observable and closes the events query client. - Close() -} - -// RedelegationReplayObservable is a defined type which is a replay observable -// of type Redelegation. -// NB: This cannot be an alias due to gomock's lack of support for generic types. -type RedelegationReplayObservable EventsObservable[Redelegation] - -// DelegationClient is an interface that wraps the EventsReplayClient interface -// specific for the EventsReplayClient[Redelegation] implementation -type DelegationClient interface { - // RedelegationsSequence returns a Observable of Redelegations that - // emits the latest redelegation events that have occurred on chain. - RedelegationsSequence(context.Context) RedelegationReplayObservable - // LastNRedelegations returns the latest N redelegation events that have - // occurred on chain. - LastNRedelegations(context.Context, int) []Redelegation - // Close unsubscribes all observers of the committed block sequence - // observable and closes the events query client. - Close() -} - -// EventsBytesObservable is an observable which is notified with an either -// value which contains either an error or the event message bytes. -// -// TODO_HACK: The purpose of this type is to work around gomock's lack of -// support for generic types. For the same reason, this type cannot be an -// alias (i.e. EventsBytesObservable = observable.Observable[either.Bytes]). -type EventsBytesObservable observable.Observable[either.Bytes] - -// EventsQueryClient is used to subscribe to chain event messages matching the given query, -// -// TODO_CONSIDERATION: the cosmos-sdk CLI code seems to use a cometbft RPC client -// which includes a `#Subscribe()` method for a similar purpose. Perhaps we could -// replace our custom implementation with one which wraps that. -// (see: https://github.com/cometbft/cometbft/blob/main/rpc/client/http/http.go#L110) -// (see: https://github.com/cosmos/cosmos-sdk/blob/main/client/rpc/tx.go#L114) -// -// NOTE: a branch which attempts this is available at: -// https://github.com/pokt-network/poktroll/pull/74 -type EventsQueryClient interface { - // EventsBytes returns an observable which is notified about chain event messages - // matching the given query. It receives an either value which contains either an - // error or the event message bytes. - EventsBytes( - ctx context.Context, - query string, - ) (EventsBytesObservable, error) - // Close unsubscribes all observers of each active query's events bytes - // observable and closes the connection. - Close() -} - -// Connection is a transport agnostic, bi-directional, message-passing interface. -type Connection interface { - // Receive blocks until a message is received or an error occurs. - Receive() (msg []byte, err error) - // Send sends a message and may return a synchronous error. - Send(msg []byte) error - // Close closes the connection. - Close() error -} - -// Dialer encapsulates the construction of connections. -type Dialer interface { - // DialContext constructs a connection to the given URL and returns it or - // potentially a synchronous error. - DialContext(ctx context.Context, urlStr string) (Connection, error) -} - -// EventsQueryClientOption defines a function type that modifies the EventsQueryClient. -type EventsQueryClientOption func(EventsQueryClient) - -// TxClientOption defines a function type that modifies the TxClient. -type TxClientOption func(TxClient) - -// SupplierClientOption defines a function type that modifies the SupplierClient. -type SupplierClientOption func(SupplierClient) - -// AccountQueryClient defines an interface that enables the querying of the -// on-chain account information -type AccountQueryClient interface { - // GetAccount queries the chain for the details of the account provided - GetAccount(ctx context.Context, address string) (accounttypes.AccountI, error) -} - -// ApplicationQueryClient defines an interface that enables the querying of the -// on-chain application information -type ApplicationQueryClient interface { - // GetApplication queries the chain for the details of the application provided - GetApplication(ctx context.Context, appAddress string) (apptypes.Application, error) -} - -// SupplierQueryClient defines an interface that enables the querying of the -// on-chain supplier information -type SupplierQueryClient interface { - // GetSupplier queries the chain for the details of the supplier provided - GetSupplier(ctx context.Context, supplierAddress string) (sharedtypes.Supplier, error) -} - -// SessionQueryClient defines an interface that enables the querying of the -// on-chain session information -type SessionQueryClient interface { - // GetSession queries the chain for the details of the session provided - GetSession( - ctx context.Context, - appAddress string, - serviceId string, - blockHeight int64, - ) (*sessiontypes.Session, error) -} diff --git a/pkg/client/keyring/errors.go b/pkg/client/keyring/errors.go deleted file mode 100644 index 7be8a677a..000000000 --- a/pkg/client/keyring/errors.go +++ /dev/null @@ -1,19 +0,0 @@ -package keyring - -import "cosmossdk.io/errors" - -var ( - // ErrEmptySigningKeyName represents an error which indicates that the - // provided signing key name is empty or unspecified. - ErrEmptySigningKeyName = errors.Register(codespace, 1, "empty signing key name") - - // ErrNoSuchSigningKey represents an error signifying that the requested - // signing key does not exist or could not be located. - ErrNoSuchSigningKey = errors.Register(codespace, 2, "signing key does not exist") - - // ErrSigningKeyAddr is raised when there's a failure in retrieving the - // associated address for the provided signing key. - ErrSigningKeyAddr = errors.Register(codespace, 3, "failed to get address for signing key") - - codespace = "keyring" -) diff --git a/pkg/client/keyring/keyring.go b/pkg/client/keyring/keyring.go deleted file mode 100644 index a77d35b6e..000000000 --- a/pkg/client/keyring/keyring.go +++ /dev/null @@ -1,29 +0,0 @@ -package keyring - -import ( - cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" - cosmostypes "github.com/cosmos/cosmos-sdk/types" -) - -// KeyNameToAddr attempts to retrieve the key with the given name from the -// given keyring and compute its address. -func KeyNameToAddr( - keyName string, - keyring cosmoskeyring.Keyring, -) (cosmostypes.AccAddress, error) { - if keyName == "" { - return nil, ErrEmptySigningKeyName - } - - keyRecord, err := keyring.Key(keyName) - if err != nil { - return nil, ErrNoSuchSigningKey.Wrapf("name %q: %s", keyName, err) - } - - signingAddr, err := keyRecord.GetAddress() - if err != nil { - return nil, ErrSigningKeyAddr.Wrapf("name %q: %s", keyName, err) - } - - return signingAddr, nil -} diff --git a/pkg/client/query/accquerier.go b/pkg/client/query/accquerier.go deleted file mode 100644 index c61ec9760..000000000 --- a/pkg/client/query/accquerier.go +++ /dev/null @@ -1,58 +0,0 @@ -package query - -import ( - "context" - - "cosmossdk.io/depinject" - accounttypes "github.com/cosmos/cosmos-sdk/x/auth/types" - grpc "github.com/cosmos/gogoproto/grpc" - - "github.com/pokt-network/poktroll/pkg/client" -) - -var _ client.AccountQueryClient = (*accQuerier)(nil) - -// accQuerier is a wrapper around the accounttypes.QueryClient that enables the -// querying of on-chain account information through a single exposed method -// which returns an accounttypes.AccountI interface -type accQuerier struct { - clientConn grpc.ClientConn - accountQuerier accounttypes.QueryClient -} - -// NewAccountQuerier returns a new instance of a client.AccountQueryClient by -// injecting the dependecies provided by the depinject.Config. -// -// Required dependencies: -// - clientCtx -func NewAccountQuerier(deps depinject.Config) (client.AccountQueryClient, error) { - aq := &accQuerier{} - - if err := depinject.Inject( - deps, - &aq.clientConn, - ); err != nil { - return nil, err - } - - aq.accountQuerier = accounttypes.NewQueryClient(aq.clientConn) - - return aq, nil -} - -// GetAccount returns an accounttypes.AccountI interface for a given address -func (aq *accQuerier) GetAccount( - ctx context.Context, - address string, -) (accounttypes.AccountI, error) { - req := &accounttypes.QueryAccountRequest{Address: address} - res, err := aq.accountQuerier.Account(ctx, req) - if err != nil { - return nil, ErrQueryAccountNotFound.Wrapf("address: %s [%v]", address, err) - } - var acc accounttypes.AccountI - if err = queryCodec.UnpackAny(res.Account, &acc); err != nil { - return nil, ErrQueryUnableToDeserializeAccount.Wrapf("address: %s [%v]", address, err) - } - return acc, nil -} diff --git a/pkg/client/query/appquerier.go b/pkg/client/query/appquerier.go deleted file mode 100644 index 310a25dfe..000000000 --- a/pkg/client/query/appquerier.go +++ /dev/null @@ -1,54 +0,0 @@ -package query - -import ( - "context" - - "cosmossdk.io/depinject" - grpc "github.com/cosmos/gogoproto/grpc" - - "github.com/pokt-network/poktroll/pkg/client" - apptypes "github.com/pokt-network/poktroll/x/application/types" -) - -var _ client.ApplicationQueryClient = (*appQuerier)(nil) - -// appQuerier is a wrapper around the apptypes.QueryClient that enables the -// querying of on-chain application information through a single exposed method -// which returns an apptypes.Application interface -type appQuerier struct { - clientConn grpc.ClientConn - applicationQuerier apptypes.QueryClient -} - -// NewApplicationQuerier returns a new instance of a client.ApplicationQueryClient -// by injecting the dependecies provided by the depinject.Config -// -// Required dependencies: -// - clientCtx -func NewApplicationQuerier(deps depinject.Config) (client.ApplicationQueryClient, error) { - aq := &appQuerier{} - - if err := depinject.Inject( - deps, - &aq.clientConn, - ); err != nil { - return nil, err - } - - aq.applicationQuerier = apptypes.NewQueryClient(aq.clientConn) - - return aq, nil -} - -// GetApplication returns an apptypes.Application interface for a given address -func (aq *appQuerier) GetApplication( - ctx context.Context, - appAddress string, -) (apptypes.Application, error) { - req := apptypes.QueryGetApplicationRequest{Address: appAddress} - res, err := aq.applicationQuerier.Application(ctx, &req) - if err != nil { - return apptypes.Application{}, apptypes.ErrAppNotFound.Wrapf("app address: %s [%v]", appAddress, err) - } - return res.Application, nil -} diff --git a/pkg/client/query/codec.go b/pkg/client/query/codec.go deleted file mode 100644 index 536df1484..000000000 --- a/pkg/client/query/codec.go +++ /dev/null @@ -1,20 +0,0 @@ -package query - -import ( - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - accounttypes "github.com/cosmos/cosmos-sdk/x/auth/types" -) - -// queryCodec is a codec used to unmarshal the account interface returned by the -// account querier into the concrete account interface implementation registered -// in the interface registry of the auth module -var queryCodec *codec.ProtoCodec - -func init() { - reg := codectypes.NewInterfaceRegistry() - accounttypes.RegisterInterfaces(reg) - cryptocodec.RegisterInterfaces(reg) - queryCodec = codec.NewProtoCodec(reg) -} diff --git a/pkg/client/query/errors.go b/pkg/client/query/errors.go deleted file mode 100644 index f395a9997..000000000 --- a/pkg/client/query/errors.go +++ /dev/null @@ -1,12 +0,0 @@ -package query - -import ( - sdkerrors "cosmossdk.io/errors" -) - -var ( - codespace = "query" - ErrQueryAccountNotFound = sdkerrors.Register(codespace, 1, "account not found") - ErrQueryUnableToDeserializeAccount = sdkerrors.Register(codespace, 2, "unable to deserialize account") - ErrQueryRetrieveSession = sdkerrors.Register(codespace, 3, "error while trying to retrieve a session") -) diff --git a/pkg/client/query/godoc.go b/pkg/client/query/godoc.go deleted file mode 100644 index 8cea857fd..000000000 --- a/pkg/client/query/godoc.go +++ /dev/null @@ -1,4 +0,0 @@ -// Package query provides interfaces used to query the state of the blockchain. -// These interfaces abstract the underlying request/response types and provide -// a single method to query for a specific piece of information from the chain. -package query diff --git a/pkg/client/query/sessionquerier.go b/pkg/client/query/sessionquerier.go deleted file mode 100644 index 6a86205fe..000000000 --- a/pkg/client/query/sessionquerier.go +++ /dev/null @@ -1,66 +0,0 @@ -package query - -import ( - "context" - - "cosmossdk.io/depinject" - grpc "github.com/cosmos/gogoproto/grpc" - - "github.com/pokt-network/poktroll/pkg/client" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -var _ client.SessionQueryClient = (*sessionQuerier)(nil) - -// sessionQuerier is a wrapper around the sessiontypes.QueryClient that enables the -// querying of on-chain session information through a single exposed method -// which returns an sessiontypes.Session struct -type sessionQuerier struct { - clientConn grpc.ClientConn - sessionQuerier sessiontypes.QueryClient -} - -// NewSessionQuerier returns a new instance of a client.SessionQueryClient by -// injecting the dependecies provided by the depinject.Config. -// -// Required dependencies: -// - clientCtx -func NewSessionQuerier(deps depinject.Config) (client.SessionQueryClient, error) { - sessq := &sessionQuerier{} - - if err := depinject.Inject( - deps, - &sessq.clientConn, - ); err != nil { - return nil, err - } - - sessq.sessionQuerier = sessiontypes.NewQueryClient(sessq.clientConn) - - return sessq, nil -} - -// GetSession returns an sessiontypes.Session struct for a given appAddress, -// serviceId and blockHeight. It implements the SessionQueryClient#GetSession function. -func (sessq *sessionQuerier) GetSession( - ctx context.Context, - appAddress string, - serviceId string, - blockHeight int64, -) (*sessiontypes.Session, error) { - service := &sharedtypes.Service{Id: serviceId} - req := &sessiontypes.QueryGetSessionRequest{ - ApplicationAddress: appAddress, - Service: service, - BlockHeight: blockHeight, - } - res, err := sessq.sessionQuerier.GetSession(ctx, req) - if err != nil { - return nil, ErrQueryRetrieveSession.Wrapf( - "address: %s; serviceId: %s; block height: %d; error: [%v]", - appAddress, serviceId, blockHeight, err, - ) - } - return res.Session, nil -} diff --git a/pkg/client/query/supplierquerier.go b/pkg/client/query/supplierquerier.go deleted file mode 100644 index c622ad9e5..000000000 --- a/pkg/client/query/supplierquerier.go +++ /dev/null @@ -1,56 +0,0 @@ -package query - -import ( - "context" - - "cosmossdk.io/depinject" - "github.com/cosmos/gogoproto/grpc" - - "github.com/pokt-network/poktroll/pkg/client" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" -) - -// supplierQuerier is a wrapper around the suppliertypes.QueryClient that enables the -// querying of on-chain supplier information through a single exposed method -// which returns an sharedtypes.Supplier struct -type supplierQuerier struct { - clientConn grpc.ClientConn - supplierQuerier suppliertypes.QueryClient -} - -// NewSupplierQuerier returns a new instance of a client.SupplierQueryClient by -// injecting the dependecies provided by the depinject.Config. -// -// Required dependencies: -// - grpc.ClientConn -func NewSupplierQuerier(deps depinject.Config) (client.SupplierQueryClient, error) { - supq := &supplierQuerier{} - - if err := depinject.Inject( - deps, - &supq.clientConn, - ); err != nil { - return nil, err - } - - supq.supplierQuerier = suppliertypes.NewQueryClient(supq.clientConn) - - return supq, nil -} - -// GetSupplier returns an suppliertypes.Supplier struct for a given address -func (supq *supplierQuerier) GetSupplier( - ctx context.Context, - address string, -) (sharedtypes.Supplier, error) { - req := &suppliertypes.QueryGetSupplierRequest{Address: address} - res, err := supq.supplierQuerier.Supplier(ctx, req) - if err != nil { - return sharedtypes.Supplier{}, suppliertypes.ErrSupplierNotFound.Wrapf( - "address: %s [%v]", - address, err, - ) - } - return res.Supplier, nil -} diff --git a/pkg/client/query/types/context.go b/pkg/client/query/types/context.go deleted file mode 100644 index d0f56fe6f..000000000 --- a/pkg/client/query/types/context.go +++ /dev/null @@ -1,12 +0,0 @@ -package types - -import ( - cosmosclient "github.com/cosmos/cosmos-sdk/client" -) - -// Context is used to distinguish a cosmosclient.Context intended for use in -// queries from others. This is because the same cosmosclient.Context can be -// used for both queries and transactions (as they are generated identically). -// This type is intentionally not an alias in order to make this distinction -// clear to the dependency injector (i.e. querytypes.Context). -type Context cosmosclient.Context diff --git a/pkg/client/services.go b/pkg/client/services.go deleted file mode 100644 index 08fbaee03..000000000 --- a/pkg/client/services.go +++ /dev/null @@ -1,19 +0,0 @@ -package client - -import ( - "fmt" - - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// NewTestApplicationServiceConfig returns a slice of application service configs for testing. -func NewTestApplicationServiceConfig(prefix string, count int) []*sharedtypes.ApplicationServiceConfig { - appSvcCfg := make([]*sharedtypes.ApplicationServiceConfig, count) - for i := range appSvcCfg { - serviceId := fmt.Sprintf("%s%d", prefix, i) - appSvcCfg[i] = &sharedtypes.ApplicationServiceConfig{ - Service: &sharedtypes.Service{Id: serviceId}, - } - } - return appSvcCfg -} diff --git a/pkg/client/supplier/client.go b/pkg/client/supplier/client.go deleted file mode 100644 index 4bf4c0554..000000000 --- a/pkg/client/supplier/client.go +++ /dev/null @@ -1,151 +0,0 @@ -package supplier - -import ( - "context" - - "cosmossdk.io/depinject" - cosmostypes "github.com/cosmos/cosmos-sdk/types" - "github.com/pokt-network/smt" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/keyring" - "github.com/pokt-network/poktroll/pkg/polylog" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" -) - -var _ client.SupplierClient = (*supplierClient)(nil) - -// supplierClient -type supplierClient struct { - signingKeyName string - signingKeyAddr cosmostypes.AccAddress - - txClient client.TxClient - txCtx client.TxContext -} - -// NewSupplierClient constructs a new SupplierClient with the given dependencies -// and options. If a signingKeyName is not configured, an error will be returned. -// -// Required dependencies: -// - client.TxClient -// - client.TxContext -// -// Available options: -// - WithSigningKeyName -func NewSupplierClient( - deps depinject.Config, - opts ...client.SupplierClientOption, -) (*supplierClient, error) { - sClient := &supplierClient{} - - if err := depinject.Inject( - deps, - &sClient.txClient, - &sClient.txCtx, - ); err != nil { - return nil, err - } - - for _, opt := range opts { - opt(sClient) - } - - if err := sClient.validateConfigAndSetDefaults(); err != nil { - return nil, err - } - - return sClient, nil -} - -// SubmitProof constructs a submit proof message then signs and broadcasts it -// to the network via #txClient. It blocks until the transaction is included in -// a block or times out. -func (sClient *supplierClient) SubmitProof( - ctx context.Context, - sessionHeader sessiontypes.SessionHeader, - proof *smt.SparseMerkleClosestProof, -) error { - logger := polylog.Ctx(ctx) - - proofBz, err := proof.Marshal() - if err != nil { - return err - } - - msg := &suppliertypes.MsgSubmitProof{ - SupplierAddress: sClient.signingKeyAddr.String(), - SessionHeader: &sessionHeader, - Proof: proofBz, - } - eitherErr := sClient.txClient.SignAndBroadcast(ctx, msg) - err, errCh := eitherErr.SyncOrAsyncError() - if err != nil { - return err - } - - // TODO_IMPROVE: log details related to what & how much is being proven - logger.Info(). - Fields(map[string]any{ - "supplier_addr": sClient.signingKeyAddr.String(), - "app_addr": sessionHeader.ApplicationAddress, - "session_id": sessionHeader.SessionId, - "service": sessionHeader.Service.Id, - }). - Msg("submitted a new proof") - - return <-errCh -} - -// CreateClaim constructs a creates claim message then signs and broadcasts it -// to the network via #txClient. It blocks until the transaction is included in -// a block or times out. -func (sClient *supplierClient) CreateClaim( - ctx context.Context, - sessionHeader sessiontypes.SessionHeader, - rootHash []byte, -) error { - logger := polylog.Ctx(ctx) - - msg := &suppliertypes.MsgCreateClaim{ - SupplierAddress: sClient.signingKeyAddr.String(), - SessionHeader: &sessionHeader, - RootHash: rootHash, - } - eitherErr := sClient.txClient.SignAndBroadcast(ctx, msg) - err, errCh := eitherErr.SyncOrAsyncError() - if err != nil { - return err - } - - // TODO_IMPROVE: log details related to how much is claimed - logger.Info(). - Fields(map[string]any{ - "supplier_addr": sClient.signingKeyAddr.String(), - "app_addr": sessionHeader.ApplicationAddress, - "session_id": sessionHeader.SessionId, - "service": sessionHeader.Service.Id, - }). - Msg("created a new claim") - - return <-errCh -} - -// validateConfigAndSetDefaults attempts to get the address from the keyring -// corresponding to the key whose name matches the configured signingKeyName. -// If signingKeyName is empty or the keyring does not contain the corresponding -// key, an error is returned. -func (sClient *supplierClient) validateConfigAndSetDefaults() error { - signingAddr, err := keyring.KeyNameToAddr( - sClient.signingKeyName, - sClient.txCtx.GetKeyring(), - ) - if err != nil { - return err - } - - sClient.signingKeyAddr = signingAddr - - return nil -} diff --git a/pkg/client/supplier/client_integration_test.go b/pkg/client/supplier/client_integration_test.go deleted file mode 100644 index f7ea11f56..000000000 --- a/pkg/client/supplier/client_integration_test.go +++ /dev/null @@ -1,36 +0,0 @@ -//go:build integration - -package supplier_test - -import ( - "context" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/testclient/testsupplier" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" -) - -func TestNewSupplierClient_Localnet(t *testing.T) { - t.Skip("TODO_TECHDEBT: this test depends on some setup which is currently not implemented in this test: staked application and servicer with matching services") - - var ( - signingKeyName = "app1" - ctx = context.Background() - ) - - supplierClient := testsupplier.NewLocalnetClient(t, signingKeyName) - require.NotNil(t, supplierClient) - - var rootHash []byte - sessionHeader := sessiontypes.SessionHeader{ - ApplicationAddress: "", - SessionStartBlockHeight: 0, - SessionId: "", - } - err := supplierClient.CreateClaim(ctx, sessionHeader, rootHash) - require.NoError(t, err) - - require.True(t, false) -} diff --git a/pkg/client/supplier/client_test.go b/pkg/client/supplier/client_test.go deleted file mode 100644 index b40fc3430..000000000 --- a/pkg/client/supplier/client_test.go +++ /dev/null @@ -1,201 +0,0 @@ -package supplier_test - -import ( - "context" - "crypto/sha256" - "testing" - "time" - - "cosmossdk.io/depinject" - "github.com/golang/mock/gomock" - "github.com/pokt-network/smt" - "github.com/pokt-network/smt/kvstore/badger" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client/keyring" - "github.com/pokt-network/poktroll/pkg/client/supplier" - "github.com/pokt-network/poktroll/testutil/mockclient" - "github.com/pokt-network/poktroll/testutil/testclient/testkeyring" - "github.com/pokt-network/poktroll/testutil/testclient/testtx" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -const ( - testSigningKeyName = "test_signer" - testService = "test_service" -) - -func TestNewSupplierClient(t *testing.T) { - ctrl := gomock.NewController(t) - - memKeyring, _ := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) - txCtxMock, _ := testtx.NewAnyTimesTxTxContext(t, memKeyring) - txClientMock := mockclient.NewMockTxClient(ctrl) - - deps := depinject.Supply( - txCtxMock, - txClientMock, - ) - - tests := []struct { - name string - signingKeyName string - expectedErr error - }{ - { - name: "valid signing key name", - signingKeyName: testSigningKeyName, - expectedErr: nil, - }, - { - name: "empty signing key name", - signingKeyName: "", - expectedErr: keyring.ErrEmptySigningKeyName, - }, - { - name: "no such signing key name", - signingKeyName: "nonexistent", - expectedErr: keyring.ErrNoSuchSigningKey, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - signingKeyOpt := supplier.WithSigningKeyName(tt.signingKeyName) - - supplierClient, err := supplier.NewSupplierClient(deps, signingKeyOpt) - if tt.expectedErr != nil { - require.ErrorIs(t, err, tt.expectedErr) - require.Nil(t, supplierClient) - } else { - require.NoError(t, err) - require.NotNil(t, supplierClient) - } - }) - } -} - -func TestSupplierClient_CreateClaim(t *testing.T) { - var ( - signAndBroadcastDelay = 50 * time.Millisecond - doneCh = make(chan struct{}, 1) - ctx = context.Background() - ) - - keyring, testAppKey := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) - - testAppAddr, err := testAppKey.GetAddress() - require.NoError(t, err) - - txCtxMock, _ := testtx.NewAnyTimesTxTxContext(t, keyring) - txClientMock := testtx.NewOneTimeDelayedSignAndBroadcastTxClient(t, ctx, signAndBroadcastDelay) - - signingKeyOpt := supplier.WithSigningKeyName(testAppKey.Name) - deps := depinject.Supply( - txCtxMock, - txClientMock, - ) - - supplierClient, err := supplier.NewSupplierClient(deps, signingKeyOpt) - require.NoError(t, err) - require.NotNil(t, supplierClient) - - var rootHash []byte - sessionHeader := sessiontypes.SessionHeader{ - ApplicationAddress: testAppAddr.String(), - SessionStartBlockHeight: 0, - SessionId: "", - Service: &sharedtypes.Service{ - Id: testService, - }, - } - - go func() { - err = supplierClient.CreateClaim(ctx, sessionHeader, rootHash) - require.NoError(t, err) - close(doneCh) - }() - - // TODO_IMPROVE: this could be rewritten to record the times at which - // things happen and then compare them to the expected times. - - select { - case <-doneCh: - t.Fatal("expected CreateClaim to block for signAndBroadcastDelay") - case <-time.After(signAndBroadcastDelay * 95 / 100): - t.Log("OK: CreateClaim blocked for at least 95% of signAndBroadcastDelay") - } - - select { - case <-time.After(signAndBroadcastDelay): - t.Fatal("expected CreateClaim to unblock after signAndBroadcastDelay") - case <-doneCh: - t.Log("OK: CreateClaim unblocked after signAndBroadcastDelay") - } -} - -func TestSupplierClient_SubmitProof(t *testing.T) { - var ( - signAndBroadcastDelay = 50 * time.Millisecond - doneCh = make(chan struct{}, 1) - ctx = context.Background() - ) - - keyring, testAppKey := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) - - testAppAddr, err := testAppKey.GetAddress() - require.NoError(t, err) - - txCtxMock, _ := testtx.NewAnyTimesTxTxContext(t, keyring) - txClientMock := testtx.NewOneTimeDelayedSignAndBroadcastTxClient(t, ctx, signAndBroadcastDelay) - - signingKeyOpt := supplier.WithSigningKeyName(testAppKey.Name) - deps := depinject.Supply( - txCtxMock, - txClientMock, - ) - - supplierClient, err := supplier.NewSupplierClient(deps, signingKeyOpt) - require.NoError(t, err) - require.NotNil(t, supplierClient) - - sessionHeader := sessiontypes.SessionHeader{ - ApplicationAddress: testAppAddr.String(), - SessionStartBlockHeight: 0, - SessionId: "", - Service: &sharedtypes.Service{ - Id: testService, - }, - } - - kvStore, err := badger.NewKVStore("") - require.NoError(t, err) - - tree := smt.NewSparseMerkleSumTrie(kvStore, sha256.New()) - proof, err := tree.ProveClosest([]byte{1}) - require.NoError(t, err) - - go func() { - err = supplierClient.SubmitProof(ctx, sessionHeader, proof) - require.NoError(t, err) - close(doneCh) - }() - - // TODO_IMPROVE: this could be rewritten to record the times at which - // things happen and then compare them to the expected times. - - select { - case <-doneCh: - t.Fatal("expected SubmitProof to block for signAndBroadcastDelay") - case <-time.After(signAndBroadcastDelay * 95 / 100): - t.Log("OK: SubmitProof blocked for at least 95% of signAndBroadcastDelay") - } - - select { - case <-time.After(signAndBroadcastDelay): - t.Fatal("expected SubmitProof to unblock after signAndBroadcastDelay") - case <-doneCh: - t.Log("OK: SubmitProof unblocked after signAndBroadcastDelay") - } -} diff --git a/pkg/client/supplier/options.go b/pkg/client/supplier/options.go deleted file mode 100644 index f4460c8c9..000000000 --- a/pkg/client/supplier/options.go +++ /dev/null @@ -1,14 +0,0 @@ -package supplier - -import ( - "github.com/pokt-network/poktroll/pkg/client" -) - -// WithSigningKeyName sets the name of the key which the supplier client should -// retrieve from the keyring to use for authoring and signing CreateClaim and -// SubmitProof messages. -func WithSigningKeyName(keyName string) client.SupplierClientOption { - return func(sClient client.SupplierClient) { - sClient.(*supplierClient).signingKeyName = keyName - } -} diff --git a/pkg/client/tx/client.go b/pkg/client/tx/client.go deleted file mode 100644 index 2149f383d..000000000 --- a/pkg/client/tx/client.go +++ /dev/null @@ -1,506 +0,0 @@ -package tx - -import ( - "bytes" - "context" - "encoding/hex" - "encoding/json" - "fmt" - "sync" - - "cosmossdk.io/api/tendermint/abci" - "cosmossdk.io/depinject" - comettypes "github.com/cometbft/cometbft/types" - cosmostypes "github.com/cosmos/cosmos-sdk/types" - "go.uber.org/multierr" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/events" - "github.com/pokt-network/poktroll/pkg/client/keyring" - "github.com/pokt-network/poktroll/pkg/either" -) - -const ( - // DefaultCommitTimeoutHeightOffset is the default number of blocks after the - // latest block (when broadcasting) that a transactions should be considered - // errored if it has not been committed. - DefaultCommitTimeoutHeightOffset = 5 - - // defaultTxReplayLimit is the number of abci.TxResult events that the replay - // observable returned by LastNBlocks() will be able to replay. - // TODO_TECHDEBT/TODO_FUTURE: add a `blocksReplayLimit` field to the blockClient - // struct that defaults to this but can be overridden via an option. - defaultTxReplayLimit = 100 - - // txWithSenderAddrQueryFmt is the query used to subscribe to cometbft transactions - // events where the sender address matches the interpolated address. - // (see: https://docs.cosmos.network/v0.47/core/events#subscribing-to-events) - txWithSenderAddrQueryFmt = "tm.event='Tx' AND message.sender='%s'" -) - -// TODO_TECHDEBT(@bryanchriswhite/@h5law): Refactor this to use the EventsReplayClient -// In order to simplify the logic of the TxClient -var _ client.TxClient = (*txClient)(nil) - -// txClient orchestrates building, signing, broadcasting, and querying of -// transactions. It maintains a single events query subscription to its own -// transactions (via the EventsQueryClient) in order to receive notifications -// regarding their status. -// It also depends on the BlockClient as a timer, synchronized to block height, -// to facilitate transaction timeout logic. If a transaction doesn't appear to -// have been committed by commitTimeoutHeightOffset number of blocks have elapsed, -// it is considered as timed out. Upon timeout, the client queries the network for -// the last status of the transaction, which is used to derive the asynchronous -// error that's populated in the either.AsyncError. -type txClient struct { - // TODO_TECHDEBT: this should be configurable & integrated w/ viper, flags, etc. - // commitTimeoutHeightOffset is the number of blocks after the latest block - // that a transactions should be considered errored if it has not been committed. - commitTimeoutHeightOffset int64 - // signingKeyName is the name of the key in the keyring to use for signing - // transactions. - signingKeyName string - // signingAddr is the address of the signing key referenced by signingKeyName. - // It is hydrated from the keyring by calling Keyring#Key() with signingKeyName. - signingAddr cosmostypes.AccAddress - // txCtx is the transactions context which encapsulates transactions building, signing, - // broadcasting, and querying, as well as keyring access. - txCtx client.TxContext - // eventsReplayClient is the client used to subscribe to transactions events from this - // sender. It is used to receive notifications about transactions events corresponding - // to transactions which it has constructed, signed, and broadcast. - eventsReplayClient client.EventsReplayClient[*abci.TxResult] - // blockClient is the client used to query for the latest block height. - // It is used to implement timout logic for transactions which weren't committed. - blockClient client.BlockClient - - // txsMutex protects txErrorChans and txTimeoutPool maps. - txsMutex sync.Mutex - // txErrorChans maps tx_hash->channel which will receive an error or nil, - // and close, when the transactions with the given hash is committed. - txErrorChans txErrorChansByHash - // txTimeoutPool maps timeout_block_height->map_of_txsByHash. It - // is used to ensure that transactions error channels receive and close in the event - // that they have not already by the given timeout height. - txTimeoutPool txTimeoutPool -} - -type ( - txTimeoutPool map[height]txErrorChansByHash - txErrorChansByHash map[txHash]chan error - height = int64 - txHash = string -) - -// NewTxClient attempts to construct a new TxClient using the given dependencies -// and options. -// -// It performs the following steps: -// 1. Initializes a default txClient with the default commit timeout height -// offset, an empty error channel map, and an empty transaction timeout pool. -// 2. Injects the necessary dependencies using depinject. -// 3. Applies any provided options to customize the client. -// 4. Validates and sets any missing default configurations using the -// validateConfigAndSetDefaults method. -// 5. Subscribes the client to its own transactions. This step might be -// reconsidered for relocation to a potential Start() method in the future. -// -// Required dependencies: -// - client.TxContext -// - client.EventsQueryClient -// - client.BlockClient -// -// Available options: -// - WithSigningKeyName -// - WithCommitTimeoutHeightOffset -func NewTxClient( - ctx context.Context, - deps depinject.Config, - opts ...client.TxClientOption, -) (_ client.TxClient, err error) { - tClient := &txClient{ - commitTimeoutHeightOffset: DefaultCommitTimeoutHeightOffset, - txErrorChans: make(txErrorChansByHash), - txTimeoutPool: make(txTimeoutPool), - } - - if err = depinject.Inject( - deps, - &tClient.txCtx, - &tClient.blockClient, - ); err != nil { - return nil, err - } - - for _, opt := range opts { - opt(tClient) - } - - if err := tClient.validateConfigAndSetDefaults(); err != nil { - return nil, err - } - - // Form a query based on the client's signing address. - eventQuery := fmt.Sprintf(txWithSenderAddrQueryFmt, tClient.signingAddr) - - // Initialize and events replay client. - tClient.eventsReplayClient, err = events.NewEventsReplayClient[*abci.TxResult]( - ctx, - deps, - eventQuery, - unmarshalTxResult, - defaultTxReplayLimit, - ) - if err != nil { - return nil, err - } - - // Start an events query subscription for transactions originating from this - // client's signing address. - // TODO_CONSIDERATION: move this into a #Start() method - go tClient.goSubscribeToOwnTxs(ctx) - - // Launch a separate goroutine to handle transaction timeouts. - // TODO_CONSIDERATION: move this into a #Start() method - go tClient.goTimeoutPendingTransactions(ctx) - - return tClient, nil -} - -// SignAndBroadcast signs a set of Cosmos SDK messages, constructs a transaction, -// and broadcasts it to the network. The function performs several steps to -// ensure the messages and the resultant transaction are valid: -// -// 1. Validates each message in the provided set. -// 2. Constructs the transaction using the Cosmos SDK's transaction builder. -// 3. Calculates and sets the transaction's timeout height. -// 4. Sets a default gas limit (note: this will be made configurable in the future). -// 5. Signs the transaction. -// 6. Validates the constructed transaction. -// 7. Serializes and broadcasts the transaction. -// 8. Checks the broadcast response for errors. -// 9. If all the above steps are successful, the function registers the -// transaction as pending. -// -// If any step encounters an error, it returns an either.AsyncError populated with -// the synchronous error. If the function completes successfully, it returns an -// either.AsyncError populated with the error channel which will receive if the -// transaction results in an asynchronous error or times out. -func (tClient *txClient) SignAndBroadcast( - ctx context.Context, - msgs ...cosmostypes.Msg, -) either.AsyncError { - var validationErrs error - for i, msg := range msgs { - if err := msg.ValidateBasic(); err != nil { - validationErr := ErrInvalidMsg.Wrapf("in msg with index %d: %s", i, err) - validationErrs = multierr.Append(validationErrs, validationErr) - } - } - if validationErrs != nil { - return either.SyncErr(validationErrs) - } - - // Construct the transactions using cosmos' transactions builder. - txBuilder := tClient.txCtx.NewTxBuilder() - if err := txBuilder.SetMsgs(msgs...); err != nil { - // return synchronous error - return either.SyncErr(err) - } - - // Calculate timeout height - timeoutHeight := tClient.blockClient.LastNBlocks(ctx, 1)[0]. - Height() + tClient.commitTimeoutHeightOffset - - // TODO_TECHDEBT: this should be configurable - txBuilder.SetGasLimit(200000) - txBuilder.SetTimeoutHeight(uint64(timeoutHeight)) - - // sign transactions - err := tClient.txCtx.SignTx( - tClient.signingKeyName, - txBuilder, - false, false, - ) - if err != nil { - return either.SyncErr(err) - } - - // ensure transactions is valid - // NOTE: this makes the transactions valid; i.e. it is *REQUIRED* - if err := txBuilder.GetTx().ValidateBasic(); err != nil { - return either.SyncErr(err) - } - - // serialize transactions - txBz, err := tClient.txCtx.EncodeTx(txBuilder) - if err != nil { - return either.SyncErr(err) - } - - txResponse, err := tClient.txCtx.BroadcastTx(txBz) - if err != nil { - return either.SyncErr(err) - } - - if txResponse.Code != 0 { - return either.SyncErr(ErrCheckTx.Wrapf(txResponse.RawLog)) - } - - return tClient.addPendingTransactions(normalizeTxHashHex(txResponse.TxHash), timeoutHeight) -} - -// validateConfigAndSetDefaults ensures that the necessary configurations for the -// txClient are set, and populates any missing defaults. -// -// 1. It checks if the signing key name is set and returns an error if it's empty. -// 2. It then retrieves the key record from the keyring using the signing key name -// and checks its existence. -// 3. The address of the signing key is computed and assigned to txClient#signgingAddr. -// 4. Lastly, it ensures that commitTimeoutHeightOffset has a valid value, setting -// it to DefaultCommitTimeoutHeightOffset if it's zero or negative. -// -// Returns: -// - ErrEmptySigningKeyName if the signing key name is not provided. -// - ErrNoSuchSigningKey if the signing key is not found in the keyring. -// - ErrSigningKeyAddr if there's an issue retrieving the address for the signing key. -// - nil if validation is successful and defaults are set appropriately. -func (tClient *txClient) validateConfigAndSetDefaults() error { - signingAddr, err := keyring.KeyNameToAddr( - tClient.signingKeyName, - tClient.txCtx.GetKeyring(), - ) - if err != nil { - return err - } - - tClient.signingAddr = signingAddr - - if tClient.commitTimeoutHeightOffset <= 0 { - tClient.commitTimeoutHeightOffset = DefaultCommitTimeoutHeightOffset - } - return nil -} - -// addPendingTransactions registers a new pending transaction for monitoring and -// notification of asynchronous errors. It accomplishes the following: -// -// 1. Creates an error notification channel (if one doesn't already exist) and associates -// it with the provided transaction hash in the txErrorChans map. -// -// 2. Ensures that there's an initialized map of transactions by hash for the -// given timeout height in the txTimeoutPool. The same error notification channel -// is also associated with the transaction hash in this map. -// -// Both txErrorChans and txTimeoutPool store references to the same error notification -// channel for a given transaction hash. This ensures idempotency of error handling -// for any given transaction between asynchronous, transaction-specific errors and -// transaction timeout logic. -// -// Note: The error channels are buffered to prevent blocking on send operations and -// are intended to convey a single error event. -// -// Returns: -// - An either.AsyncError populated with the error notification channel for the -// provided transaction hash. -func (tClient *txClient) addPendingTransactions( - txHash string, - timeoutHeight int64, -) either.AsyncError { - tClient.txsMutex.Lock() - defer tClient.txsMutex.Unlock() - - // Initialize txTimeoutPool map if necessary. - txsByHash, ok := tClient.txTimeoutPool[timeoutHeight] - if !ok { - txsByHash = make(map[string]chan error) - tClient.txTimeoutPool[timeoutHeight] = txsByHash - } - - // Initialize txErrorChans map in txTimeoutPool map if necessary. - errCh, ok := txsByHash[txHash] - if !ok { - // NB: intentionally buffered to avoid blocking on send. Only intended - // to send/receive a single error. - errCh = make(chan error, 1) - txsByHash[txHash] = errCh - } - - // Initialize txErrorChans map if necessary. - if _, ok := tClient.txErrorChans[txHash]; !ok { - // NB: both maps hold a reference to the same channel so that we can check - // if the channel has already been closed when timing out. - tClient.txErrorChans[txHash] = errCh - } - - return either.AsyncErr(errCh) -} - -// goSubscribeToOwnTxs establishes an event query subscription to monitor transactions -// originating from this client's signing address, ranges over observed transaction events, -// and performs the following steps on each: -// -// 1. Normalize hexadeimal transaction hash. -// 2. Retrieves the transaction's error channel from txErrorChans. -// 3. Closes and removes it from txErrorChans. -// 4. Removes the transaction error channel from txTimeoutPool. -// -// It is intended to be called in a goroutine. -// -// Important considerations: -// There's uncertainty surrounding the potential for asynchronous errors post transaction broadcast. -// Current implementation and observations suggest that errors might be returned synchronously, -// even when using Cosmos' BroadcastTxAsync method. Further investigation is required. -// -// Parameters: -// - ctx: Context for managing the function's lifecycle and child operations. -func (tClient *txClient) goSubscribeToOwnTxs(ctx context.Context) { - txResultsObs := tClient.eventsReplayClient.EventsSequence(ctx) - txResultsCh := txResultsObs.Subscribe(ctx).Ch() - for txResult := range txResultsCh { - // Convert transaction hash into its normalized hex form. - txHashHex := txHashBytesToNormalizedHex(comettypes.Tx(txResult.Tx).Hash()) - - tClient.txsMutex.Lock() - - // Check for a corresponding error channel in the map. - txErrCh, ok := tClient.txErrorChans[txHashHex] - if !ok { - panic("Received tx event without an associated error channel.") - } - - // TODO_INVESTIGATE: it seems like it may not be possible for the - // txResult to represent an error. Cosmos' #BroadcastTxSync() is being - // called internally, which will return an error if the transaction - // is not accepted by the mempool. - // - // It's unclear if a cosmos chain is capable of returning an async - // error for a transaction at this point; even when substituting - // #BroadcastTxAsync(), the error is returned synchronously: - // - // > error in json rpc client, with http response metadata: (Status: - // > 200 OK, Protocol HTTP/1.1). RPC error -32000 - tx added to local - // > mempool but failed to gossip: validation failed - // - // Potential parse and send transaction error on txErrCh here. - - // Close and remove from txErrChans - close(txErrCh) - delete(tClient.txErrorChans, txHashHex) - - // Remove from the txTimeoutPool. - for timeoutHeight, txErrorChans := range tClient.txTimeoutPool { - // Handled transaction isn't in this timeout height. - if _, ok := txErrorChans[txHashHex]; !ok { - continue - } - - delete(txErrorChans, txHashHex) - if len(txErrorChans) == 0 { - delete(tClient.txTimeoutPool, timeoutHeight) - } - } - - tClient.txsMutex.Unlock() - } -} - -// goTimeoutPendingTransactions monitors blocks and handles transaction timeouts. -// For each block observed, it checks if there are transactions associated with that -// block's height in the txTimeoutPool. If transactions are found, the function -// evaluates whether they have already been processed by the transaction events -// query subscription logic. If not, a timeout error is generated and sent on the -// transaction's error channel. Finally, the error channel is closed and removed -// from the txTimeoutPool. -func (tClient *txClient) goTimeoutPendingTransactions(ctx context.Context) { - // Subscribe to a sequence of committed blocks. - blockCh := tClient.blockClient.CommittedBlocksSequence(ctx).Subscribe(ctx).Ch() - - // Iterate over each incoming block. - for block := range blockCh { - select { - case <-ctx.Done(): - // Exit if the context signals done. - return - default: - } - - tClient.txsMutex.Lock() - - // Retrieve transactions associated with the current block's height. - txsByHash, ok := tClient.txTimeoutPool[block.Height()] - if !ok { - // If no transactions are found for the current block height, continue. - tClient.txsMutex.Unlock() - continue - } - - // Process each transaction for the current block height. - for txHash, txErrCh := range txsByHash { - select { - // Check if the transaction was processed by its subscription. - case err, ok := <-txErrCh: - if ok { - // Unexpected state: error channel should be closed after processing. - panic(fmt.Errorf("Expected txErrCh to be closed; received err: %w", err)) - } - // Remove the processed transaction. - delete(txsByHash, txHash) - tClient.txsMutex.Unlock() - continue - default: - } - - // Transaction was not processed by its subscription: handle timeout. - txErrCh <- tClient.getTxTimeoutError(ctx, txHash) // Send a timeout error. - close(txErrCh) // Close the error channel. - delete(txsByHash, txHash) // Remove the transaction. - } - - // Clean up the txTimeoutPool for the current block height. - delete(tClient.txTimeoutPool, block.Height()) - tClient.txsMutex.Unlock() - } -} - -// getTxTimeoutError checks if a transaction with the specified hash has timed out. -// The function decodes the provided hexadecimal hash into bytes and queries the -// transaction using the byte hash. If any error occurs during this process, -// appropriate wrapped errors are returned for easier debugging. -func (tClient *txClient) getTxTimeoutError(ctx context.Context, txHashHex string) error { - // Decode the provided hex hash into bytes. - txHash, err := hex.DecodeString(txHashHex) - if err != nil { - return ErrInvalidTxHash.Wrapf("%s", txHashHex) - } - - // Query the transaction using the decoded byte hash. - txResponse, err := tClient.txCtx.QueryTx(ctx, txHash, false) - if err != nil { - return ErrQueryTx.Wrapf("with hash: %s: %s", txHashHex, err) - } - - // Return a timeout error with details about the transaction. - return ErrTxTimeout.Wrapf("with hash %s: %s", txHashHex, txResponse.TxResult.Log) -} - -// unmarshalTxResult attempts to deserialize a slice of bytes into a TxResult -// It checks if the given bytes correspond to a valid transaction event. -// If the resulting TxResult has empty transaction bytes, it assumes that -// the message was not a transaction results and returns an error. -func unmarshalTxResult(txResultBz []byte) (*abci.TxResult, error) { - txResult := new(abci.TxResult) - - // Try to deserialize the provided bytes into a TxResult. - if err := json.Unmarshal(txResultBz, txResult); err != nil { - return nil, events.ErrEventsUnmarshalEvent.Wrap(err.Error()) - } - - // Check if the TxResult has empty transaction bytes, which indicates - // the message might not be a valid transaction event. - if bytes.Equal(txResult.Tx, []byte{}) { - return nil, events.ErrEventsUnmarshalEvent.Wrap("event bytes do not correspond to an abci.TxResult event") - } - - return txResult, nil -} diff --git a/pkg/client/tx/client_integration_test.go b/pkg/client/tx/client_integration_test.go deleted file mode 100644 index 67d4b71ef..000000000 --- a/pkg/client/tx/client_integration_test.go +++ /dev/null @@ -1,67 +0,0 @@ -//go:build integration - -package tx_test - -import ( - "context" - "testing" - - "cosmossdk.io/depinject" - "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/tx" - "github.com/pokt-network/poktroll/testutil/testclient/testblock" - "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" - "github.com/pokt-network/poktroll/testutil/testclient/testkeyring" - "github.com/pokt-network/poktroll/testutil/testclient/testtx" - apptypes "github.com/pokt-network/poktroll/x/application/types" -) - -func TestTxClient_SignAndBroadcast_Integration(t *testing.T) { - t.Skip( - "TODO_TECHDEBT: this test depends on some setup which is currently not implemented in this test: staked application and servicer with matching services", - ) - - ctx := context.Background() - - keyring, signingKey := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) - - eventsQueryClient := testeventsquery.NewLocalnetClient(t) - - _, txCtx := testtx.NewAnyTimesTxTxContext(t, keyring) - - // Construct a new mock block client because it is a required dependency. Since - // we're not exercising transactions timeouts in this test, we don't need to set any - // particular expectations on it, nor do we care about the value of blockHash - // argument. - blockClientMock := testblock.NewLocalnetClient(ctx, t) - - // Construct a new depinject config with the mocks we created above. - txClientDeps := depinject.Supply( - eventsQueryClient, - txCtx, - blockClientMock, - ) - - // Construct the transaction client. - txClient, err := tx.NewTxClient(ctx, txClientDeps, tx.WithSigningKeyName(testSigningKeyName)) - require.NoError(t, err) - - signingKeyAddr, err := signingKey.GetAddress() - require.NoError(t, err) - - // Construct a valid (arbitrary) message to sign, encode, and broadcast. - appStake := types.NewCoin("upokt", types.NewInt(1000000)) - appStakeMsg := &apptypes.MsgStakeApplication{ - Address: signingKeyAddr.String(), - Stake: &appStake, - Services: client.NewTestApplicationServiceConfig(testServiceIdPrefix, 2), - } - - // Sign and broadcast the message. - eitherErr := txClient.SignAndBroadcast(ctx, appStakeMsg) - err, _ = eitherErr.SyncOrAsyncError() - require.NoError(t, err) -} diff --git a/pkg/client/tx/client_test.go b/pkg/client/tx/client_test.go deleted file mode 100644 index 4de1b2f9a..000000000 --- a/pkg/client/tx/client_test.go +++ /dev/null @@ -1,423 +0,0 @@ -package tx_test - -import ( - "context" - "encoding/json" - "sync" - "testing" - "time" - - "cosmossdk.io/depinject" - abci "github.com/cometbft/cometbft/abci/types" - cometbytes "github.com/cometbft/cometbft/libs/bytes" - cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/keyring" - "github.com/pokt-network/poktroll/pkg/client/tx" - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/testutil/mockclient" - "github.com/pokt-network/poktroll/testutil/testclient" - "github.com/pokt-network/poktroll/testutil/testclient/testblock" - "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" - "github.com/pokt-network/poktroll/testutil/testclient/testkeyring" - "github.com/pokt-network/poktroll/testutil/testclient/testtx" - apptypes "github.com/pokt-network/poktroll/x/application/types" -) - -const ( - testSigningKeyName = "test_signer" - // NB: testServiceIdPrefix must not be longer than 7 characters due to - // maxServiceIdLen. - testServiceIdPrefix = "testsvc" - txCommitTimeout = 10 * time.Millisecond -) - -// TODO_TECHDEBT: add coverage for the transactions client handling an events bytes error either. - -func TestTxClient_SignAndBroadcast_Succeeds(t *testing.T) { - var ( - // expectedTx is the expected transactions bytes that will be signed and broadcast - // by the transaction client. It is computed and assigned in the - // testtx.NewOneTimeTxTxContext helper function. The same reference needs - // to be used across the expectations that are set on the transactions context mock. - expectedTx cometbytes.HexBytes - // txResultsBzPublishChMu is a mutex that protects txResultsBzPublishCh from concurrent access - // as it is expected to be updated in a mock method but is also sent on in the test. - txResultsBzPublishChMu = new(sync.Mutex) - // txResultsBzPublishCh is the channel that the mock events query client - // will use to publish the transactions event bytes. It is used near the end of - // the test to mock the network signaling that the transactions was committed. - txResultsBzPublishCh chan<- either.Bytes - blocksPublishCh chan client.Block - ctx = context.Background() - ) - - keyring, signingKey := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) - - eventsQueryClient := testeventsquery.NewOneTimeTxEventsQueryClient( - ctx, t, signingKey, txResultsBzPublishChMu, &txResultsBzPublishCh, - ) - - txCtxMock := testtx.NewOneTimeTxTxContext( - t, keyring, - testSigningKeyName, - &expectedTx, - ) - - // Construct a new mock block client because it is a required dependency. - // Since we're not exercising transactions timeouts in this test, we don't need to - // set any particular expectations on it, nor do we care about the contents - // of the latest block. - blockClientMock := testblock.NewOneTimeCommittedBlocksSequenceBlockClient( - t, blocksPublishCh, - ) - - // Construct a new depinject config with the mocks we created above. - txClientDeps := depinject.Supply( - eventsQueryClient, - txCtxMock, - blockClientMock, - ) - - // Construct the transaction client. - txClient, err := tx.NewTxClient( - ctx, txClientDeps, tx.WithSigningKeyName(testSigningKeyName), - ) - require.NoError(t, err) - - signingKeyAddr, err := signingKey.GetAddress() - require.NoError(t, err) - - // Construct a valid (arbitrary) message to sign, encode, and broadcast. - appStake := types.NewCoin("upokt", types.NewInt(1000000)) - appStakeMsg := &apptypes.MsgStakeApplication{ - Address: signingKeyAddr.String(), - Stake: &appStake, - Services: client.NewTestApplicationServiceConfig(testServiceIdPrefix, 2), - } - - // Sign and broadcast the message. - eitherErr := txClient.SignAndBroadcast(ctx, appStakeMsg) - err, errCh := eitherErr.SyncOrAsyncError() - require.NoError(t, err) - - // Construct the expected transaction event bytes from the expected transaction bytes. - txResultBz, err := json.Marshal(abci.TxResult{Tx: expectedTx}) - require.NoError(t, err) - - // Publish the transaction event bytes to the events query client so that the transaction client - // registers the transactions as committed (i.e. removes it from the timeout pool). - txResultsBzPublishChMu.Lock() - txResultsBzPublishCh <- either.Success[[]byte](txResultBz) - txResultsBzPublishChMu.Unlock() - - // Assert that the error channel was closed without receiving. - select { - case err, ok := <-errCh: - require.NoError(t, err) - require.Falsef(t, ok, "expected errCh to be closed") - case <-time.After(txCommitTimeout): - t.Fatal("test timed out waiting for errCh to receive") - } -} - -func TestTxClient_NewTxClient_Error(t *testing.T) { - // Construct an empty in-memory keyring. - memKeyring := cosmoskeyring.NewInMemory(testclient.EncodingConfig.Marshaler) - - tests := []struct { - name string - signingKeyName string - expectedErr error - }{ - { - name: "empty signing key name", - signingKeyName: "", - expectedErr: keyring.ErrEmptySigningKeyName, - }, - { - name: "signing key does not exist", - signingKeyName: "nonexistent", - expectedErr: keyring.ErrNoSuchSigningKey, - }, - // TODO_TECHDEBT: add coverage for this error case - // { - // name: "failed to get address", - // testSigningKeyName: "incompatible", - // expectedErr: tx.ErrSigningKeyAddr, - // }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - var ( - ctrl = gomock.NewController(t) - ctx = context.Background() - ) - - // Construct a new mock events query client. Since we expect the - // NewTxClient call to fail, we don't need to set any expectations - // on this mock. - eventsQueryClient := mockclient.NewMockEventsQueryClient(ctrl) - - // Construct a new mock transactions context. - txCtxMock, _ := testtx.NewAnyTimesTxTxContext(t, memKeyring) - - // Construct a new mock block client. Since we expect the NewTxClient - // call to fail, we don't need to set any expectations on this mock. - blockClientMock := mockclient.NewMockBlockClient(ctrl) - - // Construct a new depinject config with the mocks we created above. - txClientDeps := depinject.Supply( - eventsQueryClient, - txCtxMock, - blockClientMock, - ) - - // Construct a signing key option using the test signing key name. - signingKeyOpt := tx.WithSigningKeyName(tt.signingKeyName) - - // Attempt to create the transactions client. - txClient, err := tx.NewTxClient(ctx, txClientDeps, signingKeyOpt) - require.ErrorIs(t, err, tt.expectedErr) - require.Nil(t, txClient) - }) - } -} - -func TestTxClient_SignAndBroadcast_SyncError(t *testing.T) { - var ( - // txResultsBzPublishChMu is a mutex that protects txResultsBzPublishCh from concurrent access - // as it is expected to be updated in a mock method but is also sent on in the test. - txResultsBzPublishChMu = new(sync.Mutex) - // txResultsBzPublishCh is the channel that the mock events query client - // will use to publish the transactions event bytes. It is not used in - // this test but is required to use the NewOneTimeTxEventsQueryClient - // helper. - txResultsBzPublishCh chan<- either.Bytes - // blocksPublishCh is the channel that the mock block client will use - // to publish the latest block. It is not used in this test but is - // required to use the NewOneTimeCommittedBlocksSequenceBlockClient - // helper. - blocksPublishCh chan client.Block - ctx = context.Background() - ) - - keyring, signingKey := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) - - // Construct a new mock events query client. Since we expect the - // NewTxClient call to fail, we don't need to set any expectations - // on this mock. - eventsQueryClient := testeventsquery.NewOneTimeTxEventsQueryClient( - ctx, t, signingKey, txResultsBzPublishChMu, &txResultsBzPublishCh, - ) - - // Construct a new mock transaction context. - txCtxMock, _ := testtx.NewAnyTimesTxTxContext(t, keyring) - - // Construct a new mock block client because it is a required dependency. - // Since we're not exercising transactions timeouts in this test, we don't need to - // set any particular expectations on it, nor do we care about the contents - // of the latest block. - blockClientMock := testblock.NewOneTimeCommittedBlocksSequenceBlockClient( - t, blocksPublishCh, - ) - - // Construct a new depinject config with the mocks we created above. - txClientDeps := depinject.Supply( - eventsQueryClient, - txCtxMock, - blockClientMock, - ) - - // Construct the transaction client. - txClient, err := tx.NewTxClient( - ctx, txClientDeps, tx.WithSigningKeyName(testSigningKeyName), - ) - require.NoError(t, err) - - // Construct an invalid (arbitrary) message to sign, encode, and broadcast. - signingAddr, err := signingKey.GetAddress() - require.NoError(t, err) - appStakeMsg := &apptypes.MsgStakeApplication{ - // Providing address to avoid panic from #GetSigners(). - Address: signingAddr.String(), - Stake: nil, - // NB: explicitly omitting required fields - } - - eitherErr := txClient.SignAndBroadcast(ctx, appStakeMsg) - err, _ = eitherErr.SyncOrAsyncError() - require.ErrorIs(t, err, tx.ErrInvalidMsg) - - time.Sleep(10 * time.Millisecond) -} - -// TODO_INCOMPLETE: add coverage for async error; i.e. insufficient gas or on-chain error -func TestTxClient_SignAndBroadcast_CheckTxError(t *testing.T) { - var ( - // expectedErrMsg is the expected error message that will be returned - // by the transaction client. It is computed and assigned in the - // testtx.NewOneTimeErrCheckTxTxContext helper function. - expectedErrMsg string - // txResultsBzPublishChMu is a mutex that protects txResultsBzPublishCh from concurrent access - // as it is expected to be updated in a mock method but is also sent on in the test. - txResultsBzPublishChMu = new(sync.Mutex) - // txResultsBzPublishCh is the channel that the mock events query client - // will use to publish the transactions event bytes. It is used near the end of - // the test to mock the network signaling that the transactions was committed. - txResultsBzPublishCh chan<- either.Bytes - blocksPublishCh chan client.Block - ctx = context.Background() - ) - - keyring, signingKey := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) - - eventsQueryClient := testeventsquery.NewOneTimeTxEventsQueryClient( - ctx, t, signingKey, txResultsBzPublishChMu, &txResultsBzPublishCh, - ) - - txCtxMock := testtx.NewOneTimeErrCheckTxTxContext( - t, keyring, - testSigningKeyName, - &expectedErrMsg, - ) - - // Construct a new mock block client because it is a required dependency. - // Since we're not exercising transactions timeouts in this test, we don't need to - // set any particular expectations on it, nor do we care about the contents - // of the latest block. - blockClientMock := testblock.NewOneTimeCommittedBlocksSequenceBlockClient( - t, blocksPublishCh, - ) - - // Construct a new depinject config with the mocks we created above. - txClientDeps := depinject.Supply( - eventsQueryClient, - txCtxMock, - blockClientMock, - ) - - // Construct the transaction client. - txClient, err := tx.NewTxClient(ctx, txClientDeps, tx.WithSigningKeyName(testSigningKeyName)) - require.NoError(t, err) - - signingKeyAddr, err := signingKey.GetAddress() - require.NoError(t, err) - - // Construct a valid (arbitrary) message to sign, encode, and broadcast. - appStake := types.NewCoin("upokt", types.NewInt(1000000)) - appStakeMsg := &apptypes.MsgStakeApplication{ - Address: signingKeyAddr.String(), - Stake: &appStake, - Services: client.NewTestApplicationServiceConfig(testServiceIdPrefix, 2), - } - - // Sign and broadcast the message. - eitherErr := txClient.SignAndBroadcast(ctx, appStakeMsg) - err, _ = eitherErr.SyncOrAsyncError() - require.ErrorIs(t, err, tx.ErrCheckTx) - require.ErrorContains(t, err, expectedErrMsg) -} - -func TestTxClient_SignAndBroadcast_Timeout(t *testing.T) { - var ( - // expectedErrMsg is the expected error message that will be returned - // by the transaction client. It is computed and assigned in the - // testtx.NewOneTimeErrCheckTxTxContext helper function. - expectedErrMsg string - // txResultsBzPublishChMu is a mutex that protects txResultsBzPublishCh from concurrent access - // as it is expected to be updated in a mock method but is also sent on in the test. - txResultsBzPublishChMu = new(sync.Mutex) - // txResultsBzPublishCh is the channel that the mock events query client - // will use to publish the transaction event bytes. It is used near the end of - // the test to mock the network signaling that the transaction was committed. - txResultsBzPublishCh chan<- either.Bytes - blocksPublishCh = make(chan client.Block, tx.DefaultCommitTimeoutHeightOffset) - ctx = context.Background() - ) - - keyring, signingKey := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) - - eventsQueryClient := testeventsquery.NewOneTimeTxEventsQueryClient( - ctx, t, signingKey, txResultsBzPublishChMu, &txResultsBzPublishCh, - ) - - txCtxMock := testtx.NewOneTimeErrTxTimeoutTxContext( - t, keyring, - testSigningKeyName, - &expectedErrMsg, - ) - - // Construct a new mock block client because it is a required dependency. - // Since we're not exercising transaction timeouts in this test, we don't need to - // set any particular expectations on it, nor do we care about the contents - // of the latest block. - blockClientMock := testblock.NewOneTimeCommittedBlocksSequenceBlockClient( - t, blocksPublishCh, - ) - - // Construct a new depinject config with the mocks we created above. - txClientDeps := depinject.Supply( - eventsQueryClient, - txCtxMock, - blockClientMock, - ) - - // Construct the transaction client. - txClient, err := tx.NewTxClient( - ctx, txClientDeps, tx.WithSigningKeyName(testSigningKeyName), - ) - require.NoError(t, err) - - signingKeyAddr, err := signingKey.GetAddress() - require.NoError(t, err) - - // Construct a valid (arbitrary) message to sign, encode, and broadcast. - appStake := types.NewCoin("upokt", types.NewInt(1000000)) - appStakeMsg := &apptypes.MsgStakeApplication{ - Address: signingKeyAddr.String(), - Stake: &appStake, - Services: client.NewTestApplicationServiceConfig(testServiceIdPrefix, 2), - } - - // Sign and broadcast the message in a transaction. - eitherErr := txClient.SignAndBroadcast(ctx, appStakeMsg) - err, errCh := eitherErr.SyncOrAsyncError() - require.NoError(t, err) - - for i := 0; i < tx.DefaultCommitTimeoutHeightOffset; i++ { - blocksPublishCh <- testblock.NewAnyTimesBlock(t, []byte{}, int64(i+1)) - } - - // Assert that we receive the expected error type & message. - select { - case err := <-errCh: - require.ErrorIs(t, err, tx.ErrTxTimeout) - require.ErrorContains(t, err, expectedErrMsg) - // NB: wait 110% of txCommitTimeout; a bit longer than strictly necessary in - // order to mitigate flakiness. - case <-time.After(txCommitTimeout * 110 / 100): - t.Fatal("test timed out waiting for errCh to receive") - } - - // Assert that the error channel was closed. - select { - case err, ok := <-errCh: - require.Falsef(t, ok, "expected errCh to be closed") - require.NoError(t, err) - // NB: Give the error channel some time to be ready to receive in order to - // mitigate flakiness. - case <-time.After(50 * time.Millisecond): - t.Fatal("expected errCh to be closed") - } -} - -// TODO_TECHDEBT: add coverage for sending multiple messages simultaneously -func TestTxClient_SignAndBroadcast_MultipleMsgs(t *testing.T) { - t.SkipNow() -} diff --git a/pkg/client/tx/context.go b/pkg/client/tx/context.go deleted file mode 100644 index 6ee1525cf..000000000 --- a/pkg/client/tx/context.go +++ /dev/null @@ -1,100 +0,0 @@ -package tx - -import ( - "context" - - "cosmossdk.io/depinject" - cometrpctypes "github.com/cometbft/cometbft/rpc/core/types" - cosmosclient "github.com/cosmos/cosmos-sdk/client" - cosmostx "github.com/cosmos/cosmos-sdk/client/tx" - cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" - cosmostypes "github.com/cosmos/cosmos-sdk/types" - authclient "github.com/cosmos/cosmos-sdk/x/auth/client" - - "github.com/pokt-network/poktroll/pkg/client" - txtypes "github.com/pokt-network/poktroll/pkg/client/tx/types" -) - -var _ client.TxContext = (*cosmosTxContext)(nil) - -// cosmosTxContext is an internal implementation of the client.TxContext interface. -// It provides methods related to transaction context within the Cosmos SDK. -type cosmosTxContext struct { - // Holds cosmos-sdk client context. - // (see: https://pkg.go.dev/github.com/cosmos/cosmos-sdk@v0.47.5/client#Context) - clientCtx txtypes.Context - // Holds the cosmos-sdk transaction factory. - // (see: https://pkg.go.dev/github.com/cosmos/cosmos-sdk@v0.47.5/client/tx#Factory) - txFactory cosmostx.Factory -} - -// NewTxContext initializes a new cosmosTxContext with the given dependencies. -// It uses depinject to populate its members and returns a client.TxContext -// interface type. -// -// Required dependencies: -// - cosmosclient.Context -// - cosmostx.Factory -func NewTxContext(deps depinject.Config) (client.TxContext, error) { - txCtx := cosmosTxContext{} - - if err := depinject.Inject( - deps, - &txCtx.clientCtx, - &txCtx.txFactory, - ); err != nil { - return nil, err - } - - return txCtx, nil -} - -// GetKeyring returns the cosmos-sdk client Keyring associated with the transaction factory. -func (txCtx cosmosTxContext) GetKeyring() cosmoskeyring.Keyring { - return txCtx.txFactory.Keybase() -} - -// SignTx signs the provided transaction using the given key name. It can operate in offline mode -// and can optionally overwrite any existing signatures. -// It is a proxy to the cosmos-sdk auth module client SignTx function. -// (see: https://pkg.go.dev/github.com/cosmos/cosmos-sdk@v0.47.5/x/auth/client) -func (txCtx cosmosTxContext) SignTx( - signingKeyName string, - txBuilder cosmosclient.TxBuilder, - offline, overwriteSig bool, -) error { - return authclient.SignTx( - txCtx.txFactory, - cosmosclient.Context(txCtx.clientCtx), - signingKeyName, - txBuilder, - offline, overwriteSig, - ) -} - -// NewTxBuilder returns a new transaction builder instance using the cosmos-sdk client transaction config. -func (txCtx cosmosTxContext) NewTxBuilder() cosmosclient.TxBuilder { - return txCtx.clientCtx.TxConfig.NewTxBuilder() -} - -// EncodeTx encodes the provided tx and returns its bytes representation. -func (txCtx cosmosTxContext) EncodeTx(txBuilder cosmosclient.TxBuilder) ([]byte, error) { - return txCtx.clientCtx.TxConfig.TxEncoder()(txBuilder.GetTx()) -} - -// BroadcastTx broadcasts the given transaction to the network, blocking until the check-tx -// ABCI operation completes and returns a TxResponse of the transaction status at that point in time. -func (txCtx cosmosTxContext) BroadcastTx(txBytes []byte) (*cosmostypes.TxResponse, error) { - clientCtx := cosmosclient.Context(txCtx.clientCtx) - return clientCtx.BroadcastTxAsync(txBytes) -} - -// QueryTx queries the transaction based on its hash and optionally provides proof -// of the transaction. It returns the transaction query result. -func (txCtx cosmosTxContext) QueryTx( - ctx context.Context, - txHash []byte, - prove bool, -) (*cometrpctypes.ResultTx, error) { - return txCtx.clientCtx.Client.Tx(ctx, txHash, prove) -} diff --git a/pkg/client/tx/encoding.go b/pkg/client/tx/encoding.go deleted file mode 100644 index 78612e7b7..000000000 --- a/pkg/client/tx/encoding.go +++ /dev/null @@ -1,18 +0,0 @@ -package tx - -import ( - "fmt" - "strings" -) - -// normalizeTxHashHex defines canonical and unambiguous representation for a -// transaction hash hexadecimal string; lower-case. -func normalizeTxHashHex(txHash string) string { - return strings.ToLower(txHash) -} - -// txHashBytesToNormalizedHex converts a transaction hash bytes to a normalized -// hexadecimal string representation. -func txHashBytesToNormalizedHex(txHash []byte) string { - return normalizeTxHashHex(fmt.Sprintf("%x", txHash)) -} diff --git a/pkg/client/tx/errors.go b/pkg/client/tx/errors.go deleted file mode 100644 index 328d7a51d..000000000 --- a/pkg/client/tx/errors.go +++ /dev/null @@ -1,41 +0,0 @@ -package tx - -import errorsmod "cosmossdk.io/errors" - -var ( - // ErrInvalidMsg signifies that there was an issue in validating the - // transaction message. This could be due to format, content, or other - // constraints imposed on the message. - ErrInvalidMsg = errorsmod.Register(codespace, 4, "failed to validate tx message") - - // ErrCheckTx indicates an error occurred during the ABCI check transaction - // process, which verifies the transaction's integrity before it is added - // to the mempool. - ErrCheckTx = errorsmod.Register(codespace, 5, "error during ABCI check tx") - - // ErrTxTimeout is raised when a transaction has taken too long to - // complete, surpassing a predefined threshold. - ErrTxTimeout = errorsmod.Register(codespace, 6, "tx timed out") - - // ErrQueryTx indicates an error occurred while trying to query for the status - // of a specific transaction, likely due to issues with the query parameters - // or the state of the blockchain network. - ErrQueryTx = errorsmod.Register(codespace, 7, "error encountered while querying for tx") - - // ErrInvalidTxHash represents an error which is triggered when the - // transaction hash provided does not adhere to the expected format or - // constraints, implying it may be corrupted or tampered with. - ErrInvalidTxHash = errorsmod.Register(codespace, 8, "invalid tx hash") - - // ErrNonTxEventBytes indicates an attempt to deserialize bytes that do not - // correspond to a transaction event. This error is triggered when the provided - // byte data isn't recognized as a valid transaction event representation. - ErrNonTxEventBytes = errorsmod.Register(codespace, 9, "attempted to deserialize non-tx event bytes") - - // ErrUnmarshalTx signals a failure in the unmarshaling process of a transaction. - // This error is triggered when the system encounters issues translating a set of - // bytes into the corresponding Tx structure or object. - ErrUnmarshalTx = errorsmod.Register(codespace, 10, "failed to unmarshal tx") - - codespace = "tx_client" -) diff --git a/pkg/client/tx/options.go b/pkg/client/tx/options.go deleted file mode 100644 index 34e782b6d..000000000 --- a/pkg/client/tx/options.go +++ /dev/null @@ -1,22 +0,0 @@ -package tx - -import ( - "github.com/pokt-network/poktroll/pkg/client" -) - -// WithCommitTimeoutBlocks sets the timeout duration in terms of number of blocks -// for the client to wait for broadcast transactions to be committed before -// returning a timeout error. -func WithCommitTimeoutBlocks(timeout int64) client.TxClientOption { - return func(client client.TxClient) { - client.(*txClient).commitTimeoutHeightOffset = timeout - } -} - -// WithSigningKeyName sets the name of the key which should be retrieved from the -// keyring and used for signing transactions. -func WithSigningKeyName(keyName string) client.TxClientOption { - return func(client client.TxClient) { - client.(*txClient).signingKeyName = keyName - } -} diff --git a/pkg/client/tx/types/context.go b/pkg/client/tx/types/context.go deleted file mode 100644 index 7dd15cd7f..000000000 --- a/pkg/client/tx/types/context.go +++ /dev/null @@ -1,12 +0,0 @@ -package types - -import ( - cosmosclient "github.com/cosmos/cosmos-sdk/client" -) - -// Context is used to distinguish a cosmosclient.Context intended for use in -// transactions from others. This is because the same cosmosclient.Context can -// be used for both queries and transactions (as they are generated identically). -// This type is intentionally not an alias in order to make this distinction -// clear to the dependency injector (i.e. txtypes.Context). -type Context cosmosclient.Context diff --git a/pkg/crypto/godoc.go b/pkg/crypto/godoc.go deleted file mode 100644 index 846f22de6..000000000 --- a/pkg/crypto/godoc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package crypto provides the cryptographic primitives used by the Pocket -// Network. This includes the RingCache used to build and cache rings used -// for signing relays, and may expand to include other cryptographic -// primitives in the future. -package crypto diff --git a/pkg/crypto/interface.go b/pkg/crypto/interface.go deleted file mode 100644 index 4298a9b6a..000000000 --- a/pkg/crypto/interface.go +++ /dev/null @@ -1,30 +0,0 @@ -//go:generate mockgen -destination=../../testutil/mockcrypto/ring_cache_mock.go -package=mockcrypto . RingCache -package crypto - -import ( - "context" - - "github.com/noot/ring-go" -) - -// RingCache is used to store rings used for signing and verifying relay requests. -// It will cache rings for future use after querying the application module for -// the addresses of the gateways the application is delegated to, and converting -// them into their corresponding public key points on the secp256k1 curve. -type RingCache interface { - // Start starts the ring cache, it takes a cancellable context and, in a - // separate goroutine, listens for on-chain delegation events and invalidates - // the cache if the redelegation event's AppAddress is stored in the cache. - Start(ctx context.Context) - // GetCachedAddresses returns the addresses of the applications that are - // currently cached in the ring cache. - GetCachedAddresses() []string - // GetRingForAddress returns the ring for the given application address if - // it exists. If it does not exist in the cache, it follows a lazy approach - // of querying the on-chain state and creating it just-in-time, caching for - // future retrievals. - GetRingForAddress(ctx context.Context, appAddress string) (*ring.Ring, error) - // Stop stops the ring cache by unsubscribing from on-chain delegation events. - // And clears the cache, so that it no longer contains any rings, - Stop() -} diff --git a/pkg/crypto/rings/cache.go b/pkg/crypto/rings/cache.go deleted file mode 100644 index e1a21ed50..000000000 --- a/pkg/crypto/rings/cache.go +++ /dev/null @@ -1,278 +0,0 @@ -package rings - -import ( - "context" - "fmt" - "sync" - - "cosmossdk.io/depinject" - ring_secp256k1 "github.com/athanorlabs/go-dleq/secp256k1" - ringtypes "github.com/athanorlabs/go-dleq/types" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - "github.com/noot/ring-go" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/crypto" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/polylog" -) - -var _ crypto.RingCache = (*ringCache)(nil) - -type ringCache struct { - // logger is the logger for the ring cache. - logger polylog.Logger - - // ringPointsCache maintains a map of application addresses to the points - // on the secp256k1 curve that correspond to the public keys of the gateways - // the application is delegated to. These are used to build the app's ring. - ringPointsCache map[string][]ringtypes.Point - ringPointsMu *sync.RWMutex - - // delegationClient is used to listen for on-chain delegation events and - // invalidate cache entries for rings that have been updated on chain. - delegationClient client.DelegationClient - - // applicationQuerier is the querier for the application module, and is - // used to get the addresses of the gateways an application is delegated to. - applicationQuerier client.ApplicationQueryClient - - // accountQuerier is the querier for the account module, and is used to get - // the public keys of the application and its delegated gateways. - accountQuerier client.AccountQueryClient -} - -// NewRingCache returns a new RingCache instance. It requires a depinject.Config -// to be passed in, which is used to inject the dependencies of the RingCache. -// -// Required dependencies: -// - polylog.Logger -// - client.DelegationClient -// - client.ApplicationQueryClient -// - client.AccountQueryClient -func NewRingCache(deps depinject.Config) (crypto.RingCache, error) { - rc := &ringCache{ - ringPointsCache: make(map[string][]ringtypes.Point), - ringPointsMu: &sync.RWMutex{}, - } - - // Supply the account and application queriers to the RingCache. - if err := depinject.Inject( - deps, - &rc.logger, - &rc.delegationClient, - &rc.applicationQuerier, - &rc.accountQuerier, - ); err != nil { - return nil, err - } - - return rc, nil -} - -// Start starts the ring cache by subscribing to on-chain redelegation events. -func (rc *ringCache) Start(ctx context.Context) { - rc.logger.Info().Msg("starting ring cache") - // Listen for redelegation events and invalidate the cache if the - // redelegation event's address is stored in the cache. - go func() { - select { - case <-ctx.Done(): - // Stop the ring cache if the context is cancelled. - rc.Stop() - } - }() - go rc.goInvalidateCache(ctx) -} - -// goInvalidateCache listens for redelegation events and invalidates the -// cache if the app address in the redelegation event is stored in the cache. -// This function is intended to be run in a goroutine. -func (rc *ringCache) goInvalidateCache(ctx context.Context) { - // Get the latest redelegation replay observable. - redelegationObs := rc.delegationClient.RedelegationsSequence(ctx) - // For each redelegation event, check if the redelegation events' - // app address is in the cache. If it is, invalidate the cache entry. - channel.ForEach[client.Redelegation]( - ctx, redelegationObs, - func(ctx context.Context, redelegation client.Redelegation) { - // Lock the cache for writing. - rc.ringPointsMu.Lock() - defer rc.ringPointsMu.Unlock() - // Check if the redelegation event's app address is in the cache. - if _, ok := rc.ringPointsCache[redelegation.GetAppAddress()]; ok { - rc.logger.Debug(). - Str("app_address", redelegation.GetAppAddress()). - Msg("redelegation event received; invalidating cache entry") - // Invalidate the cache entry. - delete(rc.ringPointsCache, redelegation.GetAppAddress()) - } - }) -} - -// Stop stops the ring cache by unsubscribing from on-chain redelegation events. -func (rc *ringCache) Stop() { - // Clear the cache. - rc.ringPointsMu.Lock() - rc.ringPointsCache = make(map[string][]ringtypes.Point) - rc.ringPointsMu.Unlock() - // Close the delegation client. - rc.delegationClient.Close() -} - -// GetCachedAddresses returns the addresses of the applications that are -// currently cached in the ring cache. -func (rc *ringCache) GetCachedAddresses() []string { - rc.ringPointsMu.RLock() - defer rc.ringPointsMu.RUnlock() - keys := make([]string, 0, len(rc.ringPointsCache)) - for k := range rc.ringPointsCache { - keys = append(keys, k) - } - return keys -} - -// GetRingForAddress returns the ring for the address provided. If it does not -// exist in the cache, it will be created by querying the application module. -// and converting the addresses into their corresponding public key points on -// the secp256k1 curve. It will then be cached for future use. -func (rc *ringCache) GetRingForAddress( - ctx context.Context, - appAddress string, -) (*ring.Ring, error) { - var ( - ring *ring.Ring - err error - ) - - // Lock the cache for reading. - rc.ringPointsMu.RLock() - // Check if the ring is in the cache. - points, ok := rc.ringPointsCache[appAddress] - // Unlock the cache in case it was not cached. - rc.ringPointsMu.RUnlock() - - if !ok { - // If the ring is not in the cache, get it from the application module. - rc.logger.Debug(). - Str("app_address", appAddress). - Msg("ring cache miss; fetching from application module") - ring, err = rc.getRingForAppAddress(ctx, appAddress) - } else { - // If the ring is in the cache, create it from the points. - rc.logger.Debug(). - Str("app_address", appAddress). - Msg("ring cache hit; creating from points") - ring, err = newRingFromPoints(points) - } - if err != nil { - return nil, err - } - - // Return the ring. - return ring, nil -} - -// getRingForAppAddress returns the RingSinger used to sign relays. It does so by fetching -// the latest information from the application module and creating the correct ring. -// This method also caches the ring's public keys for future use. -func (rc *ringCache) getRingForAppAddress( - ctx context.Context, - appAddress string, -) (*ring.Ring, error) { - points, err := rc.getDelegatedPubKeysForAddress(ctx, appAddress) - if err != nil { - return nil, err - } - // Cache the ring's points for future use - rc.logger.Debug(). - Str("app_address", appAddress). - Msg("updating ring cache for app") - rc.ringPointsMu.Lock() - defer rc.ringPointsMu.Unlock() - rc.ringPointsCache[appAddress] = points - return newRingFromPoints(points) -} - -// newRingFromPoints creates a new ring from points on the secp256k1 curve -func newRingFromPoints(points []ringtypes.Point) (*ring.Ring, error) { - return ring.NewFixedKeyRingFromPublicKeys(ring_secp256k1.NewCurve(), points) -} - -// getDelegatedPubKeysForAddress returns the ring used to sign a message for -// the given application address, by querying the application module for it's -// delegated pubkeys and converting them to points on the secp256k1 curve in -// order to create the ring. -func (rc *ringCache) getDelegatedPubKeysForAddress( - ctx context.Context, - appAddress string, -) ([]ringtypes.Point, error) { - rc.ringPointsMu.Lock() - defer rc.ringPointsMu.Unlock() - - // Get the application's on chain state. - app, err := rc.applicationQuerier.GetApplication(ctx, appAddress) - if err != nil { - return nil, err - } - - // Create a slice of addresses for the ring. - ringAddresses := make([]string, 0) - ringAddresses = append(ringAddresses, appAddress) // app address is index 0 - if len(app.DelegateeGatewayAddresses) == 0 { - // add app address twice to make the ring size of mininmum 2 - // TODO_HACK: We are adding the appAddress twice because a ring - // signature requires AT LEAST two pubKeys. When the Application has - // not delegated to any gateways, we add the application's own address - // twice. This is a HACK and should be investigated as to what is the - // best approach to take in this situation. - ringAddresses = append(ringAddresses, appAddress) - } else { - // add the delegatee gateway addresses - ringAddresses = append(ringAddresses, app.DelegateeGatewayAddresses...) - } - - // Get the points on the secp256k1 curve for the addresses. - points, err := rc.addressesToPoints(ctx, ringAddresses) - if err != nil { - return nil, err - } - - // Return the public key points on the secp256k1 curve. - return points, nil -} - -// addressesToPoints converts a slice of addresses to a slice of points on the -// secp256k1 curve, by querying the account module for the public key for each -// address and converting them to the corresponding points on the secp256k1 curve -func (rc *ringCache) addressesToPoints( - ctx context.Context, - addresses []string, -) ([]ringtypes.Point, error) { - curve := ring_secp256k1.NewCurve() - points := make([]ringtypes.Point, len(addresses)) - rc.logger.Debug(). - // TODO_TECHDEBT: implement and use `polylog.Event#Strs([]string)` instead of formatting here. - Str("addresses", fmt.Sprintf("%v", addresses)). - Msg("converting addresses to points") - for i, addr := range addresses { - // Retrieve the account from the auth module - acc, err := rc.accountQuerier.GetAccount(ctx, addr) - if err != nil { - return nil, err - } - key := acc.GetPubKey() - // Check if the key is a secp256k1 public key - if _, ok := key.(*secp256k1.PubKey); !ok { - return nil, ErrRingsNotSecp256k1Curve.Wrapf("got %T", key) - } - // Convert the public key to the point on the secp256k1 curve - point, err := curve.DecodeToPoint(key.Bytes()) - if err != nil { - return nil, err - } - // Insert the point into the slice of points - points[i] = point - } - return points, nil -} diff --git a/pkg/crypto/rings/cache_test.go b/pkg/crypto/rings/cache_test.go deleted file mode 100644 index 8505fa3dd..000000000 --- a/pkg/crypto/rings/cache_test.go +++ /dev/null @@ -1,307 +0,0 @@ -package rings_test - -import ( - "context" - "errors" - "testing" - "time" - - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/crypto" - "github.com/pokt-network/poktroll/pkg/crypto/rings" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/testutil/testclient/testdelegation" - "github.com/pokt-network/poktroll/testutil/testclient/testqueryclients" - testrings "github.com/pokt-network/poktroll/testutil/testcrypto/rings" - apptypes "github.com/pokt-network/poktroll/x/application/types" -) - -const noDelegateesRingSize = 2 - -// account is an internal struct used to define an (address, public_key) pairing -type account struct { - address string - pubKey cryptotypes.PubKey -} - -// newAccount creates a new account for testing purposes on the desired curve -func newAccount(curve string) account { - var addr string - var pubkey cryptotypes.PubKey - switch curve { - case "ed25519": - addr, pubkey = sample.AccAddressAndPubKeyEdd2519() - case "secp256k1": - addr, pubkey = sample.AccAddressAndPubKey() - } - return account{ - address: addr, - pubKey: pubkey, - } -} - -func TestRingCache_BuildRing_Uncached(t *testing.T) { - // Create and start the ring cache - ctx, cancelCtx := context.WithCancel(context.Background()) - defer cancelCtx() - rc, _ := createRingCache(ctx, t, "") - rc.Start(ctx) - t.Cleanup(rc.Stop) - - tests := []struct { - desc string - appAddrIndex int - appAccount account - delegateeAccounts []account - expectedRingSize int - expectedErr error - }{ - { - desc: "success: un-cached application without delegated gateways", - appAddrIndex: 1, - appAccount: newAccount("secp256k1"), - delegateeAccounts: []account{}, - expectedRingSize: noDelegateesRingSize, - expectedErr: nil, - }, - { - desc: "success: un-cached application with delegated gateways", - appAddrIndex: 2, - appAccount: newAccount("secp256k1"), - delegateeAccounts: []account{newAccount("secp256k1"), newAccount("secp256k1")}, - expectedRingSize: 3, - expectedErr: nil, - }, - { - desc: "failure: app pubkey uses wrong curve", - appAccount: newAccount("ed25519"), - delegateeAccounts: []account{newAccount("secp256k1"), newAccount("secp256k1")}, - expectedRingSize: 0, - expectedErr: rings.ErrRingsNotSecp256k1Curve, - }, - { - desc: "failure: gateway pubkey uses wrong curve", - appAccount: newAccount("secp256k1"), - delegateeAccounts: []account{newAccount("ed25519"), newAccount("ed25519")}, - expectedRingSize: 0, - expectedErr: rings.ErrRingsNotSecp256k1Curve, - }, - { - desc: "failure: application not found", - appAccount: newAccount("secp256k1"), - delegateeAccounts: []account{newAccount("secp256k1")}, - expectedRingSize: 0, - expectedErr: apptypes.ErrAppNotFound, - }, - } - for _, test := range tests { - t.Run(test.desc, func(t *testing.T) { - // If we expect the application to exist then add it to the test - // application map with the number of delegated gateways it is - // supposed to have so it can be retrieved from the mock - if !errors.As(test.expectedErr, &apptypes.ErrAppNotFound) { - accMap := make(map[string]cryptotypes.PubKey) - for _, delegateeAcc := range test.delegateeAccounts { - accMap[delegateeAcc.address] = delegateeAcc.pubKey - } - // add the application's account and the accounts of all its - // delegated gateways to the testing state - testqueryclients.AddAddressToApplicationMap(t, test.appAccount.address, test.appAccount.pubKey, accMap) - } - // Attempt to retrieve the ring for the address - ring, err := rc.GetRingForAddress(ctx, test.appAccount.address) - if test.expectedErr != nil { - require.ErrorAs(t, err, &test.expectedErr) - return - } - require.NoError(t, err) - // Ensure the ring is the correct size. - require.Equal(t, test.expectedRingSize, ring.Size()) - require.Equal(t, test.appAddrIndex, len(rc.GetCachedAddresses())) - }) - } -} - -func TestRingCache_BuildRing_Cached(t *testing.T) { - tests := []struct { - desc string - appAccount account - expectedRingSize int - expectedErr error - }{ - { - desc: "success: cached application without delegated gateways", - appAccount: newAccount("secp256k1"), - expectedRingSize: noDelegateesRingSize, - expectedErr: nil, - }, - { - desc: "success: cached application with delegated gateways", - appAccount: newAccount("secp256k1"), - expectedRingSize: 3, - expectedErr: nil, - }, - } - - for _, test := range tests { - t.Run(test.desc, func(t *testing.T) { - // Create and start the ring cache - ctx, cancelCtx := context.WithCancel(context.Background()) - defer cancelCtx() - rc, pubCh := createRingCache(ctx, t, test.appAccount.address) - rc.Start(ctx) - t.Cleanup(rc.Stop) - - // Check that the ring cache is empty - require.Equal(t, 0, len(rc.GetCachedAddresses())) - - // add the application's account with no delegated gateways to the - // testing state - testqueryclients.AddAddressToApplicationMap(t, test.appAccount.address, test.appAccount.pubKey, nil) - - // Attempt to retrieve the ring for the address and cache it - ring1, err := rc.GetRingForAddress(ctx, test.appAccount.address) - require.NoError(t, err) - require.Equal(t, noDelegateesRingSize, ring1.Size()) - require.Equal(t, 1, len(rc.GetCachedAddresses())) - - accMap := make(map[string]cryptotypes.PubKey) - // if the test expects a ring > 2 we have delegated gateways - if test.expectedRingSize != noDelegateesRingSize { - // create accounts for all the expected delegated gateways - // and add them to the map - for i := 0; i < test.expectedRingSize-1; i++ { - gatewayAcc := newAccount("secp256k1") - accMap[gatewayAcc.address] = gatewayAcc.pubKey - } - } - - // add the application's account and the accounts of all its - // delegated gateways to the testing state simulating a change - testqueryclients.AddAddressToApplicationMap(t, test.appAccount.address, test.appAccount.pubKey, accMap) - for k := range accMap { - t.Log(accMap) - // publish a redelegation event - pubCh <- testdelegation.NewAnyTimesRedelegation(t, test.appAccount.address, k) - } - - // Wait a tick to allow the ring cache to process asynchronously. - // It should have invalidated the cache for the ring, if changed. - time.Sleep(15 * time.Millisecond) - - // Attempt to retrieve the ring for the address and cache it if - // the ring was updated - ring2, err := rc.GetRingForAddress(ctx, test.appAccount.address) - require.NoError(t, err) - // If the ring was updated then the rings should not be equal - if test.expectedRingSize != noDelegateesRingSize { - require.False(t, ring1.Equals(ring2)) - } else { - require.True(t, ring1.Equals(ring2)) - } - require.Equal(t, test.expectedRingSize, ring2.Size()) - require.Equal(t, 1, len(rc.GetCachedAddresses())) - - // Attempt to retrieve the ring for the address after its been cached - ring3, err := rc.GetRingForAddress(ctx, test.appAccount.address) - require.NoError(t, err) - require.Equal(t, 1, len(rc.GetCachedAddresses())) - - // Ensure the rings are the same and have the same size - require.True(t, ring2.Equals(ring3)) - require.Equal(t, test.expectedRingSize, ring3.Size()) - require.Equal(t, 1, len(rc.GetCachedAddresses())) - }) - } -} - -func TestRingCache_Stop(t *testing.T) { - // Create and start the ring cache - ctx, cancelCtx := context.WithCancel(context.Background()) - t.Cleanup(cancelCtx) - rc, _ := createRingCache(ctx, t, "") - rc.Start(ctx) - - // Insert an application into the testing state - appAccount := newAccount("secp256k1") - gatewayAccount := newAccount("secp256k1") - testqueryclients.AddAddressToApplicationMap( - t, appAccount.address, - appAccount.pubKey, - map[string]cryptotypes.PubKey{ - gatewayAccount.address: gatewayAccount.pubKey, - }) - - // Attempt to retrieve the ring for the address and cache it - ring1, err := rc.GetRingForAddress(ctx, appAccount.address) - require.NoError(t, err) - require.Equal(t, 2, ring1.Size()) - require.Equal(t, 1, len(rc.GetCachedAddresses())) - - // Retrieve the cached ring - ring2, err := rc.GetRingForAddress(ctx, appAccount.address) - require.NoError(t, err) - require.True(t, ring1.Equals(ring2)) - require.Equal(t, 1, len(rc.GetCachedAddresses())) - - // Stop the ring cache - rc.Stop() - - // Retrieve the ring again - require.Equal(t, 0, len(rc.GetCachedAddresses())) -} - -func TestRingCache_CancelContext(t *testing.T) { - // Create and start the ring cache - ctx, cancelCtx := context.WithCancel(context.Background()) - rc, _ := createRingCache(ctx, t, "") - rc.Start(ctx) - - // Insert an application into the testing state - appAccount := newAccount("secp256k1") - gatewayAccount := newAccount("secp256k1") - testqueryclients.AddAddressToApplicationMap( - t, - appAccount.address, appAccount.pubKey, - map[string]cryptotypes.PubKey{ - gatewayAccount.address: gatewayAccount.pubKey, - }) - - // Attempt to retrieve the ring for the address and cache it - ring1, err := rc.GetRingForAddress(ctx, appAccount.address) - require.NoError(t, err) - require.Equal(t, 2, ring1.Size()) - require.Equal(t, 1, len(rc.GetCachedAddresses())) - - // Retrieve the cached ring - ring2, err := rc.GetRingForAddress(ctx, appAccount.address) - require.NoError(t, err) - require.True(t, ring1.Equals(ring2)) - require.Equal(t, 1, len(rc.GetCachedAddresses())) - - // Cancel the context - cancelCtx() - - // Wait a tick to allow the ring cache to process asynchronously. - time.Sleep(15 * time.Millisecond) - - // Retrieve the ring again - require.Equal(t, 0, len(rc.GetCachedAddresses())) -} - -// createRingCache creates the RingCache using mocked AccountQueryClient and -// ApplicatioQueryClient instances and returns the RingCache and the delegatee -// change replay observable. -func createRingCache(ctx context.Context, t *testing.T, appAddress string) (crypto.RingCache, chan<- client.Redelegation) { - t.Helper() - redelegationObs, redelegationPublishCh := channel.NewReplayObservable[client.Redelegation](ctx, 1) - delegationClient := testdelegation.NewAnyTimesRedelegationsSequence(ctx, t, appAddress, redelegationObs) - accQuerier := testqueryclients.NewTestAccountQueryClient(t) - appQuerier := testqueryclients.NewTestApplicationQueryClient(t) - rc := testrings.NewRingCacheWithMockDependencies(ctx, t, accQuerier, appQuerier, delegationClient) - return rc, redelegationPublishCh -} diff --git a/pkg/crypto/rings/errors.go b/pkg/crypto/rings/errors.go deleted file mode 100644 index 8aae1ad9d..000000000 --- a/pkg/crypto/rings/errors.go +++ /dev/null @@ -1,10 +0,0 @@ -package rings - -import ( - sdkerrors "cosmossdk.io/errors" -) - -var ( - codespace = "rings" - ErrRingsNotSecp256k1Curve = sdkerrors.Register(codespace, 1, "key is not a secp256k1 public key") -) diff --git a/pkg/crypto/rings/godoc.go b/pkg/crypto/rings/godoc.go deleted file mode 100644 index 522a7719b..000000000 --- a/pkg/crypto/rings/godoc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Package rings provides the RingCache interface that is used to build rings -// for applications by either the application itself or a gateway. This ring -// is used to sign the relay requests. -// The RingCache is responsible for caching the rings for future use and -// invalidating the cache when the application's delegated gateways change. -package rings diff --git a/pkg/deps/config/godoc.go b/pkg/deps/config/godoc.go deleted file mode 100644 index e5d9b15a5..000000000 --- a/pkg/deps/config/godoc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package config provides a method by which dependencies can be injected into -// dependency chains, via the use of SupplierFn functions. These functions -// return functions that can be used in CLI code to chain the dependencies -// required to start a service into a single depinject.Config. -package config diff --git a/pkg/deps/config/suppliers.go b/pkg/deps/config/suppliers.go deleted file mode 100644 index 7c9f4dd21..000000000 --- a/pkg/deps/config/suppliers.go +++ /dev/null @@ -1,363 +0,0 @@ -package config - -import ( - "context" - "net/url" - - "cosmossdk.io/depinject" - cosmosclient "github.com/cosmos/cosmos-sdk/client" - cosmosflags "github.com/cosmos/cosmos-sdk/client/flags" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - grpc "github.com/cosmos/gogoproto/grpc" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/pkg/client/block" - "github.com/pokt-network/poktroll/pkg/client/delegation" - "github.com/pokt-network/poktroll/pkg/client/events" - "github.com/pokt-network/poktroll/pkg/client/query" - querytypes "github.com/pokt-network/poktroll/pkg/client/query/types" - txtypes "github.com/pokt-network/poktroll/pkg/client/tx/types" - "github.com/pokt-network/poktroll/pkg/crypto/rings" - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/sdk" -) - -// SupplierFn is a function that is used to supply a depinject config. -type SupplierFn func( - context.Context, - depinject.Config, - *cobra.Command, -) (depinject.Config, error) - -// SupplyConfig supplies a depinject config by calling each of the supplied -// supplier functions in order and passing the result of each supplier to the -// next supplier, chaining them together. -func SupplyConfig( - ctx context.Context, - cmd *cobra.Command, - suppliers []SupplierFn, -) (deps depinject.Config, err error) { - // Initialize deps to with empty depinject config. - deps = depinject.Configs() - for _, supplyFn := range suppliers { - deps, err = supplyFn(ctx, deps, cmd) - if err != nil { - return nil, err - } - } - return deps, nil -} - -// NewSupplyLoggerFromCtx supplies a depinject config with a polylog.Logger instance -// populated from the given context. -func NewSupplyLoggerFromCtx(ctx context.Context) SupplierFn { - return func( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - return depinject.Configs(deps, depinject.Supply(polylog.Ctx(ctx))), nil - } -} - -// NewSupplyEventsQueryClientFn supplies a depinject config with an -// EventsQueryClient from the given queryNodeRPCURL. -func NewSupplyEventsQueryClientFn(queryNodeRPCURL *url.URL) SupplierFn { - return func( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - // Convert the host to a websocket URL - queryNodeWebsocketURL := sdk.HostToWebsocketURL(queryNodeRPCURL.Host) - eventsQueryClient := events.NewEventsQueryClient(queryNodeWebsocketURL) - - return depinject.Configs(deps, depinject.Supply(eventsQueryClient)), nil - } -} - -// NewSupplyBlockClientFn supplies a depinject config with a blockClient. -func NewSupplyBlockClientFn() SupplierFn { - return func( - ctx context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - // Requires a query client to be supplied to the deps - blockClient, err := block.NewBlockClient(ctx, deps) - if err != nil { - return nil, err - } - - return depinject.Configs(deps, depinject.Supply(blockClient)), nil - } -} - -// NewSupplyDelegationClientFn returns a function which constructs a -// DelegationClient instance and returns a new depinject.Config which is -// supplied with the given deps and the new DelegationClient. -func NewSupplyDelegationClientFn() SupplierFn { - return func( - ctx context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - // Requires a query client to be supplied to the deps - delegationClient, err := delegation.NewDelegationClient(ctx, deps) - if err != nil { - return nil, err - } - - return depinject.Configs(deps, depinject.Supply(delegationClient)), nil - } -} - -// NewSupplyQueryClientContextFn supplies a depinject config with a query -// -// ClientContext, a GRPC client connection, and a keyring from the given queryNodeGRPCURL. -func NewSupplyQueryClientContextFn(queryNodeGRPCURL *url.URL) SupplierFn { - return func(_ context.Context, - deps depinject.Config, - cmd *cobra.Command, - ) (depinject.Config, error) { - // Temporarily store the flag's current value to be restored later, after - // the client context has been created with queryNodeGRPCURL. - // TODO_TECHDEBT(#223) Retrieve value from viper instead, once integrated. - tmpGRPC, err := cmd.Flags().GetString(cosmosflags.FlagGRPC) - if err != nil { - return nil, err - } - - // Set --grpc-addr flag to the pocketQueryNodeURL for the client context - // This flag is read by cosmosclient.GetClientQueryContext. - // Cosmos-SDK is expecting a GRPC address formatted as [:], - // so we only need to set the Host parameter of the URL to cosmosflags.FlagGRPC value. - if err := cmd.Flags().Set(cosmosflags.FlagGRPC, queryNodeGRPCURL.Host); err != nil { - return nil, err - } - - // NB: Currently, the implementations of GetClientTxContext() and - // GetClientQueryContext() are identical, allowing for their interchangeable - // use in both querying and transaction operations. However, in order to support - // independent configuration of client contexts for distinct querying and - // transacting purposes. E.g.: transactions are dispatched to the sequencer - // while queries are handled by a trusted full-node. - queryClientCtx, err := cosmosclient.GetClientQueryContext(cmd) - if err != nil { - return nil, err - } - deps = depinject.Configs(deps, depinject.Supply( - querytypes.Context(queryClientCtx), - grpc.ClientConn(queryClientCtx), - queryClientCtx.Keyring, - )) - - // Restore the flag's original value in order for other components - // to use the flag as expected. - if err := cmd.Flags().Set(cosmosflags.FlagGRPC, tmpGRPC); err != nil { - return nil, err - } - - return deps, nil - } -} - -// NewSupplyTxClientContextFn supplies a depinject config with a TxClientContext -// from the given txNodeGRPCURL. -// TODO_TECHDEBT(#256): Remove this function once the as we may no longer -// need to supply a TxClientContext to the RelayMiner. -func NewSupplyTxClientContextFn( - queryNodeGRPCURL *url.URL, - txNodeRPCURL *url.URL, -) SupplierFn { - return func(_ context.Context, - deps depinject.Config, - cmd *cobra.Command, - ) (depinject.Config, error) { - // Temporarily store the flag's current value to be restored later, after - // the client context has been created with txNodeRPCURL. - // TODO_TECHDEBT(#223) Retrieve value from viper instead, once integrated. - tmpNode, err := cmd.Flags().GetString(cosmosflags.FlagNode) - if err != nil { - return nil, err - } - - // Temporarily store the flag's current value to be restored later, after - // the client context has been created with queryNodeGRPCURL. - // TODO_TECHDEBT(#223) Retrieve value from viper instead, once integrated. - tmpGRPC, err := cmd.Flags().GetString(cosmosflags.FlagGRPC) - if err != nil { - return nil, err - } - - // Set --node flag to the txNodeRPCURL for the client context - // This flag is read by cosmosclient.GetClientTxContext. - if err := cmd.Flags().Set(cosmosflags.FlagNode, txNodeRPCURL.String()); err != nil { - return nil, err - } - - // Set --grpc-addr flag to the queryNodeGRPCURL for the client context - // This flag is read by cosmosclient.GetClientTxContext to query accounts - // for transaction signing. - // Cosmos-SDK is expecting a GRPC address formatted as [:], - // so we only need to set the Host parameter of the URL to cosmosflags.FlagGRPC value. - if err := cmd.Flags().Set(cosmosflags.FlagGRPC, queryNodeGRPCURL.Host); err != nil { - return nil, err - } - - // NB: Currently, the implementations of GetClientTxContext() and - // GetClientQueryContext() are identical, allowing for their interchangeable - // use in both querying and transaction operations. However, in order to support - // independent configuration of client contexts for distinct querying and - // transacting purposes. E.g.: transactions are dispatched to the sequencer - // while queries are handled by a trusted full-node. - txClientCtx, err := cosmosclient.GetClientTxContext(cmd) - if err != nil { - return nil, err - } - deps = depinject.Configs(deps, depinject.Supply( - txtypes.Context(txClientCtx), - )) - - // Restore the flag's original value in order for other components - // to use the flag as expected. - if err := cmd.Flags().Set(cosmosflags.FlagGRPC, tmpGRPC); err != nil { - return nil, err - } - - // Restore the flag's original value in order for other components - // to use the flag as expected. - if err := cmd.Flags().Set(cosmosflags.FlagNode, tmpNode); err != nil { - return nil, err - } - - return deps, nil - } -} - -// NewSupplyAccountQuerierFn supplies a depinject config with an AccountQuerier. -func NewSupplyAccountQuerierFn() SupplierFn { - return func( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - // Create the account querier. - accountQuerier, err := query.NewAccountQuerier(deps) - if err != nil { - return nil, err - } - - // Supply the account querier to the provided deps - return depinject.Configs(deps, depinject.Supply(accountQuerier)), nil - } -} - -// NewSupplyApplicationQuerierFn supplies a depinject config with an ApplicationQuerier. -func NewSupplyApplicationQuerierFn() SupplierFn { - return func( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - // Create the application querier. - applicationQuerier, err := query.NewApplicationQuerier(deps) - if err != nil { - return nil, err - } - - // Supply the application querier to the provided deps - return depinject.Configs(deps, depinject.Supply(applicationQuerier)), nil - } -} - -// NewSupplySessionQuerierFn supplies a depinject config with a SessionQuerier. -func NewSupplySessionQuerierFn() SupplierFn { - return func( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - // Create the session querier. - sessionQuerier, err := query.NewSessionQuerier(deps) - if err != nil { - return nil, err - } - - // Supply the session querier to the provided deps - return depinject.Configs(deps, depinject.Supply(sessionQuerier)), nil - } -} - -// NewSupplySupplierQuerierFn supplies a depinject config with a SupplierQuerier. -func NewSupplySupplierQuerierFn() SupplierFn { - return func( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - // Create the supplier querier. - supplierQuerier, err := query.NewSupplierQuerier(deps) - if err != nil { - return nil, err - } - - // Supply the supplier querier to the provided deps - return depinject.Configs(deps, depinject.Supply(supplierQuerier)), nil - } -} - -// NewSupplyRingCacheFn supplies a depinject config with a RingCache. -func NewSupplyRingCacheFn() SupplierFn { - return func( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - // Create the ring cache. - ringCache, err := rings.NewRingCache(deps) - if err != nil { - return nil, err - } - - // Supply the ring cache to the provided deps - return depinject.Configs(deps, depinject.Supply(ringCache)), nil - } -} - -// NewSupplyPOKTRollSDKFn supplies a depinject config with a POKTRollSDK given -// the signing key name. -func NewSupplyPOKTRollSDKFn(signingKeyName string) SupplierFn { - return func( - ctx context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - var clientCtx cosmosclient.Context - - // On a Cosmos environment we get the private key from the keyring - // Inject the client context, get the keyring from it then get the private key - if err := depinject.Inject(deps, &clientCtx); err != nil { - return nil, err - } - - keyRecord, err := clientCtx.Keyring.Key(signingKeyName) - if err != nil { - return nil, err - } - - privateKey, ok := keyRecord.GetLocal().PrivKey.GetCachedValue().(cryptotypes.PrivKey) - if !ok { - return nil, err - } - - config := &sdk.POKTRollSDKConfig{PrivateKey: privateKey, Deps: deps} - poktrollSDK, err := sdk.NewPOKTRollSDK(ctx, config) - if err != nil { - return nil, err - } - - // Supply the session querier to the provided deps - return depinject.Configs(deps, depinject.Supply(poktrollSDK)), nil - } -} diff --git a/pkg/either/either.go b/pkg/either/either.go deleted file mode 100644 index 2febbb412..000000000 --- a/pkg/either/either.go +++ /dev/null @@ -1,43 +0,0 @@ -package either - -// Either represents a type that can hold either a value of type T or an error. -// It's commonly used in functional programming to encapsulate functions that might fail. -// This way, instead of returning a value and an error separately, both are combined into a single type. -type Either[R any] struct { - right R // holds the success value - left error // holds the error, if any -} - -func NewEither[R any](right R, left error) Either[R] { - return Either[R]{right: right, left: left} -} - -// Success creates a successful Either value. -func Success[T any](value T) Either[T] { - return Either[T]{right: value, left: nil} -} - -// Error creates an error Either value. -func Error[T any](err error) Either[T] { - return Either[T]{right: zeroValue[T](), left: err} -} - -// IsSuccess checks if the Either contains a success value. -func (m Either[T]) IsSuccess() bool { - return m.left == nil -} - -// IsError checks if the Either contains an error. -func (m Either[T]) IsError() bool { - return m.left != nil -} - -// ValueOrError unpacks the Either value. -func (m Either[T]) ValueOrError() (T, error) { - return m.right, m.left -} - -// Helper function to get the zero value for any type. -func zeroValue[T any]() (zero T) { - return zero -} diff --git a/pkg/either/errors.go b/pkg/either/errors.go deleted file mode 100644 index f464b8886..000000000 --- a/pkg/either/errors.go +++ /dev/null @@ -1,35 +0,0 @@ -package either - -// SyncErr creates an AsyncError either from a synchronous error. -// It wraps the Error into the left field (conventionally associated with the -// error value in the Either pattern) of the Either type. It casts the result -// to the AsyncError type. -func SyncErr(err error) AsyncError { - return AsyncError(Error[chan error](err)) -} - -// AsyncErr creates an AsyncError from an error channel. -// It wraps the error channel into the right field (conventionally associated with -// successful values in the Either pattern) of the Either type. -func AsyncErr(errCh chan error) AsyncError { - return AsyncError(Success[chan error](errCh)) -} - -// SyncOrAsyncError decomposes the AsyncError into its components, returning -// a synchronous error and an error channel. If the AsyncError represents a -// synchronous error, the error channel will be nil and vice versa. -func (soaErr AsyncError) SyncOrAsyncError() (error, chan error) { - errCh, err := Either[chan error](soaErr).ValueOrError() - return err, errCh -} - -// IsSyncError checks if the AsyncError represents a synchronous error. -func (soaErr AsyncError) IsSyncError() bool { - return Either[chan error](soaErr).IsError() -} - -// IsAsyncError checks if the AsyncError represents an asynchronous error -// (sent through a channel). -func (soaErr AsyncError) IsAsyncError() bool { - return Either[chan error](soaErr).IsSuccess() -} diff --git a/pkg/either/types.go b/pkg/either/types.go deleted file mode 100644 index 4f5f53f00..000000000 --- a/pkg/either/types.go +++ /dev/null @@ -1,12 +0,0 @@ -package either - -import "github.com/pokt-network/poktroll/pkg/relayer" - -type ( - // AsyncError represents a value which could either be a synchronous error or - // an asynchronous error (sent through a channel). It wraps the more generic - // `Either` type specific for error channels. - AsyncError Either[chan error] - Bytes = Either[[]byte] - SessionTree = Either[relayer.SessionTree] -) diff --git a/pkg/observable/channel/collect.go b/pkg/observable/channel/collect.go deleted file mode 100644 index edbc545cb..000000000 --- a/pkg/observable/channel/collect.go +++ /dev/null @@ -1,34 +0,0 @@ -package channel - -import ( - "context" - "sync" - - "github.com/pokt-network/poktroll/pkg/observable" -) - -// Collect collects all notifications received from the observable and returns -// them as a slice. ctx MUST be canceled, after some finite duration as it blocks -// until either srcObservable is closed OR ctx is canceled. Collect is a terminal -// observable operator. -func Collect[V any]( - ctx context.Context, - srcObservable observable.Observable[V], -) (dstCollection []V) { - var dstCollectionMu sync.Mutex - // Defer unlocking as lock is acquired immediately before returning. - defer dstCollectionMu.Unlock() - - ForEach(ctx, srcObservable, func(ctx context.Context, src V) { - dstCollectionMu.Lock() - dstCollection = append(dstCollection, src) - dstCollectionMu.Unlock() - }) - - // Wait for context to be done before returning. - <-ctx.Done() - - // Lock to read from dstCollection in return. - dstCollectionMu.Lock() - return dstCollection -} diff --git a/pkg/observable/channel/map.go b/pkg/observable/channel/map.go deleted file mode 100644 index d6053aefa..000000000 --- a/pkg/observable/channel/map.go +++ /dev/null @@ -1,130 +0,0 @@ -package channel - -import ( - "context" - - "github.com/pokt-network/poktroll/pkg/observable" -) - -type MapFn[S, D any] func(ctx context.Context, src S) (dst D, skip bool) -type ForEachFn[V any] func(ctx context.Context, src V) - -// Map transforms the given observable by applying the given transformFn to each -// notification received from the observable. If the transformFn returns a skip -// bool of true, the notification is skipped and not emitted to the resulting -// observable. -func Map[S, D any]( - ctx context.Context, - srcObservable observable.Observable[S], - transformFn MapFn[S, D], -) observable.Observable[D] { - dstObservable, dstProducer := NewObservable[D]() - srcObserver := srcObservable.Subscribe(ctx) - - go goMapTransformNotification( - ctx, - srcObserver, - transformFn, - func(dstNotification D) { - dstProducer <- dstNotification - }, - ) - - return dstObservable -} - -// MapExpand transforms the given observable by applying the given transformFn to -// each notification received from the observable, similar to Map; however, the -// transformFn returns a slice of output notifications for each input notification. -func MapExpand[S, D any]( - ctx context.Context, - srcObservable observable.Observable[S], - transformFn MapFn[S, []D], -) observable.Observable[D] { - dstObservable, dstPublishCh := NewObservable[D]() - srcObserver := srcObservable.Subscribe(ctx) - - go goMapTransformNotification( - ctx, - srcObserver, - transformFn, - func(dstNotifications []D) { - for _, dstNotification := range dstNotifications { - dstPublishCh <- dstNotification - } - }, - ) - - return dstObservable -} - -// MapReplay transforms the given observable by applying the given transformFn to -// each notification received from the observable. If the transformFn returns a -// skip bool of true, the notification is skipped and not emitted to the resulting -// observable. -// The resulting observable will receive the last replayBufferSize -// number of values published to the source observable before receiving new values. -func MapReplay[S, D any]( - ctx context.Context, - replayBufferSize int, - srcObservable observable.Observable[S], - transformFn MapFn[S, D], -) observable.ReplayObservable[D] { - dstObservable, dstProducer := NewReplayObservable[D](ctx, replayBufferSize) - srcObserver := srcObservable.Subscribe(ctx) - - go goMapTransformNotification( - ctx, - srcObserver, - transformFn, - func(dstNotification D) { - dstProducer <- dstNotification - }, - ) - - return dstObservable -} - -// ForEach applies the given forEachFn to each notification received from the -// observable, similar to Map; however, ForEach does not publish to a destination -// observable. ForEach is useful for side effects and is a terminal observable -// operator. -func ForEach[V any]( - ctx context.Context, - srcObservable observable.Observable[V], - forEachFn ForEachFn[V], -) { - Map( - ctx, srcObservable, - func(ctx context.Context, src V) (dst V, skip bool) { - forEachFn(ctx, src) - - // No downstream observers; SHOULD always skip. - return zeroValue[V](), true - }, - ) -} - -// goMapTransformNotification transforms, optionally skips, and publishes -// notifications via the given publishFn. -func goMapTransformNotification[S, D any]( - ctx context.Context, - srcObserver observable.Observer[S], - transformFn MapFn[S, D], - publishFn func(dstNotifications D), -) { - for srcNotification := range srcObserver.Ch() { - dstNotifications, skip := transformFn(ctx, srcNotification) - if skip { - continue - } - - publishFn(dstNotifications) - } - -} - -// zeroValue is a generic helper which returns the zero value of the given type. -func zeroValue[T any]() (zero T) { - return zero -} diff --git a/pkg/observable/channel/map_test.go b/pkg/observable/channel/map_test.go deleted file mode 100644 index aa7507a71..000000000 --- a/pkg/observable/channel/map_test.go +++ /dev/null @@ -1,109 +0,0 @@ -package channel_test - -import ( - "context" - "sync/atomic" - "testing" - "time" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/observable/channel" -) - -func TestMap_Word_BytesToPalindrome(t *testing.T) { - tests := []struct { - name string - wordBz []byte - isValid bool - }{ - { - name: "valid palindrome", - wordBz: []byte("rotator"), - isValid: true, - }, - { - name: "invalid palindrome", - wordBz: []byte("spinner"), - isValid: false, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - var ( - wordCounter int32 - ctx, cancel = context.WithCancel(context.Background()) - ) - t.Cleanup(cancel) - - // set up source bytes observable - bzObservable, bzPublishCh := channel.NewObservable[[]byte]() - - // map bytes observable to palindrome observable - palindromeObservable := channel.Map(ctx, bzObservable, bytesToPalindrome) - palindromeObserver := palindromeObservable.Subscribe(ctx) - - // publish a word in bytes - bzPublishCh <- tt.wordBz - - // concurrently consume the palindrome observer's channel - go func() { - for word := range palindromeObserver.Ch() { - atomic.AddInt32(&wordCounter, 1) - - // word.forwards should always match the original word - require.Equal(t, string(tt.wordBz), word.forwards) - - if tt.isValid { - require.Equal(t, string(tt.wordBz), word.backwards) - require.Truef(t, word.IsValid(), "palindrome should be valid") - } else { - require.NotEmptyf(t, string(tt.wordBz), word.backwards) - require.Falsef(t, word.IsValid(), "palindrome should be invalid") - } - } - }() - - // wait a tick for the observer to receive the word - time.Sleep(10 * time.Millisecond) - - // ensure that the observer received the word - require.Equal(t, int32(1), atomic.LoadInt32(&wordCounter)) - }) - } -} - -// Palindrome is a word that is spelled the same forwards and backwards. -// It's used as an example of a type that can be mapped from one observable -// and has no real utility outside of this test. -type palindrome struct { - forwards string - backwards string -} - -func newPalindrome(word string) palindrome { - return palindrome{ - forwards: word, - backwards: reverseString(word), - } -} - -// IsValid returns true if the word actually is a palindrome. -func (p *palindrome) IsValid() bool { - return p.forwards == (p.backwards) -} - -func bytesToPalindrome(_ context.Context, wordBz []byte) (palindrome, bool) { - return newPalindrome(string(wordBz)), false -} - -// reverseString reverses a string, character-by-character. -func reverseString(s string) string { - runes := []rune(s) - // use i & j as cursors to iteratively swap values on symmetrical indexes - for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 { - runes[i], runes[j] = runes[j], runes[i] - } - return string(runes) -} diff --git a/pkg/observable/channel/observable.go b/pkg/observable/channel/observable.go deleted file mode 100644 index fa898200f..000000000 --- a/pkg/observable/channel/observable.go +++ /dev/null @@ -1,101 +0,0 @@ -package channel - -import ( - "context" - - "github.com/pokt-network/poktroll/pkg/observable" -) - -// TODO_DISCUSS: what should this be? should it be configurable? It seems to be most -// relevant in the context of the behavior of the observable when it has multiple -// observers which consume at different rates. -// defaultSubscribeBufferSize is the buffer size of a observable's publish channel. -const defaultPublishBufferSize = 50 - -var ( - _ observable.Observable[any] = (*channelObservable[any])(nil) - _ observerManager[any] = (*channelObservable[any])(nil) -) - -// option is a function which receives and can modify the channelObservable state. -type option[V any] func(obs *channelObservable[V]) - -// channelObservable implements the observable.Observable interface and can be notified -// by sending on its corresponding publishCh channel. -type channelObservable[V any] struct { - // embed observerManager to encapsulate concurrent-safe read/write access to - // observers. This also allows higher-level objects to wrap this observable - // without knowing its specific type by asserting that it implements the - // observerManager interface. - observerManager[V] - // publishCh is an observable-wide channel that is used to receive values - // which are subsequently fanned out to observers. - publishCh chan V -} - -// NewObservable creates a new observable which is notified when the publishCh -// channel receives a value. -func NewObservable[V any](opts ...option[V]) (observable.Observable[V], chan<- V) { - // initialize an observable that publishes messages from 1 publishCh to N observers - obs := &channelObservable[V]{ - observerManager: newObserverManager[V](), - } - - for _, opt := range opts { - opt(obs) - } - - // If the caller does not provide a publishCh, create a new one using the - // defaultPublishBuffer size and return it. - if obs.publishCh == nil { - obs.publishCh = make(chan V, defaultPublishBufferSize) - } - - // start listening to the publishCh and emit values to observers - go obs.goPublish() - - return obs, obs.publishCh -} - -// WithPublisher returns an option function which sets the given publishCh of the -// resulting observable when passed to NewObservable(). -func WithPublisher[V any](publishCh chan V) option[V] { - return func(obs *channelObservable[V]) { - obs.publishCh = publishCh - } -} - -// Subscribe returns an observer which is notified when the publishCh channel -// receives a value. -func (obs *channelObservable[V]) Subscribe(ctx context.Context) observable.Observer[V] { - // Create a new observer and add it to the list of observers to be notified - // when publishCh receives a new value. - observer := NewObserver[V](ctx, obs.observerManager.remove) - obs.observerManager.add(observer) - - // caller can rely on context cancelation or call UnsubscribeAll() to unsubscribe - // active observers - if ctx != nil { - // asynchronously wait for the context to be done and then unsubscribe - // this observer. - go obs.observerManager.goUnsubscribeOnDone(ctx, observer) - } - return observer -} - -// UnsubscribeAll unsubscribes and removes all observers from the observable. -func (obs *channelObservable[V]) UnsubscribeAll() { - obs.observerManager.removeAll() -} - -// goPublish to the publishCh and notify observers when values are received. -// This function is blocking and should be run in a goroutine. -func (obs *channelObservable[V]) goPublish() { - for notification := range obs.publishCh { - obs.observerManager.notifyAll(notification) - } - - // Here we know that the publisher channel has been closed. - // Unsubscribe all observers as they can no longer receive notifications. - obs.observerManager.removeAll() -} diff --git a/pkg/observable/channel/observable_test.go b/pkg/observable/channel/observable_test.go deleted file mode 100644 index b278546fc..000000000 --- a/pkg/observable/channel/observable_test.go +++ /dev/null @@ -1,371 +0,0 @@ -package channel_test - -import ( - "context" - "fmt" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "golang.org/x/sync/errgroup" - - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/testutil/testchannel" - "github.com/pokt-network/poktroll/testutil/testerrors" -) - -const ( - publishDelay = time.Millisecond - notifyTimeout = 50 * time.Millisecond - cancelUnsubscribeDelay = publishDelay * 2 -) - -func TestChannelObservable_NotifyObservers(t *testing.T) { - type test struct { - name string - publishCh chan int - inputs []int - expectedOutputs []int - setupFn func(t test) - } - - inputs := []int{123, 456, 789} - // NB: see TODO_INCOMPLETE comment below - //fullBlockingPublisher := make(chan *int) - //fullBufferedPublisher := make(chan *int, 1) - - tests := []test{ - { - name: "nil publisher (default buffer size)", - publishCh: nil, - inputs: inputs, - expectedOutputs: inputs, - }, - { - name: "empty non-buffered publisher", - publishCh: make(chan int), - inputs: inputs, - expectedOutputs: inputs, - }, - { - name: "empty buffered len 1 publisher", - publishCh: make(chan int, 1), - inputs: inputs, - expectedOutputs: inputs, - }, - { - name: "empty buffered len 1000 publisher", - publishCh: make(chan int, 1000), - inputs: inputs, - expectedOutputs: inputs, - }, - // TODO_INCOMPLETE(#81): publisher channels which are full are proving harder to test - // robustly (no flakiness); perhaps it has to do with the lack of some - // kind of guarantee about the receiver order on the consumer side. - // - // The following scenarios should generally pass but are flaky: - // (see: docs/pkg/observable/README.md regarding synchronization and buffering) - // - // { - // name: "full non-buffered publisher", - // publishCh: fullBlockingPublisher, - // inputs: inputs[1:], - // expectedOutputs: inputs, - // setupFn: func(t test) { - // go func() { - // // blocking send - // t.publishCh <- &inputs[0] - // }() - // }, - // }, - // { - // name: "full buffered len 1 publisher", - // publishCh: fullBufferedPublisher, - // inputs: inputs[1:], - // expectedOutputs: inputs, - // setupFn: func(t test) { - // // non-blocking send - // t.publishCh <- &inputs[0] - // }, - // }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if tt.setupFn != nil { - tt.setupFn(tt) - } - - ctx, cancel := context.WithCancel(context.Background()) - t.Cleanup(cancel) - - obsvbl, publishCh := channel.NewObservable[int]( - channel.WithPublisher(tt.publishCh), - ) - require.NotNil(t, obsvbl) - require.NotNil(t, publishCh) - - // construct 3 distinct observers, each with its own channel - observers := make([]observable.Observer[int], 1) - for i := range observers { - observers[i] = obsvbl.Subscribe(ctx) - } - - group, ctx := errgroup.WithContext(ctx) - - // ensure all observer channels are notified - for obsvrIdx, obsvr := range observers { - // onNext is called for each notification received by the observer - onNext := func(outputIndex int, output int) error { - // obsvr channel should receive notified input - if !assert.Equalf( - t, tt.expectedOutputs[outputIndex], - output, - "obsvr Idx: %d", obsvrIdx, - ) { - return testerrors.ErrAsync - } - return nil - } - - // onDone is called when the observer channel closes - onDone := func(outputs []int) error { - if !assert.ElementsMatch( - t, tt.expectedOutputs, outputs, - "obsvr addr: %p", obsvr, - ) { - return testerrors.ErrAsync - } - return nil - } - - // concurrently await notification or timeout to avoid blocking on - // empty and/or non-buffered publishers. - group.Go(goNotifiedOrTimedOutFactory(obsvr, onNext, onDone, notifyTimeout)) - } - - // notify with test input - publish := delayedPublishFactory(publishCh, publishDelay) - for _, input := range tt.inputs { - // simulating IO delay in sequential message publishing - publish(input) - } - - // Finished sending values, close publishCh to unsubscribe all observers - // and close all fan-out channels. - close(publishCh) - - // wait for obsvbl to be notified or timeout - err := group.Wait() - require.NoError(t, err) - - // closing publishCh should unsubscribe all observers, causing them - // to close their channels. - for _, observer := range observers { - // must drain the channel first to ensure it is isClosed - err := testchannel.DrainChannel(observer.Ch()) - require.NoError(t, err) - } - }) - } -} - -func TestChannelObservable_UnsubscribeObservers(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - obsvbl, publishCh := channel.NewObservable[int]() - require.NotNil(t, obsvbl) - require.NotNil(t, publishCh) - - type test struct { - name string - lifecycleFn func() observable.Observer[int] - } - - tests := []test{ - { - name: "nil context", - lifecycleFn: func() observable.Observer[int] { - observer := obsvbl.Subscribe(nil) - observer.Unsubscribe() - return observer - }, - }, - { - name: "only unsubscribe", - lifecycleFn: func() observable.Observer[int] { - observer := obsvbl.Subscribe(ctx) - observer.Unsubscribe() - return observer - }, - }, - { - name: "only cancel", - lifecycleFn: func() observable.Observer[int] { - observer := obsvbl.Subscribe(ctx) - cancel() - return observer - }, - }, - { - // NOTE: this will log a warning that can be ignored: - // > redundant unsubscribe: observer is closed - name: "cancel then unsubscribe", - lifecycleFn: func() observable.Observer[int] { - observer := obsvbl.Subscribe(ctx) - cancel() - time.Sleep(cancelUnsubscribeDelay) - observer.Unsubscribe() - return observer - }, - }, - { - // NOTE: this will log a warning that can be ignored: - // > redundant unsubscribe: observer is closed - name: "unsubscribe then cancel", - lifecycleFn: func() observable.Observer[int] { - observer := obsvbl.Subscribe(ctx) - observer.Unsubscribe() - time.Sleep(cancelUnsubscribeDelay) - cancel() - return observer - }, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - observer := tt.lifecycleFn() - - select { - case value, ok := <-observer.Ch(): - require.Empty(t, value) - require.False(t, ok) - case <-time.After(notifyTimeout): - t.Fatal("observer channel left open") - } - }) - } -} - -// TODO_INCOMPLETE/TODO_TECHDEBT: Implement `TestChannelObservable_ConcurrentSubUnSub` -func TestChannelObservable_ConcurrentSubUnSub(t *testing.T) { - t.Skip("add coverage: subscribing and unsubscribing concurrently should not race") -} - -func TestChannelObservable_SequentialPublishAndUnsubscription(t *testing.T) { - observations := new([]*observation[int]) - expectedNotifications := [][]int{ - {123, 456, 789}, - {456, 789, 987}, - {789, 987, 654}, - {987, 654, 321}, - } - - obsvbl, publishCh := channel.NewObservable[int]() - require.NotNil(t, obsvbl) - require.NotNil(t, publishCh) - // simulate IO delay in sequential message publishing - publish := delayedPublishFactory(publishCh, publishDelay) - - ctx, cancel := context.WithCancel(context.Background()) - t.Cleanup(cancel) - - observation0 := newObservation(ctx, obsvbl) - *observations = append(*observations, observation0) - go goReceiveNotifications(observation0) - publish(123) - - observation1 := newObservation(ctx, obsvbl) - *observations = append(*observations, observation1) - go goReceiveNotifications(observation1) - publish(456) - - observation2 := newObservation(ctx, obsvbl) - *observations = append(*observations, observation2) - go goReceiveNotifications(observation2) - publish(789) - - observation3 := newObservation(ctx, obsvbl) - *observations = append(*observations, observation3) - go goReceiveNotifications(observation3) - - observation0.Unsubscribe() - publish(987) - - observation1.Unsubscribe() - publish(654) - - observation2.Unsubscribe() - publish(321) - - observation3.Unsubscribe() - - for obsnIdx, obsrvn := range *observations { - t.Run(fmt.Sprintf("observation%d", obsnIdx), func(t *testing.T) { - msg := "observer %d channel left open" - select { - case _, ok := <-obsrvn.Ch(): - require.Falsef(t, ok, msg, obsnIdx) - default: - t.Fatalf(msg, obsnIdx) - } - - obsrvn.Lock() - defer obsrvn.Unlock() - - require.EqualValuesf( - t, expectedNotifications[obsnIdx], obsrvn.Notifications, - "observation index: %d", obsnIdx, - ) - }) - } -} - -// TODO_TECHDEBT/TODO_INCOMPLETE: add coverage for active observers closing when publishCh closes. -func TestChannelObservable_ObserversCloseOnPublishChannelClose(t *testing.T) { - t.Skip("add coverage: all observers should unsubscribe when publishCh closes") -} - -func delayedPublishFactory[V any](publishCh chan<- V, delay time.Duration) func(value V) { - return func(value V) { - publishCh <- value - // simulate IO delay in sequential message publishing - // NB: this make the test code safer as concurrent operations have more - // time to react; i.e. interact with the test harness. - time.Sleep(delay) - } -} - -func goNotifiedOrTimedOutFactory[V any]( - obsvr observable.Observer[V], - onNext func(index int, output V) error, - onDone func(outputs []V) error, - timeoutDuration time.Duration, -) func() error { - var ( - outputIndex int - outputs []V - ) - return func() error { - for { - select { - case output, ok := <-obsvr.Ch(): - if !ok { - return onDone(outputs) - } - - if err := onNext(outputIndex, output); err != nil { - return err - } - - outputs = append(outputs, output) - outputIndex++ - continue - case <-time.After(timeoutDuration): - return fmt.Errorf("timed out waiting for observer to be notified") - } - } - } -} diff --git a/pkg/observable/channel/observation_test.go b/pkg/observable/channel/observation_test.go deleted file mode 100644 index 71a3aa098..000000000 --- a/pkg/observable/channel/observation_test.go +++ /dev/null @@ -1,52 +0,0 @@ -package channel_test - -import ( - "context" - "sync" - - "github.com/pokt-network/poktroll/pkg/observable" -) - -// NOTE: this file does not contain any tests, only test helpers. - -// observation is a data structure that embeds an observer -// and keeps track of the received notifications. -// It uses generics with type parameter V. -type observation[V any] struct { - // Embeds a mutex for thread-safe operations - sync.Mutex - // Embeds an Observer of type V - observable.Observer[V] - // Notifications is a slice of type V to store received notifications - Notifications []V -} - -// newObservation is a constructor function that returns -// a new observation instance. It subscribes to the provided observable. -func newObservation[V any]( - ctx context.Context, - observable observable.Observable[V], -) *observation[V] { - return &observation[V]{ - Observer: observable.Subscribe(ctx), - Notifications: []V{}, - } -} - -// notify is a method on observation that safely -// appends a received value to the Notifications slice. -func (o *observation[V]) notify(value V) { - o.Lock() // Locks the mutex to prevent concurrent write access - defer o.Unlock() // Unlocks the mutex when the method returns - - o.Notifications = append(o.Notifications, value) // Appends the received value to the Notifications slice -} - -// goReceiveNotifications is a function that listens for -// notifications from the observer's channel and notifies -// the observation instance for each received value. -func goReceiveNotifications[V any](obsvn *observation[V]) { - for notification := range obsvn.Ch() { // Listens for notifications on the channel - obsvn.notify(notification) // Notifies the observation instance with the received value - } -} diff --git a/pkg/observable/channel/observer.go b/pkg/observable/channel/observer.go deleted file mode 100644 index 98f43a99b..000000000 --- a/pkg/observable/channel/observer.go +++ /dev/null @@ -1,152 +0,0 @@ -package channel - -import ( - "context" - "sync" - "time" - - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/polylog" - _ "github.com/pokt-network/poktroll/pkg/polylog/polyzero" -) - -const ( - // TODO_DISCUSS: what should this be? should it be configurable? It seems to be most - // relevant in the context of the behavior of the observable when it has multiple - // observers which consume at different rates. - // defaultSubscribeBufferSize is the buffer size of a channelObserver's channel. - defaultSubscribeBufferSize = 50 - // sendRetryInterval is the duration between attempts to send on the observer's - // channel in the event that it's full. It facilitates a branch in a for loop - // which unlocks the observer's mutex and tries again. - // NOTE: setting this too low can cause the send retry loop to "slip", giving - // up on a send attempt before the channel is ready to receive for multiple - // iterations of the loop. - sendRetryInterval = 100 * time.Millisecond -) - -var _ observable.Observer[any] = (*channelObserver[any])(nil) - -// channelObserver implements the observable.Observer interface. -type channelObserver[V any] struct { - ctx context.Context - // onUnsubscribe is called in Observer#Unsubscribe, closing this observer's - // channel and removing it from the respective obervable's observers list - // in a concurrency-safe manner. - onUnsubscribe func(toRemove observable.Observer[V]) - // observerMu protects the observerCh and isClosed fields. - observerMu *sync.RWMutex - // observerCh is the channel that is used to emit values to the observer. - // I.e. on the "N" side of the 1:N relationship between observable and - // observer. - observerCh chan V - // isClosed indicates whether the observer has been isClosed. It's set in - // unsubscribe; isClosed observers can't be reused. - isClosed bool -} - -type UnsubscribeFunc[V any] func(toRemove observable.Observer[V]) - -func NewObserver[V any]( - ctx context.Context, - onUnsubscribe UnsubscribeFunc[V], -) *channelObserver[V] { - // Create a channel for the observer and append it to the observers list - return &channelObserver[V]{ - ctx: ctx, - observerMu: new(sync.RWMutex), - observerCh: make(chan V, defaultSubscribeBufferSize), - onUnsubscribe: onUnsubscribe, - } -} - -// Unsubscribe closes the subscription channel and removes the subscription from -// the observable. -func (obsvr *channelObserver[V]) Unsubscribe() { - obsvr.unsubscribe() -} - -// Ch returns a receive-only subscription channel. -func (obsvr *channelObserver[V]) Ch() <-chan V { - return obsvr.observerCh -} - -// IsClosed returns true if the observer has been unsubscribed. -// A closed observer cannot be reused. -func (obsvr *channelObserver[V]) IsClosed() bool { - obsvr.observerMu.Lock() - defer obsvr.observerMu.Unlock() - - return obsvr.isClosed -} - -// unsubscribe closes the subscription channel, marks the observer as isClosed, and -// removes the subscription from its observable's observers list via onUnsubscribe. -func (obsvr *channelObserver[V]) unsubscribe() { - obsvr.observerMu.Lock() - defer obsvr.observerMu.Unlock() - - if obsvr.isClosed { - // Get a context, eihter from the observer or from the background to get - // a reference to the logger. - ctx := obsvr.ctx - if ctx == nil { - ctx = context.Background() - } - logger := polylog.Ctx(ctx) - - // log the fact that this case was encountered such that an extreme change - // in its frequency would be obvious. - logger.Warn().Err(observable.ErrObserverClosed).Msg("redundant unsubscribe") - return - } - - close(obsvr.observerCh) - obsvr.isClosed = true - obsvr.onUnsubscribe(obsvr) -} - -// notify is called by observable to send a msg on the observer's channel. -// We can't use channelObserver#Ch because it's intended to be a -// receive-only channel. The channel will block if it is full (determined by the buffer -// size) -// if the channel's buffer is full, we will retry after sendRetryInterval/s. -// The other half is spent holding the read-lock and waiting for the (full) channel -// to be ready to receive. -func (obsvr *channelObserver[V]) notify(value V) { - defer obsvr.observerMu.RUnlock() // defer releasing a read lock - - sendRetryTicker := time.NewTicker(sendRetryInterval) - for { - // observerMu must remain read-locked until the value is sent on observerCh - // in the event that it would be isClosed concurrently (i.e. this observer - // unsubscribes), which could cause a "send on isClosed channel" error. - if !obsvr.observerMu.TryRLock() { - continue - } - if obsvr.isClosed { - return - } - - select { - case <-obsvr.ctx.Done(): - // if the context is done just release the read-lock (deferred) - return - case obsvr.observerCh <- value: - // if observerCh has space in its buffer, the value is written to it - return - // if the context isn't done and channel is full (i.e. blocking), - // release the read-lock to give write-lockers a turn. This case - // continues the loop, re-read-locking and trying again. - case <-sendRetryTicker.C: - // TODO_IMPROVE/TODO_CONSIDERATION: this is where we would implement - // some backpressure strategy. It would be good to have a simple fail- - // safe strategy that can be used by default; e.g. dropping the oldest - // value if its buffer is full. - - // This case implies that the (read) lock was acquired, so it must - // be unlocked before continuing the send retry loop. - obsvr.observerMu.RUnlock() - } - } -} diff --git a/pkg/observable/channel/observer_manager.go b/pkg/observable/channel/observer_manager.go deleted file mode 100644 index 65acca5bc..000000000 --- a/pkg/observable/channel/observer_manager.go +++ /dev/null @@ -1,152 +0,0 @@ -package channel - -import ( - "context" - "sync" - - "github.com/pokt-network/poktroll/pkg/observable" -) - -var _ observerManager[any] = (*channelObserverManager[any])(nil) - -// observerManager is an interface intended to be used between an observable and some -// higher-level abstraction and/or observable implementation which would embed it. -// Embedding this interface rather than a channelObservable directly allows for -// more transparency and flexibility in higher-level code. -// NOTE: this interface MUST be used with a common concrete Observer type. -// TODO_CONSIDERATION: Consider whether `observerManager` and `Observable` should remain as separate -// types after some more time and experience using both. -type observerManager[V any] interface { - notifyAll(notification V) - add(toAdd observable.Observer[V]) - remove(toRemove observable.Observer[V]) - removeAll() - goUnsubscribeOnDone(ctx context.Context, observer observable.Observer[V]) -} - -// TODO_CONSIDERATION: if this were a generic implementation, we wouldn't need -// to cast `toAdd` to a channelObserver in add. There are two things -// currently preventing a generic observerManager implementation: -// 1. channelObserver#notify() is not part of the observable.Observer interface -// and is therefore not accessible here. If we move everything into the -// `observable` pkg so that the unexported member is in scope, then the channel -// pkg can't implement it for the same reason, it's an unexported method defined -// in a different pkg. -// 2. == is not defined for a generic Observer type. We would have to add an Equals() -// to the Observer interface. - -// channelObserverManager implements the observerManager interface using -// channelObservers. -type channelObserverManager[V any] struct { - // observersMu protects observers from concurrent access/updates - observersMu *sync.RWMutex - // observers is a list of channelObservers that will be notified when new value - // are received. - observers []*channelObserver[V] -} - -func newObserverManager[V any]() *channelObserverManager[V] { - return &channelObserverManager[V]{ - observersMu: &sync.RWMutex{}, - observers: make([]*channelObserver[V], 0), - } -} - -func (com *channelObserverManager[V]) notifyAll(notification V) { - // Copy currentObservers to avoid holding the lock while notifying them. - // New or existing Observers may (un)subscribe while this notification - // is being fanned out. - // The observers at the time of locking, prior to copying, are the canonical - // set of observers which receive this notification. - currentObservers := com.copyObservers() - for _, obsvr := range currentObservers { - // TODO_TECHDEBT: since this synchronously notifies all observers in a loop, - // it is possible to block here, part-way through notifying all observers, - // on a slow observer consumer (i.e. full buffer). Instead, we should notify - // observers with some limited concurrency of "worker" goroutines. - // The storj/common repo contains such a `Limiter` implementation, see: - // https://github.com/storj/common/blob/main/sync2/limiter.go. - obsvr.notify(notification) - } -} - -// addObserver implements the respective member of observerManager. It is used -// by the channelObservable implementation as well as embedders of observerManager -// (e.g. replayObservable). -// It panics if toAdd is not a channelObserver. -func (com *channelObserverManager[V]) add(toAdd observable.Observer[V]) { - // must (write) lock observersMu so that we can safely append to the observers list - com.observersMu.Lock() - defer com.observersMu.Unlock() - - com.observers = append(com.observers, toAdd.(*channelObserver[V])) -} - -// remove removes a given observer from the observable's list of observers. -// It implements the respective member of observerManager and is used by -// the channelObservable implementation as well as embedders of observerManager -// (e.g. replayObservable). -func (com *channelObserverManager[V]) remove(toRemove observable.Observer[V]) { - // must (write) lock to iterate over and modify the observers list - com.observersMu.Lock() - defer com.observersMu.Unlock() - - for i, observer := range com.observers { - if observer == toRemove { - com.observers = append((com.observers)[:i], (com.observers)[i+1:]...) - break - } - } -} - -// removeAll unsubscribes and removes all observers from the observable. -// It implements the respective member of observerManager and is used by -// the channelObservable implementation as well as embedders of observerManager -// (e.g. replayObservable). -func (com *channelObserverManager[V]) removeAll() { - // Copy currentObservers to avoid holding the lock while unsubscribing them. - // The observers at the time of locking, prior to copying, are the canonical - // set of observers which are unsubscribed. - // New or existing Observers may (un)subscribe while the observable is closing. - // Any such observers won't be isClosed but will also stop receiving notifications - // immediately (if they receive any at all). - currentObservers := com.copyObservers() - for _, observer := range currentObservers { - observer.Unsubscribe() - } - - // Reset observers to an empty list. This purges any observers which might have - // subscribed while the observable was closing. - com.observersMu.Lock() - com.observers = []*channelObserver[V]{} - com.observersMu.Unlock() -} - -// goUnsubscribeOnDone unsubscribes from the subscription when the context is done. -// It is a blocking function and intended to be called in a goroutine. -func (com *channelObserverManager[V]) goUnsubscribeOnDone( - ctx context.Context, - observer observable.Observer[V], -) { - <-ctx.Done() - if observer.IsClosed() { - return - } - observer.Unsubscribe() -} - -// copyObservers returns a copy of the current observers list. It is safe to -// call concurrently. Notably, it is not part of the observerManager interface. -func (com *channelObserverManager[V]) copyObservers() (observers []*channelObserver[V]) { - defer com.observersMu.RUnlock() - - // This loop blocks on acquiring a read lock on observersMu. If TryRLock - // fails, the loop continues until it succeeds. This is intended to give - // callers a guarantee that this copy operation won't contribute to a deadlock. - com.observersMu.RLock() - - observers = make([]*channelObserver[V], len(com.observers)) - copy(observers, com.observers) - - return observers -} diff --git a/pkg/observable/channel/observer_test.go b/pkg/observable/channel/observer_test.go deleted file mode 100644 index 034541c85..000000000 --- a/pkg/observable/channel/observer_test.go +++ /dev/null @@ -1,89 +0,0 @@ -package channel - -import ( - "context" - "sync" - "testing" - "time" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/observable" -) - -func TestObserver_Unsubscribe(t *testing.T) { - var ( - publishCh = make(chan int, 1) - onUnsubscribeCalled = false - onUnsubscribe = func(toRemove observable.Observer[int]) { - onUnsubscribeCalled = true - } - ) - obsvr := &channelObserver[int]{ - observerMu: &sync.RWMutex{}, - // using a buffered channel to keep the test synchronous - observerCh: publishCh, - onUnsubscribe: onUnsubscribe, - } - - // should initially be open - require.Equal(t, false, obsvr.isClosed) - - publishCh <- 1 - require.Equal(t, false, obsvr.isClosed) - - obsvr.Unsubscribe() - // should be isClosed after `#Unsubscribe()` - require.Equal(t, true, obsvr.isClosed) - require.True(t, onUnsubscribeCalled) -} - -func TestObserver_ConcurrentUnsubscribe(t *testing.T) { - var ( - publishCh = make(chan int, 1) - onUnsubscribeCalled = false - onUnsubscribe = func(toRemove observable.Observer[int]) { - onUnsubscribeCalled = true - } - ) - - obsvr := &channelObserver[int]{ - ctx: context.Background(), - observerMu: &sync.RWMutex{}, - // using a buffered channel to keep the test synchronous - observerCh: publishCh, - onUnsubscribe: onUnsubscribe, - } - - require.Equal(t, false, obsvr.isClosed, "observer channel should initially be open") - - // concurrently & continuously publish until the test cleanup runs - done := make(chan struct{}, 1) - go func() { - for idx := 0; ; idx++ { - // return when done receives; otherwise, - select { - case <-done: - return - default: - } - - // publish a value - obsvr.notify(idx) - - // Slow this loop to prevent bogging the test down. - time.Sleep(10 * time.Microsecond) - } - }() - // send on done when the test cleans up - t.Cleanup(func() { done <- struct{}{} }) - - // it should still be open after a bit of inactivity - time.Sleep(time.Millisecond) - require.Equal(t, false, obsvr.isClosed) - - obsvr.Unsubscribe() - // should be isClosed after `#Unsubscribe()` - require.Equal(t, true, obsvr.isClosed) - require.True(t, onUnsubscribeCalled) -} diff --git a/pkg/observable/channel/replay.go b/pkg/observable/channel/replay.go deleted file mode 100644 index 6f3284089..000000000 --- a/pkg/observable/channel/replay.go +++ /dev/null @@ -1,243 +0,0 @@ -package channel - -import ( - "context" - "sync" - "time" - - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/polylog" -) - -// replayPartialBufferTimeout is the duration to wait for the replay buffer to -// accumulate at least 1 value before returning the accumulated values. -// TODO_CONSIDERATION: perhaps this should be parameterized. -const replayPartialBufferTimeout = 100 * time.Millisecond - -var ( - _ observable.ReplayObservable[any] = (*replayObservable[any])(nil) - _ observable.Observable[any] = (*replayObservable[any])(nil) -) - -type replayObservable[V any] struct { - // embed observerManager to encapsulate concurrent-safe read/write access to - // observers. This also allows higher-level objects to wrap this observable - // without knowing its specific type by asserting that it implements the - // observerManager interface. - observerManager[V] - // replayBufferSize is the number of notifications to buffer so that they - // can be replayed to new observers. - replayBufferSize int - // replayBufferMu protects replayBuffer from concurrent access/updates. - replayBufferMu sync.RWMutex - // replayBuffer holds the last relayBufferSize number of notifications received - // by this observable. This buffer is replayed to new observers, on subscribing, - // prior to any new notifications being propagated. - replayBuffer []V -} - -// NewReplayObservable returns a new ReplayObservable with the given replay buffer -// replayBufferSize and the corresponding publish channel to notify it of new values. -func NewReplayObservable[V any]( - ctx context.Context, - replayBufferSize int, - opts ...option[V], -) (observable.ReplayObservable[V], chan<- V) { - obsvbl, publishCh := NewObservable[V](opts...) - return ToReplayObservable[V](ctx, replayBufferSize, obsvbl), publishCh -} - -// ToReplayObservable returns an observable which replays the last replayBufferSize -// number of values published to the source observable to new observers, before -// publishing new values. -// It panics if srcObservable does not implement the observerManager interface. -// It should only be used with a srcObservable which contains channelObservers -// (i.e. channelObservable or similar). -func ToReplayObservable[V any]( - ctx context.Context, - replayBufferSize int, - srcObsvbl observable.Observable[V], -) observable.ReplayObservable[V] { - // Assert that the source observable implements the observerMngr required - // to embed and wrap it. - observerMngr := srcObsvbl.(observerManager[V]) - - replayObsvbl := &replayObservable[V]{ - observerManager: observerMngr, - replayBufferSize: replayBufferSize, - replayBuffer: make([]V, 0, replayBufferSize), - } - - srcObserver := srcObsvbl.Subscribe(ctx) - go replayObsvbl.goBufferReplayNotifications(srcObserver) - - return replayObsvbl -} - -// Last synchronously returns the last n values from the replay buffer. It blocks -// until at least 1 notification has been accumulated, then waits replayPartialBufferTimeout -// duration before returning all notifications accumulated notifications by that time. -// If the replay buffer contains at least n notifications, this function will only -// block as long as it takes to accumulate and return them. -// If n is greater than the replay buffer size, the entire replay buffer is returned. -func (ro *replayObservable[V]) Last(ctx context.Context, n int) []V { - logger := polylog.Ctx(ctx) - - // Use a temporary observer to accumulate replay values. - // Subscribe will always start with the replay buffer, so we can safely - // leverage it here for synchronization (i.e. blocking until at least 1 - // notification has been accumulated). This also eliminates the need for - // locking and/or copying the replay buffer. - tempObserver := ro.Subscribe(ctx) - defer tempObserver.Unsubscribe() - - // If n is greater than the replay buffer size, return the entire replay buffer. - if n > ro.replayBufferSize { - n = ro.replayBufferSize - logger.Warn(). - Int("requested_replay_buffer_size", n). - Int("replay_buffer_capacity", cap(ro.replayBuffer)). - Msg("requested replay buffer size is greater than replay buffer capacity; returning entire replay buffer") - } - - // accumulateReplayValues works concurrently and returns a context and cancellation - // function for signaling completion. - return accumulateReplayValues(tempObserver, n) -} - -// Subscribe returns an observer which is notified when the publishCh channel -// receives a value. -func (ro *replayObservable[V]) Subscribe(ctx context.Context) observable.Observer[V] { - ro.replayBufferMu.RLock() - defer ro.replayBufferMu.RUnlock() - - observer := NewObserver[V](ctx, ro.observerManager.remove) - - // Replay all buffered replayBuffer to the observer channel buffer before - // any new values have an opportunity to send on observerCh (i.e. appending - // observer to ro.observers). - // - // TODO_IMPROVE: this assumes that the observer channel buffer is large enough - // to hold all replay (buffered) notifications. - for _, notification := range ro.replayBuffer { - observer.notify(notification) - } - - ro.observerManager.add(observer) - - // caller can rely on context cancellation or call UnsubscribeAll() to unsubscribe - // active observers - if ctx != nil { - // asynchronously wait for the context to be done and then unsubscribe - // this observer. - go ro.observerManager.goUnsubscribeOnDone(ctx, observer) - } - - return observer -} - -// UnsubscribeAll unsubscribes and removes all observers from the observable. -func (ro *replayObservable[V]) UnsubscribeAll() { - ro.observerManager.removeAll() -} - -// goBufferReplayNotifications buffers the last n notifications from a source -// observer. It is intended to be run in a goroutine. -func (ro *replayObservable[V]) goBufferReplayNotifications(srcObserver observable.Observer[V]) { - for notification := range srcObserver.Ch() { - ro.replayBufferMu.Lock() - // Add the notification to the buffer. - if len(ro.replayBuffer) < ro.replayBufferSize { - ro.replayBuffer = append(ro.replayBuffer, notification) - } else { - // buffer full, make room for the new notification by removing the - // oldest notification. - ro.replayBuffer = append(ro.replayBuffer[1:], notification) - } - ro.replayBufferMu.Unlock() - } -} - -// accumulateReplayValues synchronously (but concurrently) accumulates n values -// from the observer channel into the slice pointed to by accValues and then returns -// said slice. It cancels the context either when n values have been accumulated -// or when at least 1 value has been accumulated and replayPartialBufferTimeout -// has elapsed. -func accumulateReplayValues[V any](observer observable.Observer[V], n int) []V { - var ( - // accValuesMu protects accValues from concurrent access. - accValuesMu sync.Mutex - // Accumulate replay values in a new slice to avoid (read) locking replayBufferMu. - accValues = new([]V) - // canceling the context will cause the loop in the goroutine to exit. - ctx, cancel = context.WithCancel(context.Background()) - ) - - // Concurrently accumulate n values from the observer channel. - go func() { - // Defer canceling the context and unlocking accValuesMu. The function - // assumes that the mutex is locked when it gets execution control back - // from the loop. - defer func() { - cancel() - accValuesMu.Unlock() - }() - for { - // Lock the mutex to read accValues here and potentially write in - // the first case branch in the select below. - accValuesMu.Lock() - - // The context was canceled since the last iteration. - if ctx.Err() != nil { - return - } - - // We've accumulated n values. - if len(*accValues) >= n { - return - } - - // Receive from the observer's channel if we can, otherwise let - // the loop run. - select { - // Receiving from the observer channel blocks if replayBuffer is empty. - case value, ok := <-observer.Ch(): - // tempObserver was closed concurrently. - if !ok { - return - } - - // Update the accumulated values pointed to by accValues. - *accValues = append(*accValues, value) - default: - // If we can't receive from the observer channel immediately, - // let the loop run. - } - - // Unlock accValuesMu so that the select below gets a chance to check - // the length of *accValues to decide whether to cancel, and it can - // be relocked at the top of the loop as it must be locked when the - // loop exits. - accValuesMu.Unlock() - // Wait a tick before continuing the loop. - time.Sleep(time.Millisecond) - } - }() - - // Wait for N values to be accumulated or timeout. When timing out, if we - // have at least 1 value, we can return it. Otherwise, we need to wait for - // the next value to be published (i.e. continue the loop). - for { - select { - case <-ctx.Done(): - return *accValues - case <-time.After(replayPartialBufferTimeout): - accValuesMu.Lock() - if len(*accValues) > 1 { - cancel() - return *accValues - } - accValuesMu.Unlock() - } - } -} diff --git a/pkg/observable/channel/replay_test.go b/pkg/observable/channel/replay_test.go deleted file mode 100644 index 6e01f123e..000000000 --- a/pkg/observable/channel/replay_test.go +++ /dev/null @@ -1,240 +0,0 @@ -package channel_test - -import ( - "context" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/testutil/testerrors" -) - -func TestReplayObservable(t *testing.T) { - var ( - replayBufferSize = 3 - values = []int{1, 2, 3, 4, 5} - // the replay buffer is full and has shifted out values with index < - // len(values)-replayBufferSize so Last should return values starting - // from there. - expectedValues = values[len(values)-replayBufferSize:] - errCh = make(chan error, 1) - ctx, cancel = context.WithCancel(context.Background()) - ) - t.Cleanup(cancel) - - // NB: intentionally not using NewReplayObservable() to test ToReplayObservable() directly - // and to retain a reference to the wrapped observable for testing. - obsvbl, publishCh := channel.NewObservable[int]() - replayObsvbl := channel.ToReplayObservable[int](ctx, replayBufferSize, obsvbl) - - // vanilla observer, should be able to receive all values published after subscribing - observer := obsvbl.Subscribe(ctx) - go func() { - for _, expected := range values { - select { - case v := <-observer.Ch(): - if !assert.Equal(t, expected, v) { - errCh <- testerrors.ErrAsync - return - } - case <-time.After(1 * time.Second): - t.Errorf("Did not receive expected value %d in time", expected) - errCh <- testerrors.ErrAsync - return - } - } - }() - - // send all values to the observable's publish channel - for _, value := range values { - time.Sleep(10 * time.Microsecond) - publishCh <- value - time.Sleep(10 * time.Microsecond) - } - - // allow some time for values to be buffered by the replay observable - time.Sleep(time.Millisecond) - - // replay observer, should receive the last lastN values published prior to - // subscribing followed by subsequently published values - replayObserver := replayObsvbl.Subscribe(ctx) - - // Collect values from replayObserver. - var actualValues []int - for _, expected := range expectedValues { - select { - case v := <-replayObserver.Ch(): - actualValues = append(actualValues, v) - case <-time.After(1 * time.Second): - t.Fatalf("Did not receive expected value %d in time", expected) - } - } - - require.EqualValues(t, expectedValues, actualValues) - - // Second replay observer, should receive the same values as the first - // even though it subscribed after all values were published and the - // values were already replayed by the first. - replayObserver2 := replayObsvbl.Subscribe(ctx) - - // Collect values from replayObserver2. - var actualValues2 []int - for _, expected := range expectedValues { - select { - case v := <-replayObserver2.Ch(): - actualValues2 = append(actualValues2, v) - case <-time.After(1 * time.Second): - t.Fatalf("Did not receive expected value %d in time", expected) - } - } - - require.EqualValues(t, expectedValues, actualValues) -} - -func TestReplayObservable_Last_Full_ReplayBuffer(t *testing.T) { - values := []int{1, 2, 3, 4, 5} - tests := []struct { - name string - replayBufferSize int - // lastN is the number of values to return from the replay buffer - lastN int - expectedValues []int - }{ - { - name: "n < replayBufferSize", - replayBufferSize: 5, - lastN: 3, - // the replay buffer is not full so Last should return values - // starting from the first published value. - expectedValues: values[:3], // []int{1, 2, 3}, - }, - { - name: "n = replayBufferSize", - replayBufferSize: 5, - lastN: 5, - expectedValues: values, - }, - { - name: "n > replayBufferSize", - replayBufferSize: 3, - lastN: 5, - // the replay buffer is full so Last should return values starting - // from lastN - replayBufferSize. - expectedValues: values[2:], // []int{3, 4, 5}, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - var ctx = context.Background() - - replayObsvbl, publishCh := - channel.NewReplayObservable[int](ctx, tt.replayBufferSize) - - for _, value := range values { - publishCh <- value - time.Sleep(time.Millisecond) - } - - actualValues := replayObsvbl.Last(ctx, tt.lastN) - require.ElementsMatch(t, tt.expectedValues, actualValues) - }) - } -} - -func TestReplayObservable_Last_Blocks_And_Times_Out(t *testing.T) { - var ( - replayBufferSize = 5 - lastN = 5 - // splitIdx is the index at which this test splits the set of values. - // The two groups of values are published at different points in the - // test to test the behavior of Last under different conditions. - splitIdx = 3 - values = []int{1, 2, 3, 4, 5} - ctx = context.Background() - ) - - replayObsvbl, publishCh := channel.NewReplayObservable[int](ctx, replayBufferSize) - - // getLastValues is a helper function which returns a channel that will - // receive the result of a call to Last, the method under test. - getLastValues := func() chan []int { - lastValuesCh := make(chan []int, 1) - go func() { - // Last should block until lastN values have been published. - // NOTE: this will produce a warning log which can safely be ignored: - // > WARN: requested replay buffer size 3 is greater than replay buffer - // > capacity 3; returning entire replay buffer - lastValuesCh <- replayObsvbl.Last(ctx, lastN) - }() - return lastValuesCh - } - - // Ensure that last blocks when the replay buffer is empty - select { - case actualValues := <-getLastValues(): - t.Fatalf( - "Last should block until at lest 1 value has been published; actualValues: %v", - actualValues, - ) - case <-time.After(10 * time.Millisecond): - } - - // Publish some values (up to splitIdx). - for _, value := range values[:splitIdx] { - publishCh <- value - time.Sleep(time.Millisecond) - } - - // Ensure Last works as expected when n <= len(published_values). - require.ElementsMatch(t, []int{1}, replayObsvbl.Last(ctx, 1)) - require.ElementsMatch(t, []int{1, 2}, replayObsvbl.Last(ctx, 2)) - require.ElementsMatch(t, []int{1, 2, 3}, replayObsvbl.Last(ctx, 3)) - - // Ensure that Last blocks when n > len(published_values) and the replay - // buffer is not full. - select { - case actualValues := <-getLastValues(): - t.Fatalf( - "Last should block until replayPartialBufferTimeout has elapsed; received values: %v", - actualValues, - ) - default: - t.Log("OK: Last is blocking, as expected") - } - - // Ensure that Last returns the correct values when n > len(published_values) - // and the replay buffer is not full. - select { - case actualValues := <-getLastValues(): - require.ElementsMatch(t, values[:splitIdx], actualValues) - case <-time.After(250 * time.Millisecond): - t.Fatal("timed out waiting for Last to return") - } - - // Publish the rest of the values (from splitIdx on). - for _, value := range values[splitIdx:] { - publishCh <- value - time.Sleep(time.Millisecond) - } - - // Ensure that Last doesn't block when n = len(published_values) and the - // replay buffer is full. - select { - case actualValues := <-getLastValues(): - require.Len(t, actualValues, lastN) - require.ElementsMatch(t, values, actualValues) - case <-time.After(50 * time.Millisecond): - t.Fatal("timed out waiting for Last to return") - } - - // Ensure that Last still works as expected when n <= len(published_values). - require.ElementsMatch(t, []int{1}, replayObsvbl.Last(ctx, 1)) - require.ElementsMatch(t, []int{1, 2}, replayObsvbl.Last(ctx, 2)) - require.ElementsMatch(t, []int{1, 2, 3}, replayObsvbl.Last(ctx, 3)) - require.ElementsMatch(t, []int{1, 2, 3, 4}, replayObsvbl.Last(ctx, 4)) - require.ElementsMatch(t, []int{1, 2, 3, 4, 5}, replayObsvbl.Last(ctx, 5)) -} diff --git a/pkg/observable/errors.go b/pkg/observable/errors.go deleted file mode 100644 index c34f2f7d6..000000000 --- a/pkg/observable/errors.go +++ /dev/null @@ -1,8 +0,0 @@ -package observable - -import errorsmod "cosmossdk.io/errors" - -var ( - ErrObserverClosed = errorsmod.Register(codespace, 1, "observer is closed") - codespace = "observable" -) diff --git a/pkg/observable/filter/either.go b/pkg/observable/filter/either.go deleted file mode 100644 index 86e3d57ab..000000000 --- a/pkg/observable/filter/either.go +++ /dev/null @@ -1,62 +0,0 @@ -package filter - -import ( - "context" - - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" -) - -// EitherError operates on an observable of an either type. It filters for all -// eithers which are not populated with errors, and maps them to their errors -// (publishes errors to the resulting observable). -func EitherError[T any]( - ctx context.Context, - eitherObservable observable.Observable[either.Either[T]], -) observable.Observable[error] { - return channel.Map( - ctx, - eitherObservable, - mapEitherError[T], - ) -} - -// EitherSuccess operates on an observable of an either type. It filters for all -// eithers which are not populated with values, and maps them to their values -// (publishes values to the resulting observable). -func EitherSuccess[T any]( - ctx context.Context, - eitherObservable observable.Observable[either.Either[T]], -) observable.Observable[T] { - return channel.Map( - ctx, - eitherObservable, - mapEitherSuccess[T], - ) -} - -// mapEitherError is a MapFn that maps an either to its error. It skips the -// notification if the either is populated with a value. -func mapEitherError[T any]( - _ context.Context, - inputEither either.Either[T], -) (_ error, skip bool) { - if _, err := inputEither.ValueOrError(); err != nil { - return err, false - } - return nil, true -} - -// mapEitherSuccess is a MapFn that maps an either to its value. It skips the -// notification if the either is populated with an error. -func mapEitherSuccess[T any]( - _ context.Context, - inputEither either.Either[T], -) (_ T, skip bool) { - value, err := inputEither.ValueOrError() - if err != nil { - return value, true - } - return value, false -} diff --git a/pkg/observable/interface.go b/pkg/observable/interface.go deleted file mode 100644 index d86da414f..000000000 --- a/pkg/observable/interface.go +++ /dev/null @@ -1,41 +0,0 @@ -package observable - -import "context" - -// NOTE: We explicitly decided to write a small and custom notifications package -// to keep logic simple and minimal. If the needs & requirements of this library ever -// grow, other packages (e.g. https://github.com/ReactiveX/RxGo) can be considered. -// (see: https://github.com/ReactiveX/RxGo/pull/377) - -// ReplayObservable is an observable which replays the last n values published -// to new observers, before publishing new values to observers. -type ReplayObservable[V any] interface { - Observable[V] - // Last synchronously returns the last n values from the replay buffer. - Last(ctx context.Context, n int) []V -} - -// Observable is a generic interface that allows multiple subscribers to be -// notified of new values asynchronously. -// It is analogous to a publisher in a "Fan-Out" system design. -type Observable[V any] interface { - // Subscribe returns an observer which is notified when the publishCh channel - // receives a value. - Subscribe(context.Context) Observer[V] - // UnsubscribeAll unsubscribes and removes all observers from the observable. - UnsubscribeAll() -} - -// Observer is a generic interface that provides access to the notified -// channel and allows unsubscribing from an Observable. -// It is analogous to a subscriber in a "Fan-Out" system design. -type Observer[V any] interface { - // Unsubscribe closes the subscription channel and removes the subscription from - // the observable. - Unsubscribe() - // Ch returns a receive-only subscription channel. - Ch() <-chan V - // IsClosed returns true if the observer has been unsubscribed. - // A closed observer cannot be reused. - IsClosed() bool -} diff --git a/pkg/observable/logging/logging.go b/pkg/observable/logging/logging.go deleted file mode 100644 index 97f7e6c1b..000000000 --- a/pkg/observable/logging/logging.go +++ /dev/null @@ -1,22 +0,0 @@ -package logging - -import ( - "context" - - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/polylog" -) - -// LogErrors operates on an observable of errors. It logs all errors received -// from the observable. -func LogErrors(ctx context.Context, errs observable.Observable[error]) { - channel.ForEach(ctx, errs, forEachErrorLogError) -} - -// forEachErrorLogError is a ForEachFn that logs the given error. -func forEachErrorLogError(ctx context.Context, err error) { - logger := polylog.Ctx(ctx) - // Logging the error and flushing (i.e. sending) the log message to stdout - logger.Error().Err(err).Send() -} diff --git a/pkg/observable/types.go b/pkg/observable/types.go deleted file mode 100644 index 04df98201..000000000 --- a/pkg/observable/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package observable - -type ( - Error = Observable[error] -) diff --git a/pkg/partials/errors.go b/pkg/partials/errors.go deleted file mode 100644 index 8f3d84885..000000000 --- a/pkg/partials/errors.go +++ /dev/null @@ -1,11 +0,0 @@ -package partials - -import ( - sdkerrors "cosmossdk.io/errors" -) - -var ( - codespace = "partial" - ErrPartialInvalidPayload = sdkerrors.Register(codespace, 1, "invalid partial payload") - ErrPartialUnrecognisedRequestFormat = sdkerrors.Register(codespace, 2, "unrecognised request format in partial payload") -) diff --git a/pkg/partials/interface.go b/pkg/partials/interface.go deleted file mode 100644 index 6a014ad98..000000000 --- a/pkg/partials/interface.go +++ /dev/null @@ -1,32 +0,0 @@ -package partials - -import ( - "context" - - "github.com/pokt-network/poktroll/pkg/partials/payloads" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -var ( - _ PartialPayload = (*payloads.PartialJSONPayload)(nil) - _ PartialPayload = (*payloads.PartialRESTPayload)(nil) -) - -// PartialPayload defines an interface for partial RPC payloads that enables the -// transparent relaying of RPC requests from applications to suppliers. In order -// for this to occur we must be able to infer its format. This requires the RPC -// payload to be partially decoded, extracting the required fields, currently -// limited for the purpose of determine the RPC type, compute units and error -// generation, but may be used for other logic in the future -type PartialPayload interface { - // GetRPCType returns the request type for the given payload. - GetRPCType() sharedtypes.RPCType - // GenerateErrorPayload creates an error message from the provided error - // compatible with the protocol of this RPC type. - GenerateErrorPayload(err error) ([]byte, error) - // GetRPCComputeUnits returns the compute units for the RPC request - GetRPCComputeUnits(ctx context.Context) (uint64, error) - // ValidateBasic ensures that all the required fields are set in the partial - // payload. - ValidateBasic(ctx context.Context) error -} diff --git a/pkg/partials/partial.go b/pkg/partials/partial.go deleted file mode 100644 index 1e699c1b4..000000000 --- a/pkg/partials/partial.go +++ /dev/null @@ -1,71 +0,0 @@ -package partials - -import ( - "context" - - "github.com/pokt-network/poktroll/pkg/partials/payloads" - "github.com/pokt-network/poktroll/pkg/polylog" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// GetRequestType returns the request type for the given payload. -func GetRequestType(ctx context.Context, payloadBz []byte) (sharedtypes.RPCType, error) { - partialRequest, err := PartiallyUnmarshalRequest(ctx, payloadBz) - if err != nil { - return sharedtypes.RPCType_UNKNOWN_RPC, err - } - // if the request has missing fields return an error detailing which fields - // are missing as they are required - if err := partialRequest.ValidateBasic(ctx); err != nil { - return partialRequest.GetRPCType(), - ErrPartialInvalidPayload.Wrapf("payload: %s [%v]", string(payloadBz), err) - } - return partialRequest.GetRPCType(), nil -} - -// GetErrorReply returns an error reply for the given payload and error, -// in the correct format required by the request type. -func GetErrorReply(ctx context.Context, payloadBz []byte, err error) ([]byte, error) { - partialRequest, er := PartiallyUnmarshalRequest(ctx, payloadBz) - if er != nil { - return nil, er - } - return partialRequest.GenerateErrorPayload(err) -} - -// GetComputeUnits returns the compute units for the RPC request provided -func GetComputeUnits(ctx context.Context, payloadBz []byte) (uint64, error) { - partialRequest, err := PartiallyUnmarshalRequest(ctx, payloadBz) - if err != nil { - return 0, err - } - // if the request has missing fields return an error detailing - // which fields are missing - if err := partialRequest.ValidateBasic(ctx); err != nil { - return 0, ErrPartialInvalidPayload.Wrapf("payload: %s [%v]", string(payloadBz), err) - } - return partialRequest.GetRPCComputeUnits(ctx) -} - -// TODO_BLOCKER(@h5law): This function currently only supports JSON-RPC and must -// be extended to other request types. -// PartiallyUnmarshalRequest unmarshals the payload into a partial request -// that contains only the fields necessary to generate an error response and -// handle accounting for the request's method. -func PartiallyUnmarshalRequest(ctx context.Context, payloadBz []byte) (PartialPayload, error) { - logger := polylog.Ctx(ctx) - logger.Debug(). - Str("payload", string(payloadBz)). - Msg("partially Unmarshalling request") - // First attempt to unmarshal the payload into a partial JSON-RPC request - - jsonPayload, err := payloads.PartiallyUnmarshalJSONPayload(payloadBz) - if err != nil { - return nil, ErrPartialInvalidPayload.Wrapf("json payload: %s [%v]", string(payloadBz), err) - } - if jsonPayload != nil { - return jsonPayload, nil - } - // TODO(@h5law): Handle other request types - return nil, ErrPartialUnrecognisedRequestFormat.Wrapf("got: %s", string(payloadBz)) -} diff --git a/pkg/partials/partials_test.go b/pkg/partials/partials_test.go deleted file mode 100644 index 84c749b2a..000000000 --- a/pkg/partials/partials_test.go +++ /dev/null @@ -1,87 +0,0 @@ -package partials - -import ( - "context" - "encoding/json" - "errors" - "testing" - - sdkerror "cosmossdk.io/errors" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/polylog/polyzero" - "github.com/pokt-network/poktroll/testutil/testpolylog" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// TODO(@h5law): Expand coverage with more test cases when more request types -// are implemented in the partials package. -func TestPartials_GetErrorReply(t *testing.T) { - _, logCtx := testpolylog.NewLoggerWithCtx( - context.Background(), - polyzero.DebugLevel, - ) - - tests := []struct { - name string - err error - payload []byte - expectedReply []byte - expectedErr *sdkerror.Error - }{ - { - name: "valid json - properly formatted payload", - err: errors.New("test error"), - payload: []byte( - `{"id":1,"jsonrpc":"2.0","method":"eth_getBlockNumber","params":{"these":"are","ignored":0}}`, - ), - expectedReply: []byte( - `{"id":1,"jsonrpc":"2.0","error":{"code":-32000,"data":null,"message":"test error"}}`, - ), - expectedErr: nil, - }, - { - name: "invalid json - unrecognised payload", - err: errors.New("test error"), - payload: []byte(`{"invalid": "payload"}`), - expectedReply: nil, - expectedErr: ErrPartialUnrecognisedRequestFormat, - }, - { - name: "invalid - unrecognised payload", - err: errors.New("test error"), - payload: []byte("invalid payload"), - expectedReply: nil, - expectedErr: ErrPartialUnrecognisedRequestFormat, - }, - } - - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - // Generate the error reply - replyBz, err := GetErrorReply(logCtx, test.payload, test.err) - if test.expectedErr != nil { - require.ErrorIs(t, err, test.expectedErr) - return - } - require.NoError(t, err) - // Unmarshal the payload to test reply equality - partialReq, err := PartiallyUnmarshalRequest(logCtx, test.payload) - require.NoError(t, err) - require.NotNil(t, partialReq) - switch partialReq.GetRPCType() { - case sharedtypes.RPCType_JSON_RPC: - reply := make(map[string]any) - err = json.Unmarshal(replyBz, &reply) - require.NoError(t, err) - expectedReply := make(map[string]any) - err = json.Unmarshal(test.expectedReply, &expectedReply) - require.NoError(t, err) - for k, v := range expectedReply { - require.Equal(t, v, reply[k]) - } - require.Equal(t, len(reply), len(expectedReply)) - } - }) - } -} diff --git a/pkg/partials/payloads/godoc.go b/pkg/partials/payloads/godoc.go deleted file mode 100644 index fe74c19a4..000000000 --- a/pkg/partials/payloads/godoc.go +++ /dev/null @@ -1,8 +0,0 @@ -// Package payloads contains the different types of RPC payloads the partials -// package supports. The structs defined here are used to partially unmarshal -// the payload and extract the minimal fields required to: generate error -// responses, retrieve RPC request type, determine request compute units, etc... -// This is done through partially unmarshalling the payload into the minimum -// required set of pre-defined fields that need to be explicitly determined for -// each RPC type supported. -package payloads diff --git a/pkg/partials/payloads/jsonrpc.go b/pkg/partials/payloads/jsonrpc.go deleted file mode 100644 index 284a6f40c..000000000 --- a/pkg/partials/payloads/jsonrpc.go +++ /dev/null @@ -1,82 +0,0 @@ -package payloads - -import ( - "context" - "encoding/json" - "errors" - - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/x/shared/types" -) - -// PartialJSONPayload is a partial representation of a JSON-RPC request payload -// that contains the minimal fields necessary for basic business logic such as -// generating an error response, handling request account, etc... -type PartialJSONPayload struct { - Id uint64 `json:"id"` - JsonRPC string `json:"jsonrpc"` - Method string `json:"method"` -} - -// ValidateBasic ensures that all the required fields are set in the partial -// JSON payload. -// It uses a non-pointer receiver to ensure the default values of unset fields -// are present -func (j PartialJSONPayload) ValidateBasic(ctx context.Context) error { - logger := polylog.Ctx(ctx) - - var err error - if j.Id == 0 { - err = errors.Join(err, errors.New("id field is zero")) - } - if j.JsonRPC == "" { - err = errors.Join(err, errors.New("jsonrpc version field is empty")) - } - if j.Method == "" { - err = errors.Join(err, errors.New("method field is empty")) - } - logger.Debug().Err(err).Msg("Validating basic JSON payload") - return err -} - -// PartiallyUnmarshalJSONPayload receives a serialized payload and attempts to -// unmarshal it into the PartialJSONPayload struct. If successful this struct -// is returned, if however the struct does not contain all the required fields -// an error is returned detailing what was missing. -// If the payload is not a JSON request this function will return nil, nil -func PartiallyUnmarshalJSONPayload(payloadBz []byte) (*PartialJSONPayload, error) { - var jsonPayload PartialJSONPayload - err := json.Unmarshal(payloadBz, &jsonPayload) - // Check if we can unmarshal if we cannot return nil, nil - if err != nil || jsonPayload == (PartialJSONPayload{}) { - return nil, nil - } - // return the partial json request - return &jsonPayload, nil -} - -// GetRPCType returns the request type for the given payload. -func (j *PartialJSONPayload) GetRPCType() types.RPCType { - return types.RPCType_JSON_RPC -} - -// GenerateErrorPayload creates a JSON-RPC error payload from the provided -// error with the macthing json-rpc and id fields from the request payload. -func (j *PartialJSONPayload) GenerateErrorPayload(err error) ([]byte, error) { - reply := map[string]any{ - "jsonrpc": j.JsonRPC, - "id": j.Id, - "error": map[string]any{ - "code": -32000, - "message": err.Error(), - "data": nil, - }, - } - return json.Marshal(reply) -} - -// GetRPCComputeUnits returns the compute units for the RPC request -func (j *PartialJSONPayload) GetRPCComputeUnits(ctx context.Context) (uint64, error) { - // TODO(@h5law): Implement this method - return 0, nil -} diff --git a/pkg/partials/payloads/rest.go b/pkg/partials/payloads/rest.go deleted file mode 100644 index 273139280..000000000 --- a/pkg/partials/payloads/rest.go +++ /dev/null @@ -1,51 +0,0 @@ -package payloads - -import ( - "context" - - "github.com/pokt-network/poktroll/x/shared/types" -) - -// PartialRESTPayload is a partial representation of a REST request payload -// that contains the minimal fields necessary for basic business logic such as -// generating an error response, handling request account, etc... -type PartialRESTPayload struct { - Headers map[string]string `json:"headers"` -} - -// PartiallyUnmarshalRESTPayload receives a serialized payload and attempts to -// unmarshal it into the PartialRESTPayload struct. If successful this struct -// is returned, if however the struct does not contain all the required fields -// the success return value is false and a nil payload is returned. -func PartiallyUnmarshalRESTPayload(payloadBz []byte) (restPayload *PartialRESTPayload, success bool) { - // TODO(@h5law): Implement this function - return nil, false -} - -// ValidateBasic ensures that all the required fields are set in the partial -// REST payload. -// It uses a non-pointer receiver to ensure the default values of unset fields -// are present -func (r PartialRESTPayload) ValidateBasic(ctx context.Context) error { - // TODO(@h5law): Implement this function - var err error - return err -} - -// GetRPCType returns the request type for the given payload. -func (r *PartialRESTPayload) GetRPCType() types.RPCType { - return types.RPCType_REST -} - -// GenerateErrorPayload creates a REST error payload using the headers from the -// request payload. -func (r *PartialRESTPayload) GenerateErrorPayload(err error) ([]byte, error) { - // TODO(@h5law): Implement this method - return nil, nil -} - -// GetRPCComputeUnits returns the compute units for the RPC request -func (r *PartialRESTPayload) GetRPCComputeUnits(ctx context.Context) (uint64, error) { - // TODO(@h5law): Implement this method - return 0, nil -} diff --git a/pkg/polylog/LICENSE b/pkg/polylog/LICENSE deleted file mode 100644 index 3914913fc..000000000 --- a/pkg/polylog/LICENSE +++ /dev/null @@ -1,32 +0,0 @@ -The `Logger` and `Event` interfaces follow the `zerolog` package's API 1:1 -(possibly partially) to make zerolog implementation/integration become the -thinnest wrapper possible. - -This is the API intended for all off-chain (i.e. under `/pkg`) logging. - -The following is the MIT LICENSE from `zerolog` package at the time of writing: -(see: https://github.com/rs/zerolog) - ---- - -MIT License - -Copyright (c) 2017 Olivier Poitrey - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/pkg/polylog/context.go b/pkg/polylog/context.go deleted file mode 100644 index 0e6904b64..000000000 --- a/pkg/polylog/context.go +++ /dev/null @@ -1,39 +0,0 @@ -package polylog - -import "context" - -// CtxKey is the key used to store the polylog.Logger in a context.Context. This -// is **independant** of any logger-implementation-specific context key that may -// be used internal to any of the logger implementations. Polylog attempts to -// provide a ubiquitous interface for storing and retrieving loggers from the -// context but also to integrate with the underlying logger implementations as -// seamlessly as possible. -const CtxKey = "polylog/context" - -// DefaultContextLogger is the default logger implementation used when no logger -// is associated with a context. It is assigned in the implementation package's -// init() function to avoid potentially creating import cycles. -// The default logger implementation is zerolog (i.e. pkg/polylog/polyzero). -// -// IMPORTANT: In order for the default to be populated, the polyzero package MUST -// be part of the build. Otherwise, the polyzero package's init function will -// neither be included in the build nor executed. If no such import exists, the -// polyzero package can be imported for side effects only, e.g.: -// -// import _ "github.com/pokt-network/poktroll/pkg/polylog/polyzero" -var DefaultContextLogger Logger - -// Ctx returns the Logger associated with the ctx. If no logger is associated, -// DefaultContextLogger is returned, unless DefaultContextLogger is nil, in which -// case a disabled logger is returned. -// -// To get a context which is associated a given logger, call the respective logger's -// #WithContext() method. Then this function can be used to retrieve it from that -// (or a context derived from that) context, later and elsewhere. -func Ctx(ctx context.Context) Logger { - logger, ok := ctx.Value(CtxKey).(Logger) - if !ok { - return DefaultContextLogger - } - return logger -} diff --git a/pkg/polylog/context_example_test.go b/pkg/polylog/context_example_test.go deleted file mode 100644 index 11f979ae4..000000000 --- a/pkg/polylog/context_example_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package polylog_test - -import ( - "context" - "os" - - "github.com/rs/zerolog" - - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/polylog/polyzero" -) - -func ExampleCtx() { - // Use whichever zerolog level you need. - level := zerolog.InfoLevel - - // Specify the lowest level to log. I.e.: calls to level methods "lower" - // than this will be ignored. - levelOpt := polyzero.WithLevel(level) - - // Construct a context, this is typically received as an argument. - ctx := context.Background() - - // Construct expectedLogger. - // NB: adding WithOutput is optional; defaults to os.Stderr. It is needed - // here to print to stdout for testable example purposes. - expectedLogger := polyzero.NewLogger(levelOpt, polyzero.WithOutput(os.Stdout)) - - // Add fields to the expectedLogger's context so that we can identify it in the output. - expectedLogger = expectedLogger.With("label", "my_test_logger") - - // Associate the expectedLogger with the context and update the context reference. - ctx = expectedLogger.WithContext(ctx) - - // Retrieve the logger from the context. - retrievedLogger := polylog.Ctx(ctx) - - // Log and check that the output matches our expectations. - retrievedLogger.Info().Msg("info message") - - // Output: - // {"level":"info","label":"my_test_logger","message":"info message"} -} diff --git a/pkg/polylog/context_test.go b/pkg/polylog/context_test.go deleted file mode 100644 index d37201249..000000000 --- a/pkg/polylog/context_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package polylog_test - -import ( - "context" - "testing" - - "github.com/rs/zerolog" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/polylog/polyzero" -) - -func TestWithContext_Ctx(t *testing.T) { - var ( - expectedLogger = polyzero.NewLogger() - ctx = context.Background() - ) - - // Ensure that no logger is associated with the context. - existingLogger, ok := ctx.Value(polylog.CtxKey).(polylog.Logger) - require.False(t, ok) - require.Nil(t, existingLogger) - - // Retrieve the default logger from the context using polylog and assert - // that it matches the default context logger. - defaultLogger := polylog.Ctx(ctx) - require.Equal(t, polylog.DefaultContextLogger, defaultLogger) - - // Associate a logger with a context. - ctx = expectedLogger.WithContext(ctx) - - // Retrieve the associated logger from the context using polylog and assert - // that it matches the one constructed at the beginning of the test. - actualLogger := polylog.Ctx(ctx) - require.Equal(t, expectedLogger, actualLogger) - - // Retrieve the associated logger from the context using zerolog and assert - // that it matches the one constructed at the beginning of the test. - actualZerologLogger := zerolog.Ctx(ctx) - expectedZerologLogger := polyzero.GetZerologLogger(expectedLogger) - require.Equal(t, expectedZerologLogger, actualZerologLogger) -} diff --git a/pkg/polylog/godoc.go b/pkg/polylog/godoc.go deleted file mode 100644 index e3f759007..000000000 --- a/pkg/polylog/godoc.go +++ /dev/null @@ -1,17 +0,0 @@ -// Package polylog provides a ubiquitous logging interface which is derived from -// github.com/rs/zerolog, and as a result, also highly compatibly with other -// common, industry-standard logging libraries. This API mirrors that of zerolog -// but exists as a distinct layer of abstraction, and an extremely thin wrapper -// around the underlying logging library; especially in the case of the zerolog -// implementation. This distinction is intended to allow for evolution of the needs -// of this packages consumers as well as any future ambitions to (and implications -// thereof) adding support for adapting to additional logging libraries. -// -// It is intended to initially support the go std `log`, `github.com/rs/zerolog` and `go.uber.org/zap` logging libraries: -// -// - https://pkg.go.dev/log@go1.21.4 -// -// - https://github.com/rs/zerolog -// -// - https://github.com/uber-go/zap -package polylog diff --git a/pkg/polylog/interface.go b/pkg/polylog/interface.go deleted file mode 100644 index b4ef28457..000000000 --- a/pkg/polylog/interface.go +++ /dev/null @@ -1,193 +0,0 @@ -package polylog - -import ( - "context" - "time" -) - -// TODO_CONSIDERATION: this may be a good candidate package for extraction to -// its own module. - -// TODO_INVESTIGATE: check whether the pkg dependency tree includes all logging -// libraries. - -// Level is the minimal interface required to express and convert between log levels -// of the underlying logging libraries. -type Level interface { - // String returns the string representation of the underlying Level. - String() string - // Int returns the int representation of the underlying Level. Level types are - // typically defined as enums of a concrete type that implement #String(). - Int() int -} - -// Logger is an interface that exposes methods for each supported log level, each -// of which returns an Event. -type Logger interface { - // Debug starts a new log message (event) with debug level. - // - // You must call Msg on the returned event in order to send the event. - Debug() Event - - // Info starts a new log message (event) with info level. - // - // You must call Msg on the returned event in order to send the event. - Info() Event - - // Warn starts a new log message (event) with warn level. - // - // You must call Msg on the returned event in order to send the event. - Warn() Event - - // Error starts a new log message (event) with error level. - // - // You must call Msg on the returned event in order to send the event. - Error() Event - - // With creates a child logger with the fields constructed from keyVals added - // to its context. - With(keyVals ...any) Logger - - // WithContext returns a copy of ctx with the receiver attached. The Logger - // attached to the provided Context (if any) will not be effected. If the - // receiver's log level is Disabled it will only be attached to the returned - // Context if the provided Context has a previously attached Logger. If the - // provided Context has no attached Logger, a Disabled Logger will not be - // attached. - // - // TODO_IMPROVE/TODO_COMMUNITY: support #UpdateContext() and update this - // godoc to include #UpdateContext() usage example. - // See: https://pkg.go.dev/github.com/rs/zerolog#Logger.UpdateContext. - WithContext(ctx context.Context) context.Context - - // WithLevel starts a new message (event) with level. - // - // You must call Msg on the returned event in order to send the event. - WithLevel(level Level) Event - - // Write implements the io.Writer interface. This is useful to set as a writer - // for the standard library log. - Write(p []byte) (n int, err error) -} - -// Event represents a log event. It is instanced by one of the level methods of -// Logger and finalized by the Msg, Msgf, or Send methods. It exposes methods for -// adding fields to the event which will be rendered in an encoding-appropriate -// way in the log output. -// -// TODO_IMPROVE/TODO_COMMUNITY: support #Dict(), #Stack(), #Any() type methods. -// See: https://pkg.go.dev/github.com/rs/zerolog#Event -// -// TODO_IMPROVE/TODO_COMMUNITY: support #Ctx() and #GetCtx() methods. -// See: https://pkg.go.dev/github.com/rs/zerolog#Event.Ctx and -// https://pkg.go.dev/github.com/rs/zerolog#Event.Ctx. -type Event interface { - // Str adds the field key with value as a string to the Event context. - Str(key, value string) Event - - // Bool adds the field key with value as a bool to the Event context. - Bool(key string, value bool) Event - - // Int adds the field key with value as an int to the Event context. - Int(key string, value int) Event - - // Int8 adds the field key with value as an int8 to the Event context. - Int8(key string, value int8) Event - - // Int16 adds the field key with value as an int16 to the Event context. - Int16(key string, value int16) Event - - // Int32 adds the field key with value as an int32 to the Event context. - Int32(key string, value int32) Event - - // Int64 adds the field key with value as an int64 to the Event context. - Int64(key string, value int64) Event - - // Uint adds the field key with value as a uint to the Event context. - Uint(key string, value uint) Event - - // Uint8 adds the field key with value as a uint8 to the Event context. - Uint8(key string, value uint8) Event - - // Uint16 adds the field key with value as a uint16 to the Event context. - Uint16(key string, value uint16) Event - - // Uint32 adds the field key with value as a uint32 to the Event context. - Uint32(key string, value uint32) Event - - // Uint64 adds the field key with value as a uint64 to the Event context. - Uint64(key string, value uint64) Event - - // Float32 adds the field key with value as a float32 to the Event context. - Float32(key string, value float32) Event - - // Float64 adds the field key with value as a float64 to the Event context. - Float64(key string, value float64) Event - - // Err adds the field "error" with serialized err to the Event context. - // If err is nil, no field is added. - // - // TODO_TEST: ensure implementation tests cover this: do not add a field - // if err is nil. - // - // To customize the key name, use the appropriate option from the respective - // package when constructing a logger. - // - // TODO_UPNEXT(@bryanchriswhite): ensure implementations' godoc examples cover - // options. - Err(err error) Event - - // Timestamp adds the current local time as UNIX timestamp to the Event context - // with the "time" key. To customize the key name, use the appropriate option - // from the respective package when constructing a Logger. - // - // TODO_UPNEXT(@bryanchriswhite): ensure implementations' godoc examples cover - // options. - // - // NOTE: It won't dedupe the "time" key if the Event (or *Context) has one - // already. - Timestamp() Event - - // Time adds the field key with value formatted as string using a configurable, - // implementation-specific format. - // - // To customize the time format, use the appropriate option from the respective - // package when constructing a Logger. - Time(key string, value time.Time) Event - - // Dur adds the field key with duration with a configurable, - // implementation-specific value format. - Dur(key string, value time.Duration) Event - - // Fields is a helper function to use a map or slice to set fields using type assertion. - // Only map[string]interface{} and []interface{} are accepted. []interface{} must - // alternate string keys and arbitrary values, and extraneous ones are ignored. - Fields(fields any) Event - - // Func allows an anonymous func to run only if the event is enabled. - Func(func(Event)) Event - - // Enabled return false if the Event is going to be filtered out by - // log level or sampling. - Enabled() bool - - // Discard disables the event so Msg(f)/Send won't print it. - Discard() Event - - // Msg sends the Event with msg added as the message field if not empty. - // - // NOTICE: once this method is called, the Event should be disposed. - // Calling Msg twice can have unexpected result. - Msg(message string) - - // Msgf sends the event with formatted msg added as the message field if not empty. - // - // NOTICE: once this method is called, the Event should be disposed. - // Calling Msgf twice can have unexpected result. - Msgf(format string, keyVals ...interface{}) - - // Send is equivalent to calling Msg(""). - // - // NOTICE: once this method is called, the Event should be disposed. - Send() -} diff --git a/pkg/polylog/polyzero/default.go b/pkg/polylog/polyzero/default.go deleted file mode 100644 index 905cf7c2c..000000000 --- a/pkg/polylog/polyzero/default.go +++ /dev/null @@ -1,15 +0,0 @@ -package polyzero - -import "github.com/pokt-network/poktroll/pkg/polylog" - -func init() { - // Set the default logger to a polyzero logger. This is the logger which will - // be returned when calling polylog.Ctx() with a context which has no logger - // associated. - // - // This is assigned here to avoid an import cycle. Note that dependency init - // functions are called before dependents. It is therefore safe to override - // this default logger assignment in polylog consumer code, including in - // consumer package init functions. - polylog.DefaultContextLogger = NewLogger() -} diff --git a/pkg/polylog/polyzero/event.go b/pkg/polylog/polyzero/event.go deleted file mode 100644 index 58a78df8a..000000000 --- a/pkg/polylog/polyzero/event.go +++ /dev/null @@ -1,205 +0,0 @@ -package polyzero - -import ( - "time" - - "github.com/rs/zerolog" - - "github.com/pokt-network/poktroll/pkg/polylog" -) - -var _ polylog.Event = (*zerologEvent)(nil) - -// zerologEvent is a thin wrapper around a zerolog event. -type zerologEvent struct { - event *zerolog.Event -} - -// Str adds the field key with value as a string to the Event context. -func (zle *zerologEvent) Str(key, value string) polylog.Event { - zle.event.Str(key, value) - return zle -} - -// Bool adds the field key with value as a bool to the Event context. -func (zle *zerologEvent) Bool(key string, value bool) polylog.Event { - zle.event.Bool(key, value) - return zle -} - -// Int adds the field key with value as an int to the Event context. -func (zle *zerologEvent) Int(key string, value int) polylog.Event { - zle.event.Int(key, value) - return zle -} - -// Int8 adds the field key with value as an int8 to the Event context. -func (zle *zerologEvent) Int8(key string, value int8) polylog.Event { - zle.event.Int8(key, value) - return zle -} - -// Int16 adds the field key with value as an int16 to the Event context. -func (zle *zerologEvent) Int16(key string, value int16) polylog.Event { - zle.event.Int16(key, value) - return zle -} - -// Int32 adds the field key with value as an int32 to the Event context. -func (zle *zerologEvent) Int32(key string, value int32) polylog.Event { - zle.event.Int32(key, value) - return zle -} - -// Int64 adds the field key with value as an int64 to the Event context. -func (zle *zerologEvent) Int64(key string, value int64) polylog.Event { - zle.event.Int64(key, value) - return zle -} - -// Uint adds the field key with value as an uint to the Event context. -func (zle *zerologEvent) Uint(key string, value uint) polylog.Event { - zle.event.Uint(key, value) - return zle -} - -// Uint8 adds the field key with value as an uint8 to the Event context. -func (zle *zerologEvent) Uint8(key string, value uint8) polylog.Event { - zle.event.Uint8(key, value) - return zle -} - -// Uint16 adds the field key with value as an uint16 to the Event context. -func (zle *zerologEvent) Uint16(key string, value uint16) polylog.Event { - zle.event.Uint16(key, value) - return zle -} - -// Uint32 adds the field key with value as an uint32 to the Event context. -func (zle *zerologEvent) Uint32(key string, value uint32) polylog.Event { - zle.event.Uint32(key, value) - return zle -} - -// Uint64 adds the field key with value as an uint64 to the Event context. -func (zle *zerologEvent) Uint64(key string, value uint64) polylog.Event { - zle.event.Uint64(key, value) - return zle -} - -// Float32 adds the field key with value as a float32 to the Event context. -func (zle *zerologEvent) Float32(key string, value float32) polylog.Event { - zle.event.Float32(key, value) - return zle -} - -// Float64 adds the field key with value as a float64 to the Event context. -func (zle *zerologEvent) Float64(key string, value float64) polylog.Event { - zle.event.Float64(key, value) - return zle -} - -// Err adds the field "error" with serialized err to the Event context. -// If err is nil, no field is added. -// -// To customize the key name, change zerolog.ErrorFieldName. This can be done -// directly or by using the WithErrKey() option when constructing the logger. -// -// If Stack() has been called before and zerolog.ErrorStackMarshaler is defined, -// the err is passed to ErrorStackMarshaler and the result is appended to the -// zerolog.ErrorStackFieldName. -func (zle *zerologEvent) Err(err error) polylog.Event { - zle.event.Err(err) - return zle -} - -// Timestamp adds the current local time as UNIX timestamp to the Event context -// with the "time" key. -// To customize the key name, change zerolog.TimestampFieldName. This can be done directly or via -// the WithTimestampKey() option when constructing the logger. -// -// NOTE: It won't dedupe the "time" key if the Event (or *Context) has one -// already. -func (zle *zerologEvent) Timestamp() polylog.Event { - zle.event.Timestamp() - return zle -} - -// Time adds the field key with value formatted as string using zerolog.TimeFieldFormat. -func (zle *zerologEvent) Time(key string, value time.Time) polylog.Event { - zle.event.Time(key, value) - return zle -} - -// Dur adds the field key with duration value stored as zerolog.DurationFieldUnit. -// If zerolog.DurationFieldInteger is true, durations are rendered as integer -// instead of float. -func (zle *zerologEvent) Dur(key string, value time.Duration) polylog.Event { - zle.event.Dur(key, value) - return zle -} - -// Func allows an anonymous func to run only if the event is enabled. -func (zle *zerologEvent) Func(fn func(polylog.Event)) polylog.Event { - // NB: no need to call #Enabled() here because the underlying zerolog.Event - // will do that for us. - if zle.Enabled() { - zle.event.Func( - func(event *zerolog.Event) { - fn(newEvent(event)) - }, - ) - } - return zle -} - -// Fields is a helper function to use a map or slice to set fields using type -// assertion. Only map[string]any and []any are accepted. any must alternate -// string keys and arbitrary values, and extraneous ones are ignored. -func (zle *zerologEvent) Fields(fields any) polylog.Event { - zle.event.Fields(fields) - return zle -} - -// Enabled return false if the Event is going to be filtered out by -// log level or sampling. -func (zle *zerologEvent) Enabled() bool { - return zle.event.Enabled() -} - -// Discard disables the event so Msg(f)/Send won't print it. -func (zle *zerologEvent) Discard() polylog.Event { - zle.event.Discard() - return zle -} - -// Msg sends the Event with msg added as the message field if not empty. -// -// NOTICE: once this method is called, the Event should be disposed. -// Calling Msg twice can have unexpected result. -func (zle *zerologEvent) Msg(msg string) { - zle.event.Msg(msg) -} - -// Msgf sends the event with formatted msg added as the message field if not empty. -// -// NOTICE: once this method is called, the Event should be disposed. -// Calling Msgf twice can have unexpected result. -func (zle *zerologEvent) Msgf(format string, args ...any) { - zle.event.Msgf(format, args...) -} - -// Send is equivalent to calling Msg(""). It can be thought of as a Flush. -// -// NOTICE: once this method is called, the Event should be disposed. -func (zle *zerologEvent) Send() { - zle.event.Send() -} - -// newEvent takes a zerolog event pointer and wraps it in a polylog.zerologEvent -// struct. -func newEvent(event *zerolog.Event) polylog.Event { - return &zerologEvent{ - event: event, - } -} diff --git a/pkg/polylog/polyzero/godoc.go b/pkg/polylog/polyzero/godoc.go deleted file mode 100644 index 4410dd8e9..000000000 --- a/pkg/polylog/polyzero/godoc.go +++ /dev/null @@ -1,9 +0,0 @@ -// Package polyzero provides a polylog.Logger implementation backed by zerolog. -// As the polylogger interface mirrors that of zerolog, this package is a thin -// wrapper around the zerolog package. However, it is only a partial mapping of -// the full zerolog API, and has already begun to deviate a bit to be more -// accommodating to other supported logging libraries. -// -// Use polyzero if you don't have a preference for a particular logging library -// or are already using zerolog. -package polyzero diff --git a/pkg/polylog/polyzero/levels.go b/pkg/polylog/polyzero/levels.go deleted file mode 100644 index e2880711c..000000000 --- a/pkg/polylog/polyzero/levels.go +++ /dev/null @@ -1,47 +0,0 @@ -package polyzero - -import ( - "github.com/rs/zerolog" - - "github.com/pokt-network/poktroll/pkg/polylog" -) - -// TODO_TECHDEBT: support a Disabled level. -const ( - // DebugLevel logs are typically voluminous, and are usually disabled in - // production. - DebugLevel = Level(iota) - // InfoLevel is the default logging priority. - InfoLevel - // WarnLevel logs are more important than Info, but don't need individual - // human review. - WarnLevel - // ErrorLevel logs are high-priority. If an application is running smoothly, - // it shouldn't generate any error-level logs. - ErrorLevel -) - -var _ polylog.Level = Level(0) - -// Level implements the polylog.Level interface for zerolog levels. -type Level int - -// Levels is a convenience function to return all supported levels. -func Levels() []Level { - return []Level{ - DebugLevel, - InfoLevel, - WarnLevel, - ErrorLevel, - } -} - -// String implements polylog.Level#String(). -func (lvl Level) String() string { - return zerolog.Level(lvl).String() -} - -// Int implements polylog.Level#Int(). -func (lvl Level) Int() int { - return int(lvl) -} diff --git a/pkg/polylog/polyzero/logger.go b/pkg/polylog/polyzero/logger.go deleted file mode 100644 index 8c908fd0f..000000000 --- a/pkg/polylog/polyzero/logger.go +++ /dev/null @@ -1,109 +0,0 @@ -package polyzero - -import ( - "context" - "os" - - "github.com/rs/zerolog" - - "github.com/pokt-network/poktroll/pkg/polylog" -) - -// zerologLogger is a thin wrapper around a zerolog logger which implements -// the polylog.Logger interface. -type zerologLogger struct { - // NB: Default (0) is Debug. - level zerolog.Level - zerolog.Logger -} - -// NewLogger constructs a new zerolog-backed logger which conforms to the -// polylog.Logger interface. By default, the logger is configured to write to -// os.Stderr and log at the Debug level. -// -// TODO_IMPROVE/TODO_COMMUNITY: Add `NewProductionLogger`, `NewDevelopmentLogger`, -// and `NewExampleLogger` functions with reasonable defaults the their respective -// environments; conceptually similar to the respective analogues in zap. -// See: https://pkg.go.dev/github.com/uber-go/zap#hdr-Configuring_Zap. -func NewLogger( - opts ...polylog.LoggerOption, -) polylog.Logger { - ze := &zerologLogger{ - level: zerolog.DebugLevel, - Logger: zerolog.New(os.Stderr), - } - - for _, opt := range opts { - opt(ze) - } - - return ze -} - -// Debug starts a new message with debug level. -// -// You must call Msg on the returned event in order to send the event. -func (ze *zerologLogger) Debug() polylog.Event { - return newEvent(ze.Logger.Debug()) -} - -// Info starts a new message with info level. -// -// You must call Msg, Msgf, or Send on the returned event in order to send the event. -func (ze *zerologLogger) Info() polylog.Event { - return newEvent(ze.Logger.Info()) -} - -// Warn starts a new message with warn level. -// -// You must call Msg, Msgf, or Send on the returned event in order to send the event. -func (ze *zerologLogger) Warn() polylog.Event { - return newEvent(ze.Logger.Warn()) -} - -// Error starts a new message with error level. -// -// You must call Msg, Msgf, or Send on the returned event in order to send the event. -func (ze *zerologLogger) Error() polylog.Event { - return newEvent(ze.Logger.Error()) -} - -// With creates a child logger with the fields constructed from keyVals added -// to its context. -func (ze *zerologLogger) With(keyVals ...any) polylog.Logger { - return &zerologLogger{ - level: ze.level, - Logger: ze.Logger.With().Fields(keyVals).Logger(), - } -} - -// WithLevel starts a new message with level. -// -// You must call Msg, Msgf, or Send on the returned event in order to send the event. -func (ze *zerologLogger) WithLevel(level polylog.Level) polylog.Event { - return newEvent(ze.Logger.WithLevel(zerolog.Level(level.Int()))) -} - -// WithContext returns a copy of ctx with the receiver logger attached. -// - The Logger attached to the provided Context (if any) will not be effected. -// - If the receiver's log level is Disabled, it will only be attached to the returned -// Context if the provided Context has a previously attached Logger. -// - If the provided Context has no attached Logger, a Disabled Logger -// will not be attached. -// -// TODO_TEST/TODO_COMMUNITY: add support for #UpdateContext() and update this -// godoc to inlude example usage. -// See: https://pkg.go.dev/github.com/rs/zerolog#Logger.WithContext. -// -// TODO_TEST/TODO_COMMUNITY: add coverage for `polyzero.Logger#WithContext()`. -func (ze *zerologLogger) WithContext(ctx context.Context) context.Context { - ctx = context.WithValue(ctx, polylog.CtxKey, ze) - ctx = ze.Logger.WithContext(ctx) - return ctx -} - -// Write implements io.Writer. This is useful to set as a writer for the -// standard library log. -func (ze *zerologLogger) Write(p []byte) (n int, err error) { - return ze.Logger.Write(p) -} diff --git a/pkg/polylog/polyzero/logger_example_test.go b/pkg/polylog/polyzero/logger_example_test.go deleted file mode 100644 index 7534026d6..000000000 --- a/pkg/polylog/polyzero/logger_example_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package polyzero_test - -import ( - "os" - - "github.com/rs/zerolog" - - "github.com/pokt-network/poktroll/pkg/polylog/polyzero" -) - -func ExampleNewLogger() { - // Use whichever zerolog level you need. - level := zerolog.InfoLevel - // Specify the lowest level to log. I.e.: calls to level methods "lower" - // than this will be ignored. - levelOpt := polyzero.WithLevel(level) - - // Construct logger. - // NB: adding WithOutput is optional; defaults to os.Stderr. It is needed - // here to print to stdout for testable example purposes. - logger := polyzero.NewLogger(levelOpt, polyzero.WithOutput(os.Stdout)) - - // All level methods are always available, but will only log if the level - // is enabled. - logger.Debug().Msg("debug message - should not see me") - logger.Info().Msgf("info message with %s", "formatting") - logger.Warn().Str("warn", "message").Send() - // NB: arg type MUST be either map[string]any OR []any. - logger.Error().Fields(map[string]any{ - "error": "message", - }).Send() - - // Output: - // {"level":"info","message":"info message with formatting"} - // {"level":"warn","warn":"message"} - // {"level":"error","error":"message"} -} diff --git a/pkg/polylog/polyzero/logger_test.go b/pkg/polylog/polyzero/logger_test.go deleted file mode 100644 index c55668d41..000000000 --- a/pkg/polylog/polyzero/logger_test.go +++ /dev/null @@ -1,392 +0,0 @@ -package polyzero_test - -import ( - "bytes" - "fmt" - "testing" - "time" - - "github.com/rs/zerolog" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/polylog/polyzero" - "github.com/pokt-network/poktroll/testutil/testpolylog" -) - -const polyzeroEventTypeName = "*polyzero.zerologEvent" - -var ( - expectedErr = fmt.Errorf("%d", 42) - expectedTime = time.Now() - // expectedTimestampDayPrecisionLayout is a "layout" which is described using - // the "reference time", as per the time package usage convention. - // See: https://golang.org/pkg/time/#pkg-constants for more details on "layouts" and the "reference time". - // - // NB: #Timestamp() uses time.Now() internally. If the test is run around the - // rollover of a second, minute, or hour, the expected timestamp time may not - // match the actual time precisely enough. While this is still a possibility - // near the rollover of a day, this window occurs less frequently and is many - // multiples of the time it takes CI to run. - // - // TODO_CONSIDERATION: redesign the test helper to support regular expressions - // for the output expectation. - expectedTimestampDayPrecisionLayout = "2006-01-02T" - expectedTimeLayout = "2006-01-02T15:04:05-07:00" - expectedTimestampEventContains = fmt.Sprintf(`"time":"%s`, expectedTime.Format(expectedTimestampDayPrecisionLayout)) - expectedTimeEventContains = fmt.Sprintf(`"Time":"%s`, expectedTime.Format(expectedTimeLayout)) - expectedDuration = time.Millisecond + (250 * time.Nanosecond) // 1000250 - expectedDurationString = expectedDuration.String()[:len(expectedDuration.String())-2] // 1.00025 - expectedDurationEventContains = fmt.Sprintf(`"Dur":%s`, expectedDurationString) -) - -func TestZerologLogger_AllLevels_AllEventTypeMethods(t *testing.T) { - tests := []testpolylog.EventMethodTestCase{ - { - // Explicitly left empty; no event method should be called. - EventMethodName: "", - Msg: "Msg", - ExpectedOutputContains: "Msg", - }, - { - // Explicitly left empty; no event method should be called. - EventMethodName: "", - MsgFmt: "%s", - MsgFmtArgs: []any{"Msgf"}, - ExpectedOutputContains: "Msgf", - }, - { - Key: "Str", - Value: "str_value", - EventMethodName: "Str", - ExpectedOutputContains: `"Str":"str_value"`, - }, - { - Key: "Bool", - Value: true, - EventMethodName: "Bool", - ExpectedOutputContains: `"Bool":true`, - }, - { - EventMethodName: "Int", - Key: "Int", - Value: int(42), - ExpectedOutputContains: `"Int":42`, - }, - { - EventMethodName: "Int8", - Key: "Int8", - Value: int8(42), - ExpectedOutputContains: `"Int8":42`, - }, - { - EventMethodName: "Int16", - Key: "Int16", - Value: int16(42), - ExpectedOutputContains: `"Int16":42`, - }, - { - EventMethodName: "Int32", - Key: "Int32", - Value: int32(42), - ExpectedOutputContains: `"Int32":42`, - }, - { - EventMethodName: "Int64", - Key: "Int64", - Value: int64(42), - ExpectedOutputContains: `"Int64":42`, - }, - { - EventMethodName: "Uint", - Key: "Uint", - Value: uint(42), - ExpectedOutputContains: `"Uint":42`, - }, - { - EventMethodName: "Uint8", - Key: "Uint8", - Value: uint8(42), - ExpectedOutputContains: `"Uint8":42`, - }, - { - Key: "Uint16", - ExpectedOutputContains: `"Uint16":42`, - Value: uint16(42), - EventMethodName: "Uint16", - }, - { - EventMethodName: "Uint32", - Key: "Uint32", - Value: uint32(42), - ExpectedOutputContains: `"Uint32":42`, - }, - { - EventMethodName: "Uint64", - Key: "Uint64", - Value: uint64(42), - ExpectedOutputContains: `"Uint64":42`, - }, - { - EventMethodName: "Float32", - Key: "Float32", - Value: float32(420.69), - ExpectedOutputContains: `"Float32":420.69`, - }, - { - EventMethodName: "Float64", - Key: "Float64", - Value: float64(420.69), - ExpectedOutputContains: `"Float64":420.69`, - }, - { - EventMethodName: "Err", - Value: expectedErr, - ExpectedOutputContains: `"error":"42"`, - }, - { - EventMethodName: "Timestamp", - ExpectedOutputContains: expectedTimestampEventContains, - }, - // TODO_TECHDEBT: figure out why this fails in CI but not locally, - // (even with `make itest 500 10 ./pkg/polylog/... -- -run=ZeroLogger_AllLevels_AllEventTypeMethods`). - // - //{ - // EventMethodName: "Time", - // Key: "Time", - // Value: expectedTime, - // ExpectedOutputContains: expectedTimeEventContains, - //}, - { - EventMethodName: "Dur", - Key: "Dur", - Value: expectedDuration, - ExpectedOutputContains: expectedDurationEventContains, - }, - { - EventMethodName: "Fields", - Value: map[string]any{ - "key1": "value1", - "key2": 42, - }, - ExpectedOutputContains: `"key1":"value1","key2":42`, - }, - { - EventMethodName: "Fields", - Value: []any{"key1", "value1", "key2", 42}, - ExpectedOutputContains: `"key1":"value1","key2":42`, - }, - } - - for _, level := range polyzero.Levels() { - testpolylog.RunEventMethodTests( - t, - level, - tests, - newTestLogger, - newTestEventWithLevel, - getExpectedLevelOutputContains, - ) - } -} - -func TestZerologLogger_Levels_Discard(t *testing.T) { - // Construct a logger with each level. With each logger, log an event at each - // level and assert that the event is logged if and only if the event level - // is GTE the logger level. - for _, loggerLevel := range polyzero.Levels() { - testDesc := fmt.Sprintf("%s level logger", loggerLevel.String()) - t.Run(testDesc, func(t *testing.T) { - logger, logOutput := newTestLogger(t, loggerLevel) - - // Log an event for each level. - for _, eventLevel := range polyzero.Levels() { - event := newTestEventWithLevel(t, logger, eventLevel) - // Log the event level string. - event.Msg(eventLevel.String()) - - // If the event level is GTE the logger level, then the event should - // be logged. - if eventLevel.Int() >= loggerLevel.Int() { - require.Truef(t, event.Enabled(), "expected event to be enabled") - require.Contains(t, logOutput.String(), eventLevel.String()) - } else { - require.Falsef(t, event.Enabled(), "expected event to be discarded") - require.NotContains(t, logOutput.String(), eventLevel.String()) - } - } - - // Print log output for manual inspection. - t.Log(logOutput.String()) - }) - } -} - -func TestZerologLogger_Func_Discard_Enabled(t *testing.T) { - for _, loggerLevel := range polyzero.Levels() { - testDesc := fmt.Sprintf("%s loggerLevel logger", loggerLevel.String()) - t.Run(testDesc, func(t *testing.T) { - var ( - notExpectedOutput = "if you're reading this, the test failed" - // Construct a spy which implements a #Fn() method which we can use to - // assert that the function passed to polylog.Event#Func() is called with - // the expected arg(s). - logger, logOutput = newTestLogger(t, loggerLevel) - ) - - for _, eventLevel := range polyzero.Levels() { - funcSpy := testpolylog.EventFuncSpy{} - funcSpy.On("Fn", mock.AnythingOfType(polyzeroEventTypeName)).Return() - - event := newTestEventWithLevel(t, logger, eventLevel) - expectedEventLevelEnabled := eventLevel.Int() >= loggerLevel.Int() - - require.Equalf(t, expectedEventLevelEnabled, event.Enabled(), "expected event to be initially enabled") - - // If the event level is GTE the logger level, then make additional - // assertions about #Func(), #Discard(), and #Enabled() behavior. - if expectedEventLevelEnabled { - // Assert that #Func() calls `funcSpy#Fn()` method 1 time with - // an event whose type name matches funcMethodEventTypeName. - event.Func(funcSpy.Fn) - funcSpy.AssertCalled(t, "Fn", mock.AnythingOfType(polyzeroEventTypeName)) - funcSpy.AssertNumberOfCalls(t, "Fn", 1) - - event.Discard() - require.Falsef(t, event.Enabled(), "expected event to be disabled after Discard()") - - // Assert that #Func() **does not** call `funcSpy#Fn()` method again. - event.Func(funcSpy.Fn) - funcSpy.AssertNumberOfCalls(t, "Fn", 1) - - event.Msg(notExpectedOutput) - require.NotContains(t, logOutput.String(), notExpectedOutput) - } - - // NB: this test doesn't produce any log output as all cases - // exercise discarding. - } - }) - } -} - -func TestZerologLogger_With(t *testing.T) { - logger, logOutput := newTestLogger(t, polyzero.DebugLevel) - - logger.Debug().Msg("before") - require.Contains(t, logOutput.String(), "before") - - logger = logger.With("key", "value") - - logger.Debug().Msg("after") - require.Contains(t, logOutput.String(), "after") - require.Contains(t, logOutput.String(), `"key":"value"`) -} - -func TestZerologLogger_WithLevel(t *testing.T) { - logger, logOutput := newTestLogger(t, polyzero.DebugLevel) - logger.WithLevel(polyzero.DebugLevel).Msg("WithLevel()") - - require.Contains(t, logOutput.String(), "WithLevel()") -} - -func TestZerologLogger_Write(t *testing.T) { - testOutput := "Write()" - logger, logOutput := newTestLogger(t, polyzero.DebugLevel) - - n, err := logger.Write([]byte(testOutput)) - require.NoError(t, err) - require.Lenf(t, testOutput, n, "expected %d bytes to be written", len(testOutput)) - - require.Contains(t, logOutput.String(), testOutput) -} - -func TestWithTimestampKey(t *testing.T) { - expectedTimestampKey := "custom-timestamp-key" - - timestampKeyOpt := polyzero.WithTimestampKey(expectedTimestampKey) - // Reset zerolog timestamp key to default value after test. - t.Cleanup(func() { - zerolog.TimestampFieldName = "time" - }) - logger, logOutput := newTestLogger(t, polyzero.DebugLevel, timestampKeyOpt) - - logger.Debug().Timestamp().Send() - - expectedCustomTimestampEventContains := fmt.Sprintf( - `"%s":"%s`, - expectedTimestampKey, - expectedTime.Format(expectedTimestampDayPrecisionLayout), - ) - require.Contains(t, logOutput.String(), expectedCustomTimestampEventContains) - - // Print log output for manual inspection. - t.Log(logOutput) -} - -func TestWithErrorKey(t *testing.T) { - expectedErrKey := "custom-error-key" - - errorKeyOpt := polyzero.WithErrKey(expectedErrKey) - // Reset zerolog error key to default value after test. - t.Cleanup(func() { - zerolog.ErrorFieldName = "error" - }) - logger, logOutput := newTestLogger(t, polyzero.DebugLevel, errorKeyOpt) - - logger.Debug().Err(expectedErr).Send() - - require.Contains(t, logOutput.String(), expectedErr.Error()) - require.Contains(t, logOutput.String(), expectedErrKey) - - // Print log output for manual inspection. - t.Log(logOutput) -} - -func newTestLogger( - t *testing.T, - level polylog.Level, - opts ...polylog.LoggerOption, -) (polylog.Logger, *bytes.Buffer) { - t.Helper() - - // Redirect standard log output to logOutput buffer. - logOutput := new(bytes.Buffer) - opts = append( - opts, - polyzero.WithOutput(logOutput), - // NB: typically consumers would pass zerolog.Level directly instead. - polyzero.WithLevel(zerolog.Level(level.Int())), - ) - - logger := polyzero.NewLogger(opts...) - - return logger, logOutput -} - -func newTestEventWithLevel( - t *testing.T, - logger polylog.Logger, - level polylog.Level, -) polylog.Event { - t.Helper() - - // Match on level string to determine which level method to call. - switch level.String() { - case zerolog.DebugLevel.String(): - return logger.Debug() - case zerolog.InfoLevel.String(): - return logger.Info() - case zerolog.WarnLevel.String(): - return logger.Warn() - case zerolog.ErrorLevel.String(): - return logger.Error() - default: - panic(fmt.Errorf("level not yet supported: %s", level.String())) - } -} - -func getExpectedLevelOutputContains(level polylog.Level) string { - return fmt.Sprintf(`"level":%q`, level.String()) -} diff --git a/pkg/polylog/polyzero/options.go b/pkg/polylog/polyzero/options.go deleted file mode 100644 index 4fbe18d83..000000000 --- a/pkg/polylog/polyzero/options.go +++ /dev/null @@ -1,51 +0,0 @@ -package polyzero - -import ( - "io" - - "github.com/rs/zerolog" - - "github.com/pokt-network/poktroll/pkg/polylog" -) - -// WithOutput returns an option function that configures the output writer for zerolog. -func WithOutput(output io.Writer) polylog.LoggerOption { - return func(logger polylog.Logger) { - zl := logger.(*zerologLogger).Logger - logger.(*zerologLogger).Logger = zl.Output(output) - } -} - -// WithLevel returns an option function that configures the logger level for zerolog. -func WithLevel(level zerolog.Level) polylog.LoggerOption { - return func(logger polylog.Logger) { - zl := logger.(*zerologLogger).Logger - logger.(*zerologLogger).Logger = zl.Level(level) - } -} - -// WithTimestampKey returns an option function which configures the logger to -// use the given key when `polylog.Event#Timestamp()` is called. -func WithTimestampKey(key string) polylog.LoggerOption { - return func(_ polylog.Logger) { - zerolog.TimestampFieldName = key - } -} - -// WithErrKey returns an option function which configures the logger to use the -// given key when `polylog.Event#Err()` is called. -func WithErrKey(key string) polylog.LoggerOption { - return func(_ polylog.Logger) { - zerolog.ErrorFieldName = key - } -} - -// WithSetupFn takes function which receives the underlying zerolog logger pointer -// and returns an options function that calls it, passing the zerolog logger. -// -// TODO_TEST/TODO_COMMUNITY: add test coverage and example usage around this method. -func WithSetupFn(fn func(logger *zerolog.Logger)) polylog.LoggerOption { - return func(logger polylog.Logger) { - fn(&logger.(*zerologLogger).Logger) - } -} diff --git a/pkg/polylog/polyzero/test_logger.go b/pkg/polylog/polyzero/test_logger.go deleted file mode 100644 index f0c35c89c..000000000 --- a/pkg/polylog/polyzero/test_logger.go +++ /dev/null @@ -1,18 +0,0 @@ -//go:build test - -package polyzero - -import ( - "github.com/rs/zerolog" - - "github.com/pokt-network/poktroll/pkg/polylog" -) - -// GetZerologLogger is a helper function which provides direct access to the -// underlying zerolog logger for testing purposes; e.g. use in assertions. To use -// this helper, ensure that the build tag/constraint "test" is set (e.g. `go build -tags=test`). -// It MUST be defined in this package (as opposed to somewhere in testutils), as -// by definition, it references unexported members of this package. -func GetZerologLogger(polylogger polylog.Logger) *zerolog.Logger { - return &polylogger.(*zerologLogger).Logger -} diff --git a/pkg/polylog/types.go b/pkg/polylog/types.go deleted file mode 100644 index 3ac2ce4a0..000000000 --- a/pkg/polylog/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package polylog - -type LoggerOption func(logger Logger) diff --git a/pkg/relayer/cmd/cmd.go b/pkg/relayer/cmd/cmd.go deleted file mode 100644 index 3e80bbfa3..000000000 --- a/pkg/relayer/cmd/cmd.go +++ /dev/null @@ -1,337 +0,0 @@ -package cmd - -import ( - "context" - "errors" - "fmt" - "net/http" - "net/url" - "os" - - "cosmossdk.io/depinject" - cosmosclient "github.com/cosmos/cosmos-sdk/client" - cosmosflags "github.com/cosmos/cosmos-sdk/client/flags" - cosmostx "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/rs/zerolog" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/cmd/signals" - "github.com/pokt-network/poktroll/pkg/client/supplier" - "github.com/pokt-network/poktroll/pkg/client/tx" - txtypes "github.com/pokt-network/poktroll/pkg/client/tx/types" - "github.com/pokt-network/poktroll/pkg/deps/config" - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/polylog/polyzero" - "github.com/pokt-network/poktroll/pkg/relayer" - relayerconfig "github.com/pokt-network/poktroll/pkg/relayer/config" - "github.com/pokt-network/poktroll/pkg/relayer/miner" - "github.com/pokt-network/poktroll/pkg/relayer/proxy" - "github.com/pokt-network/poktroll/pkg/relayer/session" -) - -// We're `explicitly omitting default` so the relayer crashes if these aren't specified. -const omittedDefaultFlagValue = "explicitly omitting default" - -// TODO_CONSIDERATION: Consider moving all flags defined in `/pkg` to a `flags.go` file. -var ( - // flagRelayMinerConfig is the variable containing the relay miner config filepath - // sourced from the `--config` flag. - flagRelayMinerConfig string - // flagNodeRPCURL is the variable containing the Cosmos node RPC URL flag value. - flagNodeRPCURL string - // flagNodeGRPCURL is the variable containing the Cosmos node GRPC URL flag value. - flagNodeGRPCURL string -) - -// RelayerCmd returns the Cobra command for running the relay miner. -func RelayerCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "relayminer", - Short: "Run a relay miner", - Long: `Run a relay miner. The relay miner process configures and starts -relay servers for each service the supplier actor identified by --signing-key is -staked for (configured on-chain). - -Relay requests received by the relay servers are validated and proxied to their -respective service endpoints, maintained by the relayer off-chain. The responses -are then signed and sent back to the requesting application. - -For each successfully served relay, the miner will hash and compare its difficulty -against an on-chain threshold. If the difficulty is sufficient, it is applicable -to relay volume and therefore rewards. Such relays are inserted into and persisted -via an SMT KV store. The miner will monitor the current block height and periodically -submit claim and proof messages according to the protocol as sessions become eligible -for such operations.`, - RunE: runRelayer, - } - // Custom flags - cmd.Flags().StringVar(&flagRelayMinerConfig, "config", "", "The path to the relayminer config file") - - // Cosmos flags - // TODO_TECHDEBT(#256): Remove unneeded cosmos flags. - cmd.Flags().String(cosmosflags.FlagKeyringBackend, "", "Select keyring's backend (os|file|kwallet|pass|test)") - cmd.Flags().StringVar(&flagNodeRPCURL, cosmosflags.FlagNode, omittedDefaultFlagValue, "Register the default Cosmos node flag, which is needed to initialize the Cosmos query and tx contexts correctly. It can be used to override the `QueryNodeRPCURL` and `TxNodeRPCURL` fields in the config file if specified.") - cmd.Flags().StringVar(&flagNodeGRPCURL, cosmosflags.FlagGRPC, omittedDefaultFlagValue, "Register the default Cosmos node grpc flag, which is needed to initialize the Cosmos query context with grpc correctly. It can be used to override the `QueryNodeGRPCURL` field in the config file if specified.") - cmd.Flags().Bool(cosmosflags.FlagGRPCInsecure, true, "Used to initialize the Cosmos query context with grpc security options. It can be used to override the `QueryNodeGRPCInsecure` field in the config file if specified.") - - return cmd -} - -func runRelayer(cmd *cobra.Command, _ []string) error { - ctx, cancelCtx := context.WithCancel(cmd.Context()) - // Ensure context cancellation. - defer cancelCtx() - - // Handle interrupt and kill signals asynchronously. - signals.GoOnExitSignal(cancelCtx) - - configContent, err := os.ReadFile(flagRelayMinerConfig) - if err != nil { - return err - } - - // TODO_TECHDEBT: add logger level and output options to the config. - relayMinerConfig, err := relayerconfig.ParseRelayMinerConfigs(configContent) - if err != nil { - return err - } - - // TODO_TECHDEBT: populate logger from the config (ideally, from viper). - loggerOpts := []polylog.LoggerOption{ - polyzero.WithLevel(zerolog.DebugLevel), - polyzero.WithOutput(os.Stderr), - } - - // Construct a logger and associate it with the command context. - logger := polyzero.NewLogger(loggerOpts...) - ctx = logger.WithContext(ctx) - cmd.SetContext(ctx) - - // Sets up the following dependencies: - // Miner, EventsQueryClient, BlockClient, cosmosclient.Context, TxFactory, - // TxContext, TxClient, SupplierClient, RelayerProxy, RelayerSessionsManager. - deps, err := setupRelayerDependencies(ctx, cmd, relayMinerConfig) - if err != nil { - return err - } - - relayMiner, err := relayer.NewRelayMiner(ctx, deps) - if err != nil { - return err - } - - // Start the relay miner - logger.Info().Msg("Starting relay miner...") - if err := relayMiner.Start(ctx); err != nil && !errors.Is(err, http.ErrServerClosed) { - return fmt.Errorf("failed to start relay miner: %w", err) - } else if errors.Is(err, http.ErrServerClosed) { - logger.Info().Msg("Relay miner stopped; exiting") - } - return nil -} - -// setupRelayerDependencies sets up all the dependencies the relay miner needs -// to run by building the dependency tree from the leaves up, incrementally -// supplying each component to an accumulating depinject.Config: -// Miner, EventsQueryClient, BlockClient, cosmosclient.Context, TxFactory, TxContext, -// TxClient, SupplierClient, RelayerProxy, RelayerSessionsManager. -func setupRelayerDependencies( - ctx context.Context, - cmd *cobra.Command, - relayMinerConfig *relayerconfig.RelayMinerConfig, -) (deps depinject.Config, err error) { - queryNodeRPCUrl := relayMinerConfig.PocketNode.QueryNodeRPCUrl - queryNodeGRPCUrl := relayMinerConfig.PocketNode.QueryNodeGRPCUrl - txNodeRPCUrl := relayMinerConfig.PocketNode.TxNodeRPCUrl - - // Override the config file's `QueryNodeGRPCUrl` fields - // with the `--grpc-addr` flag if it was specified. - // TODO(#223) Remove this check once viper is used as SoT for overridable config values. - if flagNodeGRPCURL != omittedDefaultFlagValue { - parsedFlagNodeGRPCUrl, err := url.Parse(flagNodeGRPCURL) - if err != nil { - return nil, fmt.Errorf("failed to parse grpc query URL: %w", err) - } - queryNodeGRPCUrl = parsedFlagNodeGRPCUrl - } - - // Override the config file's `QueryNodeUrl` and `txNodeRPCUrl` fields - // with the `--node` flag if it was specified. - // TODO(#223) Remove this check once viper is used as SoT for overridable config values. - if flagNodeRPCURL != omittedDefaultFlagValue { - parsedFlagNodeRPCUrl, err := url.Parse(flagNodeRPCURL) - if err != nil { - return nil, fmt.Errorf("failed to parse rpc query URL: %w", err) - } - queryNodeRPCUrl = parsedFlagNodeRPCUrl - txNodeRPCUrl = parsedFlagNodeRPCUrl - } - - signingKeyName := relayMinerConfig.SigningKeyName - proxiedServiceEndpoints := relayMinerConfig.Proxies - smtStorePath := relayMinerConfig.SmtStorePath - - supplierFuncs := []config.SupplierFn{ - config.NewSupplyLoggerFromCtx(ctx), - config.NewSupplyEventsQueryClientFn(queryNodeRPCUrl), // leaf - config.NewSupplyBlockClientFn(), // leaf - config.NewSupplyQueryClientContextFn(queryNodeGRPCUrl), // leaf - supplyMiner, // leaf - config.NewSupplyTxClientContextFn(queryNodeGRPCUrl, txNodeRPCUrl), // leaf - config.NewSupplyDelegationClientFn(), // leaf - config.NewSupplyAccountQuerierFn(), - config.NewSupplyApplicationQuerierFn(), - config.NewSupplySupplierQuerierFn(), - config.NewSupplySessionQuerierFn(), - config.NewSupplyRingCacheFn(), - supplyTxFactory, - supplyTxContext, - newSupplyTxClientFn(signingKeyName), - newSupplySupplierClientFn(signingKeyName), - newSupplyRelayerProxyFn(signingKeyName, proxiedServiceEndpoints), - newSupplyRelayerSessionsManagerFn(smtStorePath), - } - - return config.SupplyConfig(ctx, cmd, supplierFuncs) -} - -// supplyMiner constructs a Miner instance and returns a new depinject.Config -// which is supplied with the given deps and the new Miner. -func supplyMiner( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, -) (depinject.Config, error) { - mnr, err := miner.NewMiner() - if err != nil { - return nil, err - } - - return depinject.Configs(deps, depinject.Supply(mnr)), nil -} - -// supplyTxFactory constructs a cosmostx.Factory instance and returns a new -// depinject.Config which is supplied with the given deps and the new -// cosmostx.Factory. -func supplyTxFactory( - _ context.Context, - deps depinject.Config, - cmd *cobra.Command, -) (depinject.Config, error) { - var txClientCtx txtypes.Context - if err := depinject.Inject(deps, &txClientCtx); err != nil { - return nil, err - } - - clientCtx := cosmosclient.Context(txClientCtx) - clientFactory, err := cosmostx.NewFactoryCLI(clientCtx, cmd.Flags()) - if err != nil { - return nil, err - } - - return depinject.Configs(deps, depinject.Supply(clientFactory)), nil -} - -func supplyTxContext( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, -) (depinject.Config, error) { - txContext, err := tx.NewTxContext(deps) - if err != nil { - return nil, err - } - - return depinject.Configs(deps, depinject.Supply(txContext)), nil -} - -// newSupplyTxClientFn returns a function which constructs a TxClient -// instance and returns a new depinject.Config which is supplied with -// the given deps and the new TxClient. -func newSupplyTxClientFn(signingKeyName string) config.SupplierFn { - return func( - ctx context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - txClient, err := tx.NewTxClient( - ctx, - deps, - tx.WithSigningKeyName(signingKeyName), - // TODO_TECHDEBT: populate this from some config. - tx.WithCommitTimeoutBlocks(tx.DefaultCommitTimeoutHeightOffset), - ) - if err != nil { - return nil, err - } - - return depinject.Configs(deps, depinject.Supply(txClient)), nil - } -} - -// newSupplySupplierClientFn returns a function which constructs a -// SupplierClient instance and returns a new depinject.Config which is -// supplied with the given deps and the new SupplierClient. -func newSupplySupplierClientFn(signingKeyName string) config.SupplierFn { - return func( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - supplierClient, err := supplier.NewSupplierClient( - deps, - supplier.WithSigningKeyName(signingKeyName), - ) - if err != nil { - return nil, err - } - - return depinject.Configs(deps, depinject.Supply(supplierClient)), nil - } -} - -// newSupplyRelayerProxyFn returns a function which constructs a -// RelayerProxy instance and returns a new depinject.Config which -// is supplied with the given deps and the new RelayerProxy. -func newSupplyRelayerProxyFn( - signingKeyName string, - proxiedServiceEndpoints map[string]*relayerconfig.RelayMinerProxyConfig, -) config.SupplierFn { - return func( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - relayerProxy, err := proxy.NewRelayerProxy( - deps, - proxy.WithSigningKeyName(signingKeyName), - proxy.WithProxiedServicesEndpoints(proxiedServiceEndpoints), - ) - if err != nil { - return nil, err - } - - return depinject.Configs(deps, depinject.Supply(relayerProxy)), nil - } -} - -// newSupplyRelayerSessionsManagerFn returns a function which constructs a -// RelayerSessionsManager instance and returns a new depinject.Config which -// is supplied with the given deps and the new RelayerSessionsManager. -func newSupplyRelayerSessionsManagerFn(smtStorePath string) config.SupplierFn { - return func( - ctx context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - relayerSessionsManager, err := session.NewRelayerSessions( - ctx, deps, - session.WithStoresDirectory(smtStorePath), - ) - if err != nil { - return nil, err - } - - return depinject.Configs(deps, depinject.Supply(relayerSessionsManager)), nil - } -} diff --git a/pkg/relayer/config/errors.go b/pkg/relayer/config/errors.go deleted file mode 100644 index eace596e3..000000000 --- a/pkg/relayer/config/errors.go +++ /dev/null @@ -1,14 +0,0 @@ -package config - -import sdkerrors "cosmossdk.io/errors" - -var ( - codespace = "relayminer_config" - ErrRelayMinerConfigUnmarshalYAML = sdkerrors.Register(codespace, 1, "config reader cannot unmarshal yaml content") - ErrRelayMinerConfigInvalidNodeUrl = sdkerrors.Register(codespace, 2, "invalid node url in RelayMiner config") - ErrRelayMinerConfigInvalidSigningKeyName = sdkerrors.Register(codespace, 3, "invalid signing key name in RelayMiner config") - ErrRelayMinerConfigInvalidSmtStorePath = sdkerrors.Register(codespace, 4, "invalid smt store path in RelayMiner config") - ErrRelayMinerConfigEmpty = sdkerrors.Register(codespace, 5, "empty RelayMiner config") - ErrRelayMinerConfigInvalidSupplier = sdkerrors.Register(codespace, 6, "invalid supplier in RelayMiner config") - ErrRelayMinerConfigInvalidProxy = sdkerrors.Register(codespace, 7, "invalid proxy in RelayMiner config") -) diff --git a/pkg/relayer/config/pocket_node_config_hydrator.go b/pkg/relayer/config/pocket_node_config_hydrator.go deleted file mode 100644 index 88a57fa85..000000000 --- a/pkg/relayer/config/pocket_node_config_hydrator.go +++ /dev/null @@ -1,56 +0,0 @@ -package config - -import "net/url" - -// HydratePocketNodeUrls populates the pocket node fields of the RelayMinerConfig -// that are relevant to the "pocket_node" section in the config file. -func (relayMinerConfig *RelayMinerConfig) HydratePocketNodeUrls( - yamlPocketNodeConfig *YAMLRelayMinerPocketNodeConfig, -) error { - relayMinerConfig.PocketNode = &RelayMinerPocketNodeConfig{} - - if len(yamlPocketNodeConfig.TxNodeRPCUrl) == 0 { - return ErrRelayMinerConfigInvalidNodeUrl.Wrap("tx node rpc url is required") - } - - // Check if the pocket node rpc url is a valid URL - txNodeRPCUrl, err := url.Parse(yamlPocketNodeConfig.TxNodeRPCUrl) - if err != nil { - return ErrRelayMinerConfigInvalidNodeUrl.Wrapf( - "invalid tx node rpc url %s", - err.Error(), - ) - } - relayMinerConfig.PocketNode.TxNodeRPCUrl = txNodeRPCUrl - - // If the query node rpc url is empty, use the tx node rpc url - if len(yamlPocketNodeConfig.QueryNodeRPCUrl) == 0 { - relayMinerConfig.PocketNode.QueryNodeRPCUrl = relayMinerConfig.PocketNode.TxNodeRPCUrl - } else { - // If the query node rpc url is not empty, make sure it is a valid URL - queryNodeRPCUrl, err := url.Parse(yamlPocketNodeConfig.QueryNodeRPCUrl) - if err != nil { - return ErrRelayMinerConfigInvalidNodeUrl.Wrapf( - "invalid query node rpc url %s", - err.Error(), - ) - } - relayMinerConfig.PocketNode.QueryNodeRPCUrl = queryNodeRPCUrl - } - - if len(yamlPocketNodeConfig.QueryNodeGRPCUrl) == 0 { - return ErrRelayMinerConfigInvalidNodeUrl.Wrap("query node grpc url is required") - } - - // Check if the query node grpc url is a valid URL - queryNodeGRPCUrl, err := url.Parse(yamlPocketNodeConfig.QueryNodeGRPCUrl) - if err != nil { - return ErrRelayMinerConfigInvalidNodeUrl.Wrapf( - "invalid query node grpc url %s", - err.Error(), - ) - } - relayMinerConfig.PocketNode.QueryNodeGRPCUrl = queryNodeGRPCUrl - - return nil -} diff --git a/pkg/relayer/config/proxies_config_hydrator.go b/pkg/relayer/config/proxies_config_hydrator.go deleted file mode 100644 index f3b7628ed..000000000 --- a/pkg/relayer/config/proxies_config_hydrator.go +++ /dev/null @@ -1,63 +0,0 @@ -package config - -// HydrateProxies populates the proxies fields of the RelayMinerConfig that -// are relevant to the "proxies" section in the config file. -func (relayMinerConfig *RelayMinerConfig) HydrateProxies( - yamlProxyConfigs []YAMLRelayMinerProxyConfig, -) error { - // At least one proxy is required - if len(yamlProxyConfigs) == 0 { - return ErrRelayMinerConfigInvalidProxy.Wrap("no proxies provided") - } - - relayMinerConfig.Proxies = make(map[string]*RelayMinerProxyConfig) - - for _, yamlProxyConfig := range yamlProxyConfigs { - // Proxy name is required - if len(yamlProxyConfig.ProxyName) == 0 { - return ErrRelayMinerConfigInvalidProxy.Wrap("proxy name is required") - } - - // Proxy name should not be unique - if _, ok := relayMinerConfig.Proxies[yamlProxyConfig.ProxyName]; ok { - return ErrRelayMinerConfigInvalidProxy.Wrapf( - "duplicate porxy name %s", - yamlProxyConfig.ProxyName, - ) - } - - proxyConfig := &RelayMinerProxyConfig{ - ProxyName: yamlProxyConfig.ProxyName, - XForwardedHostLookup: yamlProxyConfig.XForwardedHostLookup, - Suppliers: make(map[string]*RelayMinerSupplierConfig), - } - - // Populate the proxy fields that are relevant to each supported proxy type - switch yamlProxyConfig.Type { - case "http": - if err := proxyConfig.parseHTTPProxyConfig(yamlProxyConfig); err != nil { - return err - } - default: - // Fail if the proxy type is not supported - return ErrRelayMinerConfigInvalidProxy.Wrapf( - "invalid proxy type %s", - yamlProxyConfig.Type, - ) - } - - switch yamlProxyConfig.Type { - case "http": - proxyConfig.Type = ProxyTypeHTTP - default: - ErrRelayMinerConfigInvalidProxy.Wrapf( - "invalid proxy type %s", - yamlProxyConfig.Type, - ) - } - - relayMinerConfig.Proxies[proxyConfig.ProxyName] = proxyConfig - } - - return nil -} diff --git a/pkg/relayer/config/proxy_http_config_parser.go b/pkg/relayer/config/proxy_http_config_parser.go deleted file mode 100644 index a8f655f14..000000000 --- a/pkg/relayer/config/proxy_http_config_parser.go +++ /dev/null @@ -1,73 +0,0 @@ -package config - -import ( - "fmt" - "net/url" -) - -// parseHTTPProxyConfig populates the proxy fields of the target structure that -// are relevant to the "http" type in the proxy section of the config file. -// This function alters the target RelayMinerProxyConfig structure as a side effect. -func (proxyConfig *RelayMinerProxyConfig) parseHTTPProxyConfig( - yamlProxyConfig YAMLRelayMinerProxyConfig, -) error { - // Check if the proxy host is a valid URL. - // Since `yamlProxyConfig.Host` is a string representing the host, we need to - // prepend it with the "http://" scheme to make it a valid URL; we end up - // using the `Host` field of the resulting `url.URL` struct, so the prepended - // scheme is irrelevant. - proxyUrl, err := url.Parse(fmt.Sprintf("http://%s", yamlProxyConfig.Host)) - if err != nil { - return ErrRelayMinerConfigInvalidProxy.Wrapf( - "invalid proxy host %s", - err.Error(), - ) - } - - if proxyUrl.Host == "" { - return ErrRelayMinerConfigInvalidProxy.Wrap("empty proxy host") - } - - proxyConfig.Host = proxyUrl.Host - return nil -} - -// parseHTTPSupplierConfig populates the supplier fields of the target structure -// that are relevant to the "http" type in the supplier section of the config file. -// This function alters the target RelayMinerSupplierServiceConfig structure -// as a side effect. -func (supplierServiceConfig *RelayMinerSupplierServiceConfig) parseHTTPSupplierConfig( - yamlSupplierServiceConfig YAMLRelayMinerSupplierServiceConfig, -) error { - // Check if the supplier url is not empty - if len(yamlSupplierServiceConfig.Url) == 0 { - return ErrRelayMinerConfigInvalidSupplier.Wrap("empty supplier url") - } - - // Check if the supplier url is a valid URL - supplierServiceUrl, err := url.Parse(yamlSupplierServiceConfig.Url) - if err != nil { - return ErrRelayMinerConfigInvalidSupplier.Wrapf( - "invalid supplier url %s", - err.Error(), - ) - } - - supplierServiceConfig.Url = supplierServiceUrl - - // If the Authentication section is not empty, populate the supplier service - // authentication fields - if yamlSupplierServiceConfig.Authentication != (YAMLRelayMinerSupplierServiceAuthentication{}) { - supplierServiceConfig.Authentication = &RelayMinerSupplierServiceAuthentication{ - Username: yamlSupplierServiceConfig.Authentication.Username, - Password: yamlSupplierServiceConfig.Authentication.Password, - } - } - - // If the Headers section is not empty, populate the supplier service headers fields - if yamlSupplierServiceConfig.Headers != nil { - supplierServiceConfig.Headers = yamlSupplierServiceConfig.Headers - } - - return nil -} diff --git a/pkg/relayer/config/relayminer_configs_reader.go b/pkg/relayer/config/relayminer_configs_reader.go deleted file mode 100644 index 8f7c3b5ca..000000000 --- a/pkg/relayer/config/relayminer_configs_reader.go +++ /dev/null @@ -1,77 +0,0 @@ -package config - -import yaml "gopkg.in/yaml.v2" - -// ParseRelayMinerConfigs parses the relay miner config file into a RelayMinerConfig -func ParseRelayMinerConfigs(configContent []byte) (*RelayMinerConfig, error) { - var ( - yamlRelayMinerConfig YAMLRelayMinerConfig - relayMinerConfig = &RelayMinerConfig{} - ) - - // The config file should not be empty - if len(configContent) == 0 { - return nil, ErrRelayMinerConfigEmpty - } - - // Unmarshal the stake config file into a yamlAppGateConfig - if err := yaml.Unmarshal(configContent, &yamlRelayMinerConfig); err != nil { - return nil, ErrRelayMinerConfigUnmarshalYAML.Wrap(err.Error()) - } - - // Top level section - // SigningKeyName is required - if len(yamlRelayMinerConfig.SigningKeyName) == 0 { - return nil, ErrRelayMinerConfigInvalidSigningKeyName - } - relayMinerConfig.SigningKeyName = yamlRelayMinerConfig.SigningKeyName - - // SmtStorePath is required - if len(yamlRelayMinerConfig.SmtStorePath) == 0 { - return nil, ErrRelayMinerConfigInvalidSmtStorePath - } - relayMinerConfig.SmtStorePath = yamlRelayMinerConfig.SmtStorePath - - // Hydrate the pocket node urls - if err := relayMinerConfig.HydratePocketNodeUrls(&yamlRelayMinerConfig.PocketNode); err != nil { - return nil, err - } - - // Hydrate the proxies - if err := relayMinerConfig.HydrateProxies(yamlRelayMinerConfig.Proxies); err != nil { - return nil, err - } - - // Hydrate the suppliers - if err := relayMinerConfig.HydrateSuppliers(yamlRelayMinerConfig.Suppliers); err != nil { - return nil, err - } - - // Check if proxies are referencing hosts more than once - if err := relayMinerConfig.EnsureUniqueHosts(); err != nil { - return nil, err - } - - return relayMinerConfig, nil -} - -// EnsureUniqueHosts checks if each proxy is referencing a host more than once -func (relayMinerConfig *RelayMinerConfig) EnsureUniqueHosts() error { - for _, proxyConfig := range relayMinerConfig.Proxies { - existingHosts := make(map[string]bool) - for _, supplierConfig := range proxyConfig.Suppliers { - for _, host := range supplierConfig.Hosts { - if _, ok := existingHosts[host]; ok { - return ErrRelayMinerConfigInvalidProxy.Wrapf( - "duplicate host %s in proxy %s", - host, - proxyConfig.ProxyName, - ) - } - existingHosts[host] = true - } - } - } - - return nil -} diff --git a/pkg/relayer/config/relayminer_configs_reader_test.go b/pkg/relayer/config/relayminer_configs_reader_test.go deleted file mode 100644 index 6b8bc3c60..000000000 --- a/pkg/relayer/config/relayminer_configs_reader_test.go +++ /dev/null @@ -1,1265 +0,0 @@ -package config_test - -import ( - "net/url" - "testing" - - sdkerrors "cosmossdk.io/errors" - "github.com/gogo/status" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/relayer/config" - "github.com/pokt-network/poktroll/testutil/yaml" -) - -func Test_ParseRelayMinerConfigs(t *testing.T) { - tests := []struct { - desc string - - inputConfigYAML string - - expectedError *sdkerrors.Error - expectedConfig *config.RelayMinerConfig - }{ - // Valid Configs - { - desc: "valid: relay miner config", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - authentication: - username: user - password: pwd - headers: {} - hosts: - - tcp://ethereum.devnet1.poktroll.com - - tcp://ethereum - proxy_names: - - http-example - `, - - expectedError: nil, - expectedConfig: &config.RelayMinerConfig{ - PocketNode: &config.RelayMinerPocketNodeConfig{ - QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, - QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, - TxNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36659"}, - }, - SigningKeyName: "servicer1", - SmtStorePath: "smt_stores", - Proxies: map[string]*config.RelayMinerProxyConfig{ - "http-example": { - ProxyName: "http-example", - Host: "127.0.0.1:8080", - Type: config.ProxyTypeHTTP, - XForwardedHostLookup: false, - Suppliers: map[string]*config.RelayMinerSupplierConfig{ - "ethereum": { - ServiceId: "ethereum", - Type: config.ProxyTypeHTTP, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "anvil.servicer:8545"}, - Authentication: &config.RelayMinerSupplierServiceAuthentication{ - Username: "user", - Password: "pwd", - }, - Headers: map[string]string{}, - }, - Hosts: []string{ - "ethereum.devnet1.poktroll.com", - "ethereum", - }, - }, - }, - }, - }, - }, - }, - { - desc: "valid: multiple suppliers, single proxy", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - authentication: - username: user - password: pwd - headers: {} - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - - service_id: 7b-llm-model - type: http - service_config: - url: http://llama-endpoint - hosts: - - tcp://7b-llm-model.devnet1.poktroll.com - - tcp://7b-llm-model - proxy_names: - - http-example - `, - - expectedError: nil, - expectedConfig: &config.RelayMinerConfig{ - PocketNode: &config.RelayMinerPocketNodeConfig{ - QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, - QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, - TxNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36659"}, - }, - SigningKeyName: "servicer1", - SmtStorePath: "smt_stores", - Proxies: map[string]*config.RelayMinerProxyConfig{ - "http-example": { - ProxyName: "http-example", - Host: "127.0.0.1:8080", - Type: config.ProxyTypeHTTP, - XForwardedHostLookup: false, - Suppliers: map[string]*config.RelayMinerSupplierConfig{ - "ethereum": { - ServiceId: "ethereum", - Type: config.ProxyTypeHTTP, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "anvil.servicer:8545"}, - Authentication: &config.RelayMinerSupplierServiceAuthentication{ - Username: "user", - Password: "pwd", - }, - Headers: map[string]string{}, - }, - Hosts: []string{ - "ethereum.devnet1.poktroll.com", - "ethereum", - }, - }, - "7b-llm-model": { - ServiceId: "7b-llm-model", - Type: config.ProxyTypeHTTP, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "llama-endpoint"}, - }, - Hosts: []string{ - "7b-llm-model.devnet1.poktroll.com", - "7b-llm-model", - }, - }, - }, - }, - }, - }, - }, - { - desc: "valid: multiple proxies for a single supplier, no auth", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: first-proxy - host: 127.0.0.1:8080 - type: http - - proxy_name: second-proxy - host: 127.0.0.1:8081 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - first-proxy - - second-proxy - `, - - expectedError: nil, - expectedConfig: &config.RelayMinerConfig{ - PocketNode: &config.RelayMinerPocketNodeConfig{ - QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, - QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, - TxNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36659"}, - }, - SigningKeyName: "servicer1", - SmtStorePath: "smt_stores", - Proxies: map[string]*config.RelayMinerProxyConfig{ - "first-proxy": { - ProxyName: "first-proxy", - Host: "127.0.0.1:8080", - Type: config.ProxyTypeHTTP, - XForwardedHostLookup: false, - Suppliers: map[string]*config.RelayMinerSupplierConfig{ - "ethereum": { - ServiceId: "ethereum", - Type: config.ProxyTypeHTTP, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "anvil.servicer:8545"}, - }, - Hosts: []string{ - "ethereum.devnet1.poktroll.com", - }, - }, - }, - }, - "second-proxy": { - ProxyName: "second-proxy", - Host: "127.0.0.1:8081", - Type: config.ProxyTypeHTTP, - XForwardedHostLookup: false, - Suppliers: map[string]*config.RelayMinerSupplierConfig{ - "ethereum": { - ServiceId: "ethereum", - Type: config.ProxyTypeHTTP, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "anvil.servicer:8545"}, - }, - Hosts: []string{ - "ethereum.devnet1.poktroll.com", - }, - }, - }, - }, - }, - }, - }, - { - desc: "valid: relay miner config with query node rpc url defaulting to tx node rpc url", - - inputConfigYAML: ` - pocket_node: - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - - tcp://ethereum - proxy_names: - - http-example - `, - - expectedError: nil, - expectedConfig: &config.RelayMinerConfig{ - PocketNode: &config.RelayMinerPocketNodeConfig{ - QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36659"}, - QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, - TxNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36659"}, - }, - SigningKeyName: "servicer1", - SmtStorePath: "smt_stores", - Proxies: map[string]*config.RelayMinerProxyConfig{ - "http-example": { - ProxyName: "http-example", - Host: "127.0.0.1:8080", - Type: config.ProxyTypeHTTP, - XForwardedHostLookup: false, - Suppliers: map[string]*config.RelayMinerSupplierConfig{ - "ethereum": { - ServiceId: "ethereum", - Type: config.ProxyTypeHTTP, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "anvil.servicer:8545"}, - }, - Hosts: []string{ - "ethereum.devnet1.poktroll.com", - "ethereum", - }, - }, - }, - }, - }, - }, - }, - { - desc: "valid: relay miner config with x_forwarded_host_lookup set to true", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - x_forwarded_host_lookup: true - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - - tcp://ethereum - proxy_names: - - http-example - `, - - expectedError: nil, - expectedConfig: &config.RelayMinerConfig{ - PocketNode: &config.RelayMinerPocketNodeConfig{ - QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, - QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, - TxNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36659"}, - }, - SigningKeyName: "servicer1", - SmtStorePath: "smt_stores", - Proxies: map[string]*config.RelayMinerProxyConfig{ - "http-example": { - ProxyName: "http-example", - Host: "127.0.0.1:8080", - Type: config.ProxyTypeHTTP, - XForwardedHostLookup: true, - Suppliers: map[string]*config.RelayMinerSupplierConfig{ - "ethereum": { - ServiceId: "ethereum", - Type: config.ProxyTypeHTTP, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "anvil.servicer:8545"}, - }, - Hosts: []string{ - "ethereum.devnet1.poktroll.com", - "ethereum", - }, - }, - }, - }, - }, - }, - }, - // Invalid Configs - { - desc: "invalid: invalid tx node grpc url", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: &tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidNodeUrl, - }, - { - desc: "invalid: missing tx node grpc url", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - # explicitly omitted tx node grpc url - query_node_grpc_url: tcp://127.0.0.1:36658 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidNodeUrl, - }, - { - desc: "invalid: invalid query node grpc url", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: &tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidNodeUrl, - }, - { - desc: "invalid: invalid query node rpc url", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: &tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidNodeUrl, - }, - { - desc: "invalid: missing query node grpc url", - - inputConfigYAML: ` - pocket_node: - # explicitly omitted query node rpc url - query_node_rpc_url: tcp://127.0.0.1:36657 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidNodeUrl, - }, - { - desc: "invalid: missing signing key name", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - # explicitly omitted signing key name - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSigningKeyName, - }, - { - desc: "invalid: missing smt store path", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - # explicitly omitted smt store path - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSmtStorePath, - }, - { - desc: "invalid: missing proxies section", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - # explicitly omitted proxies section - suppliers: - - proxy_name: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidProxy, - }, - { - desc: "invalid: empty proxies section", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: # explicitly empty proxies section - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidProxy, - }, - { - desc: "invalid: omitted proxy name", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - # explicitly omitted proxy name - - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidProxy, - }, - { - desc: "invalid: empty proxy name", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: # explicitly empty proxy name - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidProxy, - }, - { - desc: "invalid: missing http proxy host", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - # explicitly missing proxy host - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidProxy, - }, - { - desc: "invalid: empty http proxy host", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: # explicitly empty proxy host - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidProxy, - }, - { - desc: "invalid: missing proxy type", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - # explicitly missing proxy type - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidProxy, - }, - { - desc: "invalid: empty proxy type", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: # explicitly empty proxy type - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidProxy, - }, - { - desc: "invalid: unsupported proxy type", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: unsupported - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidProxy, - }, - { - desc: "invalid: missing supplier name", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - # explicitly missing supplier name - - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSupplier, - }, - { - desc: "invalid: empty supplier name", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: # explicitly empty supplier name - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSupplier, - }, - { - desc: "invalid: unsupported supplier type", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: unsupported - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSupplier, - }, - { - desc: "invalid: missing supplier type", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - # explicitly missing supplier type - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSupplier, - }, - { - desc: "invalid: empty supplier type", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: # explicitly empty supplier type - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSupplier, - }, - { - desc: "invalid: bad supplier service config url", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: &http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSupplier, - }, - { - desc: "invalid: empty supplier service config url", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: # explicitly empty supplier service config url - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSupplier, - }, - { - desc: "invalid: missing supplier service config url", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - # explicitly missing supplier service config url - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSupplier, - }, - { - desc: "invalid: bad supplier host", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - &tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSupplier, - }, - { - desc: "invalid: blank supplier host", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - # explicitly blank supplier host - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSupplier, - }, - { - desc: "invalid: empty supplier proxy references", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - bad-proxy-name - `, - - expectedError: config.ErrRelayMinerConfigInvalidSupplier, - }, - { - desc: "invalid: empty supplier proxy references", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://devnet1.poktroll.com # hosts for both suppliers are the same - proxy_names: - - http-example - - service_id: avax - type: http - service_config: - url: http://avax.servicer:8545 - hosts: - - tcp://devnet1.poktroll.com # hosts for both suppliers are the same - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidProxy, - }, - { - desc: "invalid: empty RelayMiner config file", - - inputConfigYAML: ``, - - expectedError: config.ErrRelayMinerConfigEmpty, - }, - // TODO_NB: Test for supplier and proxy types mismatch once we have more - // than one proxy type. - } - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - normalizedConfig := yaml.NormalizeYAMLIndentation(tt.inputConfigYAML) - config, err := config.ParseRelayMinerConfigs([]byte(normalizedConfig)) - - if tt.expectedError != nil { - require.ErrorIs(t, err, tt.expectedError) - require.Nil(t, config) - stat, ok := status.FromError(tt.expectedError) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.expectedError.Error()) - require.Nil(t, config) - return - } - - require.NoError(t, err) - - require.Equal( - t, - tt.expectedConfig.SigningKeyName, - config.SigningKeyName, - ) - - require.Equal( - t, - tt.expectedConfig.SmtStorePath, - config.SmtStorePath, - ) - - require.Equal( - t, - tt.expectedConfig.PocketNode.QueryNodeGRPCUrl.String(), - config.PocketNode.QueryNodeGRPCUrl.String(), - ) - - require.Equal( - t, - tt.expectedConfig.PocketNode.QueryNodeRPCUrl.String(), - config.PocketNode.QueryNodeRPCUrl.String(), - ) - - require.Equal( - t, - tt.expectedConfig.PocketNode.TxNodeRPCUrl.String(), - config.PocketNode.TxNodeRPCUrl.String(), - ) - - for proxyName, proxy := range tt.expectedConfig.Proxies { - require.Equal( - t, - proxy.ProxyName, - config.Proxies[proxyName].ProxyName, - ) - - require.Equal( - t, - proxy.Host, - config.Proxies[proxyName].Host, - ) - - require.Equal( - t, - proxy.Type, - config.Proxies[proxyName].Type, - ) - - for supplierName, supplier := range proxy.Suppliers { - require.Equal( - t, - supplier.ServiceId, - config.Proxies[proxyName].Suppliers[supplierName].ServiceId, - ) - - require.Equal( - t, - supplier.Type, - config.Proxies[proxyName].Suppliers[supplierName].Type, - ) - - require.Equal( - t, - supplier.ServiceConfig.Url.String(), - config.Proxies[proxyName].Suppliers[supplierName].ServiceConfig.Url.String(), - ) - - if supplier.ServiceConfig.Authentication != nil { - require.NotNil( - t, - config.Proxies[proxyName].Suppliers[supplierName].ServiceConfig.Authentication, - ) - - require.Equal( - t, - supplier.ServiceConfig.Authentication.Username, - config.Proxies[proxyName].Suppliers[supplierName].ServiceConfig.Authentication.Username, - ) - - require.Equal( - t, - supplier.ServiceConfig.Authentication.Password, - config.Proxies[proxyName].Suppliers[supplierName].ServiceConfig.Authentication.Password, - ) - } - - for headerKey, headerValue := range supplier.ServiceConfig.Headers { - require.Equal( - t, - headerValue, - config.Proxies[proxyName].Suppliers[supplierName].ServiceConfig.Headers[headerKey], - ) - } - - for i, host := range supplier.Hosts { - require.Contains( - t, - host, - config.Proxies[proxyName].Suppliers[supplierName].Hosts[i], - ) - } - } - } - }) - } -} diff --git a/pkg/relayer/config/supplier_hydrator.go b/pkg/relayer/config/supplier_hydrator.go deleted file mode 100644 index 0b54a36f0..000000000 --- a/pkg/relayer/config/supplier_hydrator.go +++ /dev/null @@ -1,82 +0,0 @@ -package config - -import "net/url" - -// HydrateSupplier populates a single supplier's fields of the RelayMinerConfig -// that are relevant to each supplier in the "suppliers" section of the config file. -func (supplierConfig *RelayMinerSupplierConfig) HydrateSupplier( - yamlSupplierConfig YAMLRelayMinerSupplierConfig, -) error { - // Supplier name is required - if len(yamlSupplierConfig.ServiceId) == 0 { - return ErrRelayMinerConfigInvalidSupplier.Wrap("supplier name is required") - } - supplierConfig.ServiceId = yamlSupplierConfig.ServiceId - - // Supplier hosts - supplierConfig.Hosts = []string{} - existingHosts := make(map[string]bool) - for _, host := range yamlSupplierConfig.Hosts { - // Check if the supplier host is empty - if len(host) == 0 { - return ErrRelayMinerConfigInvalidSupplier.Wrap("empty supplier host") - } - - // Check if the supplier host is a valid URL - supplierHost, err := url.Parse(host) - if err != nil { - return ErrRelayMinerConfigInvalidSupplier.Wrapf( - "invalid supplier host %s", - host, - ) - } - - // Check if the supplier host is unique - if _, ok := existingHosts[supplierHost.Host]; ok { - return ErrRelayMinerConfigInvalidSupplier.Wrapf( - "duplicate supplier host %s", - host, - ) - } - existingHosts[supplierHost.Host] = true - - // Add the supplier host to the suppliers list - supplierConfig.Hosts = append(supplierConfig.Hosts, supplierHost.Host) - } - - // Add a default host which corresponds to the supplier name if it is not - // already in the list - if _, ok := existingHosts[supplierConfig.ServiceId]; !ok { - supplierConfig.Hosts = append(supplierConfig.Hosts, supplierConfig.ServiceId) - } - - // Populate the supplier service fields that are relevant to each supported - // supplier type. - // If other supplier types are added in the future, they should be handled - // by their own functions. - supplierConfig.ServiceConfig = &RelayMinerSupplierServiceConfig{} - switch yamlSupplierConfig.Type { - case "http": - supplierConfig.Type = ProxyTypeHTTP - if err := supplierConfig.ServiceConfig. - parseHTTPSupplierConfig(yamlSupplierConfig.ServiceConfig); err != nil { - return err - } - default: - // Fail if the supplier type is not supported - return ErrRelayMinerConfigInvalidSupplier.Wrapf( - "invalid supplier type %s", - yamlSupplierConfig.Type, - ) - } - - // Check if the supplier has proxies - if len(yamlSupplierConfig.ProxyNames) == 0 { - return ErrRelayMinerConfigInvalidSupplier.Wrapf( - "supplier %s has no proxies", - supplierConfig.ServiceId, - ) - } - - return nil -} diff --git a/pkg/relayer/config/suppliers_config_hydrator.go b/pkg/relayer/config/suppliers_config_hydrator.go deleted file mode 100644 index b8f0f4fa7..000000000 --- a/pkg/relayer/config/suppliers_config_hydrator.go +++ /dev/null @@ -1,51 +0,0 @@ -package config - -// HydrateSuppliers populates the suppliers fields of the RelayMinerConfig that -// are relevant to the "suppliers" section in the config file. -func (relayMinerConfig *RelayMinerConfig) HydrateSuppliers( - yamlSupplierConfigs []YAMLRelayMinerSupplierConfig, -) error { - existingSuppliers := make(map[string]bool) - for _, yamlSupplierConfig := range yamlSupplierConfigs { - // Hydrate and validate each supplier in the suppliers list of the config file. - supplierConfig := &RelayMinerSupplierConfig{} - if err := supplierConfig.HydrateSupplier(yamlSupplierConfig); err != nil { - return err - } - - // Supplier name should not be unique - if _, ok := existingSuppliers[yamlSupplierConfig.ServiceId]; ok { - return ErrRelayMinerConfigInvalidSupplier.Wrapf( - "duplicate supplier name %s", - yamlSupplierConfig.ServiceId, - ) - } - // Mark the supplier as existing - existingSuppliers[yamlSupplierConfig.ServiceId] = true - - // Add the supplier config to the referenced proxies - for _, proxyName := range yamlSupplierConfig.ProxyNames { - // If the proxy name is referencing a non-existent proxy, fail - if _, ok := relayMinerConfig.Proxies[proxyName]; !ok { - return ErrRelayMinerConfigInvalidSupplier.Wrapf( - "no matching proxy %s for supplier %s", - supplierConfig.ServiceId, - proxyName, - ) - } - - // If the proxy name is referencing a proxy of a different type, fail - if supplierConfig.Type != relayMinerConfig.Proxies[proxyName].Type { - return ErrRelayMinerConfigInvalidSupplier.Wrapf( - "supplier %s and proxy %s have different types", - supplierConfig.ServiceId, - proxyName, - ) - } - - relayMinerConfig.Proxies[proxyName].Suppliers[supplierConfig.ServiceId] = supplierConfig - } - } - - return nil -} diff --git a/pkg/relayer/config/types.go b/pkg/relayer/config/types.go deleted file mode 100644 index fb14b8b20..000000000 --- a/pkg/relayer/config/types.go +++ /dev/null @@ -1,147 +0,0 @@ -package config - -import "net/url" - -type ProxyType int - -const ( - ProxyTypeHTTP ProxyType = iota - // TODO: Support other proxy types: HTTPS, TCP, UNIX socket, UDP, QUIC, WebRTC ... -) - -// YAMLRelayMinerConfig is the structure used to unmarshal the RelayMiner config file -// TODO_DOCUMENT(@red-0ne): Add proper README documentation for yaml config files -// and update inline comments accordingly. -type YAMLRelayMinerConfig struct { - PocketNode YAMLRelayMinerPocketNodeConfig `yaml:"pocket_node"` - SigningKeyName string `yaml:"signing_key_name"` - SmtStorePath string `yaml:"smt_store_path"` - Proxies []YAMLRelayMinerProxyConfig `yaml:"proxies"` - Suppliers []YAMLRelayMinerSupplierConfig `yaml:"suppliers"` -} - -// YAMLRelayMinerPocketNodeConfig is the structure used to unmarshal the pocket -// node URLs section of the RelayMiner config file -type YAMLRelayMinerPocketNodeConfig struct { - QueryNodeRPCUrl string `yaml:"query_node_rpc_url"` - QueryNodeGRPCUrl string `yaml:"query_node_grpc_url"` - TxNodeRPCUrl string `yaml:"tx_node_rpc_url"` -} - -// YAMLRelayMinerProxyConfig is the structure used to unmarshal the proxy -// section of the RelayMiner config file -type YAMLRelayMinerProxyConfig struct { - ProxyName string `yaml:"proxy_name"` - Type string `yaml:"type"` - Host string `yaml:"host"` - XForwardedHostLookup bool `yaml:"x_forwarded_host_lookup"` -} - -// YAMLRelayMinerSupplierConfig is the structure used to unmarshal the supplier -// section of the RelayMiner config file -type YAMLRelayMinerSupplierConfig struct { - ServiceId string `yaml:"service_id"` - Type string `yaml:"type"` - Hosts []string `yaml:"hosts"` - ServiceConfig YAMLRelayMinerSupplierServiceConfig `yaml:"service_config"` - ProxyNames []string `yaml:"proxy_names"` -} - -// YAMLRelayMinerSupplierServiceConfig is the structure used to unmarshal the supplier -// service sub-section of the RelayMiner config file -type YAMLRelayMinerSupplierServiceConfig struct { - Url string `yaml:"url"` - Authentication YAMLRelayMinerSupplierServiceAuthentication `yaml:"authentication,omitempty"` - Headers map[string]string `yaml:"headers,omitempty"` -} - -// YAMLRelayMinerSupplierServiceAuthentication is the structure used to unmarshal -// the supplier service basic auth of the RelayMiner config file when the -// supplier is of type "http" -type YAMLRelayMinerSupplierServiceAuthentication struct { - Username string `yaml:"username,omitempty"` - Password string `yaml:"password,omitempty"` -} - -// RelayMinerConfig is the structure describing the RelayMiner config -type RelayMinerConfig struct { - PocketNode *RelayMinerPocketNodeConfig - SigningKeyName string - SmtStorePath string - Proxies map[string]*RelayMinerProxyConfig -} - -// RelayMinerPocketNodeConfig is the structure resulting from parsing the pocket -// node URLs section of the RelayMiner config file -type RelayMinerPocketNodeConfig struct { - QueryNodeRPCUrl *url.URL - QueryNodeGRPCUrl *url.URL - TxNodeRPCUrl *url.URL -} - -// RelayMinerProxyConfig is the structure resulting from parsing the proxy -// section of the RelayMiner config file. -// Each proxy embeds a map of supplier configs that are associated with it. -// Other proxy types may embed other fields in the future. eg. "https" may -// embed a TLS config. -type RelayMinerProxyConfig struct { - // ProxyName is the name of the proxy server, used to identify it in the config - ProxyName string - // Type is the transport protocol used by the proxy server like (http, https, etc.) - Type ProxyType - // Host is the host on which the proxy server will listen for incoming - // relay requests - Host string - // XForwardedHostLookup is a flag that indicates whether the proxy server - // should lookup the host from the X-Forwarded-Host header before falling - // back to the Host header. - XForwardedHostLookup bool - // Suppliers is a map of serviceIds -> RelayMinerSupplierConfig - Suppliers map[string]*RelayMinerSupplierConfig -} - -// RelayMinerSupplierConfig is the structure resulting from parsing the supplier -// section of the RelayMiner config file. -type RelayMinerSupplierConfig struct { - // ServiceId is the serviceId corresponding to the current configuration. - ServiceId string - // Type is the transport protocol used by the supplier, it must match the - // type of the proxy it is associated with. - Type ProxyType - // Hosts is a list of hosts advertised on-chain by the supplier, the corresponding - // proxy server will accept relay requests for these hosts. - Hosts []string - // ServiceConfig is the config of the service that relays will be proxied to. - // Other supplier types may embed other fields in the future. eg. "https" may - // embed a TLS config. - ServiceConfig *RelayMinerSupplierServiceConfig -} - -// RelayMinerSupplierServiceConfig is the structure resulting from parsing the supplier -// service sub-section of the RelayMiner config file. -type RelayMinerSupplierServiceConfig struct { - // Url is the URL of the service that relays will be proxied to. - Url *url.URL - // Authentication is the basic auth structure used to authenticate to the - // request being proxied from the current proxy server. - // If the service the relay requests are forwarded to requires basic auth - // then this field must be populated. - // TODO_TECHDEBT(@red-0ne): Pass the authentication to the service instance - // when the relay request is forwarded to it. - Authentication *RelayMinerSupplierServiceAuthentication - // Headers is a map of headers to be used for other authentication means. - // If the service the relay requests are forwarded to requires header based - // authentication then this field must be populated accordingly. - // For example: { "Authorization": "Bearer " } - // TODO_TECHDEBT(@red-0ne): Add these headers to the forwarded request - // before sending it to the service instance. - Headers map[string]string -} - -// RelayMinerSupplierServiceAuthentication is the structure resulting from parsing -// the supplier service basic auth of the RelayMiner config file when the -// supplier is of type "http" -type RelayMinerSupplierServiceAuthentication struct { - Username string - Password string -} diff --git a/pkg/relayer/interface.go b/pkg/relayer/interface.go deleted file mode 100644 index 74ab7975a..000000000 --- a/pkg/relayer/interface.go +++ /dev/null @@ -1,146 +0,0 @@ -//go:generate mockgen -destination=../../testutil/mockrelayer/relayer_proxy_mock.go -package=mockrelayer . RelayerProxy -//go:generate mockgen -destination=../../testutil/mockrelayer/miner_mock.go -package=mockrelayer . Miner -//go:generate mockgen -destination=../../testutil/mockrelayer/relayer_sessions_manager_mock.go -package=mockrelayer . RelayerSessionsManager - -package relayer - -import ( - "context" - - "github.com/pokt-network/smt" - - "github.com/pokt-network/poktroll/pkg/observable" - servicetypes "github.com/pokt-network/poktroll/x/service/types" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// RelaysObservable is an observable which is notified with Relay values. -// -// TODO_HACK: The purpose of this type is to work around gomock's lack of -// support for generic types. For the same reason, this type cannot be an -// alias (i.e. RelaysObservable = observable.Observable[*servicetypes.Relay]). -type RelaysObservable observable.Observable[*servicetypes.Relay] - -// MinedRelaysObservable is an observable which is notified with MinedRelay values. -// -// TODO_HACK: The purpose of this type is to work around gomock's lack of -// support for generic types. For the same reason, this type cannot be an -// alias (i.e. MinedRelaysObservable = observable.Observable[*MinedRelay]). -type MinedRelaysObservable observable.Observable[*MinedRelay] - -// Miner is responsible for observing servedRelayObs, hashing and checking the -// difficulty of each, finally publishing those with sufficient difficulty to -// minedRelayObs as they are applicable for relay volume. -type Miner interface { - MinedRelays( - ctx context.Context, - servedRelayObs RelaysObservable, - ) (minedRelaysObs MinedRelaysObservable) -} - -type MinerOption func(Miner) - -// RelayerProxy is the interface for the proxy that serves relays to the application. -// It is responsible for starting and stopping all supported RelayServers. -// While handling requests and responding in a closed loop, it also notifies -// the miner about the relays that have been served. -type RelayerProxy interface { - // Start starts all advertised relay servers and returns an error if any of them fail to start. - Start(ctx context.Context) error - - // Stop stops all advertised relay servers and returns an error if any of them fail. - Stop(ctx context.Context) error - - // ServedRelays returns an observable that notifies the miner about the relays that have been served. - // A served relay is one whose RelayRequest's signature and session have been verified, - // and its RelayResponse has been signed and successfully sent to the client. - ServedRelays() RelaysObservable - - // VerifyRelayRequest is a shared method used by RelayServers to check the - // relay request signature and session validity. - // TODO_TECHDEBT(@red-0ne): This method should be moved out of the RelayerProxy interface - // that should not be responsible for verifying relay requests. - VerifyRelayRequest( - ctx context.Context, - relayRequest *servicetypes.RelayRequest, - service *sharedtypes.Service, - ) error - - // SignRelayResponse is a shared method used by RelayServers to sign - // and append the signature to the RelayResponse. - // TODO_TECHDEBT(@red-0ne): This method should be moved out of the RelayerProxy interface - // that should not be responsible for signing relay responses. - SignRelayResponse(relayResponse *servicetypes.RelayResponse) error -} - -type RelayerProxyOption func(RelayerProxy) - -// RelayServer is the interface of the advertised relay servers provided by the RelayerProxy. -type RelayServer interface { - // Start starts the service server and returns an error if it fails. - Start(ctx context.Context) error - - // Stop terminates the service server and returns an error if it fails. - Stop(ctx context.Context) error -} - -// RelayerSessionsManager is responsible for managing the relayer's session lifecycles. -// It handles the creation and retrieval of SMSTs (trees) for a given session, as -// well as the respective and subsequent claim creation and proof submission. -// This is largely accomplished by pipelining observables of relays and sessions -// through a series of map operations. -// -// TODO_TECHDEBT: add architecture diagrams covering observable flows throughout -// the relayer package. -type RelayerSessionsManager interface { - // InsertRelays receives an observable of relays that should be included - // in their respective session's SMST (tree). - InsertRelays(minedRelaysObs MinedRelaysObservable) - - // Start iterates over the session trees at the end of each, respective, session. - // The session trees are piped through a series of map operations which progress - // them through the claim/proof lifecycle, broadcasting transactions to the - // network as necessary. - Start(ctx context.Context) - - // Stop unsubscribes all observables from the InsertRelays observable which - // will close downstream observables as they drain. - // - // TODO_TECHDEBT: Either add a mechanism to wait for draining to complete - // and/or ensure that the state at each pipeline stage is persisted to disk - // and exit as early as possible. - Stop() -} - -type RelayerSessionsManagerOption func(RelayerSessionsManager) - -// SessionTree is an interface that wraps an SMST (Sparse Merkle State Trie) and its corresponding session. -type SessionTree interface { - // GetSessionHeader returns the header of the session corresponding to the SMST. - GetSessionHeader() *sessiontypes.SessionHeader - - // Update is a wrapper for the SMST's Update function. It updates the SMST with - // the given key, value, and weight. - // This function should be called when a Relay has been successfully served. - Update(key, value []byte, weight uint64) error - - // ProveClosest is a wrapper for the SMST's ProveClosest function. It returns the - // proof for the given path. - // This function should be called several blocks after a session has been claimed and needs to be proven. - ProveClosest(path []byte) (proof *smt.SparseMerkleClosestProof, err error) - - // Flush gets the root hash of the SMST needed for submitting the claim; - // then commits the entire tree to disk and stops the KVStore. - // It should be called before submitting the claim on-chain. This function frees up - // the in-memory resources used by the SMST that are no longer needed while waiting - // for the proof submission window to open. - Flush() (SMSTRoot []byte, err error) - - // TODO_DISCUSS: This function should not be part of the interface as it is an optimization - // aiming to free up KVStore resources after the proof is no longer needed. - // Delete deletes the SMST from the KVStore. - // WARNING: This function should be called only after the proof has been successfully - // submitted on-chain and the servicer has confirmed that it has been rewarded. - Delete() error -} diff --git a/pkg/relayer/miner/gen/gen_fixtures.go b/pkg/relayer/miner/gen/gen_fixtures.go deleted file mode 100644 index 59071d9ab..000000000 --- a/pkg/relayer/miner/gen/gen_fixtures.go +++ /dev/null @@ -1,304 +0,0 @@ -// NB: ensure this code is never included in any normal builds. -//go:build ignore - -// NB: package MUST be `main` so that it can be run as a binary. -package main - -import ( - "bytes" - "context" - "crypto/rand" - "flag" - "fmt" - "hash" - "log" - "os" - "strings" - "sync" - "time" - - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/miner" - "github.com/pokt-network/poktroll/pkg/relayer/protocol" - servicetypes "github.com/pokt-network/poktroll/x/service/types" -) - -const ( - defaultDifficultyBits = 16 - defaultFixtureLimitPerGroup = 5 - defaultRandLength = 16 - defaultOutPath = "relay_fixtures_test.go" -) - -var ( - // flagDifficultyBitsThreshold is the number of leading zero bits that a - // randomized, serialized relay must have to be included in the - // `marshaledMinableRelaysHex` slice which is generated. It is also used as - // the maximum difficulty allowed for relays to be included in the - // `marshaledUnminableRelaysHex` slice. - flagDifficultyBitsThreshold int - - // flagFixtureLimitPerGroup is the number of randomized, serialized relays that will be - // generated for each of `marshaledMinableRelaysHex` and - // `marshaledUnminableRelaysHex`. - flagFixtureLimitPerGroup int - - // flagOut is the path to the generated file. - flagOut string -) - -// TODO_TECHDEBT: remove once marshaling using canonical codec. -type marshalable interface { - Marshal() ([]byte, error) -} - -func init() { - flag.IntVar(&flagDifficultyBitsThreshold, "difficulty-bits-threshold", defaultDifficultyBits, "the number of leading zero bits that a randomized, serialized relay must have to be included in the `marshaledMinableRelaysHex` slice which is generated. It is also used as the maximum difficulty allowed for relays to be included in the `marshaledUnminableRelaysHex` slice.") - flag.IntVar(&flagFixtureLimitPerGroup, "fixture-limit-per-group", defaultFixtureLimitPerGroup, "the number of randomized, serialized relays that will be generated for each of `marshaledMinableRelaysHex` and `marshaledUnminableRelaysHex`.") - flag.StringVar(&flagOut, "out", defaultOutPath, "the path to the generated file.") -} - -// This is utility for generating relay fixtures for testing. It is not intended -// to be used **in/by** any tests but rather is persisted to aid in re-generation -// of relay fixtures should the test requirements change. It generates two slices -// of minedRelays, `marshaledMinableRelaysHex` and `marshaledUnminableRelaysHex`, -// which contain hex encoded strings of serialized relays. The relays in -// `marshaledMinableRelaysHex` have been pre-mined to difficulty 16 by populating -// the signature with random bytes. The relays in `marshaledUnminableRelaysHex` -// have been pre-mined to **exclude** relays with difficulty 16 (or greater). Like -// `marshaledMinableRelaysHex`, this is done by populating the signature with -// random bytes. -// Output file is truncated and overwritten if it already exists. -// -// To regenerate all fixtures, use `make go_testgen_fixtures`; to regenerate only this -// test's fixtures run `go generate ./pkg/relayer/miner/miner_test.go`. -func main() { - flag.Parse() - - ctx, cancelCtx := context.WithCancel(context.Background()) - defer cancelCtx() - - randRelaysObs, errCh := genRandomizedMinedRelayFixtures( - ctx, - defaultRandLength, - miner.DefaultRelayHasher, - ) - exitOnError(errCh) - - outputBuffer := new(bytes.Buffer) - - // Collect the minable relay fixtures into a single string (one relay per line). - marshaledMinableRelaysHex := getMarshaledRelayFmtLines(ctx, randRelaysObs, difficultyGTE) - - // Collect the unminable relay fixtures into a single string (one relay per line). - marshaledUnminableRelaysHex := getMarshaledRelayFmtLines(ctx, randRelaysObs, difficultyLT) - - // Interpolate the collected relay fixtures into the relay fixtures template. - if err := relayFixturesTemplate.Execute( - outputBuffer, - map[string]any{ - "difficultyBitsThreshold": flagDifficultyBitsThreshold, - "MarshaledMinableRelaysHex": marshaledMinableRelaysHex, - "MarshaledUnminableRelaysHex": marshaledUnminableRelaysHex, - }, - ); err != nil { - log.Fatal(err) - } - - // Write the output buffer to the file at flagOut path. - if err := os.WriteFile(flagOut, outputBuffer.Bytes(), 0644); err != nil { - log.Fatal(err) - } -} - -// genRandomizedMinedRelayFixtures returns an observable of mined relays which -// are generated by randomizing the signature of a relay. It generates these mined -// relay fixtures continuously until the context is canceled. It also returns an -// error channel which will receive any error it encounters while generating. -func genRandomizedMinedRelayFixtures( - ctx context.Context, - randLength int, - newHasher func() hash.Hash, -) (observable.Observable[*relayer.MinedRelay], <-chan error) { - var ( - errCh = make(chan error, 1) - randBzObs, randBzPublishCh = channel.NewObservable[*relayer.MinedRelay]() - ) - - go func() { - for { - select { - case <-ctx.Done(): - return - default: - } - - randBz := make([]byte, randLength) - if _, err := rand.Read(randBz); err != nil { - errCh <- err - return - } - - // Populate a relay with the minimally sufficient randomized data. - relay := servicetypes.Relay{ - Req: &servicetypes.RelayRequest{ - Meta: &servicetypes.RelayRequestMetadata{ - Signature: randBz, - }, - Payload: nil, - }, - Res: nil, - } - - // TODO_BLOCKER: use canonical codec. - relayBz, err := relay.Marshal() - if err != nil { - errCh <- err - return - } - - // Hash relay bytes - relayHash, err := hashBytes(newHasher, relayBz) - if err != nil { - errCh <- err - return - } - - randBzPublishCh <- &relayer.MinedRelay{ - Relay: relay, - Bytes: relayBz, - Hash: relayHash, - } - } - }() - - return randBzObs, errCh -} - -// hashBytes hashes the given bytes using the given hasher. -func hashBytes(newHasher func() hash.Hash, relayBz []byte) ([]byte, error) { - hasher := newHasher() - if _, err := hasher.Write(relayBz); err != nil { - return nil, err - } - - return hasher.Sum(nil), nil -} - -// exitOnError exits the program if an error is received on the given error -// channel. -func exitOnError(errCh <-chan error) { - go func() { - for err := range errCh { - log.Fatalf("ERROR: %s", err) - } - }() -} - -// difficultyGTE returns true if the given hash has a difficulty greater than or -// equal to flagDifficultyBitsThreshold. -func difficultyGTE(hash []byte) bool { - return protocol.MustCountDifficultyBits(hash) >= flagDifficultyBitsThreshold -} - -// difficultyLT returns true if the given hash has a difficulty less than -// flagDifficultyBitsThreshold. -func difficultyLT(hash []byte) bool { - return protocol.MustCountDifficultyBits(hash) < flagDifficultyBitsThreshold -} - -// getMarshaledRelayFmtLines performs two map operations followed by a collect. -// The first map filters mined relays from the given observable, skipping when -// shouldAccept is false. This map, and as a result, all downstream observables -// are closed when flagFixtureLimitPerGroup number of relays have been accepted. -// The second map then marshals, hex-encodes, and formats the filtered mined relay. -// Finally, the collect operation collects the formatted mined relays into a slice -// to return. -func getMarshaledRelayFmtLines( - ctx context.Context, - randRelaysObs observable.Observable[*relayer.MinedRelay], - shouldAccept func(hash []byte) bool, -) string { - ctx, cancelFilterMapCollect := context.WithCancel(ctx) - filteredRelaysObs := filterLimitRelays( - ctx, - cancelFilterMapCollect, - flagFixtureLimitPerGroup, - randRelaysObs, - shouldAccept, - ) - - marshaledFilteredRelayLinesObs := channel.Map( - ctx, filteredRelaysObs, - newMapRelayMarshalLineFmt[*relayer.MinedRelay](relayFixtureLineFmt), - ) - - // Collect the filtered relays and return them (as a slice). - marshaledFilteredRelayLines := channel.Collect(ctx, marshaledFilteredRelayLinesObs) - return strings.Join(marshaledFilteredRelayLines, "\n") -} - -// filterLimitRelays maps over the given observable of mined relays, skipping when -// the given shouldAppend function returns false. Once flagFixtureLimitPerGroup -// number of relay fixtures have been mapped, it calls the given cancel function. -func filterLimitRelays( - ctx context.Context, - cancel context.CancelFunc, - limit int, - randRelaysObs observable.Observable[*relayer.MinedRelay], - shouldCollect func(hash []byte) bool, -) observable.Observable[*relayer.MinedRelay] { - var ( - counterMu sync.Mutex - minedRelayAcceptCounter = 0 - minedRelayRejectCounter = 0 - ) - - return channel.Map(ctx, randRelaysObs, - func( - _ context.Context, - minedRelay *relayer.MinedRelay, - ) (_ *relayer.MinedRelay, skip bool) { - counterMu.Lock() - defer counterMu.Unlock() - - // At the start of each iteration, check if the relayCounter has reached - // the limit. If so, cancel the ctx to stop the map operation. - if minedRelayAcceptCounter >= limit { - // Wait a tick for the map to complete as the observable drains - // asynchronously. - time.Sleep(time.Millisecond) - cancel() - return nil, true - } - - // Skip if shouldCollect returns false. - if !shouldCollect(minedRelay.Hash) { - minedRelayRejectCounter++ - return nil, true - } - - minedRelayAcceptCounter++ - return minedRelay, false - }, - ) -} - -// newMapRelayMarshalLineFmt returns a MapFn which formats the given marshalable -// as a hex-encoded string with the given line format string. -func newMapRelayMarshalLineFmt[T marshalable](lineFmt string) channel.MapFn[T, string] { - return func( - _ context.Context, - marsh T, - ) (_ string, skip bool) { - // TODO_BLOCKER: marshal using canonical codec. - minedRelayBz, err := marsh.Marshal() - if err != nil { - log.Fatal(err) - } - - return fmt.Sprintf(lineFmt, minedRelayBz), false - } -} diff --git a/pkg/relayer/miner/gen/template.go b/pkg/relayer/miner/gen/template.go deleted file mode 100644 index c75e761a4..000000000 --- a/pkg/relayer/miner/gen/template.go +++ /dev/null @@ -1,37 +0,0 @@ -package main - -import "text/template" - -var ( - relayFixtureLineFmt = "\t\t\"%x\"," - relayFixturesTemplate = template.Must( - template.New("relay_fixtures_test.go").Parse( - `// DO NOT EDIT: this file was generated by gen/gen_fixtures.go, -// changes made will be overwritten upon regeneration. -// -// To regenerate all fixtures, use make go_testgen_fixture; to regenerate only this -// test's fixtures run go generate ./pkg/relayer/miner/miner_test.go. -package miner_test - -var ( - // marshaledMinableRelaysHex are the hex encoded strings of serialized - // relayer.MinedRelays which have been pre-mined to difficulty {{.difficultyBitsThreshold}} by - // populating the signature with random bytes. It is intended for use - // in tests. - marshaledMinableRelaysHex = []string{ -{{.MarshaledMinableRelaysHex}} - } - - // marshaledUnminableRelaysHex are the hex encoded strings of serialized - // relayer.MinedRelays which have been pre-mined to **exclude** relays with - // difficulty {{.difficultyBitsThreshold}} (or greater). Like marshaledMinableRelaysHex, this is done - // by populating the signature with random bytes. It is intended for use in - // tests. - marshaledUnminableRelaysHex = []string{ -{{.MarshaledUnminableRelaysHex}} - } -) -`, - ), - ) -) diff --git a/pkg/relayer/miner/miner.go b/pkg/relayer/miner/miner.go deleted file mode 100644 index c3b062a04..000000000 --- a/pkg/relayer/miner/miner.go +++ /dev/null @@ -1,137 +0,0 @@ -package miner - -import ( - "context" - "crypto/sha256" - "hash" - - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/observable/filter" - "github.com/pokt-network/poktroll/pkg/observable/logging" - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/protocol" - servicetypes "github.com/pokt-network/poktroll/x/service/types" -) - -var ( - _ relayer.Miner = (*miner)(nil) - // TODO_TECHDEBT(@h5law): Retrieve the relay hasher mechanism from the `smt` repo. - DefaultRelayHasher = sha256.New - // TODO_BLOCKER: query on-chain governance params once available. - // Setting this to 0 to effectively disables mining for now. - // I.e., all relays are added to the tree. - defaultRelayDifficultyBits = 0 -) - -// Miner is responsible for observing servedRelayObs, hashing and checking the -// difficulty of each, finally publishing those with sufficient difficulty to -// minedRelayObs as they are applicable for relay volume. -// -// Available options: -// - WithDifficulty -// -// TODO_BLOCKER: The relay hashing and relay difficulty mechanisms & values must come -// from on-chain. -type miner struct { - // relayHasher is a function which returns a hash.Hash interfact type. It is - // used to hash serialized relays to measure their mining difficulty. - relayHasher func() hash.Hash - // relayDifficultyBits is the minimum difficulty that a relay must have to be - // volume / reward applicable. - relayDifficultyBits int -} - -// NewMiner creates a new miner from the given dependencies and options. It -// returns an error if it has not been sufficiently configured or supplied. -func NewMiner( - opts ...relayer.MinerOption, -) (*miner, error) { - mnr := &miner{} - - for _, opt := range opts { - opt(mnr) - } - - mnr.setDefaults() - - return mnr, nil -} - -// MinedRelays maps servedRelaysObs through a pipeline which: -// 1. Hashes the relay -// 2. Checks if it's above the mining difficulty -// 3. Adds it to the session tree if so -// It DOES NOT BLOCK as map operations run in their own goroutines. -func (mnr *miner) MinedRelays( - ctx context.Context, - servedRelaysObs relayer.RelaysObservable, -) relayer.MinedRelaysObservable { - // NB: must cast back to generic observable type to use with Map. - // relayer.RelaysObervable cannot be an alias due to gomock's lack of - // support for generic types. - relaysObs := observable.Observable[*servicetypes.Relay](servedRelaysObs) - - // Map servedRelaysObs to a new observable of an either type, populated with - // the minedRelay or an error. It is notified after the relay has been mined - // or an error has been encountered, respectively. - eitherMinedRelaysObs := channel.Map(ctx, relaysObs, mnr.mapMineRelay) - logging.LogErrors(ctx, filter.EitherError(ctx, eitherMinedRelaysObs)) - - return filter.EitherSuccess(ctx, eitherMinedRelaysObs) -} - -// setDefaults ensures that the miner has been configured with a hasherConstructor and uses -// the default hasherConstructor if not. -func (mnr *miner) setDefaults() { - if mnr.relayHasher == nil { - mnr.relayHasher = DefaultRelayHasher - } - - if mnr.relayDifficultyBits == 0 { - mnr.relayDifficultyBits = defaultRelayDifficultyBits - } -} - -// mapMineRelay is intended to be used as a MapFn. -// 1. It hashes the relay and compares its difficult to the minimum threshold. -// 2. If the relay difficulty is sufficient -> return an Either[MineRelay Value] -// 3. If an error is encountered -> return an Either[error] -// 4. Otherwise, skip the relay. -func (mnr *miner) mapMineRelay( - _ context.Context, - relay *servicetypes.Relay, -) (_ either.Either[*relayer.MinedRelay], skip bool) { - // TODO_BLOCKER: marshal using canonical codec. - relayBz, err := relay.Marshal() - if err != nil { - return either.Error[*relayer.MinedRelay](err), false - } - - // TODO_BLOCKER: Centralize the logic of hashing a relay. It should live - // alongside signing & verification. - // - // TODO_IMPROVE: We need to hash the key; it would be nice if smst.Update() could do it - // since smst has a reference to the hasherConstructor - relayHash := mnr.hash(relayBz) - - // The relay IS NOT volume / reward applicable - if protocol.MustCountDifficultyBits(relayHash) < mnr.relayDifficultyBits { - return either.Success[*relayer.MinedRelay](nil), true - } - - // The relay IS volume / reward applicable - return either.Success(&relayer.MinedRelay{ - Relay: *relay, - Bytes: relayBz, - Hash: relayHash, - }), false -} - -// hash constructs a new hasher and hashes the given input bytes. -func (mnr *miner) hash(inputBz []byte) []byte { - hasher := mnr.relayHasher() - hasher.Write(inputBz) - return hasher.Sum(nil) -} diff --git a/pkg/relayer/miner/miner_test.go b/pkg/relayer/miner/miner_test.go deleted file mode 100644 index 9366f4121..000000000 --- a/pkg/relayer/miner/miner_test.go +++ /dev/null @@ -1,145 +0,0 @@ -//go:generate go run gen/gen_fixtures.go gen/template.go -// (see: https://pkg.go.dev/cmd/go/internal/generate) -// (see: https://go.googlesource.com/proposal/+/refs/heads/master/design/go-generate.md) - -package miner_test - -import ( - "context" - "encoding/hex" - "hash" - "sync" - "testing" - "time" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/miner" - "github.com/pokt-network/poktroll/testutil/testrelayer" - servicetypes "github.com/pokt-network/poktroll/x/service/types" -) - -const testDifficulty = 16 - -// TestMiner_MinedRelays constructs an observable of mined relays, through which -// it pipes pre-mined relay fixtures. It asserts that the observable only emits -// mined relays with difficulty equal to or greater than testDifficulty. -// -// To regenerate all fixtures, use `make go_testgen_fixtures`; to regenerate only this -// test's fixtures run `go generate ./pkg/relayer/miner/miner_test.go`. -func TestMiner_MinedRelays(t *testing.T) { - var ( - minedRelayCounter = 0 - ctx = context.Background() - actualMinedRelaysMu sync.Mutex - actualMinedRelays []*relayer.MinedRelay - mockRelaysObs, relaysFixturePublishCh = channel.NewObservable[*servicetypes.Relay]() - expectedMinedRelays = unmarshalHexMinedRelays( - t, marshaledMinableRelaysHex, - miner.DefaultRelayHasher, - ) - ) - - mnr, err := miner.NewMiner(miner.WithDifficulty(testDifficulty)) - require.NoError(t, err) - - minedRelays := mnr.MinedRelays(ctx, mockRelaysObs) - minedRelaysObserver := minedRelays.Subscribe(ctx) - - // Subscribe to the mined relays observable and append them to the - // actualMinedRelays slice asynchronously. - go func() { - for minedRelay := range minedRelaysObserver.Ch() { - actualMinedRelaysMu.Lock() - actualMinedRelays = append(actualMinedRelays, minedRelay) - minedRelayCounter++ - actualMinedRelaysMu.Unlock() - } - }() - - // Publish unminable relay fixtures to the mock relays observable. - publishRelayFixtures(t, marshaledUnminableRelaysHex, relaysFixturePublishCh) - time.Sleep(time.Millisecond) - - // Assert that no unminable relay fixtures were published to minedRelays. - actualMinedRelaysMu.Lock() - require.Empty(t, actualMinedRelays) - actualMinedRelaysMu.Unlock() - - // Publish minable relay fixtures to the relay fixtures observable. - publishRelayFixtures(t, marshaledMinableRelaysHex, relaysFixturePublishCh) - time.Sleep(time.Millisecond) - - // Assert that all minable relay fixtures were published to minedRelays. - actualMinedRelaysMu.Lock() - require.EqualValues(t, expectedMinedRelays, actualMinedRelays) - actualMinedRelaysMu.Unlock() -} - -func publishRelayFixtures( - t *testing.T, - marshalledRelaysHex []string, - mockRelaysPublishCh chan<- *servicetypes.Relay, -) { - t.Helper() - - for _, marshalledRelayHex := range marshalledRelaysHex { - relay := unmarshalHexRelay(t, marshalledRelayHex) - - mockRelaysPublishCh <- relay - } -} - -func unmarshalHexRelay( - t *testing.T, - marshalledHexRelay string, -) *servicetypes.Relay { - t.Helper() - - relayBz, err := hex.DecodeString(marshalledHexRelay) - require.NoError(t, err) - - var relay servicetypes.Relay - err = relay.Unmarshal(relayBz) - require.NoError(t, err) - - return &relay -} - -func unmarshalHexMinedRelays( - t *testing.T, - marshalledHexMinedRelays []string, - newHasher func() hash.Hash, -) (relays []*relayer.MinedRelay) { - t.Helper() - - for _, marshalledRelayHex := range marshalledHexMinedRelays { - relays = append(relays, unmarshalHexMinedRelay(t, marshalledRelayHex, newHasher)) - } - return relays -} - -func unmarshalHexMinedRelay( - t *testing.T, - marshalledHexMinedRelay string, - newHasher func() hash.Hash, -) *relayer.MinedRelay { - t.Helper() - - relayBz, err := hex.DecodeString(marshalledHexMinedRelay) - require.NoError(t, err) - - var relay servicetypes.Relay - err = relay.Unmarshal(relayBz) - require.NoError(t, err) - - relayHashBz := testrelayer.HashBytes(t, newHasher, relayBz) - - return &relayer.MinedRelay{ - Relay: relay, - Bytes: relayBz, - Hash: relayHashBz, - } -} diff --git a/pkg/relayer/miner/options.go b/pkg/relayer/miner/options.go deleted file mode 100644 index fae783d85..000000000 --- a/pkg/relayer/miner/options.go +++ /dev/null @@ -1,11 +0,0 @@ -package miner - -import "github.com/pokt-network/poktroll/pkg/relayer" - -// WithDifficulty sets the difficulty of the miner, where difficultyBytes is the -// minimum number of leading zero bytes. -func WithDifficulty(difficultyBits int) relayer.MinerOption { - return func(mnr relayer.Miner) { - mnr.(*miner).relayDifficultyBits = difficultyBits - } -} diff --git a/pkg/relayer/miner/relay_fixtures_test.go b/pkg/relayer/miner/relay_fixtures_test.go deleted file mode 100644 index c32dd4509..000000000 --- a/pkg/relayer/miner/relay_fixtures_test.go +++ /dev/null @@ -1,33 +0,0 @@ -// DO NOT EDIT: this file was generated by gen/gen_fixtures.go, -// changes made will be overwritten upon regeneration. -// -// To regenerate all fixtures, use make go_testgen_fixture; to regenerate only this -// test's fixtures run go generate ./pkg/relayer/miner/miner_test.go. -package miner_test - -var ( - // marshaledMinableRelaysHex are the hex encoded strings of serialized - // relayer.MinedRelays which have been pre-mined to difficulty 16 by - // populating the signature with random bytes. It is intended for use - // in tests. - marshaledMinableRelaysHex = []string{ - "0a140a121210bffa0b5c3f03c71f93d7611af54ba80b", - "0a140a1212106655cb3dccaada7837b094962d65426d", - "0a140a121210b19bcf19e96cb58bb37bae3a1769fc08", - "0a140a121210146014db743850694ce211403e91c451", - "0a140a12121016da74aea084a4d40aebf61d876809d4", - } - - // marshaledUnminableRelaysHex are the hex encoded strings of serialized - // relayer.MinedRelays which have been pre-mined to **exclude** relays with - // difficulty 16 (or greater). Like marshaledMinableRelaysHex, this is done - // by populating the signature with random bytes. It is intended for use in - // tests. - marshaledUnminableRelaysHex = []string{ - "0a140a12121070b059e32e4149bcded39d8eb0186fce", - "0a140a121210f5bb373e3d6cabe04675083ac4ffc36e", - "0a140a1212104ae2b0539ecd82ec56bf23b276d543c1", - "0a140a121210d4238199f9e52347b46d060c477b464e", - "0a140a1212103118a0689c4eb883e384d12378bc61e2", - } -) diff --git a/pkg/relayer/protocol/block_heights.go b/pkg/relayer/protocol/block_heights.go deleted file mode 100644 index bb0676737..000000000 --- a/pkg/relayer/protocol/block_heights.go +++ /dev/null @@ -1,68 +0,0 @@ -package protocol - -import ( - "context" - "encoding/binary" - "fmt" - "math/rand" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/polylog" -) - -// GetEarliestCreateClaimHeight returns the earliest block height at which a claim -// for a session with the given createClaimWindowStartHeight can be created. -// -// TODO_TEST(@bryanchriswhite): Add test coverage and more logs -func GetEarliestCreateClaimHeight(ctx context.Context, createClaimWindowStartBlock client.Block) int64 { - logger := polylog.Ctx(ctx) - - createClaimWindowStartBlockHash := createClaimWindowStartBlock.Hash() - logger.Debug(). - Int64( - "create_claim_window_start_block", - createClaimWindowStartBlock.Height(), - ). - Str( - "create_claim_window_start_block_hash", - // TODO_TECHDEBT: add polylog.Event#Hex() type method. - fmt.Sprintf("%x", createClaimWindowStartBlockHash), - ) - rngSeed, _ := binary.Varint(createClaimWindowStartBlockHash) - randomNumber := rand.NewSource(rngSeed).Int63() - - // TODO_TECHDEBT: query the on-chain governance parameter once available. - // randCreateClaimHeightOffset := randomNumber % (claimproofparams.GovCreateClaimIntervalBlocks - claimproofparams.GovCreateClaimWindowBlocks - 1) - _ = randomNumber - randCreateClaimHeightOffset := int64(0) - - return createClaimWindowStartBlock.Height() + randCreateClaimHeightOffset -} - -// GetEarliestSubmitProofHeight returns the earliest block height at which a proof -// for a session with the given submitProofWindowStartHeight can be submitted. -// -// TODO_TEST(@bryanchriswhite): Add test coverage and more logs -func GetEarliestSubmitProofHeight(ctx context.Context, submitProofWindowStartBlock client.Block) int64 { - logger := polylog.Ctx(ctx) - - earliestSubmitProofBlockHash := submitProofWindowStartBlock.Hash() - logger.Debug(). - Int64( - "submit_proof_window_start_block", - submitProofWindowStartBlock.Height(), - ). - Str( - "submit_proof_window_start_block_hash", - fmt.Sprintf("%x", earliestSubmitProofBlockHash), - ) - rngSeed, _ := binary.Varint(earliestSubmitProofBlockHash) - randomNumber := rand.NewSource(rngSeed).Int63() - - // TODO_TECHDEBT: query the on-chain governance parameter once available. - // randSubmitProofHeightOffset := randomNumber % (claimproofparams.GovSubmitProofIntervalBlocks - claimproofparams.GovSubmitProofWindowBlocks - 1) - _ = randomNumber - randSubmitProofHeightOffset := int64(0) - - return submitProofWindowStartBlock.Height() + randSubmitProofHeightOffset -} diff --git a/pkg/relayer/protocol/difficulty.go b/pkg/relayer/protocol/difficulty.go deleted file mode 100644 index a33c4bac6..000000000 --- a/pkg/relayer/protocol/difficulty.go +++ /dev/null @@ -1,42 +0,0 @@ -package protocol - -import ( - "math/bits" -) - -// TODO_BLOCKER: Revisit this part of the algorithm after initial TestNet Launch. -// TODO_TEST: Add extensive tests for the core relay mining business logic. - -// MustCountDifficultyBits returns the number of leading zero bits in the given -// byte slice. It panics if an error is encountered. -func MustCountDifficultyBits(bz []byte) int { - diff, err := CountDifficultyBits(bz) - if err != nil { - panic(err) - } - - return diff -} - -// CountDifficultyBits returns the number of leading zero bits in the given byte -// slice. It returns an error if the byte slice is all zero bits. -func CountDifficultyBits(bz []byte) (int, error) { - bzLen := len(bz) - - var zeroBits int - for byteIdx, byteValue := range bz { - if byteValue != 0 { - zeroBits = bits.LeadingZeros8(byteValue) - if zeroBits == 8 { - // we already checked that byteValue != 0. - return 0, ErrDifficulty.Wrap("impossible code path") - } - - // We have byteIdx bytes that are all 0s and one byte that has - // zeroBits number of leading 0 bits. - return (byteIdx)*8 + zeroBits, nil - } - } - - return 0, ErrDifficulty.Wrapf("difficulty matches bytes length: %d; bytes (hex): % x", bzLen, bz) -} diff --git a/pkg/relayer/protocol/difficulty_test.go b/pkg/relayer/protocol/difficulty_test.go deleted file mode 100644 index ae5548634..000000000 --- a/pkg/relayer/protocol/difficulty_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package protocol_test - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/relayer/protocol" -) - -func TestCountDifficultyBits(t *testing.T) { - tests := []struct { - bz []byte - difficulty int - }{ - { - bz: []byte{0b11111111, 255, 255, 255}, - difficulty: 0, - }, - { - bz: []byte{0b01111111, 255, 255, 255}, - difficulty: 1, - }, - { - bz: []byte{0, 255, 255, 255}, - difficulty: 8, - }, - { - bz: []byte{0, 0b01111111, 255, 255}, - difficulty: 9, - }, - { - bz: []byte{0, 0b00111111, 255, 255}, - difficulty: 10, - }, - { - bz: []byte{0, 0, 255, 255}, - difficulty: 16, - }, - } - - for _, tt := range tests { - t.Run(fmt.Sprintf("difficulty_%d_zero_bits", tt.difficulty), func(t *testing.T) { - actualDifficulty, err := protocol.CountDifficultyBits(tt.bz) - require.NoError(t, err) - require.Equal(t, tt.difficulty, actualDifficulty) - }) - } -} - -func TestCountDifficultyBits_Error(t *testing.T) { - _, err := protocol.CountDifficultyBits([]byte{0, 0, 0, 0}) - require.ErrorIs(t, err, protocol.ErrDifficulty) - require.ErrorContains(t, err, "difficulty matches bytes length") -} diff --git a/pkg/relayer/protocol/errors.go b/pkg/relayer/protocol/errors.go deleted file mode 100644 index f578bf8e0..000000000 --- a/pkg/relayer/protocol/errors.go +++ /dev/null @@ -1,8 +0,0 @@ -package protocol - -import errorsmod "cosmossdk.io/errors" - -var ( - ErrDifficulty = errorsmod.New(codespace, 1, "difficulty error") - codespace = "relayer/protocol" -) diff --git a/pkg/relayer/proxy/error_reply.go b/pkg/relayer/proxy/error_reply.go deleted file mode 100644 index 06d982105..000000000 --- a/pkg/relayer/proxy/error_reply.go +++ /dev/null @@ -1,39 +0,0 @@ -package proxy - -import ( - "context" - "net/http" - - "github.com/pokt-network/poktroll/pkg/partials" - "github.com/pokt-network/poktroll/x/service/types" -) - -// replyWithError builds the appropriate error format according to the payload -// using the passed in error and writes it to the writer. -// NOTE: This method is used to reply with an "internal" error that is related -// to the proxy itself and not to the relayed request. -func (sync *synchronousRPCServer) replyWithError( - ctx context.Context, - payloadBz []byte, - writer http.ResponseWriter, - err error, -) { - responseBz, err := partials.GetErrorReply(ctx, payloadBz, err) - if err != nil { - sync.logger.Error().Err(err).Msg("failed getting error reply") - return - } - - relayResponse := &types.RelayResponse{Payload: responseBz} - - relayResponseBz, err := relayResponse.Marshal() - if err != nil { - sync.logger.Error().Err(err).Msg("failed marshaling relay response") - return - } - - if _, err = writer.Write(relayResponseBz); err != nil { - sync.logger.Error().Err(err).Msg("failed writing relay response") - return - } -} diff --git a/pkg/relayer/proxy/errors.go b/pkg/relayer/proxy/errors.go deleted file mode 100644 index 84604e836..000000000 --- a/pkg/relayer/proxy/errors.go +++ /dev/null @@ -1,20 +0,0 @@ -package proxy - -import ( - sdkerrors "cosmossdk.io/errors" -) - -var ( - codespace = "relayer_proxy" - ErrRelayerProxyUnsupportedRPCType = sdkerrors.Register(codespace, 1, "unsupported relayer proxy rpc type") - ErrRelayerProxyInvalidRelayRequestSignature = sdkerrors.Register(codespace, 2, "invalid relay request signature") - ErrRelayerProxyInvalidSession = sdkerrors.Register(codespace, 3, "invalid session in relayer request") - ErrRelayerProxyInvalidSupplier = sdkerrors.Register(codespace, 4, "invalid relayer proxy supplier") - ErrRelayerProxyUndefinedSigningKeyName = sdkerrors.Register(codespace, 5, "undefined relayer proxy signing key name") - ErrRelayerProxyUndefinedProxiedServicesEndpoints = sdkerrors.Register(codespace, 6, "undefined proxied services endpoints for relayer proxy") - ErrRelayerProxyInvalidRelayRequest = sdkerrors.Register(codespace, 7, "invalid relay request") - ErrRelayerProxyInvalidRelayResponse = sdkerrors.Register(codespace, 8, "invalid relay response") - ErrRelayerProxyEmptyRelayRequestSignature = sdkerrors.Register(codespace, 9, "empty relay response signature") - ErrRelayerProxyServiceEndpointNotHandled = sdkerrors.Register(codespace, 10, "service endpoint not handled by relayer proxy") - ErrRelayerProxyUnsupportedTransportType = sdkerrors.Register(codespace, 11, "unsupported proxy transport type") -) diff --git a/pkg/relayer/proxy/options.go b/pkg/relayer/proxy/options.go deleted file mode 100644 index ab9344c95..000000000 --- a/pkg/relayer/proxy/options.go +++ /dev/null @@ -1,21 +0,0 @@ -package proxy - -import ( - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/config" -) - -// WithSigningKeyName sets the signing key name used by the relayer proxy to sign relay responses. -// It is used along with the keyring to get the supplier address and sign the relay responses. -func WithSigningKeyName(keyName string) relayer.RelayerProxyOption { - return func(relProxy relayer.RelayerProxy) { - relProxy.(*relayerProxy).signingKeyName = keyName - } -} - -// WithProxiedServicesEndpoints sets the endpoints of the proxied services. -func WithProxiedServicesEndpoints(proxyConfig map[string]*config.RelayMinerProxyConfig) relayer.RelayerProxyOption { - return func(relProxy relayer.RelayerProxy) { - relProxy.(*relayerProxy).proxyConfigs = proxyConfig - } -} diff --git a/pkg/relayer/proxy/proxy.go b/pkg/relayer/proxy/proxy.go deleted file mode 100644 index ec9f5a1c4..000000000 --- a/pkg/relayer/proxy/proxy.go +++ /dev/null @@ -1,172 +0,0 @@ -package proxy - -import ( - "context" - - "cosmossdk.io/depinject" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - "golang.org/x/sync/errgroup" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/crypto" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/config" - "github.com/pokt-network/poktroll/x/service/types" -) - -var _ relayer.RelayerProxy = (*relayerProxy)(nil) - -// relayerProxy is the main relayer proxy that takes relay requests of supported services from the client -// and proxies them to the supported proxied services. -// It is responsible for notifying the miner about the relays that have been served so they can be counted -// when the miner enters the claim/proof phase. -// TODO_TEST: Have tests for the relayer proxy. -type relayerProxy struct { - logger polylog.Logger - - // signingKeyName is the supplier's key name in the Cosmos's keybase. It is used along with the keyring to - // get the supplier address and sign the relay responses. - signingKeyName string - keyring keyring.Keyring - - // blockClient is the client used to get the block at the latest height from the blockchain - // and be notified of new incoming blocks. It is used to update the current session data. - blockClient client.BlockClient - - // supplierQuerier is the querier used to get the supplier's advertised information from the blockchain, - // which contains the supported services, RPC types, and endpoints, etc... - supplierQuerier client.SupplierQueryClient - - // sessionQuerier is the querier used to get the current session from the blockchain, - // which is needed to check if the relay proxy should be serving an incoming relay request. - sessionQuerier client.SessionQueryClient - - // proxyServers is a map of proxyName -> RelayServer provided by the relayer proxy, - // where proxyName is the name of the proxy defined in the config file and - // RelayServer is the server that listens for incoming relay requests. - proxyServers map[string]relayer.RelayServer - - // proxyConfigs is a map of proxyName -> RelayMinerProxyConfig where proxyName - // is the name of the proxy defined in the config file and RelayMinerProxyConfig - // is the configuration of the proxy. - proxyConfigs map[string]*config.RelayMinerProxyConfig - - // servedRelays is an observable that notifies the miner about the relays that have been served. - servedRelays relayer.RelaysObservable - - // servedRelaysPublishCh is a channel that emits the relays that have been served so that the - // servedRelays observable can fan out the notifications to its subscribers. - servedRelaysPublishCh chan<- *types.Relay - - // ringCache is used to obtain and store the ring for the application. - ringCache crypto.RingCache - - // supplierAddress is the address of the supplier that the relayer proxy is running for. - supplierAddress string -} - -// NewRelayerProxy creates a new relayer proxy with the given dependencies or returns -// an error if the dependencies fail to resolve or the options are invalid. -// -// Required dependencies: -// - cosmosclient.Context -// - client.BlockClient -// -// Available options: -// - WithSigningKeyName -// - WithProxiedServicesEndpoints -func NewRelayerProxy( - deps depinject.Config, - opts ...relayer.RelayerProxyOption, -) (relayer.RelayerProxy, error) { - rp := &relayerProxy{} - - if err := depinject.Inject( - deps, - &rp.logger, - &rp.blockClient, - &rp.ringCache, - &rp.supplierQuerier, - &rp.sessionQuerier, - &rp.keyring, - ); err != nil { - return nil, err - } - - servedRelays, servedRelaysProducer := channel.NewObservable[*types.Relay]() - - rp.servedRelays = servedRelays - rp.servedRelaysPublishCh = servedRelaysProducer - - for _, opt := range opts { - opt(rp) - } - - if err := rp.validateConfig(); err != nil { - return nil, err - } - - return rp, nil -} - -// Start concurrently starts all advertised relay services and returns an error -// if any of them errors. -// This method IS BLOCKING until all RelayServers are stopped. -func (rp *relayerProxy) Start(ctx context.Context) error { - // The provided services map is built from the supplier's on-chain advertised information, - // which is a runtime parameter that can be changed by the supplier. - // NOTE: We build the provided services map at Start instead of NewRelayerProxy to avoid having to - // return an error from the constructor. - if err := rp.BuildProvidedServices(ctx); err != nil { - return err - } - - // Start the ring cache. - rp.ringCache.Start(ctx) - - startGroup, ctx := errgroup.WithContext(ctx) - - for _, relayServer := range rp.proxyServers { - server := relayServer // create a new variable scoped to the anonymous function - startGroup.Go(func() error { return server.Start(ctx) }) - } - - return startGroup.Wait() -} - -// Stop concurrently stops all advertised relay servers and returns an error if any of them fails. -// This method is blocking until all RelayServers are stopped. -func (rp *relayerProxy) Stop(ctx context.Context) error { - stopGroup, ctx := errgroup.WithContext(ctx) - - for _, relayServer := range rp.proxyServers { - // Create a new object (i.e. deep copy) variable scoped to the anonymous function below - server := relayServer - stopGroup.Go(func() error { return server.Stop(ctx) }) - } - - return stopGroup.Wait() -} - -// ServedRelays returns an observable that notifies the miner about the relays that have been served. -// A served relay is one whose RelayRequest's signature and session have been verified, -// and its RelayResponse has been signed and successfully sent to the client. -func (rp *relayerProxy) ServedRelays() relayer.RelaysObservable { - return rp.servedRelays -} - -// validateConfig validates the relayer proxy's configuration options and returns an error if it is invalid. -// TODO_TEST: Add tests for validating these configurations. -func (rp *relayerProxy) validateConfig() error { - if rp.signingKeyName == "" { - return ErrRelayerProxyUndefinedSigningKeyName - } - - if rp.proxyConfigs == nil || len(rp.proxyConfigs) == 0 { - return ErrRelayerProxyUndefinedProxiedServicesEndpoints - } - - return nil -} diff --git a/pkg/relayer/proxy/proxy_test.go b/pkg/relayer/proxy/proxy_test.go deleted file mode 100644 index bb699be71..000000000 --- a/pkg/relayer/proxy/proxy_test.go +++ /dev/null @@ -1,681 +0,0 @@ -package proxy_test - -import ( - "bytes" - "context" - "fmt" - "io" - "net/http" - "net/url" - "strings" - "testing" - "time" - - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/relayer/config" - "github.com/pokt-network/poktroll/pkg/relayer/proxy" - "github.com/pokt-network/poktroll/testutil/testproxy" - servicetypes "github.com/pokt-network/poktroll/x/service/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -const blockHeight = 1 - -var ( - // helpers used for tests that are initialized in init() - supplierKeyName string - - // supplierEndpoints is the map of serviceName -> []SupplierEndpoint - // where serviceName is the name of the service the supplier staked for - // and SupplierEndpoint is the endpoint of the service advertised on-chain - // by the supplier - supplierEndpoints map[string][]*sharedtypes.SupplierEndpoint - - // appPrivateKey is the private key of the application that is used to sign - // relay responses. - // It is also used in these tests to derive the public key and address of the - // application. - appPrivateKey *secp256k1.PrivKey - - // proxiedServices is the parsed configuration of the RelayMinerProxyConfig - proxiedServices map[string]*config.RelayMinerProxyConfig - - // defaultRelayerProxyBehavior is the list of functions that are used to - // define the behavior of the RelayerProxy in the tests. - defaultRelayerProxyBehavior []func(*testproxy.TestBehavior) -) - -func init() { - supplierKeyName = "supplierKeyName" - appPrivateKey = secp256k1.GenPrivKey() - - supplierEndpoints = map[string][]*sharedtypes.SupplierEndpoint{ - "service1": { - { - Url: "http://supplier:8545/", - // TODO_EXTEND: Consider adding support for non JSON RPC services in the future - RpcType: sharedtypes.RPCType_JSON_RPC, - }, - }, - "service2": { - { - Url: "http://supplier:8546/", - RpcType: sharedtypes.RPCType_GRPC, - }, - }, - "service3": { - { - Url: "http://supplier:8547/", - RpcType: sharedtypes.RPCType_GRPC, - }, - }, - } - - proxiedServices = map[string]*config.RelayMinerProxyConfig{ - "server1": { - ProxyName: "server1", - Type: config.ProxyTypeHTTP, - Host: "127.0.0.1:8080", - Suppliers: map[string]*config.RelayMinerSupplierConfig{ - "service1": { - ServiceId: "service1", - Type: config.ProxyTypeHTTP, - Hosts: []string{"supplier:8545"}, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "127.0.0.1:8545", Path: "/"}, - }, - }, - "service2": { - ServiceId: "service2", - Type: config.ProxyTypeHTTP, - Hosts: []string{"supplier:8546"}, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "127.0.0.1:8546", Path: "/"}, - }, - }, - }, - }, - "server2": { - ProxyName: "server2", - Type: config.ProxyTypeHTTP, - Host: "127.0.0.1:8081", - Suppliers: map[string]*config.RelayMinerSupplierConfig{ - "service3": { - ServiceId: "service3", - Type: config.ProxyTypeHTTP, - Hosts: []string{"supplier:8547"}, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "127.0.0.1:8547", Path: "/"}, - }, - }, - }, - }, - } - - defaultRelayerProxyBehavior = []func(*testproxy.TestBehavior){ - testproxy.WithRelayerProxyDependencies(supplierKeyName), - testproxy.WithRelayerProxiedServices(proxiedServices), - testproxy.WithDefaultSupplier(supplierKeyName, supplierEndpoints), - testproxy.WithDefaultApplication(appPrivateKey), - testproxy.WithDefaultSessionSupplier(supplierKeyName, "service1", appPrivateKey), - } -} - -// RelayerProxy should start and stop without errors -func TestRelayerProxy_StartAndStop(t *testing.T) { - ctx := context.TODO() - // Setup the RelayerProxy instrumented behavior - test := testproxy.NewRelayerProxyTestBehavior(ctx, t, defaultRelayerProxyBehavior...) - - // Create a RelayerProxy - rp, err := proxy.NewRelayerProxy( - test.Deps, - proxy.WithSigningKeyName(supplierKeyName), - proxy.WithProxiedServicesEndpoints(proxiedServices), - ) - require.NoError(t, err) - - // Start RelayerProxy - go rp.Start(ctx) - // Block so relayerProxy has sufficient time to start - time.Sleep(100 * time.Millisecond) - - // Test that RelayerProxy is handling requests (ignoring the actual response content) - res, err := http.DefaultClient.Get(fmt.Sprintf("http://%s/", proxiedServices["server1"].Host)) - require.NoError(t, err) - require.NotNil(t, res) - - // Test that RelayerProxy is handling requests from the other server - res, err = http.DefaultClient.Get(fmt.Sprintf("http://%s/", proxiedServices["server2"].Host)) - require.NoError(t, err) - require.NotNil(t, res) - - // Stop RelayerProxy - err = rp.Stop(ctx) - require.NoError(t, err) -} - -// RelayerProxy should fail to start if the signing key is not found in the keyring -func TestRelayerProxy_InvalidSupplierKeyName(t *testing.T) { - ctx := context.TODO() - test := testproxy.NewRelayerProxyTestBehavior(ctx, t, defaultRelayerProxyBehavior...) - - rp, err := proxy.NewRelayerProxy( - test.Deps, - proxy.WithSigningKeyName("wrongKeyName"), - proxy.WithProxiedServicesEndpoints(proxiedServices), - ) - require.NoError(t, err) - - err = rp.Start(ctx) - require.Error(t, err) -} - -// RelayerProxy should fail to build if the signing key name is not provided -func TestRelayerProxy_MissingSupplierKeyName(t *testing.T) { - ctx := context.TODO() - test := testproxy.NewRelayerProxyTestBehavior(ctx, t, defaultRelayerProxyBehavior...) - - _, err := proxy.NewRelayerProxy( - test.Deps, - proxy.WithSigningKeyName(""), - proxy.WithProxiedServicesEndpoints(proxiedServices), - ) - require.Error(t, err) -} - -// RelayerProxy should fail to build if the proxied services endpoints are not provided -func TestRelayerProxy_NoProxiedServices(t *testing.T) { - ctx := context.TODO() - - test := testproxy.NewRelayerProxyTestBehavior(ctx, t, defaultRelayerProxyBehavior...) - - _, err := proxy.NewRelayerProxy( - test.Deps, - proxy.WithSigningKeyName(supplierKeyName), - proxy.WithProxiedServicesEndpoints(make(map[string]*config.RelayMinerProxyConfig)), - ) - require.Error(t, err) -} - -// RelayerProxy should fail to start if it cannot spawn a server for the -// services it advertized on-chain. -func TestRelayerProxy_UnsupportedRpcType(t *testing.T) { - ctx := context.TODO() - - unsupportedSupplierEndpoint := map[string][]*sharedtypes.SupplierEndpoint{ - "service1": { - { - Url: "http://unsupported:8545/jsonrpc", - // TODO_EXTEND: Consider adding support for non JSON RPC services in the future - RpcType: sharedtypes.RPCType_JSON_RPC, - }, - }, - } - - unsupportedRPCTypeBehavior := []func(*testproxy.TestBehavior){ - testproxy.WithRelayerProxyDependencies(supplierKeyName), - testproxy.WithRelayerProxiedServices(proxiedServices), - - // The supplier is staked on-chain but the service it provides is not supported by the proxy - testproxy.WithDefaultSupplier(supplierKeyName, unsupportedSupplierEndpoint), - testproxy.WithDefaultApplication(appPrivateKey), - testproxy.WithDefaultSessionSupplier(supplierKeyName, "service1", appPrivateKey), - } - - test := testproxy.NewRelayerProxyTestBehavior(ctx, t, unsupportedRPCTypeBehavior...) - - rp, err := proxy.NewRelayerProxy( - test.Deps, - proxy.WithSigningKeyName(supplierKeyName), - proxy.WithProxiedServicesEndpoints(proxiedServices), - ) - require.NoError(t, err) - - err = rp.Start(ctx) - require.Error(t, err) -} - -func TestRelayerProxy_UnsupportedTransportType(t *testing.T) { - ctx := context.TODO() - - badTransportSupplierEndpoints := map[string][]*sharedtypes.SupplierEndpoint{ - "service1": { - { - Url: "xttp://supplier:8545/", - RpcType: sharedtypes.RPCType_JSON_RPC, - }, - }, - } - - unsupportedTransportProxy := map[string]*config.RelayMinerProxyConfig{ - "server1": { - ProxyName: "server1", - // The proxy is configured with an unsupported transport type - Type: config.ProxyType(100), - Host: "127.0.0.1:8080", - Suppliers: map[string]*config.RelayMinerSupplierConfig{ - "service1": { - ServiceId: "service1", - // The proxy is configured with an unsupported transport type - Type: config.ProxyType(100), - Hosts: []string{"supplier:8545"}, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "127.0.0.1:8545", Path: "/"}, - }, - }, - }, - }, - } - - unsupportedTransportTypeBehavior := []func(*testproxy.TestBehavior){ - testproxy.WithRelayerProxyDependencies(supplierKeyName), - - // The proxy is configured with an unsupported transport type for the proxy - testproxy.WithRelayerProxiedServices(unsupportedTransportProxy), - testproxy.WithDefaultSupplier(supplierKeyName, badTransportSupplierEndpoints), - testproxy.WithDefaultApplication(appPrivateKey), - testproxy.WithDefaultSessionSupplier(supplierKeyName, "service1", appPrivateKey), - } - - test := testproxy.NewRelayerProxyTestBehavior(ctx, t, unsupportedTransportTypeBehavior...) - - rp, err := proxy.NewRelayerProxy( - test.Deps, - proxy.WithSigningKeyName(supplierKeyName), - proxy.WithProxiedServicesEndpoints(unsupportedTransportProxy), - ) - require.NoError(t, err) - - err = rp.Start(ctx) - require.ErrorIs(t, err, proxy.ErrRelayerProxyUnsupportedTransportType) -} - -func TestRelayerProxy_NonConfiguredSupplierServices(t *testing.T) { - ctx := context.TODO() - - missingServicesProxy := map[string]*config.RelayMinerProxyConfig{ - "server1": { - ProxyName: "server1", - Type: config.ProxyTypeHTTP, - Host: "127.0.0.1:8080", - Suppliers: map[string]*config.RelayMinerSupplierConfig{ - "service1": { - ServiceId: "service1", - Type: config.ProxyTypeHTTP, - Hosts: []string{"supplier:8545"}, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "127.0.0.1:8545", Path: "/"}, - }, - }, - }, - }, - } - - unsupportedTransportTypeBehavior := []func(*testproxy.TestBehavior){ - testproxy.WithRelayerProxyDependencies(supplierKeyName), - - // The proxy is configured with an unsupported transport type for the proxy - testproxy.WithRelayerProxiedServices(missingServicesProxy), - testproxy.WithDefaultSupplier(supplierKeyName, supplierEndpoints), - testproxy.WithDefaultApplication(appPrivateKey), - testproxy.WithDefaultSessionSupplier(supplierKeyName, "service1", appPrivateKey), - } - - test := testproxy.NewRelayerProxyTestBehavior(ctx, t, unsupportedTransportTypeBehavior...) - - rp, err := proxy.NewRelayerProxy( - test.Deps, - proxy.WithSigningKeyName(supplierKeyName), - proxy.WithProxiedServicesEndpoints(missingServicesProxy), - ) - require.NoError(t, err) - - err = rp.Start(ctx) - require.ErrorIs(t, err, proxy.ErrRelayerProxyServiceEndpointNotHandled) -} - -// Test different RelayRequest scenarios -func TestRelayerProxy_Relays(t *testing.T) { - tests := []struct { - desc string - // RelayerProxy instrumented behavior - relayerProxyBehavior []func(*testproxy.TestBehavior) - // Input scenario builds a RelayRequest, marshals it and sends it to the RelayerProxy - inputScenario func( - t *testing.T, - test *testproxy.TestBehavior, - ) (errCode int32, errMsg string) - - // The request result should return any error form the http.DefaultClient.Do call. - // We infer the behavior from the response's code and message prefix - expectedErrCode int32 - expectedErrMsg string - }{ - { - desc: "Unparsable relay request", - - relayerProxyBehavior: defaultRelayerProxyBehavior, - inputScenario: sendRequestWithUnparsableBody, - - // expectedErrCode is because the proxy won't be able to unmarshal the request - // so it does not know how to format the error response - expectedErrCode: 0, - expectedErrMsg: "cannot unmarshal request payload", - }, - { - desc: "Missing session meta from relay request", - - relayerProxyBehavior: defaultRelayerProxyBehavior, - inputScenario: sendRequestWithMissingMeta, - - expectedErrCode: -32000, - expectedErrMsg: "missing meta from relay request", - }, - { - desc: "Missing signature from relay request", - - relayerProxyBehavior: defaultRelayerProxyBehavior, - inputScenario: sendRequestWithMissingSignature, - - expectedErrCode: -32000, - expectedErrMsg: "missing signature from relay request", - }, - { - desc: "Invalid signature associated with relay request", - - relayerProxyBehavior: defaultRelayerProxyBehavior, - inputScenario: sendRequestWithInvalidSignature, - - expectedErrCode: -32000, - expectedErrMsg: "error deserializing ring signature", - }, - { - desc: "Missing session header application address associated with relay request", - - relayerProxyBehavior: defaultRelayerProxyBehavior, - inputScenario: sendRequestWithMissingSessionHeaderApplicationAddress, - - expectedErrCode: -32000, - expectedErrMsg: "missing application address from relay request", - }, - { - desc: "Non staked application address", - - relayerProxyBehavior: defaultRelayerProxyBehavior, - inputScenario: sendRequestWithNonStakedApplicationAddress, - - expectedErrCode: -32000, - expectedErrMsg: "error getting ring for application address", - }, - { - desc: "Ring signature mismatch", - - relayerProxyBehavior: defaultRelayerProxyBehavior, - inputScenario: sendRequestWithRingSignatureMismatch, - - expectedErrCode: -32000, - expectedErrMsg: "ring signature does not match ring for application address", - }, - { - desc: "Session mismatch", - - relayerProxyBehavior: defaultRelayerProxyBehavior, - inputScenario: sendRequestWithDifferentSession, - - expectedErrCode: -32000, - expectedErrMsg: "session mismatch", - }, - { - desc: "Invalid relay supplier", - - relayerProxyBehavior: []func(*testproxy.TestBehavior){ - testproxy.WithRelayerProxyDependencies(supplierKeyName), - testproxy.WithRelayerProxiedServices(proxiedServices), - testproxy.WithDefaultSupplier(supplierKeyName, supplierEndpoints), - testproxy.WithDefaultApplication(appPrivateKey), - // Missing session supplier - testproxy.WithDefaultSessionSupplier("", "service1", appPrivateKey), - }, - inputScenario: sendRequestWithInvalidRelaySupplier, - - expectedErrCode: -32000, - expectedErrMsg: "error while trying to retrieve a session", - }, - { - desc: "Relay request signature does not match the request payload", - - relayerProxyBehavior: defaultRelayerProxyBehavior, - inputScenario: sendRequestWithSignatureForDifferentPayload, - - expectedErrCode: -32000, - expectedErrMsg: "invalid ring signature", - }, - { - desc: "Successful relay", - - relayerProxyBehavior: defaultRelayerProxyBehavior, - inputScenario: sendRequestWithSuccessfulReply, - - expectedErrCode: 0, - expectedErrMsg: "", - }, - } - - ctx := context.TODO() - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - ctx, cancel := context.WithCancel(ctx) - test := testproxy.NewRelayerProxyTestBehavior(ctx, t, tt.relayerProxyBehavior...) - - rp, err := proxy.NewRelayerProxy( - test.Deps, - proxy.WithSigningKeyName(supplierKeyName), - proxy.WithProxiedServicesEndpoints(proxiedServices), - ) - require.NoError(t, err) - - go rp.Start(ctx) - // Block so relayerProxy has sufficient time to start - time.Sleep(100 * time.Millisecond) - - errCode, errMsg := tt.inputScenario(t, test) - require.Equal(t, tt.expectedErrCode, errCode) - require.True(t, strings.HasPrefix(errMsg, tt.expectedErrMsg)) - - cancel() - }) - } -} - -func sendRequestWithUnparsableBody( - t *testing.T, - test *testproxy.TestBehavior, -) (errorCode int32, errorMessage string) { - // Send non JSONRpc payload when the post request specifies json - reader := io.NopCloser(bytes.NewReader([]byte("invalid request"))) - - res, err := http.DefaultClient.Post( - fmt.Sprintf("http://%s", proxiedServices["server1"].Host), - "application/json", - reader, - ) - require.NoError(t, err) - require.NotNil(t, res) - - return testproxy.GetRelayResponseError(t, res) -} - -func sendRequestWithMissingMeta( - t *testing.T, - test *testproxy.TestBehavior, -) (errorCode int32, errorMessage string) { - - req := &servicetypes.RelayRequest{ - // RelayRequest is missing Metadata - Payload: testproxy.PrepareJsonRPCRequestPayload(), - } - - return testproxy.MarshalAndSend(test, proxiedServices, "server1", "service1", req) -} - -func sendRequestWithMissingSignature( - t *testing.T, - test *testproxy.TestBehavior, -) (errorCode int32, errorMessage string) { - req := testproxy.GenerateRelayRequest( - test, - appPrivateKey, - "service1", - blockHeight, - testproxy.PrepareJsonRPCRequestPayload(), - ) - req.Meta.Signature = nil - return testproxy.MarshalAndSend(test, proxiedServices, "server1", "service1", req) -} - -func sendRequestWithInvalidSignature( - t *testing.T, - test *testproxy.TestBehavior, -) (errorCode int32, errorMessage string) { - req := testproxy.GenerateRelayRequest( - test, - appPrivateKey, - "service1", - blockHeight, - testproxy.PrepareJsonRPCRequestPayload(), - ) - req.Meta.Signature = []byte("invalid signature") - - return testproxy.MarshalAndSend(test, proxiedServices, "server1", "service1", req) -} - -func sendRequestWithMissingSessionHeaderApplicationAddress( - t *testing.T, - test *testproxy.TestBehavior, -) (errCode int32, errorMessage string) { - randomPrivKey := secp256k1.GenPrivKey() - req := testproxy.GenerateRelayRequest( - test, - randomPrivKey, - "service1", - blockHeight, - testproxy.PrepareJsonRPCRequestPayload(), - ) - - // The application address is missing from the session header - req.Meta.SessionHeader.ApplicationAddress = "" - - // Assign a valid but random ring signature so that the request is not rejected - // before looking at the application address - req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, randomPrivKey) - - return testproxy.MarshalAndSend(test, proxiedServices, "server1", "service1", req) -} - -func sendRequestWithNonStakedApplicationAddress( - t *testing.T, - test *testproxy.TestBehavior, -) (errCode int32, errorMessage string) { - randomPrivKey := secp256k1.GenPrivKey() - req := testproxy.GenerateRelayRequest( - test, - randomPrivKey, - "service1", - blockHeight, - testproxy.PrepareJsonRPCRequestPayload(), - ) - - // Have a valid signature from the non staked key - req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, randomPrivKey) - - return testproxy.MarshalAndSend(test, proxiedServices, "server1", "service1", req) -} - -func sendRequestWithRingSignatureMismatch( - t *testing.T, - test *testproxy.TestBehavior, -) (errCode int32, errorMessage string) { - req := testproxy.GenerateRelayRequest( - test, - appPrivateKey, - "service1", - blockHeight, - testproxy.PrepareJsonRPCRequestPayload(), - ) - - // The signature is valid but does not match the ring for the application address - randomPrivKey := secp256k1.GenPrivKey() - req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, randomPrivKey) - - return testproxy.MarshalAndSend(test, proxiedServices, "server1", "service1", req) -} - -func sendRequestWithDifferentSession( - t *testing.T, - test *testproxy.TestBehavior, -) (errCode int32, errorMessage string) { - // Use service2 instead of service1 so the session IDs don't match - req := testproxy.GenerateRelayRequest( - test, - appPrivateKey, - "service2", - blockHeight, - testproxy.PrepareJsonRPCRequestPayload(), - ) - req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, appPrivateKey) - - return testproxy.MarshalAndSend(test, proxiedServices, "server1", "service1", req) -} - -func sendRequestWithInvalidRelaySupplier( - t *testing.T, - test *testproxy.TestBehavior, -) (errCode int32, errorMessage string) { - req := testproxy.GenerateRelayRequest( - test, - appPrivateKey, - "service1", - blockHeight, - testproxy.PrepareJsonRPCRequestPayload(), - ) - req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, appPrivateKey) - - return testproxy.MarshalAndSend(test, proxiedServices, "server1", "service1", req) -} - -func sendRequestWithSignatureForDifferentPayload( - t *testing.T, - test *testproxy.TestBehavior, -) (errCode int32, errorMessage string) { - req := testproxy.GenerateRelayRequest( - test, appPrivateKey, - "service1", - blockHeight, - testproxy.PrepareJsonRPCRequestPayload(), - ) - req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, appPrivateKey) - - // Alter the request payload so the hash doesn't match the one used by the signature - req.Payload = []byte(`{"method":"someMethod","id":1,"jsonrpc":"2.0","params":["alteredParam"]}`) - - return testproxy.MarshalAndSend(test, proxiedServices, "server1", "service1", req) -} - -func sendRequestWithSuccessfulReply( - t *testing.T, - test *testproxy.TestBehavior, -) (errCode int32, errorMessage string) { - req := testproxy.GenerateRelayRequest( - test, - appPrivateKey, - "service1", - blockHeight, - testproxy.PrepareJsonRPCRequestPayload(), - ) - req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, appPrivateKey) - - return testproxy.MarshalAndSend(test, proxiedServices, "server1", "service1", req) -} diff --git a/pkg/relayer/proxy/relay_builders.go b/pkg/relayer/proxy/relay_builders.go deleted file mode 100644 index c6e9c9a77..000000000 --- a/pkg/relayer/proxy/relay_builders.go +++ /dev/null @@ -1,53 +0,0 @@ -package proxy - -import ( - "io" - "net/http" - - "github.com/pokt-network/poktroll/x/service/types" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" -) - -// newRelayRequest builds a RelayRequest from an http.Request. -func (sync *synchronousRPCServer) newRelayRequest(request *http.Request) (*types.RelayRequest, error) { - requestBz, err := io.ReadAll(request.Body) - if err != nil { - return nil, err - } - - sync.logger.Debug().Msg("unmarshaling relay request") - - var relayReq types.RelayRequest - if err := relayReq.Unmarshal(requestBz); err != nil { - sync.logger.Debug().Msg("unmarshaling relay request failed") - return nil, err - } - - return &relayReq, nil -} - -// newRelayResponse builds a RelayResponse from an http.Response and a SessionHeader. -// It also signs the RelayResponse and assigns it to RelayResponse.Meta.SupplierSignature. -// The response's Body is passed directly into the RelayResponse.Payload field. -func (sync *synchronousRPCServer) newRelayResponse( - response *http.Response, - sessionHeader *sessiontypes.SessionHeader, -) (*types.RelayResponse, error) { - relayResponse := &types.RelayResponse{ - Meta: &types.RelayResponseMetadata{SessionHeader: sessionHeader}, - } - - responseBz, err := io.ReadAll(response.Body) - if err != nil { - return nil, err - } - - relayResponse.Payload = responseBz - - // Sign the relay response and add the signature to the relay response metadata - if err = sync.relayerProxy.SignRelayResponse(relayResponse); err != nil { - return nil, err - } - - return relayResponse, nil -} diff --git a/pkg/relayer/proxy/relay_signer.go b/pkg/relayer/proxy/relay_signer.go deleted file mode 100644 index 347bf6228..000000000 --- a/pkg/relayer/proxy/relay_signer.go +++ /dev/null @@ -1,34 +0,0 @@ -package proxy - -import ( - sdkerrors "cosmossdk.io/errors" - - "github.com/pokt-network/poktroll/pkg/signer" - "github.com/pokt-network/poktroll/x/service/types" -) - -// SignRelayResponse is a shared method used by the RelayServers to sign the hash of the RelayResponse. -// It uses the keyring and keyName to sign the payload and returns the signature. -// TODO_TECHDEBT(@red-0ne): This method should be moved out of the RelayerProxy interface -// that should not be responsible for signing relay responses. -// See https://github.com/pokt-network/poktroll/issues/160 for a better design. -func (rp *relayerProxy) SignRelayResponse(relayResponse *types.RelayResponse) error { - // create a simple signer for the request - signer := signer.NewSimpleSigner(rp.keyring, rp.signingKeyName) - - // extract and hash the relay response's signable bytes - signableBz, err := relayResponse.GetSignableBytesHash() - if err != nil { - return sdkerrors.Wrapf(ErrRelayerProxyInvalidRelayResponse, "error getting signable bytes: %v", err) - } - - // sign the relay response - responseSig, err := signer.Sign(signableBz) - if err != nil { - return sdkerrors.Wrapf(ErrRelayerProxyInvalidRelayResponse, "error signing relay response: %v", err) - } - - // set the relay response's signature - relayResponse.Meta.SupplierSignature = responseSig - return nil -} diff --git a/pkg/relayer/proxy/relay_verifier.go b/pkg/relayer/proxy/relay_verifier.go deleted file mode 100644 index ce48e055e..000000000 --- a/pkg/relayer/proxy/relay_verifier.go +++ /dev/null @@ -1,131 +0,0 @@ -package proxy - -import ( - "context" - - sdkerrors "cosmossdk.io/errors" - ring_secp256k1 "github.com/athanorlabs/go-dleq/secp256k1" - ring "github.com/noot/ring-go" - - "github.com/pokt-network/poktroll/x/service/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// VerifyRelayRequest is a shared method used by RelayServers to check the relay request signature and session validity. -func (rp *relayerProxy) VerifyRelayRequest( - ctx context.Context, - relayRequest *types.RelayRequest, - service *sharedtypes.Service, -) error { - rp.logger.Debug(). - Fields(map[string]any{ - "session_id": relayRequest.Meta.SessionHeader.SessionId, - "application_address": relayRequest.Meta.SessionHeader.ApplicationAddress, - "service_id": relayRequest.Meta.SessionHeader.Service.Id, - }). - Msg("verifying relay request signature") - - // extract the relay request's ring signature - if relayRequest.Meta == nil { - return ErrRelayerProxyEmptyRelayRequestSignature.Wrapf( - "request payload: %s", relayRequest.Payload, - ) - } - signature := relayRequest.Meta.Signature - if signature == nil { - return sdkerrors.Wrapf( - ErrRelayerProxyInvalidRelayRequest, - "missing signature from relay request: %v", relayRequest, - ) - } - - ringSig := new(ring.RingSig) - if err := ringSig.Deserialize(ring_secp256k1.NewCurve(), signature); err != nil { - return sdkerrors.Wrapf( - ErrRelayerProxyInvalidRelayRequestSignature, - "error deserializing ring signature: %v", err, - ) - } - - if relayRequest.Meta.SessionHeader.ApplicationAddress == "" { - return sdkerrors.Wrap( - ErrRelayerProxyInvalidRelayRequest, - "missing application address from relay request", - ) - } - - // get the ring for the application address of the relay request - appAddress := relayRequest.Meta.SessionHeader.ApplicationAddress - appRing, err := rp.ringCache.GetRingForAddress(ctx, appAddress) - if err != nil { - return sdkerrors.Wrapf( - ErrRelayerProxyInvalidRelayRequest, - "error getting ring for application address %s: %v", appAddress, err, - ) - } - - // verify the ring signature against the ring - if !ringSig.Ring().Equals(appRing) { - return sdkerrors.Wrapf( - ErrRelayerProxyInvalidRelayRequestSignature, - "ring signature does not match ring for application address %s", appAddress, - ) - } - - // get and hash the signable bytes of the relay request - requestSignableBz, err := relayRequest.GetSignableBytesHash() - if err != nil { - return sdkerrors.Wrapf(ErrRelayerProxyInvalidRelayRequest, "error getting signable bytes: %v", err) - } - - // verify the relay request's signature - if valid := ringSig.Verify(requestSignableBz); !valid { - return sdkerrors.Wrapf( - ErrRelayerProxyInvalidRelayRequestSignature, - "invalid ring signature", - ) - } - - // Query for the current session to check if relayRequest sessionId matches the current session. - rp.logger.Debug(). - Fields(map[string]any{ - "session_id": relayRequest.Meta.SessionHeader.SessionId, - "application_address": relayRequest.Meta.SessionHeader.ApplicationAddress, - "service_id": relayRequest.Meta.SessionHeader.Service.Id, - }). - Msg("verifying relay request session") - - // TODO_BLOCKER(#275): Need to either slow down blocks, increase num blocks - // per session, BlocksPerSession. See the following comment for more details: - // https://github.com/pokt-network/poktroll/issues/275#issuecomment-1863519333 - currentBlock := rp.blockClient.LastNBlocks(ctx, 1)[0] - session, err := rp.sessionQuerier.GetSession(ctx, appAddress, service.Id, currentBlock.Height()) - - if err != nil { - return err - } - - // Since the retrieved sessionId was in terms of: - // - the current block height (which is not provided by the relayRequest) - // - serviceId (which is not provided by the relayRequest) - // - applicationAddress (which is used to to verify the relayRequest signature) - // we can reduce the session validity check to checking if the retrieved session's sessionId - // matches the relayRequest sessionId. - // TODO_INVESTIGATE: Revisit the assumptions above at some point in the future, but good enough for now. - if session.SessionId != relayRequest.Meta.SessionHeader.SessionId { - return ErrRelayerProxyInvalidSession.Wrapf( - "session mismatch, expecting: %+v, got: %+v", - session.Header, - relayRequest.Meta.SessionHeader, - ) - } - - // Check if the relayRequest is allowed to be served by the relayer proxy. - for _, supplier := range session.Suppliers { - if supplier.Address == rp.supplierAddress { - return nil - } - } - - return ErrRelayerProxyInvalidSupplier -} diff --git a/pkg/relayer/proxy/server_builder.go b/pkg/relayer/proxy/server_builder.go deleted file mode 100644 index a42e876be..000000000 --- a/pkg/relayer/proxy/server_builder.go +++ /dev/null @@ -1,109 +0,0 @@ -package proxy - -import ( - "context" - "net/url" - - "golang.org/x/exp/slices" - - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/config" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// BuildProvidedServices builds the advertised relay servers from the supplier's on-chain advertised services. -// It populates the relayerProxy's `advertisedRelayServers` map of servers for each service, where each server -// is responsible for listening for incoming relay requests and relaying them to the supported proxied service. -func (rp *relayerProxy) BuildProvidedServices(ctx context.Context) error { - // Get the supplier address from the keyring - supplierKey, err := rp.keyring.Key(rp.signingKeyName) - if err != nil { - return err - } - - supplierAddress, err := supplierKey.GetAddress() - if err != nil { - return err - } - - // Get the supplier's advertised information from the blockchain - supplier, err := rp.supplierQuerier.GetSupplier(ctx, supplierAddress.String()) - if err != nil { - return err - } - - // Check that the supplier's advertised services' endpoints are present in - // the proxy config and handled by a proxy host - // Iterate over the supplier's advertised services then iterate over each - // service's endpoint - for _, service := range supplier.Services { - for _, endpoint := range service.Endpoints { - endpointUrl, err := url.Parse(endpoint.Url) - if err != nil { - return err - } - found := false - // Iterate over the proxy configs and check if `endpointUrl` is present - // in any of the proxy config's suppliers' service's hosts - for _, proxyConfig := range rp.proxyConfigs { - supplierService, ok := proxyConfig.Suppliers[service.Service.Id] - if ok && slices.Contains(supplierService.Hosts, endpointUrl.Host) { - found = true - break - } - } - - if !found { - return ErrRelayerProxyServiceEndpointNotHandled.Wrapf( - "service endpoint %s not handled by proxy", - endpoint.Url, - ) - } - } - } - - if rp.proxyServers, err = rp.initializeProxyServers(supplier.Services); err != nil { - return err - } - - rp.supplierAddress = supplier.Address - - return nil -} - -// initializeProxyServers initializes the proxy servers for each proxy config. -func (rp *relayerProxy) initializeProxyServers( - supplierServices []*sharedtypes.SupplierServiceConfig, -) (proxyServerMap map[string]relayer.RelayServer, err error) { - // Build a map of serviceId -> service for the supplier's advertised services - supplierServiceMap := make(map[string]*sharedtypes.Service) - for _, service := range supplierServices { - supplierServiceMap[service.Service.Id] = service.Service - } - - // Build a map of proxyName -> RelayServer for each proxy defined in the config file - proxyServers := make(map[string]relayer.RelayServer) - - for _, proxyConfig := range rp.proxyConfigs { - rp.logger.Info().Str("proxy host", proxyConfig.Host).Msg("starting relay proxy server") - - // TODO(@h5law): Implement a switch that handles all synchronous - // RPC types in one server type and asynchronous RPC types in another - // to create the appropriate RelayServer. - // Initialize the proxy server according to the proxy type defined in the config file - switch proxyConfig.Type { - case config.ProxyTypeHTTP: - proxyServers[proxyConfig.ProxyName] = NewSynchronousServer( - rp.logger, - proxyConfig, - supplierServiceMap, - rp.servedRelaysPublishCh, - rp, - ) - default: - return nil, ErrRelayerProxyUnsupportedTransportType - } - } - - return proxyServers, nil -} diff --git a/pkg/relayer/proxy/synchronous.go b/pkg/relayer/proxy/synchronous.go deleted file mode 100644 index 85b181f43..000000000 --- a/pkg/relayer/proxy/synchronous.go +++ /dev/null @@ -1,265 +0,0 @@ -package proxy - -import ( - "bytes" - "context" - "io" - "net/http" - "net/url" - - sdkerrors "cosmossdk.io/errors" - - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/config" - "github.com/pokt-network/poktroll/x/service/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -var _ relayer.RelayServer = (*synchronousRPCServer)(nil) - -// synchronousRPCServer is the struct that holds the state of the synchronous -// RPC server. It is used to listen for and respond to relay requests where -// there is a one-to-one correspondence between relay requests and relay responses. -type synchronousRPCServer struct { - logger polylog.Logger - - // supplierServiceMap is a map of serviceId -> SupplierServiceConfig - // representing the supplier's advertised services. - supplierServiceMap map[string]*sharedtypes.Service - - // proxyConfig is the configuration of the proxy server. It contains the - // host address of the server, the service endpoint, and the advertised service. - // endpoints it gets relay requests from. - proxyConfig *config.RelayMinerProxyConfig - - // server is the HTTP server that listens for incoming relay requests. - server *http.Server - - // relayerProxy is the main relayer proxy that the server uses to perform its operations. - relayerProxy relayer.RelayerProxy - - // servedRelaysProducer is a channel that emits the relays that have been served, allowing - // the servedRelays observable to fan-out notifications to its subscribers. - servedRelaysProducer chan<- *types.Relay -} - -// NewSynchronousServer creates a new HTTP server that listens for incoming -// relay requests and forwards them to the supported proxied service endpoint. -// It takes the serviceId, endpointUrl, and the main RelayerProxy as arguments -// and returns a RelayServer that listens to incoming RelayRequests. -func NewSynchronousServer( - logger polylog.Logger, - proxyConfig *config.RelayMinerProxyConfig, - supplierServiceMap map[string]*sharedtypes.Service, - servedRelaysProducer chan<- *types.Relay, - proxy relayer.RelayerProxy, -) relayer.RelayServer { - return &synchronousRPCServer{ - logger: logger, - supplierServiceMap: supplierServiceMap, - server: &http.Server{Addr: proxyConfig.Host}, - relayerProxy: proxy, - servedRelaysProducer: servedRelaysProducer, - proxyConfig: proxyConfig, - } -} - -// Start starts the service server and returns an error if it fails. -// It also waits for the passed in context to end before shutting down. -// This method is blocking and should be called in a goroutine. -func (sync *synchronousRPCServer) Start(ctx context.Context) error { - go func() { - <-ctx.Done() - sync.server.Shutdown(ctx) - }() - - // Set the HTTP handler. - sync.server.Handler = sync - - return sync.server.ListenAndServe() -} - -// Stop terminates the service server and returns an error if it fails. -func (sync *synchronousRPCServer) Stop(ctx context.Context) error { - return sync.server.Shutdown(ctx) -} - -// ServeHTTP listens for incoming relay requests. It implements the respective -// method of the http.Handler interface. It is called by http.ListenAndServe() -// when synchronousRPCServer is used as an http.Handler with an http.Server. -// (see https://pkg.go.dev/net/http#Handler) -func (sync *synchronousRPCServer) ServeHTTP(writer http.ResponseWriter, request *http.Request) { - ctx := request.Context() - - var originHost string - // When the proxy is behind a reverse proxy, or is getting its requests from - // a CDN or a load balancer, the host header may not contain the on-chain - // advertized address needed to determine the service that the relay request is for. - // These CDNs and reverse proxies usually set the X-Forwarded-Host header - // to the original host. - // RelayMiner operators that have such a setup can set the XForwardedHostLookup - // option to true in the proxy config to enable the proxy to look up the - // original host from the X-Forwarded-Host header. - // Get the original host from X-Forwarded-Host header if specified in the proxy - // config and fall back to the Host header if it is not specified. - if sync.proxyConfig.XForwardedHostLookup { - originHost = request.Header.Get("X-Forwarded-Host") - } - - if originHost == "" { - originHost = request.Host - } - - var supplierService *sharedtypes.Service - var serviceUrl *url.URL - - // Get the Service and serviceUrl corresponding to the originHost. - // TODO_IMPROVE(red-0ne): Checking that the originHost is currently done by - // iterating over the proxy config's suppliers and checking if the originHost - // is present in any of the supplier's service's hosts. We could improve this - // by building a map at the server initialization level with originHost as the - // key so that we can get the service and serviceUrl in O(1) time. - for _, supplierServiceConfig := range sync.proxyConfig.Suppliers { - for _, host := range supplierServiceConfig.Hosts { - if host == originHost { - supplierService = sync.supplierServiceMap[supplierServiceConfig.ServiceId] - serviceUrl = supplierServiceConfig.ServiceConfig.Url - break - } - } - - if serviceUrl != nil { - break - } - } - - if supplierService == nil || serviceUrl == nil { - sync.replyWithError(ctx, []byte{}, writer, ErrRelayerProxyServiceEndpointNotHandled) - return - } - - sync.logger.Debug().Msg("serving synchronous relay request") - - // Extract the relay request from the request body. - sync.logger.Debug().Msg("extracting relay request from request body") - relayRequest, err := sync.newRelayRequest(request) - if err != nil { - sync.replyWithError(ctx, []byte{}, writer, err) - sync.logger.Warn().Err(err).Msg("failed serving relay request") - return - } - - if relayRequest.Meta == nil { - err = sdkerrors.Wrapf( - ErrRelayerProxyInvalidRelayRequest, - "missing meta from relay request: %v", relayRequest, - ) - sync.replyWithError(ctx, relayRequest.Payload, writer, err) - sync.logger.Warn().Err(err).Msg("relay request metadata is nil which could be a result of failed unmashaling") - return - } - - // Relay the request to the proxied service and build the response that will be sent back to the client. - relay, err := sync.serveHTTP(ctx, serviceUrl, supplierService, request, relayRequest) - if err != nil { - // Reply with an error if the relay could not be served. - sync.replyWithError(ctx, relayRequest.Payload, writer, err) - sync.logger.Warn().Err(err).Msg("failed serving relay request") - return - } - - // Send the relay response to the client. - if err := sync.sendRelayResponse(relay.Res, writer); err != nil { - sync.replyWithError(ctx, relayRequest.Payload, writer, err) - sync.logger.Warn().Err(err).Msg("failed sending relay response") - return - } - - sync.logger.Info().Fields(map[string]any{ - "application_address": relay.Res.Meta.SessionHeader.ApplicationAddress, - "service_id": relay.Res.Meta.SessionHeader.Service.Id, - "session_start_height": relay.Res.Meta.SessionHeader.SessionStartBlockHeight, - "server_addr": sync.server.Addr, - }).Msg("relay request served successfully") - - // Emit the relay to the servedRelays observable. - sync.servedRelaysProducer <- relay -} - -// serveHTTP holds the underlying logic of ServeHTTP. -func (sync *synchronousRPCServer) serveHTTP( - ctx context.Context, - serviceUrl *url.URL, - supplierService *sharedtypes.Service, - request *http.Request, - relayRequest *types.RelayRequest, -) (*types.Relay, error) { - // Verify the relay request signature and session. - // TODO_TECHDEBT(red-0ne): Currently, the relayer proxy is responsible for verifying - // the relay request signature. This responsibility should be shifted to the relayer itself. - // Consider using a middleware pattern to handle non-proxy specific logic, such as - // request signature verification, session verification, and response signature. - // This would help in separating concerns and improving code maintainability. - // See https://github.com/pokt-network/poktroll/issues/160 - if err := sync.relayerProxy.VerifyRelayRequest(ctx, relayRequest, supplierService); err != nil { - return nil, err - } - - // Get the relayRequest payload's `io.ReadCloser` to add it to the http.Request - // that will be sent to the proxied (i.e. staked for) service. - // (see https://pkg.go.dev/net/http#Request) Body field type. - requestBodyReader := io.NopCloser(bytes.NewBuffer(relayRequest.Payload)) - sync.logger.Debug(). - Str("request_payload", string(relayRequest.Payload)). - Msg("serving relay request") - - // Build the request to be sent to the native service by substituting - // the destination URL's host with the native service's listen address. - sync.logger.Debug(). - Str("destination_url", serviceUrl.String()). - Msg("building relay request payload to service") - - relayHTTPRequest := &http.Request{ - Method: request.Method, - Header: request.Header, - URL: serviceUrl, - Host: serviceUrl.Host, - Body: requestBodyReader, - } - - // Send the relay request to the native service. - httpResponse, err := http.DefaultClient.Do(relayHTTPRequest) - if err != nil { - return nil, err - } - - // Build the relay response from the native service response - // Use relayRequest.Meta.SessionHeader on the relayResponse session header since it was verified to be valid - // and has to be the same as the relayResponse session header. - sync.logger.Debug(). - Str("relay_request_session_header", relayRequest.Meta.SessionHeader.String()). - Msg("building relay response protobuf from service response") - - relayResponse, err := sync.newRelayResponse(httpResponse, relayRequest.Meta.SessionHeader) - if err != nil { - return nil, err - } - - return &types.Relay{Req: relayRequest, Res: relayResponse}, nil -} - -// sendRelayResponse marshals the relay response and sends it to the client. -func (sync *synchronousRPCServer) sendRelayResponse( - relayResponse *types.RelayResponse, - writer http.ResponseWriter, -) error { - cdc := types.ModuleCdc - relayResponseBz, err := cdc.Marshal(relayResponse) - if err != nil { - return err - } - - _, err = writer.Write(relayResponseBz) - return err -} diff --git a/pkg/relayer/relayminer.go b/pkg/relayer/relayminer.go deleted file mode 100644 index d9fdc6b2a..000000000 --- a/pkg/relayer/relayminer.go +++ /dev/null @@ -1,75 +0,0 @@ -package relayer - -import ( - "context" - - "cosmossdk.io/depinject" - - "github.com/pokt-network/poktroll/pkg/polylog" -) - -// relayMiner is the main struct that encapsulates the relayer's responsibilities (i.e. Relay Mining). -// It starts and stops the RelayerProxy and provide the served relays observable to the miner. -type relayMiner struct { - logger polylog.Logger - relayerProxy RelayerProxy - miner Miner - relayerSessionsManager RelayerSessionsManager -} - -// NewRelayMiner creates a new Relayer instance with the given dependencies. -// It injects the dependencies into the Relayer instance and returns it. -// -// Required dependencies: -// - RelayerProxy -// - Miner -// - RelayerSessionsManager -func NewRelayMiner(ctx context.Context, deps depinject.Config) (*relayMiner, error) { - rel := &relayMiner{ - logger: polylog.Ctx(ctx), - } - - if err := depinject.Inject( - deps, - &rel.relayerProxy, - &rel.miner, - &rel.relayerSessionsManager, - ); err != nil { - return nil, err - } - - // Set up relay pipeline - servedRelaysObs := rel.relayerProxy.ServedRelays() - minedRelaysObs := rel.miner.MinedRelays(ctx, servedRelaysObs) - rel.relayerSessionsManager.InsertRelays(minedRelaysObs) - - return rel, nil -} - -// Start provides the miner with the served relays observable and starts the relayer proxy. -// This method is blocking while the relayer proxy is running and returns when Stop is called -// or when the relayer proxy fails to start. -func (rel *relayMiner) Start(ctx context.Context) error { - // relayerSessionsManager.Start does not block. - // Set up the session (proof/claim) lifecycle pipeline. - rel.logger.Info().Msg("starting relayer sessions manager") - rel.relayerSessionsManager.Start(ctx) - - // Start the flow of relays by starting relayer proxy. - // This is a blocking call as it waits for the waitgroup in relayerProxy.Start() - // that starts all the relay servers to be done. - rel.logger.Info().Msg("starting relayer proxy") - if err := rel.relayerProxy.Start(ctx); err != nil { - return err - } - - rel.logger.Info().Msg("relayer proxy stopped; exiting") - return nil -} - -// Stop stops the relayer proxy which in turn stops all advertised relay servers -// and unsubscribes the miner from the served relays observable. -func (rel *relayMiner) Stop(ctx context.Context) error { - rel.relayerSessionsManager.Stop() - return rel.relayerProxy.Stop(ctx) -} diff --git a/pkg/relayer/relayminer_test.go b/pkg/relayer/relayminer_test.go deleted file mode 100644 index f7de39d39..000000000 --- a/pkg/relayer/relayminer_test.go +++ /dev/null @@ -1,59 +0,0 @@ -package relayer_test - -import ( - "context" - "testing" - "time" - - "cosmossdk.io/depinject" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/polylog/polyzero" - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/testutil/testrelayer" - servicetypes "github.com/pokt-network/poktroll/x/service/types" -) - -func TestRelayMiner_StartAndStop(t *testing.T) { - srObs, _ := channel.NewObservable[*servicetypes.Relay]() - servedRelaysObs := relayer.RelaysObservable(srObs) - - mrObs, _ := channel.NewObservable[*relayer.MinedRelay]() - minedRelaysObs := relayer.MinedRelaysObservable(mrObs) - - ctx := polyzero.NewLogger().WithContext(context.Background()) - relayerProxyMock := testrelayer.NewMockOneTimeRelayerProxy( - ctx, t, - servedRelaysObs, - ) - - minerMock := testrelayer.NewMockOneTimeMiner( - ctx, t, - servedRelaysObs, - minedRelaysObs, - ) - - relayerSessionsManagerMock := testrelayer.NewMockOneTimeRelayerSessionsManager( - ctx, t, - minedRelaysObs, - ) - - deps := depinject.Supply( - relayerProxyMock, - minerMock, - relayerSessionsManagerMock, - ) - - relayminer, err := relayer.NewRelayMiner(ctx, deps) - require.NoError(t, err) - require.NotNil(t, relayminer) - - err = relayminer.Start(ctx) - require.NoError(t, err) - - time.Sleep(time.Millisecond) - - err = relayminer.Stop(ctx) - require.NoError(t, err) -} diff --git a/pkg/relayer/session/claim.go b/pkg/relayer/session/claim.go deleted file mode 100644 index 22c3affe2..000000000 --- a/pkg/relayer/session/claim.go +++ /dev/null @@ -1,134 +0,0 @@ -package session - -import ( - "context" - "fmt" - - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/observable/filter" - "github.com/pokt-network/poktroll/pkg/observable/logging" - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/protocol" -) - -// createClaims maps over the sessionsToClaimObs observable. For each claim, it: -// 1. Calculates the earliest block height at which it is safe to CreateClaim -// 2. Waits for said block and creates the claim on-chain -// 3. Maps errors to a new observable and logs them -// 4. Returns an observable of the successfully claimed sessions -// It DOES NOT BLOCK as map operations run in their own goroutines. -func (rs *relayerSessionsManager) createClaims(ctx context.Context) observable.Observable[relayer.SessionTree] { - // Map sessionsToClaimObs to a new observable of the same type which is notified - // when the session is eligible to be claimed. - sessionsWithOpenClaimWindowObs := channel.Map( - ctx, rs.sessionsToClaimObs, - rs.mapWaitForEarliestCreateClaimHeight, - ) - - failedCreateClaimSessionsObs, failedCreateClaimSessionsPublishCh := channel.NewObservable[relayer.SessionTree]() - - // Map sessionsWithOpenClaimWindowObs to a new observable of an either type, - // populated with the session or an error, which is notified after the session - // claim has been created or an error has been encountered, respectively. - eitherClaimedSessionsObs := channel.Map( - ctx, sessionsWithOpenClaimWindowObs, - rs.newMapClaimSessionFn(failedCreateClaimSessionsPublishCh), - ) - - // TODO_TECHDEBT: pass failed create claim sessions to some retry mechanism. - _ = failedCreateClaimSessionsObs - logging.LogErrors(ctx, filter.EitherError(ctx, eitherClaimedSessionsObs)) - - // Map eitherClaimedSessions to a new observable of relayer.SessionTree which - // is notified when the corresponding claim creation succeeded. - return filter.EitherSuccess(ctx, eitherClaimedSessionsObs) -} - -// mapWaitForEarliestCreateClaimHeight is intended to be used as a MapFn. It -// calculates and waits for the earliest block height, allowed by the protocol, -// at which a claim can be created for the given session, then emits the session -// **at that moment**. -func (rs *relayerSessionsManager) mapWaitForEarliestCreateClaimHeight( - ctx context.Context, - session relayer.SessionTree, -) (_ relayer.SessionTree, skip bool) { - rs.waitForEarliestCreateClaimHeight( - ctx, session.GetSessionHeader().GetSessionEndBlockHeight(), - ) - return session, false -} - -// waitForEarliestCreateClaimHeight calculates and waits for (blocking until) the -// earliest block height, allowed by the protocol, at which a claim can be created -// for a session with the given sessionEndHeight. It is calculated relative to -// sessionEndHeight using on-chain governance parameters and randomized input. -// It IS A BLOCKING function. -func (rs *relayerSessionsManager) waitForEarliestCreateClaimHeight( - ctx context.Context, - sessionEndHeight int64, -) { - logger := polylog.Ctx(ctx) - - // TODO_TECHDEBT: refactor this logic to a shared package. - - createClaimWindowStartHeight := sessionEndHeight - // TODO_TECHDEBT: query the on-chain governance parameter once available. - // + claimproofparams.GovCreateClaimWindowStartHeightOffset - - // we wait for createClaimWindowStartHeight to be received before proceeding since we need its hash - // to know where this servicer's claim submission window starts. - logger.Info(). - Int64("create_claim_window_start_height", createClaimWindowStartHeight). - Msg("waiting & blocking for global earliest claim submission height") - createClaimWindowStartBlock := rs.waitForBlock(ctx, createClaimWindowStartHeight) - - logger.Info(). - Int64("create_claim_window_start_height", createClaimWindowStartBlock.Height()). - Str("hash", fmt.Sprintf("%x", createClaimWindowStartBlock.Hash())). - Msg("received global earliest claim submission height") - - earliestCreateClaimHeight := protocol.GetEarliestCreateClaimHeight(ctx, createClaimWindowStartBlock) - - logger.Info(). - Int64("earliest_create_claim_height", earliestCreateClaimHeight). - Str("hash", fmt.Sprintf("%x", createClaimWindowStartBlock.Hash())). - Msg("waiting & blocking for earliest claim creation height for this supplier") - - _ = rs.waitForBlock(ctx, earliestCreateClaimHeight) -} - -// newMapClaimSessionFn returns a new MapFn that creates a claim for the given -// session. Any session which encounters an error while creating a claim is sent -// on the failedCreateClaimSessions channel. -func (rs *relayerSessionsManager) newMapClaimSessionFn( - failedCreateClaimSessionsPublishCh chan<- relayer.SessionTree, -) channel.MapFn[relayer.SessionTree, either.SessionTree] { - return func( - ctx context.Context, - session relayer.SessionTree, - ) (_ either.SessionTree, skip bool) { - logger := polylog.Ctx(ctx) - - // this session should no longer be updated - claimRoot, err := session.Flush() - if err != nil { - return either.Error[relayer.SessionTree](err), false - } - - latestBlock := rs.blockClient.LastNBlocks(ctx, 1)[0] - logger.Info(). - Int64("current_block", latestBlock.Height()+1). - Msg("submitting claim") - - sessionHeader := session.GetSessionHeader() - if err := rs.supplierClient.CreateClaim(ctx, *sessionHeader, claimRoot); err != nil { - failedCreateClaimSessionsPublishCh <- session - return either.Error[relayer.SessionTree](err), false - } - - return either.Success(session), false - } -} diff --git a/pkg/relayer/session/errors.go b/pkg/relayer/session/errors.go deleted file mode 100644 index 520c85bc1..000000000 --- a/pkg/relayer/session/errors.go +++ /dev/null @@ -1,12 +0,0 @@ -package session - -import sdkerrors "cosmossdk.io/errors" - -var ( - codespace = "relayer_session" - ErrSessionTreeClosed = sdkerrors.Register(codespace, 1, "session tree already closed") - ErrSessionTreeNotClosed = sdkerrors.Register(codespace, 2, "session tree not closed") - ErrSessionTreeStorePathExists = sdkerrors.Register(codespace, 3, "session tree store path already exists") - ErrSessionTreeProofPathMismatch = sdkerrors.Register(codespace, 4, "session tree proof path mismatch") - ErrSessionTreeUndefinedStoresDirectory = sdkerrors.Register(codespace, 5, "session tree key-value store directory undefined for where they will be saved on disk") -) diff --git a/pkg/relayer/session/options.go b/pkg/relayer/session/options.go deleted file mode 100644 index 1edadc132..000000000 --- a/pkg/relayer/session/options.go +++ /dev/null @@ -1,13 +0,0 @@ -package session - -import ( - "github.com/pokt-network/poktroll/pkg/relayer" -) - -// WithStoresDirectory sets the path on disk where KVStore data files used to store -// SMST of work sessions are created. -func WithStoresDirectory(storesDirectory string) relayer.RelayerSessionsManagerOption { - return func(relSessionMgr relayer.RelayerSessionsManager) { - relSessionMgr.(*relayerSessionsManager).storesDirectory = storesDirectory - } -} diff --git a/pkg/relayer/session/proof.go b/pkg/relayer/session/proof.go deleted file mode 100644 index 135e76f64..000000000 --- a/pkg/relayer/session/proof.go +++ /dev/null @@ -1,119 +0,0 @@ -package session - -import ( - "context" - - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/observable/filter" - "github.com/pokt-network/poktroll/pkg/observable/logging" - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/protocol" -) - -// submitProofs maps over the given claimedSessions observable. -// For each session, it: -// 1. Calculates the earliest block height at which to submit a proof -// 2. Waits for said height and submits the proof on-chain -// 3. Maps errors to a new observable and logs them -// It DOES NOT BLOCKas map operations run in their own goroutines. -func (rs *relayerSessionsManager) submitProofs( - ctx context.Context, - claimedSessionsObs observable.Observable[relayer.SessionTree], -) { - // Map claimedSessionsObs to a new observable of the same type which is notified - // when the session is eligible to be proven. - sessionsWithOpenProofWindowObs := channel.Map( - ctx, claimedSessionsObs, - rs.mapWaitForEarliestSubmitProofHeight, - ) - - failedSubmitProofSessionsObs, failedSubmitProofSessionsPublishCh := channel.NewObservable[relayer.SessionTree]() - - // Map sessionsWithOpenProofWindow to a new observable of an either type, - // populated with the session or an error, which is notified after the session - // proof has been submitted or an error has been encountered, respectively. - eitherProvenSessionsObs := channel.Map( - ctx, sessionsWithOpenProofWindowObs, - rs.newMapProveSessionFn(failedSubmitProofSessionsPublishCh), - ) - - // TODO_TECHDEBT: pass failed submit proof sessions to some retry mechanism. - _ = failedSubmitProofSessionsObs - logging.LogErrors(ctx, filter.EitherError(ctx, eitherProvenSessionsObs)) -} - -// mapWaitForEarliestSubmitProofHeight is intended to be used as a MapFn. It -// calculates and waits for the earliest block height, allowed by the protocol, -// at which a proof can be submitted for the given session, then emits the session -// **at that moment**. -func (rs *relayerSessionsManager) mapWaitForEarliestSubmitProofHeight( - ctx context.Context, - session relayer.SessionTree, -) (_ relayer.SessionTree, skip bool) { - rs.waitForEarliestSubmitProofHeight( - ctx, session.GetSessionHeader().GetSessionEndBlockHeight(), - ) - return session, false -} - -// waitForEarliestSubmitProofHeight calculates and waits for (blocking until) the -// earliest block height, allowed by the protocol, at which a proof can be submitted -// for a session which was claimed at createClaimHeight. It is calculated relative -// to createClaimHeight using on-chain governance parameters and randomized input. -// It IS A BLOCKING function. -func (rs *relayerSessionsManager) waitForEarliestSubmitProofHeight( - ctx context.Context, - createClaimHeight int64, -) { - submitProofWindowStartHeight := createClaimHeight - // TODO_TECHDEBT: query the on-chain governance parameter once available. - // + claimproofparams.GovSubmitProofWindowStartHeightOffset - - // we wait for submitProofWindowStartHeight to be received before proceeding since we need its hash - rs.logger.Info(). - Int64("submitProofWindowStartHeight", submitProofWindowStartHeight). - Msg("waiting & blocking for global earliest proof submission height") - submitProofWindowStartBlock := rs.waitForBlock(ctx, submitProofWindowStartHeight) - - earliestSubmitProofHeight := protocol.GetEarliestSubmitProofHeight(ctx, submitProofWindowStartBlock) - _ = rs.waitForBlock(ctx, earliestSubmitProofHeight) -} - -// newMapProveSessionFn returns a new MapFn that submits a proof for the given -// session. Any session which encouters errors while submitting a proof is sent -// on the failedSubmitProofSessions channel. -func (rs *relayerSessionsManager) newMapProveSessionFn( - failedSubmitProofSessionsCh chan<- relayer.SessionTree, -) channel.MapFn[relayer.SessionTree, either.SessionTree] { - return func( - ctx context.Context, - session relayer.SessionTree, - ) (_ either.SessionTree, skip bool) { - // TODO_BLOCKER: The block that'll be used as a source of entropy for which - // branch(es) to prove should be deterministic and use on-chain governance params - // rather than latest. - latestBlock := rs.blockClient.LastNBlocks(ctx, 1)[0] - proof, err := session.ProveClosest(latestBlock.Hash()) - if err != nil { - return either.Error[relayer.SessionTree](err), false - } - - rs.logger.Info(). - Int64("currentBlockHeight", latestBlock.Height()+1). - Msg("submitting proof") - - // SubmitProof ensures on-chain proof inclusion so we can safely prune the tree. - if err := rs.supplierClient.SubmitProof( - ctx, - *session.GetSessionHeader(), - proof, - ); err != nil { - failedSubmitProofSessionsCh <- session - return either.Error[relayer.SessionTree](err), false - } - - return either.Success(session), false - } -} diff --git a/pkg/relayer/session/session.go b/pkg/relayer/session/session.go deleted file mode 100644 index 984d26648..000000000 --- a/pkg/relayer/session/session.go +++ /dev/null @@ -1,263 +0,0 @@ -package session - -import ( - "context" - "sync" - - "cosmossdk.io/depinject" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/observable/logging" - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/relayer" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" -) - -var _ relayer.RelayerSessionsManager = (*relayerSessionsManager)(nil) - -type sessionsTreesMap = map[int64]map[string]relayer.SessionTree - -// relayerSessionsManager is an implementation of the RelayerSessions interface. -// TODO_TEST: Add tests to the relayerSessionsManager. -type relayerSessionsManager struct { - logger polylog.Logger - - relayObs relayer.MinedRelaysObservable - - // sessionsToClaimObs notifies about sessions that are ready to be claimed. - sessionsToClaimObs observable.Observable[relayer.SessionTree] - - // sessionTrees is a map of block heights pointing to a map of SessionTrees - // indexed by their sessionId. - // The block height index is used to know when the sessions contained in the entry should be closed, - // this helps to avoid iterating over all sessionsTrees to check if they are ready to be closed. - sessionsTrees sessionsTreesMap - sessionsTreesMu *sync.Mutex - - // blockClient is used to get the notifications of committed blocks. - blockClient client.BlockClient - - // supplierClient is used to create claims and submit proofs for sessions. - supplierClient client.SupplierClient - - // storesDirectory points to a path on disk where KVStore data files are created. - storesDirectory string -} - -// NewRelayerSessions creates a new relayerSessions. -// -// Required dependencies: -// - client.BlockClient -// - client.SupplierClient -// -// Available options: -// - WithStoresDirectory -func NewRelayerSessions( - ctx context.Context, - deps depinject.Config, - opts ...relayer.RelayerSessionsManagerOption, -) (relayer.RelayerSessionsManager, error) { - rs := &relayerSessionsManager{ - logger: polylog.Ctx(ctx), - sessionsTrees: make(sessionsTreesMap), - sessionsTreesMu: &sync.Mutex{}, - } - - if err := depinject.Inject( - deps, - &rs.blockClient, - &rs.supplierClient, - ); err != nil { - return nil, err - } - - for _, opt := range opts { - opt(rs) - } - - if err := rs.validateConfig(); err != nil { - return nil, err - } - - rs.sessionsToClaimObs = channel.MapExpand[client.Block, relayer.SessionTree]( - ctx, - rs.blockClient.CommittedBlocksSequence(ctx), - rs.mapBlockToSessionsToClaim, - ) - - return rs, nil -} - -// Start maps over the session trees at the end of each, respective, session. -// The session trees are piped through a series of map operations which progress -// them through the claim/proof lifecycle, broadcasting transactions to the -// network as necessary. -// It IS NOT BLOCKING as map operations run in their own goroutines. -func (rs *relayerSessionsManager) Start(ctx context.Context) { - // NB: must cast back to generic observable type to use with Map. - // relayer.MinedRelaysObservable cannot be an alias due to gomock's lack of - // support for generic types. - relayObs := observable.Observable[*relayer.MinedRelay](rs.relayObs) - - // Map eitherMinedRelays to a new observable of an error type which is - // notified if an error was encountered while attempting to add the relay to - // the session tree. - miningErrorsObs := channel.Map(ctx, relayObs, rs.mapAddMinedRelayToSessionTree) - logging.LogErrors(ctx, miningErrorsObs) - - // Start claim/proof pipeline. - claimedSessionsObs := rs.createClaims(ctx) - rs.submitProofs(ctx, claimedSessionsObs) -} - -// Stop unsubscribes all observables from the InsertRelays observable which -// will close downstream observables as they drain. -// -// TODO_TECHDEBT: Either add a mechanism to wait for draining to complete -// and/or ensure that the state at each pipeline stage is persisted to disk -// and exit as early as possible. -func (rs *relayerSessionsManager) Stop() { - rs.relayObs.UnsubscribeAll() -} - -// SessionsToClaim returns an observable that notifies when sessions are ready to be claimed. -func (rs *relayerSessionsManager) InsertRelays(relays relayer.MinedRelaysObservable) { - rs.relayObs = relays -} - -// ensureSessionTree returns the SessionTree for a given session. -// If no tree for the session exists, a new SessionTree is created before returning. -func (rs *relayerSessionsManager) ensureSessionTree(sessionHeader *sessiontypes.SessionHeader) (relayer.SessionTree, error) { - sessionsTrees, ok := rs.sessionsTrees[sessionHeader.SessionEndBlockHeight] - - // If there is no map for sessions at the sessionEndHeight, create one. - if !ok { - sessionsTrees = make(map[string]relayer.SessionTree) - rs.sessionsTrees[sessionHeader.SessionEndBlockHeight] = sessionsTrees - } - - // Get the sessionTree for the given session. - sessionTree, ok := sessionsTrees[sessionHeader.SessionId] - - // If the sessionTree does not exist, create it. - var err error - if !ok { - sessionTree, err = NewSessionTree(sessionHeader, rs.storesDirectory, rs.removeFromRelayerSessions) - if err != nil { - return nil, err - } - - sessionsTrees[sessionHeader.SessionId] = sessionTree - } - - return sessionTree, nil -} - -// mapBlockToSessionsToClaim maps a block to a list of sessions which can be -// claimed as of that block. -func (rs *relayerSessionsManager) mapBlockToSessionsToClaim( - _ context.Context, - block client.Block, -) (sessionTrees []relayer.SessionTree, skip bool) { - rs.sessionsTreesMu.Lock() - defer rs.sessionsTreesMu.Unlock() - - // Check if there are sessions that need to enter the claim/proof phase - // as their end block height was the one before the last committed block. - // Iterate over the sessionsTrees map to get the ones that end at a block height - // lower than the current block height. - for endBlockHeight, sessionsTreesEndingAtBlockHeight := range rs.sessionsTrees { - // TODO_BLOCKER(@red-0ne): We need this to be == instead of <= because we don't want to keep sending - // the same session while waiting the next step. This does not address the case - // where the block client misses the target block which should be handled by the - // retry mechanism. See the discussion in the following GitHub thread for next - // steps: https://github.com/pokt-network/poktroll/pull/177/files?show-viewed-files=true&file-filters%5B%5D=#r1391957041 - if endBlockHeight == block.Height() { - // Iterate over the sessionsTrees that end at this block height (or - // less) and add them to the list of sessionTrees to be published. - for _, sessionTree := range sessionsTreesEndingAtBlockHeight { - sessionTrees = append(sessionTrees, sessionTree) - } - } - } - return sessionTrees, false -} - -// removeFromRelayerSessions removes the SessionTree from the relayerSessions. -func (rs *relayerSessionsManager) removeFromRelayerSessions(sessionHeader *sessiontypes.SessionHeader) { - rs.sessionsTreesMu.Lock() - defer rs.sessionsTreesMu.Unlock() - - sessionsTreesEndingAtBlockHeight, ok := rs.sessionsTrees[sessionHeader.SessionEndBlockHeight] - if !ok { - rs.logger.Debug(). - Int64("session_end_block_height", sessionHeader.SessionEndBlockHeight). - Msg("no session tree found for ending sessions") - return - } - - delete(sessionsTreesEndingAtBlockHeight, sessionHeader.SessionId) - - // Check if the sessionsTrees map is empty and delete it if so. - // This is an optimization done to save memory by avoiding an endlessly growing sessionsTrees map. - if len(sessionsTreesEndingAtBlockHeight) == 0 { - delete(rs.sessionsTrees, sessionHeader.SessionEndBlockHeight) - } -} - -// validateConfig validates the relayerSessionsManager's configuration. -// TODO_TEST: Add unit tests to validate these configurations. -func (rp *relayerSessionsManager) validateConfig() error { - if rp.storesDirectory == "" { - return ErrSessionTreeUndefinedStoresDirectory - } - - return nil -} - -// waitForBlock blocks until the block at the given height (or greater) is -// observed as having been committed. -func (rs *relayerSessionsManager) waitForBlock(ctx context.Context, height int64) client.Block { - subscription := rs.blockClient.CommittedBlocksSequence(ctx).Subscribe(ctx) - defer subscription.Unsubscribe() - - for block := range subscription.Ch() { - if block.Height() >= height { - return block - } - } - - return nil -} - -// mapAddMinedRelayToSessionTree is intended to be used as a MapFn. It adds the relay -// to the session tree. If it encounters an error, it returns the error. Otherwise, -// it skips output (only outputs errors). -func (rs *relayerSessionsManager) mapAddMinedRelayToSessionTree( - _ context.Context, - relay *relayer.MinedRelay, -) (_ error, skip bool) { - rs.sessionsTreesMu.Lock() - defer rs.sessionsTreesMu.Unlock() - // ensure the session tree exists for this relay - // TODO_CONSIDERATION: if we get the session header from the response, there - // is no possibility that we forgot to hydrate it (i.e. blindly trust the client). - sessionHeader := relay.GetReq().GetMeta().GetSessionHeader() - smst, err := rs.ensureSessionTree(sessionHeader) - if err != nil { - // TODO_TECHDEBT: log additional info? - rs.logger.Error().Err(err).Msg("failed to ensure session tree") - return err, false - } - - if err := smst.Update(relay.Hash, relay.Bytes, 1); err != nil { - // TODO_TECHDEBT: log additional info? - rs.logger.Error().Err(err).Msg("failed to update smt") - return err, false - } - - // Skip because this map function only outputs errors. - return nil, true -} diff --git a/pkg/relayer/session/session_test.go b/pkg/relayer/session/session_test.go deleted file mode 100644 index cb1dddd82..000000000 --- a/pkg/relayer/session/session_test.go +++ /dev/null @@ -1,81 +0,0 @@ -package session_test - -import ( - "context" - "testing" - "time" - - "cosmossdk.io/depinject" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/polylog/polyzero" - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/session" - "github.com/pokt-network/poktroll/testutil/testclient/testblock" - "github.com/pokt-network/poktroll/testutil/testclient/testsupplier" - "github.com/pokt-network/poktroll/testutil/testpolylog" - "github.com/pokt-network/poktroll/testutil/testrelayer" -) - -func TestRelayerSessionsManager_Start(t *testing.T) { - const ( - sessionStartHeight = 1 - sessionEndHeight = 2 - ) - var ( - zeroByteSlice = []byte{0} - _, ctx = testpolylog.NewLoggerWithCtx(context.Background(), polyzero.DebugLevel) - ) - - // Set up dependencies. - blocksObs, blockPublishCh := channel.NewReplayObservable[client.Block](ctx, 1) - blockClient := testblock.NewAnyTimesCommittedBlocksSequenceBlockClient(t, blocksObs) - supplierClient := testsupplier.NewOneTimeClaimProofSupplierClient(ctx, t) - - deps := depinject.Supply(blockClient, supplierClient) - storesDirectoryOpt := testrelayer.WithTempStoresDirectory(t) - - // Create a new relayer sessions manager. - relayerSessionsManager, err := session.NewRelayerSessions(ctx, deps, storesDirectoryOpt) - require.NoError(t, err) - require.NotNil(t, relayerSessionsManager) - - // Pass a mined relays observable via InsertRelays. - mrObs, minedRelaysPublishCh := channel.NewObservable[*relayer.MinedRelay]() - minedRelaysObs := relayer.MinedRelaysObservable(mrObs) - relayerSessionsManager.InsertRelays(minedRelaysObs) - - // Start the relayer sessions manager. - relayerSessionsManager.Start(ctx) - - // Publish a mined relay to the minedRelaysPublishCh to insert into the session tree. - minedRelay := testrelayer.NewMinedRelay(t, sessionStartHeight, sessionEndHeight) - minedRelaysPublishCh <- minedRelay - - // Wait a tick to allow the relayer sessions manager to process asynchronously. - // It should have created a session tree for the relay. - time.Sleep(10 * time.Millisecond) - - // Publish a block to the blockPublishCh to simulate non-actionable blocks. - noopBlock := testblock.NewAnyTimesBlock(t, zeroByteSlice, sessionStartHeight) - blockPublishCh <- noopBlock - - // Publish a block to the blockPublishCh to trigger claim creation for the session. - // TODO_TECHDEBT: assumes claiming at sessionEndHeight is valid. This will - // likely change in future work. - triggerClaimBlock := testblock.NewAnyTimesBlock(t, zeroByteSlice, sessionEndHeight) - blockPublishCh <- triggerClaimBlock - - // TODO_IMPROVE: ensure correctness of persisted session trees here. - - // Publish a block to the blockPublishCh to trigger proof submission for the session. - // TODO_TECHDEBT: assumes proving at sessionEndHeight is valid. This will - // likely change in future work. - triggerProofBlock := testblock.NewAnyTimesBlock(t, zeroByteSlice, sessionEndHeight+1) - blockPublishCh <- triggerProofBlock - - // Wait a tick to allow the relayer sessions manager to process asynchronously. - time.Sleep(250 * time.Millisecond) -} diff --git a/pkg/relayer/session/sessiontree.go b/pkg/relayer/session/sessiontree.go deleted file mode 100644 index a4eec8d01..000000000 --- a/pkg/relayer/session/sessiontree.go +++ /dev/null @@ -1,208 +0,0 @@ -package session - -import ( - "bytes" - "crypto/sha256" - "os" - "path/filepath" - "sync" - - "github.com/pokt-network/smt" - "github.com/pokt-network/smt/kvstore/badger" - - "github.com/pokt-network/poktroll/pkg/relayer" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" -) - -var _ relayer.SessionTree = (*sessionTree)(nil) - -// sessionTree is an implementation of the SessionTree interface. -// TODO_TEST: Add tests to the sessionTree. -type sessionTree struct { - // sessionMu is a mutex used to protect sessionTree operations from concurrent access. - sessionMu *sync.Mutex - - // sessionHeader is the header of the session corresponding to the SMST (Sparse Merkle State Trie). - sessionHeader *sessiontypes.SessionHeader - - // sessionSMT is the SMST (Sparse Merkle State Trie) corresponding the session. - sessionSMT smt.SparseMerkleSumTrie - - // claimedRoot is the root hash of the SMST needed for submitting the claim. - // If it holds a non-nil value, it means that the SMST has been flushed, - // committed to disk and no more updates can be made to it. A non-nil value also - // indicates that a proof could be generated using ProveClosest function. - claimedRoot []byte - - // proofPath is the path for which the proof was generated. - proofPath []byte - - // proof is the generated proof for the session given a proofPath. - proof *smt.SparseMerkleClosestProof - - // treeStore is the KVStore used to store the SMST. - treeStore badger.BadgerKVStore - - // storePath is the path to the KVStore used to store the SMST. - // It is created from the storePrefix and the session.sessionId. - // We keep track of it so we can use it at the end of the claim/proof lifecycle - // to delete the KVStore when it is no longer needed. - storePath string - - // removeFromRelayerSessions is a function that removes the sessionTree from - // the RelayerSessionsManager. - // Since the sessionTree has no knowledge of the RelayerSessionsManager, - // we pass this callback from the session manager to the sessionTree so - // it can remove itself from the RelayerSessionsManager when it is no longer needed. - removeFromRelayerSessions func(sessionHeader *sessiontypes.SessionHeader) -} - -// NewSessionTree creates a new sessionTree from a Session and a storePrefix. It also takes a function -// removeFromRelayerSessions that removes the sessionTree from the RelayerSessionsManager. -// It returns an error if the KVStore fails to be created. -func NewSessionTree( - sessionHeader *sessiontypes.SessionHeader, - storesDirectory string, - removeFromRelayerSessions func(sessionHeader *sessiontypes.SessionHeader), -) (relayer.SessionTree, error) { - // Join the storePrefix and the session.sessionId to create a unique storePath - storePath := filepath.Join(storesDirectory, sessionHeader.SessionId) - - // Make sure storePath does not exist when creating a new SessionTree - if _, err := os.Stat(storePath); err != nil && !os.IsNotExist(err) { - return nil, ErrSessionTreeStorePathExists.Wrapf("storePath: %q", storePath) - } - - treeStore, err := badger.NewKVStore(storePath) - if err != nil { - return nil, err - } - - // Create the SMST from the KVStore and a nil value hasher so the proof would - // contain a non-hashed Relay that could be used to validate the proof on-chain. - trie := smt.NewSparseMerkleSumTrie(treeStore, sha256.New(), smt.WithValueHasher(nil)) - - sessionTree := &sessionTree{ - sessionHeader: sessionHeader, - storePath: storePath, - treeStore: treeStore, - sessionSMT: trie, - sessionMu: &sync.Mutex{}, - - removeFromRelayerSessions: removeFromRelayerSessions, - } - - return sessionTree, nil -} - -// GetSession returns the session corresponding to the SMST. -func (st *sessionTree) GetSessionHeader() *sessiontypes.SessionHeader { - return st.sessionHeader -} - -// Update is a wrapper for the SMST's Update function. It updates the SMST with -// the given key, value, and weight. -// This function should be called by the Miner when a Relay has been successfully served. -// It returns an error if the SMST has been flushed to disk which indicates -// that updates are no longer allowed. -func (st *sessionTree) Update(key, value []byte, weight uint64) error { - st.sessionMu.Lock() - defer st.sessionMu.Unlock() - - if st.claimedRoot != nil { - return ErrSessionTreeClosed - } - - return st.sessionSMT.Update(key, value, weight) -} - -// ProveClosest is a wrapper for the SMST's ProveClosest function. It returns a proof for the given path. -// This function is intended to be called after a session has been claimed and needs to be proven. -// If the proof has already been generated, it returns the cached proof. -// It returns an error if the SMST has not been flushed yet (the claim has not been generated) -func (st *sessionTree) ProveClosest(path []byte) (proof *smt.SparseMerkleClosestProof, err error) { - st.sessionMu.Lock() - defer st.sessionMu.Unlock() - - // A claim need to be generated before a proof can be generated. - if st.claimedRoot == nil { - return nil, ErrSessionTreeNotClosed - } - - // If the proof has already been generated, return the cached proof. - if st.proof != nil { - // Make sure the path is the same as the one for which the proof was generated. - if !bytes.Equal(path, st.proofPath) { - return nil, ErrSessionTreeProofPathMismatch - } - - return st.proof, nil - } - - // Restore the KVStore from disk since it has been closed after the claim has been generated. - st.treeStore, err = badger.NewKVStore(st.storePath) - if err != nil { - return nil, err - } - - st.sessionSMT = smt.ImportSparseMerkleSumTrie(st.treeStore, sha256.New(), st.claimedRoot, smt.WithValueHasher(nil)) - - // Generate the proof and cache it along with the path for which it was generated. - st.proof, err = st.sessionSMT.ProveClosest(path) - st.proofPath = path - - return st.proof, err -} - -// Flush gets the root hash of the SMST needed for submitting the claim; -// then commits the entire tree to disk and stops the KVStore. -// It should be called before submitting the claim on-chain. This function frees up the KVStore resources. -// If the SMST has already been flushed to disk, it returns the cached root hash. -func (st *sessionTree) Flush() (SMSTRoot []byte, err error) { - st.sessionMu.Lock() - defer st.sessionMu.Unlock() - - // We already have the root hash, return it. - if st.claimedRoot != nil { - return st.claimedRoot, nil - } - - st.claimedRoot = st.sessionSMT.Root() - - // Commit the tree to disk - if err := st.sessionSMT.Commit(); err != nil { - return nil, err - } - - // Stop the KVStore - if err := st.treeStore.Stop(); err != nil { - return nil, err - } - - st.treeStore = nil - st.sessionSMT = nil - - return st.claimedRoot, nil -} - -// Delete deletes the SMST from the KVStore and removes the sessionTree from the RelayerSessionsManager. -// WARNING: This function deletes the KVStore associated to the session and should be -// called only after the proof has been successfully submitted on-chain and the servicer -// has confirmed that it has been rewarded. -func (st *sessionTree) Delete() error { - st.sessionMu.Lock() - defer st.sessionMu.Unlock() - - st.removeFromRelayerSessions(st.sessionHeader) - - if err := st.treeStore.ClearAll(); err != nil { - return err - } - - if err := st.treeStore.Stop(); err != nil { - return err - } - - // Delete the KVStore from disk - return os.RemoveAll(filepath.Dir(st.storePath)) -} diff --git a/pkg/relayer/session/sessiontree_test.go b/pkg/relayer/session/sessiontree_test.go deleted file mode 100644 index 4e199dcfe..000000000 --- a/pkg/relayer/session/sessiontree_test.go +++ /dev/null @@ -1,3 +0,0 @@ -package session_test - -// TODO: Add tests to the sessionTree logic diff --git a/pkg/relayer/types.go b/pkg/relayer/types.go deleted file mode 100644 index 1216dd25e..000000000 --- a/pkg/relayer/types.go +++ /dev/null @@ -1,10 +0,0 @@ -package relayer - -import "github.com/pokt-network/poktroll/x/service/types" - -// MinedRelay is a wrapper around a relay that has been serialized and hashed. -type MinedRelay struct { - types.Relay - Bytes []byte - Hash []byte -} diff --git a/pkg/retry/retry.go b/pkg/retry/retry.go deleted file mode 100644 index bd06af941..000000000 --- a/pkg/retry/retry.go +++ /dev/null @@ -1,77 +0,0 @@ -package retry - -import ( - "context" - "time" - - "github.com/pokt-network/poktroll/pkg/polylog" -) - -type RetryFunc func() chan error - -// OnError continuously invokes the provided work function (workFn) until either the context (ctx) -// is canceled or the error channel returned by workFn is closed. If workFn encounters an error, -// OnError will retry invoking workFn based on the provided retry parameters. -// -// Parameters: -// - ctx: the context to monitor for cancellation. If canceled, OnError will exit without error. -// - retryLimit: the maximum number of retries for workFn upon encountering an error. -// - retryDelay: the duration to wait before retrying workFn after an error. -// - retryResetCount: Specifies the duration of continuous error-free operation required -// before the retry count is reset. If the work function operates without -// errors for this duration, any subsequent error will restart the retry -// count from the beginning. -// - workName: a name or descriptor for the work function, used for logging purposes. -// - workFn: a function that performs some work and returns an error channel. -// This channel emits errors encountered during the work. -// -// Returns: -// - If the context is canceled, the function returns nil. -// - If the error channel is closed, a warning is logged, and the function returns nil. -// - If the retry limit is reached, the function returns the error from the channel. -// -// Note: After each error, a delay specified by retryDelay is introduced before retrying workFn.func OnError( -func OnError( - ctx context.Context, - retryLimit int, - retryDelay time.Duration, - retryResetTimeout time.Duration, - workName string, - workFn RetryFunc, -) error { - logger := polylog.Ctx(ctx) - - var retryCount int - errCh := workFn() - for { - select { - case <-ctx.Done(): - return nil - case <-time.After(retryResetTimeout): - retryCount = 0 - case err, ok := <-errCh: - // Exit the retry loop if the error channel is closed. - if !ok { - logger.Warn(). - Str("work_name", workName). - Msg("error channel closed, will no longer retry on error") - return nil - } - - if retryCount >= retryLimit { - return err - } - - // Wait retryDelay before retrying. - time.Sleep(retryDelay) - - // Increment retryCount and retry workFn. - retryCount++ - errCh = workFn() - logger.Error(). - Str("work_name", workName). - Err(err). - Msgf("on retry: %d", retryCount) - } - } -} diff --git a/pkg/retry/retry_test.go b/pkg/retry/retry_test.go deleted file mode 100644 index d328bda73..000000000 --- a/pkg/retry/retry_test.go +++ /dev/null @@ -1,337 +0,0 @@ -package retry_test - -/* TODO_TECHDEBT: improve this test: -- fix race condition around the logOutput buffer -- factor our common setup and assertion code -- drive out flakiness -- improve comments -*/ - -import ( - "bytes" - "context" - "fmt" - "log" - "strings" - "sync/atomic" - "testing" - "time" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/retry" -) - -var testErr = fmt.Errorf("test error") - -// TestOnError verifies the behavior of the OnError function in the retry package. -// It ensures that the function correctly retries a failing operation for a specified -// number of times with the expected delay between retries. -func TestOnError(t *testing.T) { - t.Skip("TODO_TECHDEBT: this test should pass but contains a race condition around the logOutput buffer") - - // Setting up the test variables. - var ( - // logOutput captures the log output for verification of logged messages. - logOutput bytes.Buffer - // expectedRetryDelay is the duration we expect between retries. - expectedRetryDelay = time.Millisecond - // expectedRetryLimit is the maximum number of retries the test expects. - expectedRetryLimit = 5 - // retryResetTimeout is the duration after which the retry count should reset. - retryResetTimeout = time.Second - // testFnCallCount keeps track of how many times the test function is called. - testFnCallCount int32 - // testFnCallTimeCh is a channel receives a time.Time each when the test - // function is called. - testFnCallTimeCh = make(chan time.Time, expectedRetryLimit) - ctx = context.Background() - ) - - // Redirect the standard logger's output to our custom buffer for later verification. - log.SetOutput(&logOutput) - - // Define testFn, a function that simulates a failing operation and logs its invocation times. - testFn := func() chan error { - // Record the current time to track the delay between retries. - testFnCallTimeCh <- time.Now() - - // Create a channel to return an error, simulating a failing operation. - errCh := make(chan error, 1) - errCh <- testErr - - // Increment the call count safely across goroutine boundaries. - atomic.AddInt32(&testFnCallCount, 1) - - return errCh - } - - // Create a channel to receive the error result from the OnError function. - retryOnErrorErrCh := make(chan error, 1) - - // Start the OnError function in a separate goroutine, simulating concurrent operation. - go func() { - // Call the OnError function with the test parameters and function. - retryOnErrorErrCh <- retry.OnError( - ctx, - expectedRetryLimit, - expectedRetryDelay, - retryResetTimeout, - "TestOnError", - testFn, - ) - }() - - // Calculate the total expected time for all retries to complete. - totalExpectedDelay := expectedRetryDelay * time.Duration(expectedRetryLimit) - // Wait for the OnError function to execute and retry the expected number of times. - time.Sleep(totalExpectedDelay + 100*time.Millisecond) - - // Verify that the test function was called the expected number of times. - require.Equal(t, expectedRetryLimit, int(testFnCallCount), "Test function was not called the expected number of times") - - // Verify the delay between retries of the test function. - var prevCallTime time.Time - for i := 0; i < expectedRetryLimit; i++ { - // Retrieve the next function call time from the channel. - nextCallTime, ok := <-testFnCallTimeCh - if !ok { - t.Fatalf("expected %d calls to testFn, but channel closed after %d", expectedRetryLimit, i) - } - - // For all calls after the first, check that the delay since the previous call meets expectations. - if i != 0 { - actualRetryDelay := nextCallTime.Sub(prevCallTime) - require.GreaterOrEqual(t, actualRetryDelay, expectedRetryDelay, "Retry delay was less than expected") - } - - // Update prevCallTime for the next iteration. - prevCallTime = nextCallTime - } - - // Verify that the OnError function returned the expected error. - select { - case err := <-retryOnErrorErrCh: - require.ErrorIs(t, err, testErr, "OnError did not return the expected error") - case <-time.After(100 * time.Millisecond): - t.Fatal("expected error from OnError, but none received") - } - - // Verify the error messages logged during the retries. - expectedErrorLine := "ERROR: retrying TestOnError after error: test error" - trimmedLogOutput := strings.Trim(logOutput.String(), "\n") - logOutputLines := strings.Split(trimmedLogOutput, "\n") - require.Lenf(t, logOutputLines, expectedRetryLimit, "unexpected number of log lines") - for _, line := range logOutputLines { - require.Contains(t, line, expectedErrorLine, "log line does not contain the expected prefix") - } -} - -// TODO_TECHDEBT: assert that the retry loop exits when the context is closed. -func TestOnError_ExitsWhenCtxCloses(t *testing.T) { - t.SkipNow() -} - -func TestOnError_ExitsWhenErrChCloses(t *testing.T) { - t.Skip("TODO_TECHDEBT: this test should pass but contains a race condition around the logOutput buffer") - - // Setup test variables and log capture - var ( - logOutput bytes.Buffer - testFnCallCount int32 - expectedRetryDelay = time.Millisecond - expectedRetryLimit = 3 - retryLimit = 5 - retryResetTimeout = time.Second - testFnCallTimeCh = make(chan time.Time, expectedRetryLimit) - ctx = context.Background() - ) - - // Redirect the log output for verification later - log.SetOutput(&logOutput) - - // Define the test function that simulates an error and counts its invocations - testFn := func() chan error { - atomic.AddInt32(&testFnCallCount, 1) // Increment the invocation count atomically - testFnCallTimeCh <- time.Now() // Track the invocation time - - errCh := make(chan error, 1) - if atomic.LoadInt32(&testFnCallCount) >= int32(expectedRetryLimit) { - close(errCh) - return errCh - } - - errCh <- testErr - return errCh - } - - retryOnErrorErrCh := make(chan error, 1) - // Spawn a goroutine to test the OnError function - go func() { - retryOnErrorErrCh <- retry.OnError( - ctx, - retryLimit, - expectedRetryDelay, - retryResetTimeout, - "TestOnError_ExitsWhenErrChCloses", - testFn, - ) - }() - - // Wait for the OnError function to execute and retry the expected number of times - totalExpectedDelay := expectedRetryDelay * time.Duration(expectedRetryLimit) - time.Sleep(totalExpectedDelay + 100*time.Millisecond) - - // Assert that the test function was called the expected number of times - require.Equal(t, expectedRetryLimit, int(testFnCallCount)) - - // Assert that the retry delay between function calls matches the expected delay - var prevCallTime = new(time.Time) - for i := 0; i < expectedRetryLimit; i++ { - select { - case nextCallTime := <-testFnCallTimeCh: - if i != 0 { - actualRetryDelay := nextCallTime.Sub(*prevCallTime) - require.GreaterOrEqual(t, actualRetryDelay, expectedRetryDelay) - } - - *prevCallTime = nextCallTime - default: - t.Fatalf( - "expected %d calls to testFn, but only received %d", - expectedRetryLimit, i+1, - ) - } - } - - select { - case err := <-retryOnErrorErrCh: - require.NoError(t, err) - case <-time.After(100 * time.Millisecond): - t.Fatalf("expected error from OnError, but none received") - } - - // Verify the logged error messages - var ( - logOutputLines = strings.Split(strings.Trim(logOutput.String(), "\n"), "\n") - errorLines = logOutputLines[:len(logOutputLines)-1] - warnLine = logOutputLines[len(logOutputLines)-1] - expectedWarnMsg = "WARN: error channel for TestOnError_ExitsWhenErrChCloses closed, will no longer retry on error" - expectedErrorMsg = "ERROR: retrying TestOnError_ExitsWhenErrChCloses after error: test error" - ) - - require.Lenf( - t, logOutputLines, - expectedRetryLimit, - "expected %d log lines, got %d", - expectedRetryLimit, len(logOutputLines), - ) - for _, line := range errorLines { - require.Contains(t, line, expectedErrorMsg) - } - require.Contains(t, warnLine, expectedWarnMsg) -} - -// assert that retryCount resets on success -func TestOnError_RetryCountResetTimeout(t *testing.T) { - t.Skip("TODO_TECHDEBT: this test should pass but contains a race condition around the logOutput buffer") - - // Setup test variables and log capture - var ( - logOutput bytes.Buffer - testFnCallCount int32 - expectedRetryDelay = time.Millisecond - expectedRetryLimit = 9 - retryLimit = 5 - retryResetTimeout = 3 * time.Millisecond - testFnCallTimeCh = make(chan time.Time, expectedRetryLimit) - ctx = context.Background() - ) - - // Redirect the log output for verification later - log.SetOutput(&logOutput) - - // Define the test function that simulates an error and counts its invocations - testFn := func() chan error { - // Track the invocation time - testFnCallTimeCh <- time.Now() - - errCh := make(chan error, 1) - - count := atomic.LoadInt32(&testFnCallCount) - if count == int32(retryLimit) { - go func() { - time.Sleep(retryResetTimeout) - errCh <- testErr - }() - } else { - errCh <- testErr - } - - // Increment the invocation count atomically - atomic.AddInt32(&testFnCallCount, 1) - return errCh - } - - retryOnErrorErrCh := make(chan error, 1) - // Spawn a goroutine to test the OnError function - go func() { - retryOnErrorErrCh <- retry.OnError( - ctx, - retryLimit, - expectedRetryDelay, - retryResetTimeout, - "TestOnError", - testFn, - ) - }() - - // Wait for the OnError function to execute and retry the expected number of times - totalExpectedDelay := expectedRetryDelay * time.Duration(expectedRetryLimit) - time.Sleep(totalExpectedDelay + 100*time.Millisecond) - - // Assert that the test function was called the expected number of times - require.Equal(t, expectedRetryLimit, int(testFnCallCount)) - - // Assert that the retry delay between function calls matches the expected delay - var prevCallTime = new(time.Time) - for i := 0; i < expectedRetryLimit; i++ { - select { - case nextCallTime := <-testFnCallTimeCh: - if i != 0 { - actualRetryDelay := nextCallTime.Sub(*prevCallTime) - require.GreaterOrEqual(t, actualRetryDelay, expectedRetryDelay) - } - - *prevCallTime = nextCallTime - default: - t.Fatalf( - "expected %d calls to testFn, but only received %d", - expectedRetryLimit, i+1, - ) - } - } - - // Verify the logged error messages - var ( - logOutputLines = strings.Split(strings.Trim(logOutput.String(), "\n"), "\n") - expectedPrefix = "ERROR: retrying TestOnError after error: test error" - ) - - select { - case err := <-retryOnErrorErrCh: - require.ErrorIs(t, err, testErr) - case <-time.After(100 * time.Millisecond): - t.Fatalf("expected error from OnError, but none received") - } - - require.Lenf( - t, logOutputLines, - expectedRetryLimit-1, - "expected %d log lines, got %d", - expectedRetryLimit-1, len(logOutputLines), - ) - for _, line := range logOutputLines { - require.Contains(t, line, expectedPrefix) - } -} diff --git a/pkg/sdk/deps_builder.go b/pkg/sdk/deps_builder.go deleted file mode 100644 index cfd0ff4b3..000000000 --- a/pkg/sdk/deps_builder.go +++ /dev/null @@ -1,94 +0,0 @@ -package sdk - -import ( - "context" - - "cosmossdk.io/depinject" - grpctypes "github.com/cosmos/gogoproto/grpc" - grpc "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" - - block "github.com/pokt-network/poktroll/pkg/client/block" - "github.com/pokt-network/poktroll/pkg/client/delegation" - eventsquery "github.com/pokt-network/poktroll/pkg/client/events" - "github.com/pokt-network/poktroll/pkg/client/query" - "github.com/pokt-network/poktroll/pkg/crypto/rings" - "github.com/pokt-network/poktroll/pkg/polylog" -) - -// buildDeps builds the dependencies for the POKTRollSDK if they are not provided -// in the config. This is useful for the SDK consumers that do not want or -// cannot provide the dependencies through depinject. -func (sdk *poktrollSDK) buildDeps( - ctx context.Context, - config *POKTRollSDKConfig, -) (depinject.Config, error) { - pocketNodeWebsocketURL := HostToWebsocketURL(config.QueryNodeUrl.Host) - - // Have a new depinject config - deps := depinject.Configs() - - // Supply the logger - deps = depinject.Configs(deps, depinject.Supply(polylog.Ctx(ctx))) - - // Create and supply the events query client - eventsQueryClient := eventsquery.NewEventsQueryClient(pocketNodeWebsocketURL) - deps = depinject.Configs(deps, depinject.Supply(eventsQueryClient)) - - // Create and supply the block client that depends on the events query client - blockClient, err := block.NewBlockClient(ctx, deps) - if err != nil { - return nil, err - } - deps = depinject.Configs(deps, depinject.Supply(blockClient)) - - // Create and supply the grpc client used by the queriers - // TODO_TECHDEBT: Configure the grpc client options from the config. - var grpcClient grpctypes.ClientConn - grpcClient, err = grpc.Dial( - config.QueryNodeGRPCUrl.Host, - grpc.WithTransportCredentials(insecure.NewCredentials()), - ) - if err != nil { - return nil, err - } - deps = depinject.Configs(deps, depinject.Supply(grpcClient)) - - // Create and supply the account querier - accountQuerier, err := query.NewAccountQuerier(deps) - if err != nil { - return nil, err - } - deps = depinject.Configs(deps, depinject.Supply(accountQuerier)) - - // Create and supply the application querier - applicationQuerier, err := query.NewApplicationQuerier(deps) - if err != nil { - return nil, err - } - deps = depinject.Configs(deps, depinject.Supply(applicationQuerier)) - - // Create and supply the session querier - sessionQuerier, err := query.NewSessionQuerier(deps) - if err != nil { - return nil, err - } - deps = depinject.Configs(deps, depinject.Supply(sessionQuerier)) - - // Create and supply the delegation client - delegationClient, err := delegation.NewDelegationClient(ctx, deps) - if err != nil { - return nil, err - } - deps = depinject.Configs(deps, depinject.Supply(delegationClient)) - - // Create and supply the ring cache that depends on: - // the logger, application and account querier and the delegation client - ringCache, err := rings.NewRingCache(deps) - if err != nil { - return nil, err - } - deps = depinject.Configs(deps, depinject.Supply(ringCache)) - - return deps, nil -} diff --git a/pkg/sdk/errors.go b/pkg/sdk/errors.go deleted file mode 100644 index c7d1c4cc7..000000000 --- a/pkg/sdk/errors.go +++ /dev/null @@ -1,11 +0,0 @@ -package sdk - -import sdkerrors "cosmossdk.io/errors" - -var ( - codespace = "poktrollsdk" - ErrSDKHandleRelay = sdkerrors.Register(codespace, 1, "internal error handling relay request") - ErrSDKInvalidRelayResponseSignature = sdkerrors.Register(codespace, 2, "invalid relay response signature") - ErrSDKEmptyRelayResponseSignature = sdkerrors.Register(codespace, 3, "empty relay response signature") - ErrSDKVerifyResponseSignature = sdkerrors.Register(codespace, 4, "error verifying relay response signature") -) diff --git a/pkg/sdk/interface.go b/pkg/sdk/interface.go deleted file mode 100644 index 8fcb22586..000000000 --- a/pkg/sdk/interface.go +++ /dev/null @@ -1,27 +0,0 @@ -package sdk - -import ( - "context" - "net/http" - - servicetypes "github.com/pokt-network/poktroll/x/service/types" -) - -// POKTRollSDK is the interface for the POKTRoll SDK. It is used by gateways -// and/or applications to interact with the Pocket protocol. -type POKTRollSDK interface { - // GetSession returns the suppliers endpoints of the current session for - // the given application and service. - GetSessionSupplierEndpoints( - ctx context.Context, - appAddress string, - serviceId string, - ) (session *SessionSuppliers, err error) - - // SendRelay sends a relay request to the given supplier's endpoint. - SendRelay( - ctx context.Context, - sessionSupplierEndpoint *SingleSupplierEndpoint, - request *http.Request, - ) (response *servicetypes.RelayResponse, err error) -} diff --git a/pkg/sdk/relay_verifier.go b/pkg/sdk/relay_verifier.go deleted file mode 100644 index 92de8583c..000000000 --- a/pkg/sdk/relay_verifier.go +++ /dev/null @@ -1,68 +0,0 @@ -package sdk - -import ( - "context" - - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - - "github.com/pokt-network/poktroll/x/service/types" -) - -// verifyResponse verifies the relay response signature. -func (sdk *poktrollSDK) verifyResponse( - ctx context.Context, - supplierAddress string, - relayResponse *types.RelayResponse, -) error { - // Get the supplier's public key. - supplierPubKey, err := sdk.getSupplierPubKeyFromAddress(ctx, supplierAddress) - if err != nil { - return err - } - - // Extract the supplier's signature - if relayResponse.Meta == nil { - return ErrSDKEmptyRelayResponseSignature.Wrapf( - "response payload: %s", relayResponse.Payload, - ) - } - supplierSignature := relayResponse.Meta.SupplierSignature - - // Get the relay response signable bytes and hash them. - responseSignableBz, err := relayResponse.GetSignableBytesHash() - if err != nil { - return err - } - - // Verify the relay response signature. - if !supplierPubKey.VerifySignature(responseSignableBz[:], supplierSignature) { - return ErrSDKInvalidRelayResponseSignature - } - - return nil -} - -// getSupplierPubKeyFromAddress gets the supplier's public key from the cache or -// queries if it is not found. The public key is then cached before being returned. -func (sdk *poktrollSDK) getSupplierPubKeyFromAddress( - ctx context.Context, - supplierAddress string, -) (cryptotypes.PubKey, error) { - supplierPubKey, ok := sdk.supplierAccountCache[supplierAddress] - if ok { - return supplierPubKey, nil - } - - // Query for the supplier account to get the application's public key - // to verify the relay request signature. - acc, err := sdk.accountQuerier.GetAccount(ctx, supplierAddress) - if err != nil { - return nil, err - } - - fetchedPubKey := acc.GetPubKey() - // Cache the retrieved public key. - sdk.supplierAccountCache[supplierAddress] = fetchedPubKey - - return fetchedPubKey, nil -} diff --git a/pkg/sdk/sdk.go b/pkg/sdk/sdk.go deleted file mode 100644 index 673d111d3..000000000 --- a/pkg/sdk/sdk.go +++ /dev/null @@ -1,110 +0,0 @@ -package sdk - -import ( - "context" - "fmt" - "net/url" - "sync" - - "cosmossdk.io/depinject" - ring_secp256k1 "github.com/athanorlabs/go-dleq/secp256k1" - ringtypes "github.com/athanorlabs/go-dleq/types" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/crypto" - "github.com/pokt-network/poktroll/pkg/polylog" -) - -var _ POKTRollSDK = (*poktrollSDK)(nil) - -// POKTRollSDKConfig is the configuration for the POKTRollSDK. -// It contains the Pocket Node URL to be used by the queriers and the private key -// to be used for signing relay requests. -// Deps is an optional field that can be used to provide the needed dependencies -// for the SDK. If it is not provided, the SDK will build the dependencies itself. -type POKTRollSDKConfig struct { - QueryNodeGRPCUrl *url.URL - QueryNodeUrl *url.URL - PrivateKey cryptotypes.PrivKey - Deps depinject.Config -} - -// poktrollSDK is the implementation of the POKTRollSDK. -type poktrollSDK struct { - logger polylog.Logger - config *POKTRollSDKConfig - - // signingKey is the scalar representation of the private key to be used - // for signing relay requests. - signingKey ringtypes.Scalar - - // ringCache is used to obtain and store the ring for the application. - ringCache crypto.RingCache - - // sessionQuerier is the querier for the session module. - // It used to get the current session for the application given a requested service. - sessionQuerier client.SessionQueryClient - - // serviceSessionSuppliersMu is a mutex to protect latestSessions map reads and updates. - serviceSessionSuppliersMu sync.RWMutex - - // serviceSessionSuppliers is a map of serviceId -> {appAddress -> SessionSuppliers} - // for a specific session - serviceSessionSuppliers map[string]map[string]*SessionSuppliers - - // accountQuerier is the querier for the account module. - // It is used to get the the supplier's public key to verify the relay response signature. - accountQuerier client.AccountQueryClient - - // blockClient is the client for the block module. - // It is used to get the current block height to query for the current session. - blockClient client.BlockClient - - // accountCache is a cache of the supplier accounts that has been queried - // TODO_TECHDEBT: Add a size limit to the cache. - supplierAccountCache map[string]cryptotypes.PubKey -} - -// NewPOKTRollSDK creates a new POKTRollSDK instance with the given configuration. -func NewPOKTRollSDK(ctx context.Context, config *POKTRollSDKConfig) (POKTRollSDK, error) { - sdk := &poktrollSDK{ - config: config, - serviceSessionSuppliers: make(map[string]map[string]*SessionSuppliers), - supplierAccountCache: make(map[string]cryptotypes.PubKey), - } - - var err error - var deps depinject.Config - - // Build the dependencies if they are not provided in the config. - if config.Deps != nil { - deps = config.Deps - } else if deps, err = sdk.buildDeps(ctx, config); err != nil { - return nil, err - } - - if err := depinject.Inject( - deps, - &sdk.logger, - &sdk.ringCache, - &sdk.sessionQuerier, - &sdk.accountQuerier, - &sdk.blockClient, - ); err != nil { - return nil, err - } - - // Store the private key as a ring scalar to be used for ring signatures. - crv := ring_secp256k1.NewCurve() - sdk.signingKey, err = crv.DecodeToScalar(config.PrivateKey.Bytes()) - if err != nil { - return nil, fmt.Errorf("failed to decode private key: %w", err) - } - - // Start the ring cache, when the context is canceled, the ring cache - // will stop. And clear any cached rings. - sdk.ringCache.Start(ctx) - - return sdk, nil -} diff --git a/pkg/sdk/send_relay.go b/pkg/sdk/send_relay.go deleted file mode 100644 index 45e93a728..000000000 --- a/pkg/sdk/send_relay.go +++ /dev/null @@ -1,109 +0,0 @@ -package sdk - -import ( - "bytes" - "context" - "io" - "net/http" - - "github.com/pokt-network/poktroll/pkg/signer" - "github.com/pokt-network/poktroll/x/service/types" -) - -// SendRelay sends a relay request to the given supplier's endpoint. -// It signs the request, relays it to the supplier and verifies the response signature. -// It takes an http.Request as an argument and uses its method and headers to create -// the relay request. -func (sdk *poktrollSDK) SendRelay( - ctx context.Context, - supplierEndpoint *SingleSupplierEndpoint, - request *http.Request, -) (response *types.RelayResponse, err error) { - payloadBz, err := io.ReadAll(request.Body) - if err != nil { - return nil, ErrSDKHandleRelay.Wrapf("reading request body: %s", err) - } - - // Create the relay request. - relayRequest := &types.RelayRequest{ - Meta: &types.RelayRequestMetadata{ - SessionHeader: supplierEndpoint.Header, - Signature: nil, // signature added below - }, - Payload: payloadBz, - } - - // Get the application's signer. - appAddress := supplierEndpoint.Header.ApplicationAddress - appRing, err := sdk.ringCache.GetRingForAddress(ctx, appAddress) - if err != nil { - return nil, ErrSDKHandleRelay.Wrapf("getting app ring: %s", err) - } - signer := signer.NewRingSigner(appRing, sdk.signingKey) - - // Hash and sign the request's signable bytes. - signableBz, err := relayRequest.GetSignableBytesHash() - if err != nil { - return nil, ErrSDKHandleRelay.Wrapf("error getting signable bytes: %s", err) - } - - requestSig, err := signer.Sign(signableBz) - if err != nil { - return nil, ErrSDKHandleRelay.Wrapf("error signing relay: %s", err) - } - relayRequest.Meta.Signature = requestSig - - // Marshal the relay request to bytes and create a reader to be used as an HTTP request body. - cdc := types.ModuleCdc - relayRequestBz, err := cdc.Marshal(relayRequest) - if err != nil { - return nil, ErrSDKHandleRelay.Wrapf("error marshaling relay request: %s", err) - } - relayRequestReader := io.NopCloser(bytes.NewReader(relayRequestBz)) - var relayReq types.RelayRequest - if err := relayReq.Unmarshal(relayRequestBz); err != nil { - return nil, ErrSDKHandleRelay.Wrapf("error unmarshaling relay request: %s", err) - } - - // Create the HTTP request to send the request to the relayer. - // All the RPC protocols to be supported (JSONRPC, Rest, Websockets, gRPC, etc) - // use HTTP under the hood. - relayHTTPRequest := &http.Request{ - Method: request.Method, - Header: request.Header, - URL: supplierEndpoint.Url, - Body: relayRequestReader, - } - - sdk.logger.Debug(). - Str("supplier_url", supplierEndpoint.Url.String()). - Msg("sending relay request") - relayHTTPResponse, err := http.DefaultClient.Do(relayHTTPRequest) - if err != nil { - return nil, ErrSDKHandleRelay.Wrapf("error sending relay request: %s", err) - } - - // Read the response body bytes. - relayResponseBz, err := io.ReadAll(relayHTTPResponse.Body) - if err != nil { - return nil, ErrSDKHandleRelay.Wrapf("error reading relay response body: %s", err) - } - - // Unmarshal the response bytes into a RelayResponse. - relayResponse := &types.RelayResponse{} - if err := relayResponse.Unmarshal(relayResponseBz); err != nil { - return nil, ErrSDKHandleRelay.Wrapf("error unmarshaling relay response: %s", err) - } - - // Verify the response signature. We use the supplier address that we got from - // the getRelayerUrl function since this is the address we are expecting to sign the response. - // TODO_TECHDEBT: if the RelayResponse is an internal error response, we should not verify the signature - // as in some relayer early failures, it may not be signed by the supplier. - // TODO_IMPROVE: Add more logging & telemetry so we can get visibility and signal into - // failed responses. - if err := sdk.verifyResponse(ctx, supplierEndpoint.SupplierAddress, relayResponse); err != nil { - return nil, ErrSDKVerifyResponseSignature.Wrapf("%s", err) - } - - return relayResponse, nil -} diff --git a/pkg/sdk/session.go b/pkg/sdk/session.go deleted file mode 100644 index 634f7a7d1..000000000 --- a/pkg/sdk/session.go +++ /dev/null @@ -1,114 +0,0 @@ -package sdk - -import ( - "context" - "net/url" - - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// SessionSuppliers is the structure that represents a session's end block height -// and its matching suppliers. -type SessionSuppliers struct { - // Session is the fully hydrated session object returned by the query. - Session *sessiontypes.Session - - // SuppliersEndpoints is a slice of the session's suppliers endpoints each - // item representing a single supplier endpoint augmented with the session - // header and the supplier's address. - // An item from this slice is what needs to be passed to the `SendRelay` - // function so it has all the information needed to send the relay request. - SuppliersEndpoints []*SingleSupplierEndpoint -} - -// SingleSupplierEndpoint is the structure that represents a supplier's endpoint -// augmented with the session's header and the supplier's address for easy -// access to the needed information when sending a relay request. -type SingleSupplierEndpoint struct { - Url *url.URL - RpcType sharedtypes.RPCType - SupplierAddress string - Header *sessiontypes.SessionHeader -} - -// GetSessionSupplierEndpoints returns a flattened structure of the endpoints -// from all suppliers in the session and returns them as a SupplierEndpoint slice. -// It queries for the latest session and caches it if the cached one is outdated. -func (sdk *poktrollSDK) GetSessionSupplierEndpoints( - ctx context.Context, - appAddress, serviceId string, -) (*SessionSuppliers, error) { - sdk.serviceSessionSuppliersMu.RLock() - defer sdk.serviceSessionSuppliersMu.RUnlock() - - latestBlockHeight := sdk.blockClient.LastNBlocks(ctx, 1)[0].Height() - - // Create the latestSessions map entry for the serviceId if it doesn't exist. - if _, ok := sdk.serviceSessionSuppliers[serviceId]; !ok { - sdk.serviceSessionSuppliers[serviceId] = map[string]*SessionSuppliers{} - } - - // Create the latestSessions[serviceId] map entry for the appAddress if it doesn't exist. - if _, ok := sdk.serviceSessionSuppliers[serviceId][appAddress]; !ok { - sdk.serviceSessionSuppliers[serviceId][appAddress] = &SessionSuppliers{} - } - - // currentSession is guaranteed to exist after the checks above. - currentSession := sdk.serviceSessionSuppliers[serviceId][appAddress] - - // Return the current session's SuppliersEndpoints if the session is still valid. - if currentSession.Session != nil && - latestBlockHeight < currentSession.Session.Header.SessionEndBlockHeight { - return currentSession, nil - } - - // Query for the current session. - session, err := sdk.sessionQuerier.GetSession( - ctx, - appAddress, - serviceId, - latestBlockHeight, - ) - if err != nil { - return nil, err - } - - // Override the old Session and SessionSuppliers and construct the new one. - currentSession.Session = session - currentSession.SuppliersEndpoints = []*SingleSupplierEndpoint{} - - for _, supplier := range session.Suppliers { - for _, service := range supplier.Services { - // Skip the session's services that don't match the requested serviceId. - if service.Service.Id != serviceId { - continue - } - - // Loop through the services' endpoints and add them to the - // SessionSuppliers.SuppliersEndpoints slice. - for _, endpoint := range service.Endpoints { - url, err := url.Parse(endpoint.Url) - if err != nil { - sdk.logger.Error(). - Str("url", endpoint.Url). - Err(err). - Msg("failed to parse url") - continue - } - - currentSession.SuppliersEndpoints = append( - currentSession.SuppliersEndpoints, - &SingleSupplierEndpoint{ - Url: url, - RpcType: endpoint.RpcType, - SupplierAddress: supplier.Address, - Header: session.Header, - }, - ) - } - } - } - - return currentSession, nil -} diff --git a/pkg/sdk/urls.go b/pkg/sdk/urls.go deleted file mode 100644 index de182f150..000000000 --- a/pkg/sdk/urls.go +++ /dev/null @@ -1,10 +0,0 @@ -package sdk - -import "fmt" - -// HostToWebsocketURL converts the provided host into a websocket URL that can -// be used to subscribe to onchain events and query the chain via a client -// context or send transactions via a tx client context. -func HostToWebsocketURL(host string) string { - return fmt.Sprintf("ws://%s/websocket", host) -} diff --git a/pkg/signer/interface.go b/pkg/signer/interface.go deleted file mode 100644 index 63b40b86d..000000000 --- a/pkg/signer/interface.go +++ /dev/null @@ -1,9 +0,0 @@ -package signer - -// Signer is an interface that abstracts the signing of a message, it is used -// to sign both relay requests and responses via one of the two implementations. -// The Signer interface expects a 32 byte message (sha256 hash) and returns a -// byte slice containing the signature or any error that occurred during signing. -type Signer interface { - Sign(msg [32]byte) (signature []byte, err error) -} diff --git a/pkg/signer/ring_signer.go b/pkg/signer/ring_signer.go deleted file mode 100644 index b2c46a5ce..000000000 --- a/pkg/signer/ring_signer.go +++ /dev/null @@ -1,34 +0,0 @@ -package signer - -import ( - "fmt" - - ringtypes "github.com/athanorlabs/go-dleq/types" - ring "github.com/noot/ring-go" -) - -var _ Signer = (*RingSigner)(nil) - -// RingSigner is a signer implementation that uses a ring to sign messages, for -// verification the ring signature must be verified and confirmed to be using -// the expected ring. -type RingSigner struct { - ring *ring.Ring - privKey ringtypes.Scalar -} - -// NewRingSigner creates a new RingSigner instance with the ring and private -// key provided -func NewRingSigner(ring *ring.Ring, privKey ringtypes.Scalar) *RingSigner { - return &RingSigner{ring: ring, privKey: privKey} -} - -// Sign uses the ring and private key to sign the message provided and returns the -// serialized ring signature that can be deserialized and verified by the verifier -func (r *RingSigner) Sign(msg [32]byte) ([]byte, error) { - ringSig, err := r.ring.Sign(msg, r.privKey) - if err != nil { - return nil, fmt.Errorf("failed to sign message [%v]: %w", msg, err) - } - return ringSig.Serialize() -} diff --git a/pkg/signer/simple_signer.go b/pkg/signer/simple_signer.go deleted file mode 100644 index 432c1c8a3..000000000 --- a/pkg/signer/simple_signer.go +++ /dev/null @@ -1,23 +0,0 @@ -package signer - -import "github.com/cosmos/cosmos-sdk/crypto/keyring" - -var _ Signer = (*SimpleSigner)(nil) - -// SimpleSigner is a signer implementation that uses the local keyring to sign -// messages, for verification using the signer's corresponding public key -type SimpleSigner struct { - keyring keyring.Keyring - keyName string -} - -// NewSimpleSigner creates a new SimpleSigner instance with the keyring and keyName provided -func NewSimpleSigner(keyring keyring.Keyring, keyName string) *SimpleSigner { - return &SimpleSigner{keyring: keyring, keyName: keyName} -} - -// Sign signs the given message using the SimpleSigner's keyring and keyName -func (s *SimpleSigner) Sign(msg [32]byte) (signature []byte, err error) { - sig, _, err := s.keyring.Sign(s.keyName, msg[:]) - return sig, err -} diff --git a/proto/buf.gen.gogo.yaml b/proto/buf.gen.gogo.yaml new file mode 100644 index 000000000..8d2c14601 --- /dev/null +++ b/proto/buf.gen.gogo.yaml @@ -0,0 +1,18 @@ +# This file is auto-generated from Ignite. You can edit +# the file content but do not change the file name or path. +# +# buf.gen.gogo.yaml +# +version: v1 +plugins: + - name: gocosmos + out: . + opt: + - plugins=grpc + - Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types + - Mcosmos/orm/v1/orm.proto=cosmossdk.io/orm + - name: grpc-gateway + out: . + opt: + - logtostderr=true + - allow_colon_final_segments=true diff --git a/proto/buf.gen.pulsar.yaml b/proto/buf.gen.pulsar.yaml new file mode 100644 index 000000000..89a67f2b2 --- /dev/null +++ b/proto/buf.gen.pulsar.yaml @@ -0,0 +1,22 @@ +# This file is auto-generated from Ignite. You can edit +# the file content but do not change the file name or path. +# +# buf.gen.pulsar.yaml +# +version: v1 +managed: + enabled: true + go_package_prefix: + default: cosmossdk.io/api + except: + - buf.build/googleapis/googleapis + - buf.build/cosmos/gogo-proto + - buf.build/cosmos/cosmos-proto + override: +plugins: + - name: go-pulsar + out: ./api + opt: paths=source_relative,Mpoktroll/shared/service.proto=github.com/pokt-network/poktroll/api/poktroll/shared + - name: go-grpc + out: ./api + opt: paths=source_relative diff --git a/proto/buf.gen.sta.yaml b/proto/buf.gen.sta.yaml new file mode 100644 index 000000000..4444f5e75 --- /dev/null +++ b/proto/buf.gen.sta.yaml @@ -0,0 +1,15 @@ +# This file is auto-generated from Ignite. You can edit +# the file content but do not change the file name or path. +# +# buf.gen.sta.yaml +# +version: v1 +plugins: + - name: openapiv2 + out: . + opt: + - logtostderr=true + - openapi_naming_strategy=simple + - ignore_comments=true + - simple_operation_ids=false + - json_names_for_fields=false diff --git a/proto/buf.gen.swagger.yaml b/proto/buf.gen.swagger.yaml new file mode 100644 index 000000000..58d30d86e --- /dev/null +++ b/proto/buf.gen.swagger.yaml @@ -0,0 +1,14 @@ +# This file is auto-generated from Ignite. You can edit +# the file content but do not change the file name or path. +# +# buf.gen.swagger.yaml +# +version: v1 +plugins: + - name: openapiv2 + out: . + opt: + - logtostderr=true + - openapi_naming_strategy=fqn + - json_names_for_fields=false + - generate_unbound_methods=true \ No newline at end of file diff --git a/proto/buf.gen.ts.yaml b/proto/buf.gen.ts.yaml new file mode 100644 index 000000000..c484fb3ad --- /dev/null +++ b/proto/buf.gen.ts.yaml @@ -0,0 +1,18 @@ +# This file is auto-generated from Ignite. You can edit +# the file content but do not change the file name or path. +# +# buf.gen.ts.yaml +# +version: v1 +managed: + enabled: true +plugins: + - plugin: buf.build/community/stephenh-ts-proto + out: . + opt: + - logtostderr=true + - allow_merge=true + - json_names_for_fields=false + - ts_proto_opt=snakeToCamel=true + - ts_proto_opt=esModuleInterop=true + - ts_proto_out=. diff --git a/proto/buf.lock b/proto/buf.lock new file mode 100644 index 000000000..bbe57edd9 --- /dev/null +++ b/proto/buf.lock @@ -0,0 +1,35 @@ +# Generated by buf. DO NOT EDIT. +version: v1 +deps: + - remote: buf.build + owner: cosmos + repository: cosmos-proto + commit: 1935555c206d4afb9e94615dfd0fad31 + digest: shake256:c74d91a3ac7ae07d579e90eee33abf9b29664047ac8816500cf22c081fec0d72d62c89ce0bebafc1f6fec7aa5315be72606717740ca95007248425102c365377 + - remote: buf.build + owner: cosmos + repository: cosmos-sdk + commit: aa25660f4ff746388669ce36b3778442 + digest: shake256:a20eb29eb7284d9d0b76e94324a6e24e3665d13682bed0d5beac647d7109b7b2f22080301276779a91f394c97dab334da36dfc01d4252d9f869b090bfc8248aa + - remote: buf.build + owner: cosmos + repository: gogo-proto + commit: 34d970b699f84aa382f3c29773a60836 + digest: shake256:3d3bee5229ba579e7d19ffe6e140986a228b48a8c7fe74348f308537ab95e9135210e81812489d42cd8941d33ff71f11583174ccc5972e86e6112924b6ce9f04 + - remote: buf.build + owner: cosmos + repository: ibc + commit: 30c7be3837b0465bb385ac55e8130c85 + digest: shake256:915c16dc31b3acb6ee7c8bfdc09c70db3ae1b58ecd5b2c9eae1fc1dff3957ce46e2147eb7898caf8a8ab3ed789c55a1bf88c4722bd84c50f1ed6dfebaef41fa3 + - remote: buf.build + owner: cosmos + repository: ics23 + commit: 3c44d8daa8b44059ac744cd17d4a49d7 + - remote: buf.build + owner: googleapis + repository: googleapis + commit: 75b4300737fb4efca0831636be94e517 + - remote: buf.build + owner: protocolbuffers + repository: wellknowntypes + commit: 44e83bc050a4497fa7b36b34d95ca156 diff --git a/proto/buf.yaml b/proto/buf.yaml new file mode 100644 index 000000000..bc581b15e --- /dev/null +++ b/proto/buf.yaml @@ -0,0 +1,25 @@ +breaking: + use: + - FILE +deps: +- buf.build/protocolbuffers/wellknowntypes +- buf.build/cosmos/cosmos-sdk +- buf.build/cosmos/cosmos-proto +- buf.build/cosmos/gogo-proto +- buf.build/googleapis/googleapis +- buf.build/cosmos/ics23 +- buf.build/cosmos/ibc +lint: + except: + - UNARY_RPC + - COMMENT_FIELD + - SERVICE_SUFFIX + - PACKAGE_VERSION_SUFFIX + - RPC_REQUEST_STANDARD_NAME + ignore: + - tendermint + use: + - DEFAULT + - COMMENTS + - FILE_LOWER_SNAKE_CASE +version: v1 diff --git a/proto/pocket/application/application.proto b/proto/pocket/application/application.proto deleted file mode 100644 index f4d3610ca..000000000 --- a/proto/pocket/application/application.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto3"; -package pocket.application; - -option go_package = "github.com/pokt-network/poktroll/x/application/types"; - -import "cosmos_proto/cosmos.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "gogoproto/gogo.proto"; - -import "pocket/shared/service.proto"; - -// Application defines the type used to store an on-chain definition and state for an application -message Application { - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic encoding - cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the application has staked - repeated shared.ApplicationServiceConfig service_configs = 3; // The list of services this appliccation is configured to request service for - repeated string delegatee_gateway_addresses = 4 [(cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.nullable) = false]; // The Bech32 encoded addresses for all delegatee Gateways, in a non-nullable slice -} diff --git a/proto/pocket/application/event.proto b/proto/pocket/application/event.proto deleted file mode 100644 index 619507cab..000000000 --- a/proto/pocket/application/event.proto +++ /dev/null @@ -1,15 +0,0 @@ -syntax = "proto3"; -package pocket.application; - -import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/application/types"; - -// EventRedelegation is an event emitted whenever an application changes its -// delegatee gateways on chain. This is in response to both a DelegateToGateway -// and UndelegateFromGateway message. -message EventRedelegation { - string app_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.jsontag) = "app_address"]; // The Bech32 address of the application, using cosmos' ScalarDescriptor to ensure deterministic encoding - string gateway_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.jsontag) = "gateway_address"]; // The Bech32 address of the gateway the application has changed their delegation of, using cosmos' ScalarDescriptor to ensure deterministic encoding -} diff --git a/proto/pocket/application/genesis.proto b/proto/pocket/application/genesis.proto deleted file mode 100644 index e2741972a..000000000 --- a/proto/pocket/application/genesis.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; - -package pocket.application; - -import "gogoproto/gogo.proto"; -import "pocket/application/params.proto"; -import "pocket/application/application.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/application/types"; - -// GenesisState defines the application module's genesis state. -message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; - repeated Application applicationList = 2 [(gogoproto.nullable) = false]; -} - diff --git a/proto/pocket/application/params.proto b/proto/pocket/application/params.proto deleted file mode 100644 index 4914954f3..000000000 --- a/proto/pocket/application/params.proto +++ /dev/null @@ -1,14 +0,0 @@ -syntax = "proto3"; -package pocket.application; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/application/types"; - -// Params defines the parameters for the module. -message Params { - option (gogoproto.goproto_stringer) = false; - - // The maximum number of gateways an application can delegate trust to - int64 max_delegated_gateways = 1 [(gogoproto.jsontag) = "max_delegated_gateways", (gogoproto.moretags) = "yaml:\"max_delegated_gateways\""]; -} \ No newline at end of file diff --git a/proto/pocket/application/query.proto b/proto/pocket/application/query.proto deleted file mode 100644 index 949ed3a07..000000000 --- a/proto/pocket/application/query.proto +++ /dev/null @@ -1,55 +0,0 @@ -syntax = "proto3"; - -package pocket.application; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -import "pocket/application/params.proto"; -import "pocket/application/application.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/application/types"; - -// Query defines the gRPC querier service. -service Query { - - // Parameters queries the parameters of the module. - rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/pocket/application/params"; - } - - // Queries a list of Application items. - rpc Application (QueryGetApplicationRequest) returns (QueryGetApplicationResponse) { - option (google.api.http).get = "/pocket/application/application/{address}"; - } - rpc ApplicationAll (QueryAllApplicationRequest) returns (QueryAllApplicationResponse) { - option (google.api.http).get = "/pocket/application/application"; - } -} -// QueryParamsRequest is request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is response type for the Query/Params RPC method. -message QueryParamsResponse { - - // params holds all the parameters of this module. - Params params = 1 [(gogoproto.nullable) = false]; -} - -message QueryGetApplicationRequest { - string address = 1; -} - -message QueryGetApplicationResponse { - Application application = 1 [(gogoproto.nullable) = false]; -} - -message QueryAllApplicationRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} - -message QueryAllApplicationResponse { - repeated Application application = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - diff --git a/proto/pocket/application/tx.proto b/proto/pocket/application/tx.proto deleted file mode 100644 index 1f4b9674c..000000000 --- a/proto/pocket/application/tx.proto +++ /dev/null @@ -1,51 +0,0 @@ -syntax = "proto3"; - -package pocket.application; - -import "cosmos_proto/cosmos.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "cosmos/msg/v1/msg.proto"; -import "pocket/shared/service.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/application/types"; - -// Msg defines the Msg service. -service Msg { - rpc StakeApplication (MsgStakeApplication ) returns (MsgStakeApplicationResponse ); - rpc UnstakeApplication (MsgUnstakeApplication ) returns (MsgUnstakeApplicationResponse ); - rpc DelegateToGateway (MsgDelegateToGateway ) returns (MsgDelegateToGatewayResponse ); - rpc UndelegateFromGateway (MsgUndelegateFromGateway) returns (MsgUndelegateFromGatewayResponse); -} -message MsgStakeApplication { - option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic encoding - cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the application has staked. Must be ≥ to the current amount that the application has staked (if any) - repeated shared.ApplicationServiceConfig services = 3; // The list of services this application is staked to request service for -} - -message MsgStakeApplicationResponse {} - -message MsgUnstakeApplication { - option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - string address = 1; -} - -message MsgUnstakeApplicationResponse {} - -message MsgDelegateToGateway { - option (cosmos.msg.v1.signer) = "app_address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - string app_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding - string gateway_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the gateway the application wants to delegate to using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding -} - -message MsgDelegateToGatewayResponse {} - -message MsgUndelegateFromGateway { - option (cosmos.msg.v1.signer) = "appAddress"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - string appAddress = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding - string gatewayAddress = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the gateway the application wants to undelegate from using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding -} - -message MsgUndelegateFromGatewayResponse {} - diff --git a/proto/pocket/gateway/gateway.proto b/proto/pocket/gateway/gateway.proto deleted file mode 100644 index ed7b08751..000000000 --- a/proto/pocket/gateway/gateway.proto +++ /dev/null @@ -1,13 +0,0 @@ -syntax = "proto3"; -package pocket.gateway; - -option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; - -import "cosmos_proto/cosmos.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -message Gateway { - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the gateway - cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the gateway has staked -} - diff --git a/proto/pocket/gateway/genesis.proto b/proto/pocket/gateway/genesis.proto deleted file mode 100644 index 85e6fb8a5..000000000 --- a/proto/pocket/gateway/genesis.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; - -package pocket.gateway; - -import "gogoproto/gogo.proto"; -import "pocket/gateway/params.proto"; -import "pocket/gateway/gateway.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; - -// GenesisState defines the gateway module's genesis state. -message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; - repeated Gateway gatewayList = 2 [(gogoproto.nullable) = false]; -} - diff --git a/proto/pocket/gateway/params.proto b/proto/pocket/gateway/params.proto deleted file mode 100644 index 040f5630d..000000000 --- a/proto/pocket/gateway/params.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -package pocket.gateway; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; - -// Params defines the parameters for the module. -message Params { - option (gogoproto.goproto_stringer) = false; - -} diff --git a/proto/pocket/gateway/query.proto b/proto/pocket/gateway/query.proto deleted file mode 100644 index 91080554d..000000000 --- a/proto/pocket/gateway/query.proto +++ /dev/null @@ -1,55 +0,0 @@ -syntax = "proto3"; - -package pocket.gateway; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -import "pocket/gateway/params.proto"; -import "pocket/gateway/gateway.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; - -// Query defines the gRPC querier service. -service Query { - - // Parameters queries the parameters of the module. - rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/pocket/gateway/params"; - } - - // Queries a list of Gateway items. - rpc Gateway (QueryGetGatewayRequest) returns (QueryGetGatewayResponse) { - option (google.api.http).get = "/pocket/gateway/gateway/{address}"; - } - rpc GatewayAll (QueryAllGatewayRequest) returns (QueryAllGatewayResponse) { - option (google.api.http).get = "/pocket/gateway/gateway"; - } -} -// QueryParamsRequest is request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is response type for the Query/Params RPC method. -message QueryParamsResponse { - - // params holds all the parameters of this module. - Params params = 1 [(gogoproto.nullable) = false]; -} - -message QueryGetGatewayRequest { - string address = 1; -} - -message QueryGetGatewayResponse { - Gateway gateway = 1 [(gogoproto.nullable) = false]; -} - -message QueryAllGatewayRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} - -message QueryAllGatewayResponse { - repeated Gateway gateway = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - diff --git a/proto/pocket/gateway/tx.proto b/proto/pocket/gateway/tx.proto deleted file mode 100644 index 6b0814add..000000000 --- a/proto/pocket/gateway/tx.proto +++ /dev/null @@ -1,31 +0,0 @@ -syntax = "proto3"; - -package pocket.gateway; - -option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; - -import "cosmos/msg/v1/msg.proto"; -import "cosmos_proto/cosmos.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -// Msg defines the Msg service. -service Msg { - rpc StakeGateway (MsgStakeGateway ) returns (MsgStakeGatewayResponse ); - rpc UnstakeGateway (MsgUnstakeGateway) returns (MsgUnstakeGatewayResponse); -} -message MsgStakeGateway { - option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the gateway - cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the gateway is staking. Must be ≥ to the current amount that the gateway has staked (if any) -} - -message MsgStakeGatewayResponse {} - -message MsgUnstakeGateway { - option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - - string address = 1; -} - -message MsgUnstakeGatewayResponse {} diff --git a/proto/pocket/pocket/genesis.proto b/proto/pocket/pocket/genesis.proto deleted file mode 100644 index 52d21410c..000000000 --- a/proto/pocket/pocket/genesis.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -package pocket.pocket; - -import "gogoproto/gogo.proto"; -import "pocket/pocket/params.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/pocket/types"; - -// GenesisState defines the pocket module's genesis state. -message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; -} diff --git a/proto/pocket/pocket/params.proto b/proto/pocket/pocket/params.proto deleted file mode 100644 index a760a6fb6..000000000 --- a/proto/pocket/pocket/params.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -package pocket.pocket; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/pocket/types"; - -// Params defines the parameters for the module. -message Params { - option (gogoproto.goproto_stringer) = false; - -} diff --git a/proto/pocket/pocket/query.proto b/proto/pocket/pocket/query.proto deleted file mode 100644 index 55c4471c0..000000000 --- a/proto/pocket/pocket/query.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto3"; -package pocket.pocket; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "pocket/pocket/params.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/pocket/types"; - -// Query defines the gRPC querier service. -service Query { - // Parameters queries the parameters of the module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/pocket/pocket/params"; - } -} - -// QueryParamsRequest is request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is response type for the Query/Params RPC method. -message QueryParamsResponse { - // params holds all the parameters of this module. - Params params = 1 [(gogoproto.nullable) = false]; -} \ No newline at end of file diff --git a/proto/pocket/pocket/tx.proto b/proto/pocket/pocket/tx.proto deleted file mode 100644 index a0e741350..000000000 --- a/proto/pocket/pocket/tx.proto +++ /dev/null @@ -1,7 +0,0 @@ -syntax = "proto3"; -package pocket.pocket; - -option go_package = "github.com/pokt-network/poktroll/x/pocket/types"; - -// Msg defines the Msg service. -service Msg {} \ No newline at end of file diff --git a/proto/pocket/service/genesis.proto b/proto/pocket/service/genesis.proto deleted file mode 100644 index 9e32feb53..000000000 --- a/proto/pocket/service/genesis.proto +++ /dev/null @@ -1,14 +0,0 @@ -syntax = "proto3"; -package pocket.service; - -import "gogoproto/gogo.proto"; -import "pocket/service/params.proto"; -import "pocket/shared/service.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/service/types"; - -// GenesisState defines the service module's genesis state. -message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; - repeated pocket.shared.Service service_list = 2 [(gogoproto.nullable) = false]; -} diff --git a/proto/pocket/service/query.proto b/proto/pocket/service/query.proto deleted file mode 100644 index 0ce354465..000000000 --- a/proto/pocket/service/query.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto3"; -package pocket.service; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "pocket/service/params.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/service/types"; - -// Query defines the gRPC querier service. -service Query { - // Parameters queries the parameters of the module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/pocket/service/params"; - } -} - -// QueryParamsRequest is request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is response type for the Query/Params RPC method. -message QueryParamsResponse { - // params holds all the parameters of this module. - Params params = 1 [(gogoproto.nullable) = false]; -} diff --git a/proto/pocket/service/relay.proto b/proto/pocket/service/relay.proto deleted file mode 100644 index 538f87610..000000000 --- a/proto/pocket/service/relay.proto +++ /dev/null @@ -1,47 +0,0 @@ -syntax = "proto3"; -package pocket.service; - -import "pocket/session/session.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/service/types"; - -// Relay contains both the RelayRequest (signed by the Application) and the RelayResponse (signed by the Supplier). -// The serialized tuple is inserted into the SMST leaves as values in the Claim/Proof lifecycle. -message Relay { - RelayRequest req = 1; - RelayResponse res = 2; -} - -// RelayRequestMetadata contains the metadata for a RelayRequest. -message RelayRequestMetadata { - session.SessionHeader session_header = 1; // Session header associated with the relay. - // The request signature is a serialized ring signature that may have been - // by either the application itself or one of the gateways that the - // application has delegated to. The signature is made using the ring of the - // application in both cases. - bytes signature = 2; -} - -// RelayRequest holds the request details for a relay. -message RelayRequest { - RelayRequestMetadata meta = 1; - // payload is the serialized payload for the request. - // The payload is passed directly to the service and as such can be any - // format that the service supports: JSON-RPC, REST, gRPC, etc. - bytes payload = 2; -} - -// RelayResponse contains the response details for a RelayRequest. -message RelayResponse { - RelayResponseMetadata meta = 1; - // payload is the serialized payload for the response. - // The payload is passed directly from the service and as such can be any - // format the the service responds with: JSON-RPC, REST, gRPC, etc. - bytes payload = 2; -} - -// RelayResponseMetadata contains the metadata for a RelayResponse. -message RelayResponseMetadata { - session.SessionHeader session_header = 1; // Session header associated with the relay. - bytes supplier_signature = 2; // Signature of the supplier on the response. -} diff --git a/proto/pocket/service/tx.proto b/proto/pocket/service/tx.proto deleted file mode 100644 index 4a22016e1..000000000 --- a/proto/pocket/service/tx.proto +++ /dev/null @@ -1,30 +0,0 @@ -syntax = "proto3"; - -package pocket.service; - -import "cosmos/msg/v1/msg.proto"; -import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; -import "pocket/shared/service.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/service/types"; - -// Msg defines the Msg service. -service Msg { - rpc AddService (MsgAddService) returns (MsgAddServiceResponse); -} - -// MsgAddService defines a message for adding a new message to the network. -// Services can be added by any actor in the network making them truly -// permissionless. -// TODO_DOCUMENT(@h5law): This is a key function in making services -// permissionless, document it's usage and design - in docusaurus covering how -// the entire process works. -message MsgAddService { - option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the service supplier using cosmos' ScalarDescriptor - shared.Service service = 2 [(gogoproto.nullable) = false]; // The Service for which the supplier is adding to the network -} - -message MsgAddServiceResponse {} - diff --git a/proto/pocket/session/genesis.proto b/proto/pocket/session/genesis.proto deleted file mode 100644 index 2ee8ed8ff..000000000 --- a/proto/pocket/session/genesis.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -package pocket.session; - -import "gogoproto/gogo.proto"; -import "pocket/session/params.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/session/types"; - -// GenesisState defines the session module's genesis state. -message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; -} diff --git a/proto/pocket/session/params.proto b/proto/pocket/session/params.proto deleted file mode 100644 index 428f2999e..000000000 --- a/proto/pocket/session/params.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -package pocket.session; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/session/types"; - -// Params defines the parameters for the module. -message Params { - option (gogoproto.goproto_stringer) = false; - -} diff --git a/proto/pocket/session/query.proto b/proto/pocket/session/query.proto deleted file mode 100644 index 44538be5d..000000000 --- a/proto/pocket/session/query.proto +++ /dev/null @@ -1,46 +0,0 @@ -syntax = "proto3"; -package pocket.session; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "cosmos_proto/cosmos.proto"; - -import "pocket/session/params.proto"; -import "pocket/session/session.proto"; -import "pocket/shared/service.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/session/types"; - -// Query defines the gRPC querier service. -service Query { - - // Parameters queries the parameters of the module. - rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/pocket/session/params"; - } - - // Queries a list of GetSession items. - rpc GetSession (QueryGetSessionRequest) returns (QueryGetSessionResponse) { - option (google.api.http).get = "/pocket/session/get_session"; - } -} -// QueryParamsRequest is request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is response type for the Query/Params RPC method. -message QueryParamsResponse { - - // params holds all the parameters of this module. - Params params = 1 [(gogoproto.nullable) = false]; -} - -message QueryGetSessionRequest { - string application_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic encoding - shared.Service service = 2; // The service id to query the session for - int64 block_height = 3; // The block height to query the session for -} - -message QueryGetSessionResponse { - session.Session session = 1; -} - diff --git a/proto/pocket/session/session.proto b/proto/pocket/session/session.proto deleted file mode 100644 index e92a5b5ac..000000000 --- a/proto/pocket/session/session.proto +++ /dev/null @@ -1,33 +0,0 @@ -syntax = "proto3"; -package pocket.session; - -option go_package = "github.com/pokt-network/poktroll/x/session/types"; - -import "cosmos_proto/cosmos.proto"; -import "pocket/shared/service.proto"; -import "pocket/application/application.proto"; -import "pocket/shared/supplier.proto"; - -// NOTE: Using signed integers for consistency with the cosmos SDK - -// SessionHeader is a lightweight header for a session that can be passed around. -// It is the minimal amount of data required to hydrate & retrieve all data relevant to the session. -message SessionHeader { - string application_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic encoding - shared.Service service = 2; // The service this session is for - int64 session_start_block_height = 3; // The height at which this session started - // NOTE: session_id can be derived from the above values using on-chain but is included in the header for convenience - string session_id = 4; // A unique pseudoranom ID for this session - int64 session_end_block_height = 5; // The height at which this session ended, this is the last block of the session -} - -// Session is a fully hydrated session object that contains all the information for the Session -// and its parcipants. -message Session { - SessionHeader header = 1; // The header of the session containing lightweight data - string session_id = 2; // A unique pseudoranom ID for this session - int64 session_number = 3; // The session number since genesis - int64 num_blocks_per_session = 4; // The number of blocks per session when this session started - application.Application application = 5; // A fully hydrated application object this session is for - repeated shared.Supplier suppliers = 6; // A fully hydrated set of servicers that are serving the application -} \ No newline at end of file diff --git a/proto/pocket/session/tx.proto b/proto/pocket/session/tx.proto deleted file mode 100644 index 6d793ffdb..000000000 --- a/proto/pocket/session/tx.proto +++ /dev/null @@ -1,7 +0,0 @@ -syntax = "proto3"; -package pocket.session; - -option go_package = "github.com/pokt-network/poktroll/x/session/types"; - -// Msg defines the Msg service. -service Msg {} \ No newline at end of file diff --git a/proto/pocket/shared/service.proto b/proto/pocket/shared/service.proto deleted file mode 100644 index 34553fb32..000000000 --- a/proto/pocket/shared/service.proto +++ /dev/null @@ -1,66 +0,0 @@ -syntax = "proto3"; - -// NOTE that the `shared` package is not a Cosmos module, -// but rather a manually created package to resolve circular dependencies. -package pocket.shared; - -option go_package = "github.com/pokt-network/poktroll/x/shared/types"; - -// TODO_CLEANUP(@Olshansk): Add native optional identifiers once its supported; https://github.com/ignite/cli/issues/3698 - -// Service message to encapsulate unique and semantic identifiers for a service on the network -message Service { - // For example, what if we want to request a session for a certain service but with some additional configs that identify it? - string id = 1; // Unique identifier for the service - - // TODO_TECHDEBT: Name is currently unused but acts as a reminder than an optional onchain representation of the service is necessary - string name = 2; // (Optional) Semantic human readable name for the service -} - -// ApplicationServiceConfig holds the service configuration the application stakes for -message ApplicationServiceConfig { - Service service = 1; // The Service for which the application is configured - - // TODO_RESEARCH: There is an opportunity for applications to advertise the max - // they're willing to pay for a certain configuration/price, but this is outside of scope. - // RPCConfig rpc_configs = 2; // List of endpoints for the service -} - -// SupplierServiceConfig holds the service configuration the supplier stakes for -message SupplierServiceConfig { - Service service = 1; // The Service for which the supplier is configured - repeated SupplierEndpoint endpoints = 2; // List of endpoints for the service - // TODO_RESEARCH: There is an opportunity for supplier to advertise the min - // they're willing to earn for a certain configuration/price, but this is outside of scope. -} - -// SupplierEndpoint message to hold service configuration details -message SupplierEndpoint { - string url = 1; // URL of the endpoint - RPCType rpc_type = 2; // Type of RPC exposed on the url above - repeated ConfigOption configs = 3; // Additional configuration options for the endpoint -} - -// Enum to define RPC types -enum RPCType { - UNKNOWN_RPC = 0; // Undefined RPC type - GRPC = 1; // gRPC - WEBSOCKET = 2; // WebSocket - JSON_RPC = 3; // JSON-RPC - REST = 4; // REST - // Add new RPC types here as needed -} - -// Enum to define configuration options -// TODO_RESEARCH: Should these be configs, SLAs or something else? There will be more discussion once we get closer to implementing on-chain QoS. -enum ConfigOptions { - UNKNOWN_CONFIG = 0; // Undefined config option - TIMEOUT = 1; // Timeout setting - // Add new config options here as needed -} - -// Key-value wrapper for config options, as proto maps can't be keyed by enums -message ConfigOption { - ConfigOptions key = 1; // Config option key - string value = 2; // Config option value -} diff --git a/proto/pocket/shared/supplier.proto b/proto/pocket/shared/supplier.proto deleted file mode 100644 index 90e6999b3..000000000 --- a/proto/pocket/shared/supplier.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto3"; -package pocket.shared; - -// NOTE that the `shared` package is not a Cosmos module, -// but rather a manually created package to resolve circular dependencies. - -option go_package = "github.com/pokt-network/poktroll/x/shared/types"; - -import "cosmos_proto/cosmos.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "pocket/shared/service.proto"; - -// Supplier is the type defining the actor in Pocket Network that provides RPC services. -message Supplier { - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic encoding - cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the supplier has staked - repeated SupplierServiceConfig services = 3; // The service configs this supplier can support -} diff --git a/proto/pocket/supplier/claim.proto b/proto/pocket/supplier/claim.proto deleted file mode 100644 index 25b188040..000000000 --- a/proto/pocket/supplier/claim.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; -package pocket.supplier; - -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; - -import "cosmos_proto/cosmos.proto"; -import "pocket/session/session.proto"; - -// Claim is the serialized object stored on-chain for claims pending to be proven -message Claim { - string supplier_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // the address of the supplier that submitted this claim - // The session header of the session that this claim is for. - session.SessionHeader session_header = 2; - // Root hash returned from smt.SMST#Root(). - bytes root_hash = 3; -} \ No newline at end of file diff --git a/proto/pocket/supplier/genesis.proto b/proto/pocket/supplier/genesis.proto deleted file mode 100644 index 5bba7baea..000000000 --- a/proto/pocket/supplier/genesis.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; - -package pocket.supplier; - -import "gogoproto/gogo.proto"; -import "pocket/supplier/params.proto"; -import "pocket/shared/supplier.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; - -// GenesisState defines the supplier module's genesis state. -message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; - repeated pocket.shared.Supplier supplierList = 2 [(gogoproto.nullable) = false]; -} - diff --git a/proto/pocket/supplier/params.proto b/proto/pocket/supplier/params.proto deleted file mode 100644 index 3ea82ce2f..000000000 --- a/proto/pocket/supplier/params.proto +++ /dev/null @@ -1,13 +0,0 @@ -syntax = "proto3"; -package pocket.supplier; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; - -// Params defines the parameters for the module. -message Params { - option (gogoproto.goproto_stringer) = false; - // TODO_BLOCKER: Add proof-related submission window params - // TODO_BLOCKER: Add claim-related submission window params -} diff --git a/proto/pocket/supplier/proof.proto b/proto/pocket/supplier/proof.proto deleted file mode 100644 index 7ec927d05..000000000 --- a/proto/pocket/supplier/proof.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; -package pocket.supplier; - -import "cosmos_proto/cosmos.proto"; -import "pocket/session/session.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; - -message Proof { - string supplier_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // The session header of the session that this claim is for. - session.SessionHeader session_header = 2; - // The serialized SMST proof from the `#ClosestProof()` method. - bytes closest_merkle_proof = 3; -} - diff --git a/proto/pocket/supplier/query.proto b/proto/pocket/supplier/query.proto deleted file mode 100644 index 016eec26f..000000000 --- a/proto/pocket/supplier/query.proto +++ /dev/null @@ -1,122 +0,0 @@ -syntax = "proto3"; - -package pocket.supplier; - -import "cosmos_proto/cosmos.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "pocket/supplier/params.proto"; -import "pocket/shared/supplier.proto"; -import "pocket/supplier/claim.proto"; -import "pocket/supplier/proof.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; - -// Query defines the gRPC querier service. -service Query { - - // Parameters queries the parameters of the module. - rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/pocket/supplier/params"; - } - - // Queries a list of Supplier items. - rpc Supplier (QueryGetSupplierRequest) returns (QueryGetSupplierResponse) { - option (google.api.http).get = "/pocket/supplier/supplier/{address}"; - - } - rpc SupplierAll (QueryAllSupplierRequest) returns (QueryAllSupplierResponse) { - option (google.api.http).get = "/pocket/supplier/suppliers"; - } - - // Queries a list of Claim items. - rpc Claim (QueryGetClaimRequest) returns (QueryGetClaimResponse) { - option (google.api.http).get = "/pocket/supplier/claim/{session_id}/{supplier_address}"; - } - rpc AllClaims (QueryAllClaimsRequest) returns (QueryAllClaimsResponse) { - option (google.api.http).get = "/pocket/supplier/claims"; - } - - // Queries a list of Proof items. - rpc Proof (QueryGetProofRequest) returns (QueryGetProofResponse) { - option (google.api.http).get = "/pocket/supplier/proof/{session_id}/{supplier_address}"; - } - rpc AllProofs (QueryAllProofsRequest) returns (QueryAllProofsResponse) { - option (google.api.http).get = "/pocket/supplier/proof"; - } -} - -// QueryParamsRequest is request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is response type for the Query/Params RPC method. -message QueryParamsResponse { - - // params holds all the parameters of this module. - Params params = 1 [(gogoproto.nullable) = false]; -} - -message QueryGetSupplierRequest { - string address = 1; -} - -message QueryGetSupplierResponse { - pocket.shared.Supplier supplier = 1 [(gogoproto.nullable) = false]; -} - -message QueryAllSupplierRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} - -message QueryAllSupplierResponse { - repeated pocket.shared.Supplier supplier = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -message QueryGetClaimRequest { - string session_id = 1; - string supplier_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} - -message QueryGetClaimResponse { - Claim claim = 1 [(gogoproto.nullable) = false]; -} - -message QueryAllClaimsRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; - oneof filter { - string supplier_address = 2; - string session_id = 3; - uint64 session_end_height = 4; - } -} - -message QueryAllClaimsResponse { - repeated Claim claim = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -message QueryGetProofRequest { - string session_id = 1; - string supplier_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} - -message QueryGetProofResponse { - Proof proof = 1 [(gogoproto.nullable) = false]; -} - -message QueryAllProofsRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; - oneof filter { - string supplier_address = 2; - string session_id = 3; - uint64 session_end_height = 4; - } -} - -message QueryAllProofsResponse { - repeated Proof proof = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - diff --git a/proto/pocket/supplier/tx.proto b/proto/pocket/supplier/tx.proto deleted file mode 100644 index 2671b83a9..000000000 --- a/proto/pocket/supplier/tx.proto +++ /dev/null @@ -1,63 +0,0 @@ -syntax = "proto3"; - -package pocket.supplier; - -import "cosmos_proto/cosmos.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "cosmos/msg/v1/msg.proto"; - -import "pocket/session/session.proto"; -import "pocket/shared/service.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; - -// Msg defines the Msg service. -service Msg { - rpc StakeSupplier (MsgStakeSupplier ) returns (MsgStakeSupplierResponse ); - rpc UnstakeSupplier (MsgUnstakeSupplier) returns (MsgUnstakeSupplierResponse); - rpc CreateClaim (MsgCreateClaim ) returns (MsgCreateClaimResponse ); - rpc SubmitProof (MsgSubmitProof ) returns (MsgSubmitProofResponse ); -} - -message MsgStakeSupplier { - option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding - cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the supplier has staked. Must be ≥ to the current amount that the supplier has staked (if any) - repeated shared.SupplierServiceConfig services = 3; // The list of services this supplier is staked to provide service for -} - -message MsgStakeSupplierResponse {} - -message MsgUnstakeSupplier { - option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - - string address = 1; -} - -message MsgUnstakeSupplierResponse {} - -message MsgCreateClaim { - option (cosmos.msg.v1.signer) = "supplier_address"; - - string supplier_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - pocket.session.SessionHeader session_header = 2; - // root returned from smt.SMST#Root() - bytes root_hash = 3; -} - -message MsgCreateClaimResponse {} - - - -message MsgSubmitProof { - option (cosmos.msg.v1.signer) = "supplier_address"; - - string supplier_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - pocket.session.SessionHeader session_header = 2; - // serialized version of *smt.SparseMerkleClosestProof - bytes proof = 3; -} - -message MsgSubmitProofResponse {} - diff --git a/proto/pocket/tokenomics/genesis.proto b/proto/pocket/tokenomics/genesis.proto deleted file mode 100644 index c1f72d8b8..000000000 --- a/proto/pocket/tokenomics/genesis.proto +++ /dev/null @@ -1,13 +0,0 @@ -syntax = "proto3"; -package pocket.tokenomics; - -import "gogoproto/gogo.proto"; -import "pocket/tokenomics/params.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; - -// GenesisState defines the tokenomics module's genesis state. -message GenesisState { - // params defines all the parameters of the module. - Params params = 1 [(gogoproto.nullable) = false]; -} diff --git a/proto/pocket/tokenomics/params.proto b/proto/pocket/tokenomics/params.proto deleted file mode 100644 index 79658a582..000000000 --- a/proto/pocket/tokenomics/params.proto +++ /dev/null @@ -1,28 +0,0 @@ -syntax = "proto3"; -package pocket.tokenomics; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; - -// TODO_DOCUMENT(@Olshansk): Document all of the on-chain governance parameters. -// Params defines the parameters for the tokenomics module. -message Params { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; - - // The amount of upokt that a compute unit should translate to when settling a session. - // TODO_DOCUMENT(@Olshansk): Make sure to document the units of this parameter (or the map) once finalized. - uint64 compute_units_to_tokens_multiplier = 1 [(gogoproto.jsontag) = "compute_units_to_tokens_multiplier", (gogoproto.moretags) = "yaml:\"compute_units_to_tokens_multiplier\""]; - - // TODO: Some parameters we should consider adding next: - // - Service.computeUnitsToTokensMultiplierMap - // - Application.MaxuPOKTPerRelay - // - Application.MinuPOKTPerRelay - // - Suppler.MaxuPOKTPerRelay - // - Suppler.MinuPOKTPerRelay - // - RevDistr.PercentageToSupploer - // - RevDistr.PercentageToDAO - // - RevDistr.PercentageToPNF - // - RevDistr.PercentageToDelegators -} \ No newline at end of file diff --git a/proto/pocket/tokenomics/query.proto b/proto/pocket/tokenomics/query.proto deleted file mode 100644 index ce302d0da..000000000 --- a/proto/pocket/tokenomics/query.proto +++ /dev/null @@ -1,30 +0,0 @@ -syntax = "proto3"; -package pocket.tokenomics; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "pocket/tokenomics/params.proto"; -import "google/protobuf/any.proto"; -import "cosmos/auth/v1beta1/auth.proto"; -import "cosmos_proto/cosmos.proto"; -import "cosmos/query/v1/query.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; - -// Query defines the gRPC querier service. -service Query { - // Parameters queries the parameters of the module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (cosmos.query.v1.module_query_safe) = true; - option (google.api.http).get = "/pokt-network/poktroll/tokenomics/params"; - } -} - -// QueryParamsRequest queries all parameters. -message QueryParamsRequest {} - -// QueryParamsResponse is the response type for the Query/Params RPC method. -message QueryParamsResponse { - // params defines the parameters of the module. - Params params = 1 [(gogoproto.nullable) = false]; -} \ No newline at end of file diff --git a/proto/pocket/tokenomics/tx.proto b/proto/pocket/tokenomics/tx.proto deleted file mode 100644 index d55ca7835..000000000 --- a/proto/pocket/tokenomics/tx.proto +++ /dev/null @@ -1,34 +0,0 @@ -syntax = "proto3"; -package pocket.tokenomics; - -import "cosmos/auth/v1beta1/auth.proto"; -import "gogoproto/gogo.proto"; -import "pocket/tokenomics/params.proto"; -import "cosmos/msg/v1/msg.proto"; -import "cosmos_proto/cosmos.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; - -// Msg defines the Msg service. -service Msg { - rpc UpdateParams (MsgUpdateParams) returns (MsgUpdateParamsResponse); -} - -// MsgUpdateParams is the Msg/UpdateParams request type. -message MsgUpdateParams { - option (cosmos.msg.v1.signer) = "authority"; - - // authority is the address that controls the module (defaults to x/gov unless overwritten). - string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // TODO_IMPROVE(#322): The requirement to provide all params is adopted from the - // latest Cosmos SDK version. We should look into either improving this ourselves - // or seeing if it is on their roadmap. - - // params defines the x/tokenomics parameters to update. - // NOTE: All parameters must be supplied. - Params params = 2 [(gogoproto.nullable) = false]; -} - -// MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. -message MsgUpdateParamsResponse {} \ No newline at end of file diff --git a/proto/poktroll/service/genesis.proto b/proto/poktroll/service/genesis.proto new file mode 100644 index 000000000..698660b69 --- /dev/null +++ b/proto/poktroll/service/genesis.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; +package poktroll.service; + +option go_package = "github.com/pokt-network/poktroll/x/service/types"; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; + +import "poktroll/service/params.proto"; +import "poktroll/shared/service.proto"; + + +// GenesisState defines the service module's genesis state. +message GenesisState { + + // params defines all the parameters of the module. + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated poktroll.shared.Service service_list = 2 [(gogoproto.nullable) = false] ; +} + diff --git a/proto/poktroll/service/module/module.proto b/proto/poktroll/service/module/module.proto new file mode 100644 index 000000000..d057936f7 --- /dev/null +++ b/proto/poktroll/service/module/module.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package poktroll.service.module; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object for the module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/pokt-network/poktroll/x/service" + }; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 1; +} \ No newline at end of file diff --git a/proto/pocket/service/params.proto b/proto/poktroll/service/params.proto similarity index 61% rename from proto/pocket/service/params.proto rename to proto/poktroll/service/params.proto index 70e34a3c8..aa963aba5 100644 --- a/proto/pocket/service/params.proto +++ b/proto/poktroll/service/params.proto @@ -1,17 +1,19 @@ syntax = "proto3"; -package pocket.service; +package poktroll.service; +option go_package = "github.com/pokt-network/poktroll/x/service/types"; + +import "amino/amino.proto"; import "gogoproto/gogo.proto"; -option go_package = "github.com/pokt-network/poktroll/x/service/types"; // Params defines the parameters for the module. message Params { - option (gogoproto.goproto_stringer) = false; + option (amino.name) = "poktroll/x/service/Params"; + option (gogoproto.equal) = true; // The amount of uPOKT required to add a new service. // This will be deducted from the signer's account balance, // and transferred to the pocket network foundation. - uint64 add_service_fee = 1 - [(gogoproto.jsontag) = "add_service_fee"]; -} + uint64 add_service_fee = 1 [(gogoproto.moretags) = "yaml:\"add_service_fee\""]; +} \ No newline at end of file diff --git a/proto/poktroll/service/query.proto b/proto/poktroll/service/query.proto new file mode 100644 index 000000000..909394ed6 --- /dev/null +++ b/proto/poktroll/service/query.proto @@ -0,0 +1,60 @@ +syntax = "proto3"; +package poktroll.service; + +option go_package = "github.com/pokt-network/poktroll/x/service/types"; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; + +import "poktroll/service/params.proto"; +import "poktroll/shared/service.proto"; + +// Query defines the gRPC querier service. +service Query { + + // Parameters queries the parameters of the module. + rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/pokt-network/poktroll/service/params"; + + } + + // Queries a list of Service items. + rpc Service (QueryGetServiceRequest) returns (QueryGetServiceResponse) { + option (google.api.http).get = "/pokt-network/poktroll/service/service/{id}"; + + } + rpc AllServices (QueryAllServicesRequest) returns (QueryAllServicesResponse) { + option (google.api.http).get = "/pokt-network/poktroll/service/service"; + + } +} +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + + // params holds all the parameters of this module. + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +message QueryGetServiceRequest { + // TODO: We could support getting services by name. + string id = 1; +} + +message QueryGetServiceResponse { + poktroll.shared.Service service = 1 [(gogoproto.nullable) = false]; +} + +message QueryAllServicesRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllServicesResponse { + repeated poktroll.shared.Service service = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + diff --git a/proto/poktroll/service/tx.proto b/proto/poktroll/service/tx.proto new file mode 100644 index 000000000..469c47b1e --- /dev/null +++ b/proto/poktroll/service/tx.proto @@ -0,0 +1,58 @@ +syntax = "proto3"; +package poktroll.service; + +option go_package = "github.com/pokt-network/poktroll/x/service/types"; + +import "amino/amino.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; + +import "poktroll/service/params.proto"; +import "poktroll/shared/service.proto"; + + +// Msg defines the Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + rpc UpdateParams (MsgUpdateParams) returns (MsgUpdateParamsResponse); + rpc AddService (MsgAddService ) returns (MsgAddServiceResponse ); +} +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "poktroll/x/service/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // TODO_IMPROVE(#322): The requirement to provide all params is adopted from the + // latest Cosmos SDK version. We should look into either improving this ourselves + // or seeing if it is on their roadmap. + + // params defines the x/service parameters to update. + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse {} + +// MsgAddService defines a message for adding a new message to the network. +// Services can be added by any actor in the network making them truly +// permissionless. +// TODO_DOCUMENT(@h5law): This is a key function in making services +// permissionless, document it's usage and design - in docusaurus covering how +// the entire process works. +message MsgAddService { + option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the service supplier using cosmos' ScalarDescriptor + poktroll.shared.Service service = 2 [(gogoproto.nullable) = false]; // The Service for which the supplier is adding to the network +} + +message MsgAddServiceResponse {} + diff --git a/proto/poktroll/shared/service.proto b/proto/poktroll/shared/service.proto new file mode 100644 index 000000000..60a046eac --- /dev/null +++ b/proto/poktroll/shared/service.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +// NOTE that the `shared` package is not a Cosmos module, +// but rather a manually created package to resolve circular type dependencies. +package poktroll.shared; + +option go_package = "github.com/pokt-network/poktroll/x/shared/types"; + +// TODO_CLEANUP(@Olshansk): Add native optional identifiers once its supported; https://github.com/ignite/cli/issues/3698 + +// Service message to encapsulate unique and semantic identifiers for a service on the network +message Service { + // For example, what if we want to request a session for a certain service but with some additional configs that identify it? + string id = 1; // Unique identifier for the service + + // TODO_TECHDEBT: Name is currently unused but acts as a reminder that an optional onchain representation of the service is necessary + string name = 2; // (Optional) Semantic human readable name for the service +} + diff --git a/testutil/application/mocks/mocks.go b/testutil/application/mocks/mocks.go deleted file mode 100644 index 595954e65..000000000 --- a/testutil/application/mocks/mocks.go +++ /dev/null @@ -1,11 +0,0 @@ -package mocks - -// This file is in place to declare the package for dynamically generated structs. -// -// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests -// -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree -// to be valid before mock implementations have been generated. diff --git a/testutil/gateway/mocks/mocks.go b/testutil/gateway/mocks/mocks.go deleted file mode 100644 index 595954e65..000000000 --- a/testutil/gateway/mocks/mocks.go +++ /dev/null @@ -1,11 +0,0 @@ -package mocks - -// This file is in place to declare the package for dynamically generated structs. -// -// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests -// -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree -// to be valid before mock implementations have been generated. diff --git a/testutil/keeper/application.go b/testutil/keeper/application.go deleted file mode 100644 index e9248b622..000000000 --- a/testutil/keeper/application.go +++ /dev/null @@ -1,107 +0,0 @@ -package keeper - -import ( - "testing" - - tmdb "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - mocks "github.com/pokt-network/poktroll/testutil/application/mocks" - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" - gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" -) - -// stakedGatewayMap is used to mock whether a gateway is staked or not for use -// in the application's mocked gateway keeper. This enables the tester to -// control whether a gateway is "staked" or not and whether it can be delegated to -// WARNING: Using this map may cause issues if running multiple tests in parallel -var stakedGatewayMap = make(map[string]struct{}) - -// ApplicationKeeper returns a mocked application keeper and context for testing -// it mocks the chain having staked gateways via the use of the stakedGatewayMap -func ApplicationKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - - db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) - require.NoError(t, stateStore.LoadLatestVersion()) - - registry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(registry) - - ctrl := gomock.NewController(t) - mockBankKeeper := mocks.NewMockBankKeeper(ctrl) - mockBankKeeper.EXPECT().DelegateCoinsFromAccountToModule(gomock.Any(), gomock.Any(), types.ModuleName, gomock.Any()).AnyTimes() - mockBankKeeper.EXPECT().UndelegateCoinsFromModuleToAccount(gomock.Any(), types.ModuleName, gomock.Any(), gomock.Any()).AnyTimes() - - mockAccountKeeper := mocks.NewMockAccountKeeper(ctrl) - mockAccountKeeper.EXPECT().GetAccount(gomock.Any(), gomock.Any()).AnyTimes() - - mockGatewayKeeper := mocks.NewMockGatewayKeeper(ctrl) - mockGatewayKeeper.EXPECT().GetGateway(gomock.Any(), gomock.Any()).DoAndReturn( - func(_ sdk.Context, addr string) (gatewaytypes.Gateway, bool) { - if _, ok := stakedGatewayMap[addr]; !ok { - return gatewaytypes.Gateway{}, false - } - stake := sdk.NewCoin("upokt", sdk.NewInt(10000)) - return gatewaytypes.Gateway{ - Address: addr, - Stake: &stake, - }, true - }, - ).AnyTimes() - - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "ApplicationParams", - ) - k := keeper.NewKeeper( - cdc, - storeKey, - memStoreKey, - paramsSubspace, - mockBankKeeper, - mockAccountKeeper, - mockGatewayKeeper, - ) - - ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) - - // Initialize params - k.SetParams(ctx, types.DefaultParams()) - - return k, ctx -} - -// AddGatewayToStakedGatewayMap adds the given gateway address to the staked -// gateway map for use in the application's mocked gateway keeper and ensures -// that it is removed from the map when the test is complete -func AddGatewayToStakedGatewayMap(t *testing.T, gatewayAddr string) { - t.Helper() - stakedGatewayMap[gatewayAddr] = struct{}{} - t.Cleanup(func() { - delete(stakedGatewayMap, gatewayAddr) - }) -} - -// RemoveGatewayFromStakedGatewayMap removes the given gateway address from the -// staked gateway map for use in the application's mocked gateway keeper -func RemoveGatewayFromStakedGatewayMap(t *testing.T, gatewayAddr string) { - t.Helper() - delete(stakedGatewayMap, gatewayAddr) -} diff --git a/testutil/keeper/gateway.go b/testutil/keeper/gateway.go deleted file mode 100644 index 7a7fa84bb..000000000 --- a/testutil/keeper/gateway.go +++ /dev/null @@ -1,61 +0,0 @@ -package keeper - -import ( - "testing" - - tmdb "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - mocks "github.com/pokt-network/poktroll/testutil/gateway/mocks" - "github.com/pokt-network/poktroll/x/gateway/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func GatewayKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - - db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) - require.NoError(t, stateStore.LoadLatestVersion()) - - registry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(registry) - - ctrl := gomock.NewController(t) - mockBankKeeper := mocks.NewMockBankKeeper(ctrl) - mockBankKeeper.EXPECT().DelegateCoinsFromAccountToModule(gomock.Any(), gomock.Any(), types.ModuleName, gomock.Any()).AnyTimes() - mockBankKeeper.EXPECT().UndelegateCoinsFromModuleToAccount(gomock.Any(), types.ModuleName, gomock.Any(), gomock.Any()).AnyTimes() - - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "GatewayParams", - ) - k := keeper.NewKeeper( - cdc, - storeKey, - memStoreKey, - paramsSubspace, - mockBankKeeper, - ) - - ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) - - // Initialize params - k.SetParams(ctx, types.DefaultParams()) - - return k, ctx -} diff --git a/testutil/keeper/pocket.go b/testutil/keeper/pocket.go deleted file mode 100644 index cebf1b0bf..000000000 --- a/testutil/keeper/pocket.go +++ /dev/null @@ -1,53 +0,0 @@ -package keeper - -import ( - "testing" - - tmdb "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/x/pocket/keeper" - "github.com/pokt-network/poktroll/x/pocket/types" -) - -func PocketKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - - db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) - require.NoError(t, stateStore.LoadLatestVersion()) - - registry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(registry) - - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "PocketParams", - ) - k := keeper.NewKeeper( - cdc, - storeKey, - memStoreKey, - paramsSubspace, - ) - - ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) - - // Initialize params - k.SetParams(ctx, types.DefaultParams()) - - return k, ctx -} diff --git a/testutil/keeper/service.go b/testutil/keeper/service.go index 10c43cd08..74a88169d 100644 --- a/testutil/keeper/service.go +++ b/testutil/keeper/service.go @@ -1,18 +1,23 @@ package keeper import ( + "context" "sync" "testing" - tmdb "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "cosmossdk.io/log" + "cosmossdk.io/math" + "cosmossdk.io/store" + "cosmossdk.io/store/metrics" + storetypes "cosmossdk.io/store/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" @@ -28,66 +33,60 @@ var ( mapMu = sync.RWMutex{} ) -// ServiceKeeper returns an instance of the keeper for the service module -// with a mocked dependency of the BankModule for testing purposes. -func ServiceKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) +func ServiceKeeper(t testing.TB) (keeper.Keeper, context.Context) { + t.Helper() + storeKey := storetypes.NewKVStoreKey(types.StoreKey) - db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) + db := dbm.NewMemDB() + stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) require.NoError(t, stateStore.LoadLatestVersion()) registry := codectypes.NewInterfaceRegistry() cdc := codec.NewProtoCodec(registry) + authority := authtypes.NewModuleAddress(govtypes.ModuleName) ctrl := gomock.NewController(t) mockBankKeeper := mocks.NewMockBankKeeper(ctrl) mockBankKeeper.EXPECT(). SpendableCoins(gomock.Any(), gomock.Any()). - DoAndReturn(func(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins { - mapMu.RLock() - defer mapMu.RUnlock() - if coins, ok := mapAccAddrCoins[addr.String()]; ok { - return coins - } - return sdk.Coins{} - }). - AnyTimes() + DoAndReturn( + func(ctx context.Context, addr sdk.AccAddress) sdk.Coins { + mapMu.RLock() + defer mapMu.RUnlock() + if coins, ok := mapAccAddrCoins[addr.String()]; ok { + return coins + } + return sdk.Coins{} + }, + ).AnyTimes() mockBankKeeper.EXPECT(). SendCoinsFromAccountToModule(gomock.Any(), gomock.Any(), types.ModuleName, gomock.Any()). - DoAndReturn(func(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error { - mapMu.Lock() - defer mapMu.Unlock() - coins := mapAccAddrCoins[senderAddr.String()] - if coins.AmountOf("upokt").GT(amt.AmountOf("upokt")) { - mapAccAddrCoins[senderAddr.String()] = coins.Sub(amt...) - return nil - } - return types.ErrServiceNotEnoughFunds - }). - AnyTimes() + DoAndReturn( + func(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error { + mapMu.Lock() + defer mapMu.Unlock() + coins := mapAccAddrCoins[senderAddr.String()] + if coins.AmountOf("upokt").GT(amt.AmountOf("upokt")) { + mapAccAddrCoins[senderAddr.String()] = coins.Sub(amt...) + return nil + } + return types.ErrServiceNotEnoughFunds + }, + ).AnyTimes() - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "ServiceParams", - ) k := keeper.NewKeeper( cdc, - storeKey, - memStoreKey, - paramsSubspace, + runtime.NewKVStoreService(storeKey), + log.NewNopLogger(), + authority.String(), mockBankKeeper, ) - ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) + ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) // Initialize params - k.SetParams(ctx, types.DefaultParams()) + require.NoError(t, k.SetParams(ctx, types.DefaultParams())) return k, ctx } @@ -104,16 +103,8 @@ func AddAccToAccMapCoins(t *testing.T, addr, denom string, amount uint64) { }) addrBech32, err := sdk.AccAddressFromBech32(addr) require.NoError(t, err) - coins := sdk.NewCoins(sdk.Coin{Denom: denom, Amount: sdk.NewIntFromUint64(amount)}) + coins := sdk.NewCoins(sdk.Coin{Denom: denom, Amount: math.NewIntFromUint64(amount)}) mapMu.Lock() defer mapMu.Unlock() mapAccAddrCoins[addrBech32.String()] = coins } - -// RemoveFromAccMapCoins removes an address from the mapAccAddrCoins map -func RemoveFromAccMapCoins(t *testing.T, addr string) { - t.Helper() - mapMu.Lock() - defer mapMu.Unlock() - delete(mapAccAddrCoins, addr) -} diff --git a/testutil/keeper/session.go b/testutil/keeper/session.go deleted file mode 100644 index 8b57ec0c4..000000000 --- a/testutil/keeper/session.go +++ /dev/null @@ -1,202 +0,0 @@ -package keeper - -import ( - "context" - "testing" - - tmdb "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/testutil/session/mocks" - apptypes "github.com/pokt-network/poktroll/x/application/types" - "github.com/pokt-network/poktroll/x/session/keeper" - "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -type option[V any] func(k *keeper.Keeper) - -var ( - TestServiceId1 = "svc1" // staked for by app1 & supplier1 - TestServiceId11 = "svc11" // staked for by app1 - - TestServiceId2 = "svc2" // staked for by app2 & supplier1 - TestServiceId22 = "svc22" // staked for by app2 - - TestServiceId12 = "svc12" // staked for by app1, app2 & supplier1 - - TestApp1Address = "pokt1mdccn4u38eyjdxkk4h0jaddw4n3c72u82m5m9e" // Generated via sample.AccAddress() - TestApp1 = apptypes.Application{ - Address: TestApp1Address, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: TestServiceId1}, - }, - { - Service: &sharedtypes.Service{Id: TestServiceId11}, - }, - { - Service: &sharedtypes.Service{Id: TestServiceId12}, - }, - }, - } - - TestApp2Address = "pokt133amv5suh75zwkxxcq896azvmmwszg99grvk9f" // Generated via sample.AccAddress() - TestApp2 = apptypes.Application{ - Address: TestApp1Address, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: TestServiceId2}, - }, - { - Service: &sharedtypes.Service{Id: TestServiceId22}, - }, - { - Service: &sharedtypes.Service{Id: TestServiceId12}, - }, - }, - } - - TestSupplierUrl = "http://olshansky.info" - TestSupplierAddress = sample.AccAddress() - TestSupplier = sharedtypes.Supplier{ - Address: TestSupplierAddress, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{Id: TestServiceId1}, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: TestSupplierUrl, - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - { - Service: &sharedtypes.Service{Id: TestServiceId2}, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: TestSupplierUrl, - RpcType: sharedtypes.RPCType_GRPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - { - Service: &sharedtypes.Service{Id: TestServiceId12}, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: TestSupplierUrl, - RpcType: sharedtypes.RPCType_GRPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - } -) - -func SessionKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - - db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) - require.NoError(t, stateStore.LoadLatestVersion()) - - registry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(registry) - - mockAppKeeper := defaultAppKeeperMock(t) - mockSupplierKeeper := defaultSupplierKeeperMock(t) - - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "SessionParams", - ) - k := keeper.NewKeeper( - cdc, - storeKey, - memStoreKey, - paramsSubspace, - - mockAppKeeper, - mockSupplierKeeper, - ) - - // TODO_TECHDEBT: See the comment at the bottom of this file explaining - // why we don't support options yet. - // for _, opt := range opts { - // opt(k) - // } - - ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) - - // Initialize params - k.SetParams(ctx, types.DefaultParams()) - - return k, ctx -} - -func defaultAppKeeperMock(t testing.TB) types.ApplicationKeeper { - t.Helper() - ctrl := gomock.NewController(t) - - getAppFn := func(_ context.Context, appAddr string) (apptypes.Application, bool) { - switch appAddr { - case TestApp1Address: - return TestApp1, true - case TestApp2Address: - return TestApp2, true - default: - return apptypes.Application{}, false - } - } - - mockAppKeeper := mocks.NewMockApplicationKeeper(ctrl) - mockAppKeeper.EXPECT().GetApplication(gomock.Any(), gomock.Any()).AnyTimes().DoAndReturn(getAppFn) - mockAppKeeper.EXPECT().GetApplication(gomock.Any(), TestApp1Address).AnyTimes().Return(TestApp1, true) - - return mockAppKeeper -} - -func defaultSupplierKeeperMock(t testing.TB) types.SupplierKeeper { - t.Helper() - ctrl := gomock.NewController(t) - - allSuppliers := []sharedtypes.Supplier{TestSupplier} - - mockSupplierKeeper := mocks.NewMockSupplierKeeper(ctrl) - mockSupplierKeeper.EXPECT().GetAllSupplier(gomock.Any()).AnyTimes().Return(allSuppliers) - - return mockSupplierKeeper -} - -// TODO_TECHDEBT: Figure out how to vary the supplierKeep on a per test basis with exposing `SupplierKeeper publically` - -// type option[V any] func(k *keeper.Keeper) - -// WithPublisher returns an option function which sets the given publishCh of the -// resulting observable when passed to NewObservable(). -// func WithSupplierKeeperMock(supplierKeeper types.SupplierKeeper) option[any] { -// return func(k *keeper.Keeper) { -// k.supplierKeeper = supplierKeeper -// } -// } diff --git a/testutil/keeper/supplier.go b/testutil/keeper/supplier.go deleted file mode 100644 index 8bd600c27..000000000 --- a/testutil/keeper/supplier.go +++ /dev/null @@ -1,97 +0,0 @@ -package keeper - -import ( - "testing" - - tmdb "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/supplier" - "github.com/pokt-network/poktroll/testutil/supplier/mocks" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func SupplierKeeper(t testing.TB, sessionByAppAddr supplier.SessionsByAppAddress) (*keeper.Keeper, sdk.Context) { - t.Helper() - - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - - db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) - require.NoError(t, stateStore.LoadLatestVersion()) - - registry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(registry) - - ctrl := gomock.NewController(t) - mockBankKeeper := mocks.NewMockBankKeeper(ctrl) - mockBankKeeper.EXPECT().DelegateCoinsFromAccountToModule(gomock.Any(), gomock.Any(), types.ModuleName, gomock.Any()).AnyTimes() - mockBankKeeper.EXPECT().UndelegateCoinsFromModuleToAccount(gomock.Any(), types.ModuleName, gomock.Any(), gomock.Any()).AnyTimes() - - mockSessionKeeper := mocks.NewMockSessionKeeper(ctrl) - mockSessionKeeper.EXPECT(). - GetSession(gomock.AssignableToTypeOf(sdk.Context{}), gomock.Any()). - DoAndReturn( - func( - ctx sdk.Context, - req *sessiontypes.QueryGetSessionRequest, - ) (*sessiontypes.QueryGetSessionResponse, error) { - session, ok := sessionByAppAddr[req.GetApplicationAddress()] - require.Truef(t, ok, "application address not provided during mock construction: %q", req.ApplicationAddress) - - return &sessiontypes.QueryGetSessionResponse{ - Session: &sessiontypes.Session{ - Header: &sessiontypes.SessionHeader{ - ApplicationAddress: session.GetApplication().GetAddress(), - Service: req.GetService(), - SessionStartBlockHeight: 1, - SessionId: session.GetSessionId(), - SessionEndBlockHeight: 5, - }, - SessionId: session.GetSessionId(), - SessionNumber: 1, - NumBlocksPerSession: session.GetNumBlocksPerSession(), - Application: session.GetApplication(), - Suppliers: session.GetSuppliers(), - }, - }, nil - }, - ).AnyTimes() - - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "SupplierParams", - ) - k := keeper.NewKeeper( - cdc, - storeKey, - memStoreKey, - paramsSubspace, - - mockBankKeeper, - ) - k.SupplySessionKeeper(mockSessionKeeper) - - ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) - - // Initialize params - k.SetParams(ctx, types.DefaultParams()) - - return k, ctx -} diff --git a/testutil/keeper/tokenomics.go b/testutil/keeper/tokenomics.go deleted file mode 100644 index 4eb1befcb..000000000 --- a/testutil/keeper/tokenomics.go +++ /dev/null @@ -1,80 +0,0 @@ -package keeper - -import ( - "testing" - - tmdb "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - mocks "github.com/pokt-network/poktroll/testutil/tokenomics/mocks" - "github.com/pokt-network/poktroll/x/tokenomics/keeper" - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -func TokenomicsKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - - db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) - require.NoError(t, stateStore.LoadLatestVersion()) - - registry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(registry) - - authority := authtypes.NewModuleAddress("gov").String() - - ctrl := gomock.NewController(t) - mockBankKeeper := mocks.NewMockBankKeeper(ctrl) - mockBankKeeper.EXPECT(). - MintCoins(gomock.Any(), gomock.Any(), gomock.Any()). - AnyTimes() - mockBankKeeper.EXPECT(). - BurnCoins(gomock.Any(), gomock.Any(), gomock.Any()). - AnyTimes() - mockBankKeeper.EXPECT(). - SendCoinsFromModuleToAccount(gomock.Any(), gomock.Any(), types.ModuleName, gomock.Any()). - AnyTimes() - mockBankKeeper.EXPECT(). - SendCoinsFromModuleToModule(gomock.Any(), types.ModuleName, gomock.Any(), gomock.Any()). - AnyTimes() - mockBankKeeper.EXPECT(). - SendCoinsFromAccountToModule(gomock.Any(), types.ModuleName, gomock.Any(), gomock.Any()). - AnyTimes() - - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "TokenomicsParams", - ) - k := keeper.NewKeeper( - cdc, - storeKey, - memStoreKey, - paramsSubspace, - - mockBankKeeper, - - authority, - ) - - ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) - - // Initialize params - k.SetParams(ctx, types.DefaultParams()) - - return k, ctx -} diff --git a/testutil/mockclient/mocks.go b/testutil/mockclient/mocks.go deleted file mode 100644 index d89152942..000000000 --- a/testutil/mockclient/mocks.go +++ /dev/null @@ -1,11 +0,0 @@ -package mockclient - -// This file is in place to declare the package for dynamically generated structs. -// -// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests -// -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree -// to be valid before mock implementations have been generated. diff --git a/testutil/mockcrypto/mock.go b/testutil/mockcrypto/mock.go deleted file mode 100644 index 277adca25..000000000 --- a/testutil/mockcrypto/mock.go +++ /dev/null @@ -1,11 +0,0 @@ -package mockcrypto - -// This file is in place to declare the package for dynamically generated structs. -// -// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests -// -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree -// to be valid before mock implementations have been generated. diff --git a/testutil/mockrelayer/mocks.go b/testutil/mockrelayer/mocks.go deleted file mode 100644 index 0abe65d56..000000000 --- a/testutil/mockrelayer/mocks.go +++ /dev/null @@ -1,11 +0,0 @@ -package mockrelayer - -// This file is in place to declare the package for dynamically generated structs. -// -// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests -// -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree -// to be valid before mock implementations have been generated. diff --git a/testutil/network/config.go b/testutil/network/config.go deleted file mode 100644 index f43aaac7e..000000000 --- a/testutil/network/config.go +++ /dev/null @@ -1,90 +0,0 @@ -package network - -import ( - "fmt" - "testing" - "time" - - db "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/rand" - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/crypto/hd" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - sdkservertypes "github.com/cosmos/cosmos-sdk/server/types" - pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types" - "github.com/cosmos/cosmos-sdk/testutil/network" - "github.com/cosmos/cosmos-sdk/testutil/sims" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" - - "github.com/pokt-network/poktroll/app" -) - -// GetNumApplications returns the number of applications to be created in the -// network at genesis. NOTE: This method is intended to compute the correct value, -// regardless of how the configuration is configured (i.e. the expectations/usage -// of it in any given in-memory network implementation). -func (cfg *InMemoryNetworkConfig) GetNumApplications(t *testing.T) int { - t.Helper() - - if cfg.NumApplications > 0 { - return cfg.NumApplications - } - - return cfg.AppSupplierPairingRatio * cfg.NumSuppliers -} - -// GetNumKeyringAccounts returns the number of keyring accounts needed for the given configuration. -func (cfg *InMemoryNetworkConfig) GetNumKeyringAccounts(t *testing.T) int { - t.Helper() - - return cfg.NumGateways + cfg.NumSuppliers + cfg.GetNumApplications(t) -} - -// DefaultConfig will initialize config for the network with custom application, -// genesis and single validator. -// All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig. -// -// TODO_UPNEXT(@bryanchriswhite #285): Remove _ prefix after DebugConfig is removed from network.go. -func _DefaultConfig() network.Config { - var ( - encoding = app.MakeEncodingConfig() - chainID = "chain-" + rand.NewRand().Str(6) - ) - return network.Config{ - Codec: encoding.Marshaler, - TxConfig: encoding.TxConfig, - LegacyAmino: encoding.Amino, - InterfaceRegistry: encoding.InterfaceRegistry, - AccountRetriever: types.AccountRetriever{}, - AppConstructor: func(val network.ValidatorI) sdkservertypes.Application { - return app.New( - val.GetCtx().Logger, - db.NewMemDB(), - nil, - true, - map[int64]bool{}, - val.GetCtx().Config.RootDir, - 0, - encoding, - sims.EmptyAppOptions{}, - baseapp.SetPruning(pruningtypes.NewPruningOptionsFromString(val.GetAppConfig().Pruning)), - baseapp.SetMinGasPrices(val.GetAppConfig().MinGasPrices), - baseapp.SetChainID(chainID), - ) - }, - GenesisState: app.ModuleBasics.DefaultGenesis(encoding.Marshaler), - TimeoutCommit: 2 * time.Second, - ChainID: chainID, - NumValidators: 1, - BondDenom: sdk.DefaultBondDenom, - MinGasPrices: fmt.Sprintf("0.000006%s", sdk.DefaultBondDenom), - AccountTokens: sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction), - StakingTokens: sdk.TokensFromConsensusPower(500, sdk.DefaultPowerReduction), - BondedTokens: sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction), - PruningStrategy: pruningtypes.PruningOptionNothing, - CleanupDir: true, - SigningAlgo: string(hd.Secp256k1Type), - KeyringOptions: []keyring.Option{}, - } -} diff --git a/testutil/network/interface.go b/testutil/network/interface.go deleted file mode 100644 index fa2c90eef..000000000 --- a/testutil/network/interface.go +++ /dev/null @@ -1,34 +0,0 @@ -package network - -import ( - "context" - "testing" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/testutil/network" -) - -// InMemoryNetwork encapsulates the cosmos-sdk testutil network instance and the -// responsibility of initializing it, along with (optional) additional/ setup, in -// #Start(). It also provides access to additional cosmos-sdk testutil network -// internals via corresponding methods. -type InMemoryNetwork interface { - // GetConfig returns the InMemoryNetworkConfig which associated with a given - // InMemoryNetwork instance. - GetConfig(*testing.T) *InMemoryNetworkConfig - - // GetClientCtx returns a cosmos-sdk client.Context associated with the - // underlying cosmos-sdk testutil network instance. - GetClientCtx(*testing.T) client.Context - - // GetCosmosNetworkConfig returns the underlying cosmos-sdk testutil network config. - GetCosmosNetworkConfig(*testing.T) *network.Config - - // GetNetwork returns the underlying cosmos-sdk testutil network instance. - GetNetwork(*testing.T) *network.Network - - // Start initializes the in-memory network, performing any setup - // (e.g. preparing on-chain state) for the test scenarios which - // will be exercised afterward. - Start(context.Context, *testing.T) -} diff --git a/testutil/network/network.go b/testutil/network/network.go index 4bbed2925..fd9a8e0e7 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -4,33 +4,17 @@ import ( "encoding/json" "fmt" "testing" - "time" - "cosmossdk.io/math" sdkmath "cosmossdk.io/math" - tmdb "github.com/cometbft/cometbft-db" - tmrand "github.com/cometbft/cometbft/libs/rand" - "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/crypto/hd" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - servertypes "github.com/cosmos/cosmos-sdk/server/types" - pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types" + addresscodec "github.com/cosmos/cosmos-sdk/codec/address" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/cosmos/cosmos-sdk/testutil/network" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/stretchr/testify/require" "github.com/pokt-network/poktroll/app" - "github.com/pokt-network/poktroll/testutil/sample" - appcli "github.com/pokt-network/poktroll/x/application/client/cli" - apptypes "github.com/pokt-network/poktroll/x/application/types" - gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" - tokenomicstypes "github.com/pokt-network/poktroll/x/tokenomics/types" + "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" ) type ( @@ -38,9 +22,14 @@ type ( Config = network.Config ) +func init() { + cmd.InitSDKConfig() +} + // New creates instance with fully configured cosmos network. // Accepts optional config, that will be used in place of the DefaultConfig() if provided. func New(t *testing.T, configs ...Config) *Network { + t.Helper() if len(configs) > 1 { panic("at most one config should be provided") } @@ -61,216 +50,24 @@ func New(t *testing.T, configs ...Config) *Network { // DefaultConfig will initialize config for the network with custom application, // genesis and single validator. All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig func DefaultConfig() network.Config { - var ( - encoding = app.MakeEncodingConfig() - chainID = "chain-" + tmrand.NewRand().Str(6) - ) - return network.Config{ - Codec: encoding.Marshaler, - TxConfig: encoding.TxConfig, - LegacyAmino: encoding.Amino, - InterfaceRegistry: encoding.InterfaceRegistry, - AccountRetriever: authtypes.AccountRetriever{}, - AppConstructor: func(val network.ValidatorI) servertypes.Application { - return app.New( - val.GetCtx().Logger, - tmdb.NewMemDB(), - nil, - true, - map[int64]bool{}, - val.GetCtx().Config.RootDir, - 0, - encoding, - simtestutil.EmptyAppOptions{}, - baseapp.SetPruning(pruningtypes.NewPruningOptionsFromString(val.GetAppConfig().Pruning)), - baseapp.SetMinGasPrices(val.GetAppConfig().MinGasPrices), - baseapp.SetChainID(chainID), - ) - }, - GenesisState: app.ModuleBasics.DefaultGenesis(encoding.Marshaler), - TimeoutCommit: 2 * time.Second, - ChainID: chainID, - NumValidators: 1, - BondDenom: sdk.DefaultBondDenom, - MinGasPrices: fmt.Sprintf("0.000006%s", sdk.DefaultBondDenom), - AccountTokens: sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction), - StakingTokens: sdk.TokensFromConsensusPower(500, sdk.DefaultPowerReduction), - BondedTokens: sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction), - PruningStrategy: pruningtypes.PruningOptionNothing, - CleanupDir: true, - SigningAlgo: string(hd.Secp256k1Type), - KeyringOptions: []keyring.Option{}, - } -} - -// TODO_CLEANUP: Refactor the genesis state helpers below to consolidate usage -// and reduce the code footprint. - -// DefaultApplicationModuleGenesisState generates a GenesisState object with a given number of applications. -// It returns the populated GenesisState object. -func DefaultApplicationModuleGenesisState(t *testing.T, n int) *apptypes.GenesisState { - t.Helper() - state := apptypes.DefaultGenesis() - for i := 0; i < n; i++ { - stake := sdk.NewCoin("upokt", sdk.NewInt(int64(i+1))) - application := apptypes.Application{ - Address: sample.AccAddress(), - Stake: &stake, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: fmt.Sprintf("svc%d", i)}, - }, - { - Service: &sharedtypes.Service{Id: fmt.Sprintf("svc%d%d", i, i)}, - }, - }, - } - // TODO_CONSIDERATION: Evaluate whether we need `nullify.Fill` or if we should enforce `(gogoproto.nullable) = false` everywhere - // nullify.Fill(&application) - state.ApplicationList = append(state.ApplicationList, application) - } - return state -} - -// ApplicationModuleGenesisStateWithAccount generates a GenesisState object with -// a single application for each of the given addresses. -func ApplicationModuleGenesisStateWithAddresses(t *testing.T, addresses []string) *apptypes.GenesisState { - t.Helper() - state := apptypes.DefaultGenesis() - for _, addr := range addresses { - application := apptypes.Application{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(10000)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - state.ApplicationList = append(state.ApplicationList, application) + cfg, err := network.DefaultConfigWithAppConfig(app.AppConfig()) + if err != nil { + panic(err) } - - return state -} - -// DefaultSupplierModuleGenesisState generates a GenesisState object with a given number of suppliers. -// It returns the populated GenesisState object. -func DefaultSupplierModuleGenesisState(t *testing.T, n int) *suppliertypes.GenesisState { - t.Helper() - state := suppliertypes.DefaultGenesis() - for i := 0; i < n; i++ { - stake := sdk.NewCoin("upokt", sdk.NewInt(int64(i))) - supplier := sharedtypes.Supplier{ - Address: sample.AccAddress(), - Stake: &stake, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{Id: fmt.Sprintf("svc%d", i)}, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: fmt.Sprintf("http://localhost:%d", i), - RpcType: sharedtypes.RPCType_JSON_RPC, - }, - }, - }, - }, - } - // TODO_CONSIDERATION: Evaluate whether we need `nullify.Fill` or if we should enforce `(gogoproto.nullable) = false` everywhere - // nullify.Fill(&supplier) - state.SupplierList = append(state.SupplierList, supplier) + ports, err := freePorts(3) + if err != nil { + panic(err) } - return state -} - -// SupplierModuleGenesisStateWithAddresses generates a GenesisState object with -// a single supplier for each of the given addresses. -func SupplierModuleGenesisStateWithAddresses(t *testing.T, addresses []string) *suppliertypes.GenesisState { - t.Helper() - state := suppliertypes.DefaultGenesis() - for _, addr := range addresses { - supplier := sharedtypes.Supplier{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(10000)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:1", - RpcType: sharedtypes.RPCType_JSON_RPC, - }, - }, - }, - }, - } - state.SupplierList = append(state.SupplierList, supplier) + if cfg.APIAddress == "" { + cfg.APIAddress = fmt.Sprintf("tcp://0.0.0.0:%s", ports[0]) } - - return state -} - -func DefaultTokenomicsModuleGenesisState(t *testing.T) *tokenomicstypes.GenesisState { - t.Helper() - state := tokenomicstypes.DefaultGenesis() - return state -} - -// DefaultGatewayModuleGenesisState generates a GenesisState object with a given -// number of gateways. It returns the populated GenesisState object. -func DefaultGatewayModuleGenesisState(t *testing.T, n int) *gatewaytypes.GenesisState { - t.Helper() - state := gatewaytypes.DefaultGenesis() - for i := 0; i < n; i++ { - stake := sdk.NewCoin("upokt", sdk.NewInt(int64(i))) - gateway := gatewaytypes.Gateway{ - Address: sample.AccAddress(), - Stake: &stake, - } - // TODO_CONSIDERATION: Evaluate whether we need `nullify.Fill` or if we should enforce `(gogoproto.nullable) = false` everywhere - // nullify.Fill(&gateway) - state.GatewayList = append(state.GatewayList, gateway) + if cfg.RPCAddress == "" { + cfg.RPCAddress = fmt.Sprintf("tcp://0.0.0.0:%s", ports[1]) } - return state -} - -// GatewayModuleGenesisStateWithAddresses generates a GenesisState object with -// a gateway list full of gateways with the given addresses. -// It returns the populated GenesisState object. -func GatewayModuleGenesisStateWithAddresses(t *testing.T, addresses []string) *gatewaytypes.GenesisState { - t.Helper() - state := gatewaytypes.DefaultGenesis() - for _, addr := range addresses { - gateway := gatewaytypes.Gateway{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(10000)}, - } - state.GatewayList = append(state.GatewayList, gateway) + if cfg.GRPCAddress == "" { + cfg.GRPCAddress = fmt.Sprintf("0.0.0.0:%s", ports[2]) } - return state -} - -// TODO_CLEANUP: Consolidate all of the helpers below to use shared business -// logic and move into its own helpers file. - -// InitAccount initializes an Account by sending it some funds from the validator -// in the network to the address provided -func InitAccount(t *testing.T, net *Network, addr sdk.AccAddress) { - t.Helper() - val := net.Validators[0] - ctx := val.ClientCtx - args := []string{ - fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), - } - amount := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(200))) - responseRaw, err := clitestutil.MsgSendExec(ctx, val.Address, addr, amount, args...) - require.NoError(t, err) - var responseJSON map[string]interface{} - err = json.Unmarshal(responseRaw.Bytes(), &responseJSON) - require.NoError(t, err) - require.Equal(t, float64(0), responseJSON["code"], "code is not 0 in the response: %v", responseJSON) + return cfg } // InitAccountWithSequence initializes an Account by sending it some funds from @@ -296,7 +93,8 @@ func InitAccountWithSequence( fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), } amount := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(200))) - responseRaw, err := clitestutil.MsgSendExec(ctx, val.Address, addr, amount, args...) + addrCodec := addresscodec.NewBech32Codec(app.AccountAddressPrefix) + responseRaw, err := clitestutil.MsgSendExec(ctx, val.Address, addr, amount, addrCodec, args...) require.NoError(t, err) var responseJSON map[string]interface{} err = json.Unmarshal(responseRaw.Bytes(), &responseJSON) @@ -304,61 +102,22 @@ func InitAccountWithSequence( require.Equal(t, float64(0), responseJSON["code"], "code is not 0 in the response: %v", responseJSON) } -// DelegateAppToGateway delegates the provided application to the provided gateway -func DelegateAppToGateway( - t *testing.T, - net *Network, - appAddr string, - gatewayAddr string, -) { - t.Helper() - val := net.Validators[0] - ctx := val.ClientCtx - args := []string{ - gatewayAddr, - fmt.Sprintf("--%s=%s", flags.FlagFrom, appAddr), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), +// freePorts return the available ports based on the number of requested ports. +func freePorts(n int) ([]string, error) { + closeFns := make([]func() error, n) + ports := make([]string, n) + for i := 0; i < n; i++ { + _, port, closeFn, err := network.FreeTCPAddr() + if err != nil { + return nil, err + } + ports[i] = port + closeFns[i] = closeFn } - responseRaw, err := clitestutil.ExecTestCLICmd(ctx, appcli.CmdDelegateToGateway(), args) - require.NoError(t, err) - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(responseRaw.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) -} - -// UndelegateAppFromGateway undelegates the provided application from the provided gateway -func UndelegateAppFromGateway( - t *testing.T, - net *Network, - appAddr string, - gatewayAddr string, -) { - t.Helper() - val := net.Validators[0] - ctx := val.ClientCtx - args := []string{ - gatewayAddr, - fmt.Sprintf("--%s=%s", flags.FlagFrom, appAddr), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + for _, closeFn := range closeFns { + if err := closeFn(); err != nil { + return nil, err + } } - responseRaw, err := clitestutil.ExecTestCLICmd(ctx, appcli.CmdUndelegateFromGateway(), args) - require.NoError(t, err) - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(responseRaw.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) -} - -// TODO_TECHDEBT: Reuse this helper in all test helpers where appropriate. -func NewBondDenomCoins(t *testing.T, net *network.Network, numCoins int64) sdk.Coins { - t.Helper() - - return sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, math.NewInt(numCoins))) + return ports, nil } diff --git a/testutil/network/types.go b/testutil/network/types.go deleted file mode 100644 index 368f3c485..000000000 --- a/testutil/network/types.go +++ /dev/null @@ -1,66 +0,0 @@ -package network - -import ( - "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/testutil/network" -) - -// TestMerkleProofPath is intended to be used as a "path" in a merkle tree for -// which to generate a proof. -var TestMerkleProofPath = []byte("test_proof_merkle_path") - -// InMemoryNetworkConfig is a **SHARED** config struct for use by InMemoryNetwork -// implementations to configure themselves, provide the necessary parameters to set-up -// code, and initialize the underlying cosmos-sdk testutil network. -// -// Examples of set-up operations include but are not limited to: -// - Creating accounts in the local keyring. -// - Creating genesis state for (a) module(s). -// - Executing on-chain transactions (i.e. on-chain, non-genesis state). -// - Governance parameter configuration -// - Etc... -type InMemoryNetworkConfig struct { - // NumSessions is the number of sessions (with increasing start heights) for - // which the network should generate claims and proofs. - NumSessions int - - // NumRelaysPerSession is the number of nodes to be inserted into each claim's - // session tree prior to generating the corresponding proof. - NumRelaysPerSession int - - // NumSuppliers is the number of suppliers that should be created at genesis. - NumSuppliers int - - // NumGateways is the number of gateways that should be created at genesis. - NumGateways int - - // NumApplications is the number of applications that should be created at genesis. - // Usage is mutually exclusive with AppSupplierPairingRatio. This is enforced by - // InMemoryNetwork implementations. - // - // NOTE: Use #GetNumApplications() to compute the correct value, regardless of - // which field is used; in-memory network implementations SHOULD NOT modify config - // fields. #GetNumApplications() is intended to be the single source of truth. - NumApplications int - - // AppSupplierPairingRatio is the number of applications, per supplier, that - // share a serviceId (i.e. will be in the same session). - // Usage is mutually exclusive with NumApplications. This is enforced by - // InMemoryNetwork implementations. - // - // NOTE: Use #GetNumApplications() to compute the correct value, regardless of - // which field is used; in-memory network implementations SHOULD NOT modify config - // fields. #GetNumApplications() is intended to be the single source of truth. - AppSupplierPairingRatio int - - // CosmosCfg is the configuration for the underlying cosmos-sdk testutil network. - CosmosCfg *network.Config - - // Keyring is the keyring to be used by clients of the cosmos-sdk testutil network. - // It is intended to be populated with a sufficient number of accounts for the - // InMemoryNetwork implementation's use cases. BaseInMemoryNetwork - // implements a #GetNumKeyringAccounts() for this purpose. - // This keyring is associated with the cosmos client context returned from - // BaseInMemoryNetwork#GetClientCtx(). - Keyring keyring.Keyring -} diff --git a/testutil/sample/sample.go b/testutil/sample/sample.go index 152aa43d0..98f2153ed 100644 --- a/testutil/sample/sample.go +++ b/testutil/sample/sample.go @@ -2,27 +2,12 @@ package sample import ( "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" ) -// AccAddressAndPubKey returns a sample account address and public key -func AccAddressAndPubKey() (string, cryptotypes.PubKey) { - pk := secp256k1.GenPrivKey().PubKey() - addr := pk.Address() - return sdk.AccAddress(addr).String(), pk -} - // AccAddress returns a sample account address func AccAddress() string { - addr, _ := AccAddressAndPubKey() - return addr -} - -// AccAddressAndPubKeyEdd2519 returns a sample account address and public key -func AccAddressAndPubKeyEdd2519() (string, cryptotypes.PubKey) { pk := ed25519.GenPrivKey().PubKey() addr := pk.Address() - return sdk.AccAddress(addr).String(), pk + return sdk.AccAddress(addr).String() } diff --git a/testutil/session/mocks/mocks.go b/testutil/session/mocks/mocks.go deleted file mode 100644 index 423f63d3e..000000000 --- a/testutil/session/mocks/mocks.go +++ /dev/null @@ -1,10 +0,0 @@ -package mocks - -// This file is in place to declare the package for dynamically generated structs. -// -// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests -// -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which requires `.go` files to compile. diff --git a/testutil/supplier/fixtures.go b/testutil/supplier/fixtures.go deleted file mode 100644 index b13f1d74d..000000000 --- a/testutil/supplier/fixtures.go +++ /dev/null @@ -1,113 +0,0 @@ -package supplier - -import ( - "testing" - - sdktypes "github.com/cosmos/cosmos-sdk/types" - - apptypes "github.com/pokt-network/poktroll/x/application/types" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -const ( - testSessionNumber = 1 - testBlockHeight = 1 - testBlocksPerSession = 4 - testSessionId = "mock_session_id" -) - -// SessionsByAppAddress is a map of session fixtures where the key is the -// application address and the value is the session fixture. -type SessionsByAppAddress map[string]sessiontypes.Session - -// AppSupplierPair is a pairing of an application and a supplier address. -type AppSupplierPair struct { - AppAddr string - SupplierAddr string -} - -// NewSessionFixturesWithPairings creates a map of session fixtures where the key -// is the application address and the value is the session fixture. App/supplier -// addresses are expected to be provided in alternating order (as pairs). The same -// app and/or supplier may be given more than once but only distinct pairs will -// be added to the session fixtures map. -func NewSessionFixturesWithPairings( - t *testing.T, - service *sharedtypes.Service, - appSupplierPairs ...AppSupplierPair, -) SessionsByAppAddress { - t.Helper() - - // Initialize the session fixtures map. - sessionFixturesByAppAddr := make(SessionsByAppAddress) - - // Iterate over the app and supplier address pairs (two indices at a time), - // and create a session fixture for each app address. - for _, appSupplierPair := range appSupplierPairs { - application := newApplication(t, appSupplierPair.AppAddr, service) - supplier := newSupplier(t, appSupplierPair.SupplierAddr, service) - - if session, ok := sessionFixturesByAppAddr[appSupplierPair.AppAddr]; ok { - session.Suppliers = append(session.Suppliers, supplier) - continue - } - - sessionFixturesByAppAddr[appSupplierPair.AppAddr] = sessiontypes.Session{ - Header: &sessiontypes.SessionHeader{ - ApplicationAddress: appSupplierPair.AppAddr, - Service: service, - SessionStartBlockHeight: testBlockHeight, - SessionId: testSessionId, - SessionEndBlockHeight: testBlockHeight + testBlocksPerSession, - }, - SessionId: testSessionId, - SessionNumber: testSessionNumber, - NumBlocksPerSession: testBlocksPerSession, - Application: application, - Suppliers: []*sharedtypes.Supplier{ - newSupplier(t, appSupplierPair.SupplierAddr, service), - }, - } - } - - return sessionFixturesByAppAddr -} - -// newSuppliers configures a supplier for the services provided and nil endpoints. -func newSupplier(t *testing.T, addr string, services ...*sharedtypes.Service) *sharedtypes.Supplier { - t.Helper() - - serviceConfigs := make([]*sharedtypes.SupplierServiceConfig, len(services)) - for i, service := range services { - serviceConfigs[i] = &sharedtypes.SupplierServiceConfig{ - Service: service, - Endpoints: nil, - } - } - - return &sharedtypes.Supplier{ - Address: addr, - Stake: &sdktypes.Coin{}, - Services: serviceConfigs, - } -} - -// newApplication configures an application for the services provided. -func newApplication(t *testing.T, addr string, services ...*sharedtypes.Service) *apptypes.Application { - t.Helper() - - serviceConfigs := make([]*sharedtypes.ApplicationServiceConfig, len(services)) - for i, service := range services { - serviceConfigs[i] = &sharedtypes.ApplicationServiceConfig{ - Service: service, - } - } - - return &apptypes.Application{ - Address: addr, - Stake: &sdktypes.Coin{}, - ServiceConfigs: serviceConfigs, - DelegateeGatewayAddresses: nil, - } -} diff --git a/testutil/supplier/mocks/mocks.go b/testutil/supplier/mocks/mocks.go deleted file mode 100644 index 595954e65..000000000 --- a/testutil/supplier/mocks/mocks.go +++ /dev/null @@ -1,11 +0,0 @@ -package mocks - -// This file is in place to declare the package for dynamically generated structs. -// -// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests -// -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree -// to be valid before mock implementations have been generated. diff --git a/testutil/testchannel/drain.go b/testutil/testchannel/drain.go deleted file mode 100644 index 4b7ff00a3..000000000 --- a/testutil/testchannel/drain.go +++ /dev/null @@ -1,26 +0,0 @@ -package testchannel - -import ( - "time" - - "github.com/pokt-network/poktroll/pkg/observable" -) - -// DrainChannel attempts to receive from the given channel, blocking, until it is -// empty. It returns an error if the channel is not closed by the time it's empty. -// TODO_CONSIDERATION: this function could easily take a timeout parameter and add -// a case which returns an error if the timeout is exceeded. This would prevent -// the case where the channel never stops receiving from looping indefinitely. -func DrainChannel[V any](ch <-chan V) error { - for { - select { - case _, ok := <-ch: - if ok { - continue - } - return nil - case <-time.After(time.Millisecond): - return observable.ErrObserverClosed - } - } -} diff --git a/testutil/testclient/keyring.go b/testutil/testclient/keyring.go deleted file mode 100644 index 59d54f908..000000000 --- a/testutil/testclient/keyring.go +++ /dev/null @@ -1,31 +0,0 @@ -package testclient - -import ( - "testing" - - cosmoshd "github.com/cosmos/cosmos-sdk/crypto/hd" - cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/stretchr/testify/require" -) - -// NewKey creates a new Secp256k1 key and mnemonic for the given name within -// the provided keyring. -func NewKey( - t *testing.T, - name string, - keyring cosmoskeyring.Keyring, -) (key *cosmoskeyring.Record, mnemonic string) { - t.Helper() - - key, mnemonic, err := keyring.NewMnemonic( - name, - cosmoskeyring.English, - "m/44'/118'/0'/0/0", - cosmoskeyring.DefaultBIP39Passphrase, - cosmoshd.Secp256k1, - ) - require.NoError(t, err) - require.NotNil(t, key) - - return key, mnemonic -} diff --git a/testutil/testclient/localnet.go b/testutil/testclient/localnet.go deleted file mode 100644 index 3e30318ed..000000000 --- a/testutil/testclient/localnet.go +++ /dev/null @@ -1,88 +0,0 @@ -package testclient - -import ( - "fmt" - "os" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/regen-network/gocuke" - "github.com/spf13/pflag" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/app" - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" -) - -var ( - // CometLocalTCPURL provides a default URL pointing to the localnet TCP endpoint. - CometLocalTCPURL = "tcp://localhost:36657" - - // CometLocalWebsocketURL provides a default URL pointing to the localnet websocket endpoint. - CometLocalWebsocketURL = "ws://localhost:36657/websocket" - - // EncodingConfig encapsulates encoding configurations for the Pocket application. - EncodingConfig = app.MakeEncodingConfig() -) - -// init initializes the SDK configuration upon package import. -func init() { - cmd.InitSDKConfig() - - // If SEQUENCER_RPC_ENDPOINT environment variable is set, use it to override the default localnet endpoint. - if endpoint := os.Getenv("SEQUENCER_RPC_ENDPOINT"); endpoint != "" { - CometLocalTCPURL = fmt.Sprintf("tcp://%s", endpoint) - CometLocalWebsocketURL = fmt.Sprintf("ws://%s/websocket", endpoint) - } -} - -// NewLocalnetClientCtx creates a client context specifically tailored for localnet -// environments. The returned client context is initialized with encoding -// configurations, a default home directory, a default account retriever, and -// command flags. -// -// Parameters: -// - t: The testing.T instance used for the current test. -// - flagSet: The set of flags to be read for initializing the client context. -// -// Returns: -// - A pointer to a populated client.Context instance suitable for localnet usage. -func NewLocalnetClientCtx(t gocuke.TestingT, flagSet *pflag.FlagSet) *client.Context { - t.Helper() - - homedir := app.DefaultNodeHome - clientCtx := client.Context{}. - WithCodec(EncodingConfig.Marshaler). - WithTxConfig(EncodingConfig.TxConfig). - WithHomeDir(homedir). - WithAccountRetriever(authtypes.AccountRetriever{}). - WithInterfaceRegistry(EncodingConfig.InterfaceRegistry) - - clientCtx, err := client.ReadPersistentCommandFlags(clientCtx, flagSet) - require.NoError(t, err) - return &clientCtx -} - -// NewLocalnetFlagSet creates a set of predefined flags suitable for a localnet -// testing environment. -// -// Parameters: -// - t: The testing.T instance used for the current test. -// -// Returns: -// - A flag set populated with flags tailored for localnet environments. -func NewLocalnetFlagSet(t gocuke.TestingT) *pflag.FlagSet { - t.Helper() - - mockFlagSet := pflag.NewFlagSet("test", pflag.ContinueOnError) - // TODO_IMPROVE: It would be nice if the value could be set correctly based - // on whether the test using it is running in tilt or not. - mockFlagSet.String(flags.FlagNode, CometLocalTCPURL, "use localnet poktrolld node") - mockFlagSet.String(flags.FlagHome, "", "use localnet poktrolld node") - mockFlagSet.String(flags.FlagKeyringBackend, "test", "use test keyring") - err := mockFlagSet.Parse([]string{}) - require.NoError(t, err) - - return mockFlagSet -} diff --git a/testutil/testclient/testblock/client.go b/testutil/testclient/testblock/client.go deleted file mode 100644 index 91c1641b5..000000000 --- a/testutil/testclient/testblock/client.go +++ /dev/null @@ -1,123 +0,0 @@ -package testblock - -import ( - "context" - "testing" - - "cosmossdk.io/depinject" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/block" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/testutil/mockclient" - "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" -) - -// NewLocalnetClient creates and returns a new BlockClient that's configured for -// use with the localnet sequencer. -func NewLocalnetClient(ctx context.Context, t *testing.T) client.BlockClient { - t.Helper() - - queryClient := testeventsquery.NewLocalnetClient(t) - require.NotNil(t, queryClient) - - deps := depinject.Supply(queryClient) - bClient, err := block.NewBlockClient(ctx, deps) - require.NoError(t, err) - - return bClient -} - -// NewAnyTimesCommittedBlocksSequenceBlockClient creates a new mock BlockClient. -// This mock BlockClient will expect any number of calls to CommittedBlocksSequence, -// and when that call is made, it returns the given EventsObservable[Block]. -func NewAnyTimesCommittedBlocksSequenceBlockClient( - t *testing.T, - blocksObs observable.Observable[client.Block], -) *mockclient.MockBlockClient { - t.Helper() - - // Create a mock for the block client which expects the LastNBlocks method to be called any number of times. - blockClientMock := NewAnyTimeLastNBlocksBlockClient(t, nil, 0) - - // Set up the mock expectation for the CommittedBlocksSequence method. When - // the method is called, it returns a new replay observable that publishes - // blocks sent on the given blocksPublishCh. - blockClientMock.EXPECT(). - CommittedBlocksSequence(gomock.Any()). - Return(blocksObs). - AnyTimes() - - return blockClientMock -} - -// NewOneTimeCommittedBlocksSequenceBlockClient creates a new mock BlockClient. -// This mock BlockClient will expect a call to CommittedBlocksSequence, and -// when that call is made, it returns a new BlocksObservable that is notified of -// blocks sent on the given blocksPublishCh. -// blocksPublishCh is the channel the caller can use to publish blocks the observable. -func NewOneTimeCommittedBlocksSequenceBlockClient( - t *testing.T, - blocksPublishCh chan client.Block, -) *mockclient.MockBlockClient { - t.Helper() - - // Create a mock for the block client which expects the LastNBlocks method to be called any number of times. - blockClientMock := NewAnyTimeLastNBlocksBlockClient(t, nil, 0) - - // Set up the mock expectation for the CommittedBlocksSequence method. When - // the method is called, it returns a new replay observable that publishes - // blocks sent on the given blocksPublishCh. - blockClientMock.EXPECT().CommittedBlocksSequence( - gomock.AssignableToTypeOf(context.Background()), - ).DoAndReturn(func(ctx context.Context) client.BlockReplayObservable { - // Create a new replay observable with a replay buffer size of 1. Blocks - // are published to this observable via the provided blocksPublishCh. - withPublisherOpt := channel.WithPublisher(blocksPublishCh) - obs, _ := channel.NewReplayObservable[client.Block]( - ctx, 1, withPublisherOpt, - ) - return obs - }) - - return blockClientMock -} - -// NewAnyTimeLastNBlocksBlockClient creates a mock BlockClient that expects -// calls to the LastNBlocks method any number of times. When the LastNBlocks -// method is called, it returns a mock Block with the provided hash and height. -func NewAnyTimeLastNBlocksBlockClient( - t *testing.T, - hash []byte, - height int64, -) *mockclient.MockBlockClient { - t.Helper() - ctrl := gomock.NewController(t) - - // Create a mock block that returns the provided hash and height. - blockMock := NewAnyTimesBlock(t, hash, height) - // Create a mock block client that expects calls to LastNBlocks method and - // returns the mock block. - blockClientMock := mockclient.NewMockBlockClient(ctrl) - blockClientMock.EXPECT().LastNBlocks(gomock.Any(), gomock.Any()).Return([]client.Block{blockMock}).AnyTimes() - - return blockClientMock -} - -// NewAnyTimesBlock creates a mock Block that expects calls to Height and Hash -// methods any number of times. When the methods are called, they return the -// provided height and hash respectively. -func NewAnyTimesBlock(t *testing.T, hash []byte, height int64) *mockclient.MockBlock { - t.Helper() - ctrl := gomock.NewController(t) - - // Create a mock block that returns the provided hash and height AnyTimes. - blockMock := mockclient.NewMockBlock(ctrl) - blockMock.EXPECT().Height().Return(height).AnyTimes() - blockMock.EXPECT().Hash().Return(hash).AnyTimes() - - return blockMock -} diff --git a/testutil/testclient/testblock/godoc.go b/testutil/testclient/testblock/godoc.go deleted file mode 100644 index 866bb4f70..000000000 --- a/testutil/testclient/testblock/godoc.go +++ /dev/null @@ -1,4 +0,0 @@ -// Package testblock provides helper functions for constructing real (e.g. localnet) -// and mock BlockClient objects with pre-configured and/or parameterized call -// arguments, return value(s), and/or expectations thereof. Intended for use in tests. -package testblock diff --git a/testutil/testclient/testdelegation/client.go b/testutil/testclient/testdelegation/client.go deleted file mode 100644 index 4d490e376..000000000 --- a/testutil/testclient/testdelegation/client.go +++ /dev/null @@ -1,154 +0,0 @@ -package testdelegation - -import ( - "context" - "fmt" - "testing" - - "cosmossdk.io/depinject" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/delegation" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/testutil/mockclient" - "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" -) - -// NewLocalnetClient creates and returns a new DelegationClient that's configured for -// use with the localnet sequencer. -func NewLocalnetClient(ctx context.Context, t *testing.T) client.DelegationClient { - t.Helper() - - queryClient := testeventsquery.NewLocalnetClient(t) - require.NotNil(t, queryClient) - - deps := depinject.Supply(queryClient) - dClient, err := delegation.NewDelegationClient(ctx, deps) - require.NoError(t, err) - - return dClient -} - -// NewAnyTimesRedelegationsSequence creates a new mock DelegationClient. -// This mock DelegationClient will expect any number of calls to RedelegationsSequence, -// and when that call is made, it returns the given EventsObservable[Redelegation]. -func NewAnyTimesRedelegationsSequence( - ctx context.Context, - t *testing.T, - appAddress string, - redelegationObs observable.Observable[client.Redelegation], -) *mockclient.MockDelegationClient { - t.Helper() - - // Create a mock for the delegation client which expects the - // LastNRedelegations method to be called any number of times. - delegationClientMock := NewAnyTimeLastNRedelegationsClient(t, appAddress) - - // Set up the mock expectation for the RedelegationsSequence method. When - // the method is called, it returns a new replay observable that publishes - // redelegation events sent on the given redelegationObs. - delegationClientMock.EXPECT(). - RedelegationsSequence(ctx). - Return(redelegationObs). - AnyTimes() - - return delegationClientMock -} - -// NewOneTimeRedelegationsSequenceDelegationClient creates a new mock -// DelegationClient. This mock DelegationClient will expect a call to -// RedelegationsSequence, and when that call is made, it returns a new -// RedelegationReplayObservable that publishes Redelegation events sent on -// the given redelegationPublishCh. -// redelegationPublishCh is the channel the caller can use to publish -// Redelegation events to the observable. -func NewOneTimeRedelegationsSequenceDelegationClient( - ctx context.Context, - t *testing.T, - redelegationPublishCh chan client.Redelegation, -) *mockclient.MockDelegationClient { - t.Helper() - - // Create a mock for the delegation client which expects the - // LastNRedelegations method to be called any number of times. - delegationClientMock := NewAnyTimeLastNRedelegationsClient(t, "") - - // Set up the mock expectation for the RedelegationsSequence method. When - // the method is called, it returns a new replay observable that publishes - // delegation changes sent on the given redelegationPublishCh. - delegationClientMock.EXPECT().RedelegationsSequence(ctx). - DoAndReturn(func(ctx context.Context) client.RedelegationReplayObservable { - // Create a new replay observable with a replay buffer size of 1. - // Redelegation events are published to this observable via the - // provided redelegationPublishCh. - withPublisherOpt := channel.WithPublisher(redelegationPublishCh) - obs, _ := channel.NewReplayObservable[client.Redelegation]( - ctx, 1, withPublisherOpt, - ) - return obs - }).Times(1) - - delegationClientMock.EXPECT().Close().AnyTimes() - - return delegationClientMock -} - -// NewAnyTimeLastNRedelegationsClient creates a mock DelegationClient that -// expects calls to the LastNRedelegations method any number of times. When -// the LastNRedelegations method is called, it returns a mock Redelegation -// with the provided appAddress. -func NewAnyTimeLastNRedelegationsClient( - t *testing.T, - appAddress string, -) *mockclient.MockDelegationClient { - t.Helper() - ctrl := gomock.NewController(t) - - // Create a mock redelegation that returns the provided appAddress - redelegation := NewAnyTimesRedelegation(t, appAddress, "") - // Create a mock delegation client that expects calls to - // LastNRedelegations method and returns the mock redelegation. - delegationClientMock := mockclient.NewMockDelegationClient(ctrl) - delegationClientMock.EXPECT(). - LastNRedelegations(gomock.Any(), gomock.Any()). - Return([]client.Redelegation{redelegation}).AnyTimes() - delegationClientMock.EXPECT().Close().AnyTimes() - - return delegationClientMock -} - -// NewAnyTimesRedelegation creates a mock Redelegation that expects calls -// to the AppAddress method any number of times. When the method is called, it -// returns the provided app address. -func NewAnyTimesRedelegation( - t *testing.T, - appAddress string, - gatewayAddress string, -) *mockclient.MockRedelegation { - t.Helper() - ctrl := gomock.NewController(t) - - // Create a mock redelegation that returns the provided address AnyTimes. - redelegation := mockclient.NewMockRedelegation(ctrl) - redelegation.EXPECT().GetAppAddress().Return(appAddress).AnyTimes() - redelegation.EXPECT().GetGatewayAddress().Return(gatewayAddress).AnyTimes() - - return redelegation -} - -// NewRedelegationEventBytes returns a byte slice containing a JSON string -// that mocks the event bytes returned from the events query client for a -// Redelegation event. -func NewRedelegationEventBytes( - t *testing.T, - appAddress string, - gatewayAddress string, -) []byte { - t.Helper() - jsonTemplate := `{"tx":"SGVsbG8sIHdvcmxkIQ==","result":{"events":[{"type":"message","attributes":[{"key":"action","value":"/pocket.application.MsgDelegateToGateway"},{"key":"sender","value":"pokt1exampleaddress"},{"key":"module","value":"application"}]},{"type":"pocket.application.EventRedelegation","attributes":[{"key":"app_address","value":"\"%s\""},{"key":"gateway_address","value":"\"%s\""}]}]}}` - json := fmt.Sprintf(jsonTemplate, appAddress, gatewayAddress) - return []byte(json) -} diff --git a/testutil/testclient/testdelegation/godoc.go b/testutil/testclient/testdelegation/godoc.go deleted file mode 100644 index 4c7e7387d..000000000 --- a/testutil/testclient/testdelegation/godoc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package testdelegation provides helper functions for constructing real (e.g. -// localnet) and mock DelegationClient objects with pre-configured and/or -// parameterised call arguments, return value(s), and/or expectations thereof. -// Intended for use in tests. -package testdelegation diff --git a/testutil/testclient/testeventsquery/client.go b/testutil/testclient/testeventsquery/client.go deleted file mode 100644 index 3d4251162..000000000 --- a/testutil/testclient/testeventsquery/client.go +++ /dev/null @@ -1,125 +0,0 @@ -package testeventsquery - -import ( - "context" - "fmt" - "sync" - "testing" - "time" - - cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/events" - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/testutil/mockclient" - "github.com/pokt-network/poktroll/testutil/testclient" -) - -// NewLocalnetClient creates and returns a new events query client that's configured -// for use with the localnet sequencer. Any options provided are applied to the client. -func NewLocalnetClient(t *testing.T, opts ...client.EventsQueryClientOption) client.EventsQueryClient { - t.Helper() - - return events.NewEventsQueryClient(testclient.CometLocalWebsocketURL, opts...) -} - -// NewOneTimeEventsQuery creates a mock of the EventsQueryClient which expects -// a single call to the EventsBytes method. It returns a mock client whose event -// bytes method always constructs a new observable. query is the query string -// for which event bytes subscription is expected to be for. -// The caller can simulate blockchain events by sending on publishCh, the value -// of which is set to the publish channel of the events bytes observable publish -// channel. -func NewOneTimeEventsQuery( - ctx context.Context, - t *testing.T, - query string, - publishChMu *sync.Mutex, - publishCh *chan<- either.Bytes, -) *mockclient.MockEventsQueryClient { - t.Helper() - ctrl := gomock.NewController(t) - - eventsQueryClient := mockclient.NewMockEventsQueryClient(ctrl) - eventsQueryClient.EXPECT().EventsBytes(gomock.Eq(ctx), gomock.Eq(query)). - DoAndReturn(func( - ctx context.Context, - query string, - ) (eventsBzObservable client.EventsBytesObservable, err error) { - publishChMu.Lock() - eventsBzObservable, *publishCh = channel.NewObservable[either.Bytes]() - publishChMu.Unlock() - return eventsBzObservable, nil - }).Times(1) - return eventsQueryClient -} - -// NewOneTimeTxEventsQueryClient creates a mock of the Events that expects to to -// a single call to the EventsBytes method where the query is for transaction -// events for sender address matching that of the given key. -// The caller can simulate blockchain events by sending on publishCh, the value -// of which is set to the publish channel of the events bytes observable publish -// channel. -func NewOneTimeTxEventsQueryClient( - ctx context.Context, - t *testing.T, - key *cosmoskeyring.Record, - publishChMu *sync.Mutex, - publishCh *chan<- either.Bytes, -) *mockclient.MockEventsQueryClient { - t.Helper() - - signingAddr, err := key.GetAddress() - require.NoError(t, err) - - expectedEventsQuery := fmt.Sprintf( - "tm.event='Tx' AND message.sender='%s'", - signingAddr, - ) - return NewOneTimeEventsQuery( - ctx, t, - expectedEventsQuery, - publishChMu, - publishCh, - ) -} - -// NewAnyTimesEventsBytesEventsQueryClient returns a new events query client which -// is configured to return the expected event bytes when queried with the expected -// query, any number of times. The returned client also expects to be closed once. -func NewAnyTimesEventsBytesEventsQueryClient( - ctx context.Context, - t *testing.T, - expectedQuery string, - expectedEventBytes []byte, -) client.EventsQueryClient { - t.Helper() - - ctrl := gomock.NewController(t) - eventsQueryClient := mockclient.NewMockEventsQueryClient(ctrl) - eventsQueryClient.EXPECT().Close().Times(1) - eventsQueryClient.EXPECT(). - EventsBytes(gomock.AssignableToTypeOf(ctx), gomock.Eq(expectedQuery)). - DoAndReturn( - func(ctx context.Context, query string) (client.EventsBytesObservable, error) { - bytesObsvbl, bytesPublishCh := channel.NewReplayObservable[either.Bytes](ctx, 1) - - // Now that the observable is set up, publish the expected event bytes. - // Only need to send once because it's a ReplayObservable. - bytesPublishCh <- either.Success(expectedEventBytes) - - // Wait a tick for the observables to be set up. This isn't strictly - // necessary but is done to mitigate test flakiness. - time.Sleep(10 * time.Millisecond) - - return bytesObsvbl, nil - }, - ). - AnyTimes() - - return eventsQueryClient -} diff --git a/testutil/testclient/testeventsquery/connection.go b/testutil/testclient/testeventsquery/connection.go deleted file mode 100644 index e51b31a81..000000000 --- a/testutil/testclient/testeventsquery/connection.go +++ /dev/null @@ -1,115 +0,0 @@ -package testeventsquery - -import ( - "sync/atomic" - "testing" - - "github.com/golang/mock/gomock" - - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/testutil/mockclient" -) - -// NewOneTimeMockConnAndDialer returns a new mock connection and mock dialer that -// will return the mock connection when DialContext is called. The mock dialer -// will expect DialContext to be called exactly once. The connection mock will -// expect Close to be called exactly once. -// Callers must mock the Receive method with an EXPECT call before the connection -// mock can be used. -func NewOneTimeMockConnAndDialer(t *testing.T) ( - *mockclient.MockConnection, - *mockclient.MockDialer, -) { - ctrl := gomock.NewController(t) - connMock := mockclient.NewMockConnection(ctrl) - connMock.EXPECT().Close(). - Return(nil). - Times(1) - - dialerMock := NewOneTimeMockDialer(t, either.Success(connMock)) - - return connMock, dialerMock -} - -// NewOneTimeMockDialer returns a mock dialer that will return either the given -// connection mock or error when DialContext is called. The mock dialer will -// expect DialContext to be called exactly once. -func NewOneTimeMockDialer( - t *testing.T, - eitherConnMock either.Either[*mockclient.MockConnection], -) *mockclient.MockDialer { - ctrl := gomock.NewController(t) - dialerMock := mockclient.NewMockDialer(ctrl) - - connMock, err := eitherConnMock.ValueOrError() - dialerMock.EXPECT().DialContext(gomock.Any(), gomock.Any()). - Return(connMock, err). - Times(1) - - return dialerMock -} - -// NewNTimesReconnectMockConnAndDialer returns a new mock connection and mock -// dialer that will return the mock connection when DialContext is called. The -// mock dialer will expect DialContext to be called any times. The connection -// mock will expect Close and Send to be called exactly N times. -func NewNTimesReconnectMockConnAndDialer( - t *testing.T, - n int, - connClosed *atomic.Bool, - delayEvent *atomic.Bool, -) (*mockclient.MockConnection, *mockclient.MockDialer) { - connMock := NewNTimesReconnectConnectionMock(t, n, connClosed, delayEvent) - dialerMock := NewAnyTimesMockDailer(t, connMock) - return connMock, dialerMock -} - -// NewNTimesReconnectConnectionMock returns a mock connection that will expect -// Close and Send to be called exactly N times. The connection mock will set the -// connClosed atomic to true when Close is called and false when Send is called. -// The connection mock will set the delayEvent atomic to false when Send is -// called. This is to allow the caller to subscribe to the first event emitted -func NewNTimesReconnectConnectionMock( - t *testing.T, - n int, - connClosed *atomic.Bool, - delayEvent *atomic.Bool, -) *mockclient.MockConnection { - ctrl := gomock.NewController(t) - connMock := mockclient.NewMockConnection(ctrl) - // Expect the connection to be closed and the dialer to be re-established - connMock.EXPECT(). - Close(). - DoAndReturn(func() error { - connClosed.CompareAndSwap(false, true) - return nil - }). - Times(n) - // Expect the subscription to be re-established any number of times - connMock.EXPECT(). - Send(gomock.Any()). - DoAndReturn(func(eventBz []byte) error { - if connClosed.Load() { - connClosed.CompareAndSwap(true, false) - } - delayEvent.CompareAndSwap(true, false) - return nil - }). - Times(n) - return connMock -} - -// NewAnyTimesMockDailer returns a mock dialer that will return the given -// connection mock when DialContext is called. The mock dialer will expect -// DialContext to be called any number of times. -func NewAnyTimesMockDailer( - t *testing.T, - connMock *mockclient.MockConnection, -) *mockclient.MockDialer { - ctrl := gomock.NewController(t) - dialerMock := mockclient.NewMockDialer(ctrl) - dialerMock.EXPECT().DialContext(gomock.Any(), gomock.Any()). - Return(connMock, nil). - AnyTimes() - return dialerMock -} diff --git a/testutil/testclient/testeventsquery/godoc.go b/testutil/testclient/testeventsquery/godoc.go deleted file mode 100644 index 0caa02997..000000000 --- a/testutil/testclient/testeventsquery/godoc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package testeventsquery provides helper functions for constructing real -// (e.g. localnet) and mock EventsQueryClient objects with pre-configured and/or -// parameterized call arguments, return value(s), and/or expectations thereof. -// Intended for use in tests. -package testeventsquery diff --git a/testutil/testclient/testkeyring/keyring.go b/testutil/testclient/testkeyring/keyring.go deleted file mode 100644 index bb83baf88..000000000 --- a/testutil/testclient/testkeyring/keyring.go +++ /dev/null @@ -1,17 +0,0 @@ -package testkeyring - -import ( - "testing" - - "github.com/cosmos/cosmos-sdk/crypto/keyring" - - "github.com/pokt-network/poktroll/testutil/testclient" -) - -// NewTestKeyringWithKey creates a new in-memory keyring with a test key -// with testSigningKeyName as its name. -func NewTestKeyringWithKey(t *testing.T, keyName string) (keyring.Keyring, *keyring.Record) { - keyring := keyring.NewInMemory(testclient.EncodingConfig.Marshaler) - key, _ := testclient.NewKey(t, keyName, keyring) - return keyring, key -} diff --git a/testutil/testclient/testqueryclients/accquerier.go b/testutil/testclient/testqueryclients/accquerier.go deleted file mode 100644 index 6924dc963..000000000 --- a/testutil/testclient/testqueryclients/accquerier.go +++ /dev/null @@ -1,67 +0,0 @@ -package testqueryclients - -import ( - "context" - "testing" - - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - accounttypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/golang/mock/gomock" - - "github.com/pokt-network/poktroll/testutil/mockclient" -) - -// addressAccountMap is a map of: -// -// addresses -> public keys. -// -// If an address is not present in the map or if the public key associated -// with an address is nil it is assumed that it does not exist on chain. -var addressAccountMap map[string]cryptotypes.PubKey - -func init() { - addressAccountMap = make(map[string]cryptotypes.PubKey) -} - -// NewTestAccountQueryClient creates a mock of the AccountQueryClient -// which allows the caller to call GetApplication any times and will return -// an application with the given address. -func NewTestAccountQueryClient( - t *testing.T, -) *mockclient.MockAccountQueryClient { - ctrl := gomock.NewController(t) - - accoutQuerier := mockclient.NewMockAccountQueryClient(ctrl) - accoutQuerier.EXPECT().GetAccount(gomock.Any(), gomock.Any()). - DoAndReturn(func( - _ context.Context, - address string, - ) (account accounttypes.AccountI, err error) { - anyPk := (*codectypes.Any)(nil) - if pk, ok := addressAccountMap[address]; ok { - anyPk, err = codectypes.NewAnyWithValue(pk) - if err != nil { - return nil, err - } - } - return &accounttypes.BaseAccount{ - Address: address, - PubKey: anyPk, - }, nil - }). - AnyTimes() - - return accoutQuerier -} - -// addAddressToAccountMap adds the given address to the addressAccountMap -// to mock it "existing" on chain, it will also remove the address from the -// map when the test is cleaned up. -func addAddressToAccountMap(t *testing.T, address string, pubkey cryptotypes.PubKey) { - t.Helper() - addressAccountMap[address] = pubkey - t.Cleanup(func() { - delete(addressAccountMap, address) - }) -} diff --git a/testutil/testclient/testqueryclients/appquerier.go b/testutil/testclient/testqueryclients/appquerier.go deleted file mode 100644 index 85432f35c..000000000 --- a/testutil/testclient/testqueryclients/appquerier.go +++ /dev/null @@ -1,90 +0,0 @@ -package testqueryclients - -import ( - "context" - "testing" - - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/golang/mock/gomock" - - "github.com/pokt-network/poktroll/testutil/mockclient" - apptypes "github.com/pokt-network/poktroll/x/application/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// appToGatewayMap is a map of: -// -// applicationAddresses -> list of the app's delegated gateway addresses. -// -// All addresses are assumed to exist on chain. -var appToGatewayMap map[string][]string - -func init() { - appToGatewayMap = make(map[string][]string) -} - -// NewTestApplicationQueryClient creates a mock of the ApplicationQueryClient -// which allows the caller to call GetApplication any times and will return -// an application with the given address. -func NewTestApplicationQueryClient( - t *testing.T, -) *mockclient.MockApplicationQueryClient { - ctrl := gomock.NewController(t) - - applicationQuerier := mockclient.NewMockApplicationQueryClient(ctrl) - applicationQuerier.EXPECT().GetApplication(gomock.Any(), gomock.Any()). - DoAndReturn(func( - _ context.Context, - appAddress string, - ) (application apptypes.Application, err error) { - delegateeAddresses, ok := appToGatewayMap[appAddress] - if !ok { - return apptypes.Application{}, apptypes.ErrAppNotFound - } - return apptypes.Application{ - Address: appAddress, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svc1", - Name: "service one", - }, - }, - }, - DelegateeGatewayAddresses: delegateeAddresses, - }, nil - }). - AnyTimes() - - return applicationQuerier -} - -// AddAddressToApplicationMap adds the given address to the addressApplicationMap -// with the given delegated gateways addresses. It also adds it to the -// addressAccountMap so that the account will be deemed to exist on chain. -func AddAddressToApplicationMap( - t *testing.T, - address string, pubkey cryptotypes.PubKey, - delegateeAccounts map[string]cryptotypes.PubKey, -) { - t.Helper() - addAddressToAccountMap(t, address, pubkey) - delegateeAddresses := make([]string, 0) - for delegateeAddress, delegateePubKey := range delegateeAccounts { - delegateeAddresses = append(delegateeAddresses, delegateeAddress) - addAddressToAccountMap(t, delegateeAddress, delegateePubKey) - } - appToGatewayMap[address] = delegateeAddresses - t.Cleanup(func() { - delete(appToGatewayMap, address) - }) -} - -// RemoveAddressFromApplicationMap removes the given address from the -// addressApplicationMap. -func RemoveAddressFromApplicationMap(t *testing.T, address string) { - t.Helper() - delete(appToGatewayMap, address) -} diff --git a/testutil/testclient/testqueryclients/godoc.go b/testutil/testclient/testqueryclients/godoc.go deleted file mode 100644 index 4148a0e17..000000000 --- a/testutil/testclient/testqueryclients/godoc.go +++ /dev/null @@ -1,4 +0,0 @@ -// Package testqueryclients provides helper functions for contstructing mock -// AccountQueryClient objects parameterized call arguments, return value(s), -// and/or expectations thereof. Intended for use in tests. -package testqueryclients diff --git a/testutil/testclient/testqueryclients/sessionquerier.go b/testutil/testclient/testqueryclients/sessionquerier.go deleted file mode 100644 index 0b5b27704..000000000 --- a/testutil/testclient/testqueryclients/sessionquerier.go +++ /dev/null @@ -1,90 +0,0 @@ -package testqueryclients - -import ( - "context" - "fmt" - "testing" - - "github.com/golang/mock/gomock" - - "github.com/pokt-network/poktroll/testutil/mockclient" - sessionkeeper "github.com/pokt-network/poktroll/x/session/keeper" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -const blockHash = "1B1051B7BF236FEA13EFA65B6BE678514FA5B6EA0AE9A7A4B68D45F95E4F18E0" - -// sessionsMap is a map of: sessionId -> Session. -// If a sessionId is not present in the map, it implies we have not encountered -// that session yet. -var sessionsMap map[string]*sessiontypes.Session - -func init() { - sessionsMap = make(map[string]*sessiontypes.Session) -} - -// NewTestSessionQueryClient creates a mock of the SessionQueryClient -// which allows the caller to call GetSession any times and will return -// the session matching the app address, serviceID and the blockHeight passed. -func NewTestSessionQueryClient( - t *testing.T, -) *mockclient.MockSessionQueryClient { - ctrl := gomock.NewController(t) - - sessionQuerier := mockclient.NewMockSessionQueryClient(ctrl) - sessionQuerier.EXPECT().GetSession(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()). - DoAndReturn(func( - _ context.Context, - address string, - serviceId string, - blockHeight int64, - ) (session *sessiontypes.Session, err error) { - sessionId, _ := sessionkeeper.GetSessionId(address, serviceId, blockHash, blockHeight) - - session, ok := sessionsMap[sessionId] - if !ok { - return nil, fmt.Errorf("error while trying to retrieve a session") - } - - return session, nil - }). - AnyTimes() - - return sessionQuerier -} - -// AddToExistingSessions adds the given session to the sessionsMap to mock it "existing" -// on chain, it will also remove the sessions from the map when the test is cleaned up. -func AddToExistingSessions( - t *testing.T, - appAddress string, - serviceId string, - blockHeight int64, - suppliersAddress []string, -) { - t.Helper() - - sessionId, _ := sessionkeeper.GetSessionId(appAddress, serviceId, blockHash, blockHeight) - - session := sessiontypes.Session{ - Header: &sessiontypes.SessionHeader{ - Service: &sharedtypes.Service{Id: serviceId}, - ApplicationAddress: appAddress, - SessionStartBlockHeight: blockHeight, - }, - SessionId: sessionId, - Suppliers: []*sharedtypes.Supplier{}, - } - - for _, supplierAddress := range suppliersAddress { - supplier := &sharedtypes.Supplier{Address: supplierAddress} - session.Suppliers = append(session.Suppliers, supplier) - } - - sessionsMap[sessionId] = &session - - t.Cleanup(func() { - delete(sessionsMap, sessionId) - }) -} diff --git a/testutil/testclient/testqueryclients/supplierquerier.go b/testutil/testclient/testqueryclients/supplierquerier.go deleted file mode 100644 index 6dd6b32b1..000000000 --- a/testutil/testclient/testqueryclients/supplierquerier.go +++ /dev/null @@ -1,106 +0,0 @@ -package testqueryclients - -import ( - "context" - "errors" - "testing" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/mockclient" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// suppliersProvidedServicesMap is a map of maps: -// -// supplierAddress -> {service -> []SupplierEndpoint} -// -// If an address is not present in the map it is then assumed that the supplier does -// not exist (has not staked) -var suppliersProvidedServicesMap map[string]map[string][]*sharedtypes.SupplierEndpoint - -func init() { - suppliersProvidedServicesMap = make(map[string]map[string][]*sharedtypes.SupplierEndpoint) -} - -// NewTestSupplierQueryClient creates a mock of the SupplierQueryClient -// which allows the caller to call GetSupplier any times and will return -// an application with the given address. -func NewTestSupplierQueryClient( - t *testing.T, -) *mockclient.MockSupplierQueryClient { - ctrl := gomock.NewController(t) - - supplierQuerier := mockclient.NewMockSupplierQueryClient(ctrl) - supplierQuerier.EXPECT().GetSupplier(gomock.Any(), gomock.Any()). - DoAndReturn(func( - _ context.Context, - address string, - ) (supplier sharedtypes.Supplier, err error) { - supplierProvidedServices, ok := suppliersProvidedServicesMap[address] - if !ok { - return sharedtypes.Supplier{}, errors.New("address not found") - } - - services := []*sharedtypes.SupplierServiceConfig{} - - for serviceId, providedService := range supplierProvidedServices { - serviceConfig := &sharedtypes.SupplierServiceConfig{ - Service: &sharedtypes.Service{ - Id: serviceId, - }, - Endpoints: []*sharedtypes.SupplierEndpoint{}, - } - - for _, endpointConfig := range providedService { - endpoint := &sharedtypes.SupplierEndpoint{ - Url: endpointConfig.Url, - RpcType: endpointConfig.RpcType, - } - serviceConfig.Endpoints = append(serviceConfig.Endpoints, endpoint) - } - - services = append(services, serviceConfig) - } - - return sharedtypes.Supplier{ - Address: address, - Services: services, - }, nil - }). - AnyTimes() - - return supplierQuerier -} - -// AddSupplierWithServiceEndpoints adds the given address and ServiceEndpoints -// to the suppliersProvidedServicesMap to mock it "existing" on chain, -// it will also remove the address from the map when the test is cleaned up. -func AddSuppliersWithServiceEndpoints( - t *testing.T, - address, service string, - endpoints []*sharedtypes.SupplierEndpoint, -) { - t.Helper() - require.NotEmpty(t, endpoints) - - supplier, ok := suppliersProvidedServicesMap[address] - if !ok { - supplier = make(map[string][]*sharedtypes.SupplierEndpoint) - } - - serviceEndpoints, ok := supplier[service] - if !ok { - serviceEndpoints = []*sharedtypes.SupplierEndpoint{} - } - - serviceEndpoints = append(serviceEndpoints, endpoints...) - - supplier[service] = serviceEndpoints - suppliersProvidedServicesMap[address] = supplier - - t.Cleanup(func() { - delete(addressAccountMap, address) - }) -} diff --git a/testutil/testclient/testsupplier/client.go b/testutil/testclient/testsupplier/client.go deleted file mode 100644 index 841cfc024..000000000 --- a/testutil/testclient/testsupplier/client.go +++ /dev/null @@ -1,71 +0,0 @@ -package testsupplier - -import ( - "context" - "testing" - - "cosmossdk.io/depinject" - "github.com/golang/mock/gomock" - "github.com/pokt-network/smt" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/supplier" - "github.com/pokt-network/poktroll/pkg/client/tx" - "github.com/pokt-network/poktroll/testutil/mockclient" - "github.com/pokt-network/poktroll/testutil/testclient/testtx" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" -) - -// NewLocalnetClient creates and returns a new supplier client that connects to -// the localnet sequencer. -func NewLocalnetClient( - t *testing.T, - signingKeyName string, -) client.SupplierClient { - t.Helper() - - txClientOpt := tx.WithSigningKeyName(signingKeyName) - supplierClientOpt := supplier.WithSigningKeyName(signingKeyName) - - txCtx := testtx.NewLocalnetContext(t) - txClient := testtx.NewLocalnetClient(t, txClientOpt) - - deps := depinject.Supply( - txCtx, - txClient, - ) - - supplierClient, err := supplier.NewSupplierClient(deps, supplierClientOpt) - require.NoError(t, err) - return supplierClient -} - -func NewOneTimeClaimProofSupplierClient( - ctx context.Context, - t *testing.T, -) *mockclient.MockSupplierClient { - t.Helper() - - ctrl := gomock.NewController(t) - supplierClientMock := mockclient.NewMockSupplierClient(ctrl) - supplierClientMock.EXPECT(). - CreateClaim( - gomock.Eq(ctx), - gomock.AssignableToTypeOf(sessiontypes.SessionHeader{}), - gomock.AssignableToTypeOf([]byte{}), - ). - Return(nil). - Times(1) - - supplierClientMock.EXPECT(). - SubmitProof( - gomock.Eq(ctx), - gomock.AssignableToTypeOf(sessiontypes.SessionHeader{}), - gomock.AssignableToTypeOf((*smt.SparseMerkleClosestProof)(nil)), - ). - Return(nil). - Times(1) - - return supplierClientMock -} diff --git a/testutil/testclient/testtx/client.go b/testutil/testclient/testtx/client.go deleted file mode 100644 index 405c24a2e..000000000 --- a/testutil/testclient/testtx/client.go +++ /dev/null @@ -1,95 +0,0 @@ -package testtx - -import ( - "context" - "testing" - "time" - - "cosmossdk.io/depinject" - cosmostypes "github.com/cosmos/cosmos-sdk/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/tx" - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/testutil/mockclient" - "github.com/pokt-network/poktroll/testutil/testclient/testblock" - "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" -) - -type signAndBroadcastFn func(context.Context, cosmostypes.Msg) either.AsyncError - -// TODO_CONSIDERATION: functions like these (NewLocalnetXXX) could probably accept -// and return depinject.Config arguments to support shared dependencies. - -// NewLocalnetClient creates and returns a new client for use with the localnet -// sequencer. -func NewLocalnetClient(t *testing.T, opts ...client.TxClientOption) client.TxClient { - t.Helper() - - ctx := context.Background() - txCtx := NewLocalnetContext(t) - eventsQueryClient := testeventsquery.NewLocalnetClient(t) - blockClient := testblock.NewLocalnetClient(ctx, t) - - deps := depinject.Supply( - txCtx, - eventsQueryClient, - blockClient, - ) - - txClient, err := tx.NewTxClient(ctx, deps, opts...) - require.NoError(t, err) - - return txClient -} - -// NewOneTimeDelayedSignAndBroadcastTxClient constructs a mock TxClient with the -// expectation to perform a SignAndBroadcast operation with a specified delay. -func NewOneTimeDelayedSignAndBroadcastTxClient( - t *testing.T, - ctx context.Context, - delay time.Duration, -) *mockclient.MockTxClient { - t.Helper() - - signAndBroadcast := newSignAndBroadcastSucceedsDelayed(delay) - return NewOneTimeSignAndBroadcastTxClient(t, ctx, signAndBroadcast) -} - -// NewOneTimeSignAndBroadcastTxClient constructs a mock TxClient with the -// expectation to perform a SignAndBroadcast operation, which will call and receive -// the return from the given signAndBroadcast function. -func NewOneTimeSignAndBroadcastTxClient( - t *testing.T, - ctx context.Context, - signAndBroadcast signAndBroadcastFn, -) *mockclient.MockTxClient { - t.Helper() - - ctrl := gomock.NewController(t) - - txClient := mockclient.NewMockTxClient(ctrl) - txClient.EXPECT().SignAndBroadcast( - gomock.Eq(ctx), - gomock.Any(), - ).DoAndReturn(signAndBroadcast).Times(1) - - return txClient -} - -// newSignAndBroadcastSucceedsDelayed returns a signAndBroadcastFn that succeeds -// after the given delay. -func newSignAndBroadcastSucceedsDelayed(delay time.Duration) signAndBroadcastFn { - return func(ctx context.Context, msg cosmostypes.Msg) either.AsyncError { - errCh := make(chan error) - - go func() { - time.Sleep(delay) - close(errCh) - }() - - return either.AsyncErr(errCh) - } -} diff --git a/testutil/testclient/testtx/context.go b/testutil/testclient/testtx/context.go deleted file mode 100644 index aa255d650..000000000 --- a/testutil/testclient/testtx/context.go +++ /dev/null @@ -1,275 +0,0 @@ -package testtx - -import ( - "context" - "fmt" - "testing" - - "cosmossdk.io/depinject" - abci "github.com/cometbft/cometbft/abci/types" - cometbytes "github.com/cometbft/cometbft/libs/bytes" - cometrpctypes "github.com/cometbft/cometbft/rpc/core/types" - comettypes "github.com/cometbft/cometbft/types" - cosmosclient "github.com/cosmos/cosmos-sdk/client" - cosmostx "github.com/cosmos/cosmos-sdk/client/tx" - cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" - cosmostypes "github.com/cosmos/cosmos-sdk/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/tx" - txtypes "github.com/pokt-network/poktroll/pkg/client/tx/types" - "github.com/pokt-network/poktroll/testutil/mockclient" - "github.com/pokt-network/poktroll/testutil/testclient" -) - -// NewLocalnetContext creates and returns a new transaction context configured -// for use with the localnet sequencer. -func NewLocalnetContext(t *testing.T) client.TxContext { - t.Helper() - - flagSet := testclient.NewLocalnetFlagSet(t) - clientCtx := testclient.NewLocalnetClientCtx(t, flagSet) - txFactory, err := cosmostx.NewFactoryCLI(*clientCtx, flagSet) - require.NoError(t, err) - require.NotEmpty(t, txFactory) - - deps := depinject.Supply( - *clientCtx, - txFactory, - ) - - txCtx, err := tx.NewTxContext(deps) - require.NoError(t, err) - - return txCtx -} - -// TODO_IMPROVE: these mock constructor helpers could include parameters for the -// "times" (e.g. exact, min, max) values which are passed to their respective -// gomock.EXPECT() method calls (i.e. Times(), MinTimes(), MaxTimes()). -// When implementing such a pattern, be careful about making assumptions about -// correlations between these "times" values and the contexts in which the expected -// methods may be called. - -// NewOneTimeErrTxTimeoutTxContext creates a mock transaction context designed to -// simulate a specific timeout error scenario during transaction broadcasting. -// expectedErrMsg is populated with the same error message which is presented in -// the result from the QueryTx method so that it can be asserted against. -func NewOneTimeErrTxTimeoutTxContext( - t *testing.T, - keyring cosmoskeyring.Keyring, - signingKeyName string, - expectedErrMsg *string, -) *mockclient.MockTxContext { - t.Helper() - - signerKey, err := keyring.Key(signingKeyName) - require.NoError(t, err) - - signerAddr, err := signerKey.GetAddress() - require.NoError(t, err) - - *expectedErrMsg = fmt.Sprintf( - "fee payer address: %s does not exist: unknown address", - signerAddr.String(), - ) - - var expectedTx cometbytes.HexBytes - txCtxMock := NewBaseTxContext( - t, signingKeyName, - keyring, - &expectedTx, - ) - - // intercept #BroadcastTx() call to mock response and prevent actual broadcast - txCtxMock.EXPECT().BroadcastTx(gomock.Any()). - DoAndReturn( - func(txBytes []byte) (*cosmostypes.TxResponse, error) { - var expectedTxHash cometbytes.HexBytes = comettypes.Tx(txBytes).Hash() - return &cosmostypes.TxResponse{ - Height: 1, - TxHash: expectedTxHash.String(), - }, nil - }, - ).Times(1) - - txCtxMock.EXPECT().QueryTx( - gomock.AssignableToTypeOf(context.Background()), - gomock.AssignableToTypeOf([]byte{}), - gomock.AssignableToTypeOf(false), - ).DoAndReturn( - func( - ctx context.Context, - txHash []byte, - _ bool, - ) (*cometrpctypes.ResultTx, error) { - return &cometrpctypes.ResultTx{ - Hash: txHash, - Height: 1, - TxResult: abci.ResponseDeliverTx{ - Code: 1, - Log: *expectedErrMsg, - Codespace: "test_codespace", - }, - Tx: expectedTx.Bytes(), - }, nil - }, - ) - - return txCtxMock -} - -// NewOneTimeErrCheckTxTxContext creates a mock transaction context to simulate -// a specific error scenario during the ABCI check-tx phase (i.e., during initial -// validation before the transaction is included in the block). -// expectedErrMsg is populated with the same error message which is presented in -// the result from the QueryTx method so that it can be asserted against. -func NewOneTimeErrCheckTxTxContext( - t *testing.T, - keyring cosmoskeyring.Keyring, - signingKeyName string, - expectedErrMsg *string, -) *mockclient.MockTxContext { - t.Helper() - - signerKey, err := keyring.Key(signingKeyName) - require.NoError(t, err) - - signerAddr, err := signerKey.GetAddress() - require.NoError(t, err) - - *expectedErrMsg = fmt.Sprintf( - "fee payer address: %s does not exist: unknown address", - signerAddr.String(), - ) - - var expectedTx cometbytes.HexBytes - txCtxMock := NewBaseTxContext( - t, signingKeyName, - keyring, - &expectedTx, - ) - - // intercept #BroadcastTx() call to mock response and prevent actual broadcast - txCtxMock.EXPECT().BroadcastTx(gomock.Any()). - DoAndReturn( - func(txBytes []byte) (*cosmostypes.TxResponse, error) { - var expectedTxHash cometbytes.HexBytes = comettypes.Tx(txBytes).Hash() - return &cosmostypes.TxResponse{ - Height: 1, - TxHash: expectedTxHash.String(), - RawLog: *expectedErrMsg, - Code: 1, - Codespace: "test_codespace", - }, nil - }, - ).Times(1) - - return txCtxMock -} - -// NewOneTimeTxTxContext creates a mock transaction context primed to respond with -// a single successful transaction response. -func NewOneTimeTxTxContext( - t *testing.T, - keyring cosmoskeyring.Keyring, - signingKeyName string, - expectedTx *cometbytes.HexBytes, -) *mockclient.MockTxContext { - t.Helper() - - txCtxMock := NewBaseTxContext( - t, signingKeyName, - keyring, - expectedTx, - ) - - // intercept #BroadcastTx() call to mock response and prevent actual broadcast - txCtxMock.EXPECT().BroadcastTx(gomock.Any()). - DoAndReturn( - func(txBytes []byte) (*cosmostypes.TxResponse, error) { - var expectedTxHash cometbytes.HexBytes = comettypes.Tx(txBytes).Hash() - return &cosmostypes.TxResponse{ - Height: 1, - TxHash: expectedTxHash.String(), - }, nil - }, - ).Times(1) - - return txCtxMock -} - -// NewBaseTxContext creates a mock transaction context that's configured to expect -// calls to NewTxBuilder, SignTx, and EncodeTx methods, any number of times. -// EncodeTx is used to intercept the encoded transaction bytes and store them in -// the expectedTx output parameter. Each of these methods proxies to the corresponding -// method on a real transaction context. -func NewBaseTxContext( - t *testing.T, - signingKeyName string, - keyring cosmoskeyring.Keyring, - expectedTx *cometbytes.HexBytes, -) *mockclient.MockTxContext { - t.Helper() - - txCtxMock, txCtx := NewAnyTimesTxTxContext(t, keyring) - txCtxMock.EXPECT().NewTxBuilder(). - DoAndReturn(txCtx.NewTxBuilder). - AnyTimes() - txCtxMock.EXPECT().SignTx( - gomock.Eq(signingKeyName), - gomock.AssignableToTypeOf(txCtx.NewTxBuilder()), - gomock.Eq(false), gomock.Eq(false), - ).DoAndReturn(txCtx.SignTx).AnyTimes() - txCtxMock.EXPECT().EncodeTx(gomock.Any()). - DoAndReturn( - func(txBuilder cosmosclient.TxBuilder) (_ []byte, err error) { - // intercept cosmosTxContext#EncodeTx to get the encoded tx cometbytes - *expectedTx, err = txCtx.EncodeTx(txBuilder) - require.NoError(t, err) - return expectedTx.Bytes(), nil - }, - ).AnyTimes() - - return txCtxMock -} - -// NewAnyTimesTxTxContext initializes a mock transaction context that's configured to allow -// arbitrary calls to certain predefined interactions, primarily concerning the retrieval -// of account numbers and sequences. -func NewAnyTimesTxTxContext( - t *testing.T, - keyring cosmoskeyring.Keyring, -) (*mockclient.MockTxContext, client.TxContext) { - t.Helper() - - var ( - ctrl = gomock.NewController(t) - flagSet = testclient.NewLocalnetFlagSet(t) - ) - - // intercept #GetAccountNumberSequence() call to mock response and prevent actual query - accountRetrieverMock := mockclient.NewMockAccountRetriever(ctrl) - accountRetrieverMock.EXPECT().GetAccountNumberSequence(gomock.Any(), gomock.Any()). - Return(uint64(1), uint64(1), nil). - AnyTimes() - - clientCtx := testclient.NewLocalnetClientCtx(t, flagSet). - WithKeyring(keyring). - WithAccountRetriever(accountRetrieverMock) - - txFactory, err := cosmostx.NewFactoryCLI(clientCtx, flagSet) - require.NoError(t, err) - require.NotEmpty(t, txFactory) - - txClientCtx := txtypes.Context(clientCtx) - txCtxDeps := depinject.Supply(txFactory, txClientCtx) - txCtx, err := tx.NewTxContext(txCtxDeps) - require.NoError(t, err) - txCtxMock := mockclient.NewMockTxContext(ctrl) - txCtxMock.EXPECT().GetKeyring().Return(keyring).AnyTimes() - - return txCtxMock, txCtx -} diff --git a/testutil/testcrypto/rings/cache.go b/testutil/testcrypto/rings/cache.go deleted file mode 100644 index ef25eb21b..000000000 --- a/testutil/testcrypto/rings/cache.go +++ /dev/null @@ -1,48 +0,0 @@ -package testrings - -import ( - "context" - "testing" - - "cosmossdk.io/depinject" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/crypto" - "github.com/pokt-network/poktroll/pkg/crypto/rings" - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/testutil/mockclient" -) - -// NewRingCacheWithMockDependencies creates a new "real" RingCache with the given -// mock Account and Application queriers supplied as dependencies. A Delegation -// client is required as a dependency and depending on how it is used will -// require a different function to generate the delegations client. -// The queriers are expected to maintain their respective mocked states: -// - Account querier: the account addresses and public keys -// - Application querier: the application addresses delegatee gateway addresses -// -// See: -// -// testutil/testclient/testqueryclients/accquerier.go -// testutil/testclient/testqueryclients/appquerier.go -// testutil/testclient/testdelegation/client.go -// -// for methods to create these queriers and maintain their states. -func NewRingCacheWithMockDependencies( - ctx context.Context, - t *testing.T, - accQuerier *mockclient.MockAccountQueryClient, - appQuerier *mockclient.MockApplicationQueryClient, - delegationClient *mockclient.MockDelegationClient, -) crypto.RingCache { - t.Helper() - - // Create the dependency injector with the mock queriers - logger := polylog.Ctx(ctx) - deps := depinject.Supply(logger, accQuerier, appQuerier, delegationClient) - - ringCache, err := rings.NewRingCache(deps) - require.NoError(t, err) - - return ringCache -} diff --git a/testutil/testcrypto/rings/godoc.go b/testutil/testcrypto/rings/godoc.go deleted file mode 100644 index 3d1e8f2c8..000000000 --- a/testutil/testcrypto/rings/godoc.go +++ /dev/null @@ -1,4 +0,0 @@ -// Package testrings provides helper functions for constructing real (e.g. localnet) -// and mock RingCache objects with pre-configured and/or parameterized call -// arguments, return value(s), and/or expectations thereof. Intended for use in tests. -package testrings diff --git a/testutil/testerrors/require.go b/testutil/testerrors/require.go deleted file mode 100644 index 624cdaf6e..000000000 --- a/testutil/testerrors/require.go +++ /dev/null @@ -1,11 +0,0 @@ -package testerrors - -import errorsmod "cosmossdk.io/errors" - -var ( - // ErrAsync is returned when a test assertion fails in a goroutine other than - // the main test goroutine. This is done to avoid concurrent usage of - // t.Fatal() which can cause the test binary to exit before cleanup is complete. - ErrAsync = errorsmod.Register(codespace, 1, "required assertion failed") - codespace = "testerrors" -) diff --git a/testutil/testkeyring/accounts.go b/testutil/testkeyring/accounts.go deleted file mode 100644 index f71fe665d..000000000 --- a/testutil/testkeyring/accounts.go +++ /dev/null @@ -1,118 +0,0 @@ -package testkeyring - -import ( - "encoding/base64" - "encoding/json" - "sync/atomic" - - sdktypes "github.com/cosmos/cosmos-sdk/types" -) - -// PreGeneratedAccount holds the address and mnemonic of an account which was -// pre-generated by the `gen_accounts` package. It is intended to be used ONLY -// in tests. It is useful for scenarios where it is necessary to know the address -// of a specific key in a separate context from that of keyring and/or module -// genesis state construction. -type PreGeneratedAccount struct { - Address sdktypes.AccAddress `json:"address"` - Mnemonic string `json:"mnemonic"` -} - -// PreGeneratedAccountIterator is an iterator over the pre-generated accounts. -// A new iterator populated with existing pre-generated accounts can be created -// with the PreGeneratedAccounts function. Alternatively, a new iterator can be -// created with the NewPreGeneratedAccountIterator function, to which a list of -// pre-generated accounts to be iterated over must be provided. -type PreGeneratedAccountIterator struct { - accounts []*PreGeneratedAccount - nextIndex uint32 -} - -// PreGeneratedAccountAtIndex returns the pre-generated account at the given index. -// It returns nil and false if the index is out of range. -func PreGeneratedAccountAtIndex(index uint32) (_ *PreGeneratedAccount, ok bool) { - if preGeneratedAccounts.nextIndex >= uint32(len(preGeneratedAccounts.accounts)) { - return nil, false - } - - return preGeneratedAccounts.accounts[index], true -} - -// MustPreGeneratedAccountAtIndex returns the pre-generated account at the given index. -// It panics on error; i.e. if the index is out of range. -func MustPreGeneratedAccountAtIndex(index uint32) *PreGeneratedAccount { - account, ok := PreGeneratedAccountAtIndex(index) - if !ok { - panic("index out of range of pre-generated accounts list") - } - return account -} - -// PreGeneratedAccounts returns a new PreGeneratedAccountIterator with the -// accounts which were pre-generated by the `gen_accounts` package (i.e. accounts_table.go). -func PreGeneratedAccounts() *PreGeneratedAccountIterator { - return preGeneratedAccounts.Clone() -} - -// NewPreGeneratedAccountIterator returns a new PreGeneratedAccountIterator with -// the given accounts. It is primarily used by the generated code to initially -// construct the preGeneratedAccounts variable. -func NewPreGeneratedAccountIterator(accounts ...*PreGeneratedAccount) *PreGeneratedAccountIterator { - return &PreGeneratedAccountIterator{ - accounts: accounts, - nextIndex: 0, - } -} - -// Next returns the next account in the iterator. It is safe to call -// concurrently and is guaranteed to return a unique account on each call. -// If the iterator index goes out of range, it returns nil and false. -func (iter *PreGeneratedAccountIterator) Next() (_ *PreGeneratedAccount, ok bool) { - // NB: instead of loading and incrementing in separate steps, just increment - // and use nextIndex-1 for the current index. - nextIndex := atomic.AddUint32(&iter.nextIndex, 1) - currentIndex := nextIndex - 1 - - if currentIndex > uint32(len(iter.accounts)) { - return nil, false - } - - return iter.accounts[currentIndex], true -} - -// Clone returns a new PreGeneratedAccountIterator with the same accounts as the -// receiver but with its nextIndex reset to 0. -func (iter *PreGeneratedAccountIterator) Clone() *PreGeneratedAccountIterator { - return NewPreGeneratedAccountIterator(iter.accounts...) -} - -// Marshal returns the base64 and JSON encoded account string. -func (pga *PreGeneratedAccount) Marshal() (string, error) { - accountJson, err := json.Marshal(pga) - if err != nil { - return "", err - } - - accountStr := base64.StdEncoding.EncodeToString(accountJson) - return accountStr, nil -} - -// UnmarshalString parses the given base64 and JSON encoded account string into -// the PreGeneratedAccount receiver. -func (pga *PreGeneratedAccount) UnmarshalString(encodedAccountStr string) error { - accountJson, err := base64.StdEncoding.DecodeString(encodedAccountStr) - if err != nil { - return err - } - return json.Unmarshal(accountJson, pga) -} - -// mustParsePreGeneratedAccount parses the given base64 and JSON encoded account -// string into a PreGeneratedAccount. It panics on error. -func mustParsePreGeneratedAccount(accountStr string) *PreGeneratedAccount { - account := new(PreGeneratedAccount) - if err := account.UnmarshalString(accountStr); err != nil { - panic(err) - } - return account -} diff --git a/testutil/testkeyring/accounts_table.go b/testutil/testkeyring/accounts_table.go deleted file mode 100644 index 711a25018..000000000 --- a/testutil/testkeyring/accounts_table.go +++ /dev/null @@ -1,111 +0,0 @@ -// DO NOT EDIT. This Code is generated by gen_accounts/gen.go, -// changes will be overwritten upon regeneration. -// -// To regenerate this file, use make go_testgen_accounts or go generate ./testutil/network/keyring.go. - -package testkeyring - -var ( - preGeneratedAccounts = NewPreGeneratedAccountIterator( - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWRwZzN5YWU5OWc4bHJ3Nzl3dzBrZzJ6YTg0MzY2ZDZ0NjNrdTdkIiwiTW5lbW9uaWMiOiJsaWtlIGhpcCBzd2FtcCBmb3VuZCBjcnlzdGFsIGZsYW1lIGRlY3JlYXNlIGNydXNoIGNvaW4gY29uZHVjdCBhZmZhaXIgdmlsbGFnZSBjcnVlbCBtb250aCBob3N0IGdsb2JlIHJlZnVzZSByaWdpZCBmZWJydWFyeSBvdmVuIGNvcmUgY3JvcCBpbnB1dCBndWlsdCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTczYzI2dG05enp2MnVnbGNhdmFkMGd3dG02azd0cTN0MmtzN2s4IiwiTW5lbW9uaWMiOiJyb2JvdCBzdW5ueSBoaWxsIHNvY2NlciB0b2JhY2NvIHBhbmVsIGluY2x1ZGUgdGFibGUgaW52aXRlIHNoeSB3b3JsZCBwZXJzb24gZG9vciBwdW5jaCBzdGluZyBkZWNvcmF0ZSB3aW5rIHNjaXNzb3JzIG94eWdlbiB0aG91Z2h0IGxpZnQgZGVjbGluZSBtb29uIGxvYW4ifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTBzbTVlcDUzaGt5a2RnM3p0NHNwZ214amZ0YXJ6czh1ZjBkZXdqIiwiTW5lbW9uaWMiOiJzdG9uZSBwcmVzZW50IGdvbGQgYmFyZ2FpbiBsZWFmIHJlY2VpdmUgYmFyZ2FpbiByYXcgc2luY2Ugc2hvdmUgYWRqdXN0IGRlcHV0eSByb2NrZXQgZm9sbG93IGxhd3N1aXQgbWFuZ28gc3RhZ2UgcnVud2F5IGRvZyBiZWF1dHkgZ2FzIHNlbnNlIGRpYWdyYW0gdGFzayJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWR1bHp3Z3RnN2xkeDJ6dGgzbXNtbXB1d3phN2tsZDUyOTJkenh1IiwiTW5lbW9uaWMiOiJkb25hdGUgYWxpZW4gcGxhbmV0IGRlZXIgbWFuc2lvbiBiZWdpbiBub3RoaW5nIGd1aWx0IGdvb3NlIGNpdmlsIGdhdGUgcHJvZHVjZSBvbGQgZXJyb3IgYmVoYXZlIG1ha2UgZmx1c2ggYmFubmVyIGNyaWNrZXQgbGFrZSBoaXN0b3J5IGxhbXAgdmljdG9yeSB0dW1ibGUifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTRmODRqbGc3ZHFrNHlmNXY3bDg5cHh2a2FyczZtM2czbGRyYXM0IiwiTW5lbW9uaWMiOiJlbGRlciBncmllZiBmYXRhbCBzaXggY291c2luIHByb2JsZW0gdGlnZXIgdmFsdmUgaGVhdnkgY2hyb25pYyBkZXB0aCBnYXRoZXIgZmljdGlvbiBjaGltbmV5IGNyaXNwIGVjb2xvZ3kgbWFuc2lvbiBleGN1c2UgbGV0dGVyIGZhbGwgZXZva2UgY3Jhd2wgaWdub3JlIG9wZXJhIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWNwY25oanU0MDR6NDQ3Z2x4ZzlxdTNsN3c1ZHdzcGQ1emQ0NWhyIiwiTW5lbW9uaWMiOiJ3aGF0IGVtZXJnZSBob3NwaXRhbCBrZXkgZHV0Y2ggZXhhbXBsZSB1cG9uIGdvb2Qgbm9vZGxlIHNldHRsZSB3aXNlIGNvbm5lY3QgdGlwIGFsbCByb29mIGNvbWJpbmUgZXhwbGFpbiBjaGVzdCBsYWJlbCBsb2dpYyB3YWxrIGZvbGQgdHJheSByYWNjb29uIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTNrcm11ZGpldDNrY2xjZGVtMG5qaGdodzloMnBsZnFncmNqdnRlIiwiTW5lbW9uaWMiOiJraXdpIG9wcG9zZSBxdWVzdGlvbiBtb250aCByYW5kb20gZXh0cmEgZW1wb3dlciBiYW5hbmEgd29ydGggYXBhcnQgcmlzayBiZXR3ZWVuIGluc2FuZSByaXZhbCBkdWNrIGxlZyB0cmF2ZWwgcmVuZXcgc29jY2VyIGFkanVzdCBnb2RkZXNzIGNyb3VjaCBkaXNhZ3JlZSB0b3BpYyJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXozZ3NrdjdlNjR5MzZ2eDN6Y3M3ZDYzbnJ1bWRhZnRzNjZ1MjluIiwiTW5lbW9uaWMiOiJtb3ZlIGZsaWdodCBjb21pYyB5b3V0aCBkcmFmdCB0cnV0aCB0cmFzaCBiYXNpYyBsYXdzdWl0IHdpbGQgcHJpZGUgdGlzc3VlIGFwYXJ0IGluaGFsZSB6ZWJyYSBmdWVsIHRyZWF0IGhvdXIgcGhvdG8gdG9zcyB2aXNpdCB0b3AgYWxsZXkgc3R1bWJsZSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTh1eHV2djA0MmUzbjd5d3FzMmZmODNzaDM2YzdkOXhuOGx1NmsyIiwiTW5lbW9uaWMiOiJ3b3J0aCBjaGlja2VuIGFybW9yIGNhbG0gaGVuIHRvaWxldCBldm9rZSByb3V0ZSBwYXRjaCBmYW1lIHBvcnRpb24gaG9iYnkgZXhjZXNzIG1hbmRhdGUgd29ybGQgdW5oYXBweSBoYXJkIG1vbSBvbHltcGljIGNyeXN0YWwgb2ZmaWNlIHJlbGllZiBmYXNoaW9uIHN1Y2gifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWtqcGRneG0waHN5YWhxcTQ5NHVocGt3d2w4cXZ5N3JudG12OGxoIiwiTW5lbW9uaWMiOiJva2F5IHBvZW0gYm9vc3QgYmxlYWsgc3F1ZWV6ZSBwaXBlIHRvb2wgZmlsdGVyIHRpbWJlciBzbGFiIGdhaW4gcGVvcGxlIG5ldCBhcnJlc3Qgc2VjdXJpdHkgZGVjYWRlIGNyYWZ0IGFwcGVhciBzbW9rZSBib2R5IGFzc2F1bHQgYmVhY2ggZXhvdGljIGFsdGVyIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXVudXJnd3Zna2s1NmwzM2d3bjA3MjM3NTkwODluOGU0ajRweXJmIiwiTW5lbW9uaWMiOiJ1cmJhbiBicm9jY29saSBncml0IG1lcnJ5IHJvbWFuY2UgbXl0aCBqb2IgZm9jdXMgY2xpY2sgc2h5IHByaW9yaXR5IGFzc2V0IGJyaXNrIHJlY29yZCByZW5ldyB0aW1iZXIgc3RlYWsgZmF0IGd1YXJkIG1vdGhlciBoYW5kIG5vdmVsIGN1cnZlIGxhdmEifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTY1ejRqc3Nncjl5dXNuZXNwdjd2YXk1bjcyNmNoMnYwdHF6dTU1IiwiTW5lbW9uaWMiOiJ0dW5uZWwgaHVtb3IgbWltaWMgZ2F0ZSBwaWxsIGJyZWFkIHRpbnkgc21vb3RoIHRvcGljIHdpc2UgdHdpY2Ugc3VnZ2VzdCBzb3VsIGxpbWl0IGluY3JlYXNlIGFyZWEgb3JhbmdlIHNoZXJpZmYgcHVyc2UgaW5jb21lIGphZ3VhciB3aWZlIG9yZGluYXJ5IHZpb2xpbiJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMW12cHl1OTV6bndscnprdDV0ZTdhZXMyeXN5eGhmZHptN3hlbWVsIiwiTW5lbW9uaWMiOiJsYXJnZSBiYW5hbmEgZ3JhcGUgbW9ua2V5IHVwcGVyIGdpYW50IGFjdGlvbiBtdXR1YWwgdGhlb3J5IGJlbmVmaXQgaW5kaWNhdGUgdGF0dG9vIHVwZ3JhZGUgb3BlcmEgY2hhb3MgcGFyYWRlIHNvbWVvbmUgZWR1Y2F0ZSBoYW5kIG5vYmxlIGpva2UgcmViZWwgcmFjY29vbiBhcm0ifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTcwbmFrYTVnd2swOG5xdzVqYXZtZ3A3c3VnMzUwMHMyM242ZzZmIiwiTW5lbW9uaWMiOiJlbGRlciByYXRlIGJ1c2luZXNzIGdvYXQgdGFuayBtYXR0ZXIgdXBncmFkZSByaW5nIHNob3ZlIGVjb25vbXkgYXJ0aXN0IGJhY2hlbG9yIGZsYXZvciBicmlzayBmYW1pbHkgdGVuIGJ1ZGR5IHJvYm90IHJlcXVpcmUgYWRhcHQgc3VjaCBzYWQgc2libGluZyBwaXN0b2wifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTlxcW5yNWE1M2R2azBodGgyNGRobjVhYXMwdm53bHpwbnZyNm1oIiwiTW5lbW9uaWMiOiJrYW5nYXJvbyBsaWNlbnNlIGdvb2Qgb3ZlciBxdWVzdGlvbiBzY3JhcCBhY3Jvc3MgZGVjb3JhdGUgZnJlc2ggaGFtbWVyIG1lcmdlIGNvbmZpcm0gZm9sZCB1bmFibGUgY3JhbSBzcXVlZXplIHN1cHBseSBiaXJ0aCBob3JzZSBkZXRhaWwgd2F2ZSBsaW1pdCBpbmNsdWRlIGhhaXIifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTJnN2Z6OWV2YWE4OGd2Nm1nNHA3dmM3Y2hzaGh3Nmg1NmRyM25lIiwiTW5lbW9uaWMiOiJ3aWRlIGJhdHRsZSBsZW9wYXJkIGxlbmQgcmFpbCBkaXZlcnQgZm9nIG9ycGhhbiBvY2VhbiBlbmZvcmNlIHRydWUgY29tcGFueSBkcmF3IGVuam95IHRoYXQgY29yYWwgYmxvdXNlIGZyb250IHNwb25zb3IgY29udHJvbCBjb2xvciB0b3JuYWRvIHBpbmsgYWRhcHQifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTZ3cXgwNHJqdmEzdjh4NWYzdnZtbXlwOW1mOHkzajJ1bDk3NmZhIiwiTW5lbW9uaWMiOiJncmllZiBhY3R1YWwgaW5wdXQgYmVsdCBicmFpbiB3aW5nIGp1bmsgeW91bmcgZ2VuaXVzIHBhcmsgY2lnYXIgaHVyZGxlIGxlYWRlciBkZWNlbWJlciB0d2VsdmUgbWl4dHVyZSBjb252aW5jZSB1bmZhaXIgZmxhZyBzY3JpcHQgY2hhb3Mgc3dvcmQgbWlkZGxlIGplbGx5In0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWFjMm52eHZ4aHhkaDlrc3U1M2VxdzQzMzg3emM0ajNjNHhrdW52IiwiTW5lbW9uaWMiOiJhbWF6aW5nIGh1bmdyeSBkdXN0IGVycm9yIHNjcnViIG1vcmFsIHdhdGVyIG9idGFpbiBib251cyBwdW5jaCBjbGVyayBicm9jY29saSBwcm91ZCBqdXN0IGNydWlzZSB0dXJrZXkgaWRsZSB0dW5uZWwgc2FsYWQgd2luZG93IHJlbnQgc3RvdmUgc2hhbGxvdyBydWcifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXN2eXQ4OGtrYXNkM213ZnhmcWFnbnk0c21oeHA5a2g0Y2FncjAwIiwiTW5lbW9uaWMiOiJyZWFkeSBsaXF1aWQgbW9ua2V5IGluZG9vciBjYWJiYWdlIHRyb3BoeSBidXJkZW4gcGxheSBhbmdsZSByZXZpZXcgdW5sb2NrIGhhaXIgcGFyZW50IGhhcmQgaGFsZiBuZWdhdGl2ZSBwZXJtaXQgcmVndWxhciB0cmFkZSBmcm9zdCBsYWR5IGZ1cnkgcmVndWxhciBzcXVhcmUifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXZocWNobTlkNnBybWU1enFsdHlzODYwZ3I3YWNka2RodGtnNnJhIiwiTW5lbW9uaWMiOiJpbnF1aXJ5IGxpYXIgaW1pdGF0ZSBzY2FuIHByZXBhcmUgc3RhdGUgZmluZSBjdXJyZW50IHZpcnVzIHBheW1lbnQgc2hvdmUgbm9ybWFsIGRvdWJsZSB2YXVsdCB0cmF5IGhlYWx0aCByZXNwb25zZSB3YXZlIHJlbmRlciByaXZlciBmbGF0IHNraXJ0IGxlY3R1cmUgdGVuYW50In0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWxkcTVrbHhjNmw1cjl5Mnc2NXJ2OGdrbmV4YXNkbjBmZzJwemxtIiwiTW5lbW9uaWMiOiJhZGQgaG9ja2V5IGJvb3N0IGNoYXQgc2lsZW50IGVyb2RlIGZsYW1lIGJhdHRsZSBwdXp6bGUgcm91Z2ggc2VjdGlvbiBiZWVmIGxpZ2h0IGZpbmQgcm91dGUgcmFiYml0IHZvaWQgYXJtZWQgbW9yYWwgcmlvdCBjaGFtcGlvbiBkcmlsbCBoYXphcmQgYm9vc3QifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWR0ZTA4aHNueWowcmt6em1mcnk4ZXplYWFkcGVkeHQ3eTg1N3c2IiwiTW5lbW9uaWMiOiJoaWRkZW4gc3BhcmUgbW90aW9uIG5pZ2h0IGZhdCB0ZW4gb2J2aW91cyBwdXp6bGUgYWRkcmVzcyBtZWxvZHkgamFja2V0IGVsc2UgaW5mbGljdCBhYmlsaXR5IGtleSB2YWxsZXkgZHJlc3MgcG93ZXIgbXVzaWMgYXdmdWwgc29vbiB1bmRlciBzb3VsIGFybW9yIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTM4dnIwY3hqcHhsbGs1YXVhdWM0Z3V3eGxseWd0MzczOG1jcTBwIiwiTW5lbW9uaWMiOiJ0cmFwIGNvdXNpbiBzaGFsbG93IGZpcnN0IHJveWFsIHRvZ2V0aGVyIHZpYWJsZSBiYW1ib28gYm9tYiBvY3RvYmVyIHZhY2FudCBjYW1wIGZyYW1lIGRpc2FncmVlIGN1cCBjaHVja2xlIHN5bWJvbCBtYXRlcmlhbCBhdWd1c3QgYmVzdCBtYW5hZ2Ugcm9vZiBmbGF2b3IgaW5zaWRlIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXIwcDB4eTA3dXhmNngzcDNrZ25yeGN3bjdjNjczY3hlZzJtc240IiwiTW5lbW9uaWMiOiJpZ25vcmUgdG9hc3QgcmluZyBob21lIGFoZWFkIGRlY2VtYmVyIGJpY3ljbGUgbW91c2UgZ2VudGxlIGZsb2F0IG5hbWUgZW1iYXJrIGxhcmdlIGNodXJuIGVtYnJhY2Ugc3dhbXAgZnVybmFjZSBjcmFkbGUgcHVwcHkgYW5jaWVudCBub3NlIGRlc3Ryb3kgb3JkZXIgdmVoaWNsZSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMW13MjlueXVndWFsNjd5d3E5c2N1NGMzNXZuaHdtcG1zampwNW5hIiwiTW5lbW9uaWMiOiJkYW5nZXIgd2ViIGxlbmQgZXJhc2UgaWdub3JlIHRyYWZmaWMgZGV2b3RlIGtuaWZlIGRvY3VtZW50IHNsZWVwIGludm9sdmUgdHJpcCB3aW5lIHNvbmcgZmVhdHVyZSBtYXJpbmUgbWlzZXJ5IGFyZWEgY2FuZHkgcmFkYXIgYm9tYiBkZXN0cm95IHJlbWVtYmVyIHNpdHVhdGUifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWs3dzNkbWdrdG1oc3kwa2xoeTlhazBqcjQ1ajdoMzNra3B5anZ4IiwiTW5lbW9uaWMiOiJtZW50aW9uIGp1bXAgaWRlbnRpZnkgY2FwaXRhbCBtZW51IGNvcm4gY2FuY2VsIHJvYWQgZXF1aXAgZW5kb3JzZSB3aW4gYnVyZGVuIGZvc3RlciBsb3ZlIGNsZXJrIHByb2R1Y2UgZ3JlYXQgdGhlcmUgZ2FsYXh5IGRvbmtleSBzZW50ZW5jZSB0cnVjayBqb3VybmV5IHJvdXRlIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWQ2cWpqZTlzc3c0cTN6dzkzM3g5OXhkZTZrMzQ4bmx6cHcybThoIiwiTW5lbW9uaWMiOiJjeWNsZSBzdHVtYmxlIGRheSByZXNpc3QgYnVpbGQgY290dG9uIHZlcmIgcG93ZGVyIGFjY291bnQgdml0YWwgdmlicmFudCBzaW1pbGFyIGZhbWlseSBhZmZvcmQgc2FtZSBtdXR1YWwgcGVsaWNhbiBiYW5hbmEgYnJvdGhlciByb3VnaCBiYXJlbHkgaXNsYW5kIGF3ZXNvbWUgbHVuYXIifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMW5xcWZmd2xnZ3YyZzR3dWFzenU1M3QycWZjd3E5cHZlNHBtdTRjIiwiTW5lbW9uaWMiOiJwYXRpZW50IHNtYWxsIG11dHVhbCBhcmVuYSBmZXcgYm91bmNlIHRvbmUgYXV0aG9yIGJyb29tIGx5cmljcyBiZWdpbiByZXBhaXIgbWV0aG9kIGJyb256ZSBob3RlbCBwbGF0ZSB3aW50ZXIgZHdhcmYgaGFyYm9yIGNhZ2Ugc3Rvb2wgc25pZmYgc29hcCBleGNsdWRlIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWprMHVyaGRsYWF0enJwZjJzY3l3MmhjeHN5eGVyeHAyazV5ODlnIiwiTW5lbW9uaWMiOiJtaW5kIG1hbmRhdGUgYXNzYXVsdCB0ZXJtIGdsb29tIGJsYWRlIGNodXJuIHZlcmlmeSBicmlkZ2UgZ3JhbnQgYWhlYWQgZGljZSBqZWFucyBib3kgcGljdHVyZSBiaXJ0aCBleHBlY3QgaHVycnkgc2NhbGUgb2JzZXJ2ZSB0aHJlZSBhbG9uZSBtaXggdmVsdmV0In0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXd5d3Y5OTh5emxqcXZmNzNkMGVncm5qejVzdTZubGh1enFrM3plIiwiTW5lbW9uaWMiOiJ0dXJuIGVuZm9yY2UgZmFjZSBtdWNoIHV0aWxpdHkgcGF0aWVudCBhcnQgYnJvd24gYm94IHVwc2V0IGxhYm9yIGVuZG9yc2UgdGFnIGVhcnRoIG9mZmljZSBsb3VuZ2UgZGl2b3JjZSBiYXNlIGdsYXJlIGx1bWJlciB0b2UgdG93biBwaXRjaCBzaXN0ZXIifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXBoeXhnaGN4NGZ5bnZydDR5NG52eW5kenhoMGRyOWZ4N3NrNXA3IiwiTW5lbW9uaWMiOiJyaXZhbCB0d28gbWFyZ2luIGh1bnQgYnVkZ2V0IHdhaXQgdHJpYmUgc3VubnkgcGlnZW9uIHB1bHAgc2hvb3QgdHJlYXQga2V5IGRpc2FncmVlIHVtYnJlbGxhIG9yaWVudCBuYXR1cmUgdG9tb3Jyb3cgbGVjdHVyZSBsb2dpYyByYW5jaCBzaGFmdCBmb3NzaWwgY2FuY2VsIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMW5kejRsNHN1OWRjcWVxcjd1eDR3enJzY3c0dmVoZ2hxNXo4cnBoIiwiTW5lbW9uaWMiOiJ0aW1iZXIgdGVuYW50IHNpbmcgbHVuY2ggc2VlZCBiZWx0IGxldHRlciBydWxlIHNjYXR0ZXIgZmFsc2Ugcm90YXRlIGl0ZW0gY2xldmVyIHNsaWdodCBmaWx0ZXIgZmVlIHRyeSBibG9zc29tIGZsb2NrIGdyZWVuIHVudXN1YWwgbmV0IHNuYXAgYXdmdWwifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWd5dGt5aDJoZHk0YzNqNzJxZGRrMjNjNmNsenV4emszMHRlY3ByIiwiTW5lbW9uaWMiOiJoYXZlIGxhbmd1YWdlIGhvcGUgY2hvaWNlIGZlZGVyYWwgYmljeWNsZSBxdWl0IGFsbGV5IHBhcmsgcGxlZGdlIHJlcG9ydCBhbm51YWwgc2hydWcgaG9yc2UgYWNjZXNzIGZvcnVtIGJsdWUgc29mdCBtaWRuaWdodCBsYXRpbiB3aWZlIGh1cnJ5IGVyb3Npb24gc2VnbWVudCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTVxeXdzOGx2eWRrandsN2VtM2c2ODVjcXZzMGU4amE5NmNjdXRkIiwiTW5lbW9uaWMiOiJub3RhYmxlIGlsbCBkcmFtYSBsdW5jaCBmb3JjZSBib21iIG1hcmdpbiBpZGxlIGZpbmUgdGFzdGUgZGlzaCBub3RhYmxlIHB1c2ggZXhpdCBhaXJwb3J0IGNhc2lubyBzY2hvb2wgY2FnZSBzdHVtYmxlIHRvd24ga2lkIHN1cHJlbWUgYWxhcm0gdGhleSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWN0NDV6a3RnNDd2a3I3a3lyNmVlNG54eWdndzU1c3R4c3ZkN2E5IiwiTW5lbW9uaWMiOiJldmlkZW5jZSBqb2luIHJhdGUgdW5rbm93biBzcG90IHNob2Ugd2hpc3BlciBzZWVkIGNpdmlsIG1haWQgbmVydmUgZG9ub3IgYmFsY29ueSBjcm91Y2ggc29jY2VyIG9rYXkgb2ZmZXIgamVsbHkgYWdlbnQgY3Jhd2wgY2FudmFzIGVsZGVyIHNhbmQgZGF1Z2h0ZXIifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXh5bGEzbjNtY2RnOGdmbHJ4dmR3cG1ycDlhYWQ1eGZmcTY4eDY3IiwiTW5lbW9uaWMiOiJzb29uIGdvc3BlbCBmcmFnaWxlIHNhbG1vbiBnb29kIGVjaG8gcGFycm90IGRpbGVtbWEgc3BhcmUgZmF0aWd1ZSB0d2luIGVzY2FwZSBwYW50aGVyIHRyaXAgZXh0ZW5kIGVuYWN0IGJlYW4gbGVnYWwgYmlydGggY29uZmlybSBlbXBsb3kgY29sbGVjdCBtZWRhbCB2aXRhbCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXNrN2N1YWhxemd2aGRqdWE5djZhcW43eHBkc2c5azVqcWw2ZGx2IiwiTW5lbW9uaWMiOiJwcmlzb24gY2VudHVyeSBwdWRkaW5nIGZyaW5nZSBwcm9maXQgYWxwaGEgZGV2aWNlIGxvY2sgZW1wdHkgYWJvdXQgY3J5IG96b25lIGZlYXR1cmUgdmlvbGluIHlvdXRoIGRlY2lkZSByYXZlbiBkaXNwbGF5IHRhbGVudCB1c2FnZSBsb25lbHkgaGludCBoYWlyIHZpbnRhZ2UifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWw4dXYydXRkZXJmNDczYW14Zno3bGw1djBlNWpnbWtqaGc5MHJyIiwiTW5lbW9uaWMiOiJ2b2lkIHNpYmxpbmcgd2FybSBmZWJydWFyeSBiaWN5Y2xlIGJlaGF2ZSBydXJhbCBjaHJvbmljIGNoZXJyeSBmYW1lIGRpc29yZGVyIHN3aXRjaCBicm93biBzYW1lIGNsaWVudCBnb29zZSBkcmlmdCB0b3NzIGFyZWEgcGVybWl0IGRlY3JlYXNlIHJpdHVhbCBpbmhhbGUgYmlydGgifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWhncXduZzM4MGdka25xdHcza2ZyOXRweXE4em5ldHVrcWdrbTBoIiwiTW5lbW9uaWMiOiJ2aWN0b3J5IHdvcnRoIHllYXIgcmVkdWNlIGxlYWRlciBleGl0IHJhcGlkIHRydWNrIHNjYW4gbWl4ZWQgbGltaXQgbWFyaW5lIGluc3BpcmUgdGVzdCB3b3J0aCByZXBhaXIgY29tbW9uIHNpbWlsYXIgZ2hvc3QgY29uZ3Jlc3Mgc2NhcmUgZmluZ2VyIGFyY3RpYyBkb3NlIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTNkcW05M2poZDI5anJqdjl6eWFxOGtteTk2d3RqcXgycDh5ZnltIiwiTW5lbW9uaWMiOiJzaG92ZSBwcm92aWRlIG1lYXN1cmUgbGVhZiBkb25vciBnb3Zlcm4gcmViZWwgcmV0aXJlIGNvcHkgb25jZSBuYXN0eSBzdWJqZWN0IHNldHRsZSBjcnkgZmF2b3JpdGUgd2VhciBkaXNtaXNzIGFzdGhtYSBrZWVwIGZpbmFsIG1vZGVsIHRyaWdnZXIgbGF0ZXIgYmFycmVsIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXBjN2x3am5rejlrZnNsdmZyOHJrOTk0amh6dmowMDIyeXpoazU1IiwiTW5lbW9uaWMiOiJzbGlnaHQgbGFiIGNyZXcgZGVmZW5zZSBjb2FjaCB1cG9uIGZhY3VsdHkgYXJlYSB3b2xmIGV4cGxhaW4gbWFudWFsIGdvcmlsbGEgbW9uc3RlciBmbGlwIGV4YWN0IGR1c3QgYmxvb2QgdG95IHBsYXRlIHNhbG1vbiBkaXJlY3QgYWdlIGJ1bGIgdG9uZSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWY5c3IyN3Frajk4ZTJ5bXB2MHhjZDJ1Zmsyd2VqbGRsZnpmNHc3IiwiTW5lbW9uaWMiOiJjYW1wIGdhdGUgZ2lhbnQgbWFjaGluZSBwdW1wa2luIHNpYmxpbmcgaHViIHVuaWZvcm0gbGljZW5zZSB1bmRlciBjdXJ2ZSBsYW5ndWFnZSBkZXBhcnQgYXNzdW1lIGFtYXRldXIgZ3JvdyBkaWFsIG11dHVhbCByaWIgdm95YWdlIGdvZGRlc3MgY3JlZWsgYXNrIGNhc2gifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXkwOWM0cmhndDJybWxjenhld2c3eTQ4cmp4aG1qZXM2NTc3dmRzIiwiTW5lbW9uaWMiOiJweXJhbWlkIHJlbmV3IGlsbCBzdG9jayBtYXJibGUgbnV0IGdvcmlsbGEgZGlydCBleGhhdXN0IHNoYWRvdyBjb3JuIGdvc3BlbCBpbnNpZGUgbnVyc2UgZWFydGggZm9vZCBwYXRoIGJ1eWVyIHNhdG9zaGkgY3JhZGxlIHBpZ2VvbiBsZWFmIHNlYXNvbiBzY3J1YiJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTk0ZHZmN2F4ZjB4MnB1cG01ZXh0ejIyd242dWtmNGZrNWozZGhnIiwiTW5lbW9uaWMiOiJ0b3VyaXN0IHVuaWZvcm0gc2tpIHN1cnZleSBpbm5vY2VudCBvYmxpZ2UgZm9yY2UgYmVjb21lIGFjcXVpcmUgcmVtYWluIG11c2hyb29tIGJhbGNvbnkgY2hhcmdlIG1hc3RlciBjaGVlc2UgZW1wbG95IHJpZGUgYmFyIHJvYnVzdCB0aW1iZXIgc29jayB0b3VyaXN0IHVwcGVyIHJlc2lzdCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTQ1dTV3bnZnNXlzd3hqcmx1bXhsbmpjaDJxZndyMjUyem1yZGVqIiwiTW5lbW9uaWMiOiJiZXR3ZWVuIHRyYW5zZmVyIGxpZmUgcm91Z2ggc3RvY2sgaW5oZXJpdCBvdXRlciBza2F0ZSBhbmNpZW50IHRoZXkgYmluZCBjdWJlIG92ZXIgbXlzZWxmIHJlY3ljbGUgc2Vzc2lvbiB2ZW50dXJlIGJvaWwgZW1wdHkgbG9jayBicmVhZCBleHBsYWluIGFyZ3VlIG1hZCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWw1bHE1dTh6emc0Z2dyc2Y5ZmdxbDJsODBscjhxYWRmY3F5MGFuIiwiTW5lbW9uaWMiOiJweXJhbWlkIGd1biB2YXBvciBkZXBlbmQgcHVtcGtpbiBwZW4gY3JlZWsga2V0Y2h1cCBjYWxsIGJvb3N0IGNhcGFibGUgbmFwa2luIGF1ZGl0IGFtdXNlZCBzb2x1dGlvbiBsaXR0bGUgbWFwbGUgb2NlYW4gaGlsbCBsb29wIGxpbmsgZ2FsbGVyeSBib3ggc3RlcCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWFkbXdkMjQzbmo0Zmo1MGZsOHcyY2hqdnZucjZqbmduMno5NHkwIiwiTW5lbW9uaWMiOiJsZWdhbCBoZWFydCBva2F5IGFpcnBvcnQgYWdlIGhlZGdlaG9nIHNsZWVwIHJlcGVhdCBhY2N1c2Ugc3ltcHRvbSBmb3N0ZXIgYmluZCBkcmlsbCBjcnVtYmxlIGVmZm9ydCBmbG9jayBtYXJibGUgY3Jvd2QgZ3J1bnQgZ3JhYiBvcmlnaW5hbCBlc3RhdGUgYWRkcmVzcyBwdXNoIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTh5eGo2M3kwdXhtM2U5dzl4ZGE0cGxodzAyZnU4MDA1M2FtenU5IiwiTW5lbW9uaWMiOiJtZW50aW9uIHBsYXkgYmF0dGxlIGxveWFsIHVuZm9sZCBmb3VuZCBjZW50dXJ5IGVuZCBjb21lIGNsdXRjaCB3YWxsIHdvb2QgZW5yaWNoIGVxdWlwIGFybW9yIGJvbnVzIGhlbiB2aWRlbyBtb3JhbCBkb2xsIGFuZ2VyIHNraXJ0IHNvZGEgc2F2ZSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTczZHQydTdnOW1udWU4amZnamN3ZzZucXA2NjJsdTRjNm0zcHlsIiwiTW5lbW9uaWMiOiJjb25kdWN0IGludGFjdCBhaXNsZSBjaGFvcyBxdWFsaXR5IHRoZW9yeSBjaHVuayBqdWljZSBjcnVpc2UgZmVlIHJpcHBsZSBsaW1pdCBnYXVnZSBmb3Jlc3QgY2hhbmdlIHNhdXNhZ2UgZXh0cmEgYWxwaGEgdXNhZ2UgZXhvdGljIGRyaWZ0IGJyYXNzIGdvcmlsbGEgdGFzdGUifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXBsenR3Z3Qzc2c1dmszbHNtbGtsOTV1cmw1ZDR0bGd4Y3RkZGU5IiwiTW5lbW9uaWMiOiJvYmplY3QgYmFyIGNhbG0gbXl0aCBmZWUgdG9vbCBmaW5nZXIganVuZ2xlIHNpbXBsZSBiYWcgem9uZSBjaGFzZSBzY2hvb2wgYmVuY2ggYmVsdCB0aW1lIHdlYXRoZXIgZXhwcmVzcyBhZmZhaXIgc2NpZW5jZSB2ZXJiIHJlY29yZCBpbnRhY3QgZGFyaW5nIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWhsZDhrYTBxaDY3ZjJuNWV4bXplY3RlNjRhd3VkNTNkMGY3bnhhIiwiTW5lbW9uaWMiOiJob2xpZGF5IGxpdHRsZSBwb2xhciBzdWRkZW4gY29uZmlybSBzb25nIGRpYW1vbmQgcHJpZGUganVzdCBkb3ZlIG5vYmxlIGZhdm9yaXRlIGNlbnR1cnkgcnVyYWwgZmFpbnQgYWxpZW4gYWN0dWFsIGhvbGUgZHJpZnQgcG9vbCBhcnJhbmdlIGFscGhhIGJvdHRvbSBlbnRyeSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXc2YzBleW56Zm5zd2RhNXpnOHRta3hrem1sbjNkZHY3cGd5enZ0IiwiTW5lbW9uaWMiOiJ0b25pZ2h0IGZpbGUgZGVmZW5zZSByZW5ldyBjb2lsIHVuY2xlIHBpZyBub2lzZSBibHVyIGVsc2UgZ2xvdmUgcmVtYWluIHJ1ZyBjdXJ0YWluIGNvbmZpcm0gb3JkaW5hcnkgYnVpbGQgY3J1c2ggY2FyZCBsZWF2ZSBmbGF0IGp1bmlvciBkZWJhdGUgd2F0ZXIifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWxybTB1dXM5Mzdxeng4Y3hnNXNmNWo5Z2VnanFmd3B6dHAydWd6IiwiTW5lbW9uaWMiOiJzdGF0ZSBvcmNoYXJkIGZ1biBlY29ub215IGxhZGRlciBvY2VhbiBmb3ggYm95IGN1cmlvdXMgYWxidW0gdGVzdCBzdGFpcnMgcG9ldCBlaWdodCBiZXN0IHN0cmVldCBhdXRob3Igc3Bpa2UgdGlueSBmYW4gc2F1c2FnZSBub3RhYmxlIGNydW5jaCBzaG9ydCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTNobDdteGN0Y3QyZ2w2cDlnZTc2c2VjZDBtNG14dmp4ZGZmdWQ4IiwiTW5lbW9uaWMiOiJidWxsZXQgZ2lybCBtYXNrIHNhdXNhZ2UgdHJvdWJsZSBhZmZhaXIgcHJlc2VudCBvdmVuIGRpZXNlbCBlcm9zaW9uIHByb2dyYW0gY2hpbW5leSBsYXB0b3AgcGhvbmUgc291cmNlIGh5YnJpZCBidWJibGUgc2hpbmUgaGludCBzdXJ2ZXkgdG9ydG9pc2UgdmF1bHQgcGlhbm8gdGVuYW50In0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTI2M2ZkbjQ0dnQwcjBzeWN0MGh1NXMzeTZmeTVsYzIycWN6ZHNyIiwiTW5lbW9uaWMiOiJwYXRjaCBhbmltYWwgZGVicmlzIGltbXVuZSBhcmVhIGRvY3RvciB1dGlsaXR5IHJpYmJvbiByZXZpZXcga2l0dGVuIHByb2dyYW0gY2l0aXplbiBtb3RoZXIgYWxtb3N0IGRlZmluZSB3aGVlbCBhYm92ZSB5ZWxsb3cgdHVpdGlvbiBpZGxlIG1vcmFsIG91dGRvb3Igc3B5IHdpbGwifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTQ4a2NhamY1dzZnZW04dmE5dmhncDl5Nmxxa3JmdXN2Z3Zqc2R6IiwiTW5lbW9uaWMiOiJtYXRyaXggYnVkZ2V0IGNsYWltIHJldGlyZSBnb2xkIGluc3RhbGwgdHJhdmVsIHN0dW1ibGUgbGF0ZXIgcmVzb3VyY2UgY3Jpc3AgY2xhcmlmeSBza2F0ZSB0b3Agc3BvcnQgZ2VucmUgbWFuYWdlIHNvYXAgZnVuIHRyaWdnZXIgZmluZ2VyIGJvcmRlciByZWFkeSBmb3JjZSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWRlY3M1bHY3OHV0a2V5aHUzc2h6N3cyaGd2MDhmOXk1dm03M2V4IiwiTW5lbW9uaWMiOiJwb29sIHNtYXJ0IGNpZ2FyIG1ldGhvZCBkaXp6eSB0YWxrIG1hbmdvIGJpbmQgd29vbCBicmFja2V0IGZpeCBlYXJseSBwZWFyIGVudmVsb3BlIGFlcm9iaWMgZXZva2UgdHJpZ2dlciBpbmNvbWUgbXlzZWxmIGhlbiBiaXJkIHBvc2l0aW9uIGhvbmV5IGFtb25nIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTJ2cXR0dmo5eDAwZW1kYXJxODk2eXJmMmFwYXN4Z3prZnJqOHJmIiwiTW5lbW9uaWMiOiJhZG1pdCB1c2FnZSBjb21wYW55IHJlY2VpdmUgcGF0dGVybiBjcnVlbCBzdW5ueSBuZWVkIGltcHJvdmUgbWlub3IgZGFuY2UgZXNzZW5jZSBzaGFsbG93IGVhcnRoIGlucXVpcnkgbm9vZGxlIGtuZWUgcmVzaXN0IGNvbWJpbmUgdm9pY2Ugc25ha2UgZGl6enkgbWFuIHBpYW5vIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWdkczR5NzRka3owY2pwdWRuZHM2MDY1Zzl4Mng4NHpxbmo2OWNjIiwiTW5lbW9uaWMiOiJ0b2RheSBxdWFydGVyIGludGFjdCBoZWFydCBtb3VzZSBncm91cCBleGN1c2UgbmVhciBmaWxtIHNob2Uga25vdyBjb21pYyB0cm9waHkgcmFpc2UgZm9zdGVyIHN1Z2dlc3QgbWF4aW11bSBvY3RvYmVyIGRpcnQgYXJteSBjdXJ0YWluIGVydXB0IGF0dGVuZCBmb2cifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTVmdHZyNWV0dXRocHN0aHJyOWN0M3I0NWFwZ3dqN2tncmM4eGRkIiwiTW5lbW9uaWMiOiJ0aGFuayBmbHkgZGl2b3JjZSBzaHJpbXAgbGFrZSBzaWxrIGd1YXJkIHN5c3RlbSBjYXJ0IGVtYnJhY2UgZWRpdCBwYXBlciB0aWx0IHJpc2sgYmV0dGVyIG1vdG9yIHRvcnRvaXNlIGFjcXVpcmUgZWNobyBmb29kIG9yZGVyIG1hbW1hbCB0d2VsdmUgdm9pY2UifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMW4wMDhycGt5aHlyZHA5c2Z2ZDYyd3p0cHhseXU0eGc5YTVnanR2IiwiTW5lbW9uaWMiOiJjYXNlIGxlc3NvbiBzdXJmYWNlIHNjaXNzb3JzIGNpdmlsIHNvcnJ5IG5lc3QgZXRoaWNzIG1lc3NhZ2UgaG9ybiBhZmZhaXIgZGVtaXNlIGJsb3Nzb20gbXVmZmluIGRyaWZ0IGZhbWUgYmluZCBzaGFyZSBtaWRkbGUgc3BvbnNvciBkZW55IHByZXBhcmUgbGlnaHQgc2hpZnQifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXhkdXc0YWFuanNteXIzZ2s4OGt2OXVjNHA4eG1lbGQzcWxsOXJxIiwiTW5lbW9uaWMiOiJydWRlIGJhc2tldCB0dXJrZXkgZWFybiBpbnNpZGUgYmVjb21lIGF3YWtlIG1vdmUgbGF5ZXIgYmFycmVsIHBlbmNpbCB1bmRvIGxhYm9yIGF2ZXJhZ2UgZHVuZSBjaGFuZ2UgYmFyZ2FpbiBwcmV0dHkgbGl0dGxlIGx1Y2t5IHN1aXQgcmVnaW9uIG1lbW9yeSBsYXp5In0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTU4NXA1ZzMyeHZ5N21weDA3eGhkeWF3NHZnZXN2YzRjZ3l5dThsIiwiTW5lbW9uaWMiOiJwYXRjaCB1bmxvY2sgdGhlcmUgY29weSBzaWxlbnQgcmVhZHkgcHVuY2ggdmVyYiBhZ2VudCBpbnZlc3QgbXl0aCByZXZlYWwgZHVuZSBsb25nIGNoaWxkIHN1bnNldCBrbmlmZSBzbWlsZSBtYWQgcm9vbSBtZXJjeSBhdWd1c3QgZ3JhY2UgcmVzb3VyY2UifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXprNWtkNXA2Z2xlOHJsdzVqZ2huaDh2aHI2ZWNuYXdqbXpucHN3IiwiTW5lbW9uaWMiOiJlY2hvIHdpc2UgY2hhdCBkb2xwaGluIGhhcHB5IG5leHQgdGltZSBmaWN0aW9uIGlkbGUgZmxhdCBwcm9maXQgYXJyb3cgZGlmZmVyIGJlaGF2ZSB0YXN0ZSBmbGlwIGNyb3AgZ2xhbmNlIGNvbmdyZXNzIGZldGNoIGNhcnBldCBzcGljZSBzdGVyZW8gZXZpZGVuY2UifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWY0MDU0azYwZjY5eXVtZnh6ZWc5dmNlbTRzeTByZWQ2cTRza2R5IiwiTW5lbW9uaWMiOiJqYXp6IG5hbWUgYmx1ZSBhbGJ1bSBhc3NldCBjaW5uYW1vbiBwZW5hbHR5IHJ1cmFsIG1hcGxlIGhlYWx0aCBzaWxseSBmbG9hdCBob3Jyb3Iga25pZmUgY2FuYWwgY3ViZSB3aGF0IHRvcHBsZSBlbXB0eSBqZWFucyBzcGhlcmUgYWdyZWUgYmxpbmQgdHJheSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTMwcjNwNG1nOWg1Z3FnanZ5d2hyazh3MDMwOXdkZzl6MmR1Z3ByIiwiTW5lbW9uaWMiOiJjb2FjaCBzZWdtZW50IHBhcnJvdCB1cmJhbiBjbG9jayBleHByZXNzIGp1ZGdlIGRhbWFnZSB2b3lhZ2Ugd2VhciByb3VnaCBoZWFydCBsaXF1aWQgZ3J1bnQgc29jY2VyIHBvaW50IGlkbGUgdGlkZSBzYXRvc2hpIGdpcmwgYmFnIG1hY2hpbmUgaW1wb3NlIGJyb3RoZXIifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXdnNWdjZHg0ZTRoemRwenpkajNuM2hneTNqZHlkbDI1ZGFrbWVlIiwiTW5lbW9uaWMiOiJrbmVlIGNyaXRpYyBwcm92aWRlIGRvZyBvc3RyaWNoIGxhd3N1aXQgYm9uZSBzbWFydCBwcm9qZWN0IGluZGV4IGZhaW50IHNwb2lsIGRlY3JlYXNlIGV4aWxlIGNhdHRsZSBodXJ0IGJsYW5rZXQgYXJ0d29yayBkcnVtIHdhZ29uIHNvdXRoIHVwb24gb3JiaXQgcGhvbmUifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTVnZjNnZTZ5cW55cjJneHRyNHo3dXI3dnpuN3NsNzZ2NnB0NTJ1IiwiTW5lbW9uaWMiOiJjdXAgY291bnRyeSB0cnVtcGV0IGFjdCBhc3RobWEgdXBwZXIgaW5wdXQgd2FsbnV0IGZsYWcgcHJhY3RpY2Ugc3RhYmxlIGN1dGUgbWlsbGlvbiBmaWd1cmUgbGFkeSBkaXJ0IHNoYXJlIHByZXZlbnQgb2ZmIGFkanVzdCBzdGluZyB0b3JuYWRvIGd1biBqdW5nbGUifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXE4c214aDRtY3BlcDNucWE0bHMyd2p3eXlxOXo3cmdhemhxZ2c1IiwiTW5lbW9uaWMiOiJlY2hvIGJhc2UgY2FiYmFnZSBleGhpYml0IGluamVjdCBpY2UgY3JlZGl0IGhhdCBzdGVhayB3YXJmYXJlIGRlc2lnbiBqZXdlbCBjaHVuayBzdGVlbCB1bmRvIGVucmljaCBrZXRjaHVwIHNpeCB0aG91Z2h0IGplYW5zIG11c2V1bSBzZWN1cml0eSBlbGJvdyByb29mIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTk3ZHhmNzMyd3c1M2RwdXl4em4wcThjZ3d0Z3ZmeHZ1dnprZGw3IiwiTW5lbW9uaWMiOiJwaWxvdCBhYmFuZG9uIG11c3QgcmFpbiBkZXNrIGdsb3cgd29ycnkgc2VtaW5hciBncmFpbiByaHl0aG0gZGF3biBsaXF1aWQgd2lsZCBlbm91Z2ggZm9zdGVyIGVuam95IHdyZXN0bGUgZXllYnJvdyBpbnZlc3QgcmVsYXggYmFyIHByb3VkIHN1YmplY3Qgc3R1ZGVudCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTJnOGQ2dnhnbXNybGd4bXZqeHI2Y2R6dTdqYzQ0aG11dXptNTBmIiwiTW5lbW9uaWMiOiJjbGVhbiBub21pbmVlIHByb29mIGJvbWIga2lkbmV5IHByb2JsZW0gd2lsZCBpc29sYXRlIGhhcmQgYmljeWNsZSBzdXJ2ZXkgbm93IHJlZ3VsYXIgZGlyZWN0IHN1bm55IGNvbmdyZXNzIGFibGUgam91cm5leSBwb3dkZXIgZmF1bHQgbW90aW9uIHRhY2tsZSB2aXZpZCBqb3VybmV5In0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTJsNGVzcGFsZ3NxZTk4czRzMnd4dmdhY3BhaDNyMnRxZTNneXF4IiwiTW5lbW9uaWMiOiJjbG9nIGxhYiBkb3VibGUgc2VjdGlvbiBkaXp6eSBicmFpbiBpbnRhY3QgZGV2ZWxvcCBtb2RpZnkgaGVkZ2Vob2cgdG93ZXIgc2x1c2ggY2F1Z2h0IGRpdmlkZSBzcGFjZSBsaXR0bGUgdGFzayB0ZXJtIGF0dHJhY3QgbWlkZGxlIHNoaWZ0IGNsdWIgY3VsdHVyZSBodW1hbiJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXgwYXlwYW10ZjN5bjRmbHQ2NjN2dmN0Zmd4d24yZnRucWozM2dzIiwiTW5lbW9uaWMiOiJiYWJ5IGJvcmluZyB3YWdlIHF1YWxpdHkgY2xpbmljIHNpZGUgYWZyYWlkIGtpbmQgd2FsbCBpbm5vY2VudCBzdGluZyBpZGVudGlmeSBjdWJlIG5pY2Ugc2xlZXAgcmFuZ2UgZmVlZCBjYXNpbm8gc3R1bWJsZSB1c2VmdWwgZWRpdCBob3N0IGZyb3N0IGJsaW5kIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWVtZ2ZjZWM4N3o1dXV0MnA5ZHFsYTVtNncwZ3luNzc4eHdwOTN0IiwiTW5lbW9uaWMiOiJidXJzdCBzaWNrIHR3byB0cnVtcGV0IGRyaWZ0IGJvdHRvbSBzaWJsaW5nIGNsb2NrIHllbGxvdyBtYXhpbXVtIGtpc3Mgc2hvY2sgaGVpZ2h0IHRlYWNoIHNhbHV0ZSBpZ25vcmUgY2F1dGlvbiBlYWdlciBmaW5kIGFwb2xvZ3kgc2F0b3NoaSBzcG9vbiBzYWRuZXNzIG1hdHRlciJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWh2Y3Nmc2xzZXQzcXI0ODRocGxuN3FhY2x5cnpyZXc1ejcyd3d0IiwiTW5lbW9uaWMiOiJhaXNsZSBpbnB1dCB0ZW4gZ3JlZW4gbWFuYWdlIHZpYnJhbnQgZmFtZSBidXNpbmVzcyBibGluZCByYWNjb29uIHNsaW0gdHJhaW4gYnVzaW5lc3MgZW5nYWdlIGRlc3Ryb3kgaW1wb3NlIHBsdWcgcG90YXRvIGFib3ZlIHZlc3NlbCBhdmVyYWdlIGFncmVlIHN0ZWVsIGNhdGFsb2cifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWxqNmhnaDkzamRjZ2c5NGowNWtnc3ZuYzl2OTd3c3BlcXRjNHU1IiwiTW5lbW9uaWMiOiJiYXR0bGUgYm9udXMgbnVyc2UgYWRkcmVzcyBzZWxsIHRvb3RoIGxhcmdlIGN5Y2xlIHB1ZGRpbmcgZXJhc2UgZGVwb3NpdCBtZWFkb3cgb2JzY3VyZSB0YWcgYWN0IGJhbGwgYXR0cmFjdCBjb3lvdGUgcmVwbGFjZSBpbm1hdGUgb3Bwb3NlIGFyb3VuZCByYXZlbiBwYXBlciJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXhobTVyNTRobHR2M2FzM2hna3d0cW5xdXUybXE0bXdyZ3B6anpzIiwiTW5lbW9uaWMiOiJuZWl0aGVyIGdhbGF4eSB2aXJ1cyBwbGF5IHN1biBiZWxpZXZlIG9ycGhhbiBmaW5nZXIgYnVsayBzaG9jayBsZWcgY2FwdGFpbiBicnVzaCBzcGluIG1pZG5pZ2h0IGx1Y2t5IHVnbHkgcmV1bmlvbiB3ZWVrZW5kIHdvcmQgYnVkZ2V0IHZhbiBzY3JlZW4gc2xlbmRlciJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXN4Nm5oZXNsa3RrczV3cXRlOThhYWhxbnVsZGNseG5sZ3ZtdHRtIiwiTW5lbW9uaWMiOiJjYXN0bGUgZW5nYWdlIHNoaWVsZCByb29raWUgY2hlZXNlIHB1enpsZSBiZXR3ZWVuIGZlZWQgbGlvbiBhY2N1c2UgYWhlYWQgY2FudmFzIGltYWdlIGluc3BpcmUgb21pdCBtb3JlIGNyYW5lIGRyYXN0aWMgc3Rvb2wgYmVjb21lIGhvbGUgcGx1Y2sgY29yZSB0cm9waHkifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXE3cDdlYTQ2bGZkaGU0cncycThucGM1cGh2bTJhY2x5bm0wM3R0IiwiTW5lbW9uaWMiOiJhc3N1bWUgdmFuaXNoIHVwcGVyIGdvZGRlc3MgY29taWMgd3JlY2sgdGVhY2ggd3Jpc3QgbWlzZXJ5IGd1ZXNzIHJlbnQgaGF3ayB0ZXh0IHNhbG1vbiBlcXVpcCBnZW51aW5lIGJsdXNoIHZlcmIgY29pbCByb3V0ZSB1cGdyYWRlIGJhZGdlIHN1bm55IHNwZW5kIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMW12d3loN2x0NnI5NXJseHBoN3UyMnB3OTZnemp1MDcwZHNycGd3IiwiTW5lbW9uaWMiOiJyYWJiaXQgd2F0ZXIgcGVuY2lsIHRvcm5hZG8gbmFycm93IGV4YWN0IGVuZG9yc2UgZmluZSBnaXJhZmZlIHB1cGlsIG1vbmtleSB2YWNhbnQgd2VpcmQgb2N0b2JlciB0aG91Z2h0IHN0ZWFrIGRlcGVuZCB2b2x1bWUgbmFzdHkgdG9iYWNjbyBzbGVlcCB3ZWFzZWwgYmxvb2QgdGFpbCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWF3M2twcXV6Z2x0c2F1NTRoOWtxZGxuaG1ldjVkNmNudnM1a25rIiwiTW5lbW9uaWMiOiJwb3RhdG8gc3dhcm0geW91dGggY2FzdWFsIHVzZWxlc3MgZ2FyZGVuIGRheSBzZXR0bGUgdG9wcGxlIGZsb2NrIG9idmlvdXMgcmViZWwgYnJpY2sgdmV0ZXJhbiBnbHVlIGZyZXF1ZW50IGJlaGF2ZSBzZW50ZW5jZSBjb29sIHN1cmdlIHVuaWZvcm0gYXR0ZW5kIG1lbnUgZGV2aWNlIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXV3OGwwcHFqNGxxZGFqbnN3NHB1bTd4dHR3c3E0azNqYXh3NnZqIiwiTW5lbW9uaWMiOiJtb3JuaW5nIGZsYXQgb3duIGJhcnJlbCBmcm9nIHNpeCBpbm1hdGUgY2xvd24gcHVkZGluZyBuZWdhdGl2ZSBleG90aWMgaG9ycm9yIHNoZWxsIGNyaW1lIHJpdmFsIGJlc3QgYnJva2VuIGNsaWNrIHN1bnNldCB0YWxlbnQgY2FibGUgZW1wb3dlciBhcm1vciBoZWFkIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXU5dDdjcXJwY3R2bHB5ZGRtMnBkbHJwNm45bDA4bWVyMjd1aHQ4IiwiTW5lbW9uaWMiOiJsZXNzb24gY29yZSBkaXNhZ3JlZSBkaWFsIHNhZCBoaXJlIG1ha2UgbGF0ZXIgZW52ZWxvcGUgaG9tZSBiZWF1dHkgYmVhY2ggYWZmYWlyIHZvdGUgdHJpYWwgZnJvd24gcmF0ZSBjYXN0bGUgcmVjZWl2ZSBvY2N1ciBodW1ibGUgd2VsY29tZSB1bnZlaWwgdW5rbm93biJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXY4aHQwNThyOGM2czJlaGE2bjQyeDZueHBrZnE3cjJ3NjhnejlnIiwiTW5lbW9uaWMiOiJjb29sIGdvc3BlbCBkaXNoIG1ha2UgaGFyZCB3aXNkb20gYmVhY2ggdmlkZW8gYmFyZWx5IGNhdGNoIHNvbGFyIHN0ZXJlbyBmdW5ueSByb2FkIGFubnVhbCBib251cyBnYXRlIGFkanVzdCBsdW5jaCBmbGF0IGV4aXN0IGZldmVyIHN0cm9uZyByb3V0ZSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMThoeWg0bnk5Nzh2bTQ3YXN4eXluM3VxeDNkOXJkaDN1aGx1a2hoIiwiTW5lbW9uaWMiOiJjYW1wIGJpZCBtYXplIG9seW1waWMgYmFsYW5jZSBzaWRlIGd1YXJkIHNwYXRpYWwgYXJyZXN0IG1lcnJ5IHBsYXkgc3VtbWVyIGdhdGUgbXVzaHJvb20gc2NpZW5jZSByaXBwbGUgcmVqZWN0IHRvcnRvaXNlIGZsb2NrIHN3YWxsb3cgcnVuIGNodWNrbGUgZWFnbGUgcmVmb3JtIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTZmZWRtOXpxMnBndnU1NXczZ2Z0NWRqcWNsa3Vubnc5NHBzZ2RlIiwiTW5lbW9uaWMiOiJ3aGFsZSBiYXJnYWluIGRpdmVydCBzb29uIGVyYXNlIGxvbmVseSBjbG90aCBidWRkeSBzY2llbmNlIHZhcG9yIG1pc3MgcXVvdGUgZml4IGxvb3AgZmllbGQgY2hlY2sgaGlzdG9yeSBwbHVjayB0b2RkbGVyIGltcHVsc2UgbWlyYWNsZSBiZWx0IHBvb2wgaW1tdW5lIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTRuMmU5bWN4dHZxN2xoeWNmZWhrc2YzYXYzMnJ2dTl5d3ZsMjcwIiwiTW5lbW9uaWMiOiJidWxiIGdhcmFnZSBhZGRpY3QgYXJjdGljIHN1YmplY3QgcmF2ZW4gdG9vbCBoZWxtZXQgY2FwYWJsZSBjb3VwbGUgYmFzZSBpbnZlc3QgYmVnaW4gY2FsbCBmYXRpZ3VlIGFsdGVyIGVhc3kgdXNlbGVzcyBnZW5pdXMgdW52ZWlsIGJlZWYga2luZ2RvbSBjb252aW5jZSBkYW5nZXIifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXlwcXk0dHN1NHUwZHhnM2d6OTdyNmtxY2dmNjg0dWN4cGptbWxhIiwiTW5lbW9uaWMiOiJsYXB0b3AgcHJvY2VzcyBub3NlIHRlYWNoIGJhcmVseSBqZXdlbCBpbml0aWFsIGF2b2NhZG8gZGlubmVyIGNoYWxrIHRyYW5zZmVyIG5lYXIgc3dpdGNoIGNhYmJhZ2UgYWJvdXQgY2hhbGsgY2hhaXIgYXNwZWN0IGd1biBsaWJlcnR5IGhvb2Qgc2VsZWN0IGJyYW5kIGthbmdhcm9vIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTByZmwwOG5heWRjZnc4cWtnNmNjdXB6YWRrdGVlZXRkMmx1NmpzIiwiTW5lbW9uaWMiOiJ0d2luIGdsYWQgc2VydmljZSBmaWd1cmUgcm9hc3QgY3JlZWsgb3lzdGVyIHB1bGwgY2xheSBhdXRvIGNsb3VkIGtldGNodXAgYm91bmNlIGZpZWxkIGdlbnRsZSBncmlkIGJyYW5kIHN0YWdlIGhlbG1ldCBzcGF0aWFsIHNwb2lsIHRleHQgY2FydCBzcHJpbmcifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTBhZTI4bDNua3FtN25saG5tczBwNnc4OHEyYWdzNWd1MHNrNjZ5IiwiTW5lbW9uaWMiOiJyZWd1bGFyIHdvb2wgb3JhbmdlIGlzbGFuZCBzaXJlbiB1bWJyZWxsYSBjcnVpc2UgYWxsZXkgdGlkZSBmbGlwIHNsYWIgdmVyaWZ5IHNob3VsZGVyIHR3aW4gbWV0YWwga2l0dGVuIGN1cGJvYXJkIGFjcXVpcmUgYWJsZSBzdXJmYWNlIHRlbGwgdW5kbyBiZXN0IGxlZ2VuZCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWxoNWhjeG1nOWNna3Bkcm10NzZkeXJheGtwdzhndDR3aHR3ZnQ1IiwiTW5lbW9uaWMiOiJ2b2xjYW5vIGJyb256ZSBzcHJlYWQgbnVtYmVyIHdlYWx0aCBkZWZ5IGNpdGl6ZW4gd2luZSBlZmZvcnQgbmV4dCBoYW1zdGVyIGJldHRlciBsb2NrIHN5bXB0b20gaHVzYmFuZCB1bmlmb3JtIGhvdXIgdmF1bHQgcGl0Y2ggd2FzcCBzd2lmdCBpbmRpY2F0ZSBhZXJvYmljIHRvd2FyZCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWZhNjA0bTdoa3NucXZoc2YydWpjbHFqZ3k1cDIwdXU1c3FoMHltIiwiTW5lbW9uaWMiOiJ3ZWFyIGJhbGwgaW52b2x2ZSBndWVzcyBzcG9uc29yIGVwaXNvZGUgZmljdGlvbiBjcmltZSBib3JpbmcgbWF0aCB3ZWIgc2NlbmUgYm95IGZsaWdodCBhY3RyZXNzIGltYWdlIG1hbnVhbCBxdWljayBtZWNoYW5pYyBiZWNhdXNlIGdyb3cgcnVkZSBub3JtYWwgYW50aXF1ZSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTNwamZ1YWd3MnRlZDBhbjVhcWhtdDJsOGhrM3Q2YTk1czcyZzV5IiwiTW5lbW9uaWMiOiJzbG93IGRlZmVuc2UgZHJ5IGNyYW0gbHVtYmVyIGdpYW50IGRhdWdodGVyIG1ldGFsIGJyZWV6ZSBmb3J3YXJkIG5ldCB3b2xmIGZsYW1lIGRhbXAgcGxhY2UgdHdpc3QgZWxpdGUgcHJvb2YgZWFybHkgcG90dGVyeSBzb25nIGNveW90ZSBsaXphcmQgc29tZW9uZSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTgwODJnZzU3dHlwd3ZxM2N0YWNhZzljcWg5ejJqZjdkbDJzeDlhIiwiTW5lbW9uaWMiOiJsb3ZlIG1lbHQgZ3JpZCBzaGFsbG93IGZhY3VsdHkgdG9zcyBzdXJyb3VuZCBpbWl0YXRlIG5lY2sgY2F0IGJhc2ljIHNsaWdodCBqYWd1YXIgYWNyb3NzIGdpdmUgYWJzZW50IHJlZ2lvbiBncmF2aXR5IGVuZG9yc2UgYnJpZ2h0IHNpbXBsZSBvY3RvYmVyIHJldW5pb24gc3RvcnkifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWxqd3Jsczg3MnB4MnEwNWFyZmdrazZnajQ0YXBxOHM1ajk5Z3Q1IiwiTW5lbW9uaWMiOiJzY291dCBtb2JpbGUgcmVjYWxsIG1lbWJlciByYWxseSB0aWx0IGNhcmQgaW50byB1bWJyZWxsYSBmZWVkIHZlcnNpb24gbm92ZWwgZ2lyYWZmZSBoYW1tZXIgem9uZSBrZWVuIG9yaWVudCBoYWxmIGRpc2FncmVlIGJlYWNoIHBvZXQgaW1wYWN0IGRpbm5lciBtYXNrIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTVzYTc4eTRkZ2tlc3oyN3k5bTZyNDByMDBzZTdtd2h5MjU2dGxoIiwiTW5lbW9uaWMiOiJnb2RkZXNzIGZpeCBjcmFuZSByaWdpZCBjYXN1YWwgd2hlYXQgc3ByYXkgY3JlYW0gY29pbiBsZWFmIGRpc3BsYXkgaHVyZGxlIGVuc3VyZSBhcm1lZCBjb3JyZWN0IGJ1bmtlciBpZGVudGlmeSBkb25hdGUgc3Bpa2UgZmFudGFzeSByZWxpZWYgZGlzYWdyZWUgZ3JhcGUgc2hvdWxkZXIifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTN6OWNteHVrdzdoaHYzNXgweDU0YXZhbXJuOXA2NWF0cGcybmR4IiwiTW5lbW9uaWMiOiJtb25zdGVyIGxhbmd1YWdlIHZvY2FsIGZseSBtYXJjaCBqb2tlIG5ldXRyYWwgamVsbHkgY2h1cm4gZ29kZGVzcyB3ZWFyIGNhbG0gdmFsaWQgbm93IGF1dHVtbiBsaWFyIHdhbnQgc3Bvb24gZ2xvb20gaGlnaCBqdXN0IHNvbWVvbmUgbWFudWFsIGVuZXJneSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTZjdTB4cTRyeDhlZWZqN3BrMmY5cHJmcmttejhtM3g1bWtyNjZyIiwiTW5lbW9uaWMiOiJtb3JuaW5nIG9mdGVuIGxhdGVyIGVjaG8geW91bmcgZGlsZW1tYSB1bnZlaWwgc3Vuc2V0IGdsYW5jZSBzaG9wIG9ic2VydmUgZXhwaXJlIHN0YWdlIG1lbWJlciBzaGlmdCBhY291c3RpYyBjb25maXJtIHJhZGlvIGp1ZGdlIGxhYiBtdWZmaW4gdHJpbSBnZW51aW5lIGJ1aWxkIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXQzcnVxZmN6aGp5cjRycDU5amNkdjZ4dmgwNnNhcDZuMzBjc2FhIiwiTW5lbW9uaWMiOiJsdW5jaCBib3Jyb3cgZGVmeSBwb29sIGxvY2FsIGdyYW50IHNoaXAgbXVzaHJvb20gYXdrd2FyZCBpbmNsdWRlIGtpZCBiZWx0IHBhaXIgaW50byBsZW5zIHRyYXZlbCByZWZsZWN0IHJvdXRlIG1pbmQgZW5hYmxlIG5lY2sga25lZSBzaXggd2lkdGgifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWg4MmVnOXBuN3pzM2w1bHRqdHN6ejN0MGdkNWVhejdnd3lyN2M1IiwiTW5lbW9uaWMiOiJzeXN0ZW0gdHJ5IGVhZ2VyIGNhcmQgbGVzc29uIGN1cnRhaW4gYmVjYXVzZSBmbGFtZSBpbWl0YXRlIHNpemUgc2libGluZyBsYXRlciBoaWdoIHNhbXBsZSBjbGF3IHNjYXR0ZXIgdXNlIHNlcmllcyBiYWNoZWxvciBwZXBwZXIgbmV4dCBhZ2FpbiBhbmdyeSBsb2dpYyJ9"), - ) -) diff --git a/testutil/testkeyring/gen_accounts/gen.go b/testutil/testkeyring/gen_accounts/gen.go deleted file mode 100644 index 8b05da7d2..000000000 --- a/testutil/testkeyring/gen_accounts/gen.go +++ /dev/null @@ -1,79 +0,0 @@ -//go:build ignore - -package main - -import ( - "bytes" - "flag" - "fmt" - "log" - "os" - "strings" - - "github.com/cosmos/cosmos-sdk/crypto/hd" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/testutil/testkeyring" - - "github.com/pokt-network/poktroll/app" -) - -var ( - flagOut string - flagAccountsLimit int - defaultOutPath = "accounts_table.go" -) - -func init() { - flag.StringVar(&flagOut, "out", defaultOutPath, "the path to the generated go source of pre-generated accounts.") - flag.IntVar(&flagAccountsLimit, "limit", 100, "the number of accounts to generate.") -} - -func main() { - flag.Parse() - - kr := keyring.NewInMemory(app.MakeEncodingConfig().Marshaler) - - preGeneratedAccountLines := make([]string, flagAccountsLimit) - for i := range preGeneratedAccountLines { - record, mnemonic, err := kr.NewMnemonic( - fmt.Sprintf("key-%d", i), - keyring.English, - types.FullFundraiserPath, - keyring.DefaultBIP39Passphrase, - hd.Secp256k1, - ) - addr, err := record.GetAddress() - if err != nil { - log.Fatal(err) - } - - preGeneratedAccount := &testkeyring.PreGeneratedAccount{ - Address: addr, - Mnemonic: mnemonic, - } - - preGeneratedAccountStr, err := preGeneratedAccount.Marshal() - if err != nil { - log.Fatal(err) - } - - preGeneratedAccountLines[i] = fmt.Sprintf(preGeneratedAccountLineFmt, preGeneratedAccountStr) - } - - newPreGeneratedAccountIteratorArgLines := strings.Join(preGeneratedAccountLines, "\n") - outputBuffer := new(bytes.Buffer) - if err := accountsTableTemplate.Execute( - outputBuffer, - map[string]any{ - "newPreGeneratedAccountIteratorArgLines": newPreGeneratedAccountIteratorArgLines, - }, - ); err != nil { - log.Fatal(err) - } - - if err := os.WriteFile(flagOut, outputBuffer.Bytes(), 0644); err != nil { - log.Fatal(err) - } -} diff --git a/testutil/testkeyring/gen_accounts/template.go b/testutil/testkeyring/gen_accounts/template.go deleted file mode 100644 index e7dfb5b57..000000000 --- a/testutil/testkeyring/gen_accounts/template.go +++ /dev/null @@ -1,26 +0,0 @@ -//go:build ignore - -package main - -import "text/template" - -var ( - preGeneratedAccountLineFmt = "\t\tmustParsePreGeneratedAccount(%q)," - accountsTableTemplate = template.Must( - template.New("accounts_table.go").Parse( - `// DO NOT EDIT. This Code is generated by gen_accounts/gen.go, -// changes will be overwritten upon regeneration. -// -// To regenerate this file, use make go_testgen_accounts or go generate ./testutil/testkeyring/keyring.go. - -package testkeyring - -var ( - preGeneratedAccounts = NewPreGeneratedAccountIterator( -{{.newPreGeneratedAccountIteratorArgLines}} - ) -) -`, - ), - ) -) diff --git a/testutil/testkeyring/keyring.go b/testutil/testkeyring/keyring.go deleted file mode 100644 index f6c503d8e..000000000 --- a/testutil/testkeyring/keyring.go +++ /dev/null @@ -1,47 +0,0 @@ -//go:generate go run ./gen_accounts/gen.go ./gen_accounts/template.go - -package testkeyring - -import ( - "fmt" - "testing" - - "github.com/cosmos/cosmos-sdk/crypto/hd" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" -) - -// CreatePreGeneratedKeyringAccounts uses the mnemonic from limit number of -// pre-generated accounts to populated the provided keyring, kr. It then returns -// the pre-generated accounts which were used. -// -// TODO_CONSIDERATION: Returning a new PreGeneratedAccountIterator instead of -// the slice of accounts could be more idiomatic. It would only contain keys which -// are known to be in the keyring. -func CreatePreGeneratedKeyringAccounts( - t *testing.T, - kr keyring.Keyring, - limit int, -) []*PreGeneratedAccount { - t.Helper() - - accounts := make([]*PreGeneratedAccount, limit) - for i := range accounts { - preGeneratedAccount := MustPreGeneratedAccountAtIndex(uint32(i)) - - uid := fmt.Sprintf("key-%d", i) - _, err := kr.NewAccount( - uid, - preGeneratedAccount.Mnemonic, - keyring.DefaultBIP39Passphrase, - types.FullFundraiserPath, - hd.Secp256k1, - ) - assert.NoError(t, err) - - accounts[i] = preGeneratedAccount - } - - return accounts[:limit] -} diff --git a/testutil/testpolylog/event.go b/testutil/testpolylog/event.go deleted file mode 100644 index c41708c13..000000000 --- a/testutil/testpolylog/event.go +++ /dev/null @@ -1,193 +0,0 @@ -package testpolylog - -import ( - "bytes" - "fmt" - "reflect" - "strings" - "testing" - - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/polylog" -) - -type ( - // NewLoggerAndOutputFn is called in the test helper to create a new logger - // configured with the given level and options. It returns the logger and - // the buffer to which the logger writes. It is useful for decoupling test - // helpers from a specific logger implementation and reducing boilerplate - // code in various tests. - NewLoggerAndOutputFn func( - *testing.T, - polylog.Level, - ...polylog.LoggerOption, - ) (polylog.Logger, *bytes.Buffer) - - // NewEventWithLevelFn is called in the test helper to create a new event - // at the given level from the given logger. It is useful for decoupling - // test helpers from a specific logger implementation so that we can - // call `logger.() without knowing the concrete logger - // type nor the level. - NewEventWithLevelFn func( - *testing.T, - polylog.Logger, - polylog.Level, - ) polylog.Event -) - -// EventFuncSpy is a mock which implements a #Fn() method that is intended to be -// used in tests to assert that the function passed to polylog.Event#Func() is -// called with the expected arg(s). -type EventFuncSpy struct{ mock.Mock } - -// Fn is a mock method which can be asserted on via the mock.Mock API. -// See: https://pkg.go.dev/github.com/stretchr/testify@v1.8.4/mock#Mock. -func (m *EventFuncSpy) Fn(event polylog.Event) { - m.Called(event) -} - -// EventMethodTestCase is a test case for expressing and exercising polylog.Event -// methods in a concise way. -type EventMethodTestCase struct { - // Msg is the string to pass to polylog.Event#Msg(), which will be called - // after the event method under test. Usage of Msg is mutually exclusive - // with MsgFmt. If neither are provided, then polylog.Event#Send() is called - // after the event method instead. - Msg string - - // MsgFmt is the format string to pass to polylog.Event#Msgf(), which will - // be called on the event returned from the event method under test. Usage - // of MsgFmt is mutually exclusive with Msg. If neither are provided, then - // polylog.Event#Send() is called after the event method instead. - MsgFmt string - - // MsgFmtArgs are the args to pass to polylog.Event#Msgf(). It is an error - // to provide MsgFmtArgs without also providing MsgFmt or while providing - // Msg. - MsgFmtArgs []any - - // Key is the key to pass to the event method under test. - Key string - - // Value is the value to pass to the event method under test. - Value any - - // EventMethodName is the name of the event method to call on the logger. - EventMethodName string - - // ExpectedOutputContains is the string that is expected to be contained - // in the log output. - ExpectedOutputContains string -} - -// RunEventMethodTests runs a set of tests for a given level. -func RunEventMethodTests( - t *testing.T, - level polylog.Level, - tests []EventMethodTestCase, - newLoggerAndOutput NewLoggerAndOutputFn, - newEventWithLevel NewEventWithLevelFn, - getExpectedLevelOutputContains func(level polylog.Level) string, -) { - t.Helper() - - // Title-case level string so that it can be used as the name of the - // method to call on the logger using reflect and for the sub-test - // descriptions. - // - // TODO_TECHDEBT/TODO_COMMUNITY: `strings.Title()` is deprecated. Follow - // migration guidance in godocs: https://pkg.go.dev/strings@go1.21.4#Title. - levelMethodName := strings.Title(level.String()) - - for _, tt := range tests { - var ( - eventMethodArgs []reflect.Value - doneMethodName string - doneMethodArgs []reflect.Value - ) - - // Ensure that calls to #Msg(), #Msgf(), and #Send() are mutually exclusive. - switch { - case tt.Msg != "": - require.Emptyf(t, tt.MsgFmt, "Msg and MsgFmt are mutually exclusive but MsgFmt was not empty: %s", tt.MsgFmt) - require.Emptyf(t, tt.MsgFmtArgs, "Msg and MsgFmt are mutually exclusive but MsgFmtArgs was not empty: %v", tt.MsgFmtArgs) - - // Set up call args for polylog.Event#Msg() if tt.msg is not empty. - doneMethodName = "Msg" - doneMethodArgs = append(doneMethodArgs, reflect.ValueOf(tt.Msg)) - case tt.MsgFmt != "": - // Set up call args for polylog.Event#Msgf() if tt.msgFmt is not empty. - doneMethodName = "Msgf" - doneMethodArgs = append( - doneMethodArgs, - reflect.ValueOf(tt.MsgFmt), - reflect.ValueOf(tt.MsgFmtArgs), - ) - default: - // Default to calling polylog.Event#Send() if tt.msg and tt.msgFmt are - // both empty. - doneMethodName = "Send" - } - - // Test description for this sub-test is interpolated based on the logger - // level, event, and "done" method names (e.g. `Debug().Msg()` or `Info().Str()`). - // If the event method name is not empty, the done method name is omitted. - // This is done for brevity as not every permutation of event method and done - // method is exercised (nor need they be). - // If the event method name is empty, then the test description is interpolated - // using the level method name and the "done" method name (e.g. `Error().Msg()` - // or `Warn().Send()`). - descMethodName := tt.EventMethodName - if tt.EventMethodName == "" { - descMethodName = doneMethodName - } - testDesc := fmt.Sprintf("%s().%s()", levelMethodName, descMethodName) - - // Run this sub-test for the current level. - t.Run(testDesc, func(t *testing.T) { - logger, logOutput := newLoggerAndOutput(t, level) - - // Need to use reflection in order to minimize the test code necessary - // to exercise all the permutations of logger level and event type methods. - logEvent := newEventWithLevel(t, logger, level) - logEventValue := reflect.ValueOf(logEvent) - - // If tt.EventMethodName is not empty, build the args and call it. - if tt.EventMethodName != "" { - // Append tt.key to polylog.Event#() call args. - if tt.Key != "" { - eventMethodArgs = append(eventMethodArgs, reflect.ValueOf(tt.Key)) - } - // Append tt.value to polylog.Event#() call args. - if tt.Value != nil { - eventMethodArgs = append(eventMethodArgs, reflect.ValueOf(tt.Value)) - } - - // E.g.: logEvent := logger.Debug().Str("str", "str_value") - // or: logEvent := logger.Debug().Bool("bool", true) - logEventValue. - MethodByName(tt.EventMethodName). - Call(eventMethodArgs) - } - - // E.g.: logEvent.Send() - // or: logEvent.Msg("msg") - // or: logEvent.Msgf("meaning of life: %d", 42) - logEventValue. - MethodByName(doneMethodName). - Call(doneMethodArgs) - - // Assert that each line contains the expected prefix. - require.Contains(t, logOutput.String(), getExpectedLevelOutputContains(level)) - - // Assert that the log output contains the expected messages. Split the log - // output into lines and iterate over them. - require.Contains(t, logOutput.String(), tt.ExpectedOutputContains) - - // Print log output for manual inspection. - t.Log(logOutput.String()) - }) - } -} diff --git a/testutil/testpolylog/logger.go b/testutil/testpolylog/logger.go deleted file mode 100644 index d5abf37fc..000000000 --- a/testutil/testpolylog/logger.go +++ /dev/null @@ -1,21 +0,0 @@ -package testpolylog - -import ( - "context" - - "github.com/rs/zerolog" - - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/polylog/polyzero" -) - -func NewLoggerWithCtx( - ctx context.Context, - level polylog.Level, -) (polylog.Logger, context.Context) { - levelOpt := polyzero.WithLevel(zerolog.Level(level.Int())) - logger := polyzero.NewLogger(levelOpt) - ctx = logger.WithContext(ctx) - - return logger, ctx -} diff --git a/testutil/testproxy/jsonrpc.go b/testutil/testproxy/jsonrpc.go deleted file mode 100644 index 7aace4f30..000000000 --- a/testutil/testproxy/jsonrpc.go +++ /dev/null @@ -1,24 +0,0 @@ -package testproxy - -// JSONRpcError is the error struct for the JSON RPC response -type JSONRpcError struct { - Code int32 `json:"code"` - Message string `json:"message"` -} - -// JSONRpcErrorReply is the error reply struct for the JSON RPC response -type JSONRpcErrorReply struct { - Id int32 `json:"id"` - Jsonrpc string `json:"jsonrpc"` - Error *JSONRpcError -} - -// prepareJsonRPCResponsePayload prepares a hard-coded JsonRPC payload for a specific response. -func prepareJsonRPCResponsePayload() []byte { - return []byte(`{"jsonrpc":"2.0","id":1,"result":"some result"}`) -} - -// PrepareJsonRPCRequestPayload prepares a hard-coded JsonRPC payload for a specific request. -func PrepareJsonRPCRequestPayload() []byte { - return []byte(`{"method":"someMethod","id":1,"jsonrpc":"2.0","params":["someParam"]}`) -} diff --git a/testutil/testproxy/relayerproxy.go b/testutil/testproxy/relayerproxy.go deleted file mode 100644 index 80cd141fd..000000000 --- a/testutil/testproxy/relayerproxy.go +++ /dev/null @@ -1,352 +0,0 @@ -package testproxy - -import ( - "bytes" - "context" - "encoding/json" - "io" - "net/http" - "net/url" - "testing" - - "cosmossdk.io/depinject" - ring_secp256k1 "github.com/athanorlabs/go-dleq/secp256k1" - ringtypes "github.com/athanorlabs/go-dleq/types" - keyringtypes "github.com/cosmos/cosmos-sdk/crypto/keyring" - secp256k1 "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - "github.com/cosmos/cosmos-sdk/types/bech32" - "github.com/noot/ring-go" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/relayer/config" - "github.com/pokt-network/poktroll/pkg/signer" - "github.com/pokt-network/poktroll/testutil/testclient/testblock" - "github.com/pokt-network/poktroll/testutil/testclient/testdelegation" - testkeyring "github.com/pokt-network/poktroll/testutil/testclient/testkeyring" - "github.com/pokt-network/poktroll/testutil/testclient/testqueryclients" - testrings "github.com/pokt-network/poktroll/testutil/testcrypto/rings" - servicetypes "github.com/pokt-network/poktroll/x/service/types" - sessionkeeper "github.com/pokt-network/poktroll/x/session/keeper" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// TestBehavior is a struct that holds the test context and mocks -// for the relayer proxy tests. -// It is used to provide the context needed by the instrumentation functions -// in order to isolate specific execution paths of the subject under test. -type TestBehavior struct { - ctx context.Context - t *testing.T - // Deps is exported so it can be used by the dependency injection framework - // from the pkg/relayer/proxy/proxy_test.go - Deps depinject.Config - - proxiedServices map[string]*http.Server -} - -const ( - blockHeight = 1 - blockHash = "1B1051B7BF236FEA13EFA65B6BE678514FA5B6EA0AE9A7A4B68D45F95E4F18E0" -) - -// NewRelayerProxyTestBehavior creates a TestBehavior with the provided set of -// behavior function that are used to instrument the tested subject's dependencies -// and isolate specific execution pathways. -func NewRelayerProxyTestBehavior( - ctx context.Context, - t *testing.T, - behaviors ...func(*TestBehavior), -) *TestBehavior { - test := &TestBehavior{ - ctx: ctx, - t: t, - proxiedServices: make(map[string]*http.Server), - } - - for _, behavior := range behaviors { - behavior(test) - } - - return test -} - -// WithRelayerProxyDependencies creates the dependencies for the relayer proxy -// from the TestBehavior.mocks so they have the right interface and can be -// used by the dependency injection framework. -func WithRelayerProxyDependencies(keyName string) func(*TestBehavior) { - return func(test *TestBehavior) { - logger := polylog.Ctx(test.ctx) - accountQueryClient := testqueryclients.NewTestAccountQueryClient(test.t) - applicationQueryClient := testqueryclients.NewTestApplicationQueryClient(test.t) - sessionQueryClient := testqueryclients.NewTestSessionQueryClient(test.t) - supplierQueryClient := testqueryclients.NewTestSupplierQueryClient(test.t) - - blockClient := testblock.NewAnyTimeLastNBlocksBlockClient(test.t, []byte{}, 1) - keyring, _ := testkeyring.NewTestKeyringWithKey(test.t, keyName) - - redelegationObs, _ := channel.NewReplayObservable[client.Redelegation](test.ctx, 1) - delegationClient := testdelegation.NewAnyTimesRedelegationsSequence(test.ctx, test.t, "", redelegationObs) - ringCache := testrings.NewRingCacheWithMockDependencies(test.ctx, test.t, accountQueryClient, applicationQueryClient, delegationClient) - - deps := depinject.Supply( - logger, - accountQueryClient, - ringCache, - blockClient, - sessionQueryClient, - supplierQueryClient, - keyring, - ) - - test.Deps = deps - } -} - -// WithRelayerProxiedServices creates the services that the relayer proxy will -// proxy requests to. -// It creates an HTTP server for each service and starts listening on the -// provided host. -func WithRelayerProxiedServices( - proxiedServices map[string]*config.RelayMinerProxyConfig, -) func(*TestBehavior) { - return func(test *TestBehavior) { - for _, proxy := range proxiedServices { - for serviceId, service := range proxy.Suppliers { - server := &http.Server{Addr: service.ServiceConfig.Url.Host} - server.Handler = http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { - w.Write(prepareJsonRPCResponsePayload()) - }) - go func() { server.ListenAndServe() }() - go func() { - <-test.ctx.Done() - server.Shutdown(test.ctx) - }() - - test.proxiedServices[serviceId] = server - } - } - } -} - -// WithDefaultSupplier creates the default staked supplier for the test -func WithDefaultSupplier( - supplierKeyName string, - supplierEndpoints map[string][]*sharedtypes.SupplierEndpoint, -) func(*TestBehavior) { - return func(test *TestBehavior) { - var keyring keyringtypes.Keyring - - err := depinject.Inject(test.Deps, &keyring) - require.NoError(test.t, err) - - supplierAccount, err := keyring.Key(supplierKeyName) - require.NoError(test.t, err) - - supplierAccAddress, err := supplierAccount.GetAddress() - require.NoError(test.t, err) - - supplierAddress := supplierAccAddress.String() - - for serviceId, endpoints := range supplierEndpoints { - testqueryclients.AddSuppliersWithServiceEndpoints( - test.t, - supplierAddress, - serviceId, - endpoints, - ) - } - } -} - -// WithDefaultApplication creates the default staked application actor for the test -func WithDefaultApplication(appPrivateKey *secp256k1.PrivKey) func(*TestBehavior) { - return func(test *TestBehavior) { - appPubKey := appPrivateKey.PubKey() - appAddress := GetAddressFromPrivateKey(test, appPrivateKey) - delegateeAccounts := map[string]cryptotypes.PubKey{} - - testqueryclients.AddAddressToApplicationMap( - test.t, - appAddress, - appPubKey, - delegateeAccounts, - ) - } -} - -// WithDefaultSessionSupplier adds the default staked supplier to the -// application's current session -// If the supplierKeyName is empty, the supplier will not be staked so we can -// test the case where the supplier is not in the application's session's supplier list. -func WithDefaultSessionSupplier( - supplierKeyName string, - serviceId string, - appPrivateKey *secp256k1.PrivKey, -) func(*TestBehavior) { - return func(test *TestBehavior) { - if supplierKeyName == "" { - return - } - - appAddress := GetAddressFromPrivateKey(test, appPrivateKey) - - sessionSuppliers := []string{} - var keyring keyringtypes.Keyring - err := depinject.Inject(test.Deps, &keyring) - require.NoError(test.t, err) - - supplierAccount, err := keyring.Key(supplierKeyName) - require.NoError(test.t, err) - - supplierAccAddress, err := supplierAccount.GetAddress() - require.NoError(test.t, err) - - supplierAddress := supplierAccAddress.String() - sessionSuppliers = append(sessionSuppliers, supplierAddress) - - testqueryclients.AddToExistingSessions( - test.t, - appAddress, - serviceId, - blockHeight, - sessionSuppliers, - ) - } -} - -// TODO_TECHDEBT(@red-0ne): This function only supports JSON-RPC requests and -// needs to have its http.Request "Content-Type" header passed-in as a parameter -// and take out the GetRelayResponseError function which parses JSON-RPC responses -// to make it RPC-type agnostic. - -// MarshalAndSend marshals the request and sends it to the provided service. -func MarshalAndSend( - test *TestBehavior, - proxiedServices map[string]*config.RelayMinerProxyConfig, - proxyServeName string, - serviceId string, - request *servicetypes.RelayRequest, -) (errCode int32, errorMessage string) { - reqBz, err := request.Marshal() - require.NoError(test.t, err) - - var scheme string - switch proxiedServices[proxyServeName].Type { - case config.ProxyTypeHTTP: - scheme = "http" - default: - require.FailNow(test.t, "unsupported proxy type") - } - - reader := io.NopCloser(bytes.NewReader(reqBz)) - req := &http.Request{ - Method: http.MethodPost, - Header: http.Header{ - "Content-Type": []string{"application/json"}, - }, - URL: &url.URL{Scheme: scheme, Host: proxiedServices[proxyServeName].Host}, - Host: proxiedServices[proxyServeName].Suppliers[serviceId].Hosts[0], - Body: reader, - } - res, err := http.DefaultClient.Do(req) - require.NoError(test.t, err) - require.NotNil(test.t, res) - - return GetRelayResponseError(test.t, res) -} - -// GetRelayResponseError returns the error code and message from the relay response. -// If the response is not an error, it returns `0, ""`. -func GetRelayResponseError(t *testing.T, res *http.Response) (errCode int32, errMsg string) { - responseBody, err := io.ReadAll(res.Body) - require.NoError(t, err) - - relayResponse := &servicetypes.RelayResponse{} - err = relayResponse.Unmarshal(responseBody) - if err != nil { - return 0, "cannot unmarshal request body" - } - - var payload JSONRpcErrorReply - err = json.Unmarshal(relayResponse.Payload, &payload) - if err != nil { - return 0, "cannot unmarshal request payload" - } - - if payload.Error == nil { - return 0, "" - } - - return payload.Error.Code, payload.Error.Message -} - -// GetApplicationRingSignature crafts a ring signer for test purposes and uses -// it to sign the relay request -func GetApplicationRingSignature( - t *testing.T, - req *servicetypes.RelayRequest, - appPrivateKey *secp256k1.PrivKey, -) []byte { - publicKey := appPrivateKey.PubKey() - curve := ring_secp256k1.NewCurve() - - point, err := curve.DecodeToPoint(publicKey.Bytes()) - require.NoError(t, err) - - // At least two points are required to create a ring signer so we are reusing - // the same key for it - points := []ringtypes.Point{point, point} - pointsRing, err := ring.NewFixedKeyRingFromPublicKeys(curve, points) - require.NoError(t, err) - - scalar, err := curve.DecodeToScalar(appPrivateKey.Bytes()) - require.NoError(t, err) - - signer := signer.NewRingSigner(pointsRing, scalar) - - signableBz, err := req.GetSignableBytesHash() - require.NoError(t, err) - - signature, err := signer.Sign(signableBz) - require.NoError(t, err) - - return signature -} - -// GetAddressFromPrivateKey returns the address of the provided private key -func GetAddressFromPrivateKey(test *TestBehavior, privKey *secp256k1.PrivKey) string { - addressBz := privKey.PubKey().Address() - address, err := bech32.ConvertAndEncode("pokt", addressBz) - require.NoError(test.t, err) - return address -} - -// GenerateRelayRequest generates a relay request with the provided parameters -func GenerateRelayRequest( - test *TestBehavior, - privKey *secp256k1.PrivKey, - serviceId string, - blockHeight int64, - payload []byte, -) *servicetypes.RelayRequest { - appAddress := GetAddressFromPrivateKey(test, privKey) - sessionId, _ := sessionkeeper.GetSessionId(appAddress, serviceId, blockHash, blockHeight) - - return &servicetypes.RelayRequest{ - Meta: &servicetypes.RelayRequestMetadata{ - SessionHeader: &sessiontypes.SessionHeader{ - ApplicationAddress: appAddress, - SessionId: string(sessionId[:]), - Service: &sharedtypes.Service{Id: serviceId}, - }, - // The returned relay is unsigned and must be signed elsewhere for functionality - Signature: []byte(""), - }, - Payload: payload, - } -} diff --git a/testutil/testrelayer/hash.go b/testutil/testrelayer/hash.go deleted file mode 100644 index d8c78e64e..000000000 --- a/testutil/testrelayer/hash.go +++ /dev/null @@ -1,16 +0,0 @@ -package testrelayer - -import ( - "hash" - "testing" - - "github.com/stretchr/testify/require" -) - -// TODO_TECHDEBT(@h5law): Retrieve the relay hasher mechanism from the `smt` repo. -func HashBytes(t *testing.T, newHasher func() hash.Hash, relayBz []byte) []byte { - hasher := newHasher() - _, err := hasher.Write(relayBz) - require.NoError(t, err) - return hasher.Sum(nil) -} diff --git a/testutil/testrelayer/miner.go b/testutil/testrelayer/miner.go deleted file mode 100644 index 2a73c865c..000000000 --- a/testutil/testrelayer/miner.go +++ /dev/null @@ -1,34 +0,0 @@ -package testrelayer - -import ( - "context" - "testing" - - "github.com/golang/mock/gomock" - - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/testutil/mockrelayer" -) - -// NewMockOneTimeMiner creates a new mock Miner. This mock Miner will expect a -// call to MinedRelays with the given context and expectedRelayObs args. When -// that call is made, returnedMinedRelaysObs is returned. -func NewMockOneTimeMiner( - ctx context.Context, - t *testing.T, - expectedRelaysObs relayer.RelaysObservable, - returnedMinedRelaysObs relayer.MinedRelaysObservable, -) *mockrelayer.MockMiner { - t.Helper() - - ctrl := gomock.NewController(t) - minerMock := mockrelayer.NewMockMiner(ctrl) - minerMock.EXPECT(). - MinedRelays( - gomock.Eq(ctx), - gomock.Eq(expectedRelaysObs), - ). - Return(returnedMinedRelaysObs). - Times(1) - return minerMock -} diff --git a/testutil/testrelayer/options.go b/testutil/testrelayer/options.go deleted file mode 100644 index a63518293..000000000 --- a/testutil/testrelayer/options.go +++ /dev/null @@ -1,23 +0,0 @@ -package testrelayer - -import ( - "fmt" - "os" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/session" -) - -func WithTempStoresDirectory(t *testing.T) relayer.RelayerSessionsManagerOption { - tmpDirPattern := fmt.Sprintf("%s_smt_kvstore", t.Name()) - tmpStoresDir, err := os.MkdirTemp("", tmpDirPattern) - require.NoError(t, err) - - // Delete all temporary files and directories created by the test on completion. - t.Cleanup(func() { _ = os.RemoveAll(tmpStoresDir) }) - - return session.WithStoresDirectory(tmpStoresDir) -} diff --git a/testutil/testrelayer/proxy.go b/testutil/testrelayer/proxy.go deleted file mode 100644 index a876ebec3..000000000 --- a/testutil/testrelayer/proxy.go +++ /dev/null @@ -1,37 +0,0 @@ -package testrelayer - -import ( - "context" - "testing" - - "github.com/golang/mock/gomock" - - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/testutil/mockrelayer" -) - -// NewMockOneTimeRelayerProxy creates a new mock RelayerProxy. This mock -// RelayerProxy will expect a call to ServedRelays with the given context, and -// when that call is made, returnedRelaysObs is returned. It also expects a call -// to Start and Stop with the given context. -func NewMockOneTimeRelayerProxy( - ctx context.Context, - t *testing.T, - returnedRelaysObs relayer.RelaysObservable, -) *mockrelayer.MockRelayerProxy { - t.Helper() - - ctrl := gomock.NewController(t) - relayerProxyMock := mockrelayer.NewMockRelayerProxy(ctrl) - relayerProxyMock.EXPECT(). - Start(gomock.Eq(ctx)). - Times(1) - relayerProxyMock.EXPECT(). - Stop(gomock.Eq(ctx)). - Times(1) - relayerProxyMock.EXPECT(). - ServedRelays(). - Return(returnedRelaysObs). - Times(1) - return relayerProxyMock -} diff --git a/testutil/testrelayer/relays.go b/testutil/testrelayer/relays.go deleted file mode 100644 index 53ddbadc2..000000000 --- a/testutil/testrelayer/relays.go +++ /dev/null @@ -1,44 +0,0 @@ -package testrelayer - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/miner" - servicetypes "github.com/pokt-network/poktroll/x/service/types" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" -) - -// NewMinedRelay returns a new mined relay with the given session start and end -// heights on the session header, and the bytes and hash fields populated. -func NewMinedRelay( - t *testing.T, - sessionStartHeight int64, - sessionEndHeight int64, -) *relayer.MinedRelay { - relay := servicetypes.Relay{ - Req: &servicetypes.RelayRequest{ - Meta: &servicetypes.RelayRequestMetadata{ - SessionHeader: &sessiontypes.SessionHeader{ - SessionStartBlockHeight: sessionStartHeight, - SessionEndBlockHeight: sessionEndHeight, - }, - }, - }, - Res: &servicetypes.RelayResponse{}, - } - - // TODO_BLOCKER: use canonical codec to serialize the relay - relayBz, err := relay.Marshal() - require.NoError(t, err) - - relayHash := HashBytes(t, miner.DefaultRelayHasher, relayBz) - - return &relayer.MinedRelay{ - Relay: relay, - Bytes: relayBz, - Hash: relayHash, - } -} diff --git a/testutil/testrelayer/sessions_manager.go b/testutil/testrelayer/sessions_manager.go deleted file mode 100644 index b65e0a191..000000000 --- a/testutil/testrelayer/sessions_manager.go +++ /dev/null @@ -1,37 +0,0 @@ -package testrelayer - -import ( - "context" - "testing" - - "github.com/golang/mock/gomock" - - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/testutil/mockrelayer" -) - -// NewMockOneTimeRelayerSessionsManager creates a new mock RelayerSessionsManager. -// This mock RelayerSessionsManager will expect a call to InsertRelays with the -// given context and expectedMinedRelaysObs args. When that call is made, -// returnedMinedRelaysObs is returned. It also expects a call to Start with the -// given context, and stop. -func NewMockOneTimeRelayerSessionsManager( - ctx context.Context, - t *testing.T, - expectedMinedRelaysObs relayer.MinedRelaysObservable, -) *mockrelayer.MockRelayerSessionsManager { - t.Helper() - - ctrl := gomock.NewController(t) - relayerSessionsManagerMock := mockrelayer.NewMockRelayerSessionsManager(ctrl) - relayerSessionsManagerMock.EXPECT(). - InsertRelays(gomock.Eq(expectedMinedRelaysObs)). - Times(1) - relayerSessionsManagerMock.EXPECT(). - Start(gomock.Eq(ctx)). - Times(1) - relayerSessionsManagerMock.EXPECT(). - Stop(). - Times(1) - return relayerSessionsManagerMock -} diff --git a/testutil/tokenomics/mocks/mocks.go b/testutil/tokenomics/mocks/mocks.go deleted file mode 100644 index 595954e65..000000000 --- a/testutil/tokenomics/mocks/mocks.go +++ /dev/null @@ -1,11 +0,0 @@ -package mocks - -// This file is in place to declare the package for dynamically generated structs. -// -// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests -// -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree -// to be valid before mock implementations have been generated. diff --git a/testutil/yaml/yaml.go b/testutil/yaml/yaml.go deleted file mode 100644 index 56a29cc89..000000000 --- a/testutil/yaml/yaml.go +++ /dev/null @@ -1,31 +0,0 @@ -package yaml - -import "strings" - -// YAML is indentation sensitive, so we need to remove the extra indentation from the test cases and make sure -// it is space-indented instead of tab-indented, otherwise the YAML parser will fail -func NormalizeYAMLIndentation(rawContent string) string { - var processedContent = rawContent - // Remove extra newlines - processedContent = strings.TrimPrefix(processedContent, "\n") - - // Replace tab indentation with 2 spaces as our code is tab-indented but YAML is expecting double spaces - processedContent = strings.ReplaceAll(processedContent, "\t", " ") - - // Get the extra indentation from the first line that will serve as the basis for the rest of the lines - extraIndentationCount := len(processedContent) - len(strings.TrimLeft(processedContent, " ")) - - // Create a prefix to trim from the beginning of each line - extraIndentation := strings.Repeat(" ", extraIndentationCount) - - // Split the content into lines, trim the extra indentation from each line, and rejoin the lines - lines := strings.Split(processedContent, "\n") - for i := range lines { - lines[i] = strings.TrimPrefix(lines[i], extraIndentation) - } - - // Recover the processed content - processedContent = strings.Trim(strings.Join(lines, "\n"), "\n") - - return processedContent -} diff --git a/tools/tools.go b/tools/tools.go index 6e7a12d40..d697c36cb 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -3,9 +3,14 @@ package tools import ( + _ "github.com/bufbuild/buf/cmd/buf" + _ "github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar" _ "github.com/cosmos/gogoproto/protoc-gen-gocosmos" _ "github.com/golang/protobuf/protoc-gen-go" _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway" _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger" _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2" + _ "golang.org/x/tools/cmd/goimports" + _ "google.golang.org/grpc/cmd/protoc-gen-go-grpc" + _ "google.golang.org/protobuf/cmd/protoc-gen-go" ) diff --git a/x/application/client/cli/helpers_test.go b/x/application/client/cli/helpers_test.go deleted file mode 100644 index 46f1e9440..000000000 --- a/x/application/client/cli/helpers_test.go +++ /dev/null @@ -1,33 +0,0 @@ -// Package cli_test provides unit tests for the CLI functionality. -package cli_test - -import ( - "strconv" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/x/application/types" -) - -// Dummy variable to avoid unused import error. -var _ = strconv.IntSize - -// init initializes the SDK configuration. -func init() { - cmd.InitSDKConfig() -} - -// networkWithApplicationObjects creates a new network with a given number of application objects. -// It returns the network and a slice of the created application objects. -func networkWithApplicationObjects(t *testing.T, n int) (*network.Network, []types.Application) { - t.Helper() - cfg := network.DefaultConfig() - appGenesisState := network.DefaultApplicationModuleGenesisState(t, n) - buf, err := cfg.Codec.MarshalJSON(appGenesisState) - require.NoError(t, err) - cfg.GenesisState[types.ModuleName] = buf - return network.New(t, cfg), appGenesisState.ApplicationList -} diff --git a/x/application/client/cli/query.go b/x/application/client/cli/query.go deleted file mode 100644 index 86cd73b25..000000000 --- a/x/application/client/cli/query.go +++ /dev/null @@ -1,33 +0,0 @@ -package cli - -import ( - "fmt" - // "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/application/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - // Group application queries under a subcommand - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdQueryParams()) - cmd.AddCommand(CmdListApplication()) - cmd.AddCommand(CmdShowApplication()) - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/application/client/cli/query_application.go b/x/application/client/cli/query_application.go deleted file mode 100644 index 4fbf32228..000000000 --- a/x/application/client/cli/query_application.go +++ /dev/null @@ -1,78 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/application/types" -) - -func CmdListApplication() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-application", - Short: "list all application", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryAllApplicationRequest{ - Pagination: pageReq, - } - - res, err := queryClient.ApplicationAll(cmd.Context(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, cmd.Use) - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdShowApplication() *cobra.Command { - cmd := &cobra.Command{ - Use: "show-application ", - Short: "shows a application", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - argAddress := args[0] - - params := &types.QueryGetApplicationRequest{ - Address: argAddress, - } - - res, err := queryClient.Application(cmd.Context(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/application/client/cli/query_application_test.go b/x/application/client/cli/query_application_test.go deleted file mode 100644 index 10a8b77c6..000000000 --- a/x/application/client/cli/query_application_test.go +++ /dev/null @@ -1,139 +0,0 @@ -package cli_test - -import ( - "fmt" - "strconv" - "testing" - - tmcli "github.com/cometbft/cometbft/libs/cli" - "github.com/cosmos/cosmos-sdk/client/flags" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/application/client/cli" - "github.com/pokt-network/poktroll/x/application/types" -) - -func TestShowApplication(t *testing.T) { - net, objs := networkWithApplicationObjects(t, 2) - - ctx := net.Validators[0].ClientCtx - common := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - tests := []struct { - desc string - idAddress string - - args []string - err error - obj types.Application - }{ - { - desc: "found", - idAddress: objs[0].Address, - - args: common, - obj: objs[0], - }, - { - desc: "not found", - idAddress: strconv.Itoa(100000), - - args: common, - err: status.Error(codes.NotFound, "not found"), - }, - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - args := []string{ - tc.idAddress, - } - args = append(args, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowApplication(), args) - if tc.err != nil { - stat, ok := status.FromError(tc.err) - require.True(t, ok) - require.ErrorIs(t, stat.Err(), tc.err) - } else { - require.NoError(t, err) - var resp types.QueryGetApplicationResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NotNil(t, resp.Application) - require.Equal(t, - nullify.Fill(&tc.obj), - nullify.Fill(&resp.Application), - ) - } - }) - } -} - -func TestListApplication(t *testing.T) { - net, objs := networkWithApplicationObjects(t, 5) - - ctx := net.Validators[0].ClientCtx - request := func(next []byte, offset, limit uint64, total bool) []string { - args := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - if next == nil { - args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) - } else { - args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) - } - args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) - if total { - args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) - } - return args - } - t.Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < len(objs); i += step { - args := request(nil, uint64(i), uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListApplication(), args) - require.NoError(t, err) - var resp types.QueryAllApplicationResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.Application), step) - require.Subset(t, - nullify.Fill(objs), - nullify.Fill(resp.Application), - ) - } - }) - t.Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < len(objs); i += step { - args := request(next, 0, uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListApplication(), args) - require.NoError(t, err) - var resp types.QueryAllApplicationResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.Application), step) - require.Subset(t, - nullify.Fill(objs), - nullify.Fill(resp.Application), - ) - next = resp.Pagination.NextKey - } - }) - t.Run("Total", func(t *testing.T) { - args := request(nil, 0, uint64(len(objs)), true) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListApplication(), args) - require.NoError(t, err) - var resp types.QueryAllApplicationResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NoError(t, err) - require.Equal(t, len(objs), int(resp.Pagination.Total)) - require.ElementsMatch(t, - nullify.Fill(objs), - nullify.Fill(resp.Application), - ) - }) -} diff --git a/x/application/client/cli/query_params.go b/x/application/client/cli/query_params.go deleted file mode 100644 index 7a47d705c..000000000 --- a/x/application/client/cli/query_params.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/application/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - 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.Params(cmd.Context(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/application/client/cli/tx.go b/x/application/client/cli/tx.go deleted file mode 100644 index cb09f9b3f..000000000 --- a/x/application/client/cli/tx.go +++ /dev/null @@ -1,41 +0,0 @@ -package cli - -import ( - "fmt" - "time" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/pokt-network/poktroll/x/application/types" -) - -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdStakeApplication()) - cmd.AddCommand(CmdUnstakeApplication()) - - cmd.AddCommand(CmdDelegateToGateway()) - cmd.AddCommand(CmdUndelegateFromGateway()) - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/application/client/cli/tx_delegate_to_gateway.go b/x/application/client/cli/tx_delegate_to_gateway.go deleted file mode 100644 index f1363e6db..000000000 --- a/x/application/client/cli/tx_delegate_to_gateway.go +++ /dev/null @@ -1,49 +0,0 @@ -package cli - -import ( - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/application/types" -) - -var _ = strconv.Itoa(0) - -func CmdDelegateToGateway() *cobra.Command { - cmd := &cobra.Command{ - Use: "delegate-to-gateway ", - Short: "Delegate an application to a gateway", - Long: `Delegate an application to the gateway with the provided address. This is a broadcast operation -that delegates authority to the gateway specified to sign relays requests for the application, allowing the gateway -act on the behalf of the application during a session. - -Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx application delegate-to-gateway $(GATEWAY_ADDR) --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) (err error) { - gatewayAddress := args[0] - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgDelegateToGateway( - clientCtx.GetFromAddress().String(), - gatewayAddress, - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/application/client/cli/tx_delegate_to_gateway_test.go b/x/application/client/cli/tx_delegate_to_gateway_test.go deleted file mode 100644 index 22d2630b2..000000000 --- a/x/application/client/cli/tx_delegate_to_gateway_test.go +++ /dev/null @@ -1,117 +0,0 @@ -package cli_test - -import ( - "fmt" - "testing" - - sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/x/application/client/cli" - "github.com/pokt-network/poktroll/x/application/types" -) - -func TestCLI_DelegateToGateway(t *testing.T) { - net, _ := networkWithApplicationObjects(t, 2) - val := net.Validators[0] - ctx := val.ClientCtx - - // Create a keyring and add an account for the application to be delegated - // and the gateway to be delegated to - kr := ctx.Keyring - accounts := testutil.CreateKeyringAccounts(t, kr, 2) - appAccount := accounts[0] - gatewayAccount := accounts[1] - - // Update the context with the new keyring - ctx = ctx.WithKeyring(kr) - - // Common args used for all requests - commonArgs := []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), - } - - tests := []struct { - desc string - appAddress string - gatewayAddress string - err *sdkerrors.Error - }{ - { - desc: "delegate to gateway: valid", - appAddress: appAccount.Address.String(), - gatewayAddress: gatewayAccount.Address.String(), - }, - { - desc: "invalid - missing app address", - // appAddress: appAccount.Address.String(), - gatewayAddress: gatewayAccount.Address.String(), - err: types.ErrAppInvalidAddress, - }, - { - desc: "invalid - invalid app address", - appAddress: "invalid address", - gatewayAddress: gatewayAccount.Address.String(), - err: types.ErrAppInvalidAddress, - }, - { - desc: "invalid - missing gateway address", - appAddress: appAccount.Address.String(), - // gatewayAddress: gatewayAccount.Address.String(), - err: types.ErrAppInvalidGatewayAddress, - }, - { - desc: "invalid - invalid gateway address", - appAddress: appAccount.Address.String(), - gatewayAddress: "invalid address", - err: types.ErrAppInvalidGatewayAddress, - }, - } - - // Initialize the App and Gateway Accounts by sending it some funds from the validator account that is part of genesis - network.InitAccountWithSequence(t, net, appAccount.Address, 1) - network.InitAccountWithSequence(t, net, gatewayAccount.Address, 2) - - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - // Wait for a new block to be committed - require.NoError(t, net.WaitForNextBlock()) - - // Prepare the arguments for the CLI command - args := []string{ - tt.gatewayAddress, - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.appAddress), - } - args = append(args, commonArgs...) - - // Execute the command - delegateOutput, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdDelegateToGateway(), args) - - // Validate the error if one is expected - if tt.err != nil { - stat, ok := status.FromError(tt.err) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.err.Error()) - return - } - require.NoError(t, err) - - // Check the response - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(delegateOutput.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) - }) - } -} diff --git a/x/application/client/cli/tx_stake_application.go b/x/application/client/cli/tx_stake_application.go deleted file mode 100644 index 1c8f23dda..000000000 --- a/x/application/client/cli/tx_stake_application.go +++ /dev/null @@ -1,66 +0,0 @@ -package cli - -import ( - "os" - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/application/client/config" - "github.com/pokt-network/poktroll/x/application/types" -) - -var ( - flagStakeConfig string - _ = strconv.Itoa(0) -) - -func CmdStakeApplication() *cobra.Command { - // fromAddress & signature is retrieved via `flags.FlagFrom` in the `clientCtx` - cmd := &cobra.Command{ - Use: "stake-application --config ", - Short: "Stake an application", - Long: `Stake an application with the provided parameters. This is a broadcast operation that -will stake the tokens and serviceIds and associate them with the application specified by the 'from' address. - -Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx application stake-application --config stake_config.yaml --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, _ []string) (err error) { - configContent, err := os.ReadFile(flagStakeConfig) - if err != nil { - return err - } - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - appStakeConfigs, err := config.ParseApplicationConfigs(configContent) - if err != nil { - return err - } - - msg := types.NewMsgStakeApplication( - clientCtx.GetFromAddress().String(), - appStakeConfigs.StakeAmount, - appStakeConfigs.Services, - ) - - if err := msg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().StringVar(&flagStakeConfig, "config", "", "Path to the stake config file") - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/application/client/cli/tx_stake_application_test.go b/x/application/client/cli/tx_stake_application_test.go deleted file mode 100644 index 6f255207e..000000000 --- a/x/application/client/cli/tx_stake_application_test.go +++ /dev/null @@ -1,235 +0,0 @@ -package cli_test - -import ( - "fmt" - "os" - "testing" - - sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/testutil/yaml" - "github.com/pokt-network/poktroll/x/application/client/cli" - "github.com/pokt-network/poktroll/x/application/types" -) - -func TestCLI_StakeApplication(t *testing.T) { - net, _ := networkWithApplicationObjects(t, 2) - val := net.Validators[0] - ctx := val.ClientCtx - - // Create a keyring and add an account for the application to be staked - kr := ctx.Keyring - accounts := testutil.CreateKeyringAccounts(t, kr, 1) - appAccount := accounts[0] - - // Update the context with the new keyring - ctx = ctx.WithKeyring(kr) - - // Common args used for all requests - commonArgs := []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), - } - - defaultConfig := ` - stake_amount: 1000upokt - service_ids: - - svc1 - - svc2 - - svc3 - ` - - tests := []struct { - desc string - - inputConfig string - inputAddress string - - expectedError *sdkerrors.Error - }{ - // Happy Paths - { - desc: "valid", - - inputAddress: appAccount.Address.String(), - inputConfig: defaultConfig, - - expectedError: nil, - }, - - // Error Paths - Address Related - { - desc: "invalid: missing address", - // inputAddress: "explicitly missing", - inputConfig: defaultConfig, - - expectedError: types.ErrAppInvalidAddress, - }, - { - desc: "invalid: invalid address", - - inputAddress: "invalid", - inputConfig: defaultConfig, - - expectedError: types.ErrAppInvalidAddress, - }, - - // Error Paths - Stake Related - { - desc: "invalid: missing stake", - - inputAddress: appAccount.Address.String(), - inputConfig: ` - stake_amount: # explicitly missing - service_ids: - - svc1 - - svc2 - - svc3 - `, - - expectedError: types.ErrAppInvalidStake, - }, - { - desc: "invalid: invalid stake denom", - - inputAddress: appAccount.Address.String(), - inputConfig: ` - stake_amount: 1000invalid - service_ids: - - svc1 - - svc2 - - svc3 - `, - - expectedError: types.ErrAppInvalidStake, - }, - { - desc: "invalid: stake amount (zero)", - - inputAddress: appAccount.Address.String(), - inputConfig: ` - stake_amount: 0upokt - service_ids: - - svc1 - - svc2 - - svc3 - `, - - expectedError: types.ErrAppInvalidStake, - }, - { - desc: "invalid: stake amount (negative)", - - inputAddress: appAccount.Address.String(), - inputConfig: ` - stake_amount: -1000upokt - service_ids: - - svc1 - - svc2 - - svc3 - `, - - expectedError: types.ErrAppInvalidStake, - }, - - // Error Paths - Service Related - { - desc: "invalid: services (empty string)", - - inputAddress: appAccount.Address.String(), - inputConfig: ` - stake_amount: 1000upokt - `, - - expectedError: types.ErrAppInvalidServiceConfigs, - }, - { - desc: "invalid: single invalid service contains spaces", - - inputAddress: appAccount.Address.String(), - inputConfig: ` - stake_amount: 1000upokt - service_ids: - - svc1 svc1_part2 svc1_part3 - `, - - expectedError: types.ErrAppInvalidServiceConfigs, - }, - { - desc: "invalid: one of two services is invalid because it contains spaces", - - inputAddress: appAccount.Address.String(), - inputConfig: ` - stake_amount: 1000upokt - service_ids: - - svc1 svc1_part2 - - svc2 - `, - - expectedError: types.ErrAppInvalidServiceConfigs, - }, - { - desc: "invalid: service ID is too long (8 chars is the max)", - - inputAddress: appAccount.Address.String(), - inputConfig: ` - stake_amount: 1000upokt - service_ids: - - svc1, - - abcdefghi - `, - - expectedError: types.ErrAppInvalidServiceConfigs, - }, - } - - // Initialize the App Account by sending it some funds from the validator account that is part of genesis - network.InitAccount(t, net, appAccount.Address) - - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - // Wait for a new block to be committed - require.NoError(t, net.WaitForNextBlock()) - - // write the stake config to a file - configPath := testutil.WriteToNewTempFile(t, yaml.NormalizeYAMLIndentation(tt.inputConfig)).Name() - t.Cleanup(func() { os.Remove(configPath) }) - - // Prepare the arguments for the CLI command - args := []string{ - fmt.Sprintf("--config=%s", configPath), - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.inputAddress), - } - args = append(args, commonArgs...) - - // Execute the command - outStake, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdStakeApplication(), args) - - // Validate the error if one is expected - if tt.expectedError != nil { - stat, ok := status.FromError(tt.expectedError) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.expectedError.Error()) - return - } - require.NoError(t, err) - - // Check the response - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(outStake.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) - }) - } -} diff --git a/x/application/client/cli/tx_undelegate_from_gateway.go b/x/application/client/cli/tx_undelegate_from_gateway.go deleted file mode 100644 index 50a755d8f..000000000 --- a/x/application/client/cli/tx_undelegate_from_gateway.go +++ /dev/null @@ -1,49 +0,0 @@ -package cli - -import ( - "strconv" - - "github.com/pokt-network/poktroll/x/application/types" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cobra" -) - -var _ = strconv.Itoa(0) - -func CmdUndelegateFromGateway() *cobra.Command { - cmd := &cobra.Command{ - Use: "undelegate-from-gateway [gateway address]", - Short: "Undelegate an application from a gateway", - Long: `Undelegate an application from the gateway with the provided address. This is a broadcast operation -that removes the authority from the gateway specified to sign relays requests for the application, disallowing the gateway -act on the behalf of the application during a session. - -Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx application undelegate-from-gateway $(GATEWAY_ADDR) --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) (err error) { - gatewayAddress := args[0] - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgUndelegateFromGateway( - clientCtx.GetFromAddress().String(), - gatewayAddress, - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/application/client/cli/tx_undelegate_from_gateway_test.go b/x/application/client/cli/tx_undelegate_from_gateway_test.go deleted file mode 100644 index a5d942268..000000000 --- a/x/application/client/cli/tx_undelegate_from_gateway_test.go +++ /dev/null @@ -1,117 +0,0 @@ -package cli_test - -import ( - "fmt" - "testing" - - sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/x/application/client/cli" - "github.com/pokt-network/poktroll/x/application/types" -) - -func TestCLI_UndelegateFromGateway(t *testing.T) { - net, _ := networkWithApplicationObjects(t, 2) - val := net.Validators[0] - ctx := val.ClientCtx - - // Create a keyring and add an account for the application to be delegated - // and the gateway to be delegated to - kr := ctx.Keyring - accounts := testutil.CreateKeyringAccounts(t, kr, 2) - appAccount := accounts[0] - gatewayAccount := accounts[1] - - // Update the context with the new keyring - ctx = ctx.WithKeyring(kr) - - // Common args used for all requests - commonArgs := []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), - } - - tests := []struct { - desc string - appAddress string - gatewayAddress string - err *sdkerrors.Error - }{ - { - desc: "undelegate from gateway: valid", - appAddress: appAccount.Address.String(), - gatewayAddress: gatewayAccount.Address.String(), - }, - { - desc: "invalid - missing app address", - // appAddress: appAccount.Address.String(), - gatewayAddress: gatewayAccount.Address.String(), - err: types.ErrAppInvalidAddress, - }, - { - desc: "invalid - invalid app address", - appAddress: "invalid address", - gatewayAddress: gatewayAccount.Address.String(), - err: types.ErrAppInvalidAddress, - }, - { - desc: "invalid - missing gateway address", - appAddress: appAccount.Address.String(), - // gatewayAddress: gatewayAccount.Address.String(), - err: types.ErrAppInvalidGatewayAddress, - }, - { - desc: "invalid - invalid gateway address", - appAddress: appAccount.Address.String(), - gatewayAddress: "invalid address", - err: types.ErrAppInvalidGatewayAddress, - }, - } - - // Initialize the App and Gateway Accounts by sending it some funds from the validator account that is part of genesis - network.InitAccountWithSequence(t, net, appAccount.Address, 1) - network.InitAccountWithSequence(t, net, gatewayAccount.Address, 2) - - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - // Wait for a new block to be committed - require.NoError(t, net.WaitForNextBlock()) - - // Prepare the arguments for the CLI command - args := []string{ - tt.gatewayAddress, - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.appAddress), - } - args = append(args, commonArgs...) - - // Execute the command - undelegateOutput, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdUndelegateFromGateway(), args) - - // Validate the error if one is expected - if tt.err != nil { - stat, ok := status.FromError(tt.err) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.err.Error()) - return - } - require.NoError(t, err) - - // Check the response - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(undelegateOutput.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) - }) - } -} diff --git a/x/application/client/cli/tx_unstake_application.go b/x/application/client/cli/tx_unstake_application.go deleted file mode 100644 index c602def16..000000000 --- a/x/application/client/cli/tx_unstake_application.go +++ /dev/null @@ -1,47 +0,0 @@ -package cli - -import ( - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/application/types" -) - -var _ = strconv.Itoa(0) - -func CmdUnstakeApplication() *cobra.Command { - // fromAddress & signature is retrieved via `flags.FlagFrom` in the `clientCtx` - cmd := &cobra.Command{ - Use: "unstake-application", - Short: "Unstake an application", - Long: `Unstake an application. This is a broadcast operation that will unstake -the application specified by the 'from' address. - -Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx application unstake-application --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) (err error) { - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgUnstakeApplication( - clientCtx.GetFromAddress().String(), - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/application/client/cli/tx_unstake_application_test.go b/x/application/client/cli/tx_unstake_application_test.go deleted file mode 100644 index 2681a7d77..000000000 --- a/x/application/client/cli/tx_unstake_application_test.go +++ /dev/null @@ -1,97 +0,0 @@ -package cli_test - -import ( - "fmt" - "testing" - - sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/x/application/client/cli" - "github.com/pokt-network/poktroll/x/application/types" -) - -func TestCLI_UnstakeApplication(t *testing.T) { - net, _ := networkWithApplicationObjects(t, 2) - val := net.Validators[0] - ctx := val.ClientCtx - - // Create a keyring and add an account for the application to be unstaked - kr := ctx.Keyring - accounts := testutil.CreateKeyringAccounts(t, kr, 1) - appAccount := accounts[0] - - // Update the context with the new keyring - ctx = ctx.WithKeyring(kr) - - // Common args used for all requests - commonArgs := []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), - } - - tests := []struct { - desc string - address string - err *sdkerrors.Error - }{ - { - desc: "unstake application: valid", - address: appAccount.Address.String(), - }, - { - desc: "unstake application: missing address", - // address: "explicitly missing", - err: types.ErrAppInvalidAddress, - }, - { - desc: "unstake application: invalid address", - address: "invalid", - err: types.ErrAppInvalidAddress, - }, - } - - // Initialize the App Account by sending it some funds from the validator account that is part of genesis - network.InitAccount(t, net, appAccount.Address) - - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - // Wait for a new block to be committed - require.NoError(t, net.WaitForNextBlock()) - - // Prepare the arguments for the CLI command - args := []string{ - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), - } - args = append(args, commonArgs...) - - // Execute the command - outUnstake, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdUnstakeApplication(), args) - - // Validate the error if one is expected - if tt.err != nil { - stat, ok := status.FromError(tt.err) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.err.Error()) - return - } - require.NoError(t, err) - - // Check the response - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(outUnstake.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) - }) - } -} diff --git a/x/application/client/config/application_configs_reader.go b/x/application/client/config/application_configs_reader.go deleted file mode 100644 index 871ac8709..000000000 --- a/x/application/client/config/application_configs_reader.go +++ /dev/null @@ -1,91 +0,0 @@ -package config - -import ( - "gopkg.in/yaml.v2" - - sdk "github.com/cosmos/cosmos-sdk/types" - - sharedhelpers "github.com/pokt-network/poktroll/x/shared/helpers" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// YAMLApplicationConfig is the structure describing a single service stake entry in the stake config file -// TODO_DOCUMENT(@red-0ne): Add additional documentation on app config files. -type YAMLApplicationConfig struct { - StakeAmount string `yaml:"stake_amount"` - ServiceIds []string `yaml:"service_ids"` -} - -type ApplicationStakeConfig struct { - // StakeAmount is the amount of upokt tokens that the application is willing to stake - StakeAmount sdk.Coin - // Services is the list of services that the application is willing to stake for - Services []*sharedtypes.ApplicationServiceConfig -} - -// ParseApplicationConfig parses the stake config file and returns a slice of ApplicationServiceConfig -func ParseApplicationConfigs(configContent []byte) (*ApplicationStakeConfig, error) { - var parsedAppConfig YAMLApplicationConfig - - if len(configContent) == 0 { - return nil, ErrApplicationConfigEmptyContent - } - - // Unmarshal the stake config file into a applicationServiceConfig - if err := yaml.Unmarshal(configContent, &parsedAppConfig); err != nil { - return nil, ErrApplicationConfigUnmarshalYAML.Wrapf("%s", err) - } - - if len(parsedAppConfig.ServiceIds) == 0 || parsedAppConfig.ServiceIds == nil { - return nil, ErrApplicationConfigInvalidServiceId.Wrap("serviceIds cannot be empty") - } - - if parsedAppConfig.StakeAmount == "" { - return nil, ErrApplicationConfigInvalidStake.Wrap("stake amount cannot be empty") - } - - stakeAmount, err := sdk.ParseCoinNormalized(parsedAppConfig.StakeAmount) - if err != nil { - return nil, ErrApplicationConfigInvalidStake.Wrap(err.Error()) - } - - if err := stakeAmount.Validate(); err != nil { - return nil, ErrApplicationConfigInvalidStake.Wrap(err.Error()) - } - - if stakeAmount.IsZero() { - return nil, ErrApplicationConfigInvalidStake.Wrap("stake amount cannot be zero") - } - - if stakeAmount.Denom != "upokt" { - return nil, ErrApplicationConfigInvalidStake.Wrapf( - "invalid stake denom, expecting: upokt, got: %s", - stakeAmount.Denom, - ) - } - - // Prepare the applicationServiceConfig - applicationServiceConfig := make( - []*sharedtypes.ApplicationServiceConfig, - 0, - len(parsedAppConfig.ServiceIds), - ) - - for _, serviceId := range parsedAppConfig.ServiceIds { - // Validate serviceId - if !sharedhelpers.IsValidServiceId(serviceId) { - return nil, ErrApplicationConfigInvalidServiceId.Wrapf("%s", serviceId) - } - - appServiceConfig := &sharedtypes.ApplicationServiceConfig{ - Service: &sharedtypes.Service{Id: serviceId}, - } - - applicationServiceConfig = append(applicationServiceConfig, appServiceConfig) - } - - return &ApplicationStakeConfig{ - StakeAmount: stakeAmount, - Services: applicationServiceConfig, - }, nil -} diff --git a/x/application/client/config/application_configs_reader_test.go b/x/application/client/config/application_configs_reader_test.go deleted file mode 100644 index f46e49245..000000000 --- a/x/application/client/config/application_configs_reader_test.go +++ /dev/null @@ -1,143 +0,0 @@ -package config_test - -import ( - "testing" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/gogo/status" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/yaml" - "github.com/pokt-network/poktroll/x/application/client/config" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func Test_ParseApplicationConfigs(t *testing.T) { - tests := []struct { - desc string - - inputConfig string - - expectedError *sdkerrors.Error - expectedConfig *config.ApplicationStakeConfig - }{ - // Valid Configs - { - desc: "valid: service staking config", - - inputConfig: ` - stake_amount: 1000upokt - service_ids: - - svc1 - - svc2 - `, - - expectedError: nil, - expectedConfig: &config.ApplicationStakeConfig{ - StakeAmount: sdk.NewCoin("upokt", sdk.NewInt(1000)), - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - { - Service: &sharedtypes.Service{Id: "svc2"}, - }, - }, - }, - }, - // Invalid Configs - { - desc: "invalid: empty service staking config", - - inputConfig: ``, - - expectedError: config.ErrApplicationConfigEmptyContent, - }, - { - desc: "invalid: no service ids", - - inputConfig: ` - stake_amount: 1000upokt - service_ids: # explicitly omitting service ids - `, - - expectedError: config.ErrApplicationConfigInvalidServiceId, - }, - { - desc: "invalid: invalid serviceId", - - inputConfig: ` - stake_amount: 1000upokt - service_ids: - - sv c1 - `, - - expectedError: config.ErrApplicationConfigInvalidServiceId, - }, - { - desc: "invalid: no stake amount", - - inputConfig: ` - stake_amount: # explicitly omitting stake amount - service_ids: - - svc1 - - svc2 - `, - - expectedError: config.ErrApplicationConfigInvalidStake, - }, - { - desc: "invalid: non-positive stake amount", - - inputConfig: ` - stake_amount: 0upokt - service_ids: - - svc1 - - svc2 - `, - - expectedError: config.ErrApplicationConfigInvalidStake, - }, - { - desc: "invalid: unsupported stake denom", - - inputConfig: ` - stake_amount: 1000npokt - service_ids: - - svc1 - - svc2 - `, - - expectedError: config.ErrApplicationConfigInvalidStake, - }, - } - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - normalizedConfig := yaml.NormalizeYAMLIndentation(tt.inputConfig) - appServiceConfig, err := config.ParseApplicationConfigs([]byte(normalizedConfig)) - - if tt.expectedError != nil { - require.Error(t, err) - require.ErrorIs(t, err, tt.expectedError) - stat, ok := status.FromError(tt.expectedError) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.expectedError.Error()) - require.Nil(t, appServiceConfig) - return - } - - require.NoError(t, err) - - require.Equal(t, tt.expectedConfig.StakeAmount.Amount, appServiceConfig.StakeAmount.Amount) - require.Equal(t, tt.expectedConfig.StakeAmount.Denom, appServiceConfig.StakeAmount.Denom) - - t.Logf("serviceIds: %v", tt.expectedConfig.Services) - require.Equal(t, len(tt.expectedConfig.Services), len(appServiceConfig.Services)) - for i, expected := range tt.expectedConfig.Services { - require.Equal(t, expected.Service.Id, appServiceConfig.Services[i].Service.Id) - } - }) - } -} diff --git a/x/application/client/config/errors.go b/x/application/client/config/errors.go deleted file mode 100644 index cc009197e..000000000 --- a/x/application/client/config/errors.go +++ /dev/null @@ -1,11 +0,0 @@ -package config - -import sdkerrors "cosmossdk.io/errors" - -var ( - codespace = "applicationconfig" - ErrApplicationConfigUnmarshalYAML = sdkerrors.Register(codespace, 1, "config reader cannot unmarshal yaml content") - ErrApplicationConfigInvalidServiceId = sdkerrors.Register(codespace, 2, "invalid serviceId in application config") - ErrApplicationConfigEmptyContent = sdkerrors.Register(codespace, 3, "empty application config content") - ErrApplicationConfigInvalidStake = sdkerrors.Register(codespace, 4, "invalid stake amount in application config") -) diff --git a/x/application/genesis.go b/x/application/genesis.go deleted file mode 100644 index 713c9da61..000000000 --- a/x/application/genesis.go +++ /dev/null @@ -1,29 +0,0 @@ -package application - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" -) - -// InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - // Set all the application - for _, app := range genState.ApplicationList { - k.SetApplication(ctx, app) - } - // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) -} - -// ExportGenesis returns the module's exported genesis -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) - - genesis.ApplicationList = k.GetAllApplication(ctx) - // this line is used by starport scaffolding # genesis/module/export - - return genesis -} diff --git a/x/application/genesis_test.go b/x/application/genesis_test.go deleted file mode 100644 index 74ac91f37..000000000 --- a/x/application/genesis_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package application_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/application" - "github.com/pokt-network/poktroll/x/application/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// Please see `x/application/types/genesis_test.go` for extensive tests related to the validity of the genesis state. -func TestGenesis(t *testing.T) { - genesisState := types.GenesisState{ - Params: types.DefaultParams(), - ApplicationList: []types.Application{ - { - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - }, - { - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc2"}, - }, - }, - }, - }, - // this line is used by starport scaffolding # genesis/test/state - } - - k, ctx := keepertest.ApplicationKeeper(t) - application.InitGenesis(ctx, *k, genesisState) - got := application.ExportGenesis(ctx, *k) - require.NotNil(t, got) - - nullify.Fill(&genesisState) - nullify.Fill(got) - - require.ElementsMatch(t, genesisState.ApplicationList, got.ApplicationList) - // this line is used by starport scaffolding # genesis/test/assert -} diff --git a/x/application/keeper/application.go b/x/application/keeper/application.go deleted file mode 100644 index b95b77f9e..000000000 --- a/x/application/keeper/application.go +++ /dev/null @@ -1,64 +0,0 @@ -package keeper - -import ( - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/application/types" -) - -// SetApplication set a specific application in the store from its index -func (k Keeper) SetApplication(ctx sdk.Context, application types.Application) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ApplicationKeyPrefix)) - b := k.cdc.MustMarshal(&application) - store.Set(types.ApplicationKey( - application.Address, - ), b) -} - -// GetApplication returns a application from its index -func (k Keeper) GetApplication( - ctx sdk.Context, - appAddr string, - -) (app types.Application, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ApplicationKeyPrefix)) - - b := store.Get(types.ApplicationKey( - appAddr, - )) - if b == nil { - return app, false - } - - k.cdc.MustUnmarshal(b, &app) - return app, true -} - -// RemoveApplication removes a application from the store -func (k Keeper) RemoveApplication( - ctx sdk.Context, - appAddr string, - -) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ApplicationKeyPrefix)) - store.Delete(types.ApplicationKey( - appAddr, - )) -} - -// GetAllApplication returns all application -func (k Keeper) GetAllApplication(ctx sdk.Context) (apps []types.Application) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ApplicationKeyPrefix)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var val types.Application - k.cdc.MustUnmarshal(iterator.Value(), &val) - apps = append(apps, val) - } - - return -} diff --git a/x/application/keeper/application_test.go b/x/application/keeper/application_test.go deleted file mode 100644 index 6af5e3d26..000000000 --- a/x/application/keeper/application_test.go +++ /dev/null @@ -1,86 +0,0 @@ -package keeper_test - -import ( - "fmt" - "strconv" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func init() { - cmd.InitSDKConfig() -} - -func createNApplication(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Application { - apps := make([]types.Application, n) - for i := range apps { - app := &apps[i] - app.Address = sample.AccAddress() - app.Stake = &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(int64(i))} - app.ServiceConfigs = []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: fmt.Sprintf("svc%d", i)}, - }, - } - keeper.SetApplication(ctx, *app) - } - return apps -} - -func TestApplicationGet(t *testing.T) { - keeper, ctx := keepertest.ApplicationKeeper(t) - apps := createNApplication(keeper, ctx, 10) - for _, app := range apps { - appFound, isAppFound := keeper.GetApplication(ctx, - app.Address, - ) - require.True(t, isAppFound) - require.Equal(t, - nullify.Fill(&app), - nullify.Fill(&appFound), - ) - } -} -func TestApplicationRemove(t *testing.T) { - keeper, ctx := keepertest.ApplicationKeeper(t) - apps := createNApplication(keeper, ctx, 10) - for _, app := range apps { - keeper.RemoveApplication(ctx, - app.Address, - ) - _, found := keeper.GetApplication(ctx, - app.Address, - ) - require.False(t, found) - } -} - -func TestApplicationGetAll(t *testing.T) { - keeper, ctx := keepertest.ApplicationKeeper(t) - apps := createNApplication(keeper, ctx, 10) - require.ElementsMatch(t, - nullify.Fill(apps), - nullify.Fill(keeper.GetAllApplication(ctx)), - ) -} - -// The application module address is derived off of its semantic name. -// This test is a helper for us to easily identify the underlying address. -func TestApplicationModuleAddress(t *testing.T) { - moduleAddress := authtypes.NewModuleAddress(types.ModuleName) - require.Equal(t, "pokt1rl3gjgzexmplmds3tq3r3yk84zlwdl6djzgsvm", moduleAddress.String()) -} diff --git a/x/application/keeper/keeper.go b/x/application/keeper/keeper.go deleted file mode 100644 index 38ac34db4..000000000 --- a/x/application/keeper/keeper.go +++ /dev/null @@ -1,57 +0,0 @@ -package keeper - -import ( - "fmt" - - "github.com/cometbft/cometbft/libs/log" - "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - "github.com/pokt-network/poktroll/x/application/types" -) - -type ( - Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace - - bankKeeper types.BankKeeper - accountKeeper types.AccountKeeper - gatewayKeeper types.GatewayKeeper - } -) - -func NewKeeper( - cdc codec.BinaryCodec, - storeKey, - memKey storetypes.StoreKey, - ps paramtypes.Subspace, - - bankKeeper types.BankKeeper, - accountKeeper types.AccountKeeper, - gatewayKeeper types.GatewayKeeper, -) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } - - return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramstore: ps, - - bankKeeper: bankKeeper, - accountKeeper: accountKeeper, - gatewayKeeper: gatewayKeeper, - } -} - -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} diff --git a/x/application/keeper/msg_server.go b/x/application/keeper/msg_server.go deleted file mode 100644 index 8f740e15c..000000000 --- a/x/application/keeper/msg_server.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/application/types" -) - -type msgServer struct { - Keeper -} - -// NewMsgServerImpl returns an implementation of the MsgServer interface -// for the provided Keeper. -func NewMsgServerImpl(keeper Keeper) types.MsgServer { - return &msgServer{Keeper: keeper} -} - -var _ types.MsgServer = msgServer{} diff --git a/x/application/keeper/msg_server_delegate_to_gateway.go b/x/application/keeper/msg_server_delegate_to_gateway.go deleted file mode 100644 index 11dea867f..000000000 --- a/x/application/keeper/msg_server_delegate_to_gateway.go +++ /dev/null @@ -1,70 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/application/types" -) - -func (k msgServer) DelegateToGateway(goCtx context.Context, msg *types.MsgDelegateToGateway) (*types.MsgDelegateToGatewayResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - logger := k.Logger(ctx).With("method", "DelegateToGateway") - logger.Info(fmt.Sprintf("About to delegate application to gateway with msg: %v", msg)) - - if err := msg.ValidateBasic(); err != nil { - logger.Error(fmt.Sprintf("Delegation Message failed basic validation: %v", err)) - return nil, err - } - - // Retrieve the application from the store - app, found := k.GetApplication(ctx, msg.AppAddress) - if !found { - logger.Info(fmt.Sprintf("Application not found with address [%s]", msg.AppAddress)) - return nil, sdkerrors.Wrapf(types.ErrAppNotFound, "application not found with address: %s", msg.AppAddress) - } - logger.Info(fmt.Sprintf("Application found with address [%s]", msg.AppAddress)) - - // Check if the gateway is staked - if _, found := k.gatewayKeeper.GetGateway(ctx, msg.GatewayAddress); !found { - logger.Info(fmt.Sprintf("Gateway not found with address [%s]", msg.GatewayAddress)) - return nil, sdkerrors.Wrapf(types.ErrAppGatewayNotFound, "gateway not found with address: %s", msg.GatewayAddress) - } - - // Ensure the application is not already delegated to the maximum number of gateways - maxDelegatedParam := k.GetParams(ctx).MaxDelegatedGateways - if int64(len(app.DelegateeGatewayAddresses)) >= maxDelegatedParam { - logger.Info(fmt.Sprintf("Application already delegated to maximum number of gateways: %d", maxDelegatedParam)) - return nil, sdkerrors.Wrapf(types.ErrAppMaxDelegatedGateways, "application already delegated to %d gateways", maxDelegatedParam) - } - - // Check if the application is already delegated to the gateway - for _, gatewayAddr := range app.DelegateeGatewayAddresses { - if gatewayAddr == msg.GatewayAddress { - logger.Info(fmt.Sprintf("Application already delegated to gateway with address [%s]", msg.GatewayAddress)) - return nil, sdkerrors.Wrapf(types.ErrAppAlreadyDelegated, "application already delegated to gateway with address: %s", msg.GatewayAddress) - } - } - - // Update the application with the new delegatee public key - app.DelegateeGatewayAddresses = append(app.DelegateeGatewayAddresses, msg.GatewayAddress) - logger.Info(fmt.Sprintf("Successfully added delegatee public key to application")) - - // Update the application store with the new delegation - k.SetApplication(ctx, app) - logger.Info(fmt.Sprintf("Successfully delegated application to gateway for app: %+v", app)) - - // Emit the application redelegation event - event := msg.NewRedelegationEvent() - logger.Info(fmt.Sprintf("Emitting application redelegation event %v", event)) - if err := ctx.EventManager().EmitTypedEvent(event); err != nil { - logger.Error(fmt.Sprintf("Failed to emit application redelegation event: %v", err)) - return nil, err - } - - return &types.MsgDelegateToGatewayResponse{}, nil -} diff --git a/x/application/keeper/msg_server_delegate_to_gateway_test.go b/x/application/keeper/msg_server_delegate_to_gateway_test.go deleted file mode 100644 index f926af58d..000000000 --- a/x/application/keeper/msg_server_delegate_to_gateway_test.go +++ /dev/null @@ -1,280 +0,0 @@ -package keeper_test - -import ( - "fmt" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func TestMsgServer_DelegateToGateway_SuccessfullyDelegate(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the application and gateways - appAddr := sample.AccAddress() - gatewayAddr1 := sample.AccAddress() - gatewayAddr2 := sample.AccAddress() - // Mock the gateway being staked via the staked gateway map - keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr1) - keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr2) - - // Prepare the application - stakeMsg := &types.MsgStakeApplication{ - Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Stake the application & verify that the application exists - _, err := srv.StakeApplication(wctx, stakeMsg) - require.NoError(t, err) - _, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - - // Prepare the delegation message - delegateMsg := &types.MsgDelegateToGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr1, - } - - // Delegate the application to the gateway - _, err = srv.DelegateToGateway(wctx, delegateMsg) - require.NoError(t, err) - events := ctx.EventManager().Events() - require.Equal(t, 1, len(events)) - require.Equal(t, "pocket.application.EventRedelegation", events[0].Type) - require.Equal(t, "app_address", events[0].Attributes[0].Key) - require.Equal(t, "gateway_address", events[0].Attributes[1].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), events[0].Attributes[0].Value) - require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddr1), events[0].Attributes[1].Value) - - // Verify that the application exists - foundApp, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, appAddr, foundApp.Address) - require.Equal(t, 1, len(foundApp.DelegateeGatewayAddresses)) - require.Equal(t, gatewayAddr1, foundApp.DelegateeGatewayAddresses[0]) - - // Prepare a second delegation message - delegateMsg2 := &types.MsgDelegateToGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr2, - } - - // Delegate the application to the second gateway - _, err = srv.DelegateToGateway(wctx, delegateMsg2) - require.NoError(t, err) - events = ctx.EventManager().Events() - require.Equal(t, 2, len(events)) - require.Equal(t, "pocket.application.EventRedelegation", events[1].Type) - require.Equal(t, "app_address", events[1].Attributes[0].Key) - require.Equal(t, "gateway_address", events[1].Attributes[1].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), events[1].Attributes[0].Value) - require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddr2), events[1].Attributes[1].Value) - - // Verify that the application exists - foundApp, isAppFound = k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, 2, len(foundApp.DelegateeGatewayAddresses)) - require.Equal(t, gatewayAddr1, foundApp.DelegateeGatewayAddresses[0]) - require.Equal(t, gatewayAddr2, foundApp.DelegateeGatewayAddresses[1]) -} - -func TestMsgServer_DelegateToGateway_FailDuplicate(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the application and gateway - appAddr := sample.AccAddress() - gatewayAddr := sample.AccAddress() - // Mock the gateway being staked via the staked gateway map - keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr) - - // Prepare the application - stakeMsg := &types.MsgStakeApplication{ - Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Stake the application & verify that the application exists - _, err := srv.StakeApplication(wctx, stakeMsg) - require.NoError(t, err) - _, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - - // Prepare the delegation message - delegateMsg := &types.MsgDelegateToGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr, - } - - // Delegate the application to the gateway - _, err = srv.DelegateToGateway(wctx, delegateMsg) - require.NoError(t, err) - events := ctx.EventManager().Events() - require.Equal(t, 1, len(events)) - require.Equal(t, "pocket.application.EventRedelegation", events[0].Type) - require.Equal(t, "app_address", events[0].Attributes[0].Key) - require.Equal(t, "gateway_address", events[0].Attributes[1].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), events[0].Attributes[0].Value) - require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddr), events[0].Attributes[1].Value) - - // Verify that the application exists - foundApp, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, appAddr, foundApp.Address) - require.Equal(t, 1, len(foundApp.DelegateeGatewayAddresses)) - require.Equal(t, gatewayAddr, foundApp.DelegateeGatewayAddresses[0]) - - // Prepare a second delegation message - delegateMsg2 := &types.MsgDelegateToGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr, - } - - // Attempt to delegate the application to the gateway again - _, err = srv.DelegateToGateway(wctx, delegateMsg2) - require.ErrorIs(t, err, types.ErrAppAlreadyDelegated) - events = ctx.EventManager().Events() - require.Equal(t, 1, len(events)) - foundApp, isAppFound = k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, 1, len(foundApp.DelegateeGatewayAddresses)) - require.Equal(t, gatewayAddr, foundApp.DelegateeGatewayAddresses[0]) -} - -func TestMsgServer_DelegateToGateway_FailGatewayNotStaked(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the application and gateway - appAddr := sample.AccAddress() - gatewayAddr := sample.AccAddress() - - // Prepare the application - stakeMsg := &types.MsgStakeApplication{ - Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Stake the application & verify that the application exists - _, err := srv.StakeApplication(wctx, stakeMsg) - require.NoError(t, err) - _, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - - // Prepare the delegation message - delegateMsg := &types.MsgDelegateToGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr, - } - - // Attempt to delegate the application to the unstaked gateway - _, err = srv.DelegateToGateway(wctx, delegateMsg) - require.ErrorIs(t, err, types.ErrAppGatewayNotFound) - foundApp, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, 0, len(foundApp.DelegateeGatewayAddresses)) -} - -func TestMsgServer_DelegateToGateway_FailMaxReached(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the application - appAddr := sample.AccAddress() - - // Prepare the application - stakeMsg := &types.MsgStakeApplication{ - Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Stake the application & verify that the application exists - _, err := srv.StakeApplication(wctx, stakeMsg) - require.NoError(t, err) - _, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - - // Delegate the application to the max number of gateways - maxDelegatedParam := k.GetParams(ctx).MaxDelegatedGateways - gatewayAddresses := make([]string, maxDelegatedParam) - for i := int64(0); i < k.GetParams(ctx).MaxDelegatedGateways; i++ { - // Prepare the delegation message - gatewayAddr := sample.AccAddress() - gatewayAddresses[i] = gatewayAddr - // Mock the gateway being staked via the staked gateway map - keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr) - delegateMsg := &types.MsgDelegateToGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr, - } - // Delegate the application to the gateway - _, err = srv.DelegateToGateway(wctx, delegateMsg) - require.NoError(t, err) - // Check number of gateways delegated to is correct - foundApp, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, int(i+1), len(foundApp.DelegateeGatewayAddresses)) - } - - events := ctx.EventManager().Events() - require.Equal(t, int(maxDelegatedParam), len(events)) - for i, event := range events { - require.Equal(t, "pocket.application.EventRedelegation", event.Type) - require.Equal(t, "app_address", event.Attributes[0].Key) - require.Equal(t, "gateway_address", event.Attributes[1].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), event.Attributes[0].Value) - require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddresses[i]), event.Attributes[1].Value) - } - - // Generate an address for the gateway that'll exceed the max - gatewayAddr := sample.AccAddress() - keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr) - - // Prepare the delegation message - delegateMsg := &types.MsgDelegateToGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr, - } - - // Attempt to delegate the application when the max is already reached - _, err = srv.DelegateToGateway(wctx, delegateMsg) - require.ErrorIs(t, err, types.ErrAppMaxDelegatedGateways) - events = ctx.EventManager().Events() - require.Equal(t, int(maxDelegatedParam), len(events)) - foundApp, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, maxDelegatedParam, int64(len(foundApp.DelegateeGatewayAddresses))) -} diff --git a/x/application/keeper/msg_server_stake_application.go b/x/application/keeper/msg_server_stake_application.go deleted file mode 100644 index da22a134e..000000000 --- a/x/application/keeper/msg_server_stake_application.go +++ /dev/null @@ -1,105 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/application/types" -) - -func (k msgServer) StakeApplication( - goCtx context.Context, - msg *types.MsgStakeApplication, -) (*types.MsgStakeApplicationResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - logger := k.Logger(ctx).With("method", "StakeApplication") - logger.Info(fmt.Sprintf("About to stake application with msg: %v", msg)) - - if err := msg.ValidateBasic(); err != nil { - logger.Error(fmt.Sprintf("invalid MsgStakeApplication: %v", err)) - return nil, err - } - - // Check if the application already exists or not - var err error - var coinsToDelegate sdk.Coin - app, isAppFound := k.GetApplication(ctx, msg.Address) - if !isAppFound { - logger.Info(fmt.Sprintf("Application not found. Creating new application for address %s", msg.Address)) - app = k.createApplication(ctx, msg) - coinsToDelegate = *msg.Stake - } else { - logger.Info(fmt.Sprintf("Application found. Updating application for address %s", msg.Address)) - currAppStake := *app.Stake - if err = k.updateApplication(ctx, &app, msg); err != nil { - return nil, err - } - coinsToDelegate = (*msg.Stake).Sub(currAppStake) - } - - // Retrieve the address of the application - appAddress, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) - return nil, err - } - - // TODO_IMPROVE: Should we avoid making this call if `coinsToDelegate` = 0? - // Send the coins from the application to the staked application pool - err = k.bankKeeper.DelegateCoinsFromAccountToModule(ctx, appAddress, types.ModuleName, []sdk.Coin{coinsToDelegate}) - if err != nil { - logger.Error(fmt.Sprintf("could not send %v coins from %s to %s module account due to %v", coinsToDelegate, appAddress, types.ModuleName, err)) - return nil, err - } - - // Update the Application in the store - k.SetApplication(ctx, app) - logger.Info(fmt.Sprintf("Successfully updated application stake for app: %+v", app)) - - return &types.MsgStakeApplicationResponse{}, nil -} - -func (k msgServer) createApplication( - ctx sdk.Context, - msg *types.MsgStakeApplication, -) types.Application { - return types.Application{ - Address: msg.Address, - Stake: msg.Stake, - ServiceConfigs: msg.Services, - DelegateeGatewayAddresses: make([]string, 0), - } -} - -func (k msgServer) updateApplication( - ctx sdk.Context, - app *types.Application, - msg *types.MsgStakeApplication, -) error { - // Checks if the the msg address is the same as the current owner - if msg.Address != app.Address { - return sdkerrors.Wrapf(types.ErrAppUnauthorized, "msg Address (%s) != application address (%s)", msg.Address, app.Address) - } - - // Validate that the stake is not being lowered - if msg.Stake == nil { - return sdkerrors.Wrapf(types.ErrAppInvalidStake, "stake amount cannot be nil") - } - if msg.Stake.IsLTE(*app.Stake) { - return sdkerrors.Wrapf(types.ErrAppInvalidStake, "stake amount %v must be higher than previous stake amount %v", msg.Stake, app.Stake) - } - app.Stake = msg.Stake - - // Validate that the service configs maintain at least one service. - // Additional validation is done in `msg.ValidateBasic` above. - if len(msg.Services) == 0 { - return sdkerrors.Wrapf(types.ErrAppInvalidServiceConfigs, "must have at least one service") - } - app.ServiceConfigs = msg.Services - - return nil -} diff --git a/x/application/keeper/msg_server_stake_application_test.go b/x/application/keeper/msg_server_stake_application_test.go deleted file mode 100644 index d3e858987..000000000 --- a/x/application/keeper/msg_server_stake_application_test.go +++ /dev/null @@ -1,181 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func TestMsgServer_StakeApplication_SuccessfulCreateAndUpdate(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the application - addr := sample.AccAddress() - - // Verify that the app does not exist yet - _, isAppFound := k.GetApplication(ctx, addr) - require.False(t, isAppFound) - - // Prepare the application - stakeMsg := &types.MsgStakeApplication{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Stake the application - _, err := srv.StakeApplication(wctx, stakeMsg) - require.NoError(t, err) - - // Verify that the application exists - appFound, isAppFound := k.GetApplication(ctx, addr) - require.True(t, isAppFound) - require.Equal(t, addr, appFound.Address) - require.Equal(t, int64(100), appFound.Stake.Amount.Int64()) - require.Len(t, appFound.ServiceConfigs, 1) - require.Equal(t, "svc1", appFound.ServiceConfigs[0].Service.Id) - - // Prepare an updated application with a higher stake and another service - updateStakeMsg := &types.MsgStakeApplication{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(200)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - { - Service: &sharedtypes.Service{Id: "svc2"}, - }, - }, - } - - // Update the staked application - _, err = srv.StakeApplication(wctx, updateStakeMsg) - require.NoError(t, err) - appFound, isAppFound = k.GetApplication(ctx, addr) - require.True(t, isAppFound) - require.Equal(t, int64(200), appFound.Stake.Amount.Int64()) - require.Len(t, appFound.ServiceConfigs, 2) - require.Equal(t, "svc1", appFound.ServiceConfigs[0].Service.Id) - require.Equal(t, "svc2", appFound.ServiceConfigs[1].Service.Id) -} - -func TestMsgServer_StakeApplication_FailRestakingDueToInvalidServices(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - appAddr := sample.AccAddress() - - // Prepare the application stake message - stakeMsg := &types.MsgStakeApplication{ - Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Stake the application - _, err := srv.StakeApplication(wctx, stakeMsg) - require.NoError(t, err) - - // Prepare the application stake message without any services - updateStakeMsg := &types.MsgStakeApplication{ - Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{}, - } - - // Fail updating the application when the list of services is empty - _, err = srv.StakeApplication(wctx, updateStakeMsg) - require.Error(t, err) - - // Verify the app still exists and is staked for svc1 - app, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, appAddr, app.Address) - require.Len(t, app.ServiceConfigs, 1) - require.Equal(t, "svc1", app.ServiceConfigs[0].Service.Id) - - // Prepare the application stake message with an invalid service ID - updateStakeMsg = &types.MsgStakeApplication{ - Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1 INVALID ! & *"}, - }, - }, - } - - // Fail updating the application when the list of services is empty - _, err = srv.StakeApplication(wctx, updateStakeMsg) - require.Error(t, err) - - // Verify the app still exists and is staked for svc1 - app, isAppFound = k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, appAddr, app.Address) - require.Len(t, app.ServiceConfigs, 1) - require.Equal(t, "svc1", app.ServiceConfigs[0].Service.Id) -} - -func TestMsgServer_StakeApplication_FailLoweringStake(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Prepare the application - addr := sample.AccAddress() - stakeMsg := &types.MsgStakeApplication{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Stake the application & verify that the application exists - _, err := srv.StakeApplication(wctx, stakeMsg) - require.NoError(t, err) - _, isAppFound := k.GetApplication(ctx, addr) - require.True(t, isAppFound) - - // Prepare an updated application with a lower stake - updateMsg := &types.MsgStakeApplication{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(50)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Verify that it fails - _, err = srv.StakeApplication(wctx, updateMsg) - require.Error(t, err) - - // Verify that the application stake is unchanged - appFound, isAppFound := k.GetApplication(ctx, addr) - require.True(t, isAppFound) - require.Equal(t, int64(100), appFound.Stake.Amount.Int64()) -} diff --git a/x/application/keeper/msg_server_test.go b/x/application/keeper/msg_server_test.go deleted file mode 100644 index cc6a8f16f..000000000 --- a/x/application/keeper/msg_server_test.go +++ /dev/null @@ -1,24 +0,0 @@ -package keeper_test - -import ( - "context" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" -) - -func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { - k, ctx := keepertest.ApplicationKeeper(t) - return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx) -} - -func TestMsgServer(t *testing.T) { - ms, ctx := setupMsgServer(t) - require.NotNil(t, ms) - require.NotNil(t, ctx) -} diff --git a/x/application/keeper/msg_server_undelegate_from_gateway.go b/x/application/keeper/msg_server_undelegate_from_gateway.go deleted file mode 100644 index 5c755e648..000000000 --- a/x/application/keeper/msg_server_undelegate_from_gateway.go +++ /dev/null @@ -1,63 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/application/types" -) - -func (k msgServer) UndelegateFromGateway( - goCtx context.Context, - msg *types.MsgUndelegateFromGateway, -) (*types.MsgUndelegateFromGatewayResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - logger := k.Logger(ctx).With("method", "UndelegateFromGateway") - logger.Info(fmt.Sprintf("About to undelegate application from gateway with msg: %v", msg)) - - if err := msg.ValidateBasic(); err != nil { - logger.Error(fmt.Sprintf("Undelegation Message failed basic validation: %v", err)) - return nil, err - } - - // Retrieve the application from the store - app, found := k.GetApplication(ctx, msg.AppAddress) - if !found { - logger.Info(fmt.Sprintf("Application not found with address [%s]", msg.AppAddress)) - return nil, sdkerrors.Wrapf(types.ErrAppNotFound, "application not found with address: %s", msg.AppAddress) - } - logger.Info(fmt.Sprintf("Application found with address [%s]", msg.AppAddress)) - - // Check if the application is already delegated to the gateway - foundIdx := -1 - for i, gatewayAddr := range app.DelegateeGatewayAddresses { - if gatewayAddr == msg.GatewayAddress { - foundIdx = i - } - } - if foundIdx == -1 { - logger.Info(fmt.Sprintf("Application not delegated to gateway with address [%s]", msg.GatewayAddress)) - return nil, sdkerrors.Wrapf(types.ErrAppNotDelegated, "application not delegated to gateway with address: %s", msg.GatewayAddress) - } - - // Remove the gateway from the application's delegatee gateway public keys - app.DelegateeGatewayAddresses = append(app.DelegateeGatewayAddresses[:foundIdx], app.DelegateeGatewayAddresses[foundIdx+1:]...) - - // Update the application store with the new delegation - k.SetApplication(ctx, app) - logger.Info(fmt.Sprintf("Successfully undelegated application from gateway for app: %+v", app)) - - // Emit the application redelegation event - event := msg.NewRedelegationEvent() - logger.Info(fmt.Sprintf("Emitting application redelegation event %v", event)) - if err := ctx.EventManager().EmitTypedEvent(event); err != nil { - logger.Error(fmt.Sprintf("Failed to emit application redelegation event: %v", err)) - return nil, err - } - - return &types.MsgUndelegateFromGatewayResponse{}, nil -} diff --git a/x/application/keeper/msg_server_undelegate_from_gateway_test.go b/x/application/keeper/msg_server_undelegate_from_gateway_test.go deleted file mode 100644 index 63dba4f31..000000000 --- a/x/application/keeper/msg_server_undelegate_from_gateway_test.go +++ /dev/null @@ -1,257 +0,0 @@ -package keeper_test - -import ( - "fmt" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func TestMsgServer_UndelegateFromGateway_SuccessfullyUndelegate(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the application and gateways - appAddr := sample.AccAddress() - maxDelegatedGateways := k.GetParams(ctx).MaxDelegatedGateways - gatewayAddresses := make([]string, int(maxDelegatedGateways)) - for i := 0; i < len(gatewayAddresses); i++ { - gatewayAddr := sample.AccAddress() - // Mock the gateway being staked via the staked gateway map - keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr) - gatewayAddresses[i] = gatewayAddr - } - - // Prepare the application - stakeMsg := &types.MsgStakeApplication{ - Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Stake the application & verify that the application exists - _, err := srv.StakeApplication(wctx, stakeMsg) - require.NoError(t, err) - _, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - - // Prepare the delegation messages and delegate the application to the gateways - for _, gatewayAddr := range gatewayAddresses { - delegateMsg := &types.MsgDelegateToGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr, - } - // Delegate the application to the gateway - _, err = srv.DelegateToGateway(wctx, delegateMsg) - require.NoError(t, err) - } - events := ctx.EventManager().Events() - require.Equal(t, int(maxDelegatedGateways), len(events)) - for i, event := range events { - require.Equal(t, "pocket.application.EventRedelegation", event.Type) - require.Equal(t, "app_address", event.Attributes[0].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), event.Attributes[0].Value) - require.Equal(t, "gateway_address", event.Attributes[1].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddresses[i]), event.Attributes[1].Value) - } - - // Verify that the application exists - foundApp, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, appAddr, foundApp.Address) - require.Equal(t, maxDelegatedGateways, int64(len(foundApp.DelegateeGatewayAddresses))) - for i, gatewayAddr := range gatewayAddresses { - require.Equal(t, gatewayAddr, foundApp.DelegateeGatewayAddresses[i]) - } - - // Prepare an undelegation message - undelegateMsg := &types.MsgUndelegateFromGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddresses[3], - } - - // Undelegate the application from the gateway - _, err = srv.UndelegateFromGateway(wctx, undelegateMsg) - require.NoError(t, err) - events = ctx.EventManager().Events() - require.Equal(t, int(maxDelegatedGateways)+1, len(events)) - require.Equal(t, "pocket.application.EventRedelegation", events[7].Type) - require.Equal(t, "app_address", events[7].Attributes[0].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), events[7].Attributes[0].Value) - require.Equal(t, "gateway_address", events[7].Attributes[1].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddresses[3]), events[7].Attributes[1].Value) - - // Verify that the application exists - foundApp, isAppFound = k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, appAddr, foundApp.Address) - require.Equal(t, maxDelegatedGateways-1, int64(len(foundApp.DelegateeGatewayAddresses))) - gatewayAddresses = append(gatewayAddresses[:3], gatewayAddresses[4:]...) - for i, gatewayAddr := range gatewayAddresses { - require.Equal(t, gatewayAddr, foundApp.DelegateeGatewayAddresses[i]) - } -} - -func TestMsgServer_UndelegateFromGateway_FailNotDelegated(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the application and gateway - appAddr := sample.AccAddress() - gatewayAddr1 := sample.AccAddress() - gatewayAddr2 := sample.AccAddress() - // Mock the gateway being staked via the staked gateway map - keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr1) - keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr2) - - // Prepare the application - stakeMsg := &types.MsgStakeApplication{ - Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Stake the application & verify that the application exists - _, err := srv.StakeApplication(wctx, stakeMsg) - require.NoError(t, err) - _, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - - // Prepare the undelegation message - undelegateMsg := &types.MsgUndelegateFromGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr1, - } - - // Attempt to undelgate the application from the gateway - _, err = srv.UndelegateFromGateway(wctx, undelegateMsg) - require.ErrorIs(t, err, types.ErrAppNotDelegated) - foundApp, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, appAddr, foundApp.Address) - require.Equal(t, 0, len(foundApp.DelegateeGatewayAddresses)) - events := ctx.EventManager().Events() - require.Equal(t, 0, len(events)) - - // Prepare a delegation message - delegateMsg := &types.MsgDelegateToGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr2, - } - - // Delegate the application to the gateway - _, err = srv.DelegateToGateway(wctx, delegateMsg) - require.NoError(t, err) - events = ctx.EventManager().Events() - require.Equal(t, 1, len(events)) - require.Equal(t, "pocket.application.EventRedelegation", events[0].Type) - require.Equal(t, "app_address", events[0].Attributes[0].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), events[0].Attributes[0].Value) - require.Equal(t, "gateway_address", events[0].Attributes[1].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddr2), events[0].Attributes[1].Value) - - // Ensure the failed undelegation did not affect the application - _, err = srv.UndelegateFromGateway(wctx, undelegateMsg) - require.ErrorIs(t, err, types.ErrAppNotDelegated) - events = ctx.EventManager().Events() - require.Equal(t, 1, len(events)) - foundApp, isAppFound = k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, 1, len(foundApp.DelegateeGatewayAddresses)) - require.Equal(t, gatewayAddr2, foundApp.DelegateeGatewayAddresses[0]) -} - -func TestMsgServer_UndelegateFromGateway_SuccessfullyUndelegateFromUnstakedGateway(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the application and gateways - appAddr := sample.AccAddress() - gatewayAddr := sample.AccAddress() - // Mock the gateway being staked via the staked gateway map - keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr) - - // Prepare the application - stakeMsg := &types.MsgStakeApplication{ - Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Stake the application & verify that the application exists - _, err := srv.StakeApplication(wctx, stakeMsg) - require.NoError(t, err) - _, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - - // Prepare the delegation message and delegate the application to the gateway - delegateMsg := &types.MsgDelegateToGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr, - } - // Delegate the application to the gateway - _, err = srv.DelegateToGateway(wctx, delegateMsg) - require.NoError(t, err) - events := ctx.EventManager().Events() - require.Equal(t, 1, len(events)) - require.Equal(t, "pocket.application.EventRedelegation", events[0].Type) - require.Equal(t, "app_address", events[0].Attributes[0].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), events[0].Attributes[0].Value) - require.Equal(t, "gateway_address", events[0].Attributes[1].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddr), events[0].Attributes[1].Value) - - // Verify that the application exists - foundApp, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, appAddr, foundApp.Address) - require.Equal(t, 1, len(foundApp.DelegateeGatewayAddresses)) - require.Equal(t, gatewayAddr, foundApp.DelegateeGatewayAddresses[0]) - - // Mock unstaking the gateway - keepertest.RemoveGatewayFromStakedGatewayMap(t, gatewayAddr) - - // Prepare an undelegation message - undelegateMsg := &types.MsgUndelegateFromGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr, - } - - // Undelegate the application from the gateway - _, err = srv.UndelegateFromGateway(wctx, undelegateMsg) - require.NoError(t, err) - events = ctx.EventManager().Events() - require.Equal(t, 2, len(events)) - require.Equal(t, "pocket.application.EventRedelegation", events[1].Type) - require.Equal(t, "app_address", events[1].Attributes[0].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), events[1].Attributes[0].Value) - require.Equal(t, "gateway_address", events[0].Attributes[1].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddr), events[0].Attributes[1].Value) - - // Verify that the application exists - foundApp, isAppFound = k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, appAddr, foundApp.Address) - require.Equal(t, 0, len(foundApp.DelegateeGatewayAddresses)) -} diff --git a/x/application/keeper/msg_server_unstake_application.go b/x/application/keeper/msg_server_unstake_application.go deleted file mode 100644 index d6f582aaa..000000000 --- a/x/application/keeper/msg_server_unstake_application.go +++ /dev/null @@ -1,50 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/application/types" -) - -// TODO(#73): Determine if an application needs an unbonding period after unstaking. -func (k msgServer) UnstakeApplication( - goCtx context.Context, - msg *types.MsgUnstakeApplication, -) (*types.MsgUnstakeApplicationResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - logger := k.Logger(ctx).With("method", "UnstakeApplication") - logger.Info(fmt.Sprintf("About to unstake application with msg: %v", msg)) - - // Check if the application already exists or not - var err error - app, isAppFound := k.GetApplication(ctx, msg.Address) - if !isAppFound { - logger.Info(fmt.Sprintf("Application not found. Cannot unstake address %s", msg.Address)) - return nil, types.ErrAppNotFound - } - logger.Info(fmt.Sprintf("Application found. Unstaking application for address %s", msg.Address)) - - // Retrieve the address of the application - appAddress, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) - return nil, err - } - - // Send the coins from the application pool back to the application - err = k.bankKeeper.UndelegateCoinsFromModuleToAccount(ctx, types.ModuleName, appAddress, []sdk.Coin{*app.Stake}) - if err != nil { - logger.Error(fmt.Sprintf("could not send %v coins from %s module to %s account due to %v", app.Stake, appAddress, types.ModuleName, err)) - return nil, err - } - - // Update the Application in the store - k.RemoveApplication(ctx, appAddress.String()) - logger.Info(fmt.Sprintf("Successfully removed the application: %+v", app)) - - return &types.MsgUnstakeApplicationResponse{}, nil -} diff --git a/x/application/keeper/msg_server_unstake_application_test.go b/x/application/keeper/msg_server_unstake_application_test.go deleted file mode 100644 index 4d23ff0a0..000000000 --- a/x/application/keeper/msg_server_unstake_application_test.go +++ /dev/null @@ -1,81 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func TestMsgServer_UnstakeApplication_Success(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the application - addr := sample.AccAddress() - - // Verify that the app does not exist yet - _, isAppFound := k.GetApplication(ctx, addr) - require.False(t, isAppFound) - - // Prepare the application - initialStake := sdk.NewCoin("upokt", sdk.NewInt(100)) - stakeMsg := &types.MsgStakeApplication{ - Address: addr, - Stake: &initialStake, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Stake the application - _, err := srv.StakeApplication(wctx, stakeMsg) - require.NoError(t, err) - - // Verify that the application exists - appFound, isAppFound := k.GetApplication(ctx, addr) - require.True(t, isAppFound) - require.Equal(t, addr, appFound.Address) - require.Equal(t, initialStake.Amount, appFound.Stake.Amount) - require.Len(t, appFound.ServiceConfigs, 1) - - // Unstake the application - unstakeMsg := &types.MsgUnstakeApplication{Address: addr} - _, err = srv.UnstakeApplication(wctx, unstakeMsg) - require.NoError(t, err) - - // Make sure the app can no longer be found after unstaking - _, isAppFound = k.GetApplication(ctx, addr) - require.False(t, isAppFound) -} - -func TestMsgServer_UnstakeApplication_FailIfNotStaked(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the application - addr := sample.AccAddress() - - // Verify that the app does not exist yet - _, isAppFound := k.GetApplication(ctx, addr) - require.False(t, isAppFound) - - // Unstake the application - unstakeMsg := &types.MsgUnstakeApplication{Address: addr} - _, err := srv.UnstakeApplication(wctx, unstakeMsg) - require.Error(t, err) - require.ErrorIs(t, err, types.ErrAppNotFound) - - _, isAppFound = k.GetApplication(ctx, addr) - require.False(t, isAppFound) -} diff --git a/x/application/keeper/params.go b/x/application/keeper/params.go deleted file mode 100644 index 566999f58..000000000 --- a/x/application/keeper/params.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/application/types" -) - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() -} - -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} diff --git a/x/application/keeper/params_test.go b/x/application/keeper/params_test.go deleted file mode 100644 index fb0b40921..000000000 --- a/x/application/keeper/params_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/application/types" -) - -func TestGetParams(t *testing.T) { - k, ctx := testkeeper.ApplicationKeeper(t) - params := types.DefaultParams() - - k.SetParams(ctx, params) - - require.EqualValues(t, params, k.GetParams(ctx)) -} diff --git a/x/application/keeper/query.go b/x/application/keeper/query.go deleted file mode 100644 index 288fcb527..000000000 --- a/x/application/keeper/query.go +++ /dev/null @@ -1,7 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/application/types" -) - -var _ types.QueryServer = Keeper{} diff --git a/x/application/keeper/query_application.go b/x/application/keeper/query_application.go deleted file mode 100644 index c08c3c925..000000000 --- a/x/application/keeper/query_application.go +++ /dev/null @@ -1,59 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/application/types" -) - -func (k Keeper) ApplicationAll(goCtx context.Context, req *types.QueryAllApplicationRequest) (*types.QueryAllApplicationResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - var applications []types.Application - ctx := sdk.UnwrapSDKContext(goCtx) - - store := ctx.KVStore(k.storeKey) - applicationStore := prefix.NewStore(store, types.KeyPrefix(types.ApplicationKeyPrefix)) - - pageRes, err := query.Paginate(applicationStore, req.Pagination, func(key []byte, value []byte) error { - var application types.Application - if err := k.cdc.Unmarshal(value, &application); err != nil { - return err - } - - applications = append(applications, application) - return nil - }) - - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryAllApplicationResponse{Application: applications, Pagination: pageRes}, nil -} - -func (k Keeper) Application(goCtx context.Context, req *types.QueryGetApplicationRequest) (*types.QueryGetApplicationResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - - val, found := k.GetApplication( - ctx, - req.Address, - ) - if !found { - return nil, status.Error(codes.NotFound, fmt.Sprintf("application not found: address %s", req.Address)) - } - - return &types.QueryGetApplicationResponse{Application: val}, nil -} diff --git a/x/application/keeper/query_application_test.go b/x/application/keeper/query_application_test.go deleted file mode 100644 index 0cc9c35e9..000000000 --- a/x/application/keeper/query_application_test.go +++ /dev/null @@ -1,127 +0,0 @@ -package keeper_test - -import ( - "strconv" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/application/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func TestApplicationQuerySingle(t *testing.T) { - keeper, ctx := keepertest.ApplicationKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - msgs := createNApplication(keeper, ctx, 2) - tests := []struct { - desc string - request *types.QueryGetApplicationRequest - response *types.QueryGetApplicationResponse - err error - }{ - { - desc: "First", - request: &types.QueryGetApplicationRequest{ - Address: msgs[0].Address, - }, - response: &types.QueryGetApplicationResponse{Application: msgs[0]}, - }, - { - desc: "Second", - request: &types.QueryGetApplicationRequest{ - Address: msgs[1].Address, - }, - response: &types.QueryGetApplicationResponse{Application: msgs[1]}, - }, - { - desc: "KeyNotFound", - request: &types.QueryGetApplicationRequest{ - Address: strconv.Itoa(100000), - }, - err: status.Error(codes.NotFound, "application not found"), - }, - { - desc: "InvalidRequest", - err: status.Error(codes.InvalidArgument, "invalid request"), - }, - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.Application(wctx, tc.request) - if tc.err != nil { - require.ErrorContains(t, err, tc.err.Error()) - } else { - require.NoError(t, err) - require.Equal(t, - nullify.Fill(tc.response), - nullify.Fill(response), - ) - } - }) - } -} - -func TestApplicationQueryPaginated(t *testing.T) { - keeper, ctx := keepertest.ApplicationKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - msgs := createNApplication(keeper, ctx, 5) - - request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllApplicationRequest { - return &types.QueryAllApplicationRequest{ - Pagination: &query.PageRequest{ - Key: next, - Offset: offset, - Limit: limit, - CountTotal: total, - }, - } - } - t.Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < len(msgs); i += step { - resp, err := keeper.ApplicationAll(wctx, request(nil, uint64(i), uint64(step), false)) - require.NoError(t, err) - require.LessOrEqual(t, len(resp.Application), step) - require.Subset(t, - nullify.Fill(msgs), - nullify.Fill(resp.Application), - ) - } - }) - t.Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < len(msgs); i += step { - resp, err := keeper.ApplicationAll(wctx, request(next, 0, uint64(step), false)) - require.NoError(t, err) - require.LessOrEqual(t, len(resp.Application), step) - require.Subset(t, - nullify.Fill(msgs), - nullify.Fill(resp.Application), - ) - next = resp.Pagination.NextKey - } - }) - t.Run("Total", func(t *testing.T) { - resp, err := keeper.ApplicationAll(wctx, request(nil, 0, 0, true)) - require.NoError(t, err) - require.Equal(t, len(msgs), int(resp.Pagination.Total)) - require.ElementsMatch(t, - nullify.Fill(msgs), - nullify.Fill(resp.Application), - ) - }) - t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.ApplicationAll(wctx, nil) - require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) - }) -} diff --git a/x/application/keeper/query_params.go b/x/application/keeper/query_params.go deleted file mode 100644 index b0c717d4f..000000000 --- a/x/application/keeper/query_params.go +++ /dev/null @@ -1,20 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/application/types" -) - -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil -} diff --git a/x/application/keeper/query_params_test.go b/x/application/keeper/query_params_test.go deleted file mode 100644 index 6463c3764..000000000 --- a/x/application/keeper/query_params_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/application/types" -) - -func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.ApplicationKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - params := types.DefaultParams() - keeper.SetParams(ctx, params) - - response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) - require.NoError(t, err) - require.Equal(t, &types.QueryParamsResponse{Params: params}, response) -} diff --git a/x/application/module.go b/x/application/module.go deleted file mode 100644 index 44ba01150..000000000 --- a/x/application/module.go +++ /dev/null @@ -1,150 +0,0 @@ -package application - -import ( - "context" - "encoding/json" - "fmt" - - // this line is used by starport scaffolding # 1 - - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - abci "github.com/cometbft/cometbft/abci/types" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - - "github.com/pokt-network/poktroll/x/application/client/cli" - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface that defines the independent methods a Cosmos SDK module needs to implement. -type AppModuleBasic struct { - cdc codec.BinaryCodec -} - -func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} - -// Name returns the name of the module as a string -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(reg) -} - -// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) -} - -// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var genState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - return genState.Validate() -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) -} - -// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper -} - -func NewAppModule( - cdc codec.Codec, - keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, -) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - } -} - -// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) -} - -// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the module's genesis initialization. It returns no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, genState) - - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(genState) -} - -// ConsensusVersion is a sequence number for state-breaking change of the 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 } - -// BeginBlock contains the logic that is automatically triggered at the beginning of each block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} - -// EndBlock contains the logic that is automatically triggered at the end of each block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} diff --git a/x/application/module_simulation.go b/x/application/module_simulation.go deleted file mode 100644 index 9982f2db9..000000000 --- a/x/application/module_simulation.go +++ /dev/null @@ -1,157 +0,0 @@ -package application - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/cosmos/cosmos-sdk/x/simulation" - - "github.com/pokt-network/poktroll/testutil/sample" - applicationsimulation "github.com/pokt-network/poktroll/x/application/simulation" - "github.com/pokt-network/poktroll/x/application/types" -) - -// avoid unused import issue -var ( - _ = sample.AccAddress - _ = applicationsimulation.FindAccount - _ = simulation.MsgEntryKind - _ = baseapp.Paramspace - _ = rand.Rand{} -) - -const ( - opWeightMsgStakeApplication = "op_weight_msg_stake_application" - // TODO: Determine the simulation weight value - defaultWeightMsgStakeApplication int = 100 - - opWeightMsgUnstakeApplication = "op_weight_msg_unstake_application" - // TODO: Determine the simulation weight value - defaultWeightMsgUnstakeApplication int = 100 - - opWeightMsgDelegateToGateway = "op_weight_msg_delegate_to_gateway" - // TODO: Determine the simulation weight value - defaultWeightMsgDelegateToGateway int = 100 - - opWeightMsgUndelegateFromGateway = "op_weight_msg_undelegate_from_gateway" - // TODO: Determine the simulation weight value - defaultWeightMsgUndelegateFromGateway int = 100 - - // this line is used by starport scaffolding # simapp/module/const -) - -// GenerateGenesisState creates a randomized GenState of the module. -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - accs := make([]string, len(simState.Accounts)) - for i, acc := range simState.Accounts { - accs[i] = acc.Address.String() - } - applicationGenesis := types.GenesisState{ - Params: types.DefaultParams(), - // this line is used by starport scaffolding # simapp/module/genesisState - } - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&applicationGenesis) -} - -// RegisterStoreDecoder registers a decoder. -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - -// WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - operations := make([]simtypes.WeightedOperation, 0) - - var weightMsgStakeApplication int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgStakeApplication, &weightMsgStakeApplication, nil, - func(_ *rand.Rand) { - weightMsgStakeApplication = defaultWeightMsgStakeApplication - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgStakeApplication, - applicationsimulation.SimulateMsgStakeApplication(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgUnstakeApplication int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgUnstakeApplication, &weightMsgUnstakeApplication, nil, - func(_ *rand.Rand) { - weightMsgUnstakeApplication = defaultWeightMsgUnstakeApplication - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgUnstakeApplication, - applicationsimulation.SimulateMsgUnstakeApplication(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgDelegateToGateway int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgDelegateToGateway, &weightMsgDelegateToGateway, nil, - func(_ *rand.Rand) { - weightMsgDelegateToGateway = defaultWeightMsgDelegateToGateway - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgDelegateToGateway, - applicationsimulation.SimulateMsgDelegateToGateway(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgUndelegateFromGateway int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgUndelegateFromGateway, &weightMsgUndelegateFromGateway, nil, - func(_ *rand.Rand) { - weightMsgUndelegateFromGateway = defaultWeightMsgUndelegateFromGateway - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgUndelegateFromGateway, - applicationsimulation.SimulateMsgUndelegateFromGateway(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - // this line is used by starport scaffolding # simapp/module/operation - - return operations -} - -// ProposalMsgs returns msgs used for governance proposals for simulations. -func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { - return []simtypes.WeightedProposalMsg{ - simulation.NewWeightedProposalMsg( - opWeightMsgStakeApplication, - defaultWeightMsgStakeApplication, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - applicationsimulation.SimulateMsgStakeApplication(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - simulation.NewWeightedProposalMsg( - opWeightMsgUnstakeApplication, - defaultWeightMsgUnstakeApplication, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - applicationsimulation.SimulateMsgUnstakeApplication(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - simulation.NewWeightedProposalMsg( - opWeightMsgDelegateToGateway, - defaultWeightMsgDelegateToGateway, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - applicationsimulation.SimulateMsgDelegateToGateway(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - simulation.NewWeightedProposalMsg( - opWeightMsgUndelegateFromGateway, - defaultWeightMsgUndelegateFromGateway, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - applicationsimulation.SimulateMsgUndelegateFromGateway(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - // this line is used by starport scaffolding # simapp/module/OpMsg - } -} diff --git a/x/application/simulation/delegate_to_gateway.go b/x/application/simulation/delegate_to_gateway.go deleted file mode 100644 index 37070e16e..000000000 --- a/x/application/simulation/delegate_to_gateway.go +++ /dev/null @@ -1,32 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -func SimulateMsgDelegateToGateway( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAppAccount, _ := simtypes.RandomAcc(r, accs) - simGatewayAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgDelegateToGateway{ - AppAddress: simAppAccount.Address.String(), - GatewayAddress: simGatewayAccount.Address.String(), - } - - // TODO: Handling the DelegateToGateway simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "DelegateToGateway simulation not implemented"), nil, nil - } -} diff --git a/x/application/simulation/helpers.go b/x/application/simulation/helpers.go deleted file mode 100644 index 92c437c0d..000000000 --- a/x/application/simulation/helpers.go +++ /dev/null @@ -1,15 +0,0 @@ -package simulation - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -// FindAccount find a specific address from an account list -func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { - creator, err := sdk.AccAddressFromBech32(address) - if err != nil { - panic(err) - } - return simtypes.FindAccount(accs, creator) -} diff --git a/x/application/simulation/stake_application.go b/x/application/simulation/stake_application.go deleted file mode 100644 index d17afd14e..000000000 --- a/x/application/simulation/stake_application.go +++ /dev/null @@ -1,32 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" -) - -// TODO(@Olshansk): Implement simulation for application staking -func SimulateMsgStakeApplication( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - stakeMsg := &types.MsgStakeApplication{ - Address: simAccount.Address.String(), - } - - // TODO: Handling the StakeApplication simulation - // See the documentation here to simulate application staking: https://docs.cosmos.network/main/learn/advanced/simulation - - return simtypes.NoOpMsg(types.ModuleName, stakeMsg.Type(), "StakeApplication simulation not implemented"), nil, nil - } -} diff --git a/x/application/simulation/undelegate_from_gateway.go b/x/application/simulation/undelegate_from_gateway.go deleted file mode 100644 index 9ada988fd..000000000 --- a/x/application/simulation/undelegate_from_gateway.go +++ /dev/null @@ -1,32 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -func SimulateMsgUndelegateFromGateway( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAppAccount, _ := simtypes.RandomAcc(r, accs) - simGatewayAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgUndelegateFromGateway{ - AppAddress: simAppAccount.Address.String(), - GatewayAddress: simGatewayAccount.Address.String(), - } - - // TODO: Handling the UndelegateFromGateway simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "UndelegateFromGateway simulation not implemented"), nil, nil - } -} diff --git a/x/application/simulation/unstake_application.go b/x/application/simulation/unstake_application.go deleted file mode 100644 index 3dcccd3b5..000000000 --- a/x/application/simulation/unstake_application.go +++ /dev/null @@ -1,32 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" -) - -// TODO(@Olshansk): Implement simulation for application staking -func SimulateMsgUnstakeApplication( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgUnstakeApplication{ - Address: simAccount.Address.String(), - } - - // TODO: Handling the UnstakeApplication simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "UnstakeApplication simulation not implemented"), nil, nil - } -} diff --git a/x/application/types/codec.go b/x/application/types/codec.go deleted file mode 100644 index 420ef8ecb..000000000 --- a/x/application/types/codec.go +++ /dev/null @@ -1,37 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" -) - -func RegisterCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgStakeApplication{}, "application/StakeApplication", nil) - cdc.RegisterConcrete(&MsgUnstakeApplication{}, "application/UnstakeApplication", nil) - cdc.RegisterConcrete(&MsgDelegateToGateway{}, "application/DelegateToGateway", nil) - cdc.RegisterConcrete(&MsgUndelegateFromGateway{}, "application/UndelegateFromGateway", nil) - // this line is used by starport scaffolding # 2 -} - -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgStakeApplication{}, - &MsgUnstakeApplication{}, - ) - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgDelegateToGateway{}, - ) - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgUndelegateFromGateway{}, - ) - // this line is used by starport scaffolding # 3 - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) -) diff --git a/x/application/types/errors.go b/x/application/types/errors.go deleted file mode 100644 index ea89e77e1..000000000 --- a/x/application/types/errors.go +++ /dev/null @@ -1,22 +0,0 @@ -package types - -// DONTCOVER - -import ( - sdkerrors "cosmossdk.io/errors" -) - -// x/application module sentinel errors -var ( - ErrAppInvalidStake = sdkerrors.Register(ModuleName, 1, "invalid application stake") - ErrAppInvalidAddress = sdkerrors.Register(ModuleName, 2, "invalid application address") - ErrAppUnauthorized = sdkerrors.Register(ModuleName, 3, "unauthorized application signer") - ErrAppNotFound = sdkerrors.Register(ModuleName, 4, "application not found") - ErrAppInvalidServiceConfigs = sdkerrors.Register(ModuleName, 6, "invalid service configs") - ErrAppGatewayNotFound = sdkerrors.Register(ModuleName, 7, "gateway not found") - ErrAppInvalidGatewayAddress = sdkerrors.Register(ModuleName, 8, "invalid gateway address") - ErrAppAlreadyDelegated = sdkerrors.Register(ModuleName, 9, "application already delegated to gateway") - ErrAppMaxDelegatedGateways = sdkerrors.Register(ModuleName, 10, "maximum number of delegated gateways reached") - ErrAppInvalidMaxDelegatedGateways = sdkerrors.Register(ModuleName, 11, "invalid MaxDelegatedGateways parameter") - ErrAppNotDelegated = sdkerrors.Register(ModuleName, 12, "application not delegated to gateway") -) diff --git a/x/application/types/expected_keepers.go b/x/application/types/expected_keepers.go deleted file mode 100644 index 55ab9222a..000000000 --- a/x/application/types/expected_keepers.go +++ /dev/null @@ -1,26 +0,0 @@ -package types - -//go:generate mockgen -destination ../../../testutil/application/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper,GatewayKeeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" - - gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" -) - -// AccountKeeper defines the expected account keeper used for simulations (noalias) -type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI -} - -// BankKeeper defines the expected interface needed to retrieve account balances. -type BankKeeper interface { - DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error -} - -// GatewayKeeper defines the expected interface needed to retrieve gateway information. -type GatewayKeeper interface { - GetGateway(ctx sdk.Context, addr string) (gatewaytypes.Gateway, bool) -} diff --git a/x/application/types/genesis.go b/x/application/types/genesis.go deleted file mode 100644 index ce8046f53..000000000 --- a/x/application/types/genesis.go +++ /dev/null @@ -1,74 +0,0 @@ -package types - -import ( - "fmt" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - servicehelpers "github.com/pokt-network/poktroll/x/shared/helpers" -) - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 - -// DefaultGenesis returns the default genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - ApplicationList: []Application{}, - // this line is used by starport scaffolding # genesis/types/default - Params: DefaultParams(), - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - // Check for duplicated index in application - applicationIndexMap := make(map[string]struct{}) - for _, app := range gs.ApplicationList { - index := string(ApplicationKey(app.Address)) - if _, ok := applicationIndexMap[index]; ok { - return fmt.Errorf("duplicated index for application") - } - applicationIndexMap[index] = struct{}{} - } - - // Check that the stake value for the apps is valid and that the delegatee addresses are valid - for _, app := range gs.ApplicationList { - // TODO_TECHDEBT: Consider creating shared helpers across the board for stake validation, - // similar to how we have `ValidateAppServiceConfigs` below - if app.Stake == nil { - return sdkerrors.Wrapf(ErrAppInvalidStake, "nil stake amount for application") - } - stake, err := sdk.ParseCoinNormalized(app.Stake.String()) - if !stake.IsValid() { - return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount for application %v; (%v)", app.Stake, stake.Validate()) - } - if err != nil { - return sdkerrors.Wrapf(ErrAppInvalidStake, "cannot parse stake amount for application %v; (%v)", app.Stake, err) - } - if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount for application: %v <= 0", app.Stake) - } - if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount denom for application %v", app.Stake) - } - - // Check that the application's delegated gateway addresses are valid - for _, gatewayAddr := range app.DelegateeGatewayAddresses { - if _, err := sdk.AccAddressFromBech32(gatewayAddr); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidGatewayAddress, "invalid gateway address %s; (%v)", gatewayAddr, err) - } - } - - // Validate the application service configs - if err := servicehelpers.ValidateAppServiceConfigs(app.ServiceConfigs); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidServiceConfigs, err.Error()) - } - } - - // this line is used by starport scaffolding # genesis/types/validate - - return gs.Params.Validate() -} diff --git a/x/application/types/genesis_test.go b/x/application/types/genesis_test.go deleted file mode 100644 index 3e7ce0361..000000000 --- a/x/application/types/genesis_test.go +++ /dev/null @@ -1,388 +0,0 @@ -package types_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/application/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func TestGenesisState_Validate(t *testing.T) { - addr1 := sample.AccAddress() - stake1 := sdk.NewCoin("upokt", sdk.NewInt(100)) - svc1AppConfig := &sharedtypes.ApplicationServiceConfig{ - Service: &sharedtypes.Service{Id: "svc1"}, - } - - addr2 := sample.AccAddress() - stake2 := sdk.NewCoin("upokt", sdk.NewInt(100)) - svc2AppConfig := &sharedtypes.ApplicationServiceConfig{ - Service: &sharedtypes.Service{Id: "svc2"}, - } - - emptyDelegatees := make([]string, 0) - gatewayAddr1 := sample.AccAddress() - gatewayAddr2 := sample.AccAddress() - - tests := []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - valid: true, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: []string{gatewayAddr1, gatewayAddr2}, - }, - { - Address: addr2, - Stake: &stake2, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: []string{gatewayAddr2, gatewayAddr1}, - }, - }, - // this line is used by starport scaffolding # types/genesis/validField - }, - valid: true, - }, - { - desc: "invalid - zero app stake", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(0)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - negative application stake", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(-100)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - wrong stake denom", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "invalid", Amount: sdk.NewInt(100)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - missing denom", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "", Amount: sdk.NewInt(100)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to duplicated app address", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr1, - Stake: &stake2, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to nil app stake", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr2, - Stake: nil, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to missing app stake", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr2, - // Explicitly missing stake - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to invalid delegatee pub key", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr2, - Stake: &stake2, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: []string{"invalid address"}, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to invalid delegatee pub keys", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: []string{gatewayAddr1}, - }, - { - Address: addr2, - Stake: &stake2, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: []string{"invalid address", gatewayAddr2}, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - service config not present", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - // ServiceConfigs: omitted - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - empty service config", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - service ID too long", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "12345678901"}}, - }, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - service name too long", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{ - Id: "123", - Name: "abcdefghijklmnopqrstuvwxyzab-abcdefghijklmnopqrstuvwxyzab", - }}, - }, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - service ID with invalid characters", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "12 45 !"}}, - }, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - MaxDelegatedGateways less than 1", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 0, - }, - }, - valid: false, - }, - - // this line is used by starport scaffolding # types/genesis/testcase - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } -} diff --git a/x/application/types/key_application.go b/x/application/types/key_application.go deleted file mode 100644 index 02cbefc4e..000000000 --- a/x/application/types/key_application.go +++ /dev/null @@ -1,23 +0,0 @@ -package types - -import "encoding/binary" - -var _ binary.ByteOrder - -const ( - // ApplicationKeyPrefix is the prefix to retrieve all Application - ApplicationKeyPrefix = "Application/value/" -) - -// ApplicationKey returns the store key to retrieve a Application from the index fields -func ApplicationKey( - address string, -) []byte { - var key []byte - - addressBytes := []byte(address) - key = append(key, addressBytes...) - key = append(key, []byte("/")...) - - return key -} diff --git a/x/application/types/keys.go b/x/application/types/keys.go deleted file mode 100644 index 5c9cbdd98..000000000 --- a/x/application/types/keys.go +++ /dev/null @@ -1,19 +0,0 @@ -package types - -const ( - // ModuleName defines the module name - ModuleName = "application" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // RouterKey defines the module's message routing key - RouterKey = ModuleName - - // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_application" -) - -func KeyPrefix(p string) []byte { - return []byte(p) -} diff --git a/x/application/types/message_delegate_to_gateway.go b/x/application/types/message_delegate_to_gateway.go deleted file mode 100644 index 71b17984f..000000000 --- a/x/application/types/message_delegate_to_gateway.go +++ /dev/null @@ -1,57 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const TypeMsgDelegateToGateway = "delegate_to_gateway" - -var _ sdk.Msg = (*MsgDelegateToGateway)(nil) - -func NewMsgDelegateToGateway(appAddress, gatewayAddress string) *MsgDelegateToGateway { - return &MsgDelegateToGateway{ - AppAddress: appAddress, - GatewayAddress: gatewayAddress, - } -} - -func (msg *MsgDelegateToGateway) Route() string { - return RouterKey -} - -func (msg *MsgDelegateToGateway) Type() string { - return TypeMsgDelegateToGateway -} - -func (msg *MsgDelegateToGateway) GetSigners() []sdk.AccAddress { - address, err := sdk.AccAddressFromBech32(msg.AppAddress) - if err != nil { - panic(err) - } - return []sdk.AccAddress{address} -} - -func (msg *MsgDelegateToGateway) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgDelegateToGateway) NewRedelegationEvent() *EventRedelegation { - return &EventRedelegation{ - AppAddress: msg.AppAddress, - GatewayAddress: msg.GatewayAddress, - } -} - -func (msg *MsgDelegateToGateway) ValidateBasic() error { - // Validate the application address - if _, err := sdk.AccAddressFromBech32(msg.AppAddress); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidAddress, "invalid application address %s; (%v)", msg.AppAddress, err) - } - // Validate the gateway address - if _, err := sdk.AccAddressFromBech32(msg.GatewayAddress); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidGatewayAddress, "invalid gateway address %s; (%v)", msg.GatewayAddress, err) - } - return nil -} diff --git a/x/application/types/message_delegate_to_gateway_test.go b/x/application/types/message_delegate_to_gateway_test.go deleted file mode 100644 index 0769d3e65..000000000 --- a/x/application/types/message_delegate_to_gateway_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package types - -import ( - "testing" - - "github.com/pokt-network/poktroll/testutil/sample" - - "github.com/stretchr/testify/require" -) - -func TestMsgDelegateToGateway_ValidateBasic(t *testing.T) { - tests := []struct { - name string - msg MsgDelegateToGateway - err error - }{ - { - name: "invalid app address - no gateway address", - msg: MsgDelegateToGateway{ - AppAddress: "invalid_address", - // GatewayAddress: intentionally omitted, - }, - err: ErrAppInvalidAddress, - }, { - name: "valid app address - no gateway address", - msg: MsgDelegateToGateway{ - AppAddress: sample.AccAddress(), - // GatewayAddress: intentionally omitted, - }, - err: ErrAppInvalidGatewayAddress, - }, { - name: "valid app address - invalid gateway address", - msg: MsgDelegateToGateway{ - AppAddress: sample.AccAddress(), - GatewayAddress: "invalid_address", - }, - err: ErrAppInvalidGatewayAddress, - }, { - name: "valid address", - msg: MsgDelegateToGateway{ - AppAddress: sample.AccAddress(), - GatewayAddress: sample.AccAddress(), - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/application/types/message_stake_application.go b/x/application/types/message_stake_application.go deleted file mode 100644 index 2b559d3a5..000000000 --- a/x/application/types/message_stake_application.go +++ /dev/null @@ -1,83 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" - - servicehelpers "github.com/pokt-network/poktroll/x/shared/helpers" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -const TypeMsgStakeApplication = "stake_application" - -var _ sdk.Msg = (*MsgStakeApplication)(nil) - -// TODO_TECHDEBT: See `NewMsgStakeSupplier` and follow the same pattern for the `Services` parameter -func NewMsgStakeApplication( - address string, - stake types.Coin, - appServiceConfigs []*sharedtypes.ApplicationServiceConfig, -) *MsgStakeApplication { - - return &MsgStakeApplication{ - Address: address, - Stake: &stake, - Services: appServiceConfigs, - } -} - -func (msg *MsgStakeApplication) Route() string { - return RouterKey -} - -func (msg *MsgStakeApplication) Type() string { - return TypeMsgStakeApplication -} - -func (msg *MsgStakeApplication) GetSigners() []sdk.AccAddress { - address, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - panic(err) - } - return []sdk.AccAddress{address} -} - -func (msg *MsgStakeApplication) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgStakeApplication) ValidateBasic() error { - // Validate the address - _, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - return sdkerrors.Wrapf(ErrAppInvalidAddress, "invalid application address %s; (%v)", msg.Address, err) - } - - // TODO_TECHDEBT: Centralize stake related verification and share across different parts of the source code - // Validate the stake amount - if msg.Stake == nil { - return sdkerrors.Wrapf(ErrAppInvalidStake, "nil application stake; (%v)", err) - } - stake, err := sdk.ParseCoinNormalized(msg.Stake.String()) - if !stake.IsValid() { - return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid application stake %v; (%v)", msg.Stake, stake.Validate()) - } - if err != nil { - return sdkerrors.Wrapf(ErrAppInvalidStake, "cannot parse application stake %v; (%v)", msg.Stake, err) - } - if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount for application: %v <= 0", msg.Stake) - } - if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount denom for application: %v", msg.Stake) - } - - // Validate the application service configs - if err := servicehelpers.ValidateAppServiceConfigs(msg.Services); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidServiceConfigs, err.Error()) - } - - return nil -} diff --git a/x/application/types/message_stake_application_test.go b/x/application/types/message_stake_application_test.go deleted file mode 100644 index 0d155f50c..000000000 --- a/x/application/types/message_stake_application_test.go +++ /dev/null @@ -1,172 +0,0 @@ -package types - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func TestMsgStakeApplication_ValidateBasic(t *testing.T) { - tests := []struct { - name string - msg MsgStakeApplication - err error - }{ - // address related tests - { - name: "invalid address - nil stake", - msg: MsgStakeApplication{ - Address: "invalid_address", - // Stake explicitly nil - Services: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "svc1"}}, - }, - }, - err: ErrAppInvalidAddress, - }, - - // stake related tests - { - name: "valid address - nil stake", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - // Stake explicitly nil - Services: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "svc1"}}, - }, - }, - err: ErrAppInvalidStake, - }, { - name: "valid address - valid stake", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "svc1"}}, - }, - }, - }, { - name: "valid address - zero stake", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(0)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "svc1"}}, - }, - }, - err: ErrAppInvalidStake, - }, { - name: "valid address - negative stake", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(-100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "svc1"}}, - }, - }, - err: ErrAppInvalidStake, - }, { - name: "valid address - invalid stake denom", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "invalid", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "svc1"}}, - }, - }, - err: ErrAppInvalidStake, - }, { - name: "valid address - invalid stake missing denom", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "svc1"}}, - }, - }, - err: ErrAppInvalidStake, - }, - - // service related tests - { - name: "valid service configs - multiple services", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "svc1"}}, - {Service: &sharedtypes.Service{Id: "svc2"}}, - }, - }, - }, - { - name: "invalid service configs - not present", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - // Services: omitted - }, - err: ErrAppInvalidServiceConfigs, - }, - { - name: "invalid service configs - empty", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{}, - }, - err: ErrAppInvalidServiceConfigs, - }, - { - name: "invalid service configs - invalid service ID that's too long", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "123456790"}}, - }, - }, - err: ErrAppInvalidServiceConfigs, - }, - { - name: "invalid service configs - invalid service Name that's too long", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{ - Id: "123", - Name: "abcdefghijklmnopqrstuvwxyzab-abcdefghijklmnopqrstuvwxyzab", - }}, - }, - }, - err: ErrAppInvalidServiceConfigs, - }, - { - name: "invalid service configs - invalid service ID that contains invalid characters", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "12 45 !"}}, - }, - }, - err: ErrAppInvalidServiceConfigs, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorContains(t, err, tt.err.Error()) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/application/types/message_undelegate_from_gateway.go b/x/application/types/message_undelegate_from_gateway.go deleted file mode 100644 index 0ab47aa47..000000000 --- a/x/application/types/message_undelegate_from_gateway.go +++ /dev/null @@ -1,57 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -const TypeMsgUndelegateFromGateway = "undelegate_from_gateway" - -var _ sdk.Msg = (*MsgUndelegateFromGateway)(nil) - -func NewMsgUndelegateFromGateway(appAddress, gatewayAddress string) *MsgUndelegateFromGateway { - return &MsgUndelegateFromGateway{ - AppAddress: appAddress, - GatewayAddress: gatewayAddress, - } -} - -func (msg *MsgUndelegateFromGateway) Route() string { - return RouterKey -} - -func (msg *MsgUndelegateFromGateway) Type() string { - return TypeMsgUndelegateFromGateway -} - -func (msg *MsgUndelegateFromGateway) GetSigners() []sdk.AccAddress { - address, err := sdk.AccAddressFromBech32(msg.AppAddress) - if err != nil { - panic(err) - } - return []sdk.AccAddress{address} -} - -func (msg *MsgUndelegateFromGateway) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgUndelegateFromGateway) NewRedelegationEvent() *EventRedelegation { - return &EventRedelegation{ - AppAddress: msg.AppAddress, - GatewayAddress: msg.GatewayAddress, - } -} - -func (msg *MsgUndelegateFromGateway) ValidateBasic() error { - // Validate the application address - if _, err := sdk.AccAddressFromBech32(msg.AppAddress); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidAddress, "invalid application address %s; (%v)", msg.AppAddress, err) - } - // Validate the gateway address - if _, err := sdk.AccAddressFromBech32(msg.GatewayAddress); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidGatewayAddress, "invalid gateway address %s; (%v)", msg.GatewayAddress, err) - } - return nil -} diff --git a/x/application/types/message_undelegate_from_gateway_test.go b/x/application/types/message_undelegate_from_gateway_test.go deleted file mode 100644 index b40b520e9..000000000 --- a/x/application/types/message_undelegate_from_gateway_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package types - -import ( - "testing" - - "github.com/pokt-network/poktroll/testutil/sample" - - "github.com/stretchr/testify/require" -) - -func TestMsgUndelegateFromGateway_ValidateBasic(t *testing.T) { - tests := []struct { - name string - msg MsgUndelegateFromGateway - err error - }{ - { - name: "invalid app address - no gateway address", - msg: MsgUndelegateFromGateway{ - AppAddress: "invalid_address", - // GatewayAddress: sample.AccAddress(), - }, - err: ErrAppInvalidAddress, - }, { - name: "valid app address - no gateway address", - msg: MsgUndelegateFromGateway{ - AppAddress: sample.AccAddress(), - // GatewayAddress: sample.AccAddress(), - }, - err: ErrAppInvalidGatewayAddress, - }, { - name: "valid app address - invalid gateway address", - msg: MsgUndelegateFromGateway{ - AppAddress: sample.AccAddress(), - GatewayAddress: "invalid_address", - }, - err: ErrAppInvalidGatewayAddress, - }, { - name: "valid address", - msg: MsgUndelegateFromGateway{ - AppAddress: sample.AccAddress(), - GatewayAddress: sample.AccAddress(), - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/application/types/message_unstake_application.go b/x/application/types/message_unstake_application.go deleted file mode 100644 index 010bae551..000000000 --- a/x/application/types/message_unstake_application.go +++ /dev/null @@ -1,45 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const TypeMsgUnstakeApplication = "unstake_application" - -var _ sdk.Msg = (*MsgUnstakeApplication)(nil) - -func NewMsgUnstakeApplication(address string) *MsgUnstakeApplication { - return &MsgUnstakeApplication{ - Address: address, - } -} - -func (msg *MsgUnstakeApplication) Route() string { - return RouterKey -} - -func (msg *MsgUnstakeApplication) Type() string { - return TypeMsgUnstakeApplication -} - -func (msg *MsgUnstakeApplication) GetSigners() []sdk.AccAddress { - address, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - panic(err) - } - return []sdk.AccAddress{address} -} - -func (msg *MsgUnstakeApplication) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgUnstakeApplication) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - return sdkerrors.Wrapf(ErrAppInvalidAddress, "invalid address address (%s)", err) - } - return nil -} diff --git a/x/application/types/message_unstake_application_test.go b/x/application/types/message_unstake_application_test.go deleted file mode 100644 index fdc9a5a91..000000000 --- a/x/application/types/message_unstake_application_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package types - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" -) - -func TestMsgUnstakeApplication_ValidateBasic(t *testing.T) { - tests := []struct { - name string - msg MsgUnstakeApplication - err error - }{ - { - name: "valid", - msg: MsgUnstakeApplication{ - Address: sample.AccAddress(), - }, - }, - { - name: "invalid - missing address", - msg: MsgUnstakeApplication{}, - err: ErrAppInvalidAddress, - }, - { - name: "invalid - invalid address", - msg: MsgUnstakeApplication{ - Address: "invalid_address", - }, - err: ErrAppInvalidAddress, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/application/types/params.go b/x/application/types/params.go deleted file mode 100644 index f5ec7cd0c..000000000 --- a/x/application/types/params.go +++ /dev/null @@ -1,46 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "gopkg.in/yaml.v2" -) - -// TODO: Revisit default param values -const DefaultMaxDelegatedGateways int64 = 7 - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params instance -func NewParams() Params { - return Params{MaxDelegatedGateways: DefaultMaxDelegatedGateways} -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams() -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} -} - -// Validate validates the set of params -func (p Params) Validate() error { - if p.MaxDelegatedGateways < 1 { - return sdkerrors.Wrapf(ErrAppInvalidMaxDelegatedGateways, "MaxDelegatedGateways param < 1: got %d", p.MaxDelegatedGateways) - } - return nil -} - -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} diff --git a/x/application/types/types.go b/x/application/types/types.go deleted file mode 100644 index ab1254f4c..000000000 --- a/x/application/types/types.go +++ /dev/null @@ -1 +0,0 @@ -package types diff --git a/x/gateway/client/cli/helpers_test.go b/x/gateway/client/cli/helpers_test.go deleted file mode 100644 index cf2ccf899..000000000 --- a/x/gateway/client/cli/helpers_test.go +++ /dev/null @@ -1,31 +0,0 @@ -package cli_test - -import ( - "strconv" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -// Dummy variable to avoid unused import error. -var _ = strconv.IntSize - -// init initializes the SDK configuration. -func init() { - cmd.InitSDKConfig() -} - -// networkWithGatewayObjects creates a network with a populated gateway state of n gateway objects -func networkWithGatewayObjects(t *testing.T, n int) (*network.Network, []types.Gateway) { - t.Helper() - cfg := network.DefaultConfig() - gatewayGenesisState := network.DefaultGatewayModuleGenesisState(t, n) - buf, err := cfg.Codec.MarshalJSON(gatewayGenesisState) - require.NoError(t, err) - cfg.GenesisState[types.ModuleName] = buf - return network.New(t, cfg), gatewayGenesisState.GatewayList -} diff --git a/x/gateway/client/cli/query.go b/x/gateway/client/cli/query.go deleted file mode 100644 index b896f7583..000000000 --- a/x/gateway/client/cli/query.go +++ /dev/null @@ -1,33 +0,0 @@ -package cli - -import ( - "fmt" - // "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/gateway/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - // Group gateway queries under a subcommand - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdQueryParams()) - cmd.AddCommand(CmdListGateway()) - cmd.AddCommand(CmdShowGateway()) - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/gateway/client/cli/query_gateway.go b/x/gateway/client/cli/query_gateway.go deleted file mode 100644 index 124c515c8..000000000 --- a/x/gateway/client/cli/query_gateway.go +++ /dev/null @@ -1,78 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func CmdListGateway() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-gateway", - Short: "list all gateways", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryAllGatewayRequest{ - Pagination: pageReq, - } - - res, err := queryClient.GatewayAll(cmd.Context(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, cmd.Use) - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdShowGateway() *cobra.Command { - cmd := &cobra.Command{ - Use: "show-gateway ", - Short: "shows a gateway", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - argAddress := args[0] - - params := &types.QueryGetGatewayRequest{ - Address: argAddress, - } - - res, err := queryClient.Gateway(cmd.Context(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/gateway/client/cli/query_gateway_test.go b/x/gateway/client/cli/query_gateway_test.go deleted file mode 100644 index fba32713c..000000000 --- a/x/gateway/client/cli/query_gateway_test.go +++ /dev/null @@ -1,142 +0,0 @@ -package cli_test - -import ( - "fmt" - "strconv" - "testing" - - tmcli "github.com/cometbft/cometbft/libs/cli" - "github.com/cosmos/cosmos-sdk/client/flags" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/gateway/client/cli" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func TestShowGateway(t *testing.T) { - net, objs := networkWithGatewayObjects(t, 2) - - ctx := net.Validators[0].ClientCtx - common := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - tests := []struct { - desc string - idAddress string - - args []string - err error - obj types.Gateway - }{ - { - desc: "found", - idAddress: objs[0].Address, - - args: common, - obj: objs[0], - }, - { - desc: "not found", - idAddress: strconv.Itoa(100000), - - args: common, - err: status.Error(codes.NotFound, "not found"), - }, - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - args := []string{ - tc.idAddress, - } - args = append(args, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowGateway(), args) - if tc.err != nil { - stat, ok := status.FromError(tc.err) - require.True(t, ok) - require.ErrorIs(t, stat.Err(), tc.err) - } else { - require.NoError(t, err) - var resp types.QueryGetGatewayResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NotNil(t, resp.Gateway) - require.Equal(t, - nullify.Fill(&tc.obj), - nullify.Fill(&resp.Gateway), - ) - } - }) - } -} - -func TestListGateway(t *testing.T) { - net, objs := networkWithGatewayObjects(t, 5) - - ctx := net.Validators[0].ClientCtx - request := func(next []byte, offset, limit uint64, total bool) []string { - args := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - if next == nil { - args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) - } else { - args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) - } - args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) - if total { - args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) - } - return args - } - t.Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < len(objs); i += step { - args := request(nil, uint64(i), uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListGateway(), args) - require.NoError(t, err) - var resp types.QueryAllGatewayResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.Gateway), step) - require.Subset(t, - nullify.Fill(objs), - nullify.Fill(resp.Gateway), - ) - } - }) - t.Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < len(objs); i += step { - args := request(next, 0, uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListGateway(), args) - require.NoError(t, err) - var resp types.QueryAllGatewayResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.Gateway), step) - require.Subset(t, - nullify.Fill(objs), - nullify.Fill(resp.Gateway), - ) - next = resp.Pagination.NextKey - } - }) - t.Run("Total", func(t *testing.T) { - args := request(nil, 0, uint64(len(objs)), true) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListGateway(), args) - require.NoError(t, err) - var resp types.QueryAllGatewayResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NoError(t, err) - require.Equal(t, len(objs), int(resp.Pagination.Total)) - require.ElementsMatch(t, - nullify.Fill(objs), - nullify.Fill(resp.Gateway), - ) - }) -} diff --git a/x/gateway/client/cli/query_params.go b/x/gateway/client/cli/query_params.go deleted file mode 100644 index 447a64b79..000000000 --- a/x/gateway/client/cli/query_params.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - 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.Params(cmd.Context(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/gateway/client/cli/tx.go b/x/gateway/client/cli/tx.go deleted file mode 100644 index 52be2fb88..000000000 --- a/x/gateway/client/cli/tx.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "fmt" - "time" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdStakeGateway()) - cmd.AddCommand(CmdUnstakeGateway()) - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/gateway/client/cli/tx_stake_gateway.go b/x/gateway/client/cli/tx_stake_gateway.go deleted file mode 100644 index 3369f3885..000000000 --- a/x/gateway/client/cli/tx_stake_gateway.go +++ /dev/null @@ -1,61 +0,0 @@ -package cli - -import ( - "os" - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/gateway/client/config" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -var ( - flagStakeConfig string - _ = strconv.Itoa(0) -) - -func CmdStakeGateway() *cobra.Command { - cmd := &cobra.Command{ - Use: "stake-gateway --config ", - Short: "Stake a gateway", - Long: `Stake a gateway with the provided parameters. This is a broadcast operation that -will stake the tokens and associate them with the gateway specified by the 'from' address. -Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx gateway stake-gateway --config stake_config.yaml --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE)`, - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, _ []string) (err error) { - configContent, err := os.ReadFile(flagStakeConfig) - if err != nil { - return err - } - - gatewayStakeConfig, err := config.ParseGatewayConfig(configContent) - if err != nil { - return err - } - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgStakeGateway( - clientCtx.GetFromAddress().String(), - gatewayStakeConfig.StakeAmount, - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().StringVar(&flagStakeConfig, "config", "", "Path to the stake config file") - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/gateway/client/cli/tx_stake_gateway_test.go b/x/gateway/client/cli/tx_stake_gateway_test.go deleted file mode 100644 index f50549686..000000000 --- a/x/gateway/client/cli/tx_stake_gateway_test.go +++ /dev/null @@ -1,150 +0,0 @@ -package cli_test - -import ( - "fmt" - "os" - "testing" - - sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/testutil/yaml" - "github.com/pokt-network/poktroll/x/gateway/client/cli" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func TestCLI_StakeGateway(t *testing.T) { - net, _ := networkWithGatewayObjects(t, 2) - val := net.Validators[0] - ctx := val.ClientCtx - - // Create a keyring and add an account for the gateway to be staked - kr := ctx.Keyring - accounts := testutil.CreateKeyringAccounts(t, kr, 1) - gatewayAccount := accounts[0] - - // Update the context with the new keyring - ctx = ctx.WithKeyring(kr) - - // Common args used for all requests - commonArgs := []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), - } - - tests := []struct { - desc string - address string - inputConfig string - expectedError *sdkerrors.Error - }{ - { - desc: "stake gateway: invalid address", - address: "invalid", - inputConfig: ` - stake_amount: 1000upokt - `, - expectedError: types.ErrGatewayInvalidAddress, - }, - { - desc: "stake gateway: missing address", - // address: gatewayAccount.Address.String(), - inputConfig: ` - stake_amount: 1000upokt - `, - expectedError: types.ErrGatewayInvalidAddress, - }, - { - desc: "stake gateway: invalid stake amount (zero)", - address: gatewayAccount.Address.String(), - inputConfig: ` - stake_amount: 0upokt - `, - expectedError: types.ErrGatewayInvalidStake, - }, - { - desc: "stake gateway: invalid stake amount (negative)", - address: gatewayAccount.Address.String(), - inputConfig: ` - stake_amount: -1000upokt - `, - expectedError: types.ErrGatewayInvalidStake, - }, - { - desc: "stake gateway: invalid stake denom", - address: gatewayAccount.Address.String(), - inputConfig: ` - stake_amount: 1000invalid - `, - expectedError: types.ErrGatewayInvalidStake, - }, - { - desc: "stake gateway: invalid stake missing denom", - address: gatewayAccount.Address.String(), - inputConfig: ` - stake_amount: 1000 - `, - expectedError: types.ErrGatewayInvalidStake, - }, - { - desc: "stake gateway: invalid stake missing stake", - address: gatewayAccount.Address.String(), - inputConfig: ``, - expectedError: types.ErrGatewayInvalidStake, - }, - { - desc: "stake gateway: valid", - address: gatewayAccount.Address.String(), - inputConfig: ` - stake_amount: 1000upokt - `, - }, - } - - // Initialize the Gateway Account by sending it some funds from the validator account that is part of genesis - network.InitAccount(t, net, gatewayAccount.Address) - - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - // Wait for a new block to be committed - require.NoError(t, net.WaitForNextBlock()) - - // write the stake config to a file - configPath := testutil.WriteToNewTempFile(t, yaml.NormalizeYAMLIndentation(tt.inputConfig)).Name() - t.Cleanup(func() { os.Remove(configPath) }) - - // Prepare the arguments for the CLI command - args := []string{ - fmt.Sprintf("--config=%s", configPath), - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), - } - args = append(args, commonArgs...) - - // Execute the command - outStake, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdStakeGateway(), args) - if tt.expectedError != nil { - stat, ok := status.FromError(tt.expectedError) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.expectedError.Error()) - return - } - require.NoError(t, err) - - require.NoError(t, err) - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(outStake.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) - }) - } -} diff --git a/x/gateway/client/cli/tx_unstake_gateway.go b/x/gateway/client/cli/tx_unstake_gateway.go deleted file mode 100644 index e97406495..000000000 --- a/x/gateway/client/cli/tx_unstake_gateway.go +++ /dev/null @@ -1,44 +0,0 @@ -package cli - -import ( - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/gateway/types" -) - -var _ = strconv.Itoa(0) - -func CmdUnstakeGateway() *cobra.Command { - // fromAddress & signature is retrieved via `flags.FlagFrom` in the `clientCtx` - cmd := &cobra.Command{ - Use: "unstake-gateway ", - Short: "Unstake a gateway", - Long: `Unstake a gateway. This is a broadcast operation that will unstake the gateway specified by the 'from' address. - -Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx gateway unstake-gateway --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE)`, - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, _ []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - msg := types.NewMsgUnstakeGateway( - clientCtx.GetFromAddress().String(), - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/gateway/client/cli/tx_unstake_gateway_test.go b/x/gateway/client/cli/tx_unstake_gateway_test.go deleted file mode 100644 index b0aa9fc16..000000000 --- a/x/gateway/client/cli/tx_unstake_gateway_test.go +++ /dev/null @@ -1,97 +0,0 @@ -package cli_test - -import ( - "fmt" - "testing" - - sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/x/gateway/client/cli" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func TestCLI_UnstakeGateway(t *testing.T) { - net, _ := networkWithGatewayObjects(t, 2) - val := net.Validators[0] - ctx := val.ClientCtx - - // Create a keyring and add an account for the gateway to be unstaked - kr := ctx.Keyring - accounts := testutil.CreateKeyringAccounts(t, kr, 1) - gatewayAccount := accounts[0] - - // Update the context with the new keyring - ctx = ctx.WithKeyring(kr) - - // Common args used for all requests - commonArgs := []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), - } - - tests := []struct { - desc string - address string - err *sdkerrors.Error - }{ - { - desc: "unstake gateway: valid", - address: gatewayAccount.Address.String(), - }, - { - desc: "unstake gateway: missing address", - // address: gatewayAccount.Address.String(), - err: types.ErrGatewayInvalidAddress, - }, - { - desc: "unstake gateway: invalid address", - address: "invalid", - err: types.ErrGatewayInvalidAddress, - }, - } - - // Initialize the Gateway Account by sending it some funds from the validator account that is part of genesis - network.InitAccount(t, net, gatewayAccount.Address) - - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - // Wait for a new block to be committed - require.NoError(t, net.WaitForNextBlock()) - - // Prepare the arguments for the CLI command - args := []string{ - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), - } - args = append(args, commonArgs...) - - // Execute the command - outUnstake, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdUnstakeGateway(), args) - - // Validate the error if one is expected - if tt.err != nil { - stat, ok := status.FromError(tt.err) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.err.Error()) - return - } - require.NoError(t, err) - - // Check the response - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(outUnstake.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) - }) - } -} diff --git a/x/gateway/client/config/errors.go b/x/gateway/client/config/errors.go deleted file mode 100644 index aa01b3a46..000000000 --- a/x/gateway/client/config/errors.go +++ /dev/null @@ -1,10 +0,0 @@ -package config - -import sdkerrors "cosmossdk.io/errors" - -var ( - codespace = "gatewayconfig" - ErrGatewayConfigEmptyContent = sdkerrors.Register(codespace, 1, "empty gateway staking config content") - ErrGatewayConfigUnmarshalYAML = sdkerrors.Register(codespace, 2, "config reader cannot unmarshal yaml content") - ErrGatewayConfigInvalidStake = sdkerrors.Register(codespace, 3, "invalid stake in gateway stake config") -) diff --git a/x/gateway/client/config/gateway_config_reader.go b/x/gateway/client/config/gateway_config_reader.go deleted file mode 100644 index 6bf7aa3e3..000000000 --- a/x/gateway/client/config/gateway_config_reader.go +++ /dev/null @@ -1,62 +0,0 @@ -package config - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "gopkg.in/yaml.v2" -) - -// YAMLStakeGateway is the structure describing the gateway stake config file -type YAMLStakeGateway struct { - StakeAmount string `yaml:"stake_amount"` -} - -// GatewayStakeConfig is the structure describing the gateway stake config -type GatewayStakeConfig struct { - StakeAmount sdk.Coin -} - -// ParseGatewayConfig parses the gateway stake yaml config file into a StakeGatewayConfig struct -func ParseGatewayConfig(configContent []byte) (*GatewayStakeConfig, error) { - var stakeConfig *YAMLStakeGateway - - if len(configContent) == 0 { - return nil, ErrGatewayConfigEmptyContent - } - - // Unmarshal the stake config file into a stakeConfig - if err := yaml.Unmarshal(configContent, &stakeConfig); err != nil { - return nil, ErrGatewayConfigUnmarshalYAML.Wrap(err.Error()) - } - - // Validate the stake config - if len(stakeConfig.StakeAmount) == 0 { - return nil, ErrGatewayConfigInvalidStake - } - - // Parse the stake amount to a coin struct - stakeAmount, err := sdk.ParseCoinNormalized(stakeConfig.StakeAmount) - if err != nil { - return nil, ErrGatewayConfigInvalidStake.Wrap(err.Error()) - } - - // Basic validation of the stake amount - if err := stakeAmount.Validate(); err != nil { - return nil, ErrGatewayConfigInvalidStake.Wrap(err.Error()) - } - - if stakeAmount.IsZero() { - return nil, ErrGatewayConfigInvalidStake.Wrap("stake amount cannot be zero") - } - - // Only allow upokt coins staking - if stakeAmount.Denom != "upokt" { - return nil, ErrGatewayConfigInvalidStake.Wrapf( - "invalid stake denom, expecting: upokt, got: %s", - stakeAmount.Denom, - ) - } - - return &GatewayStakeConfig{ - StakeAmount: stakeAmount, - }, nil -} diff --git a/x/gateway/client/config/gateway_config_reader_test.go b/x/gateway/client/config/gateway_config_reader_test.go deleted file mode 100644 index b9ec91f2e..000000000 --- a/x/gateway/client/config/gateway_config_reader_test.go +++ /dev/null @@ -1,83 +0,0 @@ -package config_test - -import ( - "testing" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/gogo/status" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/yaml" - "github.com/pokt-network/poktroll/x/gateway/client/config" -) - -func Test_ParseGatewayStakeConfig(t *testing.T) { - tests := []struct { - desc string - expectedError *sdkerrors.Error - expectedConfig *config.GatewayStakeConfig - inputConfig string - }{ - // Valid Configs - { - desc: "valid gateway stake config", - inputConfig: ` - stake_amount: 1000upokt - `, - expectedError: nil, - expectedConfig: &config.GatewayStakeConfig{ - StakeAmount: sdk.NewCoin("upokt", sdk.NewInt(1000)), - }, - }, - // Invalid Configs - { - desc: "services_test: invalid service config with empty content", - expectedError: config.ErrGatewayConfigEmptyContent, - inputConfig: ``, - }, - { - desc: "invalid stake denom", - inputConfig: ` - stake_amount: 1000invalid - `, - expectedError: config.ErrGatewayConfigInvalidStake, - }, - { - desc: "negative stake amount", - inputConfig: ` - stake_amount: -1000upokt - `, - expectedError: config.ErrGatewayConfigInvalidStake, - }, - { - desc: "zero stake amount", - inputConfig: ` - stake_amount: 0upokt - `, - expectedError: config.ErrGatewayConfigInvalidStake, - }, - } - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - normalizedConfig := yaml.NormalizeYAMLIndentation(tt.inputConfig) - supplierServiceConfig, err := config.ParseGatewayConfig([]byte(normalizedConfig)) - - if tt.expectedError != nil { - require.Error(t, err) - require.ErrorIs(t, err, tt.expectedError) - stat, ok := status.FromError(tt.expectedError) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.expectedError.Error()) - require.Nil(t, supplierServiceConfig) - return - } - - require.NoError(t, err) - - require.Equal(t, tt.expectedConfig.StakeAmount, supplierServiceConfig.StakeAmount) - require.Equal(t, tt.expectedConfig.StakeAmount.Denom, supplierServiceConfig.StakeAmount.Denom) - }) - } -} diff --git a/x/gateway/genesis.go b/x/gateway/genesis.go deleted file mode 100644 index eb9791d31..000000000 --- a/x/gateway/genesis.go +++ /dev/null @@ -1,29 +0,0 @@ -package gateway - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/gateway/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -// InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - // Set all the gateway - for _, gateway := range genState.GatewayList { - k.SetGateway(ctx, gateway) - } - // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) -} - -// ExportGenesis returns the module's exported genesis -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) - - genesis.GatewayList = k.GetAllGateway(ctx) - // this line is used by starport scaffolding # genesis/module/export - - return genesis -} diff --git a/x/gateway/genesis_test.go b/x/gateway/genesis_test.go deleted file mode 100644 index 2a020c7cb..000000000 --- a/x/gateway/genesis_test.go +++ /dev/null @@ -1,39 +0,0 @@ -package gateway_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/gateway" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func TestGenesis(t *testing.T) { - genesisState := types.GenesisState{ - Params: types.DefaultParams(), - - GatewayList: []types.Gateway{ - { - Address: "0", - }, - { - Address: "1", - }, - }, - // this line is used by starport scaffolding # genesis/test/state - } - - k, ctx := keepertest.GatewayKeeper(t) - gateway.InitGenesis(ctx, *k, genesisState) - got := gateway.ExportGenesis(ctx, *k) - require.NotNil(t, got) - - nullify.Fill(&genesisState) - nullify.Fill(got) - - require.ElementsMatch(t, genesisState.GatewayList, got.GatewayList) - // this line is used by starport scaffolding # genesis/test/assert -} diff --git a/x/gateway/keeper/gateway.go b/x/gateway/keeper/gateway.go deleted file mode 100644 index 4cb1e5092..000000000 --- a/x/gateway/keeper/gateway.go +++ /dev/null @@ -1,64 +0,0 @@ -package keeper - -import ( - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/gateway/types" -) - -// SetGateway set a specific gateway in the store from its index -func (k Keeper) SetGateway(ctx sdk.Context, gateway types.Gateway) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GatewayKeyPrefix)) - b := k.cdc.MustMarshal(&gateway) - store.Set(types.GatewayKey( - gateway.Address, - ), b) -} - -// GetGateway returns a gateway from its index -func (k Keeper) GetGateway( - ctx sdk.Context, - address string, - -) (val types.Gateway, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GatewayKeyPrefix)) - - b := store.Get(types.GatewayKey( - address, - )) - if b == nil { - return val, false - } - - k.cdc.MustUnmarshal(b, &val) - return val, true -} - -// RemoveGateway removes a gateway from the store -func (k Keeper) RemoveGateway( - ctx sdk.Context, - address string, - -) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GatewayKeyPrefix)) - store.Delete(types.GatewayKey( - address, - )) -} - -// GetAllGateway returns all gateways -func (k Keeper) GetAllGateway(ctx sdk.Context) (list []types.Gateway) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GatewayKeyPrefix)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var val types.Gateway - k.cdc.MustUnmarshal(iterator.Value(), &val) - list = append(list, val) - } - - return -} diff --git a/x/gateway/keeper/gateway_test.go b/x/gateway/keeper/gateway_test.go deleted file mode 100644 index b343591a0..000000000 --- a/x/gateway/keeper/gateway_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package keeper_test - -import ( - "strconv" - "testing" - - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/gateway/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" - - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/stretchr/testify/require" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func init() { - cmd.InitSDKConfig() -} - -func createNGateway(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Gateway { - items := make([]types.Gateway, n) - for i := range items { - items[i].Address = strconv.Itoa(i) - - keeper.SetGateway(ctx, items[i]) - } - return items -} - -func TestGatewayModuleAddress(t *testing.T) { - moduleAddress := authtypes.NewModuleAddress(types.ModuleName) - require.Equal(t, "pokt1f6j7u6875p2cvyrgjr0d2uecyzah0kget9vlpl", moduleAddress.String()) -} - -func TestGatewayGet(t *testing.T) { - keeper, ctx := keepertest.GatewayKeeper(t) - items := createNGateway(keeper, ctx, 10) - for _, item := range items { - rst, found := keeper.GetGateway(ctx, - item.Address, - ) - require.True(t, found) - require.Equal(t, - nullify.Fill(&item), - nullify.Fill(&rst), - ) - } -} - -func TestGatewayRemove(t *testing.T) { - keeper, ctx := keepertest.GatewayKeeper(t) - items := createNGateway(keeper, ctx, 10) - for _, item := range items { - keeper.RemoveGateway(ctx, - item.Address, - ) - _, found := keeper.GetGateway(ctx, - item.Address, - ) - require.False(t, found) - } -} - -func TestGatewayGetAll(t *testing.T) { - keeper, ctx := keepertest.GatewayKeeper(t) - items := createNGateway(keeper, ctx, 10) - require.ElementsMatch(t, - nullify.Fill(items), - nullify.Fill(keeper.GetAllGateway(ctx)), - ) -} diff --git a/x/gateway/keeper/keeper.go b/x/gateway/keeper/keeper.go deleted file mode 100644 index fcc143222..000000000 --- a/x/gateway/keeper/keeper.go +++ /dev/null @@ -1,51 +0,0 @@ -package keeper - -import ( - "fmt" - - "github.com/cometbft/cometbft/libs/log" - "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - "github.com/pokt-network/poktroll/x/gateway/types" -) - -type ( - Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace - - bankKeeper types.BankKeeper - } -) - -func NewKeeper( - cdc codec.BinaryCodec, - storeKey, - memKey storetypes.StoreKey, - ps paramtypes.Subspace, - - bankKeeper types.BankKeeper, -) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } - - return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramstore: ps, - - bankKeeper: bankKeeper, - } -} - -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} diff --git a/x/gateway/keeper/msg_server.go b/x/gateway/keeper/msg_server.go deleted file mode 100644 index fafeff27b..000000000 --- a/x/gateway/keeper/msg_server.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/gateway/types" -) - -type msgServer struct { - Keeper -} - -// NewMsgServerImpl returns an implementation of the MsgServer interface -// for the provided Keeper. -func NewMsgServerImpl(keeper Keeper) types.MsgServer { - return &msgServer{Keeper: keeper} -} - -var _ types.MsgServer = msgServer{} diff --git a/x/gateway/keeper/msg_server_stake_gateway.go b/x/gateway/keeper/msg_server_stake_gateway.go deleted file mode 100644 index f5f6e63e2..000000000 --- a/x/gateway/keeper/msg_server_stake_gateway.go +++ /dev/null @@ -1,91 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func (k msgServer) StakeGateway( - goCtx context.Context, - msg *types.MsgStakeGateway, -) (*types.MsgStakeGatewayResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - logger := k.Logger(ctx).With("method", "StakeGateway") - logger.Info(fmt.Sprintf("About to stake gateway with msg: %v", msg)) - - if err := msg.ValidateBasic(); err != nil { - return nil, err - } - - // Check if the gateway already exists or not - var err error - var coinsToDelegate sdk.Coin - gateway, isGatewayFound := k.GetGateway(ctx, msg.Address) - if !isGatewayFound { - logger.Info(fmt.Sprintf("Gateway not found. Creating new gateway for address %s", msg.Address)) - gateway = k.createGateway(ctx, msg) - coinsToDelegate = *msg.Stake - } else { - logger.Info(fmt.Sprintf("Gateway found. Updating gateway stake for address %s", msg.Address)) - currGatewayStake := *gateway.Stake - if err = k.updateGateway(ctx, &gateway, msg); err != nil { - return nil, err - } - coinsToDelegate = (*msg.Stake).Sub(currGatewayStake) - } - - // Retrieve the address of the gateway - gatewayAddress, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) - return nil, err - } - - // Send the coins from the gateway to the staked gateway pool - err = k.bankKeeper.DelegateCoinsFromAccountToModule(ctx, gatewayAddress, types.ModuleName, []sdk.Coin{coinsToDelegate}) - if err != nil { - logger.Error(fmt.Sprintf("could not send %v coins from %s to %s module account due to %v", coinsToDelegate, gatewayAddress, types.ModuleName, err)) - return nil, err - } - - // Update the Gateway in the store - k.SetGateway(ctx, gateway) - logger.Info(fmt.Sprintf("Successfully updated stake for gateway: %+v", gateway)) - - return &types.MsgStakeGatewayResponse{}, nil -} - -func (k msgServer) createGateway( - ctx sdk.Context, - msg *types.MsgStakeGateway, -) types.Gateway { - return types.Gateway{ - Address: msg.Address, - Stake: msg.Stake, - } -} - -func (k msgServer) updateGateway( - ctx sdk.Context, - gateway *types.Gateway, - msg *types.MsgStakeGateway, -) error { - // Checks if the the msg address is the same as the current owner - if msg.Address != gateway.Address { - return sdkerrors.Wrapf(types.ErrGatewayUnauthorized, "msg Address (%s) != gateway address (%s)", msg.Address, gateway.Address) - } - if msg.Stake == nil { - return sdkerrors.Wrapf(types.ErrGatewayInvalidStake, "stake amount cannot be nil") - } - if msg.Stake.IsLTE(*gateway.Stake) { - return sdkerrors.Wrapf(types.ErrGatewayInvalidStake, "stake amount %v must be higher than previous stake amount %v", msg.Stake, gateway.Stake) - } - gateway.Stake = msg.Stake - return nil -} diff --git a/x/gateway/keeper/msg_server_stake_gateway_test.go b/x/gateway/keeper/msg_server_stake_gateway_test.go deleted file mode 100644 index 597cc76d2..000000000 --- a/x/gateway/keeper/msg_server_stake_gateway_test.go +++ /dev/null @@ -1,93 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/gateway/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func TestMsgServer_StakeGateway_SuccessfulCreateAndUpdate(t *testing.T) { - k, ctx := keepertest.GatewayKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the gateway - addr := sample.AccAddress() - - // Verify that the gateway does not exist yet - _, isGatewayFound := k.GetGateway(ctx, addr) - require.False(t, isGatewayFound) - - // Prepare the gateway - initialStake := sdk.NewCoin("upokt", sdk.NewInt(100)) - stakeMsg := &types.MsgStakeGateway{ - Address: addr, - Stake: &initialStake, - } - - // Stake the gateway - _, err := srv.StakeGateway(wctx, stakeMsg) - require.NoError(t, err) - - // Verify that the gateway exists - foundGateway, isGatewayFound := k.GetGateway(ctx, addr) - require.True(t, isGatewayFound) - require.Equal(t, addr, foundGateway.Address) - require.Equal(t, initialStake.Amount, foundGateway.Stake.Amount) - - // Prepare an updated gateway with a higher stake - updatedStake := sdk.NewCoin("upokt", sdk.NewInt(200)) - updateMsg := &types.MsgStakeGateway{ - Address: addr, - Stake: &updatedStake, - } - - // Update the staked gateway - _, err = srv.StakeGateway(wctx, updateMsg) - require.NoError(t, err) - foundGateway, isGatewayFound = k.GetGateway(ctx, addr) - require.True(t, isGatewayFound) - require.Equal(t, updatedStake.Amount, foundGateway.Stake.Amount) -} - -func TestMsgServer_StakeGateway_FailLoweringStake(t *testing.T) { - k, ctx := keepertest.GatewayKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Prepare the gateway - addr := sample.AccAddress() - initialStake := sdk.NewCoin("upokt", sdk.NewInt(100)) - stakeMsg := &types.MsgStakeGateway{ - Address: addr, - Stake: &initialStake, - } - - // Stake the gateway & verify that the gateway exists - _, err := srv.StakeGateway(wctx, stakeMsg) - require.NoError(t, err) - _, isGatewayFound := k.GetGateway(ctx, addr) - require.True(t, isGatewayFound) - - // Prepare an updated gateway with a lower stake - updatedStake := sdk.NewCoin("upokt", sdk.NewInt(50)) - updateMsg := &types.MsgStakeGateway{ - Address: addr, - Stake: &updatedStake, - } - - // Verify that it fails - _, err = srv.StakeGateway(wctx, updateMsg) - require.Error(t, err) - - // Verify that the gateway stake is unchanged - gatewayFound, isGatewayFound := k.GetGateway(ctx, addr) - require.True(t, isGatewayFound) - require.Equal(t, initialStake.Amount, gatewayFound.Stake.Amount) -} diff --git a/x/gateway/keeper/msg_server_test.go b/x/gateway/keeper/msg_server_test.go deleted file mode 100644 index 598dda0e5..000000000 --- a/x/gateway/keeper/msg_server_test.go +++ /dev/null @@ -1,24 +0,0 @@ -package keeper_test - -import ( - "context" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/gateway/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { - k, ctx := keepertest.GatewayKeeper(t) - return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx) -} - -func TestMsgServer(t *testing.T) { - ms, ctx := setupMsgServer(t) - require.NotNil(t, ms) - require.NotNil(t, ctx) -} diff --git a/x/gateway/keeper/msg_server_unstake_gateway.go b/x/gateway/keeper/msg_server_unstake_gateway.go deleted file mode 100644 index 3521d1bac..000000000 --- a/x/gateway/keeper/msg_server_unstake_gateway.go +++ /dev/null @@ -1,54 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/gateway/types" -) - -// TODO_TECHDEBT(#49): Add un-delegation from delegated apps -// TODO(#73): Determine if a gateway needs an unbonding period after unstaking. -func (k msgServer) UnstakeGateway( - goCtx context.Context, - msg *types.MsgUnstakeGateway, -) (*types.MsgUnstakeGatewayResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - logger := k.Logger(ctx).With("method", "UnstakeGateway") - logger.Info(fmt.Sprintf("About to unstake gateway with msg: %v", msg)) - - if err := msg.ValidateBasic(); err != nil { - return nil, err - } - - // Check if the gateway already exists or not - var err error - gateway, isGatewayFound := k.GetGateway(ctx, msg.Address) - if !isGatewayFound { - logger.Info(fmt.Sprintf("Gateway not found. Cannot unstake address %s", msg.Address)) - return nil, types.ErrGatewayNotFound - } - logger.Info(fmt.Sprintf("Gateway found. Unstaking gateway for address %s", msg.Address)) - - // Retrieve the address of the gateway - gatewayAddress, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) - return nil, err - } - - // Send the coins from the gateway pool back to the gateway - err = k.bankKeeper.UndelegateCoinsFromModuleToAccount(ctx, types.ModuleName, gatewayAddress, []sdk.Coin{*gateway.Stake}) - if err != nil { - logger.Error(fmt.Sprintf("could not send %v coins from %s module to %s account due to %v", gateway.Stake, gatewayAddress, types.ModuleName, err)) - return nil, err - } - - // Update the Gateway in the store - k.RemoveGateway(ctx, gatewayAddress.String()) - logger.Info(fmt.Sprintf("Successfully removed the gateway: %+v", gateway)) - return &types.MsgUnstakeGatewayResponse{}, nil -} diff --git a/x/gateway/keeper/msg_server_unstake_gateway_test.go b/x/gateway/keeper/msg_server_unstake_gateway_test.go deleted file mode 100644 index 421316b78..000000000 --- a/x/gateway/keeper/msg_server_unstake_gateway_test.go +++ /dev/null @@ -1,74 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/gateway/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func TestMsgServer_UnstakeGateway_Success(t *testing.T) { - k, ctx := keepertest.GatewayKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the gateway - addr := sample.AccAddress() - - // Verify that the gateway does not exist yet - _, isGatewayFound := k.GetGateway(ctx, addr) - require.False(t, isGatewayFound) - - // Prepare the gateway - initialStake := sdk.NewCoin("upokt", sdk.NewInt(100)) - stakeMsg := &types.MsgStakeGateway{ - Address: addr, - Stake: &initialStake, - } - - // Stake the gateway - _, err := srv.StakeGateway(wctx, stakeMsg) - require.NoError(t, err) - - // Verify that the gateway exists - foundGateway, isGatewayFound := k.GetGateway(ctx, addr) - require.True(t, isGatewayFound) - require.Equal(t, addr, foundGateway.Address) - require.Equal(t, initialStake.Amount, foundGateway.Stake.Amount) - - // Unstake the gateway - unstakeMsg := &types.MsgUnstakeGateway{Address: addr} - _, err = srv.UnstakeGateway(wctx, unstakeMsg) - require.NoError(t, err) - - // Make sure the gateway can no longer be found after unstaking - _, isGatewayFound = k.GetGateway(ctx, addr) - require.False(t, isGatewayFound) -} - -func TestMsgServer_UnstakeGateway_FailIfNotStaked(t *testing.T) { - k, ctx := keepertest.GatewayKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the gateway - addr := sample.AccAddress() - - // Verify that the gateway does not exist yet - _, isGatewayFound := k.GetGateway(ctx, addr) - require.False(t, isGatewayFound) - - // Unstake the gateway - unstakeMsg := &types.MsgUnstakeGateway{Address: addr} - _, err := srv.UnstakeGateway(wctx, unstakeMsg) - require.Error(t, err) - require.ErrorIs(t, err, types.ErrGatewayNotFound) - - _, isGatewayFound = k.GetGateway(ctx, addr) - require.False(t, isGatewayFound) -} diff --git a/x/gateway/keeper/params.go b/x/gateway/keeper/params.go deleted file mode 100644 index e16780bc5..000000000 --- a/x/gateway/keeper/params.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/gateway/types" -) - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() -} - -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} diff --git a/x/gateway/keeper/params_test.go b/x/gateway/keeper/params_test.go deleted file mode 100644 index 748d837cf..000000000 --- a/x/gateway/keeper/params_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func TestGetParams(t *testing.T) { - k, ctx := testkeeper.GatewayKeeper(t) - params := types.DefaultParams() - - k.SetParams(ctx, params) - - require.EqualValues(t, params, k.GetParams(ctx)) -} diff --git a/x/gateway/keeper/query.go b/x/gateway/keeper/query.go deleted file mode 100644 index ffa80d00d..000000000 --- a/x/gateway/keeper/query.go +++ /dev/null @@ -1,7 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/gateway/types" -) - -var _ types.QueryServer = Keeper{} diff --git a/x/gateway/keeper/query_gateway.go b/x/gateway/keeper/query_gateway.go deleted file mode 100644 index 7e18dea34..000000000 --- a/x/gateway/keeper/query_gateway.go +++ /dev/null @@ -1,59 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func (k Keeper) GatewayAll(goCtx context.Context, req *types.QueryAllGatewayRequest) (*types.QueryAllGatewayResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - var gateways []types.Gateway - ctx := sdk.UnwrapSDKContext(goCtx) - - store := ctx.KVStore(k.storeKey) - gatewayStore := prefix.NewStore(store, types.KeyPrefix(types.GatewayKeyPrefix)) - - pageRes, err := query.Paginate(gatewayStore, req.Pagination, func(key []byte, value []byte) error { - var gateway types.Gateway - if err := k.cdc.Unmarshal(value, &gateway); err != nil { - return err - } - - gateways = append(gateways, gateway) - return nil - }) - - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryAllGatewayResponse{Gateway: gateways, Pagination: pageRes}, nil -} - -func (k Keeper) Gateway(goCtx context.Context, req *types.QueryGetGatewayRequest) (*types.QueryGetGatewayResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - - val, found := k.GetGateway( - ctx, - req.Address, - ) - if !found { - return nil, status.Error(codes.NotFound, fmt.Sprintf("gateway not found: address %s", req.Address)) - } - - return &types.QueryGetGatewayResponse{Gateway: val}, nil -} diff --git a/x/gateway/keeper/query_gateway_test.go b/x/gateway/keeper/query_gateway_test.go deleted file mode 100644 index 4c289e6ae..000000000 --- a/x/gateway/keeper/query_gateway_test.go +++ /dev/null @@ -1,127 +0,0 @@ -package keeper_test - -import ( - "strconv" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func TestGatewayQuerySingle(t *testing.T) { - keeper, ctx := keepertest.GatewayKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - msgs := createNGateway(keeper, ctx, 2) - tests := []struct { - desc string - request *types.QueryGetGatewayRequest - response *types.QueryGetGatewayResponse - err error - }{ - { - desc: "First", - request: &types.QueryGetGatewayRequest{ - Address: msgs[0].Address, - }, - response: &types.QueryGetGatewayResponse{Gateway: msgs[0]}, - }, - { - desc: "Second", - request: &types.QueryGetGatewayRequest{ - Address: msgs[1].Address, - }, - response: &types.QueryGetGatewayResponse{Gateway: msgs[1]}, - }, - { - desc: "KeyNotFound", - request: &types.QueryGetGatewayRequest{ - Address: strconv.Itoa(100000), - }, - err: status.Error(codes.NotFound, "gateway not found"), - }, - { - desc: "InvalidRequest", - err: status.Error(codes.InvalidArgument, "invalid request"), - }, - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.Gateway(wctx, tc.request) - if tc.err != nil { - require.ErrorContains(t, err, tc.err.Error()) - } else { - require.NoError(t, err) - require.Equal(t, - nullify.Fill(tc.response), - nullify.Fill(response), - ) - } - }) - } -} - -func TestGatewayQueryPaginated(t *testing.T) { - keeper, ctx := keepertest.GatewayKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - msgs := createNGateway(keeper, ctx, 5) - - request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllGatewayRequest { - return &types.QueryAllGatewayRequest{ - Pagination: &query.PageRequest{ - Key: next, - Offset: offset, - Limit: limit, - CountTotal: total, - }, - } - } - t.Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < len(msgs); i += step { - resp, err := keeper.GatewayAll(wctx, request(nil, uint64(i), uint64(step), false)) - require.NoError(t, err) - require.LessOrEqual(t, len(resp.Gateway), step) - require.Subset(t, - nullify.Fill(msgs), - nullify.Fill(resp.Gateway), - ) - } - }) - t.Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < len(msgs); i += step { - resp, err := keeper.GatewayAll(wctx, request(next, 0, uint64(step), false)) - require.NoError(t, err) - require.LessOrEqual(t, len(resp.Gateway), step) - require.Subset(t, - nullify.Fill(msgs), - nullify.Fill(resp.Gateway), - ) - next = resp.Pagination.NextKey - } - }) - t.Run("Total", func(t *testing.T) { - resp, err := keeper.GatewayAll(wctx, request(nil, 0, 0, true)) - require.NoError(t, err) - require.Equal(t, len(msgs), int(resp.Pagination.Total)) - require.ElementsMatch(t, - nullify.Fill(msgs), - nullify.Fill(resp.Gateway), - ) - }) - t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.GatewayAll(wctx, nil) - require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) - }) -} diff --git a/x/gateway/keeper/query_params.go b/x/gateway/keeper/query_params.go deleted file mode 100644 index 8d3afe26d..000000000 --- a/x/gateway/keeper/query_params.go +++ /dev/null @@ -1,20 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil -} diff --git a/x/gateway/keeper/query_params_test.go b/x/gateway/keeper/query_params_test.go deleted file mode 100644 index 062f049ff..000000000 --- a/x/gateway/keeper/query_params_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.GatewayKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - params := types.DefaultParams() - keeper.SetParams(ctx, params) - - response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) - require.NoError(t, err) - require.Equal(t, &types.QueryParamsResponse{Params: params}, response) -} diff --git a/x/gateway/module.go b/x/gateway/module.go deleted file mode 100644 index 86f16fb7c..000000000 --- a/x/gateway/module.go +++ /dev/null @@ -1,150 +0,0 @@ -package gateway - -import ( - "context" - "encoding/json" - "fmt" - - // this line is used by starport scaffolding # 1 - - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - abci "github.com/cometbft/cometbft/abci/types" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - - "github.com/pokt-network/poktroll/x/gateway/client/cli" - "github.com/pokt-network/poktroll/x/gateway/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface that defines the independent methods a Cosmos SDK module needs to implement. -type AppModuleBasic struct { - cdc codec.BinaryCodec -} - -func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} - -// Name returns the name of the module as a string -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(reg) -} - -// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) -} - -// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var genState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - return genState.Validate() -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) -} - -// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper -} - -func NewAppModule( - cdc codec.Codec, - keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, -) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - } -} - -// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) -} - -// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the module's genesis initialization. It returns no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, genState) - - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(genState) -} - -// ConsensusVersion is a sequence number for state-breaking change of the 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 } - -// BeginBlock contains the logic that is automatically triggered at the beginning of each block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} - -// EndBlock contains the logic that is automatically triggered at the end of each block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} diff --git a/x/gateway/module_simulation.go b/x/gateway/module_simulation.go deleted file mode 100644 index 0aab36ae9..000000000 --- a/x/gateway/module_simulation.go +++ /dev/null @@ -1,111 +0,0 @@ -package gateway - -import ( - "math/rand" - - "github.com/pokt-network/poktroll/testutil/sample" - gatewaysimulation "github.com/pokt-network/poktroll/x/gateway/simulation" - "github.com/pokt-network/poktroll/x/gateway/types" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/cosmos/cosmos-sdk/x/simulation" -) - -// avoid unused import issue -var ( - _ = sample.AccAddress - _ = gatewaysimulation.FindAccount - _ = simulation.MsgEntryKind - _ = baseapp.Paramspace - _ = rand.Rand{} -) - -const ( - opWeightMsgStakeGateway = "op_weight_msg_stake_gateway" - // TODO: Determine the simulation weight value - defaultWeightMsgStakeGateway int = 100 - - opWeightMsgUnstakeGateway = "op_weight_msg_unstake_gateway" - // TODO: Determine the simulation weight value - defaultWeightMsgUnstakeGateway int = 100 - - // this line is used by starport scaffolding # simapp/module/const -) - -// GenerateGenesisState creates a randomized GenState of the module. -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - accs := make([]string, len(simState.Accounts)) - for i, acc := range simState.Accounts { - accs[i] = acc.Address.String() - } - gatewayGenesis := types.GenesisState{ - Params: types.DefaultParams(), - // this line is used by starport scaffolding # simapp/module/genesisState - } - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&gatewayGenesis) -} - -// RegisterStoreDecoder registers a decoder. -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - -// WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - operations := make([]simtypes.WeightedOperation, 0) - - var weightMsgStakeGateway int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgStakeGateway, &weightMsgStakeGateway, nil, - func(_ *rand.Rand) { - weightMsgStakeGateway = defaultWeightMsgStakeGateway - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgStakeGateway, - gatewaysimulation.SimulateMsgStakeGateway(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgUnstakeGateway int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgUnstakeGateway, &weightMsgUnstakeGateway, nil, - func(_ *rand.Rand) { - weightMsgUnstakeGateway = defaultWeightMsgUnstakeGateway - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgUnstakeGateway, - gatewaysimulation.SimulateMsgUnstakeGateway(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - // this line is used by starport scaffolding # simapp/module/operation - - return operations -} - -// ProposalMsgs returns msgs used for governance proposals for simulations. -func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { - return []simtypes.WeightedProposalMsg{ - simulation.NewWeightedProposalMsg( - opWeightMsgStakeGateway, - defaultWeightMsgStakeGateway, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - gatewaysimulation.SimulateMsgStakeGateway(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - simulation.NewWeightedProposalMsg( - opWeightMsgUnstakeGateway, - defaultWeightMsgUnstakeGateway, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - gatewaysimulation.SimulateMsgUnstakeGateway(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - // this line is used by starport scaffolding # simapp/module/OpMsg - } -} diff --git a/x/gateway/simulation/helpers.go b/x/gateway/simulation/helpers.go deleted file mode 100644 index 92c437c0d..000000000 --- a/x/gateway/simulation/helpers.go +++ /dev/null @@ -1,15 +0,0 @@ -package simulation - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -// FindAccount find a specific address from an account list -func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { - creator, err := sdk.AccAddressFromBech32(address) - if err != nil { - panic(err) - } - return simtypes.FindAccount(accs, creator) -} diff --git a/x/gateway/simulation/stake_gateway.go b/x/gateway/simulation/stake_gateway.go deleted file mode 100644 index 9a76e82fc..000000000 --- a/x/gateway/simulation/stake_gateway.go +++ /dev/null @@ -1,30 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/pokt-network/poktroll/x/gateway/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func SimulateMsgStakeGateway( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - stakeMsg := &types.MsgStakeGateway{ - Address: simAccount.Address.String(), - } - - // TODO: Handling the StakeGateway simulation - - return simtypes.NoOpMsg(types.ModuleName, stakeMsg.Type(), "StakeGateway simulation not implemented"), nil, nil - } -} diff --git a/x/gateway/simulation/unstake_gateway.go b/x/gateway/simulation/unstake_gateway.go deleted file mode 100644 index e82ebf748..000000000 --- a/x/gateway/simulation/unstake_gateway.go +++ /dev/null @@ -1,30 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/pokt-network/poktroll/x/gateway/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func SimulateMsgUnstakeGateway( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgUnstakeGateway{ - Address: simAccount.Address.String(), - } - - // TODO: Handling the UnstakeGateway simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "UnstakeGateway simulation not implemented"), nil, nil - } -} diff --git a/x/gateway/types/codec.go b/x/gateway/types/codec.go deleted file mode 100644 index 8b6a56c1e..000000000 --- a/x/gateway/types/codec.go +++ /dev/null @@ -1,31 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" -) - -func RegisterCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgStakeGateway{}, "gateway/StakeGateway", nil) - cdc.RegisterConcrete(&MsgUnstakeGateway{}, "gateway/UnstakeGateway", nil) - // this line is used by starport scaffolding # 2 -} - -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgStakeGateway{}, - ) - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgUnstakeGateway{}, - ) - // this line is used by starport scaffolding # 3 - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) -) diff --git a/x/gateway/types/errors.go b/x/gateway/types/errors.go deleted file mode 100644 index 7a3a82930..000000000 --- a/x/gateway/types/errors.go +++ /dev/null @@ -1,15 +0,0 @@ -package types - -// DONTCOVER - -import ( - sdkerrors "cosmossdk.io/errors" -) - -// x/gateway module sentinel errors -var ( - ErrGatewayInvalidAddress = sdkerrors.Register(ModuleName, 1, "invalid gateway address") - ErrGatewayInvalidStake = sdkerrors.Register(ModuleName, 2, "invalid gateway stake") - ErrGatewayUnauthorized = sdkerrors.Register(ModuleName, 3, "unauthorized signer") - ErrGatewayNotFound = sdkerrors.Register(ModuleName, 4, "gateway not found") -) diff --git a/x/gateway/types/expected_keepers.go b/x/gateway/types/expected_keepers.go deleted file mode 100644 index 2a6f6eed1..000000000 --- a/x/gateway/types/expected_keepers.go +++ /dev/null @@ -1,20 +0,0 @@ -package types - -//go:generate mockgen -destination ../../../testutil/gateway/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" -) - -// AccountKeeper defines the expected account keeper used for simulations (noalias) -type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - // Methods imported from account should be defined here -} - -// BankKeeper defines the expected interface needed to retrieve account balances. -type BankKeeper interface { - DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error -} diff --git a/x/gateway/types/genesis.go b/x/gateway/types/genesis.go deleted file mode 100644 index 5cb161252..000000000 --- a/x/gateway/types/genesis.go +++ /dev/null @@ -1,53 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 - -// DefaultGenesis returns the default genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - GatewayList: []Gateway{}, - // this line is used by starport scaffolding # genesis/types/default - Params: DefaultParams(), - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - gatewayIndexMap := make(map[string]struct{}) - - for _, gateway := range gs.GatewayList { - // Check for duplicated index in gateway - index := string(GatewayKey(gateway.Address)) - if _, ok := gatewayIndexMap[index]; ok { - return sdkerrors.Wrap(ErrGatewayInvalidAddress, "duplicated index for gateway") - } - gatewayIndexMap[index] = struct{}{} - // Validate the stake of each gateway - if gateway.Stake == nil { - return sdkerrors.Wrap(ErrGatewayInvalidStake, "nil stake amount for gateway") - } - stake, err := sdk.ParseCoinNormalized(gateway.Stake.String()) - if !stake.IsValid() { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount for gateway %v; (%v)", gateway.Stake, stake.Validate()) - } - if err != nil { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "cannot parse stake amount for gateway %v; (%v)", gateway.Stake, err) - } - if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount for gateway: %v <= 0", gateway.Stake) - } - if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount denom for gateway %v", gateway.Stake) - } - } - // this line is used by starport scaffolding # genesis/types/validate - - return gs.Params.Validate() -} diff --git a/x/gateway/types/genesis_test.go b/x/gateway/types/genesis_test.go deleted file mode 100644 index ea1e6cdf8..000000000 --- a/x/gateway/types/genesis_test.go +++ /dev/null @@ -1,171 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/gateway/types" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" -) - -func TestGenesisState_Validate(t *testing.T) { - addr1 := sample.AccAddress() - stake1 := sdk.NewCoin("upokt", sdk.NewInt(100)) - - addr2 := sample.AccAddress() - stake2 := sdk.NewCoin("upokt", sdk.NewInt(100)) - - tests := []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - valid: true, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &stake2, - }, - }, - // this line is used by starport scaffolding # types/genesis/validField - }, - valid: true, - }, - { - desc: "invalid - duplicated gateway address", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr1, - Stake: &stake2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - nil gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: nil, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - missing gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - // Stake: stake2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - zero gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(0)}, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - negative gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(-100)}, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - wrong stake denom", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "invalid", Amount: sdk.NewInt(100)}, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - missing denom", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "", Amount: sdk.NewInt(100)}, - }, - }, - }, - valid: false, - }, - // this line is used by starport scaffolding # types/genesis/testcase - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } -} diff --git a/x/gateway/types/key_gateway.go b/x/gateway/types/key_gateway.go deleted file mode 100644 index 8fe1e65f7..000000000 --- a/x/gateway/types/key_gateway.go +++ /dev/null @@ -1,23 +0,0 @@ -package types - -import "encoding/binary" - -var _ binary.ByteOrder - -const ( - // GatewayKeyPrefix is the prefix to retrieve all Gateways - GatewayKeyPrefix = "Gateway/value/" -) - -// GatewayKey returns the store key to retrieve a Gateway from the index fields -func GatewayKey( - address string, -) []byte { - var key []byte - - addressBytes := []byte(address) - key = append(key, addressBytes...) - key = append(key, []byte("/")...) - - return key -} diff --git a/x/gateway/types/keys.go b/x/gateway/types/keys.go deleted file mode 100644 index 9e70da166..000000000 --- a/x/gateway/types/keys.go +++ /dev/null @@ -1,19 +0,0 @@ -package types - -const ( - // ModuleName defines the module name - ModuleName = "gateway" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // RouterKey defines the module's message routing key - RouterKey = ModuleName - - // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_gateway" -) - -func KeyPrefix(p string) []byte { - return []byte(p) -} diff --git a/x/gateway/types/message_stake_gateway.go b/x/gateway/types/message_stake_gateway.go deleted file mode 100644 index 70811076c..000000000 --- a/x/gateway/types/message_stake_gateway.go +++ /dev/null @@ -1,66 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" -) - -const TypeMsgStakeGateway = "stake_gateway" - -var _ sdk.Msg = (*MsgStakeGateway)(nil) - -func NewMsgStakeGateway(address string, stake types.Coin) *MsgStakeGateway { - return &MsgStakeGateway{ - Address: address, - Stake: &stake, - } -} - -func (msg *MsgStakeGateway) Route() string { - return RouterKey -} - -func (msg *MsgStakeGateway) Type() string { - return TypeMsgStakeGateway -} - -func (msg *MsgStakeGateway) GetSigners() []sdk.AccAddress { - address, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - panic(err) - } - return []sdk.AccAddress{address} -} - -func (msg *MsgStakeGateway) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgStakeGateway) ValidateBasic() error { - // Validate the address - _, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - return sdkerrors.Wrapf(ErrGatewayInvalidAddress, "invalid gateway address %s; (%v)", msg.Address, err) - } - - // Validate the stake amount - if msg.Stake == nil { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "nil gateway stake; (%v)", err) - } - stake, err := sdk.ParseCoinNormalized(msg.Stake.String()) - if !stake.IsValid() { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid gateway stake %v; (%v)", msg.Stake, stake.Validate()) - } - if err != nil { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "cannot parse gateway stake %v; (%v)", msg.Stake, err) - } - if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount for gateway: %v <= 0", msg.Stake) - } - if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount denom for gateway %v", msg.Stake) - } - return nil -} diff --git a/x/gateway/types/message_stake_gateway_test.go b/x/gateway/types/message_stake_gateway_test.go deleted file mode 100644 index 94299afaa..000000000 --- a/x/gateway/types/message_stake_gateway_test.go +++ /dev/null @@ -1,80 +0,0 @@ -package types - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" -) - -func TestMsgStakeGateway_ValidateBasic(t *testing.T) { - coins := sdk.NewCoin("upokt", sdk.NewInt(100)) - tests := []struct { - name string - msg MsgStakeGateway - err error - }{ - { - name: "invalid address - no stake", - msg: MsgStakeGateway{ - Address: "invalid_address", - // Stake explicitly nil - }, - err: ErrGatewayInvalidAddress, - }, { - name: "valid address - nil stake", - msg: MsgStakeGateway{ - Address: sample.AccAddress(), - // Stake explicitly nil - }, - err: ErrGatewayInvalidStake, - }, { - name: "valid address - zero stake", - msg: MsgStakeGateway{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(0)}, - }, - err: ErrGatewayInvalidStake, - }, { - name: "valid address - negative stake", - msg: MsgStakeGateway{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(-100)}, - }, - err: ErrGatewayInvalidStake, - }, { - name: "valid address - invalid stake denom", - msg: MsgStakeGateway{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "invalid", Amount: sdk.NewInt(100)}, - }, - err: ErrGatewayInvalidStake, - }, { - name: "valid address - invalid stake missing denom", - msg: MsgStakeGateway{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "", Amount: sdk.NewInt(100)}, - }, - err: ErrGatewayInvalidStake, - }, { - name: "valid address - valid stake", - msg: MsgStakeGateway{ - Address: sample.AccAddress(), - Stake: &coins, - }, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/gateway/types/message_unstake_gateway.go b/x/gateway/types/message_unstake_gateway.go deleted file mode 100644 index 23bf5f97a..000000000 --- a/x/gateway/types/message_unstake_gateway.go +++ /dev/null @@ -1,46 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const TypeMsgUnstakeGateway = "unstake_gateway" - -var _ sdk.Msg = (*MsgUnstakeGateway)(nil) - -func NewMsgUnstakeGateway(address string) *MsgUnstakeGateway { - return &MsgUnstakeGateway{ - Address: address, - } -} - -func (msg *MsgUnstakeGateway) Route() string { - return RouterKey -} - -func (msg *MsgUnstakeGateway) Type() string { - return TypeMsgUnstakeGateway -} - -func (msg *MsgUnstakeGateway) GetSigners() []sdk.AccAddress { - address, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - panic(err) - } - return []sdk.AccAddress{address} -} - -func (msg *MsgUnstakeGateway) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgUnstakeGateway) ValidateBasic() error { - // Validate the address - _, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - return sdkerrors.Wrapf(ErrGatewayInvalidAddress, "invalid gateway address %s; (%v)", msg.Address, err) - } - return nil -} diff --git a/x/gateway/types/message_unstake_gateway_test.go b/x/gateway/types/message_unstake_gateway_test.go deleted file mode 100644 index 759aa11d7..000000000 --- a/x/gateway/types/message_unstake_gateway_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package types - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" -) - -func TestMsgUnstakeGateway_ValidateBasic(t *testing.T) { - tests := []struct { - name string - msg MsgUnstakeGateway - err error - }{ - { - name: "invalid address", - msg: MsgUnstakeGateway{ - Address: "invalid_address", - }, - err: ErrGatewayInvalidAddress, - }, { - name: "missing address", - msg: MsgUnstakeGateway{}, - err: ErrGatewayInvalidAddress, - }, { - name: "valid address", - msg: MsgUnstakeGateway{ - Address: sample.AccAddress(), - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/gateway/types/params.go b/x/gateway/types/params.go deleted file mode 100644 index 357196ad6..000000000 --- a/x/gateway/types/params.go +++ /dev/null @@ -1,39 +0,0 @@ -package types - -import ( - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "gopkg.in/yaml.v2" -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params instance -func NewParams() Params { - return Params{} -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams() -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} -} - -// Validate validates the set of params -func (p Params) Validate() error { - return nil -} - -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} diff --git a/x/gateway/types/types.go b/x/gateway/types/types.go deleted file mode 100644 index ab1254f4c..000000000 --- a/x/gateway/types/types.go +++ /dev/null @@ -1 +0,0 @@ -package types diff --git a/x/pocket/client/cli/query.go b/x/pocket/client/cli/query.go deleted file mode 100644 index 7fb94d626..000000000 --- a/x/pocket/client/cli/query.go +++ /dev/null @@ -1,31 +0,0 @@ -package cli - -import ( - "fmt" - // "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/pocket/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - // Group pocket queries under a subcommand - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdQueryParams()) - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/pocket/client/cli/query_params.go b/x/pocket/client/cli/query_params.go deleted file mode 100644 index 8461c3c60..000000000 --- a/x/pocket/client/cli/query_params.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/pocket/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - 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.Params(cmd.Context(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/pocket/client/cli/tx.go b/x/pocket/client/cli/tx.go deleted file mode 100644 index 70032b9b8..000000000 --- a/x/pocket/client/cli/tx.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "fmt" - "time" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/pokt-network/poktroll/x/pocket/types" -) - -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/pocket/genesis.go b/x/pocket/genesis.go deleted file mode 100644 index 1a6b8738d..000000000 --- a/x/pocket/genesis.go +++ /dev/null @@ -1,24 +0,0 @@ -package pocket - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/pocket/keeper" - "github.com/pokt-network/poktroll/x/pocket/types" -) - -// InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) -} - -// ExportGenesis returns the module's exported genesis -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) - - // this line is used by starport scaffolding # genesis/module/export - - return genesis -} diff --git a/x/pocket/genesis_test.go b/x/pocket/genesis_test.go deleted file mode 100644 index 8e5f5ba18..000000000 --- a/x/pocket/genesis_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package pocket_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/pocket" - "github.com/pokt-network/poktroll/x/pocket/types" -) - -func TestGenesis(t *testing.T) { - genesisState := types.GenesisState{ - Params: types.DefaultParams(), - - // this line is used by starport scaffolding # genesis/test/state - } - - k, ctx := keepertest.PocketKeeper(t) - pocket.InitGenesis(ctx, *k, genesisState) - got := pocket.ExportGenesis(ctx, *k) - require.NotNil(t, got) - - nullify.Fill(&genesisState) - nullify.Fill(got) - - // this line is used by starport scaffolding # genesis/test/assert -} diff --git a/x/pocket/keeper/keeper.go b/x/pocket/keeper/keeper.go deleted file mode 100644 index 44114c392..000000000 --- a/x/pocket/keeper/keeper.go +++ /dev/null @@ -1,46 +0,0 @@ -package keeper - -import ( - "fmt" - - "github.com/cometbft/cometbft/libs/log" - "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - "github.com/pokt-network/poktroll/x/pocket/types" -) - -type ( - Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace - } -) - -func NewKeeper( - cdc codec.BinaryCodec, - storeKey, - memKey storetypes.StoreKey, - ps paramtypes.Subspace, - -) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } - - return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramstore: ps, - } -} - -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} diff --git a/x/pocket/keeper/msg_server.go b/x/pocket/keeper/msg_server.go deleted file mode 100644 index 310ebb2e5..000000000 --- a/x/pocket/keeper/msg_server.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/pocket/types" -) - -type msgServer struct { - Keeper -} - -// NewMsgServerImpl returns an implementation of the MsgServer interface -// for the provided Keeper. -func NewMsgServerImpl(keeper Keeper) types.MsgServer { - return &msgServer{Keeper: keeper} -} - -var _ types.MsgServer = msgServer{} diff --git a/x/pocket/keeper/msg_server_test.go b/x/pocket/keeper/msg_server_test.go deleted file mode 100644 index e27eda21b..000000000 --- a/x/pocket/keeper/msg_server_test.go +++ /dev/null @@ -1,24 +0,0 @@ -package keeper_test - -import ( - "context" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/pocket/keeper" - "github.com/pokt-network/poktroll/x/pocket/types" -) - -func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { - k, ctx := keepertest.PocketKeeper(t) - return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx) -} - -func TestMsgServer(t *testing.T) { - ms, ctx := setupMsgServer(t) - require.NotNil(t, ms) - require.NotNil(t, ctx) -} diff --git a/x/pocket/keeper/params.go b/x/pocket/keeper/params.go deleted file mode 100644 index b4b197932..000000000 --- a/x/pocket/keeper/params.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/pocket/types" -) - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() -} - -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} diff --git a/x/pocket/keeper/params_test.go b/x/pocket/keeper/params_test.go deleted file mode 100644 index 06afe192c..000000000 --- a/x/pocket/keeper/params_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/pocket/types" -) - -func TestGetParams(t *testing.T) { - k, ctx := testkeeper.PocketKeeper(t) - params := types.DefaultParams() - - k.SetParams(ctx, params) - - require.EqualValues(t, params, k.GetParams(ctx)) -} diff --git a/x/pocket/keeper/query.go b/x/pocket/keeper/query.go deleted file mode 100644 index 24adda2bb..000000000 --- a/x/pocket/keeper/query.go +++ /dev/null @@ -1,7 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/pocket/types" -) - -var _ types.QueryServer = Keeper{} diff --git a/x/pocket/keeper/query_params.go b/x/pocket/keeper/query_params.go deleted file mode 100644 index 3fdff1051..000000000 --- a/x/pocket/keeper/query_params.go +++ /dev/null @@ -1,20 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/pocket/types" -) - -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil -} diff --git a/x/pocket/keeper/query_params_test.go b/x/pocket/keeper/query_params_test.go deleted file mode 100644 index d40a517f4..000000000 --- a/x/pocket/keeper/query_params_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/pocket/types" -) - -func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.PocketKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - params := types.DefaultParams() - keeper.SetParams(ctx, params) - - response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) - require.NoError(t, err) - require.Equal(t, &types.QueryParamsResponse{Params: params}, response) -} diff --git a/x/pocket/module.go b/x/pocket/module.go deleted file mode 100644 index 684ea1d95..000000000 --- a/x/pocket/module.go +++ /dev/null @@ -1,150 +0,0 @@ -package pocket - -import ( - "context" - "encoding/json" - "fmt" - - // this line is used by starport scaffolding # 1 - - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - abci "github.com/cometbft/cometbft/abci/types" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - - "github.com/pokt-network/poktroll/x/pocket/client/cli" - "github.com/pokt-network/poktroll/x/pocket/keeper" - "github.com/pokt-network/poktroll/x/pocket/types" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface that defines the independent methods a Cosmos SDK module needs to implement. -type AppModuleBasic struct { - cdc codec.BinaryCodec -} - -func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} - -// Name returns the name of the module as a string -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(reg) -} - -// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) -} - -// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var genState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - return genState.Validate() -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) -} - -// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper -} - -func NewAppModule( - cdc codec.Codec, - keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, -) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - } -} - -// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) -} - -// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the module's genesis initialization. It returns no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, genState) - - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(genState) -} - -// ConsensusVersion is a sequence number for state-breaking change of the 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 } - -// BeginBlock contains the logic that is automatically triggered at the beginning of each block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} - -// EndBlock contains the logic that is automatically triggered at the end of each block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} diff --git a/x/pocket/module_simulation.go b/x/pocket/module_simulation.go deleted file mode 100644 index 5d5746526..000000000 --- a/x/pocket/module_simulation.go +++ /dev/null @@ -1,65 +0,0 @@ -package pocket - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/cosmos/cosmos-sdk/x/simulation" - - "github.com/pokt-network/poktroll/testutil/sample" - pocketsimulation "github.com/pokt-network/poktroll/x/pocket/simulation" - "github.com/pokt-network/poktroll/x/pocket/types" -) - -// avoid unused import issue -var ( - _ = sample.AccAddress - _ = pocketsimulation.FindAccount - _ = simulation.MsgEntryKind - _ = baseapp.Paramspace - _ = rand.Rand{} -) - -const ( -// this line is used by starport scaffolding # simapp/module/const -) - -// GenerateGenesisState creates a randomized GenState of the module. -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - accs := make([]string, len(simState.Accounts)) - for i, acc := range simState.Accounts { - accs[i] = acc.Address.String() - } - pocketGenesis := types.GenesisState{ - Params: types.DefaultParams(), - // this line is used by starport scaffolding # simapp/module/genesisState - } - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&pocketGenesis) -} - -// RegisterStoreDecoder registers a decoder. -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - -// WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - operations := make([]simtypes.WeightedOperation, 0) - - // this line is used by starport scaffolding # simapp/module/operation - - return operations -} - -// ProposalMsgs returns msgs used for governance proposals for simulations. -func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { - return []simtypes.WeightedProposalMsg{ - // this line is used by starport scaffolding # simapp/module/OpMsg - } -} diff --git a/x/pocket/simulation/helpers.go b/x/pocket/simulation/helpers.go deleted file mode 100644 index 92c437c0d..000000000 --- a/x/pocket/simulation/helpers.go +++ /dev/null @@ -1,15 +0,0 @@ -package simulation - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -// FindAccount find a specific address from an account list -func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { - creator, err := sdk.AccAddressFromBech32(address) - if err != nil { - panic(err) - } - return simtypes.FindAccount(accs, creator) -} diff --git a/x/pocket/types/codec.go b/x/pocket/types/codec.go deleted file mode 100644 index 39e7482ab..000000000 --- a/x/pocket/types/codec.go +++ /dev/null @@ -1,24 +0,0 @@ -package types - -import ( - // this line is used by starport scaffolding # 1 - - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" -) - -func RegisterCodec(cdc *codec.LegacyAmino) { - // this line is used by starport scaffolding # 2 -} - -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - // this line is used by starport scaffolding # 3 - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) -) diff --git a/x/pocket/types/errors.go b/x/pocket/types/errors.go deleted file mode 100644 index 0d0497b02..000000000 --- a/x/pocket/types/errors.go +++ /dev/null @@ -1,12 +0,0 @@ -package types - -// DONTCOVER - -import ( - sdkerrors "cosmossdk.io/errors" -) - -// x/pocket module sentinel errors -var ( - ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") -) diff --git a/x/pocket/types/expected_keepers.go b/x/pocket/types/expected_keepers.go deleted file mode 100644 index 6aa6e9778..000000000 --- a/x/pocket/types/expected_keepers.go +++ /dev/null @@ -1,18 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" -) - -// AccountKeeper defines the expected account keeper used for simulations (noalias) -type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - // Methods imported from account should be defined here -} - -// BankKeeper defines the expected interface needed to retrieve account balances. -type BankKeeper interface { - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - // Methods imported from bank should be defined here -} diff --git a/x/pocket/types/genesis.go b/x/pocket/types/genesis.go deleted file mode 100644 index 0af9b4416..000000000 --- a/x/pocket/types/genesis.go +++ /dev/null @@ -1,24 +0,0 @@ -package types - -import ( -// this line is used by starport scaffolding # genesis/types/import -) - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 - -// DefaultGenesis returns the default genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - // this line is used by starport scaffolding # genesis/types/default - Params: DefaultParams(), - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - // this line is used by starport scaffolding # genesis/types/validate - - return gs.Params.Validate() -} diff --git a/x/pocket/types/genesis_test.go b/x/pocket/types/genesis_test.go deleted file mode 100644 index c2eb457a8..000000000 --- a/x/pocket/types/genesis_test.go +++ /dev/null @@ -1,42 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/x/pocket/types" -) - -func TestGenesisState_Validate(t *testing.T) { - tests := []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - valid: true, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{ - - // this line is used by starport scaffolding # types/genesis/validField - }, - valid: true, - }, - // this line is used by starport scaffolding # types/genesis/testcase - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } -} diff --git a/x/pocket/types/keys.go b/x/pocket/types/keys.go deleted file mode 100644 index 41ef46733..000000000 --- a/x/pocket/types/keys.go +++ /dev/null @@ -1,19 +0,0 @@ -package types - -const ( - // ModuleName defines the module name - ModuleName = "pocket" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // RouterKey defines the module's message routing key - RouterKey = ModuleName - - // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_pocket" -) - -func KeyPrefix(p string) []byte { - return []byte(p) -} diff --git a/x/pocket/types/params.go b/x/pocket/types/params.go deleted file mode 100644 index 357196ad6..000000000 --- a/x/pocket/types/params.go +++ /dev/null @@ -1,39 +0,0 @@ -package types - -import ( - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "gopkg.in/yaml.v2" -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params instance -func NewParams() Params { - return Params{} -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams() -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} -} - -// Validate validates the set of params -func (p Params) Validate() error { - return nil -} - -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} diff --git a/x/pocket/types/types.go b/x/pocket/types/types.go deleted file mode 100644 index ab1254f4c..000000000 --- a/x/pocket/types/types.go +++ /dev/null @@ -1 +0,0 @@ -package types diff --git a/x/service/client/cli/query.go b/x/service/client/cli/query.go deleted file mode 100644 index f52a37c7a..000000000 --- a/x/service/client/cli/query.go +++ /dev/null @@ -1,31 +0,0 @@ -package cli - -import ( - "fmt" - // "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/service/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - // Group service queries under a subcommand - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdQueryParams()) - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/service/client/cli/query_params.go b/x/service/client/cli/query_params.go deleted file mode 100644 index cd99b673f..000000000 --- a/x/service/client/cli/query_params.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/service/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - 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.Params(cmd.Context(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/service/keeper/keeper.go b/x/service/keeper/keeper.go index 891ec3128..445e73e0f 100644 --- a/x/service/keeper/keeper.go +++ b/x/service/keeper/keeper.go @@ -3,52 +3,56 @@ package keeper import ( "fmt" - "github.com/cometbft/cometbft/libs/log" + "cosmossdk.io/core/store" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/pokt-network/poktroll/x/service/types" ) type ( - // Keeper defines the keeper, and its dependencies, for the service module. Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace + cdc codec.BinaryCodec + storeService store.KVStoreService + logger log.Logger + + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string bankKeeper types.BankKeeper } ) -// NewKeeper creates a new Service module Keeper instance. func NewKeeper( cdc codec.BinaryCodec, - storeKey, - memKey storetypes.StoreKey, - ps paramtypes.Subspace, + storeService store.KVStoreService, + logger log.Logger, + authority string, bankKeeper types.BankKeeper, -) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) +) Keeper { + if _, err := sdk.AccAddressFromBech32(authority); err != nil { + panic(fmt.Sprintf("invalid authority address: %s", authority)) } - return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramstore: ps, + return Keeper{ + cdc: cdc, + storeService: storeService, + authority: authority, + logger: logger, bankKeeper: bankKeeper, } } -// Logger provides a module-specific logger from the context's logger. -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +// GetAuthority returns the module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} + +// Logger returns a module-specific logger. +func (k Keeper) Logger() log.Logger { + return k.logger.With("module", fmt.Sprintf("x/%s", types.ModuleName)) } diff --git a/x/service/keeper/msg_server.go b/x/service/keeper/msg_server.go index e5f891b01..070f36dd6 100644 --- a/x/service/keeper/msg_server.go +++ b/x/service/keeper/msg_server.go @@ -1,8 +1,6 @@ package keeper -import ( - "github.com/pokt-network/poktroll/x/service/types" -) +import "github.com/pokt-network/poktroll/x/service/types" type msgServer struct { Keeper diff --git a/x/service/keeper/msg_server_add_service.go b/x/service/keeper/msg_server_add_service.go index 668759873..f22f15438 100644 --- a/x/service/keeper/msg_server_add_service.go +++ b/x/service/keeper/msg_server_add_service.go @@ -4,24 +4,23 @@ import ( "context" "fmt" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pokt-network/poktroll/x/service/types" ) -// AddService handles MsgAddService and adds a service to the network storing -// it in the service keeper's store using the provided ID from the message. -// If the transaction's signer does not have enough funds (upokt) to cover the -// AddServiceFee service module's governance parameter, it will not be able to -// add the service. If it does, the fee will be deducted and debited to the -// service module's account, then the service will be added on-chain. +// AddService adds a service to the network. +// The operation checks if the signer has enough funds (upokt) to pay the AddServiceFee. +// If funds are insufficient, the service won't be added. Otherwise, the fee is transferred from +// the signer to the service module's account, afterwards the service will be present on-chain. func (k msgServer) AddService( goCtx context.Context, msg *types.MsgAddService, ) (*types.MsgAddServiceResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - logger := k.Logger(ctx).With("method", "AddService") + logger := k.Logger().With("method", "AddService") logger.Info(fmt.Sprintf("About to add a new service with msg: %v", msg)) // Validate the message. @@ -58,7 +57,7 @@ func (k msgServer) AddService( // Check the balance of upokt is enough to cover the AddServiceFee. accBalance := accCoins.AmountOf("upokt") - addServiceFee := sdk.NewIntFromUint64(k.GetParams(ctx).AddServiceFee) + addServiceFee := math.NewIntFromUint64(k.GetParams(ctx).AddServiceFee) if accBalance.LTE(addServiceFee) { logger.Error(fmt.Sprintf("%s doesn't have enough funds to add service: %v", msg.Address, err)) return nil, types.ErrServiceNotEnoughFunds.Wrapf( diff --git a/x/service/keeper/msg_server_add_service_test.go b/x/service/keeper/msg_server_add_service_test.go index 9e5ab38cf..0930ede44 100644 --- a/x/service/keeper/msg_server_add_service_test.go +++ b/x/service/keeper/msg_server_add_service_test.go @@ -3,7 +3,6 @@ package keeper_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" keepertest "github.com/pokt-network/poktroll/testutil/keeper" @@ -18,30 +17,32 @@ const oneUPOKTGreaterThanFee = types.DefaultAddServiceFee + 1 func TestMsgServer_AddService(t *testing.T) { k, ctx := keepertest.ServiceKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) + srv := keeper.NewMsgServerImpl(k) - // Create a service + // Declare test services svc1 := sharedtypes.Service{ Id: "svc1", Name: "service 1", } - // Generate a valid address - addr := sample.AccAddress() - // Create a service preExistingService := sharedtypes.Service{ Id: "svc2", Name: "service 2", } + + // Generate a valid address + addr := sample.AccAddress() + // Mock adding a balance to the account keepertest.AddAccToAccMapCoins(t, addr, "upokt", oneUPOKTGreaterThanFee) + // Add the service to the store - _, err := srv.AddService(wctx, &types.MsgAddService{ + _, err := srv.AddService(ctx, &types.MsgAddService{ Address: addr, Service: preExistingService, }) require.NoError(t, err) + // Validate the service was added serviceFound, found := k.GetService(ctx, preExistingService.Id) require.True(t, found) @@ -51,11 +52,11 @@ func TestMsgServer_AddService(t *testing.T) { validAddr2 := sample.AccAddress() tests := []struct { - desc string - setup func(t *testing.T) - address string - service sharedtypes.Service - expectedError error + desc string + setup func(t *testing.T) + address string + service sharedtypes.Service + expectedErr error }{ { desc: "valid - service added successfully", @@ -63,9 +64,9 @@ func TestMsgServer_AddService(t *testing.T) { // Add 10000000001 upokt to the account keepertest.AddAccToAccMapCoins(t, validAddr1, "upokt", oneUPOKTGreaterThanFee) }, - address: validAddr1, - service: svc1, - expectedError: nil, + address: validAddr1, + service: svc1, + expectedErr: nil, }, { desc: "invalid - service supplier address is empty", @@ -75,14 +76,14 @@ func TestMsgServer_AddService(t *testing.T) { Id: "svc1", Name: "service 1", }, - expectedError: types.ErrServiceInvalidAddress, + expectedErr: types.ErrServiceInvalidAddress, }, { - desc: "invalid - invalid service supplier address", - setup: func(t *testing.T) {}, - address: "invalid address", - service: svc1, - expectedError: types.ErrServiceInvalidAddress, + desc: "invalid - invalid service supplier address", + setup: func(t *testing.T) {}, + address: "invalid address", + service: svc1, + expectedErr: types.ErrServiceInvalidAddress, }, { desc: "invalid - missing service ID", @@ -92,7 +93,7 @@ func TestMsgServer_AddService(t *testing.T) { // Explicitly omitting Id field Name: "service 1", }, - expectedError: types.ErrServiceMissingID, + expectedErr: types.ErrServiceMissingID, }, { desc: "invalid - empty service ID", @@ -102,7 +103,7 @@ func TestMsgServer_AddService(t *testing.T) { Id: "", // explicitly set to empty string Name: "service 1", }, - expectedError: types.ErrServiceMissingID, + expectedErr: types.ErrServiceMissingID, }, { desc: "invalid - missing service name", @@ -112,7 +113,7 @@ func TestMsgServer_AddService(t *testing.T) { Id: "svc1", // Explicitly omitting Name field }, - expectedError: types.ErrServiceMissingName, + expectedErr: types.ErrServiceMissingName, }, { desc: "invalid - empty service name", @@ -122,28 +123,28 @@ func TestMsgServer_AddService(t *testing.T) { Id: "svc1", Name: "", // explicitly set to empty string }, - expectedError: types.ErrServiceMissingName, + expectedErr: types.ErrServiceMissingName, }, { - desc: "invalid - service already exists (same service supplier)", - setup: func(t *testing.T) {}, - address: addr, - service: preExistingService, - expectedError: types.ErrServiceAlreadyExists, + desc: "invalid - service already exists (same service supplier)", + setup: func(t *testing.T) {}, + address: addr, + service: preExistingService, + expectedErr: types.ErrServiceAlreadyExists, }, { - desc: "invalid - service already exists (different service supplier)", - setup: func(t *testing.T) {}, - address: sample.AccAddress(), - service: preExistingService, - expectedError: types.ErrServiceAlreadyExists, + desc: "invalid - service already exists (different service supplier)", + setup: func(t *testing.T) {}, + address: sample.AccAddress(), + service: preExistingService, + expectedErr: types.ErrServiceAlreadyExists, }, { - desc: "invalid - no spendable coins", - setup: func(t *testing.T) {}, - address: sample.AccAddress(), - service: svc1, - expectedError: types.ErrServiceNotEnoughFunds, + desc: "invalid - no spendable coins", + setup: func(t *testing.T) {}, + address: sample.AccAddress(), + service: svc1, + expectedErr: types.ErrServiceNotEnoughFunds, }, { desc: "invalid - insufficient upokt balance", @@ -151,9 +152,9 @@ func TestMsgServer_AddService(t *testing.T) { // Add 999999999 upokt to the account (one less than AddServiceFee) keepertest.AddAccToAccMapCoins(t, validAddr2, "upokt", oneUPOKTGreaterThanFee-2) }, - address: validAddr2, - service: svc1, - expectedError: types.ErrServiceNotEnoughFunds, + address: validAddr2, + service: svc1, + expectedErr: types.ErrServiceNotEnoughFunds, }, { desc: "invalid - account has exactly AddServiceFee", @@ -161,9 +162,9 @@ func TestMsgServer_AddService(t *testing.T) { // Add the exact fee in upokt to the account keepertest.AddAccToAccMapCoins(t, validAddr2, "upokt", types.DefaultAddServiceFee) }, - address: validAddr2, - service: svc1, - expectedError: types.ErrServiceNotEnoughFunds, + address: validAddr2, + service: svc1, + expectedErr: types.ErrServiceNotEnoughFunds, }, { desc: "invalid - sufficient balance of different denom", @@ -171,29 +172,29 @@ func TestMsgServer_AddService(t *testing.T) { // Adds 10000000001 wrong coins to the account keepertest.AddAccToAccMapCoins(t, validAddr2, "wrong", oneUPOKTGreaterThanFee) }, - address: validAddr2, - service: svc1, - expectedError: types.ErrServiceNotEnoughFunds, + address: validAddr2, + service: svc1, + expectedErr: types.ErrServiceNotEnoughFunds, }, } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - tt.setup(t) - _, err := srv.AddService(wctx, &types.MsgAddService{ - Address: tt.address, - Service: tt.service, + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + test.setup(t) + _, err := srv.AddService(ctx, &types.MsgAddService{ + Address: test.address, + Service: test.service, }) - if tt.expectedError != nil { + if test.expectedErr != nil { // Using ErrorAs as wrapping the error sometimes gives errors with ErrorIs - require.ErrorAs(t, err, &tt.expectedError) + require.ErrorAs(t, err, &test.expectedErr) return } require.NoError(t, err) // Validate the service was added - serviceFound, found := k.GetService(ctx, tt.service.Id) + serviceFound, found := k.GetService(ctx, test.service.Id) require.True(t, found) - require.Equal(t, tt.service, serviceFound) + require.Equal(t, test.service, serviceFound) }) } } diff --git a/x/service/keeper/msg_server_test.go b/x/service/keeper/msg_server_test.go index 0c2446853..0bda2a3f4 100644 --- a/x/service/keeper/msg_server_test.go +++ b/x/service/keeper/msg_server_test.go @@ -4,20 +4,25 @@ import ( "context" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/x/service/keeper" "github.com/pokt-network/poktroll/x/service/types" - "github.com/stretchr/testify/require" ) -func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { +func setupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, context.Context) { + t.Helper() + k, ctx := keepertest.ServiceKeeper(t) - return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx) + return k, keeper.NewMsgServerImpl(k), ctx } func TestMsgServer(t *testing.T) { - ms, ctx := setupMsgServer(t) + t.Helper() + + k, ms, ctx := setupMsgServer(t) require.NotNil(t, ms) require.NotNil(t, ctx) + require.NotEmpty(t, k) } diff --git a/x/service/keeper/msg_update_params.go b/x/service/keeper/msg_update_params.go new file mode 100644 index 000000000..a926bc1dd --- /dev/null +++ b/x/service/keeper/msg_update_params.go @@ -0,0 +1,19 @@ +package keeper + +import ( + "context" + + "github.com/pokt-network/poktroll/x/service/types" +) + +func (k msgServer) UpdateParams(ctx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if k.GetAuthority() != req.Authority { + return nil, types.ErrServiceInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + } + + if err := k.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/service/keeper/msg_update_params_test.go b/x/service/keeper/msg_update_params_test.go new file mode 100644 index 000000000..8fe9ecfb1 --- /dev/null +++ b/x/service/keeper/msg_update_params_test.go @@ -0,0 +1,62 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/x/service/types" +) + +func TestMsgUpdateParams(t *testing.T) { + k, ms, ctx := setupMsgServer(t) + params := types.DefaultParams() + require.NoError(t, k.SetParams(ctx, params)) + + // default params + tests := []struct { + desc string + input *types.MsgUpdateParams + shouldError bool + expectedErrMsg string + }{ + { + desc: "invalid authority", + input: &types.MsgUpdateParams{ + Authority: "invalid", + Params: params, + }, + shouldError: true, + expectedErrMsg: "invalid authority", + }, + { + desc: "send enabled param", + input: &types.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: types.Params{}, + }, + shouldError: false, + }, + { + desc: "all good", + input: &types.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: params, + }, + shouldError: false, + }, + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + _, err := ms.UpdateParams(ctx, test.input) + + if test.shouldError { + require.Error(t, err) + require.Contains(t, err.Error(), test.expectedErrMsg) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/service/keeper/params.go b/x/service/keeper/params.go index 948fec7a1..564b30b2b 100644 --- a/x/service/keeper/params.go +++ b/x/service/keeper/params.go @@ -1,17 +1,33 @@ package keeper import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" + + "github.com/cosmos/cosmos-sdk/runtime" "github.com/pokt-network/poktroll/x/service/types" ) // GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() +func (k Keeper) GetParams(ctx context.Context) (params types.Params) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + paramsBz := store.Get(types.ParamsKey) + if paramsBz == nil { + return params + } + + k.cdc.MustUnmarshal(paramsBz, ¶ms) + return params } // SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) +func (k Keeper) SetParams(ctx context.Context, params types.Params) error { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + paramsBz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } + store.Set(types.ParamsKey, paramsBz) + + return nil } diff --git a/x/service/keeper/params_test.go b/x/service/keeper/params_test.go index 097742cd1..2c7100aef 100644 --- a/x/service/keeper/params_test.go +++ b/x/service/keeper/params_test.go @@ -5,15 +5,14 @@ import ( "github.com/stretchr/testify/require" - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" + keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/x/service/types" ) func TestGetParams(t *testing.T) { - k, ctx := testkeeper.ServiceKeeper(t) + k, ctx := keepertest.ServiceKeeper(t) params := types.DefaultParams() - k.SetParams(ctx, params) - + require.NoError(t, k.SetParams(ctx, params)) require.EqualValues(t, params, k.GetParams(ctx)) } diff --git a/x/service/keeper/query.go b/x/service/keeper/query.go index ac3116f9a..48d9d1663 100644 --- a/x/service/keeper/query.go +++ b/x/service/keeper/query.go @@ -1,7 +1,5 @@ package keeper -import ( - "github.com/pokt-network/poktroll/x/service/types" -) +import "github.com/pokt-network/poktroll/x/service/types" var _ types.QueryServer = Keeper{} diff --git a/x/service/keeper/query_params.go b/x/service/keeper/query_params.go index c04f32dd9..397ea09c4 100644 --- a/x/service/keeper/query_params.go +++ b/x/service/keeper/query_params.go @@ -3,18 +3,16 @@ package keeper import ( "context" - sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/x/service/types" ) -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (k Keeper) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - ctx := sdk.UnwrapSDKContext(goCtx) return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil } diff --git a/x/service/keeper/query_params_test.go b/x/service/keeper/query_params_test.go index 243a9ed80..96325f611 100644 --- a/x/service/keeper/query_params_test.go +++ b/x/service/keeper/query_params_test.go @@ -3,20 +3,18 @@ package keeper_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" + keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/x/service/types" ) func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.ServiceKeeper(t) - wctx := sdk.WrapSDKContext(ctx) + keeper, ctx := keepertest.ServiceKeeper(t) params := types.DefaultParams() - keeper.SetParams(ctx, params) + require.NoError(t, keeper.SetParams(ctx, params)) - response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) + response, err := keeper.Params(ctx, &types.QueryParamsRequest{}) require.NoError(t, err) require.Equal(t, &types.QueryParamsResponse{Params: params}, response) } diff --git a/x/service/keeper/query_service.go b/x/service/keeper/query_service.go new file mode 100644 index 000000000..94a0e4ad3 --- /dev/null +++ b/x/service/keeper/query_service.go @@ -0,0 +1,56 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/cosmos-sdk/types/query" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/x/service/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// AllServices queries all services. +func (k Keeper) AllServices(ctx context.Context, req *types.QueryAllServicesRequest) (*types.QueryAllServicesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + var services []sharedtypes.Service + + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + serviceStore := prefix.NewStore(store, types.KeyPrefix(types.ServiceKeyPrefix)) + + pageRes, err := query.Paginate(serviceStore, req.Pagination, func(key []byte, value []byte) error { + var service sharedtypes.Service + if err := k.cdc.Unmarshal(value, &service); err != nil { + return err + } + + services = append(services, service) + return nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllServicesResponse{Service: services, Pagination: pageRes}, nil +} + +// Service returns the requested service if it exists. +func (k Keeper) Service(ctx context.Context, req *types.QueryGetServiceRequest) (*types.QueryGetServiceResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + service, found := k.GetService(ctx, req.Id) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + return &types.QueryGetServiceResponse{Service: service}, nil +} diff --git a/x/service/keeper/query_service_test.go b/x/service/keeper/query_service_test.go new file mode 100644 index 000000000..f1f968fd6 --- /dev/null +++ b/x/service/keeper/query_service_test.go @@ -0,0 +1,124 @@ +package keeper_test + +import ( + "strconv" + "testing" + + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + "github.com/pokt-network/poktroll/x/service/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func TestServiceQuerySingle(t *testing.T) { + keeper, ctx := keepertest.ServiceKeeper(t) + msgs := createNServices(keeper, ctx, 2) + tests := []struct { + desc string + request *types.QueryGetServiceRequest + response *types.QueryGetServiceResponse + expectedErr error + }{ + { + desc: "First", + request: &types.QueryGetServiceRequest{ + Id: msgs[0].Id, + }, + response: &types.QueryGetServiceResponse{Service: msgs[0]}, + }, + { + desc: "Second", + request: &types.QueryGetServiceRequest{ + Id: msgs[1].Id, + }, + response: &types.QueryGetServiceResponse{Service: msgs[1]}, + }, + { + desc: "KeyNotFound", + request: &types.QueryGetServiceRequest{ + Id: strconv.Itoa(100000), + }, + expectedErr: status.Error(codes.NotFound, "not found"), + }, + { + desc: "InvalidRequest", + expectedErr: status.Error(codes.InvalidArgument, "invalid request"), + }, + } + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + response, err := keeper.Service(ctx, test.request) + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) + } else { + require.NoError(t, err) + require.Equal(t, + nullify.Fill(test.response), + nullify.Fill(response), + ) + } + }) + } +} + +func TestServiceQueryPaginated(t *testing.T) { + keeper, ctx := keepertest.ServiceKeeper(t) + msgs := createNServices(keeper, ctx, 5) + + request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllServicesRequest { + return &types.QueryAllServicesRequest{ + Pagination: &query.PageRequest{ + Key: next, + Offset: offset, + Limit: limit, + CountTotal: total, + }, + } + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(msgs); i += step { + resp, err := keeper.AllServices(ctx, request(nil, uint64(i), uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.Service), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.Service), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(msgs); i += step { + resp, err := keeper.AllServices(ctx, request(next, 0, uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.Service), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.Service), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + resp, err := keeper.AllServices(ctx, request(nil, 0, 0, true)) + require.NoError(t, err) + require.Equal(t, len(msgs), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(msgs), + nullify.Fill(resp.Service), + ) + }) + t.Run("InvalidRequest", func(t *testing.T) { + _, err := keeper.AllServices(ctx, nil) + require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) + }) +} diff --git a/x/service/keeper/service.go b/x/service/keeper/service.go index dd7b860f0..fe060e9a7 100644 --- a/x/service/keeper/service.go +++ b/x/service/keeper/service.go @@ -1,38 +1,33 @@ package keeper import ( - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" + "context" + + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/runtime" "github.com/pokt-network/poktroll/x/service/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) -// SetService set a specific service in the store from its index. -func (k Keeper) SetService(ctx sdk.Context, service sharedtypes.Service) { - store := prefix.NewStore( - ctx.KVStore(k.storeKey), - types.KeyPrefix(types.ServiceKeyPrefix), - ) +// SetService set a specific service in the store from its index +func (k Keeper) SetService(ctx context.Context, service sharedtypes.Service) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ServiceKeyPrefix)) serviceBz := k.cdc.MustMarshal(&service) - store.Set(types.ServiceKey( - service.Id, - ), serviceBz) + store.Set(types.ServiceKey(service.Id), serviceBz) } -// GetService returns a service from the store by its index. +// GetService returns a service from its index func (k Keeper) GetService( - ctx sdk.Context, - serviceID string, + ctx context.Context, + serviceId string, ) (service sharedtypes.Service, found bool) { - store := prefix.NewStore( - ctx.KVStore(k.storeKey), - types.KeyPrefix(types.ServiceKeyPrefix), - ) + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ServiceKeyPrefix)) - serviceBz := store.Get(types.ServiceKey( - serviceID, - )) + serviceBz := store.Get(types.ServiceKey(serviceId)) if serviceBz == nil { return service, false } @@ -41,34 +36,28 @@ func (k Keeper) GetService( return service, true } -// RemoveService removes a service from the store. +// RemoveService removes a service from the store func (k Keeper) RemoveService( - ctx sdk.Context, - serviceID string, + ctx context.Context, + serviceId string, ) { - store := prefix.NewStore( - ctx.KVStore(k.storeKey), - types.KeyPrefix(types.ServiceKeyPrefix), - ) - store.Delete(types.ServiceKey( - serviceID, - )) + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ServiceKeyPrefix)) + store.Delete(types.ServiceKey(serviceId)) } -// GetAllServices returns all services from the store. -func (k Keeper) GetAllServices(ctx sdk.Context) (list []sharedtypes.Service) { - store := prefix.NewStore( - ctx.KVStore(k.storeKey), - types.KeyPrefix(types.ServiceKeyPrefix), - ) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) +// GetAllService returns all service +func (k Keeper) GetAllService(ctx context.Context) (services []sharedtypes.Service) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ServiceKeyPrefix)) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - service := sharedtypes.Service{} + var service sharedtypes.Service k.cdc.MustUnmarshal(iterator.Value(), &service) - list = append(list, service) + services = append(services, service) } return diff --git a/x/service/keeper/service_test.go b/x/service/keeper/service_test.go index 2e7d3e763..d3a37f6e6 100644 --- a/x/service/keeper/service_test.go +++ b/x/service/keeper/service_test.go @@ -1,15 +1,15 @@ package keeper_test import ( + "context" "fmt" "strconv" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/stretchr/testify/require" - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" + "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/nullify" "github.com/pokt-network/poktroll/x/service/keeper" @@ -24,10 +24,10 @@ func init() { cmd.InitSDKConfig() } -func createNServices(keeper *keeper.Keeper, ctx sdk.Context, n int) []sharedtypes.Service { +func createNServices(keeper keeper.Keeper, ctx context.Context, n int) []sharedtypes.Service { services := make([]sharedtypes.Service, n) for i := range services { - services[i].Id = fmt.Sprintf("svcId%d", i) + services[i].Id = strconv.Itoa(i) services[i].Name = fmt.Sprintf("svcName%d", i) keeper.SetService(ctx, services[i]) @@ -44,27 +44,20 @@ func TestServiceGet(t *testing.T) { keeper, ctx := keepertest.ServiceKeeper(t) services := createNServices(keeper, ctx, 10) for _, service := range services { - service, found := keeper.GetService(ctx, - service.Id, - ) + foundService, found := keeper.GetService(ctx, service.Id) require.True(t, found) require.Equal(t, nullify.Fill(&service), - nullify.Fill(&service), + nullify.Fill(&foundService), ) } } - func TestServiceRemove(t *testing.T) { keeper, ctx := keepertest.ServiceKeeper(t) services := createNServices(keeper, ctx, 10) for _, service := range services { - keeper.RemoveService(ctx, - service.Id, - ) - _, found := keeper.GetService(ctx, - service.Id, - ) + keeper.RemoveService(ctx, service.Id) + _, found := keeper.GetService(ctx, service.Id) require.False(t, found) } } @@ -74,6 +67,6 @@ func TestServiceGetAll(t *testing.T) { services := createNServices(keeper, ctx, 10) require.ElementsMatch(t, nullify.Fill(services), - nullify.Fill(keeper.GetAllServices(ctx)), + nullify.Fill(keeper.GetAllService(ctx)), ) } diff --git a/x/service/module/autocli.go b/x/service/module/autocli.go new file mode 100644 index 000000000..287cbbcbc --- /dev/null +++ b/x/service/module/autocli.go @@ -0,0 +1,52 @@ +package service + +import ( + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + + modulev1 "github.com/pokt-network/poktroll/api/poktroll/service" +) + +// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. +func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { + return &autocliv1.ModuleOptions{ + Query: &autocliv1.ServiceCommandDescriptor{ + Service: modulev1.Query_ServiceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + // { + // RpcMethod: "Params", + // Use: "params", + // Short: "Shows the parameters of the module", + // }, + // { + // RpcMethod: "AllServices", + // Use: "list-service", + // Short: "List all service", + // }, + // { + // RpcMethod: "Service", + // Use: "show-service [id]", + // Short: "Shows a service", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "index"}}, + // }, + // this line is used by ignite scaffolding # autocli/query + }, + }, + Tx: &autocliv1.ServiceCommandDescriptor{ + Service: modulev1.Msg_ServiceDesc.ServiceName, + EnhanceCustomCommand: true, // only required if you want to use the custom command + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + // { + // RpcMethod: "UpdateParams", + // Skip: true, // skipped because authority gated + // }, + // { + // RpcMethod: "AddService", + // Use: "add-service", + // Short: "Send a add-service tx", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, + // }, + // this line is used by ignite scaffolding # autocli/tx + }, + }, + } +} diff --git a/x/service/genesis.go b/x/service/module/genesis.go similarity index 58% rename from x/service/genesis.go rename to x/service/module/genesis.go index c81e649dd..fded93481 100644 --- a/x/service/genesis.go +++ b/x/service/module/genesis.go @@ -1,28 +1,30 @@ package service import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" "github.com/pokt-network/poktroll/x/service/keeper" "github.com/pokt-network/poktroll/x/service/types" ) // InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - // Set all the initial services +func InitGenesis(ctx context.Context, k keeper.Keeper, genState types.GenesisState) { + // Set all the service for _, service := range genState.ServiceList { k.SetService(ctx, service) } // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) + if err := k.SetParams(ctx, genState.Params); err != nil { + panic(err) + } } -// ExportGenesis returns the module's exported genesis -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { +// ExportGenesis returns the module's exported genesis. +func ExportGenesis(ctx context.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetParams(ctx) - genesis.ServiceList = k.GetAllServices(ctx) + genesis.ServiceList = k.GetAllService(ctx) // this line is used by starport scaffolding # genesis/module/export return genesis diff --git a/x/service/genesis_test.go b/x/service/module/genesis_test.go similarity index 86% rename from x/service/genesis_test.go rename to x/service/module/genesis_test.go index d7d44c9c4..c95032594 100644 --- a/x/service/genesis_test.go +++ b/x/service/module/genesis_test.go @@ -7,7 +7,7 @@ import ( keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/service" + service "github.com/pokt-network/poktroll/x/service/module" "github.com/pokt-network/poktroll/x/service/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) @@ -15,6 +15,7 @@ import ( func TestGenesis(t *testing.T) { genesisState := types.GenesisState{ Params: types.DefaultParams(), + ServiceList: []sharedtypes.Service{ { Id: "svc1", @@ -29,8 +30,8 @@ func TestGenesis(t *testing.T) { } k, ctx := keepertest.ServiceKeeper(t) - service.InitGenesis(ctx, *k, genesisState) - got := service.ExportGenesis(ctx, *k) + service.InitGenesis(ctx, k, genesisState) + got := service.ExportGenesis(ctx, k) require.NotNil(t, got) nullify.Fill(&genesisState) diff --git a/x/service/module.go b/x/service/module/module.go similarity index 56% rename from x/service/module.go rename to x/service/module/module.go index a7ebd35f2..e57949906 100644 --- a/x/service/module.go +++ b/x/service/module/module.go @@ -5,34 +5,44 @@ import ( "encoding/json" "fmt" - // this line is used by starport scaffolding # 1 - - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - abci "github.com/cometbft/cometbft/abci/types" - + "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/store" + "cosmossdk.io/depinject" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + + // this line is used by starport scaffolding # 1 - "github.com/pokt-network/poktroll/x/service/client/cli" + modulev1 "github.com/pokt-network/poktroll/api/poktroll/service/module" "github.com/pokt-network/poktroll/x/service/keeper" "github.com/pokt-network/poktroll/x/service/types" ) var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} + _ module.AppModuleBasic = (*AppModule)(nil) + _ module.AppModuleSimulation = (*AppModule)(nil) + _ module.HasGenesis = (*AppModule)(nil) + _ module.HasInvariants = (*AppModule)(nil) + _ module.HasConsensusVersion = (*AppModule)(nil) + + _ appmodule.AppModule = (*AppModule)(nil) + _ appmodule.HasBeginBlocker = (*AppModule)(nil) + _ appmodule.HasEndBlocker = (*AppModule)(nil) ) // ---------------------------------------------------------------------------- // AppModuleBasic // ---------------------------------------------------------------------------- -// AppModuleBasic implements the AppModuleBasic interface that defines the independent methods a Cosmos SDK module needs to implement. +// AppModuleBasic implements the AppModuleBasic interface that defines the +// independent methods a Cosmos SDK module needs to implement. type AppModuleBasic struct { cdc codec.BinaryCodec } @@ -41,27 +51,27 @@ func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { return AppModuleBasic{cdc: cdc} } -// Name returns the name of the module as a string +// Name returns the name of the module as a string. func (AppModuleBasic) Name() string { return types.ModuleName } -// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} +// RegisterLegacyAminoCodec registers the amino codec for the module, which is used +// to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} -// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message +// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message. func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { types.RegisterInterfaces(reg) } -// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing +// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. +// The default GenesisState need to be defined by the module developer and is primarily used for testing. func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { return cdc.MustMarshalJSON(types.DefaultGenesis()) } -// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form +// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form. func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { var genState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genState); err != nil { @@ -70,19 +80,11 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod return genState.Validate() } -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) -} - -// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } } // ---------------------------------------------------------------------------- @@ -122,14 +124,12 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} // InitGenesis performs the module's genesis initialization. It returns no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) { var genState types.GenesisState // Initialize global index to index in genesis state cdc.MustUnmarshalJSON(gs, &genState) InitGenesis(ctx, am.keeper, genState) - - return []abci.ValidatorUpdate{} } // ExportGenesis returns the module's exported genesis state as raw JSON bytes. @@ -138,13 +138,76 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw return cdc.MustMarshalJSON(genState) } -// ConsensusVersion is a sequence number for state-breaking change of the 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 +// ConsensusVersion is a sequence number for state-breaking change of the 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. +// TODO_TECHDEBT(#395): Make consensus version configurable func (AppModule) ConsensusVersion() uint64 { return 1 } -// BeginBlock contains the logic that is automatically triggered at the beginning of each block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} +// BeginBlock contains the logic that is automatically triggered at the beginning of each block. +// The begin block implementation is optional. +func (am AppModule) BeginBlock(_ context.Context) error { + return nil +} -// EndBlock contains the logic that is automatically triggered at the end of each block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +// EndBlock contains the logic that is automatically triggered at the end of each block. +// The end block implementation is optional. +func (am AppModule) EndBlock(_ context.Context) error { + return nil +} + +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (am AppModule) IsOnePerModuleType() {} + +// IsAppModule implements the appmodule.AppModule interface. +func (am AppModule) IsAppModule() {} + +// ---------------------------------------------------------------------------- +// App Wiring Setup +// ---------------------------------------------------------------------------- + +func init() { + appmodule.Register(&modulev1.Module{}, appmodule.Provide(ProvideModule)) +} + +type ModuleInputs struct { + depinject.In + + StoreService store.KVStoreService + Cdc codec.Codec + Config *modulev1.Module + Logger log.Logger + + AccountKeeper types.AccountKeeper + BankKeeper types.BankKeeper +} + +type ModuleOutputs struct { + depinject.Out + + ServiceKeeper keeper.Keeper + Module appmodule.AppModule +} + +func ProvideModule(in ModuleInputs) ModuleOutputs { + // default to governance authority if not provided + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + if in.Config.Authority != "" { + authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) + } + k := keeper.NewKeeper( + in.Cdc, + in.StoreService, + in.Logger, + authority.String(), + in.BankKeeper, + ) + m := NewAppModule( + in.Cdc, + k, + in.AccountKeeper, + in.BankKeeper, + ) + + return ModuleOutputs{ServiceKeeper: k, Module: m} } diff --git a/x/service/module_simulation.go b/x/service/module/simulation.go similarity index 92% rename from x/service/module_simulation.go rename to x/service/module/simulation.go index 320a12916..3547838be 100644 --- a/x/service/module_simulation.go +++ b/x/service/module/simulation.go @@ -3,7 +3,6 @@ package service import ( "math/rand" - "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" @@ -16,11 +15,11 @@ import ( // avoid unused import issue var ( - _ = sample.AccAddress _ = servicesimulation.FindAccount - _ = simulation.MsgEntryKind - _ = baseapp.Paramspace _ = rand.Rand{} + _ = sample.AccAddress + _ = sdk.AccAddress{} + _ = simulation.MsgEntryKind ) const ( @@ -45,7 +44,7 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { } // RegisterStoreDecoder registers a decoder. -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} +func (am AppModule) RegisterStoreDecoder(_ simtypes.StoreDecoderRegistry) {} // ProposalContents doesn't return any content functions for governance proposals. func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { @@ -57,7 +56,7 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp operations := make([]simtypes.WeightedOperation, 0) var weightMsgAddService int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgAddService, &weightMsgAddService, nil, + simState.AppParams.GetOrGenerate(opWeightMsgAddService, &weightMsgAddService, nil, func(_ *rand.Rand) { weightMsgAddService = defaultWeightMsgAddService }, diff --git a/x/service/client/cli/tx.go b/x/service/module/tx.go similarity index 65% rename from x/service/client/cli/tx.go rename to x/service/module/tx.go index 38c85ed8f..48abdd9cc 100644 --- a/x/service/client/cli/tx.go +++ b/x/service/module/tx.go @@ -1,27 +1,17 @@ -package cli +package service import ( "fmt" - "time" + "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" "github.com/pokt-network/poktroll/x/service/types" ) -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - // GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { +// TODO_TECHDEBT(#370): remove if custom query commands are consolidated into AutoCLI. +func (am AppModule) GetTxCmd() *cobra.Command { cmd := &cobra.Command{ Use: types.ModuleName, Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), diff --git a/x/service/client/cli/tx_add_service.go b/x/service/module/tx_add_service.go similarity index 82% rename from x/service/client/cli/tx_add_service.go rename to x/service/module/tx_add_service.go index af8e4861e..48ed62ccb 100644 --- a/x/service/client/cli/tx_add_service.go +++ b/x/service/module/tx_add_service.go @@ -1,4 +1,4 @@ -package cli +package service import ( "strconv" @@ -18,11 +18,10 @@ func CmdAddService() *cobra.Command { Use: "add-service ", Short: "Add a new service to the network", Long: `Add a new service to the network that will be available for applications, -gateways and suppliers to use. The service id MUST be unique - or the command -will fail, however the name you use to describe it does not have to be unique. +gateways and suppliers to use. The service id MUST be unique but the service name doesn't have to be. Example: -$ poktrolld tx service add-service "svc1" "service_one" --keyring-backend test --from $(SUPPLIER) --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, +$ poktrolld tx service add-service "svc1" "service_one" --keyring-backend test --from $(SUPPLIER) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { serviceIdStr := args[0] diff --git a/x/service/client/cli/tx_add_service_test.go b/x/service/module/tx_add_service_test.go similarity index 78% rename from x/service/client/cli/tx_add_service_test.go rename to x/service/module/tx_add_service_test.go index b74d56b79..bd2b2131f 100644 --- a/x/service/client/cli/tx_add_service_test.go +++ b/x/service/module/tx_add_service_test.go @@ -1,11 +1,11 @@ -package cli_test +package service_test import ( "fmt" "testing" sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/testutil" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" @@ -14,7 +14,7 @@ import ( "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/x/service/client/cli" + service "github.com/pokt-network/poktroll/x/service/module" "github.com/pokt-network/poktroll/x/service/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) @@ -39,7 +39,7 @@ func TestCLI_AddService(t *testing.T) { fmt.Sprintf( "--%s=%s", flags.FlagFees, - sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String(), + sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, math.NewInt(10))).String(), ), } @@ -66,14 +66,15 @@ func TestCLI_AddService(t *testing.T) { fmt.Sprintf("--%s=%s", flags.FlagFrom, account.Address.String()), } args = append(args, commonArgs...) - _, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdAddService(), args) + + _, err := clitestutil.ExecTestCLICmd(ctx, service.CmdAddService(), args) require.NoError(t, err) tests := []struct { desc string supplierAddress string service sharedtypes.Service - err *sdkerrors.Error + expectedErr *sdkerrors.Error }{ { desc: "valid - add new service", @@ -84,50 +85,50 @@ func TestCLI_AddService(t *testing.T) { desc: "invalid - missing service id", supplierAddress: account.Address.String(), service: sharedtypes.Service{Name: "service name"}, // ID intentionally omitted - err: types.ErrServiceMissingID, + expectedErr: types.ErrServiceMissingID, }, { desc: "invalid - missing service name", supplierAddress: account.Address.String(), service: sharedtypes.Service{Id: "svc1"}, // Name intentionally omitted - err: types.ErrServiceMissingName, + expectedErr: types.ErrServiceMissingName, }, { desc: "invalid - invalid supplier address", supplierAddress: "invalid address", service: svc1, - err: types.ErrServiceInvalidAddress, + expectedErr: types.ErrServiceInvalidAddress, }, { desc: "invalid - service already staked", supplierAddress: account.Address.String(), service: svc2, - err: types.ErrServiceAlreadyExists, + expectedErr: types.ErrServiceAlreadyExists, }, } // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { // Wait for a new block to be committed require.NoError(t, net.WaitForNextBlock()) // Prepare the arguments for the CLI command args := []string{ - tt.service.Id, - tt.service.Name, - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.supplierAddress), + test.service.Id, + test.service.Name, + fmt.Sprintf("--%s=%s", flags.FlagFrom, test.supplierAddress), } args = append(args, commonArgs...) // Execute the command - addServiceOutput, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdAddService(), args) + addServiceOutput, err := clitestutil.ExecTestCLICmd(ctx, service.CmdAddService(), args) // Validate the error if one is expected - if tt.err != nil { - stat, ok := status.FromError(tt.err) + if test.expectedErr != nil { + stat, ok := status.FromError(test.expectedErr) require.True(t, ok) - require.Contains(t, stat.Message(), tt.err.Error()) + require.Contains(t, stat.Message(), test.expectedErr.Error()) return } require.NoError(t, err) diff --git a/x/service/simulation/add_service.go b/x/service/simulation/add_service.go index 8462edcd2..d7647d639 100644 --- a/x/service/simulation/add_service.go +++ b/x/service/simulation/add_service.go @@ -1,7 +1,6 @@ package simulation import ( - "fmt" "math/rand" "github.com/cosmos/cosmos-sdk/baseapp" @@ -10,7 +9,6 @@ import ( "github.com/pokt-network/poktroll/x/service/keeper" "github.com/pokt-network/poktroll/x/service/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) func SimulateMsgAddService( @@ -21,17 +19,12 @@ func SimulateMsgAddService( return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { simAccount, _ := simtypes.RandomAcc(r, accs) - rndNum := r.Intn(100) msg := &types.MsgAddService{ Address: simAccount.Address.String(), - Service: sharedtypes.Service{ - Id: fmt.Sprintf("svcId%d", rndNum), - Name: fmt.Sprintf("svcName%d", rndNum), - }, } // TODO: Handling the AddService simulation - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "AddService simulation not implemented"), nil, nil + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "AddService simulation not implemented"), nil, nil } } diff --git a/x/service/types/codec.go b/x/service/types/codec.go index ce02fc85e..76458e731 100644 --- a/x/service/types/codec.go +++ b/x/service/types/codec.go @@ -1,29 +1,20 @@ package types import ( - "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" + // this line is used by starport scaffolding # 1 ) -func RegisterCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgAddService{}, "service/AddService", nil) - // this line is used by starport scaffolding # 2 -} - func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgAddService{}, ) // this line is used by starport scaffolding # 3 - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) - + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateParams{}, + ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) -) diff --git a/x/service/types/errors.go b/x/service/types/errors.go index b7afd2674..cd4ea82b6 100644 --- a/x/service/types/errors.go +++ b/x/service/types/errors.go @@ -1,17 +1,19 @@ package types -import ( - sdkerrors "cosmossdk.io/errors" -) +// DONTCOVER + +import sdkerrors "cosmossdk.io/errors" +// x/service module sentinel errors var ( - ErrServiceDuplicateIndex = sdkerrors.Register(ModuleName, 1, "duplicate index when adding a new service") - ErrServiceInvalidAddress = sdkerrors.Register(ModuleName, 2, "invalid address when adding a new service") - ErrServiceMissingID = sdkerrors.Register(ModuleName, 3, "missing service ID") - ErrServiceMissingName = sdkerrors.Register(ModuleName, 4, "missing service name") - ErrServiceAlreadyExists = sdkerrors.Register(ModuleName, 5, "service already exists") - ErrServiceInvalidServiceFee = sdkerrors.Register(ModuleName, 6, "invalid service fee") - ErrServiceAccountNotFound = sdkerrors.Register(ModuleName, 7, "account not found") - ErrServiceNotEnoughFunds = sdkerrors.Register(ModuleName, 8, "not enough funds to add service") - ErrServiceFailedToDeductFee = sdkerrors.Register(ModuleName, 9, "failed to deduct fee") + ErrServiceInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrServiceDuplicateIndex = sdkerrors.Register(ModuleName, 1101, "duplicate index when adding a new service") + ErrServiceInvalidAddress = sdkerrors.Register(ModuleName, 1102, "invalid address when adding a new service") + ErrServiceMissingID = sdkerrors.Register(ModuleName, 1103, "missing service ID") + ErrServiceMissingName = sdkerrors.Register(ModuleName, 1104, "missing service name") + ErrServiceAlreadyExists = sdkerrors.Register(ModuleName, 1105, "service already exists") + ErrServiceInvalidServiceFee = sdkerrors.Register(ModuleName, 1106, "invalid service fee") + ErrServiceAccountNotFound = sdkerrors.Register(ModuleName, 1107, "account not found") + ErrServiceNotEnoughFunds = sdkerrors.Register(ModuleName, 1108, "not enough funds to add service") + ErrServiceFailedToDeductFee = sdkerrors.Register(ModuleName, 1109, "failed to deduct fee") ) diff --git a/x/service/types/expected_keepers.go b/x/service/types/expected_keepers.go index 37bcd4551..ca6a8da01 100644 --- a/x/service/types/expected_keepers.go +++ b/x/service/types/expected_keepers.go @@ -1,22 +1,26 @@ //go:generate mockgen -destination ../../../testutil/service/mocks/expected_keepers_mock.go -package mocks . BankKeeper + package types import ( + "context" + sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" ) -// AccountKeeper defines the expected account keeper used for simulations (noalias) +// AccountKeeper defines the expected interface for the Account module. type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI + GetAccount(context.Context, sdk.AccAddress) sdk.AccountI // only used for simulation + // Methods imported from account should be defined here } -// BankKeeper defines the expected interface needed to retrieve account -// balances, and send coins from one account to a module's account. +// BankKeeper defines the expected interface for the Bank module. type BankKeeper interface { - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + SpendableCoins(context.Context, sdk.AccAddress) sdk.Coins + // Methods imported from bank should be defined here + SendCoinsFromAccountToModule( - ctx sdk.Context, + ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins, diff --git a/x/service/types/genesis.go b/x/service/types/genesis.go index 06cc3f252..4c324a41f 100644 --- a/x/service/types/genesis.go +++ b/x/service/types/genesis.go @@ -1,11 +1,6 @@ package types -import ( - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 +import sharedtypes "github.com/pokt-network/poktroll/x/shared/types" // DefaultGenesis returns the default genesis state func DefaultGenesis() *GenesisState { @@ -20,19 +15,19 @@ func DefaultGenesis() *GenesisState { // failure. func (gs GenesisState) Validate() error { // Check for duplicated index in services - serviceIDIndexMap := make(map[string]struct{}) - serviceNameIndexMap := make(map[string]struct{}) + serviceIDMap := make(map[string]struct{}) + serviceNameMap := make(map[string]struct{}) for _, service := range gs.ServiceList { - idIndex := string(ServiceKey(service.Id)) - if _, ok := serviceIDIndexMap[idIndex]; ok { + serviceID := string(ServiceKey(service.Id)) + if _, ok := serviceIDMap[serviceID]; ok { return ErrServiceDuplicateIndex.Wrapf("duplicated ID for service: %v", service) } - serviceIDIndexMap[idIndex] = struct{}{} - nameIndex := string(ServiceKey(service.Name)) - if _, ok := serviceNameIndexMap[nameIndex]; ok { + serviceIDMap[serviceID] = struct{}{} + serviceName := string(ServiceKey(service.Name)) + if _, ok := serviceNameMap[serviceName]; ok { return ErrServiceDuplicateIndex.Wrapf("duplicated name for service: %v", service) } - serviceNameIndexMap[nameIndex] = struct{}{} + serviceNameMap[serviceName] = struct{}{} } // this line is used by starport scaffolding # genesis/types/validate diff --git a/x/service/types/genesis_test.go b/x/service/types/genesis_test.go index b51d7dd5b..d6abdd42d 100644 --- a/x/service/types/genesis_test.go +++ b/x/service/types/genesis_test.go @@ -22,18 +22,18 @@ func TestGenesisState_Validate(t *testing.T) { svc3 := &sharedtypes.Service{ Id: "svcId3", - Name: "svcName1", + Name: svc1.Name, } tests := []struct { - desc string - genState *types.GenesisState - expectedError error + desc string + genState *types.GenesisState + expectedErr error }{ { - desc: "default is valid", - genState: types.DefaultGenesis(), - expectedError: nil, + desc: "default is valid", + genState: types.DefaultGenesis(), + expectedErr: nil, }, { desc: "valid genesis state", @@ -44,7 +44,7 @@ func TestGenesisState_Validate(t *testing.T) { }, // this line is used by starport scaffolding # types/genesis/validField }, - expectedError: nil, + expectedErr: nil, }, { desc: "invalid - duplicate service ID", @@ -54,7 +54,7 @@ func TestGenesisState_Validate(t *testing.T) { *svc1, *svc1, }, }, - expectedError: types.ErrServiceDuplicateIndex, + expectedErr: types.ErrServiceDuplicateIndex, }, { desc: "invalid - duplicate service name", @@ -64,7 +64,7 @@ func TestGenesisState_Validate(t *testing.T) { *svc1, *svc3, }, }, - expectedError: types.ErrServiceDuplicateIndex, + expectedErr: types.ErrServiceDuplicateIndex, }, { desc: "invalid - invalid add service fee parameter (below minimum)", @@ -76,18 +76,18 @@ func TestGenesisState_Validate(t *testing.T) { *svc1, *svc2, }, }, - expectedError: types.ErrServiceInvalidServiceFee, + expectedErr: types.ErrServiceInvalidServiceFee, }, // this line is used by starport scaffolding # types/genesis/testcase } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.expectedError == nil { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.genState.Validate() + if test.expectedErr == nil { require.NoError(t, err) } else { - require.ErrorIs(t, err, tc.expectedError) + require.ErrorIs(t, err, test.expectedErr) } }) } diff --git a/x/service/types/key_service.go b/x/service/types/key_service.go index 6893f7e29..168955896 100644 --- a/x/service/types/key_service.go +++ b/x/service/types/key_service.go @@ -1,14 +1,12 @@ package types -import ( - "encoding/binary" -) +import "encoding/binary" var _ binary.ByteOrder const ( - // ServiceKeyPrefix is the prefix to retrieve all Services - ServiceKeyPrefix = "Service/value/" + // ServiceKeyPrefix is the prefix to retrieve all Service + ServiceKeyPrefix = "Service/id/" ) // ServiceKey returns the store key to retrieve a Service from the index fields diff --git a/x/service/types/keys.go b/x/service/types/keys.go index f84e13d4e..0025cbba8 100644 --- a/x/service/types/keys.go +++ b/x/service/types/keys.go @@ -1,7 +1,5 @@ package types -import "bytes" - const ( // ModuleName defines the module name ModuleName = "service" @@ -9,22 +7,10 @@ const ( // StoreKey defines the primary module store key StoreKey = ModuleName - // RouterKey defines the module's message routing key - RouterKey = ModuleName - // MemStoreKey defines the in-memory store key MemStoreKey = "mem_service" ) -// KeyDelimiter is the delimiter for composite keys. -var KeyDelimiter = []byte("/") - -// KeyPrefix returns the given prefix as a byte slice for use with the KVStore. -func KeyPrefix(p string) []byte { - return []byte(p) -} +var ParamsKey = []byte("p_service") -// KeyComposite combines the given keys into a single key for use with KVStore. -func KeyComposite(keys ...[]byte) []byte { - return bytes.Join(keys, KeyDelimiter) -} +func KeyPrefix(p string) []byte { return []byte(p) } diff --git a/x/service/types/message_add_service.go b/x/service/types/message_add_service.go index b904d2767..eaed93489 100644 --- a/x/service/types/message_add_service.go +++ b/x/service/types/message_add_service.go @@ -3,53 +3,25 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + "github.com/pokt-network/poktroll/x/shared/types" ) -// TypeMsgAddService is the name of the service message -const TypeMsgAddService = "add_service" - var _ sdk.Msg = (*MsgAddService)(nil) -// NewMsgAddService creates a new MsgAddService instance -func NewMsgAddService(address string, serviceID, serviceName string) *MsgAddService { +func NewMsgAddService(address, serviceId, serviceName string) *MsgAddService { return &MsgAddService{ Address: address, - Service: sharedtypes.Service{Id: serviceID, Name: serviceName}, - } -} - -// Route returns the roter key for the message -func (msg *MsgAddService) Route() string { - return RouterKey -} - -// Type returns the message type -func (msg *MsgAddService) Type() string { - return TypeMsgAddService -} - -// GetSigners returns the signers of the message -func (msg *MsgAddService) GetSigners() []sdk.AccAddress { - address, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - panic(err) + Service: types.Service{ + Id: serviceId, + Name: serviceName, + }, } - return []sdk.AccAddress{address} -} - -// GetSignBytes returns the signable bytes of the message -func (msg *MsgAddService) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) } // ValidateBasic performs basic validation of the message and its fields func (msg *MsgAddService) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Address); err != nil { - return ErrServiceInvalidAddress.Wrapf( - "invalid supplier address %s; (%v)", msg.Address, err, - ) + return ErrServiceInvalidAddress.Wrapf("invalid supplier address %s; (%v)", msg.Address, err) } // TODO_TECHDEBT: Add a validate basic function to the `Service` object if msg.Service.Id == "" { diff --git a/x/service/types/message_add_service_test.go b/x/service/types/message_add_service_test.go index dfcc674e0..05fd283c1 100644 --- a/x/service/types/message_add_service_test.go +++ b/x/service/types/message_add_service_test.go @@ -45,11 +45,11 @@ func TestMsgAddService_ValidateBasic(t *testing.T) { expectedErr: nil, }, } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.expectedErr != nil { - require.ErrorIs(t, err, tt.expectedErr) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.msg.ValidateBasic() + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) return } require.NoError(t, err) diff --git a/x/service/types/message_update_params.go b/x/service/types/message_update_params.go new file mode 100644 index 000000000..aeed4a633 --- /dev/null +++ b/x/service/types/message_update_params.go @@ -0,0 +1,21 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = (*MsgUpdateParams)(nil) + +// ValidateBasic does a sanity check on the provided data. +func (m *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrap(err, "invalid authority address") + } + + if err := m.Params.Validate(); err != nil { + return err + } + + return nil +} diff --git a/x/service/types/params.go b/x/service/types/params.go index 2b5e999cc..fd0b612ad 100644 --- a/x/service/types/params.go +++ b/x/service/types/params.go @@ -1,9 +1,10 @@ package types import ( + "fmt" + sdkerrors "cosmossdk.io/errors" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "gopkg.in/yaml.v2" ) // DefaultAddServiceFee is the default value for the add service fee @@ -11,7 +12,11 @@ import ( // TODO_BLOCKER: Revisit default param values for service fee const DefaultAddServiceFee = 1000000000 // 1000 POKT -var _ paramtypes.ParamSet = (*Params)(nil) +var ( + _ paramtypes.ParamSet = (*Params)(nil) + + KeyAddServiceFee = []byte("AddServiceFee") +) // ParamKeyTable the param key table for launch module func ParamKeyTable() paramtypes.KeyTable { @@ -19,18 +24,24 @@ func ParamKeyTable() paramtypes.KeyTable { } // NewParams creates a new Params instance -func NewParams() Params { - return Params{AddServiceFee: DefaultAddServiceFee} +func NewParams(addServiceFee uint64) Params { + return Params{ + AddServiceFee: addServiceFee, + } } // DefaultParams returns a default set of parameters func DefaultParams() Params { - return NewParams() + return NewParams( + DefaultAddServiceFee, + ) } // ParamSetPairs get the params.ParamSet func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyAddServiceFee, &p.AddServiceFee, validateAddServiceFee), + } } // Validate validates the set of params @@ -47,8 +58,15 @@ func (p Params) Validate() error { return nil } -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) +// validateAddServiceFee validates the AddServiceFee param +func validateAddServiceFee(v interface{}) error { + addServiceFee, ok := v.(uint64) + if !ok { + return fmt.Errorf("invalid parameter type: %T", v) + } + + // TODO_BLOCKER: implement validation + _ = addServiceFee + + return nil } diff --git a/x/service/types/relay.go b/x/service/types/relay.go deleted file mode 100644 index 7815fc1ab..000000000 --- a/x/service/types/relay.go +++ /dev/null @@ -1,57 +0,0 @@ -package types - -import "crypto/sha256" - -// getSignableBytes returns the bytes resulting from marshaling the relay request -// A value receiver is used to avoid overwriting any pre-existing signature -func (req RelayRequest) getSignableBytes() ([]byte, error) { - // set signature to nil - req.Meta.Signature = nil - - return req.Marshal() -} - -// GetSignableBytesHash returns the hash of the signable bytes of the relay request -// Hashing the marshaled request message guarantees that the signable bytes are -// always of a constant and expected length. -func (req *RelayRequest) GetSignableBytesHash() ([32]byte, error) { - requestBz, err := req.getSignableBytes() - if err != nil { - return [32]byte{}, err - } - - // return the marshaled request hash to guarantee that the signable bytes are - // always of a constant and expected length - return sha256.Sum256(requestBz), nil -} - -// getSignableBytes returns the bytes resulting from marshaling the relay response -// A value receiver is used to avoid overwriting any pre-existing signature -func (res RelayResponse) getSignableBytes() ([]byte, error) { - // set signature to nil - res.Meta.SupplierSignature = nil - - return res.Marshal() -} - -// GetSignableBytesHash returns the hash of the signable bytes of the relay response -// Hashing the marshaled response message guarantees that the signable bytes are -// always of a constant and expected length. -func (res *RelayResponse) GetSignableBytesHash() ([32]byte, error) { - responseBz, err := res.getSignableBytes() - if err != nil { - return [32]byte{}, err - } - - // return the marshaled response hash to guarantee that the signable bytes are - // always of a constant and expected length - return sha256.Sum256(responseBz), nil -} - -func (res *RelayResponse) ValidateBasic() error { - // TODO_FUTURE: if a client gets a response with an invalid/incomplete - // SessionHeader, consider sending an on-chain challenge, lowering their - // QoS, or other future work. - - return nil -} diff --git a/x/service/types/types.go b/x/service/types/types.go index ab1254f4c..78d9ec9f9 100644 --- a/x/service/types/types.go +++ b/x/service/types/types.go @@ -1 +1,3 @@ package types + +// This file is in place to declare the package for dynamically generated protobufs diff --git a/x/session/client/cli/helpers_test.go b/x/session/client/cli/helpers_test.go deleted file mode 100644 index 484bca4db..000000000 --- a/x/session/client/cli/helpers_test.go +++ /dev/null @@ -1,44 +0,0 @@ -// Package cli_test provides unit tests for the CLI functionality. -package cli_test - -import ( - "strconv" - "testing" - - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" - "github.com/pokt-network/poktroll/testutil/network" - apptypes "github.com/pokt-network/poktroll/x/application/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" - "github.com/stretchr/testify/require" -) - -// Dummy variable to avoid unused import error. -var _ = strconv.IntSize - -// init initializes the SDK configuration. -func init() { - cmd.InitSDKConfig() -} - -// networkWithApplicationsAndSupplier creates a new network with a given number of supplier & application objects. -// It returns the network and a slice of the created supplier & application objects. -func networkWithApplicationsAndSupplier(t *testing.T, n int) (*network.Network, []sharedtypes.Supplier, []apptypes.Application) { - t.Helper() - cfg := network.DefaultConfig() - - // Prepare the application genesis state - applicationGenesisState := network.DefaultApplicationModuleGenesisState(t, n) - buf, err := cfg.Codec.MarshalJSON(applicationGenesisState) - require.NoError(t, err) - cfg.GenesisState[apptypes.ModuleName] = buf - - // Prepare the supplier genesis state - supplierGenesisState := network.DefaultSupplierModuleGenesisState(t, n) - buf, err = cfg.Codec.MarshalJSON(supplierGenesisState) - require.NoError(t, err) - cfg.GenesisState[suppliertypes.ModuleName] = buf - - // Start the network - return network.New(t, cfg), supplierGenesisState.SupplierList, applicationGenesisState.ApplicationList -} diff --git a/x/session/client/cli/query.go b/x/session/client/cli/query.go deleted file mode 100644 index cd6bf6f70..000000000 --- a/x/session/client/cli/query.go +++ /dev/null @@ -1,33 +0,0 @@ -package cli - -import ( - "fmt" - // "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/session/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - // Group session queries under a subcommand - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdQueryParams()) - cmd.AddCommand(CmdGetSession()) - - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/session/client/cli/query_get_session.go b/x/session/client/cli/query_get_session.go deleted file mode 100644 index 9659ce331..000000000 --- a/x/session/client/cli/query_get_session.go +++ /dev/null @@ -1,65 +0,0 @@ -package cli - -import ( - "fmt" - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/session/types" -) - -var _ = strconv.Itoa(0) - -func CmdGetSession() *cobra.Command { - cmd := &cobra.Command{ - Use: "get-session [block_height]", - Short: "Query get-session", - Long: `Query the session data for a specific (app, service, height) tuple. - -[block_height] is optional. If unspecified, or set to 0, it defaults to the latest height of the node being queried. - -This is a query operation that will not result in a state transition but simply gives a view into the chain state. - -Example: -$ poktrolld --home=$(POKTROLLD_HOME) q session get-session pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4 svc1 42 --node $(POCKET_NODE)`, - Args: cobra.RangeArgs(2, 3), - RunE: func(cmd *cobra.Command, args []string) (err error) { - appAddressString := args[0] - serviceIdString := args[1] - blockHeightString := "0" // 0 will default to latest height - if len(args) == 3 { - blockHeightString = args[2] - } - - blockHeight, err := strconv.ParseInt(blockHeightString, 10, 64) - if err != nil { - return fmt.Errorf("couldn't convert block height to int: %s; (%v)", blockHeightString, err) - } - - getSessionReq := types.NewQueryGetSessionRequest(appAddressString, serviceIdString, blockHeight) - if err := getSessionReq.ValidateBasic(); err != nil { - return err - } - - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - - getSessionRes, err := queryClient.GetSession(cmd.Context(), getSessionReq) - if err != nil { - return err - } - - return clientCtx.PrintProto(getSessionRes) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/session/client/cli/query_get_session_test.go b/x/session/client/cli/query_get_session_test.go deleted file mode 100644 index 480bafa48..000000000 --- a/x/session/client/cli/query_get_session_test.go +++ /dev/null @@ -1,197 +0,0 @@ -package cli_test - -import ( - "fmt" - "testing" - - sdkerrors "cosmossdk.io/errors" - tmcli "github.com/cometbft/cometbft/libs/cli" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - "github.com/gogo/status" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/x/session/client/cli" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" -) - -func TestCLI_GetSession(t *testing.T) { - // Prepare the network - net, suppliers, applications := networkWithApplicationsAndSupplier(t, 2) - _, err := net.WaitForHeight(10) // Wait for a sufficiently high block height to ensure the staking transactions have been processed - require.NoError(t, err) - val := net.Validators[0] - ctx := val.ClientCtx - - // Sanity check the application configs are what we expect them to be - appSvc0 := applications[0] - appSvc1 := applications[1] - - require.Len(t, appSvc0.ServiceConfigs, 2) - require.Len(t, appSvc1.ServiceConfigs, 2) - - require.Equal(t, appSvc0.ServiceConfigs[0].Service.Id, "svc0") // svc0 has a supplier - require.Equal(t, appSvc0.ServiceConfigs[1].Service.Id, "svc00") // svc00 doesn't have a supplier - require.Equal(t, appSvc1.ServiceConfigs[0].Service.Id, "svc1") // svc1 has a supplier - require.Equal(t, appSvc1.ServiceConfigs[1].Service.Id, "svc11") // svc11 doesn't have a supplier - - // Sanity check the supplier configs are what we expect them to be - supplierSvc0 := suppliers[0] // supplier for svc0 - supplierSvc1 := suppliers[1] // supplier for svc1 - - require.Len(t, supplierSvc0.Services, 1) - require.Len(t, supplierSvc1.Services, 1) - - require.Equal(t, supplierSvc0.Services[0].Service.Id, "svc0") - require.Equal(t, supplierSvc1.Services[0].Service.Id, "svc1") - - // Prepare the test cases - tests := []struct { - desc string - - appAddress string - serviceId string - blockHeight int64 - - expectedErr *sdkerrors.Error - expectedNumSuppliers int - }{ - // Valid requests - { - desc: "valid - block height specified and is zero", - - appAddress: appSvc0.Address, - serviceId: "svc0", - blockHeight: 0, - - expectedErr: nil, - expectedNumSuppliers: 1, - }, - { - desc: "valid - block height specified and is greater than zero", - - appAddress: appSvc1.Address, - serviceId: "svc1", - blockHeight: 10, - - expectedErr: nil, - expectedNumSuppliers: 1, - }, - { - desc: "valid - block height unspecified and defaults to 0", - - appAddress: appSvc0.Address, - serviceId: "svc0", - // blockHeight: intentionally omitted, - - expectedErr: nil, - expectedNumSuppliers: 1, - }, - - // Invalid requests - incompatible state - { - desc: "invalid - app not staked for service", - - appAddress: appSvc0.Address, - serviceId: "svc9001", // appSvc0 is only staked for svc0 (has supplier) and svc00 (doesn't have supplier) and is not staked for service over 9000 - blockHeight: 0, - - expectedErr: sessiontypes.ErrSessionAppNotStakedForService, - }, - { - desc: "invalid - no suppliers staked for service", - - appAddress: appSvc0.Address, // dynamically getting address from applications - serviceId: "svc00", // appSvc0 is only staked for svc0 (has supplier) and svc00 (doesn't have supplier) - blockHeight: 0, - - expectedErr: sessiontypes.ErrSessionSuppliersNotFound, - }, - { - desc: "invalid - block height is in the future", - - appAddress: appSvc0.Address, // dynamically getting address from applications - serviceId: "svc0", - blockHeight: 9001, // block height over 9000 is greater than the context height of 10 - - expectedErr: sessiontypes.ErrSessionInvalidBlockHeight, - }, - - // Invalid requests - bad app address input - { - desc: "invalid - invalid appAddress", - - appAddress: "invalidAddress", // providing a deliberately invalid address - serviceId: "svc0", - blockHeight: 0, - - expectedErr: sessiontypes.ErrSessionInvalidAppAddress, - }, - { - desc: "invalid - missing appAddress", - // appAddress: intentionally omitted - serviceId: "svc0", - blockHeight: 0, - - expectedErr: sessiontypes.ErrSessionInvalidAppAddress, - }, - - // Invalid requests - bad serviceID input - { - desc: "invalid - invalid service ID", - appAddress: appSvc0.Address, // dynamically getting address from applications - serviceId: "invalidServiceId", - blockHeight: 0, - - expectedErr: sessiontypes.ErrSessionInvalidService, - }, - { - desc: "invalid - missing service ID", - appAddress: appSvc0.Address, // dynamically getting address from applications - // serviceId: intentionally omitted - blockHeight: 0, - - expectedErr: sessiontypes.ErrSessionInvalidService, - }, - } - - // We want to use the `--output=json` flag for all tests so it's easy to unmarshal below - common := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - // Prepare the arguments for the CLI command - args := []string{ - tt.appAddress, - tt.serviceId, - fmt.Sprintf("%d", tt.blockHeight), - } - args = append(args, common...) - - // Execute the command - getSessionOut, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdGetSession(), args) - if tt.expectedErr != nil { - stat, ok := status.FromError(tt.expectedErr) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.expectedErr.Error()) - return - } - require.NoError(t, err) - - var getSessionRes sessiontypes.QueryGetSessionResponse - err = net.Config.Codec.UnmarshalJSON(getSessionOut.Bytes(), &getSessionRes) - require.NoError(t, err) - require.NotNil(t, getSessionRes) - - session := getSessionRes.Session - require.NotNil(t, session) - - // Verify some data about the session - require.Equal(t, tt.appAddress, session.Application.Address) - require.Equal(t, tt.serviceId, session.Header.Service.Id) - require.Len(t, session.Suppliers, tt.expectedNumSuppliers) - }) - } -} diff --git a/x/session/client/cli/query_params.go b/x/session/client/cli/query_params.go deleted file mode 100644 index 5f8aa0609..000000000 --- a/x/session/client/cli/query_params.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/session/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - 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.Params(cmd.Context(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/session/client/cli/tx.go b/x/session/client/cli/tx.go deleted file mode 100644 index 248ae5237..000000000 --- a/x/session/client/cli/tx.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "fmt" - "time" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/pokt-network/poktroll/x/session/types" -) - -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/session/genesis.go b/x/session/genesis.go deleted file mode 100644 index a14b12f31..000000000 --- a/x/session/genesis.go +++ /dev/null @@ -1,24 +0,0 @@ -package session - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/session/keeper" - "github.com/pokt-network/poktroll/x/session/types" -) - -// InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) -} - -// ExportGenesis returns the module's exported genesis -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) - - // this line is used by starport scaffolding # genesis/module/export - - return genesis -} diff --git a/x/session/genesis_test.go b/x/session/genesis_test.go deleted file mode 100644 index 50298ada9..000000000 --- a/x/session/genesis_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package session_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/session" - "github.com/pokt-network/poktroll/x/session/types" -) - -func TestGenesis(t *testing.T) { - genesisState := types.GenesisState{ - Params: types.DefaultParams(), - - // this line is used by starport scaffolding # genesis/test/state - } - - k, ctx := keepertest.SessionKeeper(t) - session.InitGenesis(ctx, *k, genesisState) - got := session.ExportGenesis(ctx, *k) - require.NotNil(t, got) - - nullify.Fill(&genesisState) - nullify.Fill(got) - - // this line is used by starport scaffolding # genesis/test/assert -} diff --git a/x/session/keeper/keeper.go b/x/session/keeper/keeper.go deleted file mode 100644 index 292890964..000000000 --- a/x/session/keeper/keeper.go +++ /dev/null @@ -1,55 +0,0 @@ -package keeper - -import ( - "fmt" - - "github.com/cometbft/cometbft/libs/log" - "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - "github.com/pokt-network/poktroll/x/session/types" -) - -type ( - Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace - - appKeeper types.ApplicationKeeper - supplierKeeper types.SupplierKeeper - } -) - -func NewKeeper( - cdc codec.BinaryCodec, - storeKey, - memKey storetypes.StoreKey, - ps paramtypes.Subspace, - - appKeeper types.ApplicationKeeper, - supplierKeeper types.SupplierKeeper, - -) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } - - return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramstore: ps, - - appKeeper: appKeeper, - supplierKeeper: supplierKeeper, - } -} - -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} diff --git a/x/session/keeper/msg_server.go b/x/session/keeper/msg_server.go deleted file mode 100644 index 6dbe55462..000000000 --- a/x/session/keeper/msg_server.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/session/types" -) - -type msgServer struct { - Keeper -} - -// NewMsgServerImpl returns an implementation of the MsgServer interface -// for the provided Keeper. -func NewMsgServerImpl(keeper Keeper) types.MsgServer { - return &msgServer{Keeper: keeper} -} - -var _ types.MsgServer = msgServer{} diff --git a/x/session/keeper/msg_server_test.go b/x/session/keeper/msg_server_test.go deleted file mode 100644 index b00a56aba..000000000 --- a/x/session/keeper/msg_server_test.go +++ /dev/null @@ -1,24 +0,0 @@ -package keeper_test - -import ( - "context" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/session/keeper" - "github.com/pokt-network/poktroll/x/session/types" -) - -func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { - k, ctx := keepertest.SessionKeeper(t) - return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx) -} - -func TestMsgServer(t *testing.T) { - ms, ctx := setupMsgServer(t) - require.NotNil(t, ms) - require.NotNil(t, ctx) -} diff --git a/x/session/keeper/params.go b/x/session/keeper/params.go deleted file mode 100644 index 142887657..000000000 --- a/x/session/keeper/params.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/session/types" -) - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() -} - -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} diff --git a/x/session/keeper/params_test.go b/x/session/keeper/params_test.go deleted file mode 100644 index bf020e294..000000000 --- a/x/session/keeper/params_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/session/types" -) - -func TestGetParams(t *testing.T) { - k, ctx := testkeeper.SessionKeeper(t) - params := types.DefaultParams() - - k.SetParams(ctx, params) - - require.EqualValues(t, params, k.GetParams(ctx)) -} diff --git a/x/session/keeper/query.go b/x/session/keeper/query.go deleted file mode 100644 index 700ec87e8..000000000 --- a/x/session/keeper/query.go +++ /dev/null @@ -1,7 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/session/types" -) - -var _ types.QueryServer = Keeper{} diff --git a/x/session/keeper/query_get_session.go b/x/session/keeper/query_get_session.go deleted file mode 100644 index e2d4681af..000000000 --- a/x/session/keeper/query_get_session.go +++ /dev/null @@ -1,45 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/session/types" -) - -func (k Keeper) GetSession(goCtx context.Context, req *types.QueryGetSessionRequest) (*types.QueryGetSessionResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - if err := req.ValidateBasic(); err != nil { - return nil, err - } - - ctx := sdk.UnwrapSDKContext(goCtx) - - // If block height is not specified, use the current (context's latest) block height - // Note that `GetSession` is called via the `Query` service rather than the `Msg` server. - // The former is stateful but does not lead to state transitions, while the latter one - // does. The request height depends on how much the node has synched and only acts as a read, - // while the `Msg` server handles the code flow of the validator/sequencer when a new block - // is being proposed. - blockHeight := req.BlockHeight - if blockHeight == 0 { - blockHeight = ctx.BlockHeight() - } - - sessionHydrator := NewSessionHydrator(req.ApplicationAddress, req.Service.Id, blockHeight) - session, err := k.HydrateSession(ctx, sessionHydrator) - if err != nil { - return nil, err - } - - res := &types.QueryGetSessionResponse{ - Session: session, - } - return res, nil -} diff --git a/x/session/keeper/query_get_session_test.go b/x/session/keeper/query_get_session_test.go deleted file mode 100644 index a8b8ecedb..000000000 --- a/x/session/keeper/query_get_session_test.go +++ /dev/null @@ -1,167 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func init() { - cmd.InitSDKConfig() -} - -// NOTE: See `session_hydrator_test.go` for more extensive test coverage of different -// GetSession scenarios. This is just used to verify a few basic scenarios that act as -// the Cosmos SDK context aware wrapper around it. - -func TestSession_GetSession_Success(t *testing.T) { - keeper, ctx := keepertest.SessionKeeper(t) - ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors - wctx := sdk.WrapSDKContext(ctx) - - type test struct { - name string - - appAddr string - serviceId string - blockHeight int64 - - expectedSessionId string - expectedSessionNumber int64 - expectedNumSuppliers int - } - - tests := []test{ - { - name: "valid - app1 svc1 at height=1", - - appAddr: keepertest.TestApp1Address, - serviceId: keepertest.TestServiceId1, - blockHeight: 1, - - // Intentionally only checking a subset of the session metadata returned - expectedSessionId: "cf5bbdce56ee5a7c46c5d5482303907685a7e5dbb22703cd4a85df521b9ab6e9", - expectedSessionNumber: 0, - expectedNumSuppliers: 1, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - req := &types.QueryGetSessionRequest{ - ApplicationAddress: tt.appAddr, - Service: &sharedtypes.Service{ - Id: tt.serviceId, - }, - BlockHeight: 1, - } - - response, err := keeper.GetSession(wctx, req) - require.NoError(t, err) - require.NotNil(t, response) - - require.Equal(t, tt.expectedSessionId, response.Session.SessionId) - require.Equal(t, tt.expectedSessionNumber, response.Session.SessionNumber) - require.Len(t, response.Session.Suppliers, tt.expectedNumSuppliers) - }) - } -} - -func TestSession_GetSession_Failure(t *testing.T) { - keeper, ctx := keepertest.SessionKeeper(t) - ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors - wctx := sdk.WrapSDKContext(ctx) - - type test struct { - name string - - appAddr string - serviceId string - blockHeight int64 - - expectedErrContains string - } - - tests := []test{ - { - name: "application address does not reflected a staked application", - - appAddr: sample.AccAddress(), // a random (valid) app address that's not staked - serviceId: keepertest.TestServiceId1, - blockHeight: 1, - - expectedErrContains: types.ErrSessionAppNotFound.Error(), - }, - { - name: "application staked for service that has no available suppliers", - - appAddr: keepertest.TestApp1Address, - serviceId: keepertest.TestServiceId11, - blockHeight: 1, - - expectedErrContains: types.ErrSessionSuppliersNotFound.Error(), - }, - { - name: "application is valid but not staked for the specified service", - - appAddr: keepertest.TestApp1Address, - serviceId: "svc9001", // App1 is not staked for service over 9000 - blockHeight: 1, - - expectedErrContains: types.ErrSessionAppNotStakedForService.Error(), - }, - { - name: "application address is invalid format", - - appAddr: "invalid_app_address", - serviceId: keepertest.TestServiceId1, - blockHeight: 1, - - expectedErrContains: types.ErrSessionInvalidAppAddress.Error(), - }, - { - name: "service ID is invalid", - - appAddr: keepertest.TestApp1Address, - serviceId: "service_id_is_too_long_to_be_valid", - blockHeight: 1, - - expectedErrContains: "invalid service in session", - }, - { - name: "negative block height", - - appAddr: keepertest.TestApp1Address, - serviceId: keepertest.TestServiceId1, - blockHeight: -1, - - expectedErrContains: "invalid block height for session being retrieved", - }, - } - - expectedRes := (*types.QueryGetSessionResponse)(nil) - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - req := &types.QueryGetSessionRequest{ - ApplicationAddress: tt.appAddr, - Service: &sharedtypes.Service{ - Id: tt.serviceId, - }, - BlockHeight: tt.blockHeight, - } - - res, err := keeper.GetSession(wctx, req) - require.Error(t, err) - require.Contains(t, err.Error(), tt.expectedErrContains) - require.Equal(t, expectedRes, res) - }) - } -} diff --git a/x/session/keeper/query_params.go b/x/session/keeper/query_params.go deleted file mode 100644 index 75734ad7a..000000000 --- a/x/session/keeper/query_params.go +++ /dev/null @@ -1,20 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/session/types" -) - -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil -} diff --git a/x/session/keeper/query_params_test.go b/x/session/keeper/query_params_test.go deleted file mode 100644 index 85f0ddd9b..000000000 --- a/x/session/keeper/query_params_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/session/types" -) - -func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.SessionKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - params := types.DefaultParams() - keeper.SetParams(ctx, params) - - response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) - require.NoError(t, err) - require.Equal(t, &types.QueryParamsResponse{Params: params}, response) -} diff --git a/x/session/keeper/session_hydrator.go b/x/session/keeper/session_hydrator.go deleted file mode 100644 index cae92e6c9..000000000 --- a/x/session/keeper/session_hydrator.go +++ /dev/null @@ -1,265 +0,0 @@ -package keeper - -import ( - "crypto" - "encoding/binary" - "encoding/hex" - "fmt" - "math/rand" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - _ "golang.org/x/crypto/sha3" - - "github.com/pokt-network/poktroll/x/session/types" - sharedhelpers "github.com/pokt-network/poktroll/x/shared/helpers" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -var SHA3HashLen = crypto.SHA3_256.Size() - -// TODO(#21): Make these configurable governance param -const ( - NumBlocksPerSession = 4 - NumSupplierPerSession = 15 - SessionIDComponentDelimiter = "." -) - -type sessionHydrator struct { - // The session header that is used to hydrate the rest of the session data - sessionHeader *types.SessionHeader - - // The fully hydrated session object - session *types.Session - - // The height at which the session being request - blockHeight int64 - - // A redundant helper that maintains a hex decoded copy of `session.Id` used for session hydration - sessionIdBz []byte -} - -func NewSessionHydrator( - appAddress string, - serviceId string, - blockHeight int64, -) *sessionHydrator { - sessionHeader := &types.SessionHeader{ - ApplicationAddress: appAddress, - Service: &sharedtypes.Service{Id: serviceId}, - } - return &sessionHydrator{ - sessionHeader: sessionHeader, - session: &types.Session{}, - blockHeight: blockHeight, - sessionIdBz: make([]byte, 0), - } -} - -// GetSession implements of the exposed `UtilityModule.GetSession` function -// TECHDEBT(#519): Add custom error types depending on the type of issue that occurred and assert on them in the unit tests. -func (k Keeper) HydrateSession(ctx sdk.Context, sh *sessionHydrator) (*types.Session, error) { - logger := k.Logger(ctx).With("method", "hydrateSession") - - if err := k.hydrateSessionMetadata(ctx, sh); err != nil { - return nil, sdkerrors.Wrapf(types.ErrSessionHydration, "failed to hydrate the session metadata: %v", err) - } - logger.Debug("Finished hydrating session metadata") - - if err := k.hydrateSessionID(ctx, sh); err != nil { - return nil, sdkerrors.Wrapf(types.ErrSessionHydration, "failed to hydrate the session ID: %v", err) - } - logger.Info(fmt.Sprintf("Finished hydrating session ID: %s", sh.sessionHeader.SessionId)) - - if err := k.hydrateSessionApplication(ctx, sh); err != nil { - return nil, sdkerrors.Wrapf(types.ErrSessionHydration, "failed to hydrate application for session: %v", err) - } - logger.Debug("Finished hydrating session application: %+v", sh.session.Application) - - if err := k.hydrateSessionSuppliers(ctx, sh); err != nil { - return nil, sdkerrors.Wrapf(types.ErrSessionHydration, "failed to hydrate suppliers for session: %v", err) - } - logger.Debug("Finished hydrating session suppliers: %+v") - - sh.session.Header = sh.sessionHeader - sh.session.SessionId = sh.sessionHeader.SessionId - - return sh.session, nil -} - -// hydrateSessionMetadata hydrates metadata related to the session such as the height at which the session started, its number, the number of blocks per session, etc.. -func (k Keeper) hydrateSessionMetadata(ctx sdk.Context, sh *sessionHydrator) error { - // TODO_TECHDEBT: Add a test if `blockHeight` is ahead of the current chain or what this node is aware of - - if sh.blockHeight > ctx.BlockHeight() { - return sdkerrors.Wrapf(types.ErrSessionHydration, "block height %d is ahead of the current block height %d", sh.blockHeight, ctx.BlockHeight()) - } - - sh.session.NumBlocksPerSession = NumBlocksPerSession - sh.session.SessionNumber = sh.blockHeight / NumBlocksPerSession - - // TODO_BLOCKER: SessionStartBlockHeight should be aligned to NumBlocksPerSession. - sh.sessionHeader.SessionStartBlockHeight = sh.blockHeight - (sh.blockHeight % NumBlocksPerSession) - sh.sessionHeader.SessionEndBlockHeight = sh.sessionHeader.SessionStartBlockHeight + NumBlocksPerSession - return nil -} - -// hydrateSessionID use both session and on-chain data to determine a unique session ID -func (k Keeper) hydrateSessionID(ctx sdk.Context, sh *sessionHydrator) error { - // TODO_BLOCKER: Need to retrieve the block hash at SessionStartBlockHeight, but this requires - // a bit of work and the `ctx` only gives access to the current block/header. See this thread - // for more details: https://github.com/pokt-network/poktroll/pull/78/files#r1369215667 - // prevHashBz := ctx.HeaderHash() - prevHash := "TODO_BLOCKER: See the comment above" - - // TODO_TECHDEBT: In the future, we will need to valid that the Service is a valid service depending on whether - // or not its permissioned or permissionless - - if !sharedhelpers.IsValidService(sh.sessionHeader.Service) { - return sdkerrors.Wrapf(types.ErrSessionHydration, "invalid service: %v", sh.sessionHeader.Service) - } - - sh.sessionHeader.SessionId, sh.sessionIdBz = GetSessionId( - sh.sessionHeader.ApplicationAddress, - sh.sessionHeader.Service.Id, - prevHash, - sh.sessionHeader.SessionStartBlockHeight, - ) - - return nil -} - -// hydrateSessionApplication hydrates the full Application actor based on the address provided -func (k Keeper) hydrateSessionApplication(ctx sdk.Context, sh *sessionHydrator) error { - app, appIsFound := k.appKeeper.GetApplication(ctx, sh.sessionHeader.ApplicationAddress) - if !appIsFound { - return sdkerrors.Wrapf(types.ErrSessionAppNotFound, "could not find app with address: %s at height %d", sh.sessionHeader.ApplicationAddress, sh.sessionHeader.SessionStartBlockHeight) - } - - for _, appServiceConfig := range app.ServiceConfigs { - if appServiceConfig.Service.Id == sh.sessionHeader.Service.Id { - sh.session.Application = &app - return nil - } - } - - return sdkerrors.Wrapf(types.ErrSessionAppNotStakedForService, "application %s not staked for service %s", sh.sessionHeader.ApplicationAddress, sh.sessionHeader.Service.Id) -} - -// hydrateSessionSuppliers finds the suppliers that are staked at the session height and populates the session with them -func (k Keeper) hydrateSessionSuppliers(ctx sdk.Context, sh *sessionHydrator) error { - logger := k.Logger(ctx).With("method", "hydrateSessionSuppliers") - - // TODO_TECHDEBT(@Olshansk, @bryanchriswhite): Need to retrieve the suppliers at SessionStartBlockHeight, - // NOT THE CURRENT ONE which is what's provided by the context. For now, for simplicity, - // only retrieving the suppliers at the current block height which could create a discrepancy - // if new suppliers were staked mid session. - // TODO(@bryanchriswhite): Investigate if `BlockClient` + `ReplayObservable` where `N = SessionLength` could be used here.` - suppliers := k.supplierKeeper.GetAllSupplier(ctx) - - candidateSuppliers := make([]*sharedtypes.Supplier, 0) - for _, s := range suppliers { - // NB: Allocate a new heap variable as s is a value and we're appending - // to a slice of pointers; otherwise, we'd be appending new pointers to - // the same memory address containing the last supplier in the loop. - supplier := s - // TODO_OPTIMIZE: If `supplier.Services` was a map[string]struct{}, we could eliminate `slices.Contains()`'s loop - for _, supplierServiceConfig := range supplier.Services { - if supplierServiceConfig.Service.Id == sh.sessionHeader.Service.Id { - candidateSuppliers = append(candidateSuppliers, &supplier) - break - } - } - } - - if len(candidateSuppliers) == 0 { - logger.Error(fmt.Sprintf("[ERROR] no suppliers found for session")) - return sdkerrors.Wrapf(types.ErrSessionSuppliersNotFound, "could not find suppliers for service %s at height %d", sh.sessionHeader.Service, sh.sessionHeader.SessionStartBlockHeight) - } - - if len(candidateSuppliers) < NumSupplierPerSession { - logger.Info(fmt.Sprintf("[WARN] number of available suppliers (%d) is less than the number of suppliers per session (%d)", len(candidateSuppliers), NumSupplierPerSession)) - sh.session.Suppliers = candidateSuppliers - } else { - sh.session.Suppliers = pseudoRandomSelection(candidateSuppliers, NumSupplierPerSession, sh.sessionIdBz) - } - - return nil -} - -// TODO_INVESTIGATE: We are using a `Go` native implementation for a pseudo-random number generator. In order -// for it to be language agnostic, a general purpose algorithm MUST be used. -// pseudoRandomSelection returns a random subset of the candidates. -func pseudoRandomSelection(candidates []*sharedtypes.Supplier, numTarget int, sessionIdBz []byte) []*sharedtypes.Supplier { - // Take the first 8 bytes of sessionId to use as the seed - // NB: There is specific reason why `BigEndian` was chosen over `LittleEndian` in this specific context. - seed := int64(binary.BigEndian.Uint64(sha3Hash(sessionIdBz)[:8])) - - // Retrieve the indices for the candidates - actors := make([]*sharedtypes.Supplier, 0) - uniqueIndices := uniqueRandomIndices(seed, int64(len(candidates)), int64(numTarget)) - for idx := range uniqueIndices { - actors = append(actors, candidates[idx]) - } - - return actors -} - -// uniqueRandomIndices returns a map of `numIndices` unique random numbers less than `maxIndex` -// seeded by `seed`. -// panics if `numIndicies > maxIndex` since that code path SHOULD never be executed. -// NB: A map pointing to empty structs is used to simulate set behavior. -func uniqueRandomIndices(seed, maxIndex, numIndices int64) map[int64]struct{} { - // This should never happen - if numIndices > maxIndex { - panic(fmt.Sprintf("uniqueRandomIndices: numIndices (%d) is greater than maxIndex (%d)", numIndices, maxIndex)) - } - - // create a new random source with the seed - randSrc := rand.NewSource(seed) - - // initialize a map to capture the indicesMap we'll return - indicesMap := make(map[int64]struct{}, maxIndex) - - // The random source could potentially return duplicates, so while loop until we have enough unique indices - for int64(len(indicesMap)) < numIndices { - indicesMap[randSrc.Int63()%int64(maxIndex)] = struct{}{} - } - - return indicesMap -} - -func concatWithDelimiter(delimiter string, b ...[]byte) (result []byte) { - for _, bz := range b { - result = append(result, bz...) - result = append(result, []byte(delimiter)...) - } - return result -} - -func sha3Hash(bz []byte) []byte { - hasher := crypto.SHA3_256.New() - hasher.Write(bz) - return hasher.Sum(nil) -} - -// GetSessionId returns the string and bytes representation of the sessionId -// given the application public key, service ID, block hash, and block height. -func GetSessionId( - appPubKey, - serviceId, - blockHash string, - blockHeight int64, -) (sessionId string, sessionIdBz []byte) { - appPubKeyBz := []byte(appPubKey) - serviceIdBz := []byte(serviceId) - blockHashBz := []byte(blockHash) - - sessionHeightBz := make([]byte, 8) - binary.LittleEndian.PutUint64(sessionHeightBz, uint64(blockHeight)) - - sessionIdBz = concatWithDelimiter(SessionIDComponentDelimiter, blockHashBz, serviceIdBz, appPubKeyBz, sessionHeightBz) - sessionId = hex.EncodeToString(sha3Hash(sessionIdBz)) - - return sessionId, sessionIdBz -} diff --git a/x/session/keeper/session_hydrator_test.go b/x/session/keeper/session_hydrator_test.go deleted file mode 100644 index 5e72e1151..000000000 --- a/x/session/keeper/session_hydrator_test.go +++ /dev/null @@ -1,356 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/session/keeper" - "github.com/pokt-network/poktroll/x/session/types" -) - -func TestSession_HydrateSession_Success_BaseCase(t *testing.T) { - sessionKeeper, ctx := keepertest.SessionKeeper(t) - ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors - blockHeight := int64(10) - - sessionHydrator := keeper.NewSessionHydrator(keepertest.TestApp1Address, keepertest.TestServiceId1, blockHeight) - session, err := sessionKeeper.HydrateSession(ctx, sessionHydrator) - require.NoError(t, err) - - // Check the header - sessionHeader := session.Header - require.Equal(t, keepertest.TestApp1Address, sessionHeader.ApplicationAddress) - require.Equal(t, keepertest.TestServiceId1, sessionHeader.Service.Id) - require.Equal(t, "", sessionHeader.Service.Name) - require.Equal(t, int64(8), sessionHeader.SessionStartBlockHeight) - require.Equal(t, int64(12), sessionHeader.SessionEndBlockHeight) - require.Equal(t, "5481d5ca2ddb15dc5edb792b8e20ba9c7d516a74475fc5feba6b6aeb95a26f58", sessionHeader.SessionId) - - // Check the session - require.Equal(t, int64(4), session.NumBlocksPerSession) - require.Equal(t, "5481d5ca2ddb15dc5edb792b8e20ba9c7d516a74475fc5feba6b6aeb95a26f58", session.SessionId) - require.Equal(t, int64(2), session.SessionNumber) - - // Check the application - app := session.Application - require.Equal(t, keepertest.TestApp1Address, app.Address) - require.Len(t, app.ServiceConfigs, 3) - - // Check the suppliers - suppliers := session.Suppliers - require.Len(t, suppliers, 1) - supplier := suppliers[0] - require.Equal(t, keepertest.TestSupplierAddress, supplier.Address) - require.Len(t, supplier.Services, 3) -} - -func TestSession_HydrateSession_Metadata(t *testing.T) { - type test struct { - desc string - blockHeight int64 - - expectedNumBlocksPerSession int64 - expectedSessionNumber int64 - expectedSessionStartBlock int64 - expectedSessionEndBlock int64 - errExpected error - } - - // TODO_TECHDEBT: Extend these tests once `NumBlocksPerSession` is configurable. - // Currently assumes NumBlocksPerSession=4 - tests := []test{ - { - desc: "blockHeight = 0", - blockHeight: 0, - - expectedNumBlocksPerSession: 4, - expectedSessionNumber: 0, - expectedSessionStartBlock: 0, - expectedSessionEndBlock: 4, - errExpected: nil, - }, - { - desc: "blockHeight = 1", - blockHeight: 1, - - expectedNumBlocksPerSession: 4, - expectedSessionNumber: 0, - expectedSessionStartBlock: 0, - expectedSessionEndBlock: 4, - errExpected: nil, - }, - { - desc: "blockHeight = sessionHeight", - blockHeight: 4, - - expectedNumBlocksPerSession: 4, - expectedSessionNumber: 1, - expectedSessionStartBlock: 4, - expectedSessionEndBlock: 8, - errExpected: nil, - }, - { - desc: "blockHeight != sessionHeight", - blockHeight: 5, - - expectedNumBlocksPerSession: 4, - expectedSessionNumber: 1, - expectedSessionStartBlock: 4, - expectedSessionEndBlock: 8, - errExpected: nil, - }, - { - desc: "blockHeight > contextHeight", - blockHeight: 9001, // block height over 9000 is too high given that the context height is 100 - - errExpected: types.ErrSessionHydration, - }, - } - - appAddr := keepertest.TestApp1Address - serviceId := keepertest.TestServiceId1 - sessionKeeper, ctx := keepertest.SessionKeeper(t) - ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - sessionHydrator := keeper.NewSessionHydrator(appAddr, serviceId, tt.blockHeight) - session, err := sessionKeeper.HydrateSession(ctx, sessionHydrator) - - if tt.errExpected != nil { - require.ErrorIs(t, tt.errExpected, err) - return - } - require.NoError(t, err) - - require.Equal(t, tt.expectedNumBlocksPerSession, session.NumBlocksPerSession) - require.Equal(t, tt.expectedSessionNumber, session.SessionNumber) - require.Equal(t, tt.expectedSessionStartBlock, session.Header.SessionStartBlockHeight) - require.Equal(t, tt.expectedSessionEndBlock, session.Header.SessionEndBlockHeight) - }) - } -} - -func TestSession_HydrateSession_SessionId(t *testing.T) { - type test struct { - desc string - - blockHeight1 int64 - blockHeight2 int64 - - appAddr1 string - appAddr2 string - - serviceId1 string - serviceId2 string - - expectedSessionId1 string - expectedSessionId2 string - } - - // TODO_TECHDEBT: Extend these tests once `NumBlocksPerSession` is configurable. - // Currently assumes NumBlocksPerSession=4 - tests := []test{ - { - desc: "(app1, svc1): sessionId at first session block != sessionId at next session block", - - blockHeight1: 4, - blockHeight2: 8, - - appAddr1: keepertest.TestApp1Address, // app1 - appAddr2: keepertest.TestApp1Address, // app1 - - serviceId1: keepertest.TestServiceId1, // svc1 - serviceId2: keepertest.TestServiceId1, // svc1 - - expectedSessionId1: "251665c7cf286a30fbd98acd983c63e9a34efc16496511373405e24eb02a8fb9", - expectedSessionId2: "5481d5ca2ddb15dc5edb792b8e20ba9c7d516a74475fc5feba6b6aeb95a26f58", - }, - { - desc: "app1: sessionId for svc1 != sessionId for svc12", - - blockHeight1: 4, - blockHeight2: 4, - - appAddr1: keepertest.TestApp1Address, // app1 - appAddr2: keepertest.TestApp1Address, // app1 - - serviceId1: keepertest.TestServiceId1, // svc1 - serviceId2: keepertest.TestServiceId12, // svc12 - - expectedSessionId1: "251665c7cf286a30fbd98acd983c63e9a34efc16496511373405e24eb02a8fb9", - expectedSessionId2: "44fce80205bece269429a5dc8b55f9d96e5bf7acdb9838f2ac9aa7216905a1cf", - }, - { - desc: "svc12: sessionId for app1 != sessionId for app2", - - blockHeight1: 4, - blockHeight2: 4, - - appAddr1: keepertest.TestApp1Address, // app1 - appAddr2: keepertest.TestApp2Address, // app2 - - serviceId1: keepertest.TestServiceId12, // svc12 - serviceId2: keepertest.TestServiceId12, // svc12 - - expectedSessionId1: "44fce80205bece269429a5dc8b55f9d96e5bf7acdb9838f2ac9aa7216905a1cf", - expectedSessionId2: "22328e12562532047c9d4200beaedc9be694cd99b38938ba64cf4cdca0a8ecba", - }, - } - - sessionKeeper, ctx := keepertest.SessionKeeper(t) - ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - sessionHydrator1 := keeper.NewSessionHydrator(tt.appAddr1, tt.serviceId1, tt.blockHeight1) - session1, err := sessionKeeper.HydrateSession(ctx, sessionHydrator1) - require.NoError(t, err) - - sessionHydrator2 := keeper.NewSessionHydrator(tt.appAddr2, tt.serviceId2, tt.blockHeight2) - session2, err := sessionKeeper.HydrateSession(ctx, sessionHydrator2) - require.NoError(t, err) - - require.NotEqual(t, session1.Header.SessionId, session2.Header.SessionId) - require.Equal(t, tt.expectedSessionId1, session1.Header.SessionId) - require.Equal(t, tt.expectedSessionId2, session2.Header.SessionId) - }) - } -} - -// TODO_TECHDEBT: Expand these tests to account for application joining/leaving the network at different heights as well changing the services they support -func TestSession_HydrateSession_Application(t *testing.T) { - type test struct { - // Description - desc string - // Inputs - appAddr string - serviceId string - - // Outputs - expectedErr error - } - - tests := []test{ - { - desc: "app is found", - - appAddr: keepertest.TestApp1Address, - serviceId: keepertest.TestServiceId1, - - expectedErr: nil, - }, - { - desc: "app is not found", - - appAddr: sample.AccAddress(), // Generating a random address on the fly - serviceId: keepertest.TestServiceId1, - - expectedErr: types.ErrSessionHydration, - }, - { - desc: "invalid app address", - - appAddr: "invalid", - serviceId: keepertest.TestServiceId1, - - expectedErr: types.ErrSessionHydration, - }, - { - desc: "invalid - app not staked for service", - - appAddr: keepertest.TestApp1Address, // app1 - serviceId: "svc9001", // app1 is only stake for svc1 and svc11 - - expectedErr: types.ErrSessionHydration, - }, - // TODO_TECHDEBT: Add tests for when: - // - Application join/leaves (stakes/unstakes) altogether - // - Application adds/removes certain services mid-session - // - Application increases stakes mid-session - } - - blockHeight := int64(10) - sessionKeeper, ctx := keepertest.SessionKeeper(t) - ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - sessionHydrator := keeper.NewSessionHydrator(tt.appAddr, tt.serviceId, blockHeight) - _, err := sessionKeeper.HydrateSession(ctx, sessionHydrator) - if tt.expectedErr != nil { - require.Error(t, err) - } else { - require.NoError(t, err) - } - }) - } -} - -// TODO_TECHDEBT: Expand these tests to account for supplier joining/leaving the network at different heights as well changing the services they support -func TestSession_HydrateSession_Suppliers(t *testing.T) { - type test struct { - // Description - desc string - - // Inputs - appAddr string - serviceId string - - // Outputs - numExpectedSuppliers int - expectedErr error - } - - // TODO_TECHDEBT: Extend these tests once `NumBlocksPerSession` is configurable. - // Currently assumes NumSupplierPerSession=15 - tests := []test{ - { - desc: "num_suppliers_available = 0", - - appAddr: keepertest.TestApp1Address, // app1 - serviceId: keepertest.TestServiceId11, - - numExpectedSuppliers: 0, - expectedErr: types.ErrSessionSuppliersNotFound, - }, - { - desc: "num_suppliers_available < num_suppliers_per_session_param", - - appAddr: keepertest.TestApp1Address, // app1 - serviceId: keepertest.TestServiceId1, // svc1 - - numExpectedSuppliers: 1, - expectedErr: nil, - }, - // TODO_TECHDEBT: Add this test once we make the num suppliers per session configurable - // { - // name: "num_suppliers_available > num_suppliers_per_session_param", - // }, - // TODO_TECHDEBT: Add tests for when: - // - Supplier join/leaves (stakes/unstakes) altogether - // - Supplier adds/removes certain services mid-session - // - Supplier increases stakes mid-session - } - - blockHeight := int64(10) - sessionKeeper, ctx := keepertest.SessionKeeper(t) - ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) {}) - - sessionHydrator := keeper.NewSessionHydrator(tt.appAddr, tt.serviceId, blockHeight) - session, err := sessionKeeper.HydrateSession(ctx, sessionHydrator) - - if tt.expectedErr != nil { - require.ErrorContains(t, err, tt.expectedErr.Error()) - continue - } - require.NoError(t, err) - require.Len(t, session.Suppliers, tt.numExpectedSuppliers) - } -} diff --git a/x/session/module.go b/x/session/module.go deleted file mode 100644 index 990ada0c0..000000000 --- a/x/session/module.go +++ /dev/null @@ -1,146 +0,0 @@ -package session - -import ( - "context" - "encoding/json" - "fmt" - - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/session/client/cli" - "github.com/pokt-network/poktroll/x/session/keeper" - "github.com/pokt-network/poktroll/x/session/types" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface that defines the independent methods a Cosmos SDK module needs to implement. -type AppModuleBasic struct { - cdc codec.BinaryCodec -} - -func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} - -// Name returns the name of the module as a string -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(reg) -} - -// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) -} - -// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var genState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - return genState.Validate() -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) -} - -// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper -} - -func NewAppModule( - cdc codec.Codec, - keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, -) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - } -} - -// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) -} - -// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the module's genesis initialization. It returns no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, genState) - - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(genState) -} - -// ConsensusVersion is a sequence number for state-breaking change of the 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 } - -// BeginBlock contains the logic that is automatically triggered at the beginning of each block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} - -// EndBlock contains the logic that is automatically triggered at the end of each block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} diff --git a/x/session/module_simulation.go b/x/session/module_simulation.go deleted file mode 100644 index befedd421..000000000 --- a/x/session/module_simulation.go +++ /dev/null @@ -1,65 +0,0 @@ -package session - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/cosmos/cosmos-sdk/x/simulation" - - "github.com/pokt-network/poktroll/testutil/sample" - sessionsimulation "github.com/pokt-network/poktroll/x/session/simulation" - "github.com/pokt-network/poktroll/x/session/types" -) - -// avoid unused import issue -var ( - _ = sample.AccAddress - _ = sessionsimulation.FindAccount - _ = simulation.MsgEntryKind - _ = baseapp.Paramspace - _ = rand.Rand{} -) - -const ( -// this line is used by starport scaffolding # simapp/module/const -) - -// GenerateGenesisState creates a randomized GenState of the module. -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - accs := make([]string, len(simState.Accounts)) - for i, acc := range simState.Accounts { - accs[i] = acc.Address.String() - } - sessionGenesis := types.GenesisState{ - Params: types.DefaultParams(), - // this line is used by starport scaffolding # simapp/module/genesisState - } - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&sessionGenesis) -} - -// RegisterStoreDecoder registers a decoder. -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - -// WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - operations := make([]simtypes.WeightedOperation, 0) - - // this line is used by starport scaffolding # simapp/module/operation - - return operations -} - -// ProposalMsgs returns msgs used for governance proposals for simulations. -func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { - return []simtypes.WeightedProposalMsg{ - // this line is used by starport scaffolding # simapp/module/OpMsg - } -} diff --git a/x/session/simulation/helpers.go b/x/session/simulation/helpers.go deleted file mode 100644 index 92c437c0d..000000000 --- a/x/session/simulation/helpers.go +++ /dev/null @@ -1,15 +0,0 @@ -package simulation - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -// FindAccount find a specific address from an account list -func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { - creator, err := sdk.AccAddressFromBech32(address) - if err != nil { - panic(err) - } - return simtypes.FindAccount(accs, creator) -} diff --git a/x/session/types/codec.go b/x/session/types/codec.go deleted file mode 100644 index 39e7482ab..000000000 --- a/x/session/types/codec.go +++ /dev/null @@ -1,24 +0,0 @@ -package types - -import ( - // this line is used by starport scaffolding # 1 - - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" -) - -func RegisterCodec(cdc *codec.LegacyAmino) { - // this line is used by starport scaffolding # 2 -} - -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - // this line is used by starport scaffolding # 3 - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) -) diff --git a/x/session/types/errors.go b/x/session/types/errors.go deleted file mode 100644 index dde73c1e6..000000000 --- a/x/session/types/errors.go +++ /dev/null @@ -1,18 +0,0 @@ -package types - -// DONTCOVER - -import ( - sdkerrors "cosmossdk.io/errors" -) - -// x/session module sentinel errors -var ( - ErrSessionHydration = sdkerrors.Register(ModuleName, 1, "error during session hydration") - ErrSessionAppNotFound = sdkerrors.Register(ModuleName, 2, "application for session not found not found ") - ErrSessionAppNotStakedForService = sdkerrors.Register(ModuleName, 3, "application in session not staked for requested service") - ErrSessionSuppliersNotFound = sdkerrors.Register(ModuleName, 4, "no suppliers not found for session") - ErrSessionInvalidAppAddress = sdkerrors.Register(ModuleName, 5, "invalid application address for session") - ErrSessionInvalidService = sdkerrors.Register(ModuleName, 6, "invalid service in session") - ErrSessionInvalidBlockHeight = sdkerrors.Register(ModuleName, 7, "invalid block height for session") -) diff --git a/x/session/types/expected_keepers.go b/x/session/types/expected_keepers.go deleted file mode 100644 index 697528f21..000000000 --- a/x/session/types/expected_keepers.go +++ /dev/null @@ -1,29 +0,0 @@ -package types - -//go:generate mockgen -destination ../../../testutil/session/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper,ApplicationKeeper,SupplierKeeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" - - apptypes "github.com/pokt-network/poktroll/x/application/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// AccountKeeper defines the expected account keeper used for simulations (noalias) -type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI -} - -// BankKeeper defines the expected interface needed to retrieve account balances. -type BankKeeper interface{} - -// ApplicationKeeper defines the expected application keeper to retrieve applications -type ApplicationKeeper interface { - GetApplication(ctx sdk.Context, address string) (app apptypes.Application, found bool) -} - -// SupplierKeeper defines the expected supplier keeper to retrieve suppliers -type SupplierKeeper interface { - GetAllSupplier(ctx sdk.Context) (suppliers []sharedtypes.Supplier) -} diff --git a/x/session/types/genesis.go b/x/session/types/genesis.go deleted file mode 100644 index 0af9b4416..000000000 --- a/x/session/types/genesis.go +++ /dev/null @@ -1,24 +0,0 @@ -package types - -import ( -// this line is used by starport scaffolding # genesis/types/import -) - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 - -// DefaultGenesis returns the default genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - // this line is used by starport scaffolding # genesis/types/default - Params: DefaultParams(), - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - // this line is used by starport scaffolding # genesis/types/validate - - return gs.Params.Validate() -} diff --git a/x/session/types/genesis_test.go b/x/session/types/genesis_test.go deleted file mode 100644 index 97252a21e..000000000 --- a/x/session/types/genesis_test.go +++ /dev/null @@ -1,42 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/x/session/types" -) - -func TestGenesisState_Validate(t *testing.T) { - tests := []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - valid: true, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{ - - // this line is used by starport scaffolding # types/genesis/validField - }, - valid: true, - }, - // this line is used by starport scaffolding # types/genesis/testcase - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } -} diff --git a/x/session/types/keys.go b/x/session/types/keys.go deleted file mode 100644 index 5cdde17b9..000000000 --- a/x/session/types/keys.go +++ /dev/null @@ -1,19 +0,0 @@ -package types - -const ( - // ModuleName defines the module name - ModuleName = "session" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // RouterKey defines the module's message routing key - RouterKey = ModuleName - - // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_session" -) - -func KeyPrefix(p string) []byte { - return []byte(p) -} diff --git a/x/session/types/params.go b/x/session/types/params.go deleted file mode 100644 index 357196ad6..000000000 --- a/x/session/types/params.go +++ /dev/null @@ -1,39 +0,0 @@ -package types - -import ( - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "gopkg.in/yaml.v2" -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params instance -func NewParams() Params { - return Params{} -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams() -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} -} - -// Validate validates the set of params -func (p Params) Validate() error { - return nil -} - -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} diff --git a/x/session/types/query_get_session_request.go b/x/session/types/query_get_session_request.go deleted file mode 100644 index 31b705f8e..000000000 --- a/x/session/types/query_get_session_request.go +++ /dev/null @@ -1,40 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - sharedhelpers "github.com/pokt-network/poktroll/x/shared/helpers" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// NOTE: Please note that `QueryGetSessionRequest` is not a `sdk.Msg`, and is therefore not a message/request -// that will be signable or invoke a state transition. However, following a similar `ValidateBasic` pattern -// allows us to localize & reuse validation logic. -func NewQueryGetSessionRequest(appAddress, serviceId string, blockHeight int64) *QueryGetSessionRequest { - return &QueryGetSessionRequest{ - ApplicationAddress: appAddress, - Service: &sharedtypes.Service{ - Id: serviceId, - }, - BlockHeight: blockHeight, - } -} - -func (query *QueryGetSessionRequest) ValidateBasic() error { - // Validate the application address - if _, err := sdk.AccAddressFromBech32(query.ApplicationAddress); err != nil { - return sdkerrors.Wrapf(ErrSessionInvalidAppAddress, "invalid app address for session being retrieved %s; (%v)", query.ApplicationAddress, err) - } - - // Validate the Service ID - if !sharedhelpers.IsValidService(query.Service) { - return sdkerrors.Wrapf(ErrSessionInvalidService, "invalid service for session being retrieved %s;", query.Service) - } - - // Validate the height for which a session is being retrieved - if query.BlockHeight < 0 { // Note that `0` defaults to the latest height rather than genesis - return sdkerrors.Wrapf(ErrSessionInvalidBlockHeight, "invalid block height for session being retrieved %d;", query.BlockHeight) - } - return nil -} diff --git a/x/session/types/types.go b/x/session/types/types.go deleted file mode 100644 index ab1254f4c..000000000 --- a/x/session/types/types.go +++ /dev/null @@ -1 +0,0 @@ -package types diff --git a/x/shared/helpers/service.go b/x/shared/helpers/service.go deleted file mode 100644 index 9825f26d4..000000000 --- a/x/shared/helpers/service.go +++ /dev/null @@ -1,86 +0,0 @@ -package helpers - -import ( - "net/url" - "regexp" - - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -const ( - maxServiceIdLength = 8 // Limiting all serviceIds to 8 characters - maxServiceIdName = 42 // Limit the the name of the - - regexServiceId = "^[a-zA-Z0-9_-]+$" // Define the regex pattern to match allowed characters - regexServiceName = "^[a-zA-Z0-9-_ ]+$" // Define the regex pattern to match allowed characters (allows spaces) -) - -var ( - regexExprServiceId *regexp.Regexp - regexExprServiceName *regexp.Regexp -) - -func init() { - // Compile the regex pattern - regexExprServiceId = regexp.MustCompile(regexServiceId) - regexExprServiceName = regexp.MustCompile(regexServiceName) - -} - -// IsValidService checks if the provided ServiceId struct has valid fields -func IsValidService(service *sharedtypes.Service) bool { - // Check if service Id and Name are valid using the provided helper functions - return service != nil && - IsValidServiceId(service.Id) && - IsValidServiceName(service.Name) -} - -// IsValidServiceId checks if the input string is a valid serviceId -func IsValidServiceId(serviceId string) bool { - // ServiceId CANNOT be empty - if len(serviceId) == 0 { - return false - } - - if len(serviceId) > maxServiceIdLength { - return false - } - - // Use the regex to match against the input string - return regexExprServiceId.MatchString(serviceId) -} - -// IsValidServiceName checks if the input string is a valid serviceName -func IsValidServiceName(serviceName string) bool { - // ServiceName CAN be empty - if len(serviceName) == 0 { - return true - } - - if len(serviceName) > maxServiceIdName { - return false - } - - // Use the regex to match against the input string - return regexExprServiceName.MatchString(serviceName) -} - -// IsValidEndpointUrl checks if the provided string is a valid URL. -func IsValidEndpointUrl(endpoint string) bool { - u, err := url.Parse(endpoint) - if err != nil { - return false - } - - // Check if scheme is http or https - if u.Scheme != "http" && u.Scheme != "https" { - return false - } - - // Ensure the URL has a host - if u.Host == "" { - return false - } - - return true -} diff --git a/x/shared/helpers/service_configs.go b/x/shared/helpers/service_configs.go deleted file mode 100644 index 95335d058..000000000 --- a/x/shared/helpers/service_configs.go +++ /dev/null @@ -1,81 +0,0 @@ -package helpers - -import ( - "fmt" - - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// ValidateAppServiceConfigs returns an error if any of the application service configs are invalid -func ValidateAppServiceConfigs(services []*sharedtypes.ApplicationServiceConfig) error { - if len(services) == 0 { - return fmt.Errorf("no services configs provided for application: %v", services) - } - for _, serviceConfig := range services { - if serviceConfig == nil { - return fmt.Errorf("serviceConfig cannot be nil: %v", services) - } - // Check the Service - if !IsValidService(serviceConfig.Service) { - return fmt.Errorf("invalid service: %v", serviceConfig.Service) - } - } - return nil -} - -// ValidateSupplierServiceConfigs returns an error if any of the supplier service configs are invalid -func ValidateSupplierServiceConfigs(services []*sharedtypes.SupplierServiceConfig) error { - if len(services) == 0 { - return fmt.Errorf("no services provided for supplier: %v", services) - } - for _, serviceConfig := range services { - if serviceConfig == nil { - return fmt.Errorf("serviceConfig cannot be nil: %v", services) - } - - // Check the Service - if !IsValidService(serviceConfig.Service) { - return fmt.Errorf("invalid service: %v", serviceConfig.Service) - } - - // Check the Endpoints - if serviceConfig.Endpoints == nil { - return fmt.Errorf("endpoints cannot be nil: %v", serviceConfig) - } - if len(serviceConfig.Endpoints) == 0 { - return fmt.Errorf("endpoints must have at least one entry: %v", serviceConfig) - } - - // Check each endpoint - for _, endpoint := range serviceConfig.Endpoints { - if endpoint == nil { - return fmt.Errorf("endpoint cannot be nil: %v", serviceConfig) - } - - // Validate the URL - if endpoint.Url == "" { - return fmt.Errorf("endpoint.Url cannot be empty: %v", serviceConfig) - } - if !IsValidEndpointUrl(endpoint.Url) { - return fmt.Errorf("invalid endpoint.Url: %v", serviceConfig) - } - - // Validate the RPC type - if endpoint.RpcType == sharedtypes.RPCType_UNKNOWN_RPC { - return fmt.Errorf("endpoint.RpcType cannot be UNKNOWN_RPC: %v", serviceConfig) - } - if _, ok := sharedtypes.RPCType_name[int32(endpoint.RpcType)]; !ok { - return fmt.Errorf("endpoint.RpcType is not a valid RPCType: %v", serviceConfig) - } - - // TODO: Validate configs once they are being used - // if endpoint.Configs == nil { - // return fmt.Errorf("endpoint.Configs cannot be nil: %v", serviceConfig) - // } - // if len(endpoint.Configs) == 0 { - // return fmt.Errorf("endpoint.Configs must have at least one entry: %v", serviceConfig) - // } - } - } - return nil -} diff --git a/x/shared/helpers/service_test.go b/x/shared/helpers/service_test.go deleted file mode 100644 index e3dcf57d6..000000000 --- a/x/shared/helpers/service_test.go +++ /dev/null @@ -1,261 +0,0 @@ -package helpers - -import ( - "testing" - - "github.com/stretchr/testify/require" - - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func TestIsValidService(t *testing.T) { - tests := []struct { - desc string - - serviceId string - serviceName string - - expectedIsValid bool - }{ - { - desc: "Valid ID and Name", - - serviceId: "Service1", - serviceName: "Valid Service Name", - - expectedIsValid: true, - }, - { - desc: "Valid ID and empty Name", - - serviceId: "svc", - serviceName: "", // Valid because the service name can be empty - - expectedIsValid: true, - }, - { - desc: "ID exceeds max length", - - serviceId: "TooLongId123", // Exceeds maxServiceIdLength - serviceName: "Valid Name", - - expectedIsValid: false, - }, - { - desc: "Name exceeds max length", - - serviceId: "ValidID", - serviceName: "This service name is way too long to be considered valid since it exceeds the max length", - - expectedIsValid: false, - }, - { - desc: "Empty ID is invalid", - - serviceId: "", // Invalid because the service ID cannot be empty - serviceName: "Valid Name", - - expectedIsValid: false, - }, - { - desc: "Invalid characters in ID", - - serviceId: "ID@Invalid", // Invalid character '@' - serviceName: "Valid Name", - - expectedIsValid: false, - }, - } - - for _, test := range tests { - t.Run(test.desc, func(t *testing.T) { - service := &sharedtypes.Service{ - Id: test.serviceId, - Name: test.serviceName, - } - result := IsValidService(service) - require.Equal(t, test.expectedIsValid, result) - }) - } -} - -func TestIsValidServiceName(t *testing.T) { - tests := []struct { - desc string - input string - expected bool - }{ - { - desc: "Valid with hyphen and number", - input: "ValidName-1", - expected: true, - }, - { - desc: "Valid with space and underscore", - input: "Valid Name_1", - expected: true, - }, - { - desc: "Valid name with spaces", - input: "valid name with spaces", - expected: true, - }, - { - desc: "Invalid character '@'", - input: "invalid@name", - expected: false, - }, - { - desc: "Invalid character '.'", - input: "Valid.Name", - expected: false, - }, - { - desc: "Empty string", - input: "", - expected: true, - }, - { - desc: "Exceeds maximum length", - input: "validnamebuttoolongvalidnamebuttoolongvalidnamebuttoolong", - expected: false, - }, - } - - for _, test := range tests { - t.Run(test.desc, func(t *testing.T) { - result := IsValidServiceName(test.input) - require.Equal(t, test.expected, result) - }) - } -} - -func TestIsValidServiceId(t *testing.T) { - tests := []struct { - desc string - - input string - expected bool - }{ - { - desc: "Valid alphanumeric with hyphen", - - input: "Hello-1", - expected: true, - }, - { - desc: "Valid alphanumeric with underscore", - - input: "Hello_2", - expected: true, - }, - { - desc: "Exceeds maximum length", - - input: "hello-world", - expected: false, // exceeds maxServiceIdLength - }, - { - desc: "Contains invalid character '@'", - - input: "Hello@", - expected: false, // contains invalid character '@' - }, - { - desc: "All uppercase", - - input: "HELLO", - expected: true, - }, - { - desc: "Maximum length boundary", - - input: "12345678", - expected: true, // exactly maxServiceIdLength - }, - { - desc: "Above maximum length boundary", - - input: "123456789", - expected: false, // exceeds maxServiceIdLength - }, - { - desc: "Contains invalid character '.'", - - input: "Hello.World", - expected: false, // contains invalid character '.' - }, - { - desc: "Empty string", - - input: "", - expected: false, // empty string - }, - } - - for _, test := range tests { - t.Run(test.desc, func(t *testing.T) { - result := IsValidServiceId(test.input) - require.Equal(t, test.expected, result) - }) - } -} - -func TestIsValidEndpointUrl(t *testing.T) { - tests := []struct { - desc string - - input string - expected bool - }{ - { - desc: "valid http URL", - - input: "http://example.com", - expected: true, - }, - { - desc: "valid https URL", - - input: "https://example.com/path?query=value#fragment", - expected: true, - }, - { - desc: "valid localhost URL with scheme", - - input: "https://localhost:8081", - expected: true, - }, - { - desc: "valid loopback URL with scheme", - - input: "http://127.0.0.1:8081", - expected: true, - }, - { - desc: "invalid scheme", - - input: "ftp://example.com", - expected: false, - }, - { - desc: "missing scheme", - - input: "example.com", - expected: false, - }, - { - desc: "invalid URL", - - input: "not-a-valid-url", - expected: false, - }, - } - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - got := IsValidEndpointUrl(tt.input) - require.Equal(t, tt.expected, got) - }) - } -} diff --git a/x/supplier/client/cli/flags.go b/x/supplier/client/cli/flags.go deleted file mode 100644 index 1755bbf2d..000000000 --- a/x/supplier/client/cli/flags.go +++ /dev/null @@ -1,7 +0,0 @@ -package cli - -const ( - FlagSessionEndHeight = "session-end-height" - FlagSessionId = "session-id" - FlagSupplierAddress = "supplier-address" -) diff --git a/x/supplier/client/cli/helpers_test.go b/x/supplier/client/cli/helpers_test.go deleted file mode 100644 index e8a0753d0..000000000 --- a/x/supplier/client/cli/helpers_test.go +++ /dev/null @@ -1,260 +0,0 @@ -// Package cli_test provides unit tests for the CLI functionality. -package cli_test - -import ( - "context" - "encoding/base64" - "encoding/json" - "fmt" - "strconv" - "testing" - - "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - testcli "github.com/cosmos/cosmos-sdk/testutil/cli" - sdktypes "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/testutil/testkeyring" - apptypes "github.com/pokt-network/poktroll/x/application/types" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/client/cli" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// TODO_TECHDEBT: This should not be hardcoded once the num blocks per session is configurable. -const ( - numBlocksPerSession = 4 - testServiceId = "svc1" -) - -// Dummy variable to avoid unused import error. -var _ = strconv.IntSize - -// init initializes the SDK configuration. -func init() { - cmd.InitSDKConfig() -} - -// networkWithSupplierObjects creates a new network with a given number of supplier objects. -// It returns the network and a slice of the created supplier objects. -func networkWithSupplierObjects(t *testing.T, n int) (*network.Network, []sharedtypes.Supplier) { - t.Helper() - cfg := network.DefaultConfig() - supplierGenesisState := network.DefaultSupplierModuleGenesisState(t, n) - buf, err := cfg.Codec.MarshalJSON(supplierGenesisState) - require.NoError(t, err) - cfg.GenesisState[types.ModuleName] = buf - return network.New(t, cfg), supplierGenesisState.SupplierList -} - -// TODO_CONSIDERATION: perhaps this (and/or other similar helpers) can be refactored -// into something more generic and moved into a shared testutil package. -// TODO_TECHDEBT: refactor; this function has more than a single responsibility, -// which should be to configure and start the test network. The genesis state, -// accounts, and claims set up logic can probably be factored out and/or reduced. -func networkWithClaimObjects( - t *testing.T, - sessionCount int, - supplierCount int, - appCount int, -) (net *network.Network, claims []types.Claim) { - t.Helper() - - // Initialize a network config. - cfg := network.DefaultConfig() - - // Construct an in-memory keyring so that it can be populated and used prior - // to network start. - kr := keyring.NewInMemory(cfg.Codec) - // Populate the in-memmory keyring with as many pre-generated accounts as - // we expect to need for the test (i.e. appCount + supplierCount). - testkeyring.CreatePreGeneratedKeyringAccounts(t, kr, supplierCount+appCount) - - // Use the pre-generated accounts iterator to populate the supplier and - // application accounts and addresses lists for use in genesis state construction. - preGeneratedAccts := testkeyring.PreGeneratedAccounts().Clone() - - // Create a supplier for each session in numClaimsSessions and an app for each - // claim in numClaimsPerSession. - supplierAccts := make([]*testkeyring.PreGeneratedAccount, supplierCount) - supplierAddrs := make([]string, supplierCount) - for i := range supplierAccts { - account, ok := preGeneratedAccts.Next() - require.True(t, ok) - supplierAccts[i] = account - supplierAddrs[i] = account.Address.String() - } - appAccts := make([]*testkeyring.PreGeneratedAccount, appCount) - appAddrs := make([]string, appCount) - for i := range appAccts { - account, ok := preGeneratedAccts.Next() - require.True(t, ok) - appAccts[i] = account - appAddrs[i] = account.Address.String() - } - - // Construct supplier and application module genesis states given the account addresses. - supplierGenesisState := network.SupplierModuleGenesisStateWithAddresses(t, supplierAddrs) - supplierGenesisBuffer, err := cfg.Codec.MarshalJSON(supplierGenesisState) - require.NoError(t, err) - appGenesisState := network.ApplicationModuleGenesisStateWithAddresses(t, appAddrs) - appGenesisBuffer, err := cfg.Codec.MarshalJSON(appGenesisState) - require.NoError(t, err) - - // Add supplier and application module genesis states to the network config. - cfg.GenesisState[types.ModuleName] = supplierGenesisBuffer - cfg.GenesisState[apptypes.ModuleName] = appGenesisBuffer - - // Construct the network with the configuration. - net = network.New(t, cfg) - // Only the first validator's client context is populated. - // (see: https://pkg.go.dev/github.com/cosmos/cosmos-sdk/testutil/network#pkg-overview) - ctx := net.Validators[0].ClientCtx - // Overwrite the client context's keyring with the in-memory one that contains - // our pre-generated accounts. - ctx = ctx.WithKeyring(kr) - - // Initialize all the accounts - sequenceIndex := 1 - for _, supplierAcct := range supplierAccts { - network.InitAccountWithSequence(t, net, supplierAcct.Address, sequenceIndex) - sequenceIndex++ - } - for _, appAcct := range appAccts { - network.InitAccountWithSequence(t, net, appAcct.Address, sequenceIndex) - sequenceIndex++ - } - // need to wait for the account to be initialized in the next block - require.NoError(t, net.WaitForNextBlock()) - - // Create sessionCount * numClaimsPerSession claims for the supplier - sessionEndHeight := int64(1) - for sessionIdx := 0; sessionIdx < sessionCount; sessionIdx++ { - sessionEndHeight += numBlocksPerSession - for _, appAcct := range appAccts { - for _, supplierAcct := range supplierAccts { - claim := createClaim( - t, net, ctx, - supplierAcct.Address.String(), - sessionEndHeight, - appAcct.Address.String(), - ) - claims = append(claims, *claim) - // TODO_TECHDEBT(#196): Move this outside of the forloop so that the test iteration is faster - require.NoError(t, net.WaitForNextBlock()) - } - } - } - - return net, claims -} - -// encodeSessionHeader returns a base64 encoded string of a json -// serialized session header. -func encodeSessionHeader( - t *testing.T, - appAddr string, - sessionId string, - sessionStartHeight int64, -) string { - t.Helper() - - argSessionHeader := &sessiontypes.SessionHeader{ - ApplicationAddress: appAddr, - SessionStartBlockHeight: sessionStartHeight, - SessionId: sessionId, - SessionEndBlockHeight: sessionStartHeight + numBlocksPerSession, - Service: &sharedtypes.Service{Id: testServiceId}, - } - cdc := codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) - sessionHeaderBz := cdc.MustMarshalJSON(argSessionHeader) - return base64.StdEncoding.EncodeToString(sessionHeaderBz) -} - -// createClaim sends a tx using the test CLI to create an on-chain claim -func createClaim( - t *testing.T, - net *network.Network, - ctx client.Context, - supplierAddr string, - sessionEndHeight int64, - appAddress string, -) *types.Claim { - t.Helper() - - rootHash := []byte("root_hash") - sessionStartHeight := sessionEndHeight - numBlocksPerSession - sessionId := getSessionId(t, net, appAddress, supplierAddr, sessionStartHeight) - sessionHeaderEncoded := encodeSessionHeader(t, appAddress, sessionId, sessionStartHeight) - rootHashEncoded := base64.StdEncoding.EncodeToString(rootHash) - - args := []string{ - sessionHeaderEncoded, - rootHashEncoded, - fmt.Sprintf("--%s=%s", flags.FlagFrom, supplierAddr), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdktypes.NewCoins(sdktypes.NewCoin(net.Config.BondDenom, math.NewInt(10))).String()), - } - - responseRaw, err := testcli.ExecTestCLICmd(ctx, cli.CmdCreateClaim(), args) - require.NoError(t, err) - var responseJson map[string]interface{} - err = json.Unmarshal(responseRaw.Bytes(), &responseJson) - require.NoError(t, err) - require.Equal(t, float64(0), responseJson["code"], "code is not 0 in the response: %v", responseJson) - - // TODO_TECHDEBT: Forward the actual claim in the response once the response is updated to return it. - return &types.Claim{ - SupplierAddress: supplierAddr, - SessionHeader: &sessiontypes.SessionHeader{ - ApplicationAddress: appAddress, - Service: &sharedtypes.Service{Id: testServiceId}, - SessionId: sessionId, - SessionStartBlockHeight: sessionStartHeight, - SessionEndBlockHeight: sessionEndHeight, - }, - RootHash: rootHash, - } -} - -// getSessionId sends a query using the test CLI to get a session for the inputs provided. -// It is assumed that the supplierAddr will be in that session based on the test design, but this -// is insured in this function before it's successfully returned. -func getSessionId( - t *testing.T, - net *network.Network, - appAddr string, - supplierAddr string, - sessionStartHeight int64, -) string { - t.Helper() - ctx := context.TODO() - - sessionQueryClient := sessiontypes.NewQueryClient(net.Validators[0].ClientCtx) - res, err := sessionQueryClient.GetSession(ctx, &sessiontypes.QueryGetSessionRequest{ - ApplicationAddress: appAddr, - Service: &sharedtypes.Service{Id: testServiceId}, - BlockHeight: sessionStartHeight, - }) - require.NoError(t, err) - - var found bool - for _, supplier := range res.GetSession().GetSuppliers() { - if supplier.GetAddress() == supplierAddr { - found = true - break - } - } - require.Truef(t, found, "supplier address %s not found in session", supplierAddr) - - return res.Session.SessionId -} diff --git a/x/supplier/client/cli/query.go b/x/supplier/client/cli/query.go deleted file mode 100644 index e87eda8ed..000000000 --- a/x/supplier/client/cli/query.go +++ /dev/null @@ -1,33 +0,0 @@ -package cli - -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - // Group supplier queries under a subcommand - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdQueryParams()) - cmd.AddCommand(CmdListSupplier()) - cmd.AddCommand(CmdShowSupplier()) - cmd.AddCommand(CmdListClaims()) - cmd.AddCommand(CmdShowClaim()) - cmd.AddCommand(CmdListProof()) - cmd.AddCommand(CmdShowProof()) - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/supplier/client/cli/query_claim.go b/x/supplier/client/cli/query_claim.go deleted file mode 100644 index 949ac0d6e..000000000 --- a/x/supplier/client/cli/query_claim.go +++ /dev/null @@ -1,172 +0,0 @@ -package cli - -import ( - "fmt" - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -// AddPaginationFlagsToCmd adds common pagination flags to cmd -func AddClaimFilterFlags(cmd *cobra.Command) { - cmd.Flags().Uint64(FlagSessionEndHeight, 0, "claims whose session ends at this height will be returned") - cmd.Flags().String(FlagSessionId, "", "claims matching this session id will be returned") - cmd.Flags().String(FlagSupplierAddress, "", "claims submitted by suppliers matching this address will be returned") -} - -func CmdListClaims() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-claims", - Short: "list all claims", - Long: `List all the claims that the node being queried has in its state. - -The claims can be optionally filtered by one of --session-end-height --session-id or --supplier-address flags - -Example: -$ poktrolld --home=$(POKTROLLD_HOME) q claim list-claims --node $(POCKET_NODE) -$ poktrolld --home=$(POKTROLLD_HOME) q claim list-claims --session-id --node $(POCKET_NODE) -$ poktrolld --home=$(POKTROLLD_HOME) q claim list-claims --session-end-height --node $(POCKET_NODE) -$ poktrolld --home=$(POKTROLLD_HOME) q claim list-claims --supplier-address --node $(POCKET_NODE)`, - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - req := &types.QueryAllClaimsRequest{ - Pagination: pageReq, - } - if err := updateClaimsFilter(cmd, req); err != nil { - return err - } - if err := req.ValidateBasic(); err != nil { - return err - } - - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.AllClaims(cmd.Context(), req) - if err != nil { - return err - } - return clientCtx.PrintProto(res) - }, - } - - AddClaimFilterFlags(cmd) - flags.AddPaginationFlagsToCmd(cmd, cmd.Use) - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdShowClaim() *cobra.Command { - cmd := &cobra.Command{ - Use: "show-claim ", - Short: "shows a specific claim", - Long: `List a specific claim that the node being queried has access to (if it still exists). - -A unique claim can be defined via a ` + "`session_id`" + ` that the given ` + "`supplier`" + ` participated in. - -` + "`Claims`" + ` are pruned, according to protocol parameters, some time after their respective ` + "`proof`" + ` has been submitted and any dispute window has elapsed. - -This is done to minimize the rate at which state accumulates by eliminating claims as a long-term factor to persistence requirements. - -Example: -$ poktrolld --home=$(POKTROLLD_HOME) q claim show-claims --node $(POCKET_NODE)`, - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - sessionId := args[0] - supplierAddr := args[1] - - getClaimRequest := &types.QueryGetClaimRequest{ - SessionId: sessionId, - SupplierAddress: supplierAddr, - } - if err := getClaimRequest.ValidateBasic(); err != nil { - return err - } - - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Claim(cmd.Context(), getClaimRequest) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -// updateClaimsFilter updates the claims filter request based on the flags set provided -func updateClaimsFilter(cmd *cobra.Command, req *types.QueryAllClaimsRequest) error { - sessionId, _ := cmd.Flags().GetString(FlagSessionId) - supplierAddr, _ := cmd.Flags().GetString(FlagSupplierAddress) - sessionEndHeight, _ := cmd.Flags().GetUint64(FlagSessionEndHeight) - - // Preparing a shared error in case more than one flag was set - err := fmt.Errorf("can only specify one flag filter but got sessionId (%s), supplierAddr (%s) and sessionEngHeight (%d)", sessionId, supplierAddr, sessionEndHeight) - - // Use the session id as the filter - if sessionId != "" { - // If the session id is set, then the other flags must not be set - if supplierAddr != "" || sessionEndHeight > 0 { - return err - } - // Set the session id filter - req.Filter = &types.QueryAllClaimsRequest_SessionId{ - SessionId: sessionId, - } - return nil - } - - // Use the supplier address as the filter - if supplierAddr != "" { - // If the supplier address is set, then the other flags must not be set - if sessionId != "" || sessionEndHeight > 0 { - return err - } - // Set the supplier address filter - req.Filter = &types.QueryAllClaimsRequest_SupplierAddress{ - SupplierAddress: supplierAddr, - } - return nil - } - - // Use the session end height as the filter - if sessionEndHeight > 0 { - // If the session end height is set, then the other flags must not be set - if sessionId != "" || supplierAddr != "" { - return err - } - // Set the session end height filter - req.Filter = &types.QueryAllClaimsRequest_SessionEndHeight{ - SessionEndHeight: sessionEndHeight, - } - return nil - } - - return nil -} diff --git a/x/supplier/client/cli/query_claim_test.go b/x/supplier/client/cli/query_claim_test.go deleted file mode 100644 index d7bd4aabd..000000000 --- a/x/supplier/client/cli/query_claim_test.go +++ /dev/null @@ -1,284 +0,0 @@ -package cli_test - -import ( - "fmt" - "testing" - - tmcli "github.com/cometbft/cometbft/libs/cli" - "github.com/cosmos/cosmos-sdk/client/flags" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/supplier/client/cli" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func TestClaim_Show(t *testing.T) { - sessionCount := 1 - supplierCount := 3 - appCount := 3 - - net, claims := networkWithClaimObjects( - t, sessionCount, - appCount, - supplierCount, - ) - - ctx := net.Validators[0].ClientCtx - common := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - - var wrongSupplierAddr = sample.AccAddress() - tests := []struct { - desc string - sessionId string - supplierAddr string - - args []string - expectedErr error - claim types.Claim - }{ - { - desc: "claim found", - sessionId: claims[0].GetSessionHeader().GetSessionId(), - supplierAddr: claims[0].GetSupplierAddress(), - - args: common, - claim: claims[0], - }, - { - desc: "claim not found (wrong session ID)", - sessionId: "wrong_session_id", - supplierAddr: claims[0].GetSupplierAddress(), - - args: common, - - expectedErr: status.Error( - codes.NotFound, - types.ErrSupplierClaimNotFound.Wrapf( - "session ID %q and supplier %q", - "wrong_session_id", - claims[0].GetSupplierAddress(), - ).Error(), - ), - }, - { - desc: "claim not found (invalid bech32 supplier address)", - sessionId: claims[0].GetSessionHeader().GetSessionId(), - supplierAddr: "invalid_bech32_supplier_address", - - args: common, - // NB: this is *NOT* a gRPC status error because the bech32 parse - // error occurs during request validation (i.e. client-side). - expectedErr: types.ErrSupplierInvalidAddress.Wrapf( - // TODO_CONSIDERATION: prefer using "%q" in error format strings - // to disambiguate empty string from space or no output. - "invalid supplier address for claim being retrieved %s; (decoding bech32 failed: invalid separator index -1)", - "invalid_bech32_supplier_address", - ), - }, - { - desc: "claim not found (wrong supplier address)", - sessionId: claims[0].GetSessionHeader().GetSessionId(), - supplierAddr: wrongSupplierAddr, - - args: common, - expectedErr: status.Error( - codes.NotFound, - types.ErrSupplierClaimNotFound.Wrapf( - "session ID %q and supplier %q", - claims[0].GetSessionHeader().GetSessionId(), - wrongSupplierAddr, - ).Error(), - ), - }, - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - args := []string{ - tc.sessionId, - tc.supplierAddr, - } - args = append(args, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowClaim(), args) - if tc.expectedErr != nil { - require.ErrorContains(t, err, tc.expectedErr.Error()) - } else { - require.NoError(t, err) - var resp types.QueryGetClaimResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NotNil(t, resp.Claim) - - require.Equal(t, tc.claim.GetSupplierAddress(), resp.Claim.GetSupplierAddress()) - require.Equal(t, tc.claim.GetRootHash(), resp.Claim.GetRootHash()) - require.Equal(t, tc.claim.GetSessionHeader(), resp.Claim.GetSessionHeader()) - } - }) - } -} - -func TestClaim_List(t *testing.T) { - sessionCount := 2 - supplierCount := 4 - appCount := 3 - serviceCount := 1 - // Each supplier will submit a claim for each app x service combination (per session). - numClaimsPerSession := supplierCount * appCount * serviceCount - totalClaims := sessionCount * numClaimsPerSession - - net, claims := networkWithClaimObjects( - t, sessionCount, - supplierCount, - appCount, - ) - - ctx := net.Validators[0].ClientCtx - prepareArgs := func(next []byte, offset, limit uint64, total bool) []string { - args := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - if next == nil { - args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) - } else { - args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) - } - args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) - if total { - args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) - } - return args - } - - t.Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < totalClaims; i += step { - args := prepareArgs(nil, uint64(i), uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListClaims(), args) - require.NoError(t, err) - - var resp types.QueryAllClaimsResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - - require.LessOrEqual(t, len(resp.Claim), step) - require.Subset(t, - nullify.Fill(claims), - nullify.Fill(resp.Claim), - ) - } - }) - - t.Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < totalClaims; i += step { - args := prepareArgs(next, 0, uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListClaims(), args) - require.NoError(t, err) - - var resp types.QueryAllClaimsResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - - require.LessOrEqual(t, len(resp.Claim), step) - require.Subset(t, - nullify.Fill(claims), - nullify.Fill(resp.Claim), - ) - next = resp.Pagination.NextKey - } - }) - - t.Run("ByAddress", func(t *testing.T) { - supplierAddr := claims[0].SupplierAddress - args := prepareArgs(nil, 0, uint64(totalClaims), true) - args = append(args, fmt.Sprintf("--%s=%s", cli.FlagSupplierAddress, supplierAddr)) - - expectedClaims := make([]types.Claim, 0) - for _, claim := range claims { - if claim.SupplierAddress == supplierAddr { - expectedClaims = append(expectedClaims, claim) - } - } - - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListClaims(), args) - require.NoError(t, err) - - var resp types.QueryAllClaimsResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - - require.ElementsMatch(t, - nullify.Fill(expectedClaims), - nullify.Fill(resp.Claim), - ) - require.Equal(t, sessionCount*appCount, int(resp.Pagination.Total)) - }) - - t.Run("BySession", func(t *testing.T) { - sessionId := claims[0].GetSessionHeader().SessionId - args := prepareArgs(nil, 0, uint64(totalClaims), true) - args = append(args, fmt.Sprintf("--%s=%s", cli.FlagSessionId, sessionId)) - - expectedClaims := make([]types.Claim, 0) - for _, claim := range claims { - if claim.GetSessionHeader().SessionId == sessionId { - expectedClaims = append(expectedClaims, claim) - } - } - - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListClaims(), args) - require.NoError(t, err) - - var resp types.QueryAllClaimsResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - - require.ElementsMatch(t, - nullify.Fill(expectedClaims), - nullify.Fill(resp.Claim), - ) - require.Equal(t, supplierCount, int(resp.Pagination.Total)) - }) - - t.Run("ByHeight", func(t *testing.T) { - sessionEndHeight := claims[0].GetSessionHeader().GetSessionEndBlockHeight() - args := prepareArgs(nil, 0, uint64(totalClaims), true) - args = append(args, fmt.Sprintf("--%s=%d", cli.FlagSessionEndHeight, sessionEndHeight)) - - expectedClaims := make([]types.Claim, 0) - for _, claim := range claims { - if claim.GetSessionHeader().GetSessionEndBlockHeight() == sessionEndHeight { - expectedClaims = append(expectedClaims, claim) - } - } - - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListClaims(), args) - require.NoError(t, err) - - var resp types.QueryAllClaimsResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - - require.Equal(t, numClaimsPerSession, int(resp.Pagination.Total)) - require.ElementsMatch(t, - nullify.Fill(expectedClaims), - nullify.Fill(resp.Claim), - ) - }) - - t.Run("Total", func(t *testing.T) { - args := prepareArgs(nil, 0, uint64(totalClaims), true) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListClaims(), args) - require.NoError(t, err) - - var resp types.QueryAllClaimsResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - - require.Equal(t, totalClaims, int(resp.Pagination.Total)) - require.ElementsMatch(t, - nullify.Fill(claims), - nullify.Fill(resp.Claim), - ) - }) -} diff --git a/x/supplier/client/cli/query_params.go b/x/supplier/client/cli/query_params.go deleted file mode 100644 index 339dbcf00..000000000 --- a/x/supplier/client/cli/query_params.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - 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.Params(cmd.Context(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/supplier/client/cli/query_proof.go b/x/supplier/client/cli/query_proof.go deleted file mode 100644 index 091c4403c..000000000 --- a/x/supplier/client/cli/query_proof.go +++ /dev/null @@ -1,165 +0,0 @@ -package cli - -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// AddProofFilterFlagsToCmd adds common pagination flags to cmd -func AddProofFilterFlagsToCmd(cmd *cobra.Command) { - cmd.Flags().Uint64(FlagSessionEndHeight, 0, "proofs whose session ends at this height will be returned") - cmd.Flags().String(FlagSessionId, "", "proofs matching this session id will be returned") - cmd.Flags().String(FlagSupplierAddress, "", "proofs submitted by suppliers matching this address will be returned") -} - -func CmdListProof() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-proofs", - Short: "list all proofs", - Long: `List all the proofs that the node being queried has in its state. - -The proofs can be optionally filtered by one of --session-end-height --session-id or --supplier-address flags - -Example: -$ poktrolld q proof list-proofs --node $(POCKET_NODE) --home=$(POKTROLLD_HOME) -$ poktrolld q proof list-proofs --session-id --node $(POCKET_NODE) --home=$(POKTROLLD_HOME) -$ poktrolld q proof list-proofs --session-end-height --node $(POCKET_NODE) --home=$(POKTROLLD_HOME) -$ poktrolld q proof list-proofs --supplier-address --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - req := &types.QueryAllProofsRequest{ - Pagination: pageReq, - } - if err := updateProofsFilter(cmd, req); err != nil { - return err - } - if err := req.ValidateBasic(); err != nil { - return err - } - - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.AllProofs(cmd.Context(), req) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - AddProofFilterFlagsToCmd(cmd) - flags.AddPaginationFlagsToCmd(cmd, cmd.Use) - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdShowProof() *cobra.Command { - cmd := &cobra.Command{ - Use: "show-proof ", - Short: "shows a specific proof", - Long: `List a specific proof that the node being queried has access to. - -A unique proof can be defined via a session_id that a given supplier participated in. - -Example: -$ poktrolld --home=$(POKTROLLD_HOME) q proof show-proofs --node $(POCKET_NODE)`, - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) (err error) { - sessionId := args[0] - supplierAddr := args[1] - - getProofRequest := &types.QueryGetProofRequest{ - SessionId: sessionId, - SupplierAddress: supplierAddr, - } - if err := getProofRequest.ValidateBasic(); err != nil { - return err - } - - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Proof(cmd.Context(), getProofRequest) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -// updateProofsFilter updates the proofs filter request based on the flags set provided -func updateProofsFilter(cmd *cobra.Command, req *types.QueryAllProofsRequest) error { - sessionId, _ := cmd.Flags().GetString(FlagSessionId) - supplierAddr, _ := cmd.Flags().GetString(FlagSupplierAddress) - sessionEndHeight, _ := cmd.Flags().GetUint64(FlagSessionEndHeight) - - // Preparing a shared error in case more than one flag was set - err := fmt.Errorf("can only specify one flag filter but got sessionId (%s), supplierAddr (%s) and sessionEngHeight (%d)", sessionId, supplierAddr, sessionEndHeight) - - // Use the session id as the filter - if sessionId != "" { - // If the session id is set, then the other flags must not be set - if supplierAddr != "" || sessionEndHeight > 0 { - return err - } - // Set the session id filter - req.Filter = &types.QueryAllProofsRequest_SessionId{ - SessionId: sessionId, - } - return nil - } - - // Use the supplier address as the filter - if supplierAddr != "" { - // If the supplier address is set, then the other flags must not be set - if sessionId != "" || sessionEndHeight > 0 { - return err - } - // Set the supplier address filter - req.Filter = &types.QueryAllProofsRequest_SupplierAddress{ - SupplierAddress: supplierAddr, - } - return nil - } - - // Use the session end height as the filter - if sessionEndHeight > 0 { - // If the session end height is set, then the other flags must not be set - if sessionId != "" || supplierAddr != "" { - return err - } - // Set the session end height filter - req.Filter = &types.QueryAllProofsRequest_SessionEndHeight{ - SessionEndHeight: sessionEndHeight, - } - return nil - } - - return nil -} diff --git a/x/supplier/client/cli/query_proof_test.go b/x/supplier/client/cli/query_proof_test.go deleted file mode 100644 index f6f4fcefe..000000000 --- a/x/supplier/client/cli/query_proof_test.go +++ /dev/null @@ -1,145 +0,0 @@ -package cli_test - -// TODO_UPNEXT(@Olshansk): Add these tests back in after merging on-chain Proof persistence. -// Prevent strconv unused error -// var _ = strconv.IntSize - -// func networkWithProofObjects(t *testing.T, n int) (*network.Network, []types.Proof) { -// t.Helper() -// cfg := network.DefaultConfig() -// state := types.GenesisState{} -// for i := 0; i < n; i++ { -// proof := types.Proof{ -// Index: strconv.Itoa(i), - -// } -// nullify.Fill(&proof) -// state.ProofList = append(state.ProofList, proof) -// } -// buf, err := cfg.Codec.MarshalJSON(&state) -// require.NoError(t, err) -// cfg.GenesisState[types.ModuleName] = buf -// return network.New(t, cfg), state.ProofList -// } - -// func TestShowProof(t *testing.T) { -// net, objs := networkWithProofObjects(t, 2) - -// ctx := net.Validators[0].ClientCtx -// common := []string{ -// fmt.Sprintf("--%s=json", tmcli.OutputFlag), -// } -// tests := []struct { -// desc string -// idIndex string - -// args []string -// err error -// obj types.Proof -// }{ -// { -// desc: "found", -// idIndex: objs[0].Index, - -// args: common, -// obj: objs[0], -// }, -// { -// desc: "not found", -// idIndex: strconv.Itoa(100000), - -// args: common, -// err: status.Error(codes.NotFound, "not found"), -// }, -// } -// for _, tc := range tests { -// t.Run(tc.desc, func(t *testing.T) { -// args := []string{ -// tc.idIndex, - -// } -// args = append(args, tc.args...) -// out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowProof(), args) -// if tc.err != nil { -// stat, ok := status.FromError(tc.err) -// require.True(t, ok) -// require.ErrorIs(t, stat.Err(), tc.err) -// } else { -// require.NoError(t, err) -// var resp types.QueryGetProofResponse -// require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) -// require.NotNil(t, resp.Proof) -// require.Equal(t, -// nullify.Fill(&tc.obj), -// nullify.Fill(&resp.Proof), -// ) -// } -// }) -// } -// } - -// func TestListProof(t *testing.T) { -// net, objs := networkWithProofObjects(t, 5) - -// ctx := net.Validators[0].ClientCtx -// request := func(next []byte, offset, limit uint64, total bool) []string { -// args := []string{ -// fmt.Sprintf("--%s=json", tmcli.OutputFlag), -// } -// if next == nil { -// args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) -// } else { -// args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) -// } -// args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) -// if total { -// args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) -// } -// return args -// } -// t.Run("ByOffset", func(t *testing.T) { -// step := 2 -// for i := 0; i < len(objs); i += step { -// args := request(nil, uint64(i), uint64(step), false) -// out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListProof(), args) -// require.NoError(t, err) -// var resp types.QueryAllProofsResponse -// require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) -// require.LessOrEqual(t, len(resp.Proof), step) -// require.Subset(t, -// nullify.Fill(objs), -// nullify.Fill(resp.Proof), -// ) -// } -// }) -// t.Run("ByKey", func(t *testing.T) { -// step := 2 -// var next []byte -// for i := 0; i < len(objs); i += step { -// args := request(next, 0, uint64(step), false) -// out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListProof(), args) -// require.NoError(t, err) -// var resp types.QueryAllProofsResponse -// require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) -// require.LessOrEqual(t, len(resp.Proof), step) -// require.Subset(t, -// nullify.Fill(objs), -// nullify.Fill(resp.Proof), -// ) -// next = resp.Pagination.NextKey -// } -// }) -// t.Run("Total", func(t *testing.T) { -// args := request(nil, 0, uint64(len(objs)), true) -// out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListProof(), args) -// require.NoError(t, err) -// var resp types.QueryAllProofsResponse -// require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) -// require.NoError(t, err) -// require.Equal(t, len(objs), int(resp.Pagination.Total)) -// require.ElementsMatch(t, -// nullify.Fill(objs), -// nullify.Fill(resp.Proof), -// ) -// }) -// } diff --git a/x/supplier/client/cli/query_supplier.go b/x/supplier/client/cli/query_supplier.go deleted file mode 100644 index 604c1182f..000000000 --- a/x/supplier/client/cli/query_supplier.go +++ /dev/null @@ -1,78 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func CmdListSupplier() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-supplier", - Short: "list all supplier", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryAllSupplierRequest{ - Pagination: pageReq, - } - - res, err := queryClient.SupplierAll(cmd.Context(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, cmd.Use) - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdShowSupplier() *cobra.Command { - cmd := &cobra.Command{ - Use: "show-supplier ", - Short: "shows a supplier", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - argAddress := args[0] - - params := &types.QueryGetSupplierRequest{ - Address: argAddress, - } - - res, err := queryClient.Supplier(cmd.Context(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/supplier/client/cli/query_supplier_test.go b/x/supplier/client/cli/query_supplier_test.go deleted file mode 100644 index bf05a5d44..000000000 --- a/x/supplier/client/cli/query_supplier_test.go +++ /dev/null @@ -1,139 +0,0 @@ -package cli_test - -import ( - "fmt" - "strconv" - "testing" - - tmcli "github.com/cometbft/cometbft/libs/cli" - "github.com/cosmos/cosmos-sdk/client/flags" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - "github.com/pokt-network/poktroll/testutil/nullify" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/client/cli" - "github.com/pokt-network/poktroll/x/supplier/types" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -func TestShowSupplier(t *testing.T) { - net, suppliers := networkWithSupplierObjects(t, 2) - - ctx := net.Validators[0].ClientCtx - common := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - tests := []struct { - desc string - idAddress string - - args []string - err error - obj sharedtypes.Supplier - }{ - { - desc: "supplier found", - idAddress: suppliers[0].Address, - - args: common, - obj: suppliers[0], - }, - { - desc: "supplier not found", - idAddress: strconv.Itoa(100000), - - args: common, - err: status.Error(codes.NotFound, "not found"), - }, - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - args := []string{ - tc.idAddress, - } - args = append(args, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowSupplier(), args) - if tc.err != nil { - stat, ok := status.FromError(tc.err) - require.True(t, ok) - require.ErrorIs(t, stat.Err(), tc.err) - } else { - require.NoError(t, err) - var resp types.QueryGetSupplierResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NotNil(t, resp.Supplier) - require.Equal(t, - nullify.Fill(&tc.obj), - nullify.Fill(&resp.Supplier), - ) - } - }) - } -} - -func TestListSupplier(t *testing.T) { - net, suppliers := networkWithSupplierObjects(t, 5) - - ctx := net.Validators[0].ClientCtx - request := func(next []byte, offset, limit uint64, total bool) []string { - args := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - if next == nil { - args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) - } else { - args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) - } - args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) - if total { - args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) - } - return args - } - t.Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < len(suppliers); i += step { - args := request(nil, uint64(i), uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListSupplier(), args) - require.NoError(t, err) - var resp types.QueryAllSupplierResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.Supplier), step) - require.Subset(t, - nullify.Fill(suppliers), - nullify.Fill(resp.Supplier), - ) - } - }) - t.Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < len(suppliers); i += step { - args := request(next, 0, uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListSupplier(), args) - require.NoError(t, err) - var resp types.QueryAllSupplierResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.Supplier), step) - require.Subset(t, - nullify.Fill(suppliers), - nullify.Fill(resp.Supplier), - ) - next = resp.Pagination.NextKey - } - }) - t.Run("Total", func(t *testing.T) { - args := request(nil, 0, uint64(len(suppliers)), true) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListSupplier(), args) - require.NoError(t, err) - var resp types.QueryAllSupplierResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NoError(t, err) - require.Equal(t, len(suppliers), int(resp.Pagination.Total)) - require.ElementsMatch(t, - nullify.Fill(suppliers), - nullify.Fill(resp.Supplier), - ) - }) -} diff --git a/x/supplier/client/cli/tx.go b/x/supplier/client/cli/tx.go deleted file mode 100644 index c76c24dae..000000000 --- a/x/supplier/client/cli/tx.go +++ /dev/null @@ -1,39 +0,0 @@ -package cli - -import ( - "fmt" - "time" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdStakeSupplier()) - cmd.AddCommand(CmdUnstakeSupplier()) - cmd.AddCommand(CmdCreateClaim()) - cmd.AddCommand(CmdSubmitProof()) - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/supplier/client/cli/tx_create_claim.go b/x/supplier/client/cli/tx_create_claim.go deleted file mode 100644 index 9fd509e55..000000000 --- a/x/supplier/client/cli/tx_create_claim.go +++ /dev/null @@ -1,68 +0,0 @@ -package cli - -import ( - "encoding/base64" - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/spf13/cobra" - - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// TODO(@bryanchriswhite): Add unit tests for the CLI command when implementing the business logic. - -var _ = strconv.Itoa(0) - -func CmdCreateClaim() *cobra.Command { - cmd := &cobra.Command{ - Use: "create-claim ", - Short: "Broadcast message create-claim", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) (err error) { - sessionHeaderEncodedStr := args[0] - rootHashEncodedStr := args[1] - - // Get the session header - cdc := codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) - sessionHeaderBz, err := base64.StdEncoding.DecodeString(sessionHeaderEncodedStr) - if err != nil { - return err - } - sessionHeader := sessiontypes.SessionHeader{} - cdc.MustUnmarshalJSON(sessionHeaderBz, &sessionHeader) - - // Get the root hash - rootHash, err := base64.StdEncoding.DecodeString(rootHashEncodedStr) - if err != nil { - return err - } - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - supplierAddress := clientCtx.GetFromAddress().String() - - msg := types.NewMsgCreateClaim( - supplierAddress, - &sessionHeader, - rootHash, - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/supplier/client/cli/tx_stake_supplier.go b/x/supplier/client/cli/tx_stake_supplier.go deleted file mode 100644 index 2c611f817..000000000 --- a/x/supplier/client/cli/tx_stake_supplier.go +++ /dev/null @@ -1,67 +0,0 @@ -package cli - -import ( - "os" - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/supplier/client/config" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -var ( - flagStakeConfig string - _ = strconv.Itoa(0) // Part of the default ignite imports -) - -func CmdStakeSupplier() *cobra.Command { - // fromAddress & signature is retrieved via `flags.FlagFrom` in the `clientCtx` - cmd := &cobra.Command{ - Use: "stake-supplier --config ", - Short: "Stake a supplier", - Long: `Stake an supplier with the provided parameters. This is a broadcast operation that -will stake the tokens and associate them with the supplier specified by the 'from' address. - -Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx supplier stake-supplier --config stake_config.yaml --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, - - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, _ []string) (err error) { - configContent, err := os.ReadFile(flagStakeConfig) - if err != nil { - return err - } - - supplierStakeConfigs, err := config.ParseSupplierConfigs(configContent) - if err != nil { - return err - } - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgStakeSupplier( - clientCtx.GetFromAddress().String(), - supplierStakeConfigs.StakeAmount, - supplierStakeConfigs.Services, - ) - - if err := msg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().StringVar(&flagStakeConfig, "config", "", "Path to the stake config file") - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/supplier/client/cli/tx_stake_supplier_test.go b/x/supplier/client/cli/tx_stake_supplier_test.go deleted file mode 100644 index 7400e404c..000000000 --- a/x/supplier/client/cli/tx_stake_supplier_test.go +++ /dev/null @@ -1,297 +0,0 @@ -package cli_test - -import ( - "fmt" - "testing" - - sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/testutil/yaml" - "github.com/pokt-network/poktroll/x/supplier/client/cli" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func TestCLI_StakeSupplier(t *testing.T) { - net, _ := networkWithSupplierObjects(t, 2) - val := net.Validators[0] - ctx := val.ClientCtx - - // Create a keyring and add an account for the supplier to be staked - kr := ctx.Keyring - accounts := testutil.CreateKeyringAccounts(t, kr, 1) - supplierAccount := accounts[0] - - // Update the context with the new keyring - ctx = ctx.WithKeyring(kr) - - // Common args used for all requests - commonArgs := []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), - } - - defaultConfig := ` - stake_amount: 1000upokt - services: - - service_id: svc1 - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - ` - - tests := []struct { - desc string - address string - config string - err *sdkerrors.Error - }{ - // Happy Paths - { - desc: "stake supplier: valid", - address: supplierAccount.Address.String(), - config: defaultConfig, - }, - - // Error Paths - Address Related - { - desc: "stake supplier: missing address", - // address: "explicitly missing", - err: types.ErrSupplierInvalidAddress, - config: defaultConfig, - }, - { - desc: "stake supplier: invalid address", - address: "invalid", - err: types.ErrSupplierInvalidAddress, - config: defaultConfig, - }, - - // Error Paths - Stake Related - { - desc: "stake supplier: missing stake", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidStake, - config: ` - # explicitly omitted stake - services: - - service_id: svc1 - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - `, - }, - { - desc: "stake supplier: invalid stake denom", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidStake, - config: ` - stake_amount: 1000invalid - services: - - service_id: svc1 - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - `, - }, - { - desc: "stake supplier: invalid stake amount (zero)", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidStake, - config: ` - stake_amount: 0upokt - services: - - service_id: svc1 - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - `, - }, - { - desc: "stake supplier: invalid stake amount (negative)", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidStake, - config: ` - stake_amount: -1000upokt - services: - - service_id: svc1 - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - `, - }, - - // Happy Paths - Service Related - { - desc: "services_test: valid multiple services", - address: supplierAccount.Address.String(), - config: ` - stake_amount: 1000upokt - services: - - service_id: svc1 - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - - service_id: svc2 - endpoints: - - url: http://pokt.network:8082 - rpc_type: json_rpc - `, - }, - { - desc: "services_test: valid localhost", - address: supplierAccount.Address.String(), - config: ` - stake_amount: 1000upokt - services: - - service_id: svc1 - endpoints: - - url: http://127.0.0.1:8082 - rpc_type: json_rpc - `, - }, - { - desc: "services_test: valid loopback", - address: supplierAccount.Address.String(), - config: ` - stake_amount: 1000upokt - services: - - service_id: svc1 - endpoints: - - url: http://localhost:8082 - rpc_type: json_rpc - `, - }, - { - desc: "services_test: valid without a pork", - address: supplierAccount.Address.String(), - config: ` - stake_amount: 1000upokt - services: - - service_id: svc1 - endpoints: - - url: http://pokt.network - rpc_type: json_rpc - `, - }, - - // Error Paths - Service Related - { - desc: "services_test: invalid services (missing argument)", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, - // servicesString: "explicitly omitted", - config: ` - stake_amount: 1000upokt - `, - }, - { - desc: "services_test: invalid services (empty string)", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, - config: ` - stake_amount: 1000upokt - services: - `, - }, - { - desc: "services_test: invalid URL", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, - config: ` - stake_amount: 1000upokt - services: - - service_id: svc1 - endpoints: - - url: bad_url - rpc_type: json_rpc - `, - }, - { - desc: "services_test: missing URLs", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, - config: ` - stake_amount: 1000upokt - services: - - service_id: svc1 - - service_id: svc2 - `, - }, - { - desc: "services_test: missing service IDs", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, - config: ` - stake_amount: 1000upokt - services: - - endpoints: - - url: localhost:8081 - rpc_type: json_rpc - - endpoints: - - url: localhost:8082 - rpc_type: json_rpc - `, - }, - { - desc: "services_test: missing rpc type", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, - config: ` - stake_amount: 1000upokt - services: - - service_id: svc1 - endpoints: - - url: localhost:8082 - `, - }, - } - - // Initialize the Supplier Account by sending it some funds from the validator account that is part of genesis - network.InitAccount(t, net, supplierAccount.Address) - - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - // Wait for a new block to be committed - require.NoError(t, net.WaitForNextBlock()) - - // write the stake config to a file - configPath := testutil.WriteToNewTempFile(t, yaml.NormalizeYAMLIndentation(tt.config)).Name() - - // Prepare the arguments for the CLI command - args := []string{ - fmt.Sprintf("--config=%s", configPath), - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), - } - args = append(args, commonArgs...) - - // Execute the command - outStake, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdStakeSupplier(), args) - - // Validate the error if one is expected - if tt.err != nil { - stat, ok := status.FromError(tt.err) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.err.Error()) - return - } - require.NoError(t, err) - - // Check the response - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(outStake.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) - }) - } -} diff --git a/x/supplier/client/cli/tx_submit_proof.go b/x/supplier/client/cli/tx_submit_proof.go deleted file mode 100644 index 32a0604d3..000000000 --- a/x/supplier/client/cli/tx_submit_proof.go +++ /dev/null @@ -1,65 +0,0 @@ -package cli - -import ( - "encoding/base64" - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/spf13/cobra" - - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// TODO(@bryanchriswhite): Add unit tests for the CLI command when implementing the business logic. - -var _ = strconv.Itoa(0) - -func CmdSubmitProof() *cobra.Command { - cmd := &cobra.Command{ - Use: "submit-proof ", - Short: "Broadcast message submit-proof", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) (err error) { - sessionHeaderEncodedStr := args[0] - smstProofEncodedStr := args[1] - - // Get the session header - sessionHeaderBz, err := base64.StdEncoding.DecodeString(sessionHeaderEncodedStr) - if err != nil { - return err - } - sessionHeader := &sessiontypes.SessionHeader{} - cdc := codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) - cdc.MustUnmarshalJSON(sessionHeaderBz, sessionHeader) - - smstProof, err := base64.StdEncoding.DecodeString(smstProofEncodedStr) - if err != nil { - return err - } - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgSubmitProof( - clientCtx.GetFromAddress().String(), - sessionHeader, - smstProof, - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/supplier/client/cli/tx_unstake_supplier.go b/x/supplier/client/cli/tx_unstake_supplier.go deleted file mode 100644 index 434eceb24..000000000 --- a/x/supplier/client/cli/tx_unstake_supplier.go +++ /dev/null @@ -1,42 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func CmdUnstakeSupplier() *cobra.Command { - // fromAddress & signature is retrieved via `flags.FlagFrom` in the `clientCtx` - cmd := &cobra.Command{ - Use: "unstake-supplier", - Short: "Unstake a supplier", - Long: `Unstake an supplier with the provided parameters. This is a broadcast operation that will unstake the supplier specified by the 'from' address. - -Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx supplier unstake-supplier --keyring-backend test --from $(SUPPLIER) --node $(POCKET_NODE)`, - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) (err error) { - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgUnstakeSupplier( - clientCtx.GetFromAddress().String(), - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/supplier/client/cli/tx_unstake_supplier_test.go b/x/supplier/client/cli/tx_unstake_supplier_test.go deleted file mode 100644 index 179e5dce5..000000000 --- a/x/supplier/client/cli/tx_unstake_supplier_test.go +++ /dev/null @@ -1,97 +0,0 @@ -package cli_test - -import ( - "fmt" - "testing" - - sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/x/supplier/client/cli" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func TestCLI_UnstakeSupplier(t *testing.T) { - net, _ := networkWithSupplierObjects(t, 2) - val := net.Validators[0] - ctx := val.ClientCtx - - // Create a keyring and add an account for the supplier to be unstaked - kr := ctx.Keyring - accounts := testutil.CreateKeyringAccounts(t, kr, 1) - supplierAccount := accounts[0] - - // Update the context with the new keyring - ctx = ctx.WithKeyring(kr) - - // Common args used for all requests - commonArgs := []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), - } - - tests := []struct { - desc string - address string - err *sdkerrors.Error - }{ - { - desc: "unstake supplier: valid", - address: supplierAccount.Address.String(), - }, - { - desc: "unstake supplier: missing address", - // address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidAddress, - }, - { - desc: "unstake supplier: invalid address", - address: "invalid", - err: types.ErrSupplierInvalidAddress, - }, - } - - // Initialize the Supplier Account by sending it some funds from the validator account that is part of genesis - network.InitAccount(t, net, supplierAccount.Address) - - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - // Wait for a new block to be committed - require.NoError(t, net.WaitForNextBlock()) - - // Prepare the arguments for the CLI command - args := []string{ - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), - } - args = append(args, commonArgs...) - - // Execute the command - outUnstake, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdUnstakeSupplier(), args) - - // Validate the error if one is expected - if tt.err != nil { - stat, ok := status.FromError(tt.err) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.err.Error()) - return - } - require.NoError(t, err) - - // Check the response - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(outUnstake.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) - }) - } -} diff --git a/x/supplier/client/config/errors.go b/x/supplier/client/config/errors.go deleted file mode 100644 index 6a0194a75..000000000 --- a/x/supplier/client/config/errors.go +++ /dev/null @@ -1,15 +0,0 @@ -package config - -import sdkerrors "cosmossdk.io/errors" - -var ( - codespace = "supplierconfig" - ErrSupplierConfigUnmarshalYAML = sdkerrors.Register(codespace, 1, "config reader cannot unmarshal yaml content") - ErrSupplierConfigInvalidServiceId = sdkerrors.Register(codespace, 2, "invalid serviceId in supplier config") - ErrSupplierConfigNoEndpoints = sdkerrors.Register(codespace, 3, "no endpoints defined for serviceId in supplier config") - ErrSupplierConfigInvalidEndpointConfig = sdkerrors.Register(codespace, 4, "invalid endpoint config in supplier config") - ErrSupplierConfigInvalidRPCType = sdkerrors.Register(codespace, 5, "invalid rpc type in supplier config") - ErrSupplierConfigInvalidURL = sdkerrors.Register(codespace, 6, "invalid endpoint url in supplier config") - ErrSupplierConfigEmptyContent = sdkerrors.Register(codespace, 7, "empty supplier config content") - ErrSupplierConfigInvalidStake = sdkerrors.Register(codespace, 8, "invalid stake amount in supplier config") -) diff --git a/x/supplier/client/config/supplier_configs_reader.go b/x/supplier/client/config/supplier_configs_reader.go deleted file mode 100644 index c5f1aeffc..000000000 --- a/x/supplier/client/config/supplier_configs_reader.go +++ /dev/null @@ -1,193 +0,0 @@ -package config - -import ( - "net/url" - - "gopkg.in/yaml.v2" - - sdk "github.com/cosmos/cosmos-sdk/types" - - sharedhelpers "github.com/pokt-network/poktroll/x/shared/helpers" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// YAMLStakeConfig is the structure describing the supplier stake config file -type YAMLStakeConfig struct { - StakeAmount string `yaml:"stake_amount"` - Services []*YAMLStakeService `yaml:"services"` -} - -// YAMLStakeService is the structure describing a single service stake entry in the stake config file -type YAMLStakeService struct { - ServiceId string `yaml:"service_id"` - Endpoints []YAMLServiceEndpoint `yaml:"endpoints"` -} - -// YAMLServiceEndpoint is the structure describing a single service endpoint in the stake config file -type YAMLServiceEndpoint struct { - Url string `yaml:"url"` - RPCType string `yaml:"rpc_type"` - Config map[string]string `yaml:"config,omitempty"` -} - -// SupplierStakeConfig is the structure describing the parsed supplier stake config -type SupplierStakeConfig struct { - StakeAmount sdk.Coin - Services []*sharedtypes.SupplierServiceConfig -} - -// ParseSupplierServiceConfig parses the stake config file into a SupplierServiceConfig -func ParseSupplierConfigs(configContent []byte) (*SupplierStakeConfig, error) { - var stakeConfig *YAMLStakeConfig - - if len(configContent) == 0 { - return nil, ErrSupplierConfigEmptyContent - } - - // Unmarshal the stake config file into a stakeConfig - if err := yaml.Unmarshal(configContent, &stakeConfig); err != nil { - return nil, ErrSupplierConfigUnmarshalYAML.Wrapf("%s", err) - } - - // Validate the stake amount - if len(stakeConfig.StakeAmount) == 0 { - return nil, ErrSupplierConfigInvalidStake.Wrap("stake amount cannot be empty") - } - - stakeAmount, err := sdk.ParseCoinNormalized(stakeConfig.StakeAmount) - if err != nil { - return nil, ErrSupplierConfigInvalidStake.Wrap(err.Error()) - } - - if err := stakeAmount.Validate(); err != nil { - return nil, ErrSupplierConfigInvalidStake.Wrap(err.Error()) - } - - if stakeAmount.IsZero() { - return nil, ErrSupplierConfigInvalidStake.Wrap("stake amount cannot be zero") - } - - if stakeAmount.Denom != "upokt" { - return nil, ErrSupplierConfigInvalidStake.Wrapf( - "invalid stake denom, expecting: upokt, got: %s", - stakeAmount.Denom, - ) - } - - // Validate the services - if stakeConfig.Services == nil || len(stakeConfig.Services) == 0 { - return nil, ErrSupplierConfigInvalidServiceId.Wrap("serviceIds cannot be empty") - } - - // Prepare the supplierServiceConfig - supplierServiceConfig := make([]*sharedtypes.SupplierServiceConfig, 0, len(stakeConfig.Services)) - - // Populate the services slice - for _, svc := range stakeConfig.Services { - // Validate the serviceId - if !sharedhelpers.IsValidServiceId(svc.ServiceId) { - return nil, ErrSupplierConfigInvalidServiceId.Wrapf("%s", svc.ServiceId) - } - - if len(svc.Endpoints) == 0 { - return nil, ErrSupplierConfigNoEndpoints.Wrapf("%s", svc.ServiceId) - } - - // Create a supplied service config with the serviceId - service := &sharedtypes.SupplierServiceConfig{ - Service: &sharedtypes.Service{Id: svc.ServiceId}, - Endpoints: []*sharedtypes.SupplierEndpoint{}, - } - - // Iterate over the service endpoints and add their parsed representation to the supplied service config - for _, endpoint := range svc.Endpoints { - parsedEndpointEntry, err := parseEndpointEntry(endpoint) - if err != nil { - return nil, err - } - service.Endpoints = append(service.Endpoints, parsedEndpointEntry) - } - supplierServiceConfig = append(supplierServiceConfig, service) - } - - return &SupplierStakeConfig{ - StakeAmount: stakeAmount, - Services: supplierServiceConfig, - }, nil -} - -func parseEndpointEntry(endpoint YAMLServiceEndpoint) (*sharedtypes.SupplierEndpoint, error) { - endpointEntry := &sharedtypes.SupplierEndpoint{} - var err error - - // Endpoint URL - if endpointEntry.Url, err = validateEndpointURL(endpoint); err != nil { - return nil, err - } - - // Endpoint config - if endpointEntry.Configs, err = parseEndpointConfigs(endpoint); err != nil { - return nil, err - } - - // Endpoint RPC type - if endpointEntry.RpcType, err = parseEndpointRPCType(endpoint); err != nil { - return nil, err - } - - return endpointEntry, nil -} - -// validateEndpointURL validates the endpoint URL, making sure that the string provided is a valid URL -func validateEndpointURL(endpoint YAMLServiceEndpoint) (string, error) { - // Validate the endpoint URL - if _, err := url.Parse(endpoint.Url); err != nil { - return "", ErrSupplierConfigInvalidURL.Wrapf("%s", err) - } - - return endpoint.Url, nil -} - -// parseEndpointConfigs parses the endpoint config entries into a slice of ConfigOption -// compatible with the SupplierEndpointConfig. -// It accepts a nil config entry or a map of valid config keys. -func parseEndpointConfigs(endpoint YAMLServiceEndpoint) ([]*sharedtypes.ConfigOption, error) { - // Prepare the endpoint configs slice - endpointConfigs := []*sharedtypes.ConfigOption{} - - // If we have an endpoint config entry, parse it into a slice of ConfigOption - if endpoint.Config == nil { - return endpointConfigs, nil - } - - // Iterate over the endpoint config entries and add them to the slice of ConfigOption - for key, value := range endpoint.Config { - var configKey sharedtypes.ConfigOptions - - // Make sure the config key is valid - switch key { - case "timeout": - configKey = sharedtypes.ConfigOptions_TIMEOUT - default: - return nil, ErrSupplierConfigInvalidEndpointConfig.Wrapf("%s", key) - } - - config := &sharedtypes.ConfigOption{ - Key: configKey, - Value: value, - } - endpointConfigs = append(endpointConfigs, config) - } - - return endpointConfigs, nil -} - -// parseEndpointRPCType parses the endpoint RPC type into a sharedtypes.RPCType -func parseEndpointRPCType(endpoint YAMLServiceEndpoint) (sharedtypes.RPCType, error) { - switch endpoint.RPCType { - case "json_rpc": - return sharedtypes.RPCType_JSON_RPC, nil - default: - return sharedtypes.RPCType_UNKNOWN_RPC, ErrSupplierConfigInvalidRPCType.Wrapf("%s", endpoint.RPCType) - } -} diff --git a/x/supplier/client/config/supplier_configs_reader_test.go b/x/supplier/client/config/supplier_configs_reader_test.go deleted file mode 100644 index 546a735c3..000000000 --- a/x/supplier/client/config/supplier_configs_reader_test.go +++ /dev/null @@ -1,407 +0,0 @@ -package config_test - -import ( - "testing" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/gogo/status" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/yaml" - "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/client/config" -) - -func Test_ParseSupplierConfigs(t *testing.T) { - tests := []struct { - desc string - expectedError *sdkerrors.Error - expectedConfig *config.SupplierStakeConfig - inputConfig string - }{ - // Valid Configs - { - desc: "services_test: valid full service config", - inputConfig: ` - stake_amount: 1000upokt - services: - - service_id: svc - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - timeout: 10 - `, - expectedError: nil, - expectedConfig: &config.SupplierStakeConfig{ - StakeAmount: sdk.NewCoin("upokt", sdk.NewInt(1000)), - Services: []*types.SupplierServiceConfig{ - { - Service: &types.Service{Id: "svc"}, - Endpoints: []*types.SupplierEndpoint{ - { - Url: "http://pokt.network:8081", - RpcType: types.RPCType_JSON_RPC, - Configs: []*types.ConfigOption{ - { - Key: types.ConfigOptions_TIMEOUT, - Value: "10", - }, - }, - }, - }, - }, - }, - }, - }, - { - desc: "services_test: valid service config without endpoint config", - inputConfig: ` - stake_amount: 1000upokt - services: - - service_id: svc - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - `, - expectedError: nil, - expectedConfig: &config.SupplierStakeConfig{ - StakeAmount: sdk.NewCoin("upokt", sdk.NewInt(1000)), - Services: []*types.SupplierServiceConfig{ - { - Service: &types.Service{Id: "svc"}, - Endpoints: []*types.SupplierEndpoint{ - { - Url: "http://pokt.network:8081", - RpcType: types.RPCType_JSON_RPC, - }, - }, - }, - }, - }, - }, - { - desc: "services_test: valid service config with empty endpoint config", - inputConfig: ` - stake_amount: 1000upokt - services: - - service_id: svc - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - `, - expectedError: nil, - expectedConfig: &config.SupplierStakeConfig{ - StakeAmount: sdk.NewCoin("upokt", sdk.NewInt(1000)), - Services: []*types.SupplierServiceConfig{ - { - Service: &types.Service{Id: "svc"}, - Endpoints: []*types.SupplierEndpoint{ - { - Url: "http://pokt.network:8081", - RpcType: types.RPCType_JSON_RPC, - Configs: []*types.ConfigOption{}, - }, - }, - }, - }, - }, - }, - { - desc: "services_test: valid service config with multiple endpoints", - inputConfig: ` - stake_amount: 1000upokt - services: - - service_id: svc - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - timeout: 10 - - url: http://pokt.network:8082 - rpc_type: json_rpc - config: - timeout: 11 - `, - expectedError: nil, - expectedConfig: &config.SupplierStakeConfig{ - StakeAmount: sdk.NewCoin("upokt", sdk.NewInt(1000)), - Services: []*types.SupplierServiceConfig{ - { - Service: &types.Service{Id: "svc"}, - Endpoints: []*types.SupplierEndpoint{ - { - Url: "http://pokt.network:8081", - RpcType: types.RPCType_JSON_RPC, - Configs: []*types.ConfigOption{ - { - Key: types.ConfigOptions_TIMEOUT, - Value: "10", - }, - }, - }, - { - Url: "http://pokt.network:8082", - RpcType: types.RPCType_JSON_RPC, - Configs: []*types.ConfigOption{ - { - Key: types.ConfigOptions_TIMEOUT, - Value: "11", - }, - }, - }, - }, - }, - }, - }, - }, - { - desc: "services_test: valid service config with multiple services", - expectedError: nil, - inputConfig: ` - stake_amount: 1000upokt - services: - - service_id: svc1 - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - timeout: 10 - - service_id: svc2 - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - timeout: 10 - `, - expectedConfig: &config.SupplierStakeConfig{ - StakeAmount: sdk.NewCoin("upokt", sdk.NewInt(1000)), - Services: []*types.SupplierServiceConfig{ - { - Service: &types.Service{Id: "svc1"}, - Endpoints: []*types.SupplierEndpoint{ - { - Url: "http://pokt.network:8081", - RpcType: types.RPCType_JSON_RPC, - Configs: []*types.ConfigOption{ - { - Key: types.ConfigOptions_TIMEOUT, - Value: "10", - }, - }, - }, - }, - }, - { - Service: &types.Service{Id: "svc2"}, - Endpoints: []*types.SupplierEndpoint{ - { - Url: "http://pokt.network:8081", - RpcType: types.RPCType_JSON_RPC, - Configs: []*types.ConfigOption{ - { - Key: types.ConfigOptions_TIMEOUT, - Value: "10", - }, - }, - }, - }, - }, - }, - }, - }, - // Invalid Configs - { - desc: "services_test: invalid service config without service ID", - inputConfig: ` - stake_amount: 1000upokt - services: - - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - timeout: 10 - `, - expectedError: config.ErrSupplierConfigInvalidServiceId, - }, - { - desc: "services_test: invalid service config with empty service ID", - inputConfig: ` - stake_amount: 1000upokt - services: - - service_id: - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - timeout: 10 - `, - expectedError: config.ErrSupplierConfigInvalidServiceId, - }, - { - desc: "services_test: invalid service config without endpoints", - inputConfig: ` - stake_amount: 1000upokt - services: - - service_id: svc - `, - expectedError: config.ErrSupplierConfigNoEndpoints, - }, - { - desc: "services_test: invalid service config with empty endpoints", - inputConfig: ` - stake_amount: 1000upokt - services: - - service_id: svc - endpoints: - `, - expectedError: config.ErrSupplierConfigNoEndpoints, - }, - { - desc: "services_test: invalid service config with unknown endpoint config key", - inputConfig: ` - stake_amount: 1000upokt - services: - - service_id: svc - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - somekey: 10 - `, - expectedError: config.ErrSupplierConfigInvalidEndpointConfig, - }, - { - desc: "services_test: invalid service config with unknown endpoint rpc type", - inputConfig: ` - stake_amount: 1000upokt - services: - - service_id: svc - endpoints: - - url: http://pokt.network:8081 - rpc_type: somerpc - config: - timeout: 10 - `, - expectedError: config.ErrSupplierConfigInvalidRPCType, - }, - { - desc: "services_test: invalid service config with invalid endpoint url", - inputConfig: ` - stake_amount: 1000upokt - services: - - service_id: svc - endpoints: - - url: ::invalid_url - rpc_type: json_rpc - config: - timeout: 10 - `, - expectedError: config.ErrSupplierConfigInvalidURL, - }, - { - desc: "services_test: invalid service config with empty content", - expectedError: config.ErrSupplierConfigEmptyContent, - inputConfig: ``, - }, - { - desc: "services_test: missing stake amount", - inputConfig: ` - services: - - service_id: svc - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - timeout: 10 - `, - expectedError: config.ErrSupplierConfigInvalidStake, - }, - { - desc: "services_test: invalid stake denom", - inputConfig: ` - stake_amount: 1000invalid - services: - - service_id: svc - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - timeout: 10 - `, - expectedError: config.ErrSupplierConfigInvalidStake, - }, - { - desc: "services_test: negative stake amount", - inputConfig: ` - stake_amount: -1000upokt - services: - - service_id: svc - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - timeout: 10 - `, - expectedError: config.ErrSupplierConfigInvalidStake, - }, - { - desc: "services_test: zero stake amount", - inputConfig: ` - stake_amount: 0upokt - services: - - service_id: svc - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - timeout: 10 - `, - expectedError: config.ErrSupplierConfigInvalidStake, - }, - } - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - normalizedConfig := yaml.NormalizeYAMLIndentation(tt.inputConfig) - supplierServiceConfig, err := config.ParseSupplierConfigs([]byte(normalizedConfig)) - - if tt.expectedError != nil { - require.Error(t, err) - require.ErrorIs(t, err, tt.expectedError) - stat, ok := status.FromError(tt.expectedError) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.expectedError.Error()) - require.Nil(t, supplierServiceConfig) - return - } - - require.NoError(t, err) - - require.Equal(t, tt.expectedConfig.StakeAmount, supplierServiceConfig.StakeAmount) - require.Equal(t, tt.expectedConfig.StakeAmount.Denom, supplierServiceConfig.StakeAmount.Denom) - - require.Equal(t, len(tt.expectedConfig.Services), len(supplierServiceConfig.Services)) - for i, expected := range tt.expectedConfig.Services { - - require.Equal(t, expected.Service.Id, supplierServiceConfig.Services[i].Service.Id) - - require.Equal(t, len(expected.Endpoints), len(supplierServiceConfig.Services[i].Endpoints)) - for j, expectedEndpoint := range expected.Endpoints { - - require.Equal(t, expectedEndpoint.Url, supplierServiceConfig.Services[i].Endpoints[j].Url) - require.Equal(t, expectedEndpoint.RpcType, supplierServiceConfig.Services[i].Endpoints[j].RpcType) - - require.Equal(t, len(expectedEndpoint.Configs), len(supplierServiceConfig.Services[i].Endpoints[j].Configs)) - for k, expectedConfig := range expectedEndpoint.Configs { - - require.Equal(t, expectedConfig.Key, supplierServiceConfig.Services[i].Endpoints[j].Configs[k].Key) - require.Equal(t, expectedConfig.Value, supplierServiceConfig.Services[i].Endpoints[j].Configs[k].Value) - } - } - } - }) - } -} diff --git a/x/supplier/genesis.go b/x/supplier/genesis.go deleted file mode 100644 index 156d80118..000000000 --- a/x/supplier/genesis.go +++ /dev/null @@ -1,30 +0,0 @@ -package supplier - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// TODO_TECHDEBT(@Olshansk): Remove existing claims from genesis. -// InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - // Set all the supplier - for _, supplier := range genState.SupplierList { - k.SetSupplier(ctx, supplier) - } - // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) -} - -// ExportGenesis returns the module's exported genesis -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) - - genesis.SupplierList = k.GetAllSupplier(ctx) - // this line is used by starport scaffolding # genesis/module/export - - return genesis -} diff --git a/x/supplier/genesis_test.go b/x/supplier/genesis_test.go deleted file mode 100644 index da9245955..000000000 --- a/x/supplier/genesis_test.go +++ /dev/null @@ -1,72 +0,0 @@ -package supplier_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/testutil/sample" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// Please see `x/supplier/types/genesis_test.go` for extensive tests related to the validity of the genesis state. -func TestGenesis(t *testing.T) { - genesisState := types.GenesisState{ - Params: types.DefaultParams(), - SupplierList: []sharedtypes.Supplier{ - { - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId1", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8081", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - { - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId2", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8082", - RpcType: sharedtypes.RPCType_GRPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - }, - // this line is used by starport scaffolding # genesis/test/state - } - - k, ctx := keepertest.SupplierKeeper(t, nil) - supplier.InitGenesis(ctx, *k, genesisState) - got := supplier.ExportGenesis(ctx, *k) - require.NotNil(t, got) - - nullify.Fill(&genesisState) - nullify.Fill(got) - - require.ElementsMatch(t, genesisState.SupplierList, got.SupplierList) - // this line is used by starport scaffolding # genesis/test/assert -} diff --git a/x/supplier/keeper/claim.go b/x/supplier/keeper/claim.go deleted file mode 100644 index b73cfee84..000000000 --- a/x/supplier/keeper/claim.go +++ /dev/null @@ -1,160 +0,0 @@ -package keeper - -import ( - "encoding/binary" - "fmt" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// UpsertClaim inserts or updates a specific claim in the store by index. -func (k Keeper) UpsertClaim(ctx sdk.Context, claim types.Claim) { - logger := k.Logger(ctx).With("method", "UpsertClaim") - - claimBz := k.cdc.MustMarshal(&claim) - parentStore := ctx.KVStore(k.storeKey) - - // Update the primary store: ClaimPrimaryKey -> ClaimObject - primaryStore := prefix.NewStore(parentStore, types.KeyPrefix(types.ClaimPrimaryKeyPrefix)) - sessionId := claim.GetSessionHeader().GetSessionId() - primaryKey := types.ClaimPrimaryKey(sessionId, claim.SupplierAddress) - primaryStore.Set(primaryKey, claimBz) - - logger.Info(fmt.Sprintf("upserted claim for supplier %s with primaryKey %s", claim.SupplierAddress, primaryKey)) - - // Update the address index: supplierAddress -> [ClaimPrimaryKey] - addressStoreIndex := prefix.NewStore(parentStore, types.KeyPrefix(types.ClaimSupplierAddressPrefix)) - addressKey := types.ClaimSupplierAddressKey(claim.SupplierAddress, primaryKey) - addressStoreIndex.Set(addressKey, primaryKey) - - logger.Info(fmt.Sprintf("indexed claim for supplier %s with primaryKey %s", claim.SupplierAddress, primaryKey)) - - // Update the session end height index: sessionEndHeight -> [ClaimPrimaryKey] - sessionHeightStoreIndex := prefix.NewStore(parentStore, types.KeyPrefix(types.ClaimSessionEndHeightPrefix)) - sessionEndBlockHeight := claim.GetSessionHeader().GetSessionEndBlockHeight() - heightKey := types.ClaimSupplierEndSessionHeightKey(sessionEndBlockHeight, primaryKey) - sessionHeightStoreIndex.Set(heightKey, primaryKey) - - logger.Info(fmt.Sprintf("indexed claim for supplier %s at session ending height %d", claim.SupplierAddress, sessionEndBlockHeight)) -} - -// RemoveClaim removes a claim from the store -func (k Keeper) RemoveClaim(ctx sdk.Context, sessionId, supplierAddr string) { - logger := k.Logger(ctx).With("method", "RemoveClaim") - - parentStore := ctx.KVStore(k.storeKey) - primaryStore := prefix.NewStore(parentStore, types.KeyPrefix(types.ClaimPrimaryKeyPrefix)) - - // Check if the claim exists - primaryKey := types.ClaimPrimaryKey(sessionId, supplierAddr) - claim, foundClaim := k.getClaimByPrimaryKey(ctx, primaryKey) - if !foundClaim { - logger.Error(fmt.Sprintf("trying to delete non-existent claim with primary key %s for supplier %s and session %s", primaryKey, supplierAddr, sessionId)) - return - } - - // Prepare the indices for deletion - addressStoreIndex := prefix.NewStore(parentStore, types.KeyPrefix(types.ClaimSupplierAddressPrefix)) - sessionHeightStoreIndex := prefix.NewStore(parentStore, types.KeyPrefix(types.ClaimSessionEndHeightPrefix)) - - addressKey := types.ClaimSupplierAddressKey(claim.SupplierAddress, primaryKey) - sessionEndBlockHeight := claim.GetSessionHeader().GetSessionEndBlockHeight() - heightKey := types.ClaimSupplierEndSessionHeightKey(sessionEndBlockHeight, primaryKey) - - // Delete all the entries (primary store and secondary indices) - primaryStore.Delete(primaryKey) - addressStoreIndex.Delete(addressKey) - sessionHeightStoreIndex.Delete(heightKey) - - logger.Info(fmt.Sprintf("deleted claim with primary key %s for supplier %s and session %s", primaryKey, supplierAddr, sessionId)) -} - -// GetClaim returns a Claim given a SessionId & SupplierAddr -func (k Keeper) GetClaim(ctx sdk.Context, sessionId, supplierAddr string) (val types.Claim, found bool) { - primaryKey := types.ClaimPrimaryKey(sessionId, supplierAddr) - return k.getClaimByPrimaryKey(ctx, primaryKey) -} - -// GetAllClaims returns all claim -func (k Keeper) GetAllClaims(ctx sdk.Context) (claims []types.Claim) { - primaryStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ClaimPrimaryKeyPrefix)) - iterator := sdk.KVStorePrefixIterator(primaryStore, []byte{}) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var val types.Claim - k.cdc.MustUnmarshal(iterator.Value(), &val) - claims = append(claims, val) - } - - return -} - -// GetClaimsByAddress returns all claims for a given supplier address -func (k Keeper) GetClaimsByAddress(ctx sdk.Context, address string) (claims []types.Claim) { - addressStoreIndex := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ClaimSupplierAddressPrefix)) - - iterator := sdk.KVStorePrefixIterator(addressStoreIndex, []byte(address)) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - primaryKey := iterator.Value() - claim, claimFound := k.getClaimByPrimaryKey(ctx, primaryKey) - if claimFound { - claims = append(claims, claim) - } - } - - return claims -} - -// GetClaimsByAddress returns all claims whose session ended at the given block height -func (k Keeper) GetClaimsByHeight(ctx sdk.Context, height uint64) (claims []types.Claim) { - sessionHeightStoreIndex := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ClaimSessionEndHeightPrefix)) - - heightBz := make([]byte, 8) - binary.BigEndian.PutUint64(heightBz, height) - - iterator := sdk.KVStorePrefixIterator(sessionHeightStoreIndex, heightBz) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - primaryKey := iterator.Value() - claim, claimFound := k.getClaimByPrimaryKey(ctx, primaryKey) - if claimFound { - claims = append(claims, claim) - } - } - - return claims -} - -// GetClaimsByAddress returns all claims matching the given session id -func (k Keeper) GetClaimsBySession(ctx sdk.Context, sessionId string) (claims []types.Claim) { - sessionIdStoreIndex := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ClaimPrimaryKeyPrefix)) - - iterator := sdk.KVStorePrefixIterator(sessionIdStoreIndex, []byte(sessionId)) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var val types.Claim - k.cdc.MustUnmarshal(iterator.Value(), &val) - claims = append(claims, val) - } - - return claims -} - -// getClaimByPrimaryKey is a helper that retrieves, if exists, the Claim associated with the key provided -func (k Keeper) getClaimByPrimaryKey(ctx sdk.Context, primaryKey []byte) (val types.Claim, found bool) { - primaryStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ClaimPrimaryKeyPrefix)) - b := primaryStore.Get(primaryKey) - if b == nil { - return val, false - } - k.cdc.MustUnmarshal(b, &val) - return val, true -} diff --git a/x/supplier/keeper/claim_test.go b/x/supplier/keeper/claim_test.go deleted file mode 100644 index 475350752..000000000 --- a/x/supplier/keeper/claim_test.go +++ /dev/null @@ -1,116 +0,0 @@ -package keeper_test - -import ( - "fmt" - "strconv" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/testutil/sample" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func createNClaims(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Claim { - claims := make([]types.Claim, n) - for i := range claims { - claims[i].SupplierAddress = sample.AccAddress() - claims[i].SessionHeader = &sessiontypes.SessionHeader{ - SessionId: fmt.Sprintf("session-%d", i), - SessionEndBlockHeight: int64(i), - } - claims[i].RootHash = []byte(fmt.Sprintf("rootHash-%d", i)) - keeper.UpsertClaim(ctx, claims[i]) - } - return claims -} - -func TestClaim_Get(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - claims := createNClaims(keeper, ctx, 10) - for _, claim := range claims { - foundClaim, isClaimFound := keeper.GetClaim(ctx, - claim.GetSessionHeader().GetSessionId(), - claim.SupplierAddress, - ) - require.True(t, isClaimFound) - require.Equal(t, - nullify.Fill(&claim), - nullify.Fill(&foundClaim), - ) - } -} -func TestClaim_Remove(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - claims := createNClaims(keeper, ctx, 10) - for _, claim := range claims { - sessionId := claim.GetSessionHeader().GetSessionId() - keeper.RemoveClaim(ctx, - sessionId, - claim.SupplierAddress, - ) - _, isClaimFound := keeper.GetClaim(ctx, - sessionId, - claim.SupplierAddress, - ) - require.False(t, isClaimFound) - } -} - -func TestClaim_GetAll(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - claims := createNClaims(keeper, ctx, 10) - - // Get all the claims and check if they match - allFoundClaims := keeper.GetAllClaims(ctx) - require.ElementsMatch(t, - nullify.Fill(claims), - nullify.Fill(allFoundClaims), - ) -} - -func TestClaim_GetAll_ByAddress(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - claims := createNClaims(keeper, ctx, 10) - - // Get all claims for a given address - allFoundClaimsByAddress := keeper.GetClaimsByAddress(ctx, claims[3].SupplierAddress) - require.ElementsMatch(t, - nullify.Fill([]types.Claim{claims[3]}), - nullify.Fill(allFoundClaimsByAddress), - ) -} - -func TestClaim_GetAll_ByHeight(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - claims := createNClaims(keeper, ctx, 10) - - // Get all claims for a given ending session block height - sessionEndHeight := claims[6].GetSessionHeader().GetSessionEndBlockHeight() - allFoundClaimsEndingAtHeight := keeper.GetClaimsByHeight(ctx, uint64(sessionEndHeight)) - require.ElementsMatch(t, - nullify.Fill([]types.Claim{claims[6]}), - nullify.Fill(allFoundClaimsEndingAtHeight), - ) -} - -func TestClaim_GetAll_BySession(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - claims := createNClaims(keeper, ctx, 10) - - // Get all claims for a given ending session block height - sessionId := claims[8].GetSessionHeader().GetSessionId() - allFoundClaimsForSession := keeper.GetClaimsBySession(ctx, sessionId) - require.ElementsMatch(t, - nullify.Fill([]types.Claim{claims[8]}), - nullify.Fill(allFoundClaimsForSession), - ) -} diff --git a/x/supplier/keeper/keeper.go b/x/supplier/keeper/keeper.go deleted file mode 100644 index 709c94c30..000000000 --- a/x/supplier/keeper/keeper.go +++ /dev/null @@ -1,60 +0,0 @@ -package keeper - -import ( - "fmt" - - "github.com/cometbft/cometbft/libs/log" - "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -type ( - Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace - - bankKeeper types.BankKeeper - sessionKeeper types.SessionKeeper - } -) - -func NewKeeper( - cdc codec.BinaryCodec, - storeKey, - memKey storetypes.StoreKey, - ps paramtypes.Subspace, - - bankKeeper types.BankKeeper, -) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } - - return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramstore: ps, - - bankKeeper: bankKeeper, - } -} - -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} - -// TODO_TECHDEBT: Evaluate if this is still necessary after the upgrade to cosmos 0.5x -// SupplySessionKeeper assigns the session keeper dependency of this supplier -// keeper. This MUST be done as a separate step from construction because there -// is a circular dependency between the supplier and session keepers. -func (k *Keeper) SupplySessionKeeper(sessionKeeper types.SessionKeeper) { - k.sessionKeeper = sessionKeeper -} diff --git a/x/supplier/keeper/msg_server.go b/x/supplier/keeper/msg_server.go deleted file mode 100644 index 83879071c..000000000 --- a/x/supplier/keeper/msg_server.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/supplier/types" -) - -type msgServer struct { - Keeper -} - -// NewMsgServerImpl returns an implementation of the MsgServer interface -// for the provided Keeper. -func NewMsgServerImpl(keeper Keeper) types.MsgServer { - return &msgServer{Keeper: keeper} -} - -var _ types.MsgServer = msgServer{} diff --git a/x/supplier/keeper/msg_server_create_claim.go b/x/supplier/keeper/msg_server_create_claim.go deleted file mode 100644 index 3f4b0df30..000000000 --- a/x/supplier/keeper/msg_server_create_claim.go +++ /dev/null @@ -1,72 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" -) - -func (k msgServer) CreateClaim(goCtx context.Context, msg *suppliertypes.MsgCreateClaim) (*suppliertypes.MsgCreateClaimResponse, error) { - // TODO_BLOCKER: Prevent Claim upserts after the ClaimWindow is closed. - // TODO_BLOCKER: Validate the signature on the Claim message corresponds to the supplier before Upserting. - - ctx := sdk.UnwrapSDKContext(goCtx) - logger := k.Logger(ctx).With("method", "CreateClaim") - - if err := msg.ValidateBasic(); err != nil { - return nil, err - } - - session, err := k.queryAndValidateSessionHeader( - goCtx, - msg.GetSessionHeader(), - msg.GetSupplierAddress(), - ) - if err != nil { - return nil, err - } - - logger. - With( - "session_id", session.GetSessionId(), - "session_end_height", msg.GetSessionHeader().GetSessionEndBlockHeight(), - "supplier", msg.GetSupplierAddress(), - ). - Debug("validated claim") - - /* - TODO_INCOMPLETE: - - ### Msg distribution validation (depends on sessionRes validation) - 1. [ ] governance-based earliest block offset - 2. [ ] pseudo-randomize earliest block offset - - ### Claim validation - 1. [x] sessionRes validation - 2. [ ] msg distribution validation - */ - - // Construct and upsert claim after all validation. - claim := suppliertypes.Claim{ - SupplierAddress: msg.GetSupplierAddress(), - SessionHeader: msg.GetSessionHeader(), - RootHash: msg.RootHash, - } - - // TODO_BLOCKER: check if this claim already exists and return an appropriate error - // in any case where the supplier should no longer be able to update the given proof. - k.Keeper.UpsertClaim(ctx, claim) - - logger. - With( - "session_id", claim.GetSessionHeader().GetSessionId(), - "session_end_height", claim.GetSessionHeader().GetSessionEndBlockHeight(), - "supplier", claim.GetSupplierAddress(), - ). - Debug("created claim") - - // TODO: return the claim in the response. - return &suppliertypes.MsgCreateClaimResponse{}, nil -} diff --git a/x/supplier/keeper/msg_server_create_claim_test.go b/x/supplier/keeper/msg_server_create_claim_test.go deleted file mode 100644 index 93bd2b5b2..000000000 --- a/x/supplier/keeper/msg_server_create_claim_test.go +++ /dev/null @@ -1,121 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/testutil/supplier" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" -) - -const testServiceId = "svc1" - -func TestMsgServer_CreateClaim_Success(t *testing.T) { - appSupplierPair := supplier.AppSupplierPair{ - AppAddr: sample.AccAddress(), - SupplierAddr: sample.AccAddress(), - } - service := &sharedtypes.Service{Id: testServiceId} - sessionFixturesByAddr := supplier.NewSessionFixturesWithPairings(t, service, appSupplierPair) - - supplierKeeper, sdkCtx := keepertest.SupplierKeeper(t, sessionFixturesByAddr) - srv := keeper.NewMsgServerImpl(*supplierKeeper) - ctx := sdk.WrapSDKContext(sdkCtx) - - claimMsg := newTestClaimMsg(t) - claimMsg.SupplierAddress = appSupplierPair.SupplierAddr - claimMsg.SessionHeader.ApplicationAddress = appSupplierPair.AppAddr - - createClaimRes, err := srv.CreateClaim(ctx, claimMsg) - require.NoError(t, err) - require.NotNil(t, createClaimRes) - - claimRes, err := supplierKeeper.AllClaims(sdkCtx, &types.QueryAllClaimsRequest{}) - require.NoError(t, err) - - claims := claimRes.GetClaim() - require.Lenf(t, claims, 1, "expected 1 claim, got %d", len(claims)) - require.Equal(t, claimMsg.SessionHeader.SessionId, claims[0].GetSessionHeader().GetSessionId()) - require.Equal(t, claimMsg.SupplierAddress, claims[0].GetSupplierAddress()) - require.Equal(t, claimMsg.SessionHeader.GetSessionEndBlockHeight(), claims[0].GetSessionHeader().GetSessionEndBlockHeight()) - require.Equal(t, claimMsg.RootHash, claims[0].GetRootHash()) -} - -func TestMsgServer_CreateClaim_Error(t *testing.T) { - service := &sharedtypes.Service{Id: testServiceId} - appSupplierPair := supplier.AppSupplierPair{ - AppAddr: sample.AccAddress(), - SupplierAddr: sample.AccAddress(), - } - sessionFixturesByAppAddr := supplier.NewSessionFixturesWithPairings(t, service, appSupplierPair) - - supplierKeeper, sdkCtx := keepertest.SupplierKeeper(t, sessionFixturesByAppAddr) - srv := keeper.NewMsgServerImpl(*supplierKeeper) - ctx := sdk.WrapSDKContext(sdkCtx) - - tests := []struct { - desc string - claimMsgFn func(t *testing.T) *types.MsgCreateClaim - expectedErr error - }{ - { - desc: "on-chain session ID must match claim msg session ID", - claimMsgFn: func(t *testing.T) *types.MsgCreateClaim { - msg := newTestClaimMsg(t) - msg.SupplierAddress = appSupplierPair.SupplierAddr - msg.SessionHeader.ApplicationAddress = appSupplierPair.AppAddr - msg.SessionHeader.SessionId = "invalid_session_id" - - return msg - }, - expectedErr: types.ErrSupplierInvalidSessionId, - }, - { - desc: "claim msg supplier address must be in the session", - claimMsgFn: func(t *testing.T) *types.MsgCreateClaim { - msg := newTestClaimMsg(t) - msg.SessionHeader.ApplicationAddress = appSupplierPair.AppAddr - - // Overwrite supplier address to one not included in the session fixtures. - msg.SupplierAddress = sample.AccAddress() - - return msg - }, - expectedErr: types.ErrSupplierNotFound, - }, - } - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - createClaimRes, err := srv.CreateClaim(ctx, tt.claimMsgFn(t)) - require.ErrorIs(t, err, tt.expectedErr) - require.Nil(t, createClaimRes) - }) - } -} - -func newTestClaimMsg(t *testing.T) *suppliertypes.MsgCreateClaim { - t.Helper() - - return suppliertypes.NewMsgCreateClaim( - sample.AccAddress(), - &sessiontypes.SessionHeader{ - ApplicationAddress: sample.AccAddress(), - SessionStartBlockHeight: 1, - SessionId: "mock_session_id", - Service: &sharedtypes.Service{ - Id: "svc1", - Name: "svc1", - }, - }, - []byte{0, 0, 0, 0}, - ) -} diff --git a/x/supplier/keeper/msg_server_stake_supplier.go b/x/supplier/keeper/msg_server_stake_supplier.go deleted file mode 100644 index edd8ecee8..000000000 --- a/x/supplier/keeper/msg_server_stake_supplier.go +++ /dev/null @@ -1,106 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func (k msgServer) StakeSupplier( - goCtx context.Context, - msg *types.MsgStakeSupplier, -) (*types.MsgStakeSupplierResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - logger := k.Logger(ctx).With("method", "StakeSupplier") - logger.Info(fmt.Sprintf("About to stake supplier with msg: %v", msg)) - - if err := msg.ValidateBasic(); err != nil { - logger.Error(fmt.Sprintf("invalid MsgStakeSupplier: %v", msg)) - return nil, err - } - - // Check if the supplier already exists or not - var err error - var coinsToDelegate sdk.Coin - supplier, isSupplierFound := k.GetSupplier(ctx, msg.Address) - if !isSupplierFound { - logger.Info(fmt.Sprintf("Supplier not found. Creating new supplier for address %s", msg.Address)) - supplier = k.createSupplier(ctx, msg) - coinsToDelegate = *msg.Stake - } else { - logger.Info(fmt.Sprintf("Supplier found. Updating supplier for address %s", msg.Address)) - currSupplierStake := *supplier.Stake - if err = k.updateSupplier(ctx, &supplier, msg); err != nil { - return nil, err - } - coinsToDelegate = (*msg.Stake).Sub(currSupplierStake) - } - - // Retrieve the address of the supplier - supplierAddress, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) - return nil, err - } - - // TODO_IMPROVE: Should we avoid making this call if `coinsToDelegate` = 0? - // Send the coins from the supplier to the staked supplier pool - err = k.bankKeeper.DelegateCoinsFromAccountToModule(ctx, supplierAddress, types.ModuleName, []sdk.Coin{coinsToDelegate}) - if err != nil { - logger.Error(fmt.Sprintf("could not send %v coins from %s to %s module account due to %v", coinsToDelegate, supplierAddress, types.ModuleName, err)) - return nil, err - } - - // Update the Supplier in the store - k.SetSupplier(ctx, supplier) - logger.Info(fmt.Sprintf("Successfully updated supplier stake for supplier: %+v", supplier)) - - return &types.MsgStakeSupplierResponse{}, nil -} - -func (k msgServer) createSupplier( - ctx sdk.Context, - msg *types.MsgStakeSupplier, -) sharedtypes.Supplier { - return sharedtypes.Supplier{ - Address: msg.Address, - Stake: msg.Stake, - Services: msg.Services, - } -} - -func (k msgServer) updateSupplier( - ctx sdk.Context, - supplier *sharedtypes.Supplier, - msg *types.MsgStakeSupplier, -) error { - // Checks if the the msg address is the same as the current owner - if msg.Address != supplier.Address { - return sdkerrors.Wrapf(types.ErrSupplierUnauthorized, "msg Address (%s) != supplier address (%s)", msg.Address, supplier.Address) - } - - // Validate that the stake is not being lowered - if msg.Stake == nil { - return sdkerrors.Wrapf(types.ErrSupplierInvalidStake, "stake amount cannot be nil") - } - if msg.Stake.IsLTE(*supplier.Stake) { - - return sdkerrors.Wrapf(types.ErrSupplierInvalidStake, "stake amount %v must be higher than previous stake amount %v", msg.Stake, supplier.Stake) - } - supplier.Stake = msg.Stake - - // Validate that the service configs maintain at least one service. - // Additional validation is done in `msg.ValidateBasic` above. - if len(msg.Services) == 0 { - return sdkerrors.Wrapf(types.ErrSupplierInvalidServiceConfig, "must have at least one service") - } - supplier.Services = msg.Services - - return nil -} diff --git a/x/supplier/keeper/msg_server_stake_supplier_test.go b/x/supplier/keeper/msg_server_stake_supplier_test.go deleted file mode 100644 index bbc74cd6e..000000000 --- a/x/supplier/keeper/msg_server_stake_supplier_test.go +++ /dev/null @@ -1,236 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func TestMsgServer_StakeSupplier_SuccessfulCreateAndUpdate(t *testing.T) { - k, ctx := keepertest.SupplierKeeper(t, nil) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the supplier - addr := sample.AccAddress() - - // Verify that the supplier does not exist yet - _, isSupplierFound := k.GetSupplier(ctx, addr) - require.False(t, isSupplierFound) - - // Prepare the stakeMsg - stakeMsg := &types.MsgStakeSupplier{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8080", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - } - - // Stake the supplier - _, err := srv.StakeSupplier(wctx, stakeMsg) - require.NoError(t, err) - - // Verify that the supplier exists - supplierFound, isSupplierFound := k.GetSupplier(ctx, addr) - require.True(t, isSupplierFound) - require.Equal(t, addr, supplierFound.Address) - require.Equal(t, int64(100), supplierFound.Stake.Amount.Int64()) - require.Len(t, supplierFound.Services, 1) - require.Equal(t, "svcId", supplierFound.Services[0].Service.Id) - require.Len(t, supplierFound.Services[0].Endpoints, 1) - require.Equal(t, "http://localhost:8080", supplierFound.Services[0].Endpoints[0].Url) - - // Prepare an updated supplier with a higher stake and a different URL for the service - updateMsg := &types.MsgStakeSupplier{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(200)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId2", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8082", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - } - - // Update the staked supplier - _, err = srv.StakeSupplier(wctx, updateMsg) - require.NoError(t, err) - supplierFound, isSupplierFound = k.GetSupplier(ctx, addr) - require.True(t, isSupplierFound) - require.Equal(t, int64(200), supplierFound.Stake.Amount.Int64()) - require.Len(t, supplierFound.Services, 1) - require.Equal(t, "svcId2", supplierFound.Services[0].Service.Id) - require.Len(t, supplierFound.Services[0].Endpoints, 1) - require.Equal(t, "http://localhost:8082", supplierFound.Services[0].Endpoints[0].Url) -} - -func TestMsgServer_StakeSupplier_FailRestakingDueToInvalidServices(t *testing.T) { - k, ctx := keepertest.SupplierKeeper(t, nil) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - supplierAddr := sample.AccAddress() - - // Prepare the supplier stake message - stakeMsg := &types.MsgStakeSupplier{ - Address: supplierAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8080", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - } - - // Stake the supplier - _, err := srv.StakeSupplier(wctx, stakeMsg) - require.NoError(t, err) - - // Prepare the supplier stake message without any service endpoints - updateStakeMsg := &types.MsgStakeSupplier{ - Address: supplierAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svcId"}, - Endpoints: []*sharedtypes.SupplierEndpoint{}, - }, - }, - } - - // Fail updating the supplier when the list of service endpoints is empty - _, err = srv.StakeSupplier(wctx, updateStakeMsg) - require.Error(t, err) - - // Verify the supplierFound still exists and is staked for svc1 - supplierFound, isSupplierFound := k.GetSupplier(ctx, supplierAddr) - require.True(t, isSupplierFound) - require.Equal(t, supplierAddr, supplierFound.Address) - require.Len(t, supplierFound.Services, 1) - require.Equal(t, "svcId", supplierFound.Services[0].Service.Id) - require.Len(t, supplierFound.Services[0].Endpoints, 1) - require.Equal(t, "http://localhost:8080", supplierFound.Services[0].Endpoints[0].Url) - - // Prepare the supplier stake message with an invalid service ID - updateStakeMsg = &types.MsgStakeSupplier{ - Address: supplierAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1 INVALID ! & *"}, - }, - }, - } - - // Fail updating the supplier when the list of services is empty - _, err = srv.StakeSupplier(wctx, updateStakeMsg) - require.Error(t, err) - - // Verify the supplier still exists and is staked for svc1 - supplierFound, isSupplierFound = k.GetSupplier(ctx, supplierAddr) - require.True(t, isSupplierFound) - require.Equal(t, supplierAddr, supplierFound.Address) - require.Len(t, supplierFound.Services, 1) - require.Equal(t, "svcId", supplierFound.Services[0].Service.Id) - require.Len(t, supplierFound.Services[0].Endpoints, 1) - require.Equal(t, "http://localhost:8080", supplierFound.Services[0].Endpoints[0].Url) -} - -func TestMsgServer_StakeSupplier_FailLoweringStake(t *testing.T) { - k, ctx := keepertest.SupplierKeeper(t, nil) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Prepare the supplier - addr := sample.AccAddress() - stakeMsg := &types.MsgStakeSupplier{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8080", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - } - - // Stake the supplier & verify that the supplier exists - _, err := srv.StakeSupplier(wctx, stakeMsg) - require.NoError(t, err) - _, isSupplierFound := k.GetSupplier(ctx, addr) - require.True(t, isSupplierFound) - - // Prepare an updated supplier with a lower stake - updateMsg := &types.MsgStakeSupplier{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(50)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8080", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - } - - // Verify that it fails - _, err = srv.StakeSupplier(wctx, updateMsg) - require.Error(t, err) - - // Verify that the supplier stake is unchanged - supplierFound, isSupplierFound := k.GetSupplier(ctx, addr) - require.True(t, isSupplierFound) - require.Equal(t, int64(100), supplierFound.Stake.Amount.Int64()) - require.Len(t, supplierFound.Services, 1) -} diff --git a/x/supplier/keeper/msg_server_submit_proof.go b/x/supplier/keeper/msg_server_submit_proof.go deleted file mode 100644 index 7a764a12d..000000000 --- a/x/supplier/keeper/msg_server_submit_proof.go +++ /dev/null @@ -1,58 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func (k msgServer) SubmitProof(goCtx context.Context, msg *types.MsgSubmitProof) (*types.MsgSubmitProofResponse, error) { - // TODO_BLOCKER: Prevent Proof upserts after the tokenomics module has processes the respective session. - // TODO_BLOCKER: Validate the signature on the Proof message corresponds to the supplier before Upserting. - - ctx := sdk.UnwrapSDKContext(goCtx) - - if err := msg.ValidateBasic(); err != nil { - return nil, err - } - - /* - INCOMPLETE: Handling the message - - ## Validation - - ### Session validation - 1. [ ] claimed session ID == retrieved session ID - 2. [ ] this supplier is in the session's suppliers list - 3. [ ] proof signer addr == session application addr - - ### Msg distribution validation (depends on session validation) - 1. [ ] pseudo-randomize earliest block offset - 2. [ ] governance-based earliest block offset - - ### Proof validation - 1. [ ] session validation - 2. [ ] msg distribution validation - 3. [ ] claim with matching session ID exists - 4. [ ] proof path matches last committed block hash at claim height - 1 - 5. [ ] proof validates with claimed root hash - - ## Persistence - 1. [ ] submit proof message - - supplier address - - session header - - proof - - ## Accounting - 1. [ ] extract work done from root hash - 2. [ ] calculate reward/burn token with governance-based multiplier - 3. [ ] reward supplier - 4. [ ] burn application tokens - */ - - _ = ctx - - return &types.MsgSubmitProofResponse{}, nil -} diff --git a/x/supplier/keeper/msg_server_test.go b/x/supplier/keeper/msg_server_test.go deleted file mode 100644 index b337090e3..000000000 --- a/x/supplier/keeper/msg_server_test.go +++ /dev/null @@ -1,24 +0,0 @@ -package keeper_test - -import ( - "context" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { - k, ctx := keepertest.SupplierKeeper(t, nil) - return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx) -} - -func TestMsgServer(t *testing.T) { - ms, ctx := setupMsgServer(t) - require.NotNil(t, ms) - require.NotNil(t, ctx) -} diff --git a/x/supplier/keeper/msg_server_unstake_supplier.go b/x/supplier/keeper/msg_server_unstake_supplier.go deleted file mode 100644 index 79f86db3f..000000000 --- a/x/supplier/keeper/msg_server_unstake_supplier.go +++ /dev/null @@ -1,52 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// TODO(#73): Determine if an application needs an unbonding period after unstaking. -func (k msgServer) UnstakeSupplier( - goCtx context.Context, - msg *types.MsgUnstakeSupplier, -) (*types.MsgUnstakeSupplierResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - logger := k.Logger(ctx).With("method", "UnstakeSupplier") - logger.Info(fmt.Sprintf("About to unstake supplier with msg: %v", msg)) - - if err := msg.ValidateBasic(); err != nil { - return nil, err - } - - // Check if the supplier already exists or not - supplier, isSupplierFound := k.GetSupplier(ctx, msg.Address) - if !isSupplierFound { - logger.Info(fmt.Sprintf("Supplier not found. Cannot unstake address %s", msg.Address)) - return nil, types.ErrSupplierNotFound - } - logger.Info(fmt.Sprintf("Supplier found. Unstaking supplier for address %s", msg.Address)) - - // Retrieve the address of the supplier - supplierAddress, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) - return nil, err - } - - // Send the coins from the supplier pool back to the supplier - err = k.bankKeeper.UndelegateCoinsFromModuleToAccount(ctx, types.ModuleName, supplierAddress, []sdk.Coin{*supplier.Stake}) - if err != nil { - logger.Error(fmt.Sprintf("could not send %v coins from %s module to %s account due to %v", supplier.Stake, supplierAddress, types.ModuleName, err)) - return nil, err - } - - // Update the Supplier in the store - k.RemoveSupplier(ctx, supplierAddress.String()) - logger.Info(fmt.Sprintf("Successfully removed the supplier: %+v", supplier)) - return &types.MsgUnstakeSupplierResponse{}, nil -} diff --git a/x/supplier/keeper/msg_server_unstake_supplier_test.go b/x/supplier/keeper/msg_server_unstake_supplier_test.go deleted file mode 100644 index 2999a5e3c..000000000 --- a/x/supplier/keeper/msg_server_unstake_supplier_test.go +++ /dev/null @@ -1,90 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func TestMsgServer_UnstakeSupplier_Success(t *testing.T) { - k, ctx := keepertest.SupplierKeeper(t, nil) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the supplier - addr := sample.AccAddress() - - // Verify that the supplier does not exist yet - _, isSupplierFound := k.GetSupplier(ctx, addr) - require.False(t, isSupplierFound) - - // Prepare the supplier - initialStake := sdk.NewCoin("upokt", sdk.NewInt(100)) - stakeMsg := &types.MsgStakeSupplier{ - Address: addr, - Stake: &initialStake, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8080", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - } - - // Stake the supplier - _, err := srv.StakeSupplier(wctx, stakeMsg) - require.NoError(t, err) - - // Verify that the supplier exists - foundSupplier, isSupplierFound := k.GetSupplier(ctx, addr) - require.True(t, isSupplierFound) - require.Equal(t, addr, foundSupplier.Address) - require.Equal(t, initialStake.Amount, foundSupplier.Stake.Amount) - require.Len(t, foundSupplier.Services, 1) - - // Unstake the supplier - unstakeMsg := &types.MsgUnstakeSupplier{Address: addr} - _, err = srv.UnstakeSupplier(wctx, unstakeMsg) - require.NoError(t, err) - - // Make sure the supplier can no longer be found after unstaking - _, isSupplierFound = k.GetSupplier(ctx, addr) - require.False(t, isSupplierFound) -} - -func TestMsgServer_UnstakeSupplier_FailIfNotStaked(t *testing.T) { - k, ctx := keepertest.SupplierKeeper(t, nil) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the supplier - addr := sample.AccAddress() - - // Verify that the supplier does not exist yet - _, isSupplierFound := k.GetSupplier(ctx, addr) - require.False(t, isSupplierFound) - - // Unstake the supplier - unstakeMsg := &types.MsgUnstakeSupplier{Address: addr} - _, err := srv.UnstakeSupplier(wctx, unstakeMsg) - require.Error(t, err) - require.ErrorIs(t, err, types.ErrSupplierNotFound) - - _, isSupplierFound = k.GetSupplier(ctx, addr) - require.False(t, isSupplierFound) -} diff --git a/x/supplier/keeper/params.go b/x/supplier/keeper/params.go deleted file mode 100644 index 86ca01cbe..000000000 --- a/x/supplier/keeper/params.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() -} - -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} diff --git a/x/supplier/keeper/params_test.go b/x/supplier/keeper/params_test.go deleted file mode 100644 index 38f2e91b9..000000000 --- a/x/supplier/keeper/params_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func TestGetParams(t *testing.T) { - k, ctx := testkeeper.SupplierKeeper(t, nil) - params := types.DefaultParams() - - k.SetParams(ctx, params) - - require.EqualValues(t, params, k.GetParams(ctx)) -} diff --git a/x/supplier/keeper/proof.go b/x/supplier/keeper/proof.go deleted file mode 100644 index 3aacbf273..000000000 --- a/x/supplier/keeper/proof.go +++ /dev/null @@ -1,83 +0,0 @@ -package keeper - -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// UpsertProof inserts or updates a specific proof in the store by index. -func (k Keeper) UpsertProof(ctx sdk.Context, proof types.Proof) { - logger := k.Logger(ctx).With("method", "UpsertProof") - - proofBz := k.cdc.MustMarshal(&proof) - parentStore := ctx.KVStore(k.storeKey) - - // Update the primary store containing the proof object. - primaryStore := prefix.NewStore(parentStore, types.KeyPrefix(types.ProofPrimaryKeyPrefix)) - sessionId := proof.GetSessionHeader().GetSessionId() - primaryKey := types.ProofPrimaryKey(sessionId, proof.GetSupplierAddress()) - primaryStore.Set(primaryKey, proofBz) - - logger.Info(fmt.Sprintf("upserted proof for supplier %s with primaryKey %s", proof.GetSupplierAddress(), primaryKey)) - - // Update the address index: supplierAddress -> [ProofPrimaryKey] - addressStoreIndex := prefix.NewStore(parentStore, types.KeyPrefix(types.ProofSupplierAddressPrefix)) - addressKey := types.ProofSupplierAddressKey(proof.GetSupplierAddress(), primaryKey) - addressStoreIndex.Set(addressKey, primaryKey) - - logger.Info(fmt.Sprintf("indexed Proof for supplier %s with primaryKey %s", proof.GetSupplierAddress(), primaryKey)) - - // Update the session end height index: sessionEndHeight -> [ProofPrimaryKey] - sessionHeightStoreIndex := prefix.NewStore(parentStore, types.KeyPrefix(types.ProofSessionEndHeightPrefix)) - sessionEndHeight := proof.GetSessionHeader().GetSessionEndBlockHeight() - heightKey := types.ProofSupplierEndSessionHeightKey(sessionEndHeight, primaryKey) - sessionHeightStoreIndex.Set(heightKey, primaryKey) -} - -// GetProof returns a proof from its index -func (k Keeper) GetProof(ctx sdk.Context, sessionId, supplierAdd string) (val types.Proof, found bool) { - primaryKey := types.ProofPrimaryKey(sessionId, supplierAdd) - return k.getProofByPrimaryKey(ctx, primaryKey) -} - -// RemoveProof removes a proof from the store -func (k Keeper) RemoveProof(ctx sdk.Context, sessionId, supplierAddr string) { - parentStore := ctx.KVStore(k.storeKey) - proofPrimaryStore := prefix.NewStore(parentStore, types.KeyPrefix(types.ProofPrimaryKeyPrefix)) - proofPrimaryKey := types.ProofPrimaryKey(sessionId, supplierAddr) - proofPrimaryStore.Delete(proofPrimaryKey) -} - -// GetAllProofs returns all proof -func (k Keeper) GetAllProofs(ctx sdk.Context) (list []types.Proof) { - parentStore := ctx.KVStore(k.storeKey) - primaryStore := prefix.NewStore(parentStore, types.KeyPrefix(types.ProofPrimaryKeyPrefix)) - iterator := sdk.KVStorePrefixIterator(primaryStore, []byte{}) - - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var val types.Proof - k.cdc.MustUnmarshal(iterator.Value(), &val) - list = append(list, val) - } - - return -} - -// getProofByPrimaryKey is a helper that retrieves, if exists, the Proof associated with the key provided -func (k Keeper) getProofByPrimaryKey(ctx sdk.Context, primaryKey []byte) (val types.Proof, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ProofPrimaryKeyPrefix)) - - proofBz := store.Get(primaryKey) - if proofBz == nil { - return val, false - } - - k.cdc.MustUnmarshal(proofBz, &val) - return val, true -} diff --git a/x/supplier/keeper/proof_test.go b/x/supplier/keeper/proof_test.go deleted file mode 100644 index bf34f7027..000000000 --- a/x/supplier/keeper/proof_test.go +++ /dev/null @@ -1,78 +0,0 @@ -package keeper_test - -import ( - "fmt" - "strconv" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/testutil/sample" - sessionkeeper "github.com/pokt-network/poktroll/x/session/keeper" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func createNProofs(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Proof { - proofs := make([]types.Proof, n) - for i := range proofs { - proofs[i] = types.Proof{ - SupplierAddress: sample.AccAddress(), - SessionHeader: &sessiontypes.SessionHeader{ - ApplicationAddress: sample.AccAddress(), - Service: &sharedtypes.Service{Id: testServiceId}, - SessionId: fmt.Sprintf("session-%d", i), - SessionStartBlockHeight: 1, - SessionEndBlockHeight: 1 + sessionkeeper.NumBlocksPerSession, - }, - ClosestMerkleProof: nil, - } - - keeper.UpsertProof(ctx, proofs[i]) - } - return proofs -} - -func TestProofGet(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - proofs := createNProofs(keeper, ctx, 10) - for _, proof := range proofs { - rst, found := keeper.GetProof( - ctx, - proof.GetSessionHeader().GetSessionId(), - proof.GetSupplierAddress(), - ) - require.True(t, found) - require.Equal(t, - nullify.Fill(&proof), - nullify.Fill(&rst), - ) - } -} -func TestProofRemove(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - proofs := createNProofs(keeper, ctx, 10) - for _, proof := range proofs { - sessionId := proof.GetSessionHeader().GetSessionId() - keeper.RemoveProof(ctx, sessionId, proof.GetSupplierAddress()) - _, found := keeper.GetProof(ctx, sessionId, proof.GetSupplierAddress()) - require.False(t, found) - } -} - -func TestProofGetAll(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - items := createNProofs(keeper, ctx, 10) - require.ElementsMatch(t, - nullify.Fill(items), - nullify.Fill(keeper.GetAllProofs(ctx)), - ) -} diff --git a/x/supplier/keeper/query.go b/x/supplier/keeper/query.go deleted file mode 100644 index 2d1d5c18e..000000000 --- a/x/supplier/keeper/query.go +++ /dev/null @@ -1,7 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/supplier/types" -) - -var _ types.QueryServer = Keeper{} diff --git a/x/supplier/keeper/query_claim.go b/x/supplier/keeper/query_claim.go deleted file mode 100644 index 4dd294adc..000000000 --- a/x/supplier/keeper/query_claim.go +++ /dev/null @@ -1,103 +0,0 @@ -package keeper - -import ( - "context" - "encoding/binary" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func (k Keeper) AllClaims(goCtx context.Context, req *types.QueryAllClaimsRequest) (*types.QueryAllClaimsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(goCtx) - store := ctx.KVStore(k.storeKey) - - // isCustomIndex is used to determined if we'll be using the store that points - // to the actual Claim values, or a secondary index that points to the primary keys. - var isCustomIndex bool - var keyPrefix []byte - switch filter := req.Filter.(type) { - case *types.QueryAllClaimsRequest_SupplierAddress: - isCustomIndex = true - keyPrefix = types.KeyPrefix(types.ClaimSupplierAddressPrefix) - keyPrefix = append(keyPrefix, []byte(filter.SupplierAddress)...) - - case *types.QueryAllClaimsRequest_SessionEndHeight: - isCustomIndex = true - heightBz := make([]byte, 8) - binary.BigEndian.PutUint64(heightBz, filter.SessionEndHeight) - - keyPrefix = types.KeyPrefix(types.ClaimSessionEndHeightPrefix) - keyPrefix = append(keyPrefix, heightBz...) - - case *types.QueryAllClaimsRequest_SessionId: - isCustomIndex = false - keyPrefix = types.KeyPrefix(types.ClaimPrimaryKeyPrefix) - keyPrefix = append(keyPrefix, []byte(filter.SessionId)...) - - default: - isCustomIndex = false - keyPrefix = types.KeyPrefix(types.ClaimPrimaryKeyPrefix) - } - claimStore := prefix.NewStore(store, keyPrefix) - - var claims []types.Claim - pageRes, err := query.Paginate(claimStore, req.Pagination, func(key []byte, value []byte) error { - if isCustomIndex { - // We retrieve the primaryKey, and need to query the actual Claim before decoding it. - claim, claimFound := k.getClaimByPrimaryKey(ctx, value) - if claimFound { - claims = append(claims, claim) - } - } else { - // The value is an encoded Claim. - var claim types.Claim - if err := k.cdc.Unmarshal(value, &claim); err != nil { - return err - } - claims = append(claims, claim) - } - - return nil - }) - - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryAllClaimsResponse{Claim: claims, Pagination: pageRes}, nil -} - -func (k Keeper) Claim(goCtx context.Context, req *types.QueryGetClaimRequest) (*types.QueryGetClaimResponse, error) { - if req == nil { - err := types.ErrSupplierInvalidQueryRequest.Wrapf("request cannot be nil") - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - if err := req.ValidateBasic(); err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - ctx := sdk.UnwrapSDKContext(goCtx) - - val, found := k.GetClaim( - ctx, - req.SessionId, - req.SupplierAddress, - ) - if !found { - err := types.ErrSupplierClaimNotFound.Wrapf("session ID %q and supplier %q", req.SessionId, req.SupplierAddress) - return nil, status.Error(codes.NotFound, err.Error()) - } - - return &types.QueryGetClaimResponse{Claim: val}, nil -} diff --git a/x/supplier/keeper/query_claim_test.go b/x/supplier/keeper/query_claim_test.go deleted file mode 100644 index fac734a78..000000000 --- a/x/supplier/keeper/query_claim_test.go +++ /dev/null @@ -1,234 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func TestClaim_QuerySingle(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - wctx := sdk.WrapSDKContext(ctx) - claims := createNClaims(keeper, ctx, 2) - - var wrongSupplierAddr = sample.AccAddress() - tests := []struct { - desc string - - request *types.QueryGetClaimRequest - - response *types.QueryGetClaimResponse - expectedErr error - }{ - { - desc: "First Claim", - - request: &types.QueryGetClaimRequest{ - SessionId: claims[0].GetSessionHeader().GetSessionId(), - SupplierAddress: claims[0].SupplierAddress, - }, - - response: &types.QueryGetClaimResponse{Claim: claims[0]}, - expectedErr: nil, - }, - { - desc: "Second Claim", - - request: &types.QueryGetClaimRequest{ - SessionId: claims[1].GetSessionHeader().GetSessionId(), - SupplierAddress: claims[1].SupplierAddress, - }, - - response: &types.QueryGetClaimResponse{Claim: claims[1]}, - expectedErr: nil, - }, - { - desc: "Claim Not Found - Random SessionId", - - request: &types.QueryGetClaimRequest{ - SessionId: "not a real session id", - SupplierAddress: claims[0].GetSupplierAddress(), - }, - - expectedErr: status.Error( - codes.NotFound, - types.ErrSupplierClaimNotFound.Wrapf( - // TODO_CONSIDERATION: factor out error message format strings to constants. - "session ID %q and supplier %q", - "not a real session id", - claims[0].GetSupplierAddress(), - ).Error(), - ), - }, - { - desc: "Claim Not Found - Wrong Supplier Address", - - request: &types.QueryGetClaimRequest{ - SessionId: claims[0].GetSessionHeader().GetSessionId(), - SupplierAddress: wrongSupplierAddr, - }, - - expectedErr: status.Error( - codes.NotFound, - types.ErrSupplierClaimNotFound.Wrapf( - "session ID %q and supplier %q", - claims[0].GetSessionHeader().GetSessionId(), - wrongSupplierAddr, - ).Error(), - ), - }, - { - desc: "InvalidRequest - Missing SessionId", - request: &types.QueryGetClaimRequest{ - // SessionId: Intentionally Omitted - SupplierAddress: claims[0].GetSupplierAddress(), - }, - - expectedErr: status.Error( - codes.InvalidArgument, - types.ErrSupplierInvalidSessionId.Wrapf( - "invalid session ID for claim being retrieved %s", - "", - ).Error(), - ), - }, - { - desc: "InvalidRequest - Missing SupplierAddress", - request: &types.QueryGetClaimRequest{ - SessionId: claims[0].GetSessionHeader().GetSessionId(), - // SupplierAddress: Intentionally Omitted, - }, - - expectedErr: status.Error( - codes.InvalidArgument, - types.ErrSupplierInvalidAddress.Wrap( - "invalid supplier address for claim being retrieved ; (empty address string is not allowed)", - ).Error(), - ), - }, - { - desc: "InvalidRequest - nil QueryGetClaimRequest", - request: nil, - - expectedErr: status.Error( - codes.InvalidArgument, - types.ErrSupplierInvalidQueryRequest.Wrap( - "request cannot be nil", - ).Error(), - ), - }, - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.Claim(wctx, tc.request) - if tc.expectedErr != nil { - actualStatus, ok := status.FromError(err) - require.True(t, ok) - - require.ErrorIs(t, actualStatus.Err(), tc.expectedErr) - require.ErrorContains(t, err, tc.expectedErr.Error()) - } else { - require.NoError(t, err) - require.Equal(t, - nullify.Fill(tc.response), - nullify.Fill(response), - ) - } - }) - } -} - -func TestClaim_QueryPaginated(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - wctx := sdk.WrapSDKContext(ctx) - claims := createNClaims(keeper, ctx, 10) - - request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllClaimsRequest { - return &types.QueryAllClaimsRequest{ - Pagination: &query.PageRequest{ - Key: next, - Offset: offset, - Limit: limit, - CountTotal: total, - }, - } - } - t.Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < len(claims); i += step { - resp, err := keeper.AllClaims(wctx, request(nil, uint64(i), uint64(step), false)) - require.NoError(t, err) - require.LessOrEqual(t, len(resp.Claim), step) - require.Subset(t, - nullify.Fill(claims), - nullify.Fill(resp.Claim), - ) - } - }) - t.Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < len(claims); i += step { - resp, err := keeper.AllClaims(wctx, request(next, 0, uint64(step), false)) - require.NoError(t, err) - require.LessOrEqual(t, len(resp.Claim), step) - require.Subset(t, - nullify.Fill(claims), - nullify.Fill(resp.Claim), - ) - next = resp.Pagination.NextKey - } - }) - t.Run("Total", func(t *testing.T) { - resp, err := keeper.AllClaims(wctx, request(nil, 0, 0, true)) - require.NoError(t, err) - require.Equal(t, len(claims), int(resp.Pagination.Total)) - require.ElementsMatch(t, - nullify.Fill(claims), - nullify.Fill(resp.Claim), - ) - }) - t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.AllClaims(wctx, nil) - require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) - }) - - t.Run("BySupplierAddress", func(t *testing.T) { - req := request(nil, 0, 0, true) - req.Filter = &types.QueryAllClaimsRequest_SupplierAddress{ - SupplierAddress: claims[0].SupplierAddress, - } - resp, err := keeper.AllClaims(wctx, req) - require.NoError(t, err) - require.Equal(t, 1, int(resp.Pagination.Total)) - }) - - t.Run("BySessionId", func(t *testing.T) { - req := request(nil, 0, 0, true) - req.Filter = &types.QueryAllClaimsRequest_SessionId{ - SessionId: claims[0].GetSessionHeader().GetSessionId(), - } - resp, err := keeper.AllClaims(wctx, req) - require.NoError(t, err) - require.Equal(t, 1, int(resp.Pagination.Total)) - }) - - t.Run("BySessionEndHeight", func(t *testing.T) { - req := request(nil, 0, 0, true) - req.Filter = &types.QueryAllClaimsRequest_SessionEndHeight{ - SessionEndHeight: uint64(claims[0].GetSessionHeader().GetSessionEndBlockHeight()), - } - resp, err := keeper.AllClaims(wctx, req) - require.NoError(t, err) - require.Equal(t, 1, int(resp.Pagination.Total)) - }) -} diff --git a/x/supplier/keeper/query_params.go b/x/supplier/keeper/query_params.go deleted file mode 100644 index 67e2a17f4..000000000 --- a/x/supplier/keeper/query_params.go +++ /dev/null @@ -1,20 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil -} diff --git a/x/supplier/keeper/query_params_test.go b/x/supplier/keeper/query_params_test.go deleted file mode 100644 index 37df8b949..000000000 --- a/x/supplier/keeper/query_params_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.SupplierKeeper(t, nil) - wctx := sdk.WrapSDKContext(ctx) - params := types.DefaultParams() - keeper.SetParams(ctx, params) - - response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) - require.NoError(t, err) - require.Equal(t, &types.QueryParamsResponse{Params: params}, response) -} diff --git a/x/supplier/keeper/query_proof.go b/x/supplier/keeper/query_proof.go deleted file mode 100644 index cb8642679..000000000 --- a/x/supplier/keeper/query_proof.go +++ /dev/null @@ -1,101 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func (k Keeper) AllProofs(goCtx context.Context, req *types.QueryAllProofsRequest) (*types.QueryAllProofsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - if err := req.ValidateBasic(); err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - ctx := sdk.UnwrapSDKContext(goCtx) - store := ctx.KVStore(k.storeKey) - - var ( - // isCustomIndex is used to determined if we'll be using the store that points - // to the actual Claim values, or a secondary index that points to the primary keys. - isCustomIndex bool - keyPrefix []byte - ) - - switch filter := req.Filter.(type) { - case *types.QueryAllProofsRequest_SupplierAddress: - isCustomIndex = true - keyPrefix = types.KeyPrefix(types.ProofSupplierAddressPrefix) - keyPrefix = append(keyPrefix, []byte(filter.SupplierAddress)...) - case *types.QueryAllProofsRequest_SessionEndHeight: - isCustomIndex = true - keyPrefix = types.KeyPrefix(types.ProofSessionEndHeightPrefix) - keyPrefix = append(keyPrefix, []byte(fmt.Sprintf("%d", filter.SessionEndHeight))...) - case *types.QueryAllProofsRequest_SessionId: - isCustomIndex = false - keyPrefix = types.KeyPrefix(types.ProofPrimaryKeyPrefix) - keyPrefix = append(keyPrefix, []byte(filter.SessionId)...) - default: - isCustomIndex = false - keyPrefix = types.KeyPrefix(types.ProofPrimaryKeyPrefix) - } - proofStore := prefix.NewStore(store, keyPrefix) - - var proofs []types.Proof - pageRes, err := query.Paginate(proofStore, req.Pagination, func(key []byte, value []byte) error { - if isCustomIndex { - // We retrieve the primaryKey, and need to query the actual proof before decoding it. - proof, proofFound := k.getProofByPrimaryKey(ctx, value) - if proofFound { - proofs = append(proofs, proof) - } - } else { - // The value is an encoded proof. - var proof types.Proof - if err := k.cdc.Unmarshal(value, &proof); err != nil { - return err - } - - proofs = append(proofs, proof) - } - - return nil - }) - - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryAllProofsResponse{Proof: proofs, Pagination: pageRes}, nil -} - -func (k Keeper) Proof(goCtx context.Context, req *types.QueryGetProofRequest) (*types.QueryGetProofResponse, error) { - if req == nil { - err := types.ErrSupplierInvalidQueryRequest.Wrap("request cannot be nil") - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - if err := req.ValidateBasic(); err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - ctx := sdk.UnwrapSDKContext(goCtx) - - val, found := k.GetProof(ctx, req.GetSessionId(), req.GetSupplierAddress()) - if !found { - err := types.ErrSupplierProofNotFound.Wrapf("session ID %q and supplier %q", req.SessionId, req.SupplierAddress) - return nil, status.Error(codes.NotFound, err.Error()) - } - - return &types.QueryGetProofResponse{Proof: val}, nil -} diff --git a/x/supplier/keeper/query_proof_test.go b/x/supplier/keeper/query_proof_test.go deleted file mode 100644 index 787b23d68..000000000 --- a/x/supplier/keeper/query_proof_test.go +++ /dev/null @@ -1,192 +0,0 @@ -package keeper_test - -import ( - "strconv" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func TestProofQuerySingle(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - wctx := sdk.WrapSDKContext(ctx) - proofs := createNProofs(keeper, ctx, 2) - - var randSupplierAddr = sample.AccAddress() - tests := []struct { - desc string - request *types.QueryGetProofRequest - response *types.QueryGetProofResponse - expectedErr error - }{ - { - desc: "First", - request: &types.QueryGetProofRequest{ - SessionId: proofs[0].GetSessionHeader().GetSessionId(), - SupplierAddress: proofs[0].SupplierAddress, - }, - response: &types.QueryGetProofResponse{Proof: proofs[0]}, - }, - { - desc: "Second", - request: &types.QueryGetProofRequest{ - SessionId: proofs[1].GetSessionHeader().GetSessionId(), - SupplierAddress: proofs[1].SupplierAddress, - }, - response: &types.QueryGetProofResponse{Proof: proofs[1]}, - }, - { - desc: "Proof Not Found - Random SessionId", - request: &types.QueryGetProofRequest{ - SessionId: "not a real session id", - SupplierAddress: proofs[0].GetSupplierAddress(), - }, - expectedErr: status.Error( - codes.NotFound, - types.ErrSupplierProofNotFound.Wrapf( - "session ID %q and supplier %q", - "not a real session id", - proofs[0].GetSupplierAddress(), - ).Error(), - ), - }, - { - desc: "Proof Not Found - Random Supplier Address", - request: &types.QueryGetProofRequest{ - SessionId: proofs[0].GetSessionHeader().GetSessionId(), - SupplierAddress: randSupplierAddr, - }, - expectedErr: status.Error( - codes.NotFound, - types.ErrSupplierProofNotFound.Wrapf( - "session ID %q and supplier %q", - proofs[0].GetSessionHeader().GetSessionId(), - randSupplierAddr, - ).Error(), - ), - }, - { - desc: "InvalidRequest - Missing SessionId", - request: &types.QueryGetProofRequest{ - // SessionId: Intentionally Omitted - SupplierAddress: proofs[0].GetSupplierAddress(), - }, - expectedErr: status.Error( - codes.InvalidArgument, - types.ErrSupplierInvalidSessionId.Wrapf( - "invalid session ID for proof being retrieved %s", - "", - ).Error(), - ), - }, - { - desc: "InvalidRequest - Missing SupplierAddress", - request: &types.QueryGetProofRequest{ - SessionId: proofs[0].GetSessionHeader().GetSessionId(), - // SupplierAddress: Intentionally Omitted, - }, - expectedErr: status.Error( - codes.InvalidArgument, - types.ErrSupplierInvalidAddress.Wrap( - "invalid supplier address for proof being retrieved ; (empty address string is not allowed)", - ).Error(), - ), - }, - { - desc: "InvalidRequest - nil QueryGetProofRequest", - request: nil, - expectedErr: status.Error( - codes.InvalidArgument, - types.ErrSupplierInvalidQueryRequest.Wrap( - "request cannot be nil", - ).Error(), - ), - }, - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.Proof(wctx, tc.request) - if tc.expectedErr != nil { - actualStatus, ok := status.FromError(err) - require.True(t, ok) - - require.ErrorIs(t, actualStatus.Err(), tc.expectedErr) - require.ErrorContains(t, err, tc.expectedErr.Error()) - } else { - require.NoError(t, err) - require.Equal(t, - nullify.Fill(tc.response), - nullify.Fill(response), - ) - } - }) - } -} - -func TestProofQueryPaginated(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - wctx := sdk.WrapSDKContext(ctx) - msgs := createNProofs(keeper, ctx, 5) - - request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllProofsRequest { - return &types.QueryAllProofsRequest{ - Pagination: &query.PageRequest{ - Key: next, - Offset: offset, - Limit: limit, - CountTotal: total, - }, - } - } - t.Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < len(msgs); i += step { - resp, err := keeper.AllProofs(wctx, request(nil, uint64(i), uint64(step), false)) - require.NoError(t, err) - require.LessOrEqual(t, len(resp.Proof), step) - require.Subset(t, - nullify.Fill(msgs), - nullify.Fill(resp.Proof), - ) - } - }) - t.Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < len(msgs); i += step { - resp, err := keeper.AllProofs(wctx, request(next, 0, uint64(step), false)) - require.NoError(t, err) - require.LessOrEqual(t, len(resp.Proof), step) - require.Subset(t, - nullify.Fill(msgs), - nullify.Fill(resp.Proof), - ) - next = resp.Pagination.NextKey - } - }) - t.Run("Total", func(t *testing.T) { - resp, err := keeper.AllProofs(wctx, request(nil, 0, 0, true)) - require.NoError(t, err) - require.Equal(t, len(msgs), int(resp.Pagination.Total)) - require.ElementsMatch(t, - nullify.Fill(msgs), - nullify.Fill(resp.Proof), - ) - }) - t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.AllProofs(wctx, nil) - require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) - }) -} diff --git a/x/supplier/keeper/query_supplier.go b/x/supplier/keeper/query_supplier.go deleted file mode 100644 index c27e8e8f6..000000000 --- a/x/supplier/keeper/query_supplier.go +++ /dev/null @@ -1,61 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func (k Keeper) SupplierAll(goCtx context.Context, req *types.QueryAllSupplierRequest) (*types.QueryAllSupplierResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - var suppliers []sharedtypes.Supplier - ctx := sdk.UnwrapSDKContext(goCtx) - - store := ctx.KVStore(k.storeKey) - supplierStore := prefix.NewStore(store, types.KeyPrefix(types.SupplierKeyPrefix)) - - pageRes, err := query.Paginate(supplierStore, req.Pagination, func(key []byte, value []byte) error { - var supplier sharedtypes.Supplier - if err := k.cdc.Unmarshal(value, &supplier); err != nil { - return err - } - - suppliers = append(suppliers, supplier) - return nil - }) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryAllSupplierResponse{Supplier: suppliers, Pagination: pageRes}, nil -} - -func (k Keeper) Supplier(goCtx context.Context, req *types.QueryGetSupplierRequest) (*types.QueryGetSupplierResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - - val, found := k.GetSupplier( - ctx, - req.Address, - ) - if !found { - // TODO_TECHDEBT(#181): conform to logging conventions once established - msg := fmt.Sprintf("supplier with address %q", req.GetAddress()) - return nil, status.Error(codes.NotFound, msg) - } - - return &types.QueryGetSupplierResponse{Supplier: val}, nil -} diff --git a/x/supplier/keeper/query_supplier_test.go b/x/supplier/keeper/query_supplier_test.go deleted file mode 100644 index bfd4f8019..000000000 --- a/x/supplier/keeper/query_supplier_test.go +++ /dev/null @@ -1,127 +0,0 @@ -package keeper_test - -import ( - "strconv" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func TestSupplierQuerySingle(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - wctx := sdk.WrapSDKContext(ctx) - msgs := createNSupplier(keeper, ctx, 2) - tests := []struct { - desc string - request *types.QueryGetSupplierRequest - response *types.QueryGetSupplierResponse - err error - }{ - { - desc: "First", - request: &types.QueryGetSupplierRequest{ - Address: msgs[0].Address, - }, - response: &types.QueryGetSupplierResponse{Supplier: msgs[0]}, - }, - { - desc: "Second", - request: &types.QueryGetSupplierRequest{ - Address: msgs[1].Address, - }, - response: &types.QueryGetSupplierResponse{Supplier: msgs[1]}, - }, - { - desc: "KeyNotFound", - request: &types.QueryGetSupplierRequest{ - Address: strconv.Itoa(100000), - }, - err: status.Error(codes.NotFound, "supplier with address \"100000\""), - }, - { - desc: "InvalidRequest", - err: status.Error(codes.InvalidArgument, "invalid request"), - }, - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.Supplier(wctx, tc.request) - if tc.err != nil { - require.ErrorIs(t, err, tc.err) - } else { - require.NoError(t, err) - require.Equal(t, - nullify.Fill(tc.response), - nullify.Fill(response), - ) - } - }) - } -} - -func TestSupplierQueryPaginated(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - wctx := sdk.WrapSDKContext(ctx) - msgs := createNSupplier(keeper, ctx, 5) - - request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllSupplierRequest { - return &types.QueryAllSupplierRequest{ - Pagination: &query.PageRequest{ - Key: next, - Offset: offset, - Limit: limit, - CountTotal: total, - }, - } - } - t.Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < len(msgs); i += step { - resp, err := keeper.SupplierAll(wctx, request(nil, uint64(i), uint64(step), false)) - require.NoError(t, err) - require.LessOrEqual(t, len(resp.Supplier), step) - require.Subset(t, - nullify.Fill(msgs), - nullify.Fill(resp.Supplier), - ) - } - }) - t.Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < len(msgs); i += step { - resp, err := keeper.SupplierAll(wctx, request(next, 0, uint64(step), false)) - require.NoError(t, err) - require.LessOrEqual(t, len(resp.Supplier), step) - require.Subset(t, - nullify.Fill(msgs), - nullify.Fill(resp.Supplier), - ) - next = resp.Pagination.NextKey - } - }) - t.Run("Total", func(t *testing.T) { - resp, err := keeper.SupplierAll(wctx, request(nil, 0, 0, true)) - require.NoError(t, err) - require.Equal(t, len(msgs), int(resp.Pagination.Total)) - require.ElementsMatch(t, - nullify.Fill(msgs), - nullify.Fill(resp.Supplier), - ) - }) - t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.SupplierAll(wctx, nil) - require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) - }) -} diff --git a/x/supplier/keeper/session.go b/x/supplier/keeper/session.go deleted file mode 100644 index af24e52f0..000000000 --- a/x/supplier/keeper/session.go +++ /dev/null @@ -1,83 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" -) - -// queryAndValidateSessionHeader ensures that a session with the sessionID of the given session -// header exists and that this session includes the supplier with the given address. -func (k msgServer) queryAndValidateSessionHeader( - goCtx context.Context, - sessionHeader *sessiontypes.SessionHeader, - supplierAddr string, -) (*sessiontypes.Session, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - logger := k.Logger(ctx).With("method", "SubmitProof") - - sessionReq := &sessiontypes.QueryGetSessionRequest{ - ApplicationAddress: sessionHeader.GetApplicationAddress(), - Service: sessionHeader.GetService(), - BlockHeight: sessionHeader.GetSessionStartBlockHeight(), - } - - // Get the on-chain session for the ground-truth against which the given - // session header is to be validated. - sessionRes, err := k.Keeper.sessionKeeper.GetSession(goCtx, sessionReq) - if err != nil { - return nil, err - } - onChainSession := sessionRes.GetSession() - - logger. - With( - "session_id", onChainSession.GetSessionId(), - "session_end_height", sessionHeader.GetSessionEndBlockHeight(), - "supplier", supplierAddr, - ). - Debug("got sessionId for proof") - - // Ensure that the given session header's session ID matches the on-chain onChainSession ID. - if sessionHeader.GetSessionId() != onChainSession.GetSessionId() { - return nil, suppliertypes.ErrSupplierInvalidSessionId.Wrapf( - "session ID does not match on-chain session ID; expected %q, got %q", - onChainSession.GetSessionId(), - sessionHeader.GetSessionId(), - ) - } - - // NB: it is redundant to assert that the service ID in the request matches the - // on-chain session service ID because the session is queried using the service - // ID as a parameter. Either a different session (i.e. different session ID) - // or an error would be returned depending on whether an application/supplier - // pair exists for the given service ID or not, respectively. - - // Ensure the given supplier is in the onChainSession supplier list. - if found := foundSupplier( - sessionRes.GetSession().GetSuppliers(), - supplierAddr, - ); !found { - return nil, suppliertypes.ErrSupplierNotFound.Wrapf( - "supplier address %q not found in session ID %q", - supplierAddr, - sessionHeader.GetSessionId(), - ) - } - - return onChainSession, nil -} - -// foundSupplier ensures that the given supplier address is in the given list of suppliers. -func foundSupplier(suppliers []*sharedtypes.Supplier, supplierAddr string) bool { - for _, supplier := range suppliers { - if supplier.Address == supplierAddr { - return true - } - } - return false -} diff --git a/x/supplier/keeper/supplier.go b/x/supplier/keeper/supplier.go deleted file mode 100644 index c5edeefc4..000000000 --- a/x/supplier/keeper/supplier.go +++ /dev/null @@ -1,66 +0,0 @@ -package keeper - -import ( - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// SetSupplier set a specific supplier in the store from its index -func (k Keeper) SetSupplier(ctx sdk.Context, supplier sharedtypes.Supplier) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.SupplierKeyPrefix)) - b := k.cdc.MustMarshal(&supplier) - store.Set(types.SupplierKey( - supplier.Address, - ), b) -} - -// GetSupplier returns a supplier from its index -func (k Keeper) GetSupplier( - ctx sdk.Context, - supplierAddr string, -) (supplier sharedtypes.Supplier, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.SupplierKeyPrefix)) - - b := store.Get(types.SupplierKey( - supplierAddr, - )) - if b == nil { - return supplier, false - } - - k.cdc.MustUnmarshal(b, &supplier) - return supplier, true -} - -// RemoveSupplier removes a supplier from the store -func (k Keeper) RemoveSupplier( - ctx sdk.Context, - supplierAddr string, -) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.SupplierKeyPrefix)) - store.Delete(types.SupplierKey( - supplierAddr, - )) -} - -// GetAllSupplier returns all supplier -func (k Keeper) GetAllSupplier(ctx sdk.Context) (suppliers []sharedtypes.Supplier) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.SupplierKeyPrefix)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var supplier sharedtypes.Supplier - k.cdc.MustUnmarshal(iterator.Value(), &supplier) - suppliers = append(suppliers, supplier) - } - - return -} - -// TODO_OPTIMIZE: Index suppliers by service so we can easily query `k.GetAllSupplier(ctx, Service)` -// func (k Keeper) GetAllSupplier(ctx, sdkContext, serviceId string) (suppliers []sharedtypes.Supplier) {} diff --git a/x/supplier/keeper/supplier_test.go b/x/supplier/keeper/supplier_test.go deleted file mode 100644 index 03b1e470a..000000000 --- a/x/supplier/keeper/supplier_test.go +++ /dev/null @@ -1,94 +0,0 @@ -package keeper_test - -import ( - "fmt" - "strconv" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/testutil/sample" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func init() { - cmd.InitSDKConfig() -} - -func createNSupplier(keeper *keeper.Keeper, ctx sdk.Context, n int) []sharedtypes.Supplier { - suppliers := make([]sharedtypes.Supplier, n) - for i := range suppliers { - supplier := &suppliers[i] - supplier.Address = sample.AccAddress() - supplier.Stake = &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(int64(i))} - supplier.Services = []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{Id: fmt.Sprintf("svc%d", i)}, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: fmt.Sprintf("http://localhost:%d", i), - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - } - keeper.SetSupplier(ctx, *supplier) - } - - return suppliers -} - -func TestSupplierGet(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - suppliers := createNSupplier(keeper, ctx, 10) - for _, supplier := range suppliers { - supplierFound, isSupplierFound := keeper.GetSupplier(ctx, - supplier.Address, - ) - require.True(t, isSupplierFound) - require.Equal(t, - nullify.Fill(&supplier), - nullify.Fill(&supplierFound), - ) - } -} -func TestSupplierRemove(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - suppliers := createNSupplier(keeper, ctx, 10) - for _, supplier := range suppliers { - keeper.RemoveSupplier(ctx, - supplier.Address, - ) - _, isSupplierFound := keeper.GetSupplier(ctx, - supplier.Address, - ) - require.False(t, isSupplierFound) - } -} - -func TestSupplierGetAll(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - suppliers := createNSupplier(keeper, ctx, 10) - require.ElementsMatch(t, - nullify.Fill(suppliers), - nullify.Fill(keeper.GetAllSupplier(ctx)), - ) -} - -// The application module address is derived off of its semantic name. -// This test is a helper for us to easily identify the underlying address. -func TestApplicationModuleAddress(t *testing.T) { - moduleAddress := authtypes.NewModuleAddress(types.ModuleName) - require.Equal(t, "pokt1j40dzzmn6cn9kxku7a5tjnud6hv37vesr5ccaa", moduleAddress.String()) -} diff --git a/x/supplier/module.go b/x/supplier/module.go deleted file mode 100644 index a39dc9303..000000000 --- a/x/supplier/module.go +++ /dev/null @@ -1,150 +0,0 @@ -package supplier - -import ( - "context" - "encoding/json" - "fmt" - - // this line is used by starport scaffolding # 1 - - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - abci "github.com/cometbft/cometbft/abci/types" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - - "github.com/pokt-network/poktroll/x/supplier/client/cli" - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface that defines the independent methods a Cosmos SDK module needs to implement. -type AppModuleBasic struct { - cdc codec.BinaryCodec -} - -func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} - -// Name returns the name of the module as a string -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(reg) -} - -// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) -} - -// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var genState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - return genState.Validate() -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) -} - -// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper -} - -func NewAppModule( - cdc codec.Codec, - keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, -) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - } -} - -// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) -} - -// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the module's genesis initialization. It returns no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, genState) - - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(genState) -} - -// ConsensusVersion is a sequence number for state-breaking change of the 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 } - -// BeginBlock contains the logic that is automatically triggered at the beginning of each block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} - -// EndBlock contains the logic that is automatically triggered at the end of each block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} diff --git a/x/supplier/module_simulation.go b/x/supplier/module_simulation.go deleted file mode 100644 index eb30e7dd3..000000000 --- a/x/supplier/module_simulation.go +++ /dev/null @@ -1,157 +0,0 @@ -package supplier - -import ( - "math/rand" - - "github.com/pokt-network/poktroll/testutil/sample" - suppliersimulation "github.com/pokt-network/poktroll/x/supplier/simulation" - "github.com/pokt-network/poktroll/x/supplier/types" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/cosmos/cosmos-sdk/x/simulation" -) - -// avoid unused import issue -var ( - _ = sample.AccAddress - _ = suppliersimulation.FindAccount - _ = simulation.MsgEntryKind - _ = baseapp.Paramspace - _ = rand.Rand{} -) - -const ( - opWeightMsgStakeSupplier = "op_weight_msg_stake_supplier" - // TODO: Determine the simulation weight value - defaultWeightMsgStakeSupplier int = 100 - - opWeightMsgUnstakeSupplier = "op_weight_msg_unstake_supplier" - // TODO: Determine the simulation weight value - defaultWeightMsgUnstakeSupplier int = 100 - - opWeightMsgCreateClaim = "op_weight_msg_create_claim" - // TODO: Determine the simulation weight value - defaultWeightMsgCreateClaim int = 100 - - opWeightMsgSubmitProof = "op_weight_msg_submit_proof" - // TODO: Determine the simulation weight value - defaultWeightMsgSubmitProof int = 100 - - // this line is used by starport scaffolding # simapp/module/const -) - -// GenerateGenesisState creates a randomized GenState of the module. -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - accs := make([]string, len(simState.Accounts)) - for i, acc := range simState.Accounts { - accs[i] = acc.Address.String() - } - supplierGenesis := types.GenesisState{ - Params: types.DefaultParams(), - // this line is used by starport scaffolding # simapp/module/genesisState - } - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&supplierGenesis) -} - -// RegisterStoreDecoder registers a decoder. -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - -// WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - operations := make([]simtypes.WeightedOperation, 0) - - var weightMsgStakeSupplier int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgStakeSupplier, &weightMsgStakeSupplier, nil, - func(_ *rand.Rand) { - weightMsgStakeSupplier = defaultWeightMsgStakeSupplier - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgStakeSupplier, - suppliersimulation.SimulateMsgStakeSupplier(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgUnstakeSupplier int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgUnstakeSupplier, &weightMsgUnstakeSupplier, nil, - func(_ *rand.Rand) { - weightMsgUnstakeSupplier = defaultWeightMsgUnstakeSupplier - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgUnstakeSupplier, - suppliersimulation.SimulateMsgUnstakeSupplier(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgCreateClaim int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgCreateClaim, &weightMsgCreateClaim, nil, - func(_ *rand.Rand) { - weightMsgCreateClaim = defaultWeightMsgCreateClaim - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgCreateClaim, - suppliersimulation.SimulateMsgCreateClaim(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgSubmitProof int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgSubmitProof, &weightMsgSubmitProof, nil, - func(_ *rand.Rand) { - weightMsgSubmitProof = defaultWeightMsgSubmitProof - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgSubmitProof, - suppliersimulation.SimulateMsgSubmitProof(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - // this line is used by starport scaffolding # simapp/module/operation - - return operations -} - -// ProposalMsgs returns msgs used for governance proposals for simulations. -func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { - return []simtypes.WeightedProposalMsg{ - simulation.NewWeightedProposalMsg( - opWeightMsgStakeSupplier, - defaultWeightMsgStakeSupplier, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - suppliersimulation.SimulateMsgStakeSupplier(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - simulation.NewWeightedProposalMsg( - opWeightMsgUnstakeSupplier, - defaultWeightMsgUnstakeSupplier, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - suppliersimulation.SimulateMsgUnstakeSupplier(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - simulation.NewWeightedProposalMsg( - opWeightMsgCreateClaim, - defaultWeightMsgCreateClaim, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - suppliersimulation.SimulateMsgCreateClaim(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - simulation.NewWeightedProposalMsg( - opWeightMsgSubmitProof, - defaultWeightMsgSubmitProof, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - suppliersimulation.SimulateMsgSubmitProof(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - // this line is used by starport scaffolding # simapp/module/OpMsg - } -} diff --git a/x/supplier/simulation/create_claim.go b/x/supplier/simulation/create_claim.go deleted file mode 100644 index cae471c06..000000000 --- a/x/supplier/simulation/create_claim.go +++ /dev/null @@ -1,30 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func SimulateMsgCreateClaim( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgCreateClaim{ - SupplierAddress: simAccount.Address.String(), - } - - // TODO: Handling the CreateClaim simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "CreateClaim simulation not implemented"), nil, nil - } -} diff --git a/x/supplier/simulation/helpers.go b/x/supplier/simulation/helpers.go deleted file mode 100644 index 92c437c0d..000000000 --- a/x/supplier/simulation/helpers.go +++ /dev/null @@ -1,15 +0,0 @@ -package simulation - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -// FindAccount find a specific address from an account list -func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { - creator, err := sdk.AccAddressFromBech32(address) - if err != nil { - panic(err) - } - return simtypes.FindAccount(accs, creator) -} diff --git a/x/supplier/simulation/stake_supplier.go b/x/supplier/simulation/stake_supplier.go deleted file mode 100644 index 95fb7e8d6..000000000 --- a/x/supplier/simulation/stake_supplier.go +++ /dev/null @@ -1,31 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func SimulateMsgStakeSupplier( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - stakeMsg := &types.MsgStakeSupplier{ - Address: simAccount.Address.String(), - // TODO: Update all stake message fields - } - - // TODO: Handling the StakeSupplier simulation - - return simtypes.NoOpMsg(types.ModuleName, stakeMsg.Type(), "StakeSupplier simulation not implemented"), nil, nil - } -} diff --git a/x/supplier/simulation/submit_proof.go b/x/supplier/simulation/submit_proof.go deleted file mode 100644 index 3473f1c7b..000000000 --- a/x/supplier/simulation/submit_proof.go +++ /dev/null @@ -1,30 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func SimulateMsgSubmitProof( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgSubmitProof{ - SupplierAddress: simAccount.Address.String(), - } - - // TODO: Handling the SubmitProof simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "SubmitProof simulation not implemented"), nil, nil - } -} diff --git a/x/supplier/simulation/unstake_supplier.go b/x/supplier/simulation/unstake_supplier.go deleted file mode 100644 index 3955b25db..000000000 --- a/x/supplier/simulation/unstake_supplier.go +++ /dev/null @@ -1,30 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func SimulateMsgUnstakeSupplier( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgUnstakeSupplier{ - Address: simAccount.Address.String(), - } - - // TODO: Handling the UnstakeSupplier simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "UnstakeSupplier simulation not implemented"), nil, nil - } -} diff --git a/x/supplier/types/codec.go b/x/supplier/types/codec.go deleted file mode 100644 index 5dc59bf31..000000000 --- a/x/supplier/types/codec.go +++ /dev/null @@ -1,36 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" -) - -func RegisterCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgStakeSupplier{}, "supplier/StakeSupplier", nil) - cdc.RegisterConcrete(&MsgUnstakeSupplier{}, "supplier/UnstakeSupplier", nil) - cdc.RegisterConcrete(&MsgCreateClaim{}, "supplier/CreateClaim", nil) - cdc.RegisterConcrete(&MsgSubmitProof{}, "supplier/SubmitProof", nil) - // this line is used by starport scaffolding # 2 -} - -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgStakeSupplier{}, - &MsgUnstakeSupplier{}, - ) - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgCreateClaim{}, - ) - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgSubmitProof{}, - ) - // this line is used by starport scaffolding # 3 - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) -) diff --git a/x/supplier/types/errors.go b/x/supplier/types/errors.go deleted file mode 100644 index 5406c8e3f..000000000 --- a/x/supplier/types/errors.go +++ /dev/null @@ -1,24 +0,0 @@ -package types - -// DONTCOVER - -import ( - sdkerrors "cosmossdk.io/errors" -) - -// x/supplier module sentinel errors -var ( - ErrSupplierInvalidStake = sdkerrors.Register(ModuleName, 1, "invalid supplier stake") - ErrSupplierInvalidAddress = sdkerrors.Register(ModuleName, 2, "invalid address") - ErrSupplierUnauthorized = sdkerrors.Register(ModuleName, 3, "unauthorized supplier signer") - ErrSupplierNotFound = sdkerrors.Register(ModuleName, 4, "supplier not found") - ErrSupplierInvalidServiceConfig = sdkerrors.Register(ModuleName, 5, "invalid service config") - ErrSupplierInvalidSessionStartHeight = sdkerrors.Register(ModuleName, 6, "invalid session start height") - ErrSupplierInvalidSessionId = sdkerrors.Register(ModuleName, 7, "invalid session ID") - ErrSupplierInvalidService = sdkerrors.Register(ModuleName, 8, "invalid service in supplier") - ErrSupplierInvalidClaimRootHash = sdkerrors.Register(ModuleName, 9, "invalid root hash") - ErrSupplierInvalidSessionEndHeight = sdkerrors.Register(ModuleName, 10, "invalid session ending height") - ErrSupplierInvalidQueryRequest = sdkerrors.Register(ModuleName, 11, "invalid query request") - ErrSupplierClaimNotFound = sdkerrors.Register(ModuleName, 12, "claim not found") - ErrSupplierProofNotFound = sdkerrors.Register(ModuleName, 13, "proof not found") -) diff --git a/x/supplier/types/expected_keepers.go b/x/supplier/types/expected_keepers.go deleted file mode 100644 index f6f8b626c..000000000 --- a/x/supplier/types/expected_keepers.go +++ /dev/null @@ -1,28 +0,0 @@ -package types - -//go:generate mockgen -destination ../../../testutil/supplier/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper,SessionKeeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" - - sessiontypes "github.com/pokt-network/poktroll/x/session/types" -) - -// AccountKeeper defines the expected account keeper used for simulations (noalias) -type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - // Methods imported from account should be defined here -} - -// BankKeeper defines the expected interface needed to retrieve account balances. -type BankKeeper interface { - DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error -} - -type SessionKeeper interface { - GetSession(context.Context, *sessiontypes.QueryGetSessionRequest) (*sessiontypes.QueryGetSessionResponse, error) -} diff --git a/x/supplier/types/genesis.go b/x/supplier/types/genesis.go deleted file mode 100644 index 9d06b42ff..000000000 --- a/x/supplier/types/genesis.go +++ /dev/null @@ -1,67 +0,0 @@ -package types - -import ( - "fmt" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - servicehelpers "github.com/pokt-network/poktroll/x/shared/helpers" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 - -// DefaultGenesis returns the default genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - SupplierList: []sharedtypes.Supplier{}, - // this line is used by starport scaffolding # genesis/types/default - Params: DefaultParams(), - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - // Check for duplicated index in supplier - supplierIndexMap := make(map[string]struct{}) - for _, supplier := range gs.SupplierList { - index := string(SupplierKey(supplier.Address)) - if _, ok := supplierIndexMap[index]; ok { - return fmt.Errorf("duplicated index for supplier") - } - supplierIndexMap[index] = struct{}{} - } - - // Check that the stake value for the suppliers is valid - for _, supplier := range gs.SupplierList { - // TODO_TECHDEBT: Consider creating shared helpers across the board for stake validation, - // similar to how we have `ValidateAppServiceConfigs` below - if supplier.Stake == nil { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "nil stake amount for supplier") - } - stake, err := sdk.ParseCoinNormalized(supplier.Stake.String()) - if !stake.IsValid() { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount for supplier %v; (%v)", supplier.Stake, stake.Validate()) - } - if err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "cannot parse stake amount for supplier %v; (%v)", supplier.Stake, err) - } - if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount for supplier: %v <= 0", supplier.Stake) - } - if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount denom for supplier %v", supplier.Stake) - } - - // Validate the application service configs - if err := servicehelpers.ValidateSupplierServiceConfigs(supplier.Services); err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidServiceConfig, err.Error()) - } - } - // this line is used by starport scaffolding # genesis/types/validate - - return gs.Params.Validate() -} diff --git a/x/supplier/types/genesis_test.go b/x/supplier/types/genesis_test.go deleted file mode 100644 index 5895fd717..000000000 --- a/x/supplier/types/genesis_test.go +++ /dev/null @@ -1,312 +0,0 @@ -package types_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/pokt-network/poktroll/testutil/sample" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/types" - "github.com/stretchr/testify/require" -) - -func TestGenesisState_Validate(t *testing.T) { - addr1 := sample.AccAddress() - stake1 := sdk.NewCoin("upokt", sdk.NewInt(100)) - serviceConfig1 := &sharedtypes.SupplierServiceConfig{ - Service: &sharedtypes.Service{ - Id: "svcId1", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8081", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - } - serviceList1 := []*sharedtypes.SupplierServiceConfig{serviceConfig1} - - addr2 := sample.AccAddress() - stake2 := sdk.NewCoin("upokt", sdk.NewInt(100)) - serviceConfig2 := &sharedtypes.SupplierServiceConfig{ - Service: &sharedtypes.Service{ - Id: "svcId2", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8082", - RpcType: sharedtypes.RPCType_GRPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - } - serviceList2 := []*sharedtypes.SupplierServiceConfig{serviceConfig2} - - tests := []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - valid: true, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{ - - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &stake2, - Services: serviceList2, - }, - }, - // this line is used by starport scaffolding # types/genesis/validField - }, - valid: true, - }, - { - desc: "invalid - zero supplier stake", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(0)}, - Services: serviceList2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - negative supplier stake", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(-100)}, - Services: serviceList2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - wrong stake denom", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "invalid", Amount: sdk.NewInt(100)}, - Services: serviceList2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - missing denom", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "", Amount: sdk.NewInt(100)}, - Services: serviceList2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to duplicated supplier address", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr1, - Stake: &stake2, - Services: serviceList2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to nil supplier stake", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: nil, - Services: serviceList2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to missing supplier stake", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - // Explicitly missing stake - Services: serviceList2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - missing services list", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &stake2, - // Services: intentionally omitted - }, - }, - }, - valid: false, - }, - { - desc: "invalid - empty services list", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &stake2, - Services: []*sharedtypes.SupplierServiceConfig{}, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - invalid URL", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &stake2, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId1", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "invalid URL", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - invalid RPC Type", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &stake2, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId1", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8081", - RpcType: sharedtypes.RPCType_UNKNOWN_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - }, - }, - valid: false, - }, - // this line is used by starport scaffolding # types/genesis/testcase - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } -} diff --git a/x/supplier/types/key_claim.go b/x/supplier/types/key_claim.go deleted file mode 100644 index e570a2341..000000000 --- a/x/supplier/types/key_claim.go +++ /dev/null @@ -1,39 +0,0 @@ -package types - -import ( - "encoding/binary" -) - -var _ binary.ByteOrder - -const ( - - // ClaimPrimaryKeyPrefix is the prefix to retrieve the entire Claim object (the primary store) - ClaimPrimaryKeyPrefix = "Claim/value/" - - // ClaimSupplierAddressPrefix is the key to retrieve a Claim's Primary Key from the Address index - ClaimSupplierAddressPrefix = "Claim/address/" - - // ClaimSessionEndHeightPrefix is the key to retrieve a Claim's Primary Key from the Height index - ClaimSessionEndHeightPrefix = "Claim/height/" -) - -// ClaimPrimaryKey returns the primary store key used to retrieve a Claim by creating a composite key of the sessionId and supplierAddr. -func ClaimPrimaryKey(sessionId, supplierAddr string) []byte { - // We are guaranteed uniqueness of the primary key if it's a composite of the (sessionId, supplierAddr) - // because every supplier can only have one claim per session. - return KeyComposite([]byte(sessionId), []byte(supplierAddr)) -} - -// ClaimSupplierAddressKey returns the key used to iterate through claims given a supplier Address. -func ClaimSupplierAddressKey(supplierAddr string, primaryKey []byte) []byte { - return KeyComposite([]byte(supplierAddr), primaryKey) -} - -// ClaimSupplierEndSessionHeightKey returns the key used to iterate through claims given a session end height. -func ClaimSupplierEndSessionHeightKey(sessionEndHeight int64, primaryKey []byte) []byte { - heightBz := make([]byte, 8) - binary.BigEndian.PutUint64(heightBz, uint64(sessionEndHeight)) - - return KeyComposite(heightBz, primaryKey) -} diff --git a/x/supplier/types/key_proof.go b/x/supplier/types/key_proof.go deleted file mode 100644 index f74bb7fa9..000000000 --- a/x/supplier/types/key_proof.go +++ /dev/null @@ -1,36 +0,0 @@ -package types - -import "encoding/binary" - -var _ binary.ByteOrder - -const ( - // ProofPrimaryKeyPrefix is the prefix to retrieve the entire Proof object (the primary store) - ProofPrimaryKeyPrefix = "Proof/value/" - - // ProofSupplierAddressPrefix is the key to retrieve a Proof's Primary Key from the Address index - ProofSupplierAddressPrefix = "Proof/address/" - - // ProofSessionEndHeightPrefix is the key to retrieve a Proof's Primary Key from the Height index - ProofSessionEndHeightPrefix = "Proof/height/" -) - -// ProofPrimaryKey returns the primary store key used to retrieve a Proof by creating a composite key of the sessionId and supplierAddr. -func ProofPrimaryKey(sessionId, supplierAddr string) []byte { - // We are guaranteed uniqueness of the primary key if it's a composite of the (sessionId, supplierAddr). - // because every supplier can only have one Proof per session. - return KeyComposite([]byte(sessionId), []byte(supplierAddr)) -} - -// ProofSupplierAddressKey returns the key used to iterate through Proofs given a supplier Address. -func ProofSupplierAddressKey(supplierAddr string, primaryKey []byte) []byte { - return KeyComposite([]byte(supplierAddr), primaryKey) -} - -// ProofSupplierEndSessionHeightKey returns the key used to iterate through Proofs given a session end height. -func ProofSupplierEndSessionHeightKey(sessionEndHeight int64, primaryKey []byte) []byte { - heightBz := make([]byte, 8) - binary.BigEndian.PutUint64(heightBz, uint64(sessionEndHeight)) - - return KeyComposite(heightBz, primaryKey) -} diff --git a/x/supplier/types/key_supplier.go b/x/supplier/types/key_supplier.go deleted file mode 100644 index 20f28a5c1..000000000 --- a/x/supplier/types/key_supplier.go +++ /dev/null @@ -1,23 +0,0 @@ -package types - -import "encoding/binary" - -var _ binary.ByteOrder - -const ( - // SupplierKeyPrefix is the prefix to retrieve all Supplier - SupplierKeyPrefix = "Supplier/value/" -) - -// SupplierKey returns the store key to retrieve a Supplier from the index fields -func SupplierKey( - address string, -) []byte { - var key []byte - - addressBytes := []byte(address) - key = append(key, addressBytes...) - key = append(key, []byte("/")...) - - return key -} diff --git a/x/supplier/types/keys.go b/x/supplier/types/keys.go deleted file mode 100644 index 138fd0f19..000000000 --- a/x/supplier/types/keys.go +++ /dev/null @@ -1,32 +0,0 @@ -package types - -import ( - "bytes" -) - -const ( - // ModuleName defines the module name - ModuleName = "supplier" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // RouterKey defines the module's message routing key - RouterKey = ModuleName - - // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_supplier" -) - -// KeyDelimiter is the delimiter for composite keys. -var KeyDelimiter = []byte("/") - -// KeyPrefix returns the given prefix as a byte slice for use with the KVStore. -func KeyPrefix(prefix string) []byte { - return []byte(prefix) -} - -// KeyComposite combines the given keys into a single key for use with KVStore. -func KeyComposite(keys ...[]byte) []byte { - return bytes.Join(keys, KeyDelimiter) -} diff --git a/x/supplier/types/message_create_claim.go b/x/supplier/types/message_create_claim.go deleted file mode 100644 index 0b20c27ec..000000000 --- a/x/supplier/types/message_create_claim.go +++ /dev/null @@ -1,74 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedhelpers "github.com/pokt-network/poktroll/x/shared/helpers" -) - -const TypeMsgCreateClaim = "create_claim" - -var _ sdk.Msg = (*MsgCreateClaim)(nil) - -func NewMsgCreateClaim( - supplierAddress string, - sessionHeader *sessiontypes.SessionHeader, - rootHash []byte, -) *MsgCreateClaim { - return &MsgCreateClaim{ - SupplierAddress: supplierAddress, - SessionHeader: sessionHeader, - RootHash: rootHash, - } -} - -func (msg *MsgCreateClaim) Route() string { - return RouterKey -} - -func (msg *MsgCreateClaim) Type() string { - return TypeMsgCreateClaim -} - -func (msg *MsgCreateClaim) GetSigners() []sdk.AccAddress { - supplierAddress, err := sdk.AccAddressFromBech32(msg.SupplierAddress) - if err != nil { - panic(err) - } - return []sdk.AccAddress{supplierAddress} -} - -func (msg *MsgCreateClaim) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgCreateClaim) ValidateBasic() error { - // Validate the supplier address - _, err := sdk.AccAddressFromBech32(msg.SupplierAddress) - if err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidAddress, "invalid supplierAddress address (%s)", err) - } - - // Validate the session header - sessionHeader := msg.SessionHeader - if sessionHeader.SessionStartBlockHeight < 1 { - return sdkerrors.Wrapf(ErrSupplierInvalidSessionStartHeight, "invalid session start block height (%d)", sessionHeader.SessionStartBlockHeight) - } - if len(sessionHeader.SessionId) == 0 { - return sdkerrors.Wrapf(ErrSupplierInvalidSessionId, "invalid session ID (%v)", sessionHeader.SessionId) - } - if !sharedhelpers.IsValidService(sessionHeader.Service) { - return sdkerrors.Wrapf(ErrSupplierInvalidService, "invalid service (%v)", sessionHeader.Service) - } - - // Validate the root hash - // TODO_IMPROVE: Only checking to make sure a non-nil hash was provided for now, but we can validate the length as well. - if len(msg.RootHash) == 0 { - return sdkerrors.Wrapf(ErrSupplierInvalidClaimRootHash, "invalid root hash (%v)", msg.RootHash) - } - - return nil -} diff --git a/x/supplier/types/message_create_claim_test.go b/x/supplier/types/message_create_claim_test.go deleted file mode 100644 index c46647ebe..000000000 --- a/x/supplier/types/message_create_claim_test.go +++ /dev/null @@ -1,109 +0,0 @@ -package types - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func TestMsgCreateClaim_ValidateBasic(t *testing.T) { - tests := []struct { - desc string - - msg MsgCreateClaim - err error - }{ - { - desc: "invalid address", - - msg: MsgCreateClaim{ - SupplierAddress: "invalid_address", - }, - err: ErrSupplierInvalidAddress, - }, - { - desc: "valid address but invalid session start height", - - msg: MsgCreateClaim{ - SupplierAddress: sample.AccAddress(), - SessionHeader: &sessiontypes.SessionHeader{ - SessionStartBlockHeight: 0, // Invalid start height - }, - }, - err: ErrSupplierInvalidSessionStartHeight, - }, - { - desc: "valid address and session start height but invalid session ID", - - msg: MsgCreateClaim{ - SupplierAddress: sample.AccAddress(), - SessionHeader: &sessiontypes.SessionHeader{ - SessionStartBlockHeight: 100, - SessionId: "", // Invalid session ID - }, - }, - err: ErrSupplierInvalidSessionId, - }, - { - desc: "valid address, session start height, session ID but invalid service", - - msg: MsgCreateClaim{ - SupplierAddress: sample.AccAddress(), - SessionHeader: &sessiontypes.SessionHeader{ - SessionStartBlockHeight: 100, - SessionId: "valid_session_id", - Service: &sharedtypes.Service{ - Id: "invalid_service_id", // Assuming this ID is invalid - }, // Should trigger error - }, - }, - err: ErrSupplierInvalidService, - }, - { - desc: "valid address, session start height, session ID, service but invalid root hash", - - msg: MsgCreateClaim{ - SupplierAddress: sample.AccAddress(), - SessionHeader: &sessiontypes.SessionHeader{ - SessionStartBlockHeight: 100, - SessionId: "valid_session_id", - Service: &sharedtypes.Service{ - Id: "svcId", // Assuming this ID is valid - }, - }, - RootHash: []byte(""), // Invalid root hash - }, - err: ErrSupplierInvalidClaimRootHash, - }, - { - desc: "all valid inputs", - - msg: MsgCreateClaim{ - SupplierAddress: sample.AccAddress(), - SessionHeader: &sessiontypes.SessionHeader{ - SessionStartBlockHeight: 100, - SessionId: "valid_session_id", - Service: &sharedtypes.Service{ - Id: "svcId", // Assuming this ID is valid - }, - }, - RootHash: []byte("valid_root_hash"), // Assuming this is valid - }, - err: nil, - }, - } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) - } else { - require.NoError(t, err) - } - }) - } -} diff --git a/x/supplier/types/message_stake_supplier.go b/x/supplier/types/message_stake_supplier.go deleted file mode 100644 index 7d1dbde07..000000000 --- a/x/supplier/types/message_stake_supplier.go +++ /dev/null @@ -1,81 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" - - servicehelpers "github.com/pokt-network/poktroll/x/shared/helpers" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -const TypeMsgStakeSupplier = "stake_supplier" - -var _ sdk.Msg = (*MsgStakeSupplier)(nil) - -func NewMsgStakeSupplier( - address string, - stake types.Coin, - services []*sharedtypes.SupplierServiceConfig, -) *MsgStakeSupplier { - return &MsgStakeSupplier{ - Address: address, - Stake: &stake, - Services: services, - } -} - -func (msg *MsgStakeSupplier) Route() string { - return RouterKey -} - -func (msg *MsgStakeSupplier) Type() string { - return TypeMsgStakeSupplier -} - -func (msg *MsgStakeSupplier) GetSigners() []sdk.AccAddress { - address, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - panic(err) - } - return []sdk.AccAddress{address} -} - -func (msg *MsgStakeSupplier) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgStakeSupplier) ValidateBasic() error { - // Validate the address - _, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidAddress, "invalid supplier address %s; (%v)", msg.Address, err) - } - - // TODO_TECHDEBT: Centralize stake related verification and share across different parts of the source code - // Validate the stake amount - if msg.Stake == nil { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "nil supplier stake; (%v)", err) - } - stake, err := sdk.ParseCoinNormalized(msg.Stake.String()) - if !stake.IsValid() { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid supplier stake %v; (%v)", msg.Stake, stake.Validate()) - } - if err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "cannot parse supplier stake %v; (%v)", msg.Stake, err) - } - if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount for supplier: %v <= 0", msg.Stake) - } - if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount denom for supplier %v", msg.Stake) - } - - // Validate the supplier service configs - if err := servicehelpers.ValidateSupplierServiceConfigs(msg.Services); err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidServiceConfig, err.Error()) - } - - return nil -} diff --git a/x/supplier/types/message_stake_supplier_test.go b/x/supplier/types/message_stake_supplier_test.go deleted file mode 100644 index 158fd8ff3..000000000 --- a/x/supplier/types/message_stake_supplier_test.go +++ /dev/null @@ -1,299 +0,0 @@ -package types - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// TODO_CLEANUP: This test has a lot of copy-pasted code from test to test. -// It can be simplified by splitting it into smaller tests where the common -// fields don't need to be explicitly specified from test to test. -func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { - - defaultServicesList := []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId1", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8081", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }} - - tests := []struct { - name string - msg MsgStakeSupplier - err error - }{ - // address related tests - { - name: "invalid address - nil stake", - msg: MsgStakeSupplier{ - Address: "invalid_address", - // Stake explicitly nil - Services: defaultServicesList, - }, - err: ErrSupplierInvalidAddress, - }, - - // stake related tests - { - name: "valid address - nil stake", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - // Stake explicitly nil - Services: defaultServicesList, - }, - err: ErrSupplierInvalidStake, - }, { - name: "valid address - valid stake", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: defaultServicesList, - }, - }, { - name: "valid address - zero stake", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(0)}, - Services: defaultServicesList, - }, - err: ErrSupplierInvalidStake, - }, { - name: "valid address - negative stake", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(-100)}, - Services: defaultServicesList, - }, - err: ErrSupplierInvalidStake, - }, { - name: "valid address - invalid stake denom", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "invalid", Amount: sdk.NewInt(100)}, - Services: defaultServicesList, - }, - err: ErrSupplierInvalidStake, - }, { - name: "valid address - invalid stake missing denom", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "", Amount: sdk.NewInt(100)}, - Services: defaultServicesList, - }, - err: ErrSupplierInvalidStake, - }, - - // service related tests - { - name: "valid service configs - multiple services", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId1", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8081", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - { - Service: &sharedtypes.Service{ - Id: "svcId2", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8082", - RpcType: sharedtypes.RPCType_GRPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - }, - { - name: "invalid service configs - omitted", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - // Services: intentionally omitted - }, - err: ErrSupplierInvalidServiceConfig, - }, - { - name: "invalid service configs - empty", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{}, - }, - err: ErrSupplierInvalidServiceConfig, - }, - { - name: "invalid service configs - invalid service ID that's too long", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "123456790", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8080", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - err: ErrSupplierInvalidServiceConfig, - }, - { - name: "invalid service configs - invalid service Name that's too long", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "123", - Name: "abcdefghijklmnopqrstuvwxyzab-abcdefghijklmnopqrstuvwxyzab", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8080", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - err: ErrSupplierInvalidServiceConfig, - }, - { - name: "invalid service configs - invalid service ID that contains invalid characters", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "12 45 !", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8080", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - err: ErrSupplierInvalidServiceConfig, - }, - { - name: "invalid service configs - missing url", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId", - Name: "name", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - // Url: intentionally omitted - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - err: ErrSupplierInvalidServiceConfig, - }, - { - name: "invalid service configs - invalid url", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId", - Name: "name", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "I am not a valid URL", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - err: ErrSupplierInvalidServiceConfig, - }, - { - name: "invalid service configs - missing rpc type", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId", - Name: "name", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8080", - // RpcType: intentionally omitted, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - err: ErrSupplierInvalidServiceConfig, - }, - // TODO_TEST: Need to add more tests around config types - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/supplier/types/message_submit_proof.go b/x/supplier/types/message_submit_proof.go deleted file mode 100644 index ad00eb225..000000000 --- a/x/supplier/types/message_submit_proof.go +++ /dev/null @@ -1,49 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - sessiontypes "github.com/pokt-network/poktroll/x/session/types" -) - -const TypeMsgSubmitProof = "submit_proof" - -var _ sdk.Msg = (*MsgSubmitProof)(nil) - -func NewMsgSubmitProof(supplierAddress string, sessionHeader *sessiontypes.SessionHeader, proof []byte) *MsgSubmitProof { - return &MsgSubmitProof{ - SupplierAddress: supplierAddress, - SessionHeader: sessionHeader, - Proof: proof, - } -} - -func (msg *MsgSubmitProof) Route() string { - return RouterKey -} - -func (msg *MsgSubmitProof) Type() string { - return TypeMsgSubmitProof -} - -func (msg *MsgSubmitProof) GetSigners() []sdk.AccAddress { - supplierAddress, err := sdk.AccAddressFromBech32(msg.SupplierAddress) - if err != nil { - panic(err) - } - return []sdk.AccAddress{supplierAddress} -} - -func (msg *MsgSubmitProof) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgSubmitProof) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.SupplierAddress) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid supplierAddress address (%s)", err) - } - return nil -} diff --git a/x/supplier/types/message_submit_proof_test.go b/x/supplier/types/message_submit_proof_test.go deleted file mode 100644 index 8479db05d..000000000 --- a/x/supplier/types/message_submit_proof_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package types - -import ( - "testing" - - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" -) - -// TODO(@bryanchriswhite): Add unit tests for message validation when adding the business logic. - -func TestMsgSubmitProof_ValidateBasic(t *testing.T) { - tests := []struct { - name string - msg MsgSubmitProof - err error - }{ - { - name: "invalid address", - msg: MsgSubmitProof{ - SupplierAddress: "invalid_address", - }, - err: sdkerrors.ErrInvalidAddress, - }, { - name: "valid address", - msg: MsgSubmitProof{ - SupplierAddress: sample.AccAddress(), - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/supplier/types/message_unstake_supplier.go b/x/supplier/types/message_unstake_supplier.go deleted file mode 100644 index 884c21c36..000000000 --- a/x/supplier/types/message_unstake_supplier.go +++ /dev/null @@ -1,45 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const TypeMsgUnstakeSupplier = "unstake_supplier" - -var _ sdk.Msg = (*MsgUnstakeSupplier)(nil) - -func NewMsgUnstakeSupplier(address string) *MsgUnstakeSupplier { - return &MsgUnstakeSupplier{ - Address: address, - } -} - -func (msg *MsgUnstakeSupplier) Route() string { - return RouterKey -} - -func (msg *MsgUnstakeSupplier) Type() string { - return TypeMsgUnstakeSupplier -} - -func (msg *MsgUnstakeSupplier) GetSigners() []sdk.AccAddress { - address, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - panic(err) - } - return []sdk.AccAddress{address} -} - -func (msg *MsgUnstakeSupplier) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgUnstakeSupplier) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidAddress, "invalid address address (%s)", err) - } - return nil -} diff --git a/x/supplier/types/message_unstake_supplier_test.go b/x/supplier/types/message_unstake_supplier_test.go deleted file mode 100644 index b447397ed..000000000 --- a/x/supplier/types/message_unstake_supplier_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package types - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" -) - -func TestMsgUnstakeSupplier_ValidateBasic(t *testing.T) { - tests := []struct { - name string - msg MsgUnstakeSupplier - err error - }{ - { - name: "invalid address", - msg: MsgUnstakeSupplier{ - Address: "invalid_address", - }, - err: ErrSupplierInvalidAddress, - }, { - name: "missing address", - msg: MsgUnstakeSupplier{}, - err: ErrSupplierInvalidAddress, - }, { - name: "valid address", - msg: MsgUnstakeSupplier{ - Address: sample.AccAddress(), - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/supplier/types/params.go b/x/supplier/types/params.go deleted file mode 100644 index 357196ad6..000000000 --- a/x/supplier/types/params.go +++ /dev/null @@ -1,39 +0,0 @@ -package types - -import ( - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "gopkg.in/yaml.v2" -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params instance -func NewParams() Params { - return Params{} -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams() -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} -} - -// Validate validates the set of params -func (p Params) Validate() error { - return nil -} - -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} diff --git a/x/supplier/types/query_validation.go b/x/supplier/types/query_validation.go deleted file mode 100644 index c7a352bd6..000000000 --- a/x/supplier/types/query_validation.go +++ /dev/null @@ -1,94 +0,0 @@ -package types - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/pkg/polylog" -) - -// NOTE: Please note that these messages are not of type `sdk.Msg`, and are therefore not a message/request -// that will be signable or invoke a state transition. However, following a similar `ValidateBasic` pattern -// allows us to localize & reuse validation logic. - -// ValidateBasic performs basic (non-state-dependant) validation on a QueryGetClaimRequest. -func (query *QueryGetClaimRequest) ValidateBasic() error { - // Validate the supplier address - if _, err := sdk.AccAddressFromBech32(query.SupplierAddress); err != nil { - return ErrSupplierInvalidAddress.Wrapf("invalid supplier address for claim being retrieved %s; (%v)", query.SupplierAddress, err) - } - - // TODO_TECHDEBT: Validate the session ID once we have a deterministic way to generate it - if query.SessionId == "" { - return ErrSupplierInvalidSessionId.Wrapf("invalid session ID for claim being retrieved %s", query.SessionId) - } - - return nil -} - -// ValidateBasic performs basic (non-state-dependant) validation on a QueryAllClaimsRequest. -func (query *QueryAllClaimsRequest) ValidateBasic() error { - logger := polylog.Ctx(context.Background()) - - switch filter := query.Filter.(type) { - case *QueryAllClaimsRequest_SupplierAddress: - if _, err := sdk.AccAddressFromBech32(filter.SupplierAddress); err != nil { - return ErrSupplierInvalidAddress.Wrapf("invalid supplier address for claims being retrieved %s; (%v)", filter.SupplierAddress, err) - } - - case *QueryAllClaimsRequest_SessionId: - logger.Warn(). - Str("session_id", filter.SessionId). - Msg("TODO_TECHDEBT: Validate the session ID once we have a deterministic way to generate it") - - case *QueryAllClaimsRequest_SessionEndHeight: - if filter.SessionEndHeight < 0 { - return ErrSupplierInvalidSessionEndHeight.Wrapf("invalid session end height for claims being retrieved %d", filter.SessionEndHeight) - } - } - - return nil -} - -func (query *QueryGetProofRequest) ValidateBasic() error { - // Validate the supplier address - if _, err := sdk.AccAddressFromBech32(query.SupplierAddress); err != nil { - return ErrSupplierInvalidAddress.Wrapf("invalid supplier address for proof being retrieved %s; (%v)", query.SupplierAddress, err) - } - - // TODO_TECHDEBT: Validate the session ID once we have a deterministic way to generate it - if query.SessionId == "" { - return ErrSupplierInvalidSessionId.Wrapf("invalid session ID for proof being retrieved %s", query.SessionId) - } - - return nil -} - -func (query *QueryAllProofsRequest) ValidateBasic() error { - // TODO_TECHDEBT: update function signature to receive a context. - logger := polylog.Ctx(context.TODO()) - - switch filter := query.Filter.(type) { - case *QueryAllProofsRequest_SupplierAddress: - if _, err := sdk.AccAddressFromBech32(filter.SupplierAddress); err != nil { - return ErrSupplierInvalidAddress.Wrapf("invalid supplier address for proofs being retrieved %s; (%v)", filter.SupplierAddress, err) - } - - case *QueryAllProofsRequest_SessionId: - logger.Warn(). - Str("session_id", filter.SessionId). - Msg("TODO_TECHDEBT: Validate the session ID once we have a deterministic way to generate it") - - case *QueryAllProofsRequest_SessionEndHeight: - if filter.SessionEndHeight < 0 { - return ErrSupplierInvalidSessionEndHeight.Wrapf("invalid session end height for proofs being retrieved %d", filter.SessionEndHeight) - } - - default: - // No filter is set - logger.Debug().Msg("No specific filter set when requesting claims") - } - - return nil -} diff --git a/x/supplier/types/types.go b/x/supplier/types/types.go deleted file mode 100644 index ab1254f4c..000000000 --- a/x/supplier/types/types.go +++ /dev/null @@ -1 +0,0 @@ -package types diff --git a/x/tokenomics/client/cli/helpers_test.go b/x/tokenomics/client/cli/helpers_test.go deleted file mode 100644 index bbcee251e..000000000 --- a/x/tokenomics/client/cli/helpers_test.go +++ /dev/null @@ -1,32 +0,0 @@ -// Package cli_test provides unit tests for the CLI functionality. -package cli_test - -import ( - "strconv" - "testing" - - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/x/tokenomics/types" - "github.com/stretchr/testify/require" -) - -// Dummy variable to avoid unused import error. -var _ = strconv.IntSize - -// init initializes the SDK configuration. -func init() { - cmd.InitSDKConfig() -} - -// networkWithDefaultConfig is a helper function to create a network for testing -// with a default tokenomics genesis state. -func networkWithDefaultConfig(t *testing.T) *network.Network { - t.Helper() - cfg := network.DefaultConfig() - tokenomicsGenesisState := network.DefaultTokenomicsModuleGenesisState(t) - buf, err := cfg.Codec.MarshalJSON(tokenomicsGenesisState) - require.NoError(t, err) - cfg.GenesisState[types.ModuleName] = buf - return network.New(t, cfg) -} diff --git a/x/tokenomics/client/cli/query.go b/x/tokenomics/client/cli/query.go deleted file mode 100644 index c11674331..000000000 --- a/x/tokenomics/client/cli/query.go +++ /dev/null @@ -1,31 +0,0 @@ -package cli - -import ( - "fmt" - // "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - // Group tokenomics queries under a subcommand - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdQueryParams()) - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/tokenomics/client/cli/query_params.go b/x/tokenomics/client/cli/query_params.go deleted file mode 100644 index 16c3b3a8b..000000000 --- a/x/tokenomics/client/cli/query_params.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - 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.Params(cmd.Context(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/tokenomics/client/cli/tx.go b/x/tokenomics/client/cli/tx.go deleted file mode 100644 index 4aa62f068..000000000 --- a/x/tokenomics/client/cli/tx.go +++ /dev/null @@ -1,37 +0,0 @@ -package cli - -import ( - "fmt" - "time" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdUpdateParams()) - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/tokenomics/client/cli/tx_update_params.go b/x/tokenomics/client/cli/tx_update_params.go deleted file mode 100644 index a2b79a63b..000000000 --- a/x/tokenomics/client/cli/tx_update_params.go +++ /dev/null @@ -1,59 +0,0 @@ -package cli - -import ( - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -var _ = strconv.Itoa(0) - -// TODO_BLOCKER(#322): Update the CLI once we determine settle on how to maintain and update parameters. -// TODO_TECHDEBT(@red-0ne): Add a config file for on-chain parameters. -func CmdUpdateParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "update-params ", - Short: "Update the parameters of the tokenomics module", - Long: `Update the parameters in the tokenomics module.", - -All parameters must be provided when updating. - -Example: -$ poktrolld tx tokenomics update-params --from pnf --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) (err error) { - // Parse computeUnitsToTokensMultiplier - computeUnitsToTokensMultiplier, err := strconv.ParseUint(args[0], 10, 64) - if err != nil { - return err - } - - // Get client context - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - // Create update params message - msg := types.NewMsgUpdateParams( - clientCtx.GetFromAddress().String(), - computeUnitsToTokensMultiplier, - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - - res := tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - return res - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/tokenomics/client/cli/tx_update_params_test.go b/x/tokenomics/client/cli/tx_update_params_test.go deleted file mode 100644 index fdb7b7334..000000000 --- a/x/tokenomics/client/cli/tx_update_params_test.go +++ /dev/null @@ -1,68 +0,0 @@ -package cli_test - -import ( - "fmt" - "testing" - - tmcli "github.com/cometbft/cometbft/libs/cli" - "github.com/cosmos/cosmos-sdk/client/flags" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/gogo/status" - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/x/tokenomics/client/cli" - "github.com/pokt-network/poktroll/x/tokenomics/types" - "github.com/stretchr/testify/require" -) - -func TestCLI_UpdateParams(t *testing.T) { - net := networkWithDefaultConfig(t) - ctx := net.Validators[0].ClientCtx - - common := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - fmt.Sprintf("--%s=%s", flags.FlagFrom, net.Validators[0].Address.String()), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, network.NewBondDenomCoins(t, net, 10)), - } - - tests := []struct { - desc string - args []string - expectedErr error - expectedExtraErrMsg string - }{ - { - desc: "valid update of all params", - args: []string{"42"}, - expectedErr: nil, - }, - { - desc: "invalid compute_units_to_tokens_multiplier update", - args: []string{"0"}, - expectedErr: types.ErrTokenomicsParamsInvalid, - expectedExtraErrMsg: "invalid ComputeUnitsToTokensMultiplier", - }, - } - - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - args := append(common, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdUpdateParams(), args) - if tc.expectedErr != nil { - _, ok := status.FromError(tc.expectedErr) - require.True(t, ok) - require.ErrorIs(t, err, tc.expectedErr) - require.Contains(t, err.Error(), tc.expectedExtraErrMsg) - } else { - require.NoError(t, err) - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) - } - }) - } -} diff --git a/x/tokenomics/genesis.go b/x/tokenomics/genesis.go deleted file mode 100644 index 6197d5960..000000000 --- a/x/tokenomics/genesis.go +++ /dev/null @@ -1,24 +0,0 @@ -package tokenomics - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/tokenomics/keeper" - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -// InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) -} - -// ExportGenesis returns the module's exported genesis -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) - - // this line is used by starport scaffolding # genesis/module/export - - return genesis -} diff --git a/x/tokenomics/genesis_test.go b/x/tokenomics/genesis_test.go deleted file mode 100644 index 24faddd65..000000000 --- a/x/tokenomics/genesis_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package tokenomics_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/tokenomics" - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -func TestGenesis(t *testing.T) { - genesisState := types.GenesisState{ - Params: types.DefaultParams(), - - // this line is used by starport scaffolding # genesis/test/state - } - - k, ctx := keepertest.TokenomicsKeeper(t) - tokenomics.InitGenesis(ctx, *k, genesisState) - got := tokenomics.ExportGenesis(ctx, *k) - require.NotNil(t, got) - - nullify.Fill(&genesisState) - nullify.Fill(got) - - // this line is used by starport scaffolding # genesis/test/assert -} diff --git a/x/tokenomics/keeper/keeper.go b/x/tokenomics/keeper/keeper.go deleted file mode 100644 index 635b330a4..000000000 --- a/x/tokenomics/keeper/keeper.go +++ /dev/null @@ -1,67 +0,0 @@ -package keeper - -import ( - "fmt" - - "github.com/cometbft/cometbft/libs/log" - "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -// Keeper is the structure that implements the `KeeperI` interface. - -// TODO_TECHDEBT(#240): See `x/nft/keeper.keeper.go` in the Cosmos SDK on how -// we should refactor all our keepers. This keeper has started following a small -// subset of those patterns. -type Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace - - // keeper dependencies - bankKeeper types.BankKeeper - - // the address capable of executing a MsgUpdateParams message. Typically, this - // should be the x/gov module account. - authority string -} - -func NewKeeper( - cdc codec.BinaryCodec, - storeKey, - memKey storetypes.StoreKey, - ps paramtypes.Subspace, - - // keeper dependencies - bankKeeper types.BankKeeper, - - authority string, -) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } - - return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramstore: ps, - - authority: authority, - } -} - -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} - -// GetAuthority returns the x/tokenomics module's authority. -func (k Keeper) GetAuthority() string { - return k.authority -} diff --git a/x/tokenomics/keeper/msg_server.go b/x/tokenomics/keeper/msg_server.go deleted file mode 100644 index ab7353c82..000000000 --- a/x/tokenomics/keeper/msg_server.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -type msgServer struct { - Keeper -} - -// NewMsgServerImpl returns an implementation of the MsgServer interface -// for the provided Keeper. -func NewMsgServerImpl(keeper Keeper) types.MsgServer { - return &msgServer{Keeper: keeper} -} - -var _ types.MsgServer = msgServer{} diff --git a/x/tokenomics/keeper/msg_server_test.go b/x/tokenomics/keeper/msg_server_test.go deleted file mode 100644 index 545dff143..000000000 --- a/x/tokenomics/keeper/msg_server_test.go +++ /dev/null @@ -1,24 +0,0 @@ -package keeper_test - -import ( - "context" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/tokenomics/keeper" - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { - k, ctx := testkeeper.TokenomicsKeeper(t) - return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx) -} - -func TestMsgServer(t *testing.T) { - ms, ctx := setupMsgServer(t) - require.NotNil(t, ms) - require.NotNil(t, ctx) -} diff --git a/x/tokenomics/keeper/msg_server_update_params.go b/x/tokenomics/keeper/msg_server_update_params.go deleted file mode 100644 index 837904c2e..000000000 --- a/x/tokenomics/keeper/msg_server_update_params.go +++ /dev/null @@ -1,53 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - logger := k.Logger(ctx) - - if err := msg.ValidateBasic(); err != nil { - return nil, err - } - - // TODO_BLOCKER(@Olshansk): How do we validate this is the same address that signed the request? - // Do we have to use `msg.GetSigners()` explicitly during the check/validation or - // does the `cosmos.msg.v1.signer` tag in the protobuf definition enforce - // this somewhere in the Cosmos SDK? - if msg.Authority != k.GetAuthority() { - return nil, types.ErrTokenomicsAuthorityAddressMismatch - } - - prevParams := k.GetParams(ctx) - logger.Info("About to update params from [%v] to [%v]", prevParams, msg.Params) - k.SetParams(ctx, msg.Params) - logger.Info("Done updating params") - - return &types.MsgUpdateParamsResponse{}, nil -} - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams( - k.ComputeUnitsToTokensMultiplier(ctx), - ) -} - -// SetParams set the params -// TODO_IMPROVE: We are following a pattern from `Cosmos v0.50` that does not -// return errors. Opportunity to investigate better approaches. -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} - -// ComputeUnitsToTokensMultiplier returns the ComputeUnitsToTokensMultiplier param -func (k Keeper) ComputeUnitsToTokensMultiplier(ctx sdk.Context) (res uint64) { - k.paramstore.Get(ctx, types.KeyComputeUnitsToTokensMultiplier, &res) - return -} diff --git a/x/tokenomics/keeper/msg_server_update_params_test.go b/x/tokenomics/keeper/msg_server_update_params_test.go deleted file mode 100644 index 831244f72..000000000 --- a/x/tokenomics/keeper/msg_server_update_params_test.go +++ /dev/null @@ -1,138 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/tokenomics/keeper" - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -func TestUpdateParams_Validity(t *testing.T) { - Keeper, ctx := testkeeper.TokenomicsKeeper(t) - srv := keeper.NewMsgServerImpl(*Keeper) - - params := types.DefaultParams() - Keeper.SetParams(ctx, params) - - tests := []struct { - desc string - - req *types.MsgUpdateParams - - expectErr bool - expectedPanic bool - expErrMsg string - }{ - { - desc: "invalid authority address", - - req: &types.MsgUpdateParams{ - Authority: "invalid", - Params: types.Params{ - ComputeUnitsToTokensMultiplier: 1, - }, - }, - - expectErr: true, - expectedPanic: false, - expErrMsg: "invalid authority", - }, - { - desc: "incorrect authority address", - - req: &types.MsgUpdateParams{ - Authority: sample.AccAddress(), - Params: types.Params{ - ComputeUnitsToTokensMultiplier: 1, - }, - }, - - expectErr: true, - expectedPanic: false, - expErrMsg: "the provided authority address does not match the on-chain governance address", - }, - { - desc: "invalid ComputeUnitsToTokensMultiplier", - - req: &types.MsgUpdateParams{ - Authority: Keeper.GetAuthority(), - - Params: types.Params{ - ComputeUnitsToTokensMultiplier: 0, - }, - }, - - expectErr: true, - expectedPanic: true, - expErrMsg: "invalid compute to tokens multiplier", - }, - { - desc: "successful param update", - - req: &types.MsgUpdateParams{ - Authority: Keeper.GetAuthority(), - - Params: types.Params{ - ComputeUnitsToTokensMultiplier: 1000000, - }, - }, - - expectedPanic: false, - expectErr: false, - }, - } - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - if tt.expectedPanic { - defer func() { - if r := recover(); r != nil { - _, err := srv.UpdateParams(ctx, tt.req) - require.Error(t, err) - } - }() - return - } - _, err := srv.UpdateParams(ctx, tt.req) - if tt.expectErr { - require.Error(t, err) - require.ErrorContains(t, err, tt.expErrMsg) - } else { - require.Nil(t, err) - } - }) - } -} - -func TestUpdateParams_ComputeUnitsToTokensMultiplier(t *testing.T) { - Keeper, ctx := testkeeper.TokenomicsKeeper(t) - srv := keeper.NewMsgServerImpl(*Keeper) - - // Set the default params - Keeper.SetParams(ctx, types.DefaultParams()) - - // Verify the default value for ComputeUnitsToTokensMultiplier - getParamsReq := &types.QueryParamsRequest{} - getParamsRes, err := Keeper.Params(ctx, getParamsReq) - require.Nil(t, err) - require.Equal(t, uint64(42), getParamsRes.Params.GetComputeUnitsToTokensMultiplier()) - - // Update the value for ComputeUnitsToTokensMultiplier - updateParamsReq := &types.MsgUpdateParams{ - Authority: Keeper.GetAuthority(), - Params: types.Params{ - ComputeUnitsToTokensMultiplier: 69, - }, - } - _, err = srv.UpdateParams(ctx, updateParamsReq) - require.Nil(t, err) - - // Verify that ComputeUnitsToTokensMultiplier was updated - getParamsRes, err = Keeper.Params(ctx, getParamsReq) - require.Nil(t, err) - require.Equal(t, uint64(69), getParamsRes.Params.GetComputeUnitsToTokensMultiplier()) -} diff --git a/x/tokenomics/keeper/query.go b/x/tokenomics/keeper/query.go deleted file mode 100644 index bb812a52f..000000000 --- a/x/tokenomics/keeper/query.go +++ /dev/null @@ -1,7 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -var _ types.QueryServer = Keeper{} diff --git a/x/tokenomics/keeper/query_params.go b/x/tokenomics/keeper/query_params.go deleted file mode 100644 index f8a4d0dc4..000000000 --- a/x/tokenomics/keeper/query_params.go +++ /dev/null @@ -1,20 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil -} diff --git a/x/tokenomics/keeper/query_params_test.go b/x/tokenomics/keeper/query_params_test.go deleted file mode 100644 index 19a5e9edc..000000000 --- a/x/tokenomics/keeper/query_params_test.go +++ /dev/null @@ -1,32 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -func TestGetParams(t *testing.T) { - k, ctx := testkeeper.TokenomicsKeeper(t) - params := types.DefaultParams() - - k.SetParams(ctx, params) - - require.EqualValues(t, params, k.GetParams(ctx)) - require.EqualValues(t, params.ComputeUnitsToTokensMultiplier, k.ComputeUnitsToTokensMultiplier(ctx)) -} - -func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.TokenomicsKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - params := types.DefaultParams() - keeper.SetParams(ctx, params) - - response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) - require.NoError(t, err) - require.Equal(t, &types.QueryParamsResponse{Params: params}, response) -} diff --git a/x/tokenomics/keeper/settle_session_accounting.go b/x/tokenomics/keeper/settle_session_accounting.go deleted file mode 100644 index 274a2fe3a..000000000 --- a/x/tokenomics/keeper/settle_session_accounting.go +++ /dev/null @@ -1,23 +0,0 @@ -package keeper - -import ( - "context" - - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" -) - -// SettleSessionAccounting is responsible for all of the post-session accounting -// necessary to burn, mint or transfer tokens depending on the amount of work -// done. The amount of "work done" complete is dictated by `sum` of `root`. -// -// ASSUMPTION: It is assumed the caller of this function validated the claim -// against a proof BEFORE calling this function. -// -// TODO_BLOCKER(@Olshansk): Is there a way to limit who can call this function? -// TODO_UPNEXT(#323, @Olshansk): Implement this function -func (k Keeper) SettleSessionAccounting( - goCtx context.Context, - claim *suppliertypes.Claim, -) error { - return nil -} diff --git a/x/tokenomics/module.go b/x/tokenomics/module.go deleted file mode 100644 index e54983755..000000000 --- a/x/tokenomics/module.go +++ /dev/null @@ -1,146 +0,0 @@ -package tokenomics - -import ( - "context" - "encoding/json" - "fmt" - - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/tokenomics/client/cli" - "github.com/pokt-network/poktroll/x/tokenomics/keeper" - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface that defines the independent methods a Cosmos SDK module needs to implement. -type AppModuleBasic struct { - cdc codec.BinaryCodec -} - -func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} - -// Name returns the name of the module as a string -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(reg) -} - -// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) -} - -// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var genState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - return genState.Validate() -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) -} - -// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper -} - -func NewAppModule( - cdc codec.Codec, - keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, -) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - } -} - -// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) -} - -// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the module's genesis initialization. It returns no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, genState) - - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(genState) -} - -// ConsensusVersion is a sequence number for state-breaking change of the 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 } - -// BeginBlock contains the logic that is automatically triggered at the beginning of each block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} - -// EndBlock contains the logic that is automatically triggered at the end of each block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} diff --git a/x/tokenomics/module_simulation.go b/x/tokenomics/module_simulation.go deleted file mode 100644 index 6c5e2eab6..000000000 --- a/x/tokenomics/module_simulation.go +++ /dev/null @@ -1,88 +0,0 @@ -package tokenomics - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/cosmos/cosmos-sdk/x/simulation" - - "github.com/pokt-network/poktroll/testutil/sample" - tokenomicssimulation "github.com/pokt-network/poktroll/x/tokenomics/simulation" - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -// avoid unused import issue -var ( - _ = sample.AccAddress - _ = tokenomicssimulation.FindAccount - _ = simulation.MsgEntryKind - _ = baseapp.Paramspace - _ = rand.Rand{} -) - -const ( - opWeightMsgUpdateParams = "op_weight_msg_update_params" - // TODO: Determine the simulation weight value - defaultWeightMsgUpdateParams int = 100 - - // this line is used by starport scaffolding # simapp/module/const -) - -// GenerateGenesisState creates a randomized GenState of the module. -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - accs := make([]string, len(simState.Accounts)) - for i, acc := range simState.Accounts { - accs[i] = acc.Address.String() - } - tokenomicsGenesis := types.GenesisState{ - Params: types.DefaultParams(), - // this line is used by starport scaffolding # simapp/module/genesisState - } - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&tokenomicsGenesis) -} - -// RegisterStoreDecoder registers a decoder. -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - -// WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - operations := make([]simtypes.WeightedOperation, 0) - - var weightMsgUpdateParams int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgUpdateParams, &weightMsgUpdateParams, nil, - func(_ *rand.Rand) { - weightMsgUpdateParams = defaultWeightMsgUpdateParams - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgUpdateParams, - tokenomicssimulation.SimulateMsgUpdateParams(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - // this line is used by starport scaffolding # simapp/module/operation - - return operations -} - -// ProposalMsgs returns msgs used for governance proposals for simulations. -func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { - return []simtypes.WeightedProposalMsg{ - simulation.NewWeightedProposalMsg( - opWeightMsgUpdateParams, - defaultWeightMsgUpdateParams, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - tokenomicssimulation.SimulateMsgUpdateParams(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - // this line is used by starport scaffolding # simapp/module/OpMsg - } -} diff --git a/x/tokenomics/simulation/helpers.go b/x/tokenomics/simulation/helpers.go deleted file mode 100644 index c260f2fcd..000000000 --- a/x/tokenomics/simulation/helpers.go +++ /dev/null @@ -1,15 +0,0 @@ -package simulation - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -// FindAccount find a specific address from an account list -func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { - addr, err := sdk.AccAddressFromBech32(address) - if err != nil { - panic(err) - } - return simtypes.FindAccount(accs, addr) -} diff --git a/x/tokenomics/simulation/update_params.go b/x/tokenomics/simulation/update_params.go deleted file mode 100644 index 70b7599cc..000000000 --- a/x/tokenomics/simulation/update_params.go +++ /dev/null @@ -1,30 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/pokt-network/poktroll/x/tokenomics/keeper" - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -func SimulateMsgUpdateParams( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgUpdateParams{ - Authority: simAccount.Address.String(), - } - - // TODO: Handling the UpdateParams simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "UpdateParams simulation not implemented"), nil, nil - } -} diff --git a/x/tokenomics/types/codec.go b/x/tokenomics/types/codec.go deleted file mode 100644 index 2fc398bd4..000000000 --- a/x/tokenomics/types/codec.go +++ /dev/null @@ -1,31 +0,0 @@ -package types - -import ( - // this line is used by starport scaffolding # 1 - - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" -) - -func RegisterCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(Params{}, "tokenomics/Params", nil) - cdc.RegisterConcrete(&MsgUpdateParams{}, "tokenomics/UpdateParams", nil) - // this line is used by starport scaffolding # 2 -} - -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgUpdateParams{}, - ) - - // this line is used by starport scaffolding # 3 - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) -) diff --git a/x/tokenomics/types/errors.go b/x/tokenomics/types/errors.go deleted file mode 100644 index 441d57847..000000000 --- a/x/tokenomics/types/errors.go +++ /dev/null @@ -1,20 +0,0 @@ -package types - -// DONTCOVER - -import ( - sdkerrors "cosmossdk.io/errors" -) - -// x/tokenomics module sentinel errors -var ( - ErrTokenomicsAuthorityAddressInvalid = sdkerrors.Register(ModuleName, 1, "the provided authority address is not a valid bech32 address") - ErrTokenomicsAuthorityAddressMismatch = sdkerrors.Register(ModuleName, 2, "the provided authority address does not match the on-chain governance address") - ErrTokenomicsClaimNil = sdkerrors.Register(ModuleName, 3, "provided claim is nil") - ErrTokenomicsSessionHeaderNil = sdkerrors.Register(ModuleName, 4, "provided claim's session header is nil") - ErrTokenomicsSupplierModuleMintFailed = sdkerrors.Register(ModuleName, 5, "failed to mint uPOKT to supplier module account") - ErrTokenomicsSupplierRewardFailed = sdkerrors.Register(ModuleName, 6, "failed to send uPOKT from supplier module account to supplier") - ErrTokenomicsApplicationModuleBurn = sdkerrors.Register(ModuleName, 7, "failed to burn uPOKT from application module account") - ErrTokenomicsApplicationModuleFeeFailed = sdkerrors.Register(ModuleName, 8, "failed to send uPOKT from application module account to application") - ErrTokenomicsParamsInvalid = sdkerrors.Register(ModuleName, 9, "provided params are invalid") -) diff --git a/x/tokenomics/types/expected_keepers.go b/x/tokenomics/types/expected_keepers.go deleted file mode 100644 index bd77b8bef..000000000 --- a/x/tokenomics/types/expected_keepers.go +++ /dev/null @@ -1,23 +0,0 @@ -package types - -//go:generate mockgen -destination ../../../testutil/tokenomics/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" -) - -// AccountKeeper defines the expected account keeper used for simulations (noalias) -type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - // Methods imported from account should be defined here -} - -// BankKeeper defines the expected interface needed to retrieve account balances. -type BankKeeper interface { - MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error -} diff --git a/x/tokenomics/types/genesis.go b/x/tokenomics/types/genesis.go deleted file mode 100644 index 0af9b4416..000000000 --- a/x/tokenomics/types/genesis.go +++ /dev/null @@ -1,24 +0,0 @@ -package types - -import ( -// this line is used by starport scaffolding # genesis/types/import -) - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 - -// DefaultGenesis returns the default genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - // this line is used by starport scaffolding # genesis/types/default - Params: DefaultParams(), - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - // this line is used by starport scaffolding # genesis/types/validate - - return gs.Params.Validate() -} diff --git a/x/tokenomics/types/genesis_test.go b/x/tokenomics/types/genesis_test.go deleted file mode 100644 index ad3aaa914..000000000 --- a/x/tokenomics/types/genesis_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/pokt-network/poktroll/x/tokenomics/types" - "github.com/stretchr/testify/require" -) - -func TestGenesisState_Validate(t *testing.T) { - tests := []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - valid: true, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{ - Params: types.Params{ - ComputeUnitsToTokensMultiplier: 1, - }, - // this line is used by starport scaffolding # types/genesis/validField - }, - valid: true, - }, - { - desc: "invalid genesis state - ComputeUnitsToTokensMultiplier is 0", - genState: &types.GenesisState{ - Params: types.Params{ - ComputeUnitsToTokensMultiplier: 0, - }, - // this line is used by starport scaffolding # types/genesis/validField - }, - valid: false, - }, - // this line is used by starport scaffolding # types/genesis/testcase - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } -} diff --git a/x/tokenomics/types/keys.go b/x/tokenomics/types/keys.go deleted file mode 100644 index c3664bad9..000000000 --- a/x/tokenomics/types/keys.go +++ /dev/null @@ -1,19 +0,0 @@ -package types - -const ( - // ModuleName defines the module name - ModuleName = "tokenomics" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // RouterKey defines the module's message routing key - RouterKey = ModuleName - - // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_tokenomics" -) - -func KeyPrefix(p string) []byte { - return []byte(p) -} diff --git a/x/tokenomics/types/message_update_params.go b/x/tokenomics/types/message_update_params.go deleted file mode 100644 index 553032915..000000000 --- a/x/tokenomics/types/message_update_params.go +++ /dev/null @@ -1,66 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const TypeMsgUpdateParams = "update_params" - -var _ sdk.Msg = (*MsgUpdateParams)(nil) - -func NewMsgUpdateParams( - authority string, - compute_units_to_tokens_multiplier uint64, -) *MsgUpdateParams { - return &MsgUpdateParams{ - Authority: authority, - Params: Params{ - ComputeUnitsToTokensMultiplier: compute_units_to_tokens_multiplier, - }, - } -} - -func (msg *MsgUpdateParams) Route() string { - return RouterKey -} - -func (msg *MsgUpdateParams) Type() string { - return TypeMsgUpdateParams -} - -func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { - authority, err := sdk.AccAddressFromBech32(msg.Authority) - if err != nil { - panic(err) - } - return []sdk.AccAddress{authority} -} - -func (msg *MsgUpdateParams) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgUpdateParams) ValidateBasic() error { - // Validate the address - _, err := sdk.AccAddressFromBech32(msg.Authority) - if err != nil { - return sdkerrors.Wrapf(ErrTokenomicsAuthorityAddressInvalid, "invalid authority address %s; (%v)", msg.Authority, err) - } - - // Validate the params - if err := msg.Params.ValidateBasic(); err != nil { - return err - } - - return nil -} - -func (params *Params) ValidateBasic() error { - // Validate the ComputeUnitsToTokensMultiplier - if params.ComputeUnitsToTokensMultiplier == 0 { - return sdkerrors.Wrapf(ErrTokenomicsParamsInvalid, "invalid ComputeUnitsToTokensMultiplier; (%v)", params.ComputeUnitsToTokensMultiplier) - } - return nil -} diff --git a/x/tokenomics/types/message_update_params_test.go b/x/tokenomics/types/message_update_params_test.go deleted file mode 100644 index 0ac9863b7..000000000 --- a/x/tokenomics/types/message_update_params_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package types - -import ( - "testing" - - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/stretchr/testify/require" -) - -func TestMsgUpdateParams_ValidateBasic(t *testing.T) { - tests := []struct { - desc string - - msg MsgUpdateParams - - expectedErr error - }{ - { - desc: "invalid authority address", - msg: MsgUpdateParams{ - Authority: "invalid_address", - Params: Params{ - ComputeUnitsToTokensMultiplier: 1, - }, - }, - expectedErr: ErrTokenomicsAuthorityAddressInvalid, - }, { - desc: "valid address", - msg: MsgUpdateParams{ - Authority: sample.AccAddress(), - Params: Params{ - ComputeUnitsToTokensMultiplier: 1, - }, - }, - }, { - desc: "invalid ComputeUnitsToTokensMultiplier", - msg: MsgUpdateParams{ - Authority: sample.AccAddress(), - Params: Params{ - ComputeUnitsToTokensMultiplier: 0, - }, - }, - expectedErr: ErrTokenomicsParamsInvalid, - }, - } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.expectedErr != nil { - require.ErrorIs(t, err, tt.expectedErr) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/tokenomics/types/params.go b/x/tokenomics/types/params.go deleted file mode 100644 index 992cdd9ed..000000000 --- a/x/tokenomics/types/params.go +++ /dev/null @@ -1,73 +0,0 @@ -package types - -import ( - "fmt" - - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "gopkg.in/yaml.v2" -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -var ( - KeyComputeUnitsToTokensMultiplier = []byte("ComputeUnitsToTokensMultiplier") - // TODO: Determine the default value - DefaultComputeUnitsToTokensMultiplier uint64 = 42 -) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params instance -func NewParams( - computeUnitsToTokensMultiplier uint64, -) Params { - return Params{ - ComputeUnitsToTokensMultiplier: computeUnitsToTokensMultiplier, - } -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams( - DefaultComputeUnitsToTokensMultiplier, - ) -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyComputeUnitsToTokensMultiplier, &p.ComputeUnitsToTokensMultiplier, validateComputeUnitsToTokensMultiplier), - } -} - -// Validate validates the set of params -func (p Params) Validate() error { - if err := validateComputeUnitsToTokensMultiplier(p.ComputeUnitsToTokensMultiplier); err != nil { - return err - } - - return nil -} - -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} - -// validateComputeUnitsToTokensMultiplier validates the ComputeUnitsToTokensMultiplier param -func validateComputeUnitsToTokensMultiplier(v interface{}) error { - computeUnitsToTokensMultiplier, ok := v.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", v) - } - - if computeUnitsToTokensMultiplier <= 0 { - return fmt.Errorf("invalid compute to tokens multiplier: %d", computeUnitsToTokensMultiplier) - } - - return nil -} diff --git a/x/tokenomics/types/types.go b/x/tokenomics/types/types.go deleted file mode 100644 index ab1254f4c..000000000 --- a/x/tokenomics/types/types.go +++ /dev/null @@ -1 +0,0 @@ -package types