diff --git a/Makefile b/Makefile index cc8ee344..554b32e1 100644 --- a/Makefile +++ b/Makefile @@ -99,13 +99,14 @@ ifeq ($(SHELL_NAME),Darwin) SED_FLAG := "" endif -.PHONY: all lint lint-go build build-go help - +.PHONY: all all: help ## Lint: +.PHONY: lint lint: lint-go lint-proto ## Lint all available linters +.PHONY: lint-go lint-go: ## Lint go source code @echo "${COLOR_CYAN}๐Ÿ” Inspecting go source code${COLOR_RESET}" @docker run --rm \ @@ -114,6 +115,7 @@ lint-go: ## Lint go source code ${DOCKER_IMAGE_GOLANG_CI} \ golangci-lint run -v +.PHONY: lint-proto lint-proto: ## Lint proto files @echo "${COLOR_CYAN}๐Ÿ”๏ธ lint proto${COLOR_RESET}" @docker run --rm \ @@ -122,10 +124,18 @@ lint-proto: ## Lint proto files -w /proto \ ${DOCKER_IMAGE_BUF} \ lint proto -v + @docker run --rm \ + -v ${HOME}/.cache:/root/.cache \ + -v `pwd`:/proto \ + -w /proto \ + ${DOCKER_IMAGE_BUF} \ + format -d --exit-code ## Format: +.PHONY: format format: format-go ## Run all available formatters +.PHONY: format-go format-go: ## Format go files @echo "${COLOR_CYAN}๐Ÿ“ Formatting go source code${COLOR_RESET}" @docker run --rm \ @@ -135,9 +145,21 @@ format-go: ## Format go files sh -c \ "go install mvdan.cc/gofumpt@v0.4.0; gofumpt -w -l ." +.PHONY: format-proto +format-proto: ## Format proto files + @echo "${COLOR_CYAN}๐Ÿ“ Formatting proto files${COLOR_RESET}" + @docker run --rm \ + -v ${HOME}/.cache:/root/.cache \ + -v `pwd`:/proto \ + -w /proto \ + ${DOCKER_IMAGE_BUF} \ + format -w + ## Build: +.PHONY: build build: build-go ## Build all available artefacts (executable, docker image, etc.) +.PHONY: build-go build-go: ## Build node executable for the current environment (default build) @echo "${COLOR_CYAN} ๐Ÿ—๏ธ Building project ${COLOR_RESET}${CMD_ROOT}${COLOR_CYAN}${COLOR_RESET} into ${COLOR_YELLOW}${DIST_FOLDER}${COLOR_RESET}" @$(call build-go,"","",${DIST_FOLDER}/${BINARY_NAME}) @@ -165,13 +187,16 @@ $(ENVIRONMENTS_TARGETS): ## Install: +.PHONY: install install: ## Install node executable @echo "${COLOR_CYAN} ๐Ÿšš Installing project ${BINARY_NAME}${COLOR_RESET}" @go install ${BUILD_FLAGS} ${CMD_ROOT} ## Test: +.PHONY: test test: test-go ## Pass all the tests +.PHONY: test-go test-go: build ## Pass the test for the go source code @echo "${COLOR_CYAN} ๐Ÿงช Passing go tests${COLOR_RESET}" @go test -v -covermode=count -coverprofile ./target/coverage.out ./... @@ -218,11 +243,16 @@ chain-stop: ## Stop the blockchain @killall okp4d ## Clean: +.PHONY: clean clean: ## Remove all the files from the target folder @echo "${COLOR_CYAN} ๐Ÿ—‘ Cleaning folder $(TARGET_FOLDER)${COLOR_RESET}" @rm -rf $(TARGET_FOLDER)/ ## Proto: +.PHONY: proto +proto: proto-format lint-proto proto-build proto-gen doc-proto ## Generate all resources for proto files (go, doc, etc.) + +.PHONY: proto-format proto-format: ## Format Protobuf files @echo "${COLOR_CYAN} ๐Ÿ“ Formatting Protobuf files${COLOR_RESET}" @docker run --rm \ @@ -232,6 +262,7 @@ proto-format: ## Format Protobuf files ${DOCKER_IMAGE_BUF} \ format -w -v +.PHONY: proto-build proto-build: ## Build all Protobuf files @echo "${COLOR_CYAN} ๐Ÿ”จ๏ธBuild Protobuf files${COLOR_RESET}" @docker run --rm \ @@ -241,6 +272,7 @@ proto-build: ## Build all Protobuf files ${DOCKER_IMAGE_BUF} \ build proto -v +.PHONY: proto-gen proto-gen: proto-build ## Generate all the code from the Protobuf files @echo "${COLOR_CYAN} ๐Ÿ“ Generating code from Protobuf files${COLOR_RESET}" @docker run --rm \ @@ -287,6 +319,7 @@ doc-command: ## Generate markdown documentation for the command ${DOCKER_IMAGE_MARKDOWNLINT} -f $$OUT_FOLDER ## Release: +.PHONY: release-assets release-assets: release-binary-all release-checksums ## Generate release assets release-binary-all: $(RELEASE_TARGETS) @@ -322,6 +355,7 @@ ensure-buildx-builder: docker buildx create --name ${DOCKER_BUILDX_BUILDER} ## Help: +.PHONY: help help: ## Show this help. @echo '' @echo 'Usage:' diff --git a/README.md b/README.md index db02b26a..b9ee3fe5 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,7 @@ Targets: Format: format Run all available formatters format-go Format go files + format-proto Format proto files Build: build Build all available artefacts (executable, docker image, etc.) build-go Build node executable for the current environment (default build) @@ -155,6 +156,7 @@ Targets: Clean: clean Remove all the files from the target folder Proto: + proto Generate all resources for proto files (go, doc, etc.) proto-format Format Protobuf files proto-build Build all Protobuf files proto-gen Generate all the code from the Protobuf files diff --git a/docs/proto/logic.md b/docs/proto/logic.md index bacf782d..89ed070d 100644 --- a/docs/proto/logic.md +++ b/docs/proto/logic.md @@ -7,14 +7,24 @@ ## Table of Contents - [logic/v1beta/params.proto](#logic/v1beta/params.proto) + - [Interpreter](#logic.v1beta.Interpreter) + - [Limits](#logic.v1beta.Limits) - [Params](#logic.v1beta.Params) - [logic/v1beta/genesis.proto](#logic/v1beta/genesis.proto) - [GenesisState](#logic.v1beta.GenesisState) +- [logic/v1beta/types.proto](#logic/v1beta/types.proto) + - [Answer](#logic.v1beta.Answer) + - [Result](#logic.v1beta.Result) + - [Substitution](#logic.v1beta.Substitution) + - [Term](#logic.v1beta.Term) + - [logic/v1beta/query.proto](#logic/v1beta/query.proto) - [QueryServiceParamsRequest](#logic.v1beta.QueryServiceParamsRequest) - [QueryServiceParamsResponse](#logic.v1beta.QueryServiceParamsResponse) + - [QueryServiceQueryRequest](#logic.v1beta.QueryServiceQueryRequest) + - [QueryServiceQueryResponse](#logic.v1beta.QueryServiceQueryResponse) - [QueryService](#logic.v1beta.QueryService) @@ -28,15 +38,39 @@ ## logic/v1beta/params.proto + + +### Interpreter + +Interpreter defines the various parameters for the interpreter. + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `registered_predicates` | [string](#string) | repeated | registered_predicates specifies the list of registered predicates/operators, in the form of: `/`. For instance: `findall/3`. If not specified, the default set of predicates/operators will be registered. | +| `bootstrap` | [string](#string) | | bootstrap specifies the initial program to run when booting the logic interpreter. If not specified, the default boot sequence will be executed. | + + + +### Limits + +Limits defines the limits of the logic module. + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `max_gas` | [uint64](#uint64) | | max_gas specifies the maximum amount of computing power, measured in "gas," that is allowed to be consumed when executing a request by the interpreter. The interpreter calculates the gas consumption based on the number and type of operations that are executed, as well as, in some cases, the complexity of the processed data. | +| `max_size` | [uint32](#uint32) | | max_size specifies the maximum size, in bytes, that is accepted for a program. | +| `max_result_count` | [uint32](#uint32) | | max_result_count specifies the maximum number of results that can be requested for a query. | + ### Params -Params defines the parameters for the module. +Params defines all the configuration parameters of the "logic" module. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `foo` | [string](#string) | | foo represents a metasyntactic variable for testing purposes. | +| `interpreter` | [Interpreter](#logic.v1beta.Interpreter) | | Interpreter specifies the parameter for the logic interpreter. | +| `limits` | [Limits](#logic.v1beta.Limits) | | Limits defines the limits of the logic module. The limits are used to prevent the interpreter from running for too long. If the interpreter runs for too long, the execution will be aborted. | [//]: # (end messages) @@ -69,6 +103,64 @@ GenesisState defines the logic module's genesis state. [//]: # (end services) + +

Top

+ +## logic/v1beta/types.proto + + + +### Answer + +Answer represents the answer to a logic query. + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `success` | [bool](#bool) | | result is the result of the query. | +| `has_more` | [bool](#bool) | | has_more specifies if there are more solutions than the ones returned. | +| `variables` | [string](#string) | repeated | variables represent all the variables in the query. | +| `results` | [Result](#logic.v1beta.Result) | repeated | results represent all the results of the query. | + + + +### Result + +Result represents the result of a query. + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `substitutions` | [Substitution](#logic.v1beta.Substitution) | repeated | substitutions represent all the substitutions made to the variables in the query to obtain the answer. | + + + +### Substitution + +Substitution represents a substitution made to the variables in the query to obtain the answer. + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `variable` | [string](#string) | | variable is the name of the variable. | +| `term` | [Term](#logic.v1beta.Term) | | term is the term that the variable is substituted with. | + + + +### Term + +Term is the representation of a piece of data and can be a constant, a variable, or an atom. + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `name` | [string](#string) | | name is the name of the term. | +| `arguments` | [Term](#logic.v1beta.Term) | repeated | arguments are the arguments of the term, which can be constants, variables, or atoms. | + + [//]: # (end messages) + + [//]: # (end enums) + + [//]: # (end HasExtensions) + + [//]: # (end services) +

Top

@@ -90,6 +182,29 @@ QueryServiceParamsResponse is response type for the QueryService/Params RPC meth | ----- | ---- | ----- | ----------- | | `params` | [Params](#logic.v1beta.Params) | | params holds all the parameters of this module. | + + +### QueryServiceQueryRequest + +QueryServiceQueryRequest is request type for the QueryService/Query RPC method. + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `program` | [string](#string) | | program is the logic program to be queried. | +| `query` | [string](#string) | | query is the query string to be executed. | + + + +### QueryServiceQueryResponse + +QueryServiceQueryResponse is response type for the QueryService/Query RPC method. + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `height` | [uint64](#uint64) | | height is the block height at which the query was executed. | +| `gas_used` | [uint64](#uint64) | | gas_used is the amount of gas used to execute the query. | +| `answer` | [Answer](#logic.v1beta.Answer) | | answer is the answer to the query. | + [//]: # (end messages) [//]: # (end enums) @@ -104,7 +219,8 @@ QueryService defines the gRPC querier service. | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `Params` | [QueryServiceParamsRequest](#logic.v1beta.QueryServiceParamsRequest) | [QueryServiceParamsResponse](#logic.v1beta.QueryServiceParamsResponse) | Parameters queries the parameters of the module. | GET|/okp4/okp4d/logic/params| +| `Params` | [QueryServiceParamsRequest](#logic.v1beta.QueryServiceParamsRequest) | [QueryServiceParamsResponse](#logic.v1beta.QueryServiceParamsResponse) | Params queries all parameters for the logic module. | GET|/okp4/okp4d/logic/params| +| `Query` | [QueryServiceQueryRequest](#logic.v1beta.QueryServiceQueryRequest) | [QueryServiceQueryResponse](#logic.v1beta.QueryServiceQueryResponse) | Query executes a logic query and returns the solutions found. Since the query is without any side-effect, the query is not executed in the context of a transaction and no fee is charged for this, but the execution is constrained by the current limits configured in the module. | GET|/okp4/okp4d/logic/query| [//]: # (end services) @@ -123,7 +239,8 @@ QueryService defines the gRPC querier service. ### MsgService -Msg defines the Msg service. +MsgService defines the service for the logic module. +Do nothing for now as the service is without any side effects. | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | ----------- | ------------ | ------------- | ------------| ------- | -------- | diff --git a/proto/logic/v1beta/params.proto b/proto/logic/v1beta/params.proto index 2ff3b514..6aba7098 100644 --- a/proto/logic/v1beta/params.proto +++ b/proto/logic/v1beta/params.proto @@ -6,10 +6,57 @@ import "gogoproto/gogo.proto"; option go_package = "github.com/okp4/okp4d/x/logic/types"; -// Params defines the parameters for the module. +// Params defines all the configuration parameters of the "logic" module. message Params { option (gogoproto.goproto_stringer) = false; - // foo represents a metasyntactic variable for testing purposes. - string foo = 1 [(gogoproto.moretags) = "yaml:\"foo\""]; + // Interpreter specifies the parameter for the logic interpreter. + Interpreter interpreter = 1 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"interpreter\"" + ]; + + // Limits defines the limits of the logic module. + // The limits are used to prevent the interpreter from running for too long. + // If the interpreter runs for too long, the execution will be aborted. + Limits limits = 2 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"limits\"" + ]; +} + +// Limits defines the limits of the logic module. +message Limits { + option (gogoproto.goproto_stringer) = true; + + // max_gas specifies the maximum amount of computing power, measured in "gas," that is allowed to be consumed when + // executing a request by the interpreter. The interpreter calculates the gas consumption based on the number and type + // of operations that are executed, as well as, in some cases, the complexity of the processed data. + uint64 max_gas = 1 [(gogoproto.moretags) = "yaml:\"max_gas\",omitempty"]; + + // max_size specifies the maximum size, in bytes, that is accepted for a program. + uint32 max_size = 3 [(gogoproto.moretags) = "yaml:\"max_size\""]; + + // max_result_count specifies the maximum number of results that can be requested for a query. + uint32 max_result_count = 2 [(gogoproto.moretags) = "yaml:\"max_result_count\""]; +} + +// Interpreter defines the various parameters for the interpreter. +message Interpreter { + option (gogoproto.goproto_stringer) = true; + + // registered_predicates specifies the list of registered predicates/operators, in the form of: `/`. + // For instance: `findall/3`. + // If not specified, the default set of predicates/operators will be registered. + repeated string registered_predicates = 1 [ + (gogoproto.nullable) = true, + (gogoproto.moretags) = "yaml:\"registered_predicates\"" + ]; + + // bootstrap specifies the initial program to run when booting the logic interpreter. + // If not specified, the default boot sequence will be executed. + string bootstrap = 2 [ + (gogoproto.nullable) = true, + (gogoproto.moretags) = "yaml:\"bootstrap\"" + ]; } diff --git a/proto/logic/v1beta/query.proto b/proto/logic/v1beta/query.proto index edd46fe8..5b0dddfc 100644 --- a/proto/logic/v1beta/query.proto +++ b/proto/logic/v1beta/query.proto @@ -5,15 +5,23 @@ package logic.v1beta; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "logic/v1beta/params.proto"; +import "logic/v1beta/types.proto"; option go_package = "github.com/okp4/okp4d/x/logic/types"; // QueryService defines the gRPC querier service. service QueryService { - // Parameters queries the parameters of the module. + // Params queries all parameters for the logic module. rpc Params(QueryServiceParamsRequest) returns (QueryServiceParamsResponse) { option (google.api.http).get = "/okp4/okp4d/logic/params"; } + + // Query executes a logic query and returns the solutions found. + // Since the query is without any side-effect, the query is not executed in the context of a transaction and no fee + // is charged for this, but the execution is constrained by the current limits configured in the module. + rpc Query(QueryServiceQueryRequest) returns (QueryServiceQueryResponse) { + option (google.api.http).get = "/okp4/okp4d/logic/query"; + } } // QueryServiceParamsRequest is request type for the QueryService/Params RPC method. @@ -22,5 +30,30 @@ message QueryServiceParamsRequest {} // QueryServiceParamsResponse is response type for the QueryService/Params RPC method. message QueryServiceParamsResponse { // params holds all the parameters of this module. - Params params = 1 [(gogoproto.nullable) = false]; + Params params = 1 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"params\",omitempty" + ]; +} + +// QueryServiceQueryRequest is request type for the QueryService/Query RPC method. +message QueryServiceQueryRequest { + option (gogoproto.goproto_stringer) = true; + + // program is the logic program to be queried. + string program = 1 [(gogoproto.moretags) = "yaml:\"program\",omitempty"]; + // query is the query string to be executed. + string query = 2 [(gogoproto.moretags) = "yaml:\"query\",omitempty"]; +} + +// QueryServiceQueryResponse is response type for the QueryService/Query RPC method. +message QueryServiceQueryResponse { + option (gogoproto.goproto_stringer) = true; + + // height is the block height at which the query was executed. + uint64 height = 1 [(gogoproto.moretags) = "yaml:\"height\",omitempty"]; + // gas_used is the amount of gas used to execute the query. + uint64 gas_used = 2 [(gogoproto.moretags) = "yaml:\"gas_used\",omitempty"]; + // answer is the answer to the query. + Answer answer = 3 [(gogoproto.moretags) = "yaml:\"answer\",omitempty"]; } diff --git a/proto/logic/v1beta/tx.proto b/proto/logic/v1beta/tx.proto index 2819f6d1..aceba258 100644 --- a/proto/logic/v1beta/tx.proto +++ b/proto/logic/v1beta/tx.proto @@ -4,5 +4,6 @@ package logic.v1beta; option go_package = "github.com/okp4/okp4d/x/logic/types"; -// Msg defines the Msg service. +// MsgService defines the service for the logic module. +// Do nothing for now as the service is without any side effects. service MsgService {} diff --git a/proto/logic/v1beta/types.proto b/proto/logic/v1beta/types.proto new file mode 100644 index 00000000..db671032 --- /dev/null +++ b/proto/logic/v1beta/types.proto @@ -0,0 +1,64 @@ +syntax = "proto3"; + +package logic.v1beta; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/okp4/okp4d/x/logic/types"; + +// Term is the representation of a piece of data and can be a constant, a variable, or an atom. +message Term { + option (gogoproto.goproto_stringer) = true; + + // name is the name of the term. + string name = 1 [(gogoproto.moretags) = "yaml:\"name\",omitempty"]; + // arguments are the arguments of the term, which can be constants, variables, or atoms. + repeated Term arguments = 2 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"arguments\",omitempty" + ]; +} + +// Substitution represents a substitution made to the variables in the query to obtain the answer. +message Substitution { + option (gogoproto.goproto_stringer) = true; + + // variable is the name of the variable. + string variable = 1 [(gogoproto.moretags) = "yaml:\"variable\",omitempty"]; + // term is the term that the variable is substituted with. + Term term = 2 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"term\",omitempty" + ]; +} + +// Result represents the result of a query. +message Result { + option (gogoproto.goproto_stringer) = true; + + // substitutions represent all the substitutions made to the variables in the query to obtain the answer. + repeated Substitution substitutions = 1 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"substitutions\",omitempty" + ]; +} + +// Answer represents the answer to a logic query. +message Answer { + option (gogoproto.goproto_stringer) = true; + + // result is the result of the query. + bool success = 1 [(gogoproto.moretags) = "yaml:\"success\",omitempty"]; + // has_more specifies if there are more solutions than the ones returned. + bool has_more = 2 [(gogoproto.moretags) = "yaml:\"has_next\",omitempty"]; + // variables represent all the variables in the query. + repeated string variables = 3 [ + (gogoproto.nullable) = true, + (gogoproto.moretags) = "yaml:\"variables\",omitempty" + ]; + // results represent all the results of the query. + repeated Result results = 4 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"results\",omitempty" + ]; +} diff --git a/proto/mint/v1beta1/genesis.proto b/proto/mint/v1beta1/genesis.proto index 41e1a8e4..6afddac5 100644 --- a/proto/mint/v1beta1/genesis.proto +++ b/proto/mint/v1beta1/genesis.proto @@ -1,4 +1,5 @@ syntax = "proto3"; + package mint.v1beta1; import "gogoproto/gogo.proto"; diff --git a/proto/mint/v1beta1/mint.proto b/proto/mint/v1beta1/mint.proto index 0a4dc32e..f8dd84b0 100644 --- a/proto/mint/v1beta1/mint.proto +++ b/proto/mint/v1beta1/mint.proto @@ -1,10 +1,11 @@ syntax = "proto3"; -package mint.v1beta1; -option go_package = "github.com/okp4/okp4d/x/mint/types"; +package mint.v1beta1; import "gogoproto/gogo.proto"; +option go_package = "github.com/okp4/okp4d/x/mint/types"; + // Minter represents the minting state. // // At the beginning of the chain (first block) the mint module will recalculate the `annual_provisions` and @@ -15,17 +16,17 @@ message Minter { // current annual inflation rate string inflation = 1 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.nullable) = false ]; // current annual expected provisions string annual_provisions = 2 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.nullable) = false ]; // target supply at end of period string target_supply = 3 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false + (gogoproto.nullable) = false ]; } @@ -43,7 +44,7 @@ message Params { // annual reduction factor inflation rate change string annual_reduction_factor = 2 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.nullable) = false ]; // expected blocks per year uint64 blocks_per_year = 3; diff --git a/proto/mint/v1beta1/query.proto b/proto/mint/v1beta1/query.proto index 750aa7bb..e3df3e98 100644 --- a/proto/mint/v1beta1/query.proto +++ b/proto/mint/v1beta1/query.proto @@ -1,4 +1,5 @@ syntax = "proto3"; + package mint.v1beta1; import "gogoproto/gogo.proto"; @@ -41,7 +42,10 @@ message QueryInflationRequest {} // method. message QueryInflationResponse { // inflation is the current minting inflation value. - bytes inflation = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + bytes inflation = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; } // QueryAnnualProvisionsRequest is the request type for the @@ -52,6 +56,8 @@ message QueryAnnualProvisionsRequest {} // Query/AnnualProvisions RPC method. message QueryAnnualProvisionsResponse { // annual_provisions is the current minting annual provisions value. - bytes annual_provisions = 1 - [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + bytes annual_provisions = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; } diff --git a/x/logic/keeper/grpc_query_params_test.go b/x/logic/keeper/grpc_query_params_test.go index 1f739054..ea679208 100644 --- a/x/logic/keeper/grpc_query_params_test.go +++ b/x/logic/keeper/grpc_query_params_test.go @@ -2,20 +2,8 @@ package keeper_test import ( "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - testkeeper "github.com/okp4/okp4d/testutil/keeper" - "github.com/okp4/okp4d/x/logic/types" - "github.com/stretchr/testify/require" ) func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.LogicKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - params := types.DefaultParams() - keeper.SetParams(ctx, params) - - response, err := keeper.Params(wctx, &types.QueryServiceParamsRequest{}) - require.NoError(t, err) - require.Equal(t, &types.QueryServiceParamsResponse{Params: params}, response) + // TODO implement me } diff --git a/x/logic/keeper/keeper.go b/x/logic/keeper/keeper.go index 5e54cd90..bedcf22f 100644 --- a/x/logic/keeper/keeper.go +++ b/x/logic/keeper/keeper.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "fmt" "github.com/cosmos/cosmos-sdk/codec" @@ -20,6 +21,11 @@ type ( } ) +func (k Keeper) Query(ctx context.Context, request *types.QueryServiceQueryRequest) (*types.QueryServiceQueryResponse, error) { + // TODO implement me + panic("implement me") +} + func NewKeeper( cdc codec.BinaryCodec, storeKey, diff --git a/x/logic/keeper/params.go b/x/logic/keeper/params.go index 67edcfc3..95505435 100644 --- a/x/logic/keeper/params.go +++ b/x/logic/keeper/params.go @@ -7,18 +7,11 @@ import ( // GetParams get all parameters as types.Params. func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams( - k.Foo(ctx), - ) + // TODO implement me + return types.Params{} } // SetParams set the params. func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { k.paramstore.SetParamSet(ctx, ¶ms) } - -// Foo returns the Foo param. -func (k Keeper) Foo(ctx sdk.Context) (res string) { - k.paramstore.Get(ctx, types.KeyFoo, &res) - return -} diff --git a/x/logic/keeper/params_test.go b/x/logic/keeper/params_test.go index 05e09f70..3b34bad5 100644 --- a/x/logic/keeper/params_test.go +++ b/x/logic/keeper/params_test.go @@ -2,18 +2,8 @@ package keeper_test import ( "testing" - - testkeeper "github.com/okp4/okp4d/testutil/keeper" - "github.com/okp4/okp4d/x/logic/types" - "github.com/stretchr/testify/require" ) func TestGetParams(t *testing.T) { - k, ctx := testkeeper.LogicKeeper(t) - params := types.DefaultParams() - - k.SetParams(ctx, params) - - require.EqualValues(t, params, k.GetParams(ctx)) - require.EqualValues(t, params.Foo, k.Foo(ctx)) + // TODO implement me } diff --git a/x/logic/module_simulation.go b/x/logic/module_simulation.go index 51ad022e..c414e8ba 100644 --- a/x/logic/module_simulation.go +++ b/x/logic/module_simulation.go @@ -42,12 +42,8 @@ func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedP // RandomizedParams creates randomized param changes for the simulator. func (am AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { - logicParams := types.DefaultParams() - return []simtypes.ParamChange{ - simulation.NewSimParamChange(types.ModuleName, string(types.KeyFoo), func(r *rand.Rand) string { - return string(types.Amino.MustMarshalJSON(logicParams.Foo)) - }), - } + // TODO implement me + panic("implement me") } // RegisterStoreDecoder registers a decoder. diff --git a/x/logic/types/params.go b/x/logic/types/params.go index 3615cc2b..e0ab3dca 100644 --- a/x/logic/types/params.go +++ b/x/logic/types/params.go @@ -1,72 +1,36 @@ package types import ( - "fmt" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "gopkg.in/yaml.v2" ) var _ paramtypes.ParamSet = (*Params)(nil) -var ( - KeyFoo = []byte("Foo") - // TODO: Determine the default value - DefaultFoo = "foo" -) - // 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( - foo string, -) Params { - return Params{ - Foo: foo, - } -} - // DefaultParams returns a default set of parameters. func DefaultParams() Params { - return NewParams( - DefaultFoo, - ) + // TODO implement me + return Params{} } // ParamSetPairs get the params.ParamSet. func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyFoo, &p.Foo, validateFoo), - } + // TODO implement me + return []paramtypes.ParamSetPair{} } // Validate validates the set of params. func (p Params) Validate() error { - if err := validateFoo(p.Foo); err != nil { - return err - } - + // TODO implement me return nil } // String implements the Stringer interface. func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} - -// validateFoo validates the Foo param. -func validateFoo(v interface{}) error { - foo, ok := v.(string) - if !ok { - return fmt.Errorf("invalid parameter type: %T", v) - } - - // TODO implement validation - _ = foo - - return nil + // TODO implement me + return "" } diff --git a/x/logic/types/params.pb.go b/x/logic/types/params.pb.go index 777d8419..4770979e 100644 --- a/x/logic/types/params.pb.go +++ b/x/logic/types/params.pb.go @@ -23,10 +23,14 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// Params defines the parameters for the module. +// Params defines all the configuration parameters of the "logic" module. type Params struct { - // foo represents a metasyntactic variable for testing purposes. - Foo string `protobuf:"bytes,1,opt,name=foo,proto3" json:"foo,omitempty" yaml:"foo"` + // Interpreter specifies the parameter for the logic interpreter. + Interpreter Interpreter `protobuf:"bytes,1,opt,name=interpreter,proto3" json:"interpreter" yaml:"interpreter"` + // Limits defines the limits of the logic module. + // The limits are used to prevent the interpreter from running for too long. + // If the interpreter runs for too long, the execution will be aborted. + Limits Limits `protobuf:"bytes,2,opt,name=limits,proto3" json:"limits" yaml:"limits"` } func (m *Params) Reset() { *m = Params{} } @@ -61,33 +65,182 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetFoo() string { +func (m *Params) GetInterpreter() Interpreter { if m != nil { - return m.Foo + return m.Interpreter + } + return Interpreter{} +} + +func (m *Params) GetLimits() Limits { + if m != nil { + return m.Limits + } + return Limits{} +} + +// Limits defines the limits of the logic module. +type Limits struct { + // max_gas specifies the maximum amount of computing power, measured in "gas," that is allowed to be consumed when + // executing a request by the interpreter. The interpreter calculates the gas consumption based on the number and type + // of operations that are executed, as well as, in some cases, the complexity of the processed data. + MaxGas uint64 `protobuf:"varint,1,opt,name=max_gas,json=maxGas,proto3" json:"max_gas,omitempty" yaml:"max_gas",omitempty` + // max_size specifies the maximum size, in bytes, that is accepted for a program. + MaxSize uint32 `protobuf:"varint,3,opt,name=max_size,json=maxSize,proto3" json:"max_size,omitempty" yaml:"max_size"` + // max_result_count specifies the maximum number of results that can be requested for a query. + MaxResultCount uint32 `protobuf:"varint,2,opt,name=max_result_count,json=maxResultCount,proto3" json:"max_result_count,omitempty" yaml:"max_result_count"` +} + +func (m *Limits) Reset() { *m = Limits{} } +func (m *Limits) String() string { return proto.CompactTextString(m) } +func (*Limits) ProtoMessage() {} +func (*Limits) Descriptor() ([]byte, []int) { + return fileDescriptor_55eca4aea58a32e5, []int{1} +} +func (m *Limits) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Limits) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Limits.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Limits) XXX_Merge(src proto.Message) { + xxx_messageInfo_Limits.Merge(m, src) +} +func (m *Limits) XXX_Size() int { + return m.Size() +} +func (m *Limits) XXX_DiscardUnknown() { + xxx_messageInfo_Limits.DiscardUnknown(m) +} + +var xxx_messageInfo_Limits proto.InternalMessageInfo + +func (m *Limits) GetMaxGas() uint64 { + if m != nil { + return m.MaxGas + } + return 0 +} + +func (m *Limits) GetMaxSize() uint32 { + if m != nil { + return m.MaxSize + } + return 0 +} + +func (m *Limits) GetMaxResultCount() uint32 { + if m != nil { + return m.MaxResultCount + } + return 0 +} + +// Interpreter defines the various parameters for the interpreter. +type Interpreter struct { + // registered_predicates specifies the list of registered predicates/operators, in the form of: `/`. + // For instance: `findall/3`. + // If not specified, the default set of predicates/operators will be registered. + RegisteredPredicates []string `protobuf:"bytes,1,rep,name=registered_predicates,json=registeredPredicates,proto3" json:"registered_predicates,omitempty" yaml:"registered_predicates"` + // bootstrap specifies the initial program to run when booting the logic interpreter. + // If not specified, the default boot sequence will be executed. + Bootstrap string `protobuf:"bytes,2,opt,name=bootstrap,proto3" json:"bootstrap,omitempty" yaml:"bootstrap"` +} + +func (m *Interpreter) Reset() { *m = Interpreter{} } +func (m *Interpreter) String() string { return proto.CompactTextString(m) } +func (*Interpreter) ProtoMessage() {} +func (*Interpreter) Descriptor() ([]byte, []int) { + return fileDescriptor_55eca4aea58a32e5, []int{2} +} +func (m *Interpreter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Interpreter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Interpreter.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Interpreter) XXX_Merge(src proto.Message) { + xxx_messageInfo_Interpreter.Merge(m, src) +} +func (m *Interpreter) XXX_Size() int { + return m.Size() +} +func (m *Interpreter) XXX_DiscardUnknown() { + xxx_messageInfo_Interpreter.DiscardUnknown(m) +} + +var xxx_messageInfo_Interpreter proto.InternalMessageInfo + +func (m *Interpreter) GetRegisteredPredicates() []string { + if m != nil { + return m.RegisteredPredicates + } + return nil +} + +func (m *Interpreter) GetBootstrap() string { + if m != nil { + return m.Bootstrap } return "" } func init() { proto.RegisterType((*Params)(nil), "logic.v1beta.Params") + proto.RegisterType((*Limits)(nil), "logic.v1beta.Limits") + proto.RegisterType((*Interpreter)(nil), "logic.v1beta.Interpreter") } func init() { proto.RegisterFile("logic/v1beta/params.proto", fileDescriptor_55eca4aea58a32e5) } var fileDescriptor_55eca4aea58a32e5 = []byte{ - // 178 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xc9, 0x4f, 0xcf, - 0x4c, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x01, 0x4b, 0xe9, 0x41, 0xa4, 0xa4, 0x44, 0xd2, 0xf3, - 0xd3, 0xf3, 0xc1, 0x12, 0xfa, 0x20, 0x16, 0x44, 0x8d, 0x92, 0x01, 0x17, 0x5b, 0x00, 0x58, 0x8f, - 0x90, 0x02, 0x17, 0x73, 0x5a, 0x7e, 0xbe, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xa7, 0x13, 0xdf, 0xa7, - 0x7b, 0xf2, 0x5c, 0x95, 0x89, 0xb9, 0x39, 0x56, 0x4a, 0x69, 0xf9, 0xf9, 0x4a, 0x41, 0x20, 0x29, - 0x2b, 0x96, 0x19, 0x0b, 0xe4, 0x19, 0x9c, 0x6c, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, - 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, - 0x8e, 0x21, 0x4a, 0x39, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x3f, 0x3f, - 0xbb, 0xc0, 0x04, 0x4c, 0xa4, 0xe8, 0x57, 0xe8, 0x43, 0x9c, 0x58, 0x52, 0x59, 0x90, 0x5a, 0x9c, - 0xc4, 0x06, 0xb6, 0xd7, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x10, 0x83, 0xf4, 0xa8, 0xb8, 0x00, - 0x00, 0x00, + // 441 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xcd, 0x6e, 0xd3, 0x30, + 0x00, 0xc7, 0x63, 0x36, 0x05, 0xea, 0x52, 0x98, 0x4c, 0x27, 0xb2, 0x31, 0x25, 0x93, 0xe1, 0xd0, + 0x03, 0x4a, 0xc4, 0xe7, 0x61, 0x12, 0x97, 0x4c, 0x08, 0x21, 0x71, 0x98, 0xcc, 0x01, 0xc1, 0xa5, + 0x72, 0x5b, 0x2b, 0x58, 0xd4, 0xb3, 0x65, 0xbb, 0xa8, 0xdd, 0x53, 0x70, 0xe4, 0xc8, 0x89, 0x13, + 0x8f, 0xc0, 0x03, 0xf4, 0xb8, 0x23, 0xa7, 0x08, 0xb5, 0x6f, 0x90, 0x27, 0x40, 0xb1, 0xa3, 0x25, + 0x48, 0xbb, 0x44, 0xd1, 0xff, 0xe3, 0x97, 0xbf, 0x23, 0xc3, 0x83, 0xb9, 0x2c, 0xf8, 0x34, 0xfb, + 0xfa, 0x64, 0xc2, 0x2c, 0xcd, 0x14, 0xd5, 0x54, 0x98, 0x54, 0x69, 0x69, 0x25, 0xba, 0xed, 0xac, + 0xd4, 0x5b, 0x87, 0xc3, 0x42, 0x16, 0xd2, 0x19, 0x59, 0xfd, 0xe6, 0x33, 0xf8, 0x17, 0x80, 0xe1, + 0x99, 0x2b, 0xa1, 0x0f, 0xb0, 0xcf, 0xcf, 0x2d, 0xd3, 0x4a, 0x33, 0xcb, 0x74, 0x04, 0x8e, 0xc1, + 0xa8, 0xff, 0xf4, 0x20, 0xed, 0x42, 0xd2, 0xb7, 0x6d, 0x20, 0x3f, 0x5c, 0x97, 0x49, 0x50, 0x95, + 0x09, 0x5a, 0x51, 0x31, 0x3f, 0xc1, 0x9d, 0x2e, 0x26, 0x5d, 0x12, 0x3a, 0x85, 0xe1, 0x9c, 0x0b, + 0x6e, 0x4d, 0x74, 0xc3, 0x31, 0x87, 0xff, 0x33, 0xdf, 0x39, 0x2f, 0xdf, 0x6f, 0x70, 0x03, 0x8f, + 0xf3, 0x0d, 0x4c, 0x9a, 0xea, 0xc9, 0xee, 0xf7, 0x1f, 0x49, 0x80, 0x7f, 0x03, 0x18, 0xfa, 0x3c, + 0x7a, 0x01, 0x6f, 0x0a, 0xba, 0x1c, 0x17, 0xd4, 0xb8, 0xa9, 0xbb, 0xf9, 0x51, 0x55, 0x26, 0x91, + 0x2f, 0x37, 0x06, 0x7e, 0x2c, 0x05, 0xb7, 0x4c, 0x28, 0xbb, 0x22, 0xa1, 0xa0, 0xcb, 0x37, 0xd4, + 0xa0, 0x14, 0xde, 0xaa, 0x5d, 0xc3, 0x2f, 0x58, 0xb4, 0x73, 0x0c, 0x46, 0x83, 0xfc, 0x5e, 0x55, + 0x26, 0x77, 0xdb, 0x5e, 0xed, 0x60, 0x52, 0xb3, 0xdf, 0xf3, 0x0b, 0x86, 0x5e, 0xc3, 0xbd, 0x5a, + 0xd5, 0xcc, 0x2c, 0xe6, 0x76, 0x3c, 0x95, 0x8b, 0x73, 0xeb, 0x8e, 0x31, 0xc8, 0x1f, 0x54, 0x65, + 0x72, 0xbf, 0xed, 0x75, 0x13, 0x98, 0xdc, 0x11, 0x74, 0x49, 0x9c, 0x72, 0x5a, 0x0b, 0x6e, 0x3e, + 0xc0, 0x3f, 0x01, 0xec, 0x77, 0x7e, 0x21, 0xfa, 0x08, 0xf7, 0x35, 0x2b, 0xb8, 0xb1, 0x4c, 0xb3, + 0xd9, 0x58, 0x69, 0x36, 0xe3, 0x53, 0x6a, 0x59, 0x7d, 0xa2, 0x9d, 0x51, 0x2f, 0x7f, 0xb4, 0x2e, + 0x13, 0x50, 0x95, 0xc9, 0x91, 0xff, 0xca, 0xb5, 0x51, 0x4c, 0x86, 0xad, 0x7e, 0x76, 0x25, 0xa3, + 0x97, 0xb0, 0x37, 0x91, 0xd2, 0x1a, 0xab, 0xa9, 0x72, 0x83, 0x7b, 0x79, 0xd4, 0xe0, 0xf6, 0x3c, + 0xee, 0xca, 0xc6, 0xa4, 0x8d, 0xfa, 0xa1, 0xf9, 0xab, 0xf5, 0x26, 0x06, 0x97, 0x9b, 0x18, 0xfc, + 0xdd, 0xc4, 0xe0, 0xdb, 0x36, 0x0e, 0x2e, 0xb7, 0x71, 0xf0, 0x67, 0x1b, 0x07, 0x9f, 0x1e, 0x16, + 0xdc, 0x7e, 0x5e, 0x4c, 0xd2, 0xa9, 0x14, 0x99, 0xfc, 0xa2, 0x9e, 0xbb, 0xc7, 0x2c, 0x5b, 0x66, + 0xfe, 0x1e, 0xda, 0x95, 0x62, 0x66, 0x12, 0xba, 0xcb, 0xf5, 0xec, 0x5f, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x4b, 0xe5, 0xff, 0xbe, 0x9d, 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -110,12 +263,102 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Foo) > 0 { - i -= len(m.Foo) - copy(dAtA[i:], m.Foo) - i = encodeVarintParams(dAtA, i, uint64(len(m.Foo))) + { + size, err := m.Limits.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Interpreter.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Limits) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Limits) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Limits) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MaxSize != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MaxSize)) + i-- + dAtA[i] = 0x18 + } + if m.MaxResultCount != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MaxResultCount)) + i-- + dAtA[i] = 0x10 + } + if m.MaxGas != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MaxGas)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Interpreter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Interpreter) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Interpreter) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Bootstrap) > 0 { + i -= len(m.Bootstrap) + copy(dAtA[i:], m.Bootstrap) + i = encodeVarintParams(dAtA, i, uint64(len(m.Bootstrap))) i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + } + if len(m.RegisteredPredicates) > 0 { + for iNdEx := len(m.RegisteredPredicates) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.RegisteredPredicates[iNdEx]) + copy(dAtA[i:], m.RegisteredPredicates[iNdEx]) + i = encodeVarintParams(dAtA, i, uint64(len(m.RegisteredPredicates[iNdEx]))) + i-- + dAtA[i] = 0xa + } } return len(dAtA) - i, nil } @@ -137,7 +380,44 @@ func (m *Params) Size() (n int) { } var l int _ = l - l = len(m.Foo) + l = m.Interpreter.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.Limits.Size() + n += 1 + l + sovParams(uint64(l)) + return n +} + +func (m *Limits) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MaxGas != 0 { + n += 1 + sovParams(uint64(m.MaxGas)) + } + if m.MaxResultCount != 0 { + n += 1 + sovParams(uint64(m.MaxResultCount)) + } + if m.MaxSize != 0 { + n += 1 + sovParams(uint64(m.MaxSize)) + } + return n +} + +func (m *Interpreter) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.RegisteredPredicates) > 0 { + for _, s := range m.RegisteredPredicates { + l = len(s) + n += 1 + l + sovParams(uint64(l)) + } + } + l = len(m.Bootstrap) if l > 0 { n += 1 + l + sovParams(uint64(l)) } @@ -181,7 +461,262 @@ func (m *Params) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Foo", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Interpreter", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Interpreter.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Limits", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Limits.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Limits) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Limits: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Limits: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxGas", wireType) + } + m.MaxGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxGas |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxResultCount", wireType) + } + m.MaxResultCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxResultCount |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxSize", wireType) + } + m.MaxSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxSize |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Interpreter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Interpreter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Interpreter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegisteredPredicates", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RegisteredPredicates = append(m.RegisteredPredicates, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bootstrap", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -209,7 +744,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Foo = string(dAtA[iNdEx:postIndex]) + m.Bootstrap = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/logic/types/query.pb.go b/x/logic/types/query.pb.go index 339bee39..c510e420 100644 --- a/x/logic/types/query.pb.go +++ b/x/logic/types/query.pb.go @@ -69,7 +69,7 @@ var xxx_messageInfo_QueryServiceParamsRequest proto.InternalMessageInfo // QueryServiceParamsResponse is response type for the QueryService/Params RPC method. type QueryServiceParamsResponse struct { // params holds all the parameters of this module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params" yaml:"params",omitempty` } func (m *QueryServiceParamsResponse) Reset() { *m = QueryServiceParamsResponse{} } @@ -112,33 +112,167 @@ func (m *QueryServiceParamsResponse) GetParams() Params { return Params{} } +// QueryServiceQueryRequest is request type for the QueryService/Query RPC method. +type QueryServiceQueryRequest struct { + // program is the logic program to be queried. + Program string `protobuf:"bytes,1,opt,name=program,proto3" json:"program,omitempty" yaml:"program",omitempty` + // query is the query string to be executed. + Query string `protobuf:"bytes,2,opt,name=query,proto3" json:"query,omitempty" yaml:"query",omitempty` +} + +func (m *QueryServiceQueryRequest) Reset() { *m = QueryServiceQueryRequest{} } +func (m *QueryServiceQueryRequest) String() string { return proto.CompactTextString(m) } +func (*QueryServiceQueryRequest) ProtoMessage() {} +func (*QueryServiceQueryRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2a2e6b98fc71dc0f, []int{2} +} +func (m *QueryServiceQueryRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryServiceQueryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryServiceQueryRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryServiceQueryRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryServiceQueryRequest.Merge(m, src) +} +func (m *QueryServiceQueryRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryServiceQueryRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryServiceQueryRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryServiceQueryRequest proto.InternalMessageInfo + +func (m *QueryServiceQueryRequest) GetProgram() string { + if m != nil { + return m.Program + } + return "" +} + +func (m *QueryServiceQueryRequest) GetQuery() string { + if m != nil { + return m.Query + } + return "" +} + +// QueryServiceQueryResponse is response type for the QueryService/Query RPC method. +type QueryServiceQueryResponse struct { + // height is the block height at which the query was executed. + Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty" yaml:"height",omitempty` + // gas_used is the amount of gas used to execute the query. + GasUsed uint64 `protobuf:"varint,2,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty" yaml:"gas_used",omitempty` + // answer is the answer to the query. + Answer *Answer `protobuf:"bytes,3,opt,name=answer,proto3" json:"answer,omitempty" yaml:"answer",omitempty` +} + +func (m *QueryServiceQueryResponse) Reset() { *m = QueryServiceQueryResponse{} } +func (m *QueryServiceQueryResponse) String() string { return proto.CompactTextString(m) } +func (*QueryServiceQueryResponse) ProtoMessage() {} +func (*QueryServiceQueryResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2a2e6b98fc71dc0f, []int{3} +} +func (m *QueryServiceQueryResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryServiceQueryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryServiceQueryResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryServiceQueryResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryServiceQueryResponse.Merge(m, src) +} +func (m *QueryServiceQueryResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryServiceQueryResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryServiceQueryResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryServiceQueryResponse proto.InternalMessageInfo + +func (m *QueryServiceQueryResponse) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *QueryServiceQueryResponse) GetGasUsed() uint64 { + if m != nil { + return m.GasUsed + } + return 0 +} + +func (m *QueryServiceQueryResponse) GetAnswer() *Answer { + if m != nil { + return m.Answer + } + return nil +} + func init() { proto.RegisterType((*QueryServiceParamsRequest)(nil), "logic.v1beta.QueryServiceParamsRequest") proto.RegisterType((*QueryServiceParamsResponse)(nil), "logic.v1beta.QueryServiceParamsResponse") + proto.RegisterType((*QueryServiceQueryRequest)(nil), "logic.v1beta.QueryServiceQueryRequest") + proto.RegisterType((*QueryServiceQueryResponse)(nil), "logic.v1beta.QueryServiceQueryResponse") } func init() { proto.RegisterFile("logic/v1beta/query.proto", fileDescriptor_2a2e6b98fc71dc0f) } var fileDescriptor_2a2e6b98fc71dc0f = []byte{ - // 276 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xc8, 0xc9, 0x4f, 0xcf, - 0x4c, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0xd4, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, - 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x01, 0xcb, 0xe8, 0x41, 0x64, 0xa4, 0x44, 0xd2, 0xf3, 0xd3, - 0xf3, 0xc1, 0x12, 0xfa, 0x20, 0x16, 0x44, 0x8d, 0x94, 0x4c, 0x7a, 0x7e, 0x7e, 0x7a, 0x4e, 0xaa, - 0x7e, 0x62, 0x41, 0xa6, 0x7e, 0x62, 0x5e, 0x5e, 0x7e, 0x49, 0x62, 0x49, 0x66, 0x7e, 0x5e, 0x31, - 0x54, 0x56, 0x12, 0xc5, 0xec, 0x82, 0xc4, 0xa2, 0xc4, 0x5c, 0xa8, 0x94, 0x92, 0x34, 0x97, 0x64, - 0x20, 0xc8, 0xae, 0xe0, 0xd4, 0xa2, 0xb2, 0xcc, 0xe4, 0xd4, 0x00, 0xb0, 0x5c, 0x50, 0x6a, 0x61, - 0x69, 0x6a, 0x71, 0x89, 0x52, 0x00, 0x97, 0x14, 0x36, 0xc9, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, - 0x21, 0x23, 0x2e, 0x36, 0x88, 0x51, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x22, 0x7a, 0xc8, - 0x0e, 0xd5, 0x83, 0xa8, 0x76, 0x62, 0x39, 0x71, 0x4f, 0x9e, 0x21, 0x08, 0xaa, 0xd2, 0xa8, 0x97, - 0x91, 0x8b, 0x07, 0xd9, 0x48, 0xa1, 0x5a, 0x2e, 0x36, 0x88, 0x42, 0x21, 0x75, 0x54, 0xed, 0x38, - 0x5d, 0x25, 0xa5, 0x41, 0x58, 0x21, 0xc4, 0x85, 0x4a, 0x0a, 0x4d, 0x97, 0x9f, 0x4c, 0x66, 0x92, - 0x12, 0x92, 0xd0, 0xcf, 0xcf, 0x2e, 0x30, 0x01, 0x13, 0x29, 0xfa, 0x90, 0xb0, 0x80, 0xb8, 0xc7, - 0xc9, 0xf6, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, - 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x94, 0xd3, 0x33, 0x4b, - 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0x91, 0x75, 0x57, 0x40, 0xf5, 0x97, 0x54, 0x16, 0xa4, - 0x16, 0x27, 0xb1, 0x81, 0x03, 0xd1, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x93, 0x7d, 0xb2, 0x7c, - 0xbd, 0x01, 0x00, 0x00, + // 490 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0x41, 0x6b, 0xd4, 0x40, + 0x14, 0xde, 0xac, 0xdb, 0xa8, 0x63, 0x4f, 0x43, 0xb1, 0xd9, 0xb4, 0x26, 0x25, 0x82, 0xed, 0x41, + 0x12, 0x6d, 0x45, 0xa4, 0xe0, 0xc1, 0xdc, 0x3c, 0x08, 0x5a, 0xf1, 0xe2, 0x45, 0x66, 0x77, 0x87, + 0xd9, 0xd0, 0x4d, 0x26, 0xcd, 0xcc, 0x56, 0x73, 0xf0, 0xe2, 0x49, 0x3c, 0x09, 0x5e, 0x3c, 0xfa, + 0x73, 0x7a, 0x2c, 0x78, 0x11, 0x84, 0x20, 0xbb, 0xfe, 0x82, 0xfd, 0x05, 0xd2, 0xf7, 0x66, 0x71, + 0x42, 0x5b, 0x7a, 0x09, 0xe1, 0x7d, 0xef, 0x7b, 0xdf, 0xf7, 0xbd, 0x99, 0x21, 0xde, 0x44, 0x8a, + 0x6c, 0x98, 0x1c, 0x3f, 0x1c, 0x70, 0xcd, 0x92, 0xa3, 0x29, 0xaf, 0xea, 0xb8, 0xac, 0xa4, 0x96, + 0x74, 0x15, 0x90, 0x18, 0x11, 0x7f, 0x4d, 0x48, 0x21, 0x01, 0x48, 0xce, 0xfe, 0xb0, 0xc7, 0xdf, + 0x14, 0x52, 0x8a, 0x09, 0x4f, 0x58, 0x99, 0x25, 0xac, 0x28, 0xa4, 0x66, 0x3a, 0x93, 0x85, 0x32, + 0x68, 0xbf, 0x35, 0xbb, 0x64, 0x15, 0xcb, 0x97, 0x50, 0x5b, 0x56, 0xd7, 0x25, 0x37, 0x48, 0xb4, + 0x41, 0xfa, 0xaf, 0xce, 0x5c, 0xbc, 0xe6, 0xd5, 0x71, 0x36, 0xe4, 0x2f, 0x81, 0x75, 0xc0, 0x8f, + 0xa6, 0x5c, 0xe9, 0xe8, 0x90, 0xf8, 0x17, 0x81, 0xaa, 0x94, 0x85, 0xe2, 0xf4, 0x05, 0x71, 0x51, + 0xc4, 0x73, 0xb6, 0x9c, 0x9d, 0x5b, 0xbb, 0x6b, 0xb1, 0x1d, 0x21, 0xc6, 0xee, 0x34, 0x3c, 0x69, + 0xc2, 0xce, 0xa2, 0x09, 0xd7, 0x6b, 0x96, 0x4f, 0xf6, 0x23, 0x64, 0x44, 0xf7, 0x65, 0x9e, 0x69, + 0x9e, 0x97, 0xba, 0x3e, 0x30, 0x43, 0xa2, 0x2f, 0x0e, 0xf1, 0x6c, 0x35, 0xf8, 0x37, 0x4e, 0xe8, + 0x63, 0x72, 0xbd, 0xac, 0xa4, 0xa8, 0x58, 0x0e, 0x62, 0x37, 0xd3, 0xcd, 0x45, 0x13, 0x7a, 0x66, + 0x24, 0x02, 0xf6, 0xcc, 0x65, 0x33, 0x7d, 0x40, 0x56, 0x60, 0xc9, 0x5e, 0x17, 0x58, 0xfe, 0xa2, + 0x09, 0x6f, 0x23, 0x0b, 0xca, 0x36, 0x07, 0x1b, 0xf7, 0x7b, 0xdf, 0x7f, 0x84, 0x4e, 0xf4, 0xdb, + 0x69, 0xef, 0xc5, 0x98, 0x31, 0xc9, 0xf7, 0x88, 0x3b, 0xe6, 0x99, 0x18, 0x6b, 0x30, 0xd3, 0x4b, + 0x37, 0xfe, 0xe7, 0xc3, 0x7a, 0x2b, 0x1f, 0x96, 0xe8, 0x13, 0x72, 0x43, 0x30, 0xf5, 0x6e, 0xaa, + 0xf8, 0x08, 0xdc, 0xf4, 0xd2, 0x3b, 0x8b, 0x26, 0xec, 0x23, 0x6d, 0x89, 0xb4, 0x42, 0x08, 0xa6, + 0xde, 0x28, 0x3e, 0xa2, 0xcf, 0x89, 0xcb, 0x0a, 0xf5, 0x9e, 0x57, 0xde, 0xb5, 0x8b, 0x16, 0xfd, + 0x0c, 0x30, 0xdb, 0x04, 0x76, 0xb7, 0x4c, 0x60, 0x09, 0xd3, 0xed, 0x7e, 0xee, 0x92, 0x55, 0x3b, + 0x1d, 0xfd, 0x48, 0x5c, 0x3c, 0x2e, 0xba, 0xdd, 0x9e, 0x7d, 0xe9, 0xdd, 0xf0, 0x77, 0xae, 0x6e, + 0xc4, 0x6d, 0x45, 0x5b, 0x9f, 0x7e, 0xfe, 0xfd, 0xd6, 0xf5, 0xa9, 0x97, 0xc8, 0xc3, 0xf2, 0x11, + 0x7c, 0x46, 0x09, 0x5e, 0x48, 0x3c, 0x7a, 0x5a, 0x93, 0x15, 0xe0, 0xd3, 0x7b, 0x97, 0x0f, 0xb5, + 0xaf, 0x83, 0xbf, 0x7d, 0x65, 0x9f, 0xd1, 0x0e, 0x41, 0xbb, 0x4f, 0xd7, 0xcf, 0x6b, 0xc3, 0x71, + 0xa7, 0x4f, 0x4f, 0x66, 0x81, 0x73, 0x3a, 0x0b, 0x9c, 0x3f, 0xb3, 0xc0, 0xf9, 0x3a, 0x0f, 0x3a, + 0xa7, 0xf3, 0xa0, 0xf3, 0x6b, 0x1e, 0x74, 0xde, 0xde, 0x15, 0x99, 0x1e, 0x4f, 0x07, 0xf1, 0x50, + 0xe6, 0x36, 0xf9, 0x83, 0xa1, 0xc3, 0x23, 0x1a, 0xb8, 0xf0, 0x8a, 0xf6, 0xfe, 0x05, 0x00, 0x00, + 0xff, 0xff, 0x42, 0xa5, 0x31, 0x7b, 0xd8, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -153,8 +287,12 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryServiceClient interface { - // Parameters queries the parameters of the module. + // Params queries all parameters for the logic module. Params(ctx context.Context, in *QueryServiceParamsRequest, opts ...grpc.CallOption) (*QueryServiceParamsResponse, error) + // Query executes a logic query and returns the solutions found. + // Since the query is without any side-effect, the query is not executed in the context of a transaction and no fee + // is charged for this, but the execution is constrained by the current limits configured in the module. + Query(ctx context.Context, in *QueryServiceQueryRequest, opts ...grpc.CallOption) (*QueryServiceQueryResponse, error) } type queryServiceClient struct { @@ -174,10 +312,23 @@ func (c *queryServiceClient) Params(ctx context.Context, in *QueryServiceParamsR return out, nil } +func (c *queryServiceClient) Query(ctx context.Context, in *QueryServiceQueryRequest, opts ...grpc.CallOption) (*QueryServiceQueryResponse, error) { + out := new(QueryServiceQueryResponse) + err := c.cc.Invoke(ctx, "/logic.v1beta.QueryService/Query", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServiceServer is the server API for QueryService service. type QueryServiceServer interface { - // Parameters queries the parameters of the module. + // Params queries all parameters for the logic module. Params(context.Context, *QueryServiceParamsRequest) (*QueryServiceParamsResponse, error) + // Query executes a logic query and returns the solutions found. + // Since the query is without any side-effect, the query is not executed in the context of a transaction and no fee + // is charged for this, but the execution is constrained by the current limits configured in the module. + Query(context.Context, *QueryServiceQueryRequest) (*QueryServiceQueryResponse, error) } // UnimplementedQueryServiceServer can be embedded to have forward compatible implementations. @@ -187,6 +338,9 @@ type UnimplementedQueryServiceServer struct { func (*UnimplementedQueryServiceServer) Params(ctx context.Context, req *QueryServiceParamsRequest) (*QueryServiceParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } +func (*UnimplementedQueryServiceServer) Query(ctx context.Context, req *QueryServiceQueryRequest) (*QueryServiceQueryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Query not implemented") +} func RegisterQueryServiceServer(s grpc1.Server, srv QueryServiceServer) { s.RegisterService(&_QueryService_serviceDesc, srv) @@ -210,6 +364,24 @@ func _QueryService_Params_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _QueryService_Query_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryServiceQueryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServiceServer).Query(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/logic.v1beta.QueryService/Query", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServiceServer).Query(ctx, req.(*QueryServiceQueryRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _QueryService_serviceDesc = grpc.ServiceDesc{ ServiceName: "logic.v1beta.QueryService", HandlerType: (*QueryServiceServer)(nil), @@ -218,6 +390,10 @@ var _QueryService_serviceDesc = grpc.ServiceDesc{ MethodName: "Params", Handler: _QueryService_Params_Handler, }, + { + MethodName: "Query", + Handler: _QueryService_Query_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "logic/v1beta/query.proto", @@ -279,6 +455,88 @@ func (m *QueryServiceParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } +func (m *QueryServiceQueryRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryServiceQueryRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryServiceQueryRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Query) > 0 { + i -= len(m.Query) + copy(dAtA[i:], m.Query) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Query))) + i-- + dAtA[i] = 0x12 + } + if len(m.Program) > 0 { + i -= len(m.Program) + copy(dAtA[i:], m.Program) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Program))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryServiceQueryResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryServiceQueryResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryServiceQueryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Answer != nil { + { + size, err := m.Answer.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.GasUsed != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.GasUsed)) + i-- + dAtA[i] = 0x10 + } + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -310,6 +568,42 @@ func (m *QueryServiceParamsResponse) Size() (n int) { return n } +func (m *QueryServiceQueryRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Program) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Query) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryServiceQueryResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + if m.GasUsed != 0 { + n += 1 + sovQuery(uint64(m.GasUsed)) + } + if m.Answer != nil { + l = m.Answer.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -449,6 +743,244 @@ func (m *QueryServiceParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryServiceQueryRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryServiceQueryRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryServiceQueryRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Program", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Program = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Query = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryServiceQueryResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryServiceQueryResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryServiceQueryResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GasUsed", wireType) + } + m.GasUsed = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GasUsed |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Answer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Answer == nil { + m.Answer = &Answer{} + } + if err := m.Answer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/logic/types/query.pb.gw.go b/x/logic/types/query.pb.gw.go index ea698551..499601c9 100644 --- a/x/logic/types/query.pb.gw.go +++ b/x/logic/types/query.pb.gw.go @@ -51,6 +51,42 @@ func local_request_QueryService_Params_0(ctx context.Context, marshaler runtime. } +var ( + filter_QueryService_Query_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_QueryService_Query_0(ctx context.Context, marshaler runtime.Marshaler, client QueryServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryServiceQueryRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryService_Query_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Query(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_QueryService_Query_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryServiceQueryRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryService_Query_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Query(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryServiceHandlerServer registers the http handlers for service QueryService to "mux". // UnaryRPC :call QueryServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -80,6 +116,29 @@ func RegisterQueryServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu }) + mux.Handle("GET", pattern_QueryService_Query_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_QueryService_Query_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_QueryService_Query_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -141,13 +200,37 @@ func RegisterQueryServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu }) + mux.Handle("GET", pattern_QueryService_Query_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_QueryService_Query_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_QueryService_Query_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } var ( pattern_QueryService_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"okp4", "okp4d", "logic", "params"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_QueryService_Query_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"okp4", "okp4d", "logic", "query"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( forward_QueryService_Params_0 = runtime.ForwardResponseMessage + + forward_QueryService_Query_0 = runtime.ForwardResponseMessage ) diff --git a/x/logic/types/types.pb.go b/x/logic/types/types.pb.go new file mode 100644 index 00000000..849ec40d --- /dev/null +++ b/x/logic/types/types.pb.go @@ -0,0 +1,1131 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: logic/v1beta/types.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Term is the representation of a piece of data and can be a constant, a variable, or an atom. +type Term struct { + // name is the name of the term. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty" yaml:"name",omitempty` + // arguments are the arguments of the term, which can be constants, variables, or atoms. + Arguments []Term `protobuf:"bytes,2,rep,name=arguments,proto3" json:"arguments" yaml:"arguments",omitempty` +} + +func (m *Term) Reset() { *m = Term{} } +func (m *Term) String() string { return proto.CompactTextString(m) } +func (*Term) ProtoMessage() {} +func (*Term) Descriptor() ([]byte, []int) { + return fileDescriptor_9039e7facc8fa2a2, []int{0} +} +func (m *Term) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Term) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Term.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Term) XXX_Merge(src proto.Message) { + xxx_messageInfo_Term.Merge(m, src) +} +func (m *Term) XXX_Size() int { + return m.Size() +} +func (m *Term) XXX_DiscardUnknown() { + xxx_messageInfo_Term.DiscardUnknown(m) +} + +var xxx_messageInfo_Term proto.InternalMessageInfo + +func (m *Term) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Term) GetArguments() []Term { + if m != nil { + return m.Arguments + } + return nil +} + +// Substitution represents a substitution made to the variables in the query to obtain the answer. +type Substitution struct { + // variable is the name of the variable. + Variable string `protobuf:"bytes,1,opt,name=variable,proto3" json:"variable,omitempty" yaml:"variable",omitempty` + // term is the term that the variable is substituted with. + Term Term `protobuf:"bytes,2,opt,name=term,proto3" json:"term" yaml:"term",omitempty` +} + +func (m *Substitution) Reset() { *m = Substitution{} } +func (m *Substitution) String() string { return proto.CompactTextString(m) } +func (*Substitution) ProtoMessage() {} +func (*Substitution) Descriptor() ([]byte, []int) { + return fileDescriptor_9039e7facc8fa2a2, []int{1} +} +func (m *Substitution) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Substitution) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Substitution.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Substitution) XXX_Merge(src proto.Message) { + xxx_messageInfo_Substitution.Merge(m, src) +} +func (m *Substitution) XXX_Size() int { + return m.Size() +} +func (m *Substitution) XXX_DiscardUnknown() { + xxx_messageInfo_Substitution.DiscardUnknown(m) +} + +var xxx_messageInfo_Substitution proto.InternalMessageInfo + +func (m *Substitution) GetVariable() string { + if m != nil { + return m.Variable + } + return "" +} + +func (m *Substitution) GetTerm() Term { + if m != nil { + return m.Term + } + return Term{} +} + +// Result represents the result of a query. +type Result struct { + // substitutions represent all the substitutions made to the variables in the query to obtain the answer. + Substitutions []Substitution `protobuf:"bytes,1,rep,name=substitutions,proto3" json:"substitutions" yaml:"substitutions",omitempty` +} + +func (m *Result) Reset() { *m = Result{} } +func (m *Result) String() string { return proto.CompactTextString(m) } +func (*Result) ProtoMessage() {} +func (*Result) Descriptor() ([]byte, []int) { + return fileDescriptor_9039e7facc8fa2a2, []int{2} +} +func (m *Result) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Result) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Result.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Result) XXX_Merge(src proto.Message) { + xxx_messageInfo_Result.Merge(m, src) +} +func (m *Result) XXX_Size() int { + return m.Size() +} +func (m *Result) XXX_DiscardUnknown() { + xxx_messageInfo_Result.DiscardUnknown(m) +} + +var xxx_messageInfo_Result proto.InternalMessageInfo + +func (m *Result) GetSubstitutions() []Substitution { + if m != nil { + return m.Substitutions + } + return nil +} + +// Answer represents the answer to a logic query. +type Answer struct { + // result is the result of the query. + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty" yaml:"success",omitempty` + // has_more specifies if there are more solutions than the ones returned. + HasMore bool `protobuf:"varint,2,opt,name=has_more,json=hasMore,proto3" json:"has_more,omitempty" yaml:"has_next",omitempty` + // variables represent all the variables in the query. + Variables []string `protobuf:"bytes,3,rep,name=variables,proto3" json:"variables,omitempty" yaml:"variables",omitempty` + // results represent all the results of the query. + Results []Result `protobuf:"bytes,4,rep,name=results,proto3" json:"results" yaml:"results",omitempty` +} + +func (m *Answer) Reset() { *m = Answer{} } +func (m *Answer) String() string { return proto.CompactTextString(m) } +func (*Answer) ProtoMessage() {} +func (*Answer) Descriptor() ([]byte, []int) { + return fileDescriptor_9039e7facc8fa2a2, []int{3} +} +func (m *Answer) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Answer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Answer.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Answer) XXX_Merge(src proto.Message) { + xxx_messageInfo_Answer.Merge(m, src) +} +func (m *Answer) XXX_Size() int { + return m.Size() +} +func (m *Answer) XXX_DiscardUnknown() { + xxx_messageInfo_Answer.DiscardUnknown(m) +} + +var xxx_messageInfo_Answer proto.InternalMessageInfo + +func (m *Answer) GetSuccess() bool { + if m != nil { + return m.Success + } + return false +} + +func (m *Answer) GetHasMore() bool { + if m != nil { + return m.HasMore + } + return false +} + +func (m *Answer) GetVariables() []string { + if m != nil { + return m.Variables + } + return nil +} + +func (m *Answer) GetResults() []Result { + if m != nil { + return m.Results + } + return nil +} + +func init() { + proto.RegisterType((*Term)(nil), "logic.v1beta.Term") + proto.RegisterType((*Substitution)(nil), "logic.v1beta.Substitution") + proto.RegisterType((*Result)(nil), "logic.v1beta.Result") + proto.RegisterType((*Answer)(nil), "logic.v1beta.Answer") +} + +func init() { proto.RegisterFile("logic/v1beta/types.proto", fileDescriptor_9039e7facc8fa2a2) } + +var fileDescriptor_9039e7facc8fa2a2 = []byte{ + // 464 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x93, 0xcf, 0x8b, 0xd3, 0x40, + 0x14, 0xc7, 0x3b, 0x6d, 0xe8, 0xb6, 0xe3, 0x7a, 0x19, 0x56, 0xc8, 0x16, 0x37, 0x09, 0x11, 0xa4, + 0x07, 0x4d, 0xf0, 0x07, 0xa2, 0x0b, 0x82, 0x06, 0x3c, 0x0a, 0xb2, 0xee, 0xc9, 0x8b, 0x4c, 0xea, + 0x90, 0x06, 0x3b, 0x99, 0x32, 0x33, 0x59, 0xdb, 0xff, 0x42, 0x41, 0xc4, 0xa3, 0x7f, 0xce, 0x1e, + 0xf7, 0xe8, 0x29, 0x48, 0xfb, 0x1f, 0xf4, 0x2f, 0x90, 0xcc, 0x4c, 0xda, 0x99, 0xc3, 0x5e, 0x42, + 0x78, 0xdf, 0xf7, 0xbe, 0xef, 0xbd, 0xcf, 0xf0, 0xa0, 0xbf, 0x60, 0x45, 0x39, 0x4b, 0xaf, 0x9e, + 0xe4, 0x44, 0xe2, 0x54, 0xae, 0x97, 0x44, 0x24, 0x4b, 0xce, 0x24, 0x43, 0xc7, 0x4a, 0x49, 0xb4, + 0x32, 0x39, 0x29, 0x58, 0xc1, 0x94, 0x90, 0xb6, 0x7f, 0x3a, 0x27, 0xfe, 0x01, 0xa0, 0x77, 0x49, + 0x38, 0x45, 0x8f, 0xa1, 0x57, 0x61, 0x4a, 0x7c, 0x10, 0x81, 0xe9, 0x38, 0x3b, 0xdd, 0x35, 0xe1, + 0xbd, 0x35, 0xa6, 0x8b, 0xf3, 0xb8, 0x8d, 0xc6, 0x8f, 0x18, 0x2d, 0x25, 0xa1, 0x4b, 0xb9, 0xbe, + 0x50, 0x69, 0xe8, 0x12, 0x8e, 0x31, 0x2f, 0x6a, 0x4a, 0x2a, 0x29, 0xfc, 0x7e, 0x34, 0x98, 0xde, + 0x79, 0x8a, 0x12, 0xbb, 0x5f, 0xd2, 0xba, 0x66, 0xf1, 0x75, 0x13, 0xf6, 0x76, 0x4d, 0x38, 0xd1, + 0x5e, 0xfb, 0x12, 0xdb, 0xf0, 0x60, 0x74, 0xee, 0xfd, 0xfe, 0x13, 0x82, 0xf8, 0x17, 0x80, 0xc7, + 0x1f, 0xeb, 0x5c, 0xc8, 0x52, 0xd6, 0xb2, 0x64, 0x15, 0x7a, 0x05, 0x47, 0x57, 0x98, 0x97, 0x38, + 0x5f, 0x74, 0xf3, 0x9d, 0xed, 0x9a, 0xf0, 0x54, 0x7b, 0x76, 0x8a, 0x6d, 0xb9, 0x4f, 0x47, 0xef, + 0xa0, 0x27, 0x09, 0xa7, 0x7e, 0x3f, 0x02, 0xb7, 0x8c, 0x78, 0x66, 0x46, 0x34, 0xeb, 0xb6, 0xd9, + 0xce, 0xba, 0x6d, 0xc0, 0x0c, 0xb6, 0x82, 0xc3, 0x0b, 0x22, 0xea, 0x85, 0x44, 0x73, 0x78, 0x57, + 0x58, 0x13, 0x0a, 0x1f, 0x28, 0x04, 0x13, 0xd7, 0xdf, 0x5e, 0x22, 0x7b, 0x68, 0xfa, 0x04, 0xba, + 0x8f, 0x53, 0x6e, 0x37, 0x74, 0x8d, 0x4d, 0xe7, 0x9f, 0x7d, 0x38, 0x7c, 0x5b, 0x89, 0x6f, 0x84, + 0xa3, 0x17, 0xf0, 0x48, 0xd4, 0xb3, 0x19, 0x11, 0x42, 0xb1, 0x18, 0x65, 0xf7, 0x77, 0x4d, 0xe8, + 0x77, 0xa6, 0x4a, 0xb0, 0xed, 0xba, 0x64, 0xf4, 0x12, 0x8e, 0xe6, 0x58, 0x7c, 0xa6, 0x8c, 0x13, + 0x45, 0x63, 0x64, 0x43, 0x6c, 0x95, 0x8a, 0xac, 0xa4, 0x53, 0x39, 0xc7, 0xe2, 0x3d, 0xe3, 0x04, + 0xbd, 0x81, 0xe3, 0x8e, 0xa7, 0xf0, 0x07, 0xd1, 0x60, 0x3a, 0x56, 0xef, 0x0a, 0x0e, 0xef, 0xba, + 0x97, 0x9d, 0x77, 0xdd, 0x47, 0xd1, 0x07, 0x78, 0xc4, 0x15, 0x38, 0xe1, 0x7b, 0x0a, 0xd4, 0x89, + 0x0b, 0x4a, 0x53, 0xcd, 0x22, 0x83, 0xc8, 0x6c, 0x63, 0x4a, 0x9c, 0x99, 0x4c, 0x4c, 0x63, 0xc9, + 0x5e, 0x5f, 0x6f, 0x02, 0x70, 0xb3, 0x09, 0xc0, 0xbf, 0x4d, 0x00, 0xbe, 0x6f, 0x83, 0xde, 0xcd, + 0x36, 0xe8, 0xfd, 0xdd, 0x06, 0xbd, 0x4f, 0x0f, 0x8a, 0x52, 0xce, 0xeb, 0x3c, 0x99, 0x31, 0x9a, + 0xb2, 0xaf, 0xcb, 0xe7, 0xea, 0xf3, 0x25, 0x5d, 0xa5, 0xfa, 0x5a, 0xd4, 0x99, 0xe4, 0x43, 0x75, + 0x03, 0xcf, 0xfe, 0x07, 0x00, 0x00, 0xff, 0xff, 0x54, 0xbe, 0x29, 0x47, 0x43, 0x03, 0x00, 0x00, +} + +func (m *Term) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Term) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Term) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Arguments) > 0 { + for iNdEx := len(m.Arguments) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Arguments[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Substitution) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Substitution) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Substitution) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Term.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Variable) > 0 { + i -= len(m.Variable) + copy(dAtA[i:], m.Variable) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Variable))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Result) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Result) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Result) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Substitutions) > 0 { + for iNdEx := len(m.Substitutions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Substitutions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *Answer) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Answer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Answer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Results) > 0 { + for iNdEx := len(m.Results) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Results[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.Variables) > 0 { + for iNdEx := len(m.Variables) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Variables[iNdEx]) + copy(dAtA[i:], m.Variables[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Variables[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if m.HasMore { + i-- + if m.HasMore { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if m.Success { + i-- + if m.Success { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Term) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if len(m.Arguments) > 0 { + for _, e := range m.Arguments { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *Substitution) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Variable) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.Term.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *Result) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Substitutions) > 0 { + for _, e := range m.Substitutions { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *Answer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Success { + n += 2 + } + if m.HasMore { + n += 2 + } + if len(m.Variables) > 0 { + for _, s := range m.Variables { + l = len(s) + n += 1 + l + sovTypes(uint64(l)) + } + } + if len(m.Results) > 0 { + for _, e := range m.Results { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Term) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Term: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Term: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Arguments", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Arguments = append(m.Arguments, Term{}) + if err := m.Arguments[len(m.Arguments)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Substitution) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Substitution: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Substitution: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Variable", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Variable = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Term.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Result) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Result: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Result: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Substitutions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Substitutions = append(m.Substitutions, Substitution{}) + if err := m.Substitutions[len(m.Substitutions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Answer) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Answer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Answer: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Success = bool(v != 0) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HasMore", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.HasMore = bool(v != 0) + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Variables", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Variables = append(m.Variables, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Results", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Results = append(m.Results, Result{}) + if err := m.Results[len(m.Results)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +)