Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/predicates include exclude #315

Merged
merged 11 commits into from
Mar 28, 2023
6 changes: 3 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ func New(
appCodec,
keys[logicmoduletypes.StoreKey],
keys[logicmoduletypes.MemStoreKey],
app.GetSubspace(logicmoduletypes.ModuleName),
authtypes.NewModuleAddress(govtypes.ModuleName),
app.AccountKeeper,
app.BankKeeper,
app.provideFS,
Expand Down Expand Up @@ -665,7 +665,7 @@ func New(
transferModule,
icaModule,
interTxModule,
logicmodule.NewAppModule(appCodec, app.LogicKeeper, app.AccountKeeper, app.BankKeeper),
logicmodule.NewAppModule(appCodec, app.LogicKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(logicmoduletypes.ModuleName)),
)

// During begin block slashing happens after distr.BeginBlocker so that
Expand Down Expand Up @@ -784,7 +784,7 @@ func New(
wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
ibc.NewAppModule(app.IBCKeeper),
transferModule,
logicmodule.NewAppModule(appCodec, app.LogicKeeper, app.AccountKeeper, app.BankKeeper),
logicmodule.NewAppModule(appCodec, app.LogicKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(logicmoduletypes.ModuleName)),
)
app.sm.RegisterStoreDecoders()

Expand Down
133 changes: 78 additions & 55 deletions docs/proto/logic.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,50 +196,54 @@ utilized within a query, or limiting the depth of the backtracking algorithm.

## Table of Contents

- [logic/v1beta/params.proto](#logic/v1beta/params.proto)
- [Interpreter](#logic.v1beta.Interpreter)
- [Limits](#logic.v1beta.Limits)
- [Params](#logic.v1beta.Params)
- [logic/v1beta2/params.proto](#logic/v1beta2/params.proto)
- [Interpreter](#logic.v1beta2.Interpreter)
- [Limits](#logic.v1beta2.Limits)
- [Params](#logic.v1beta2.Params)

- [logic/v1beta/genesis.proto](#logic/v1beta/genesis.proto)
- [GenesisState](#logic.v1beta.GenesisState)
- [logic/v1beta2/genesis.proto](#logic/v1beta2/genesis.proto)
- [GenesisState](#logic.v1beta2.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/v1beta2/types.proto](#logic/v1beta2/types.proto)
- [Answer](#logic.v1beta2.Answer)
- [Result](#logic.v1beta2.Result)
- [Substitution](#logic.v1beta2.Substitution)
- [Term](#logic.v1beta2.Term)

- [logic/v1beta/query.proto](#logic/v1beta/query.proto)
- [QueryServiceAskRequest](#logic.v1beta.QueryServiceAskRequest)
- [QueryServiceAskResponse](#logic.v1beta.QueryServiceAskResponse)
- [QueryServiceParamsRequest](#logic.v1beta.QueryServiceParamsRequest)
- [QueryServiceParamsResponse](#logic.v1beta.QueryServiceParamsResponse)
- [logic/v1beta2/query.proto](#logic/v1beta2/query.proto)
- [QueryServiceAskRequest](#logic.v1beta2.QueryServiceAskRequest)
- [QueryServiceAskResponse](#logic.v1beta2.QueryServiceAskResponse)
- [QueryServiceParamsRequest](#logic.v1beta2.QueryServiceParamsRequest)
- [QueryServiceParamsResponse](#logic.v1beta2.QueryServiceParamsResponse)

- [QueryService](#logic.v1beta.QueryService)
- [QueryService](#logic.v1beta2.QueryService)

- [logic/v1beta/tx.proto](#logic/v1beta/tx.proto)
- [MsgService](#logic.v1beta.MsgService)
- [logic/v1beta2/tx.proto](#logic/v1beta2/tx.proto)
- [MsgUpdateParams](#logic.v1beta2.MsgUpdateParams)
- [MsgUpdateParamsResponse](#logic.v1beta2.MsgUpdateParamsResponse)

- [MsgService](#logic.v1beta2.MsgService)

- [Scalar Value Types](#scalar-value-types)

<a name="logic/v1beta/params.proto"></a>
<a name="logic/v1beta2/params.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## logic/v1beta/params.proto
## logic/v1beta2/params.proto

<a name="logic.v1beta.Interpreter"></a>
<a name="logic.v1beta2.Interpreter"></a>

### 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: `<predicate_name>/<arity>`. For instance: `findall/3`. If not specified, the default set of predicates/operators will be registered. |
| `predicates_whitelist` | [string](#string) | repeated | predicates_whitelist specifies a list of prolog predicates that are allowed and can be used by the interpreter. The predicates are represented as `<predicate_name>/[<arity>]`, for example: `findall/3`, or `call`. If a predicate name without arity is included in this list, then all predicates with that name will be considered regardless of arity. For example, if `call` is included in the whitelist, then all predicates `call/1`, `call/2`, `call/3`... will be allowed. If this field is not specified, the interpreter will use the default set of predicates. |
| `predicates_blacklist` | [string](#string) | repeated | predicates_blacklist specifies a list of prolog predicates that are excluded from the set of registered predicates and can never be executed by the interpreter. The predicates are represented as `<predicate_name>/[<arity>]`, for example: `findall/3`, or `call`. If a predicate name without arity is included in this list, then all predicates with that name will be considered regardless of arity. For example, if `call` is included in the blacklist, then all predicates `call/1`, `call/2`, `call/3`... will be excluded. If a predicate is included in both whitelist and blacklist, it will be excluded. This means that blacklisted predicates prevails on whitelisted predicates. |
| `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. |

<a name="logic.v1beta.Limits"></a>
<a name="logic.v1beta2.Limits"></a>

### Limits

Expand All @@ -251,16 +255,16 @@ Limits defines the limits of the logic module.
| `max_size` | [string](#string) | | max_size specifies the maximum size, in bytes, that is accepted for a program. nil value remove size limitation. |
| `max_result_count` | [string](#string) | | max_result_count specifies the maximum number of results that can be requested for a query. nil value remove max result count limitation. |

<a name="logic.v1beta.Params"></a>
<a name="logic.v1beta2.Params"></a>

### Params

Params defines all the configuration parameters of the "logic" module.

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `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. |
| `interpreter` | [Interpreter](#logic.v1beta2.Interpreter) | | Interpreter specifies the parameter for the logic interpreter. |
| `limits` | [Limits](#logic.v1beta2.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)

Expand All @@ -270,20 +274,20 @@ Params defines all the configuration parameters of the "logic" module.

[//]: # (end services)

<a name="logic/v1beta/genesis.proto"></a>
<a name="logic/v1beta2/genesis.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## logic/v1beta/genesis.proto
## logic/v1beta2/genesis.proto

<a name="logic.v1beta.GenesisState"></a>
<a name="logic.v1beta2.GenesisState"></a>

### GenesisState

GenesisState defines the logic module's genesis state.

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `params` | [Params](#logic.v1beta.Params) | | The state parameters for the logic module. |
| `params` | [Params](#logic.v1beta2.Params) | | The state parameters for the logic module. |

[//]: # (end messages)

Expand All @@ -293,12 +297,12 @@ GenesisState defines the logic module's genesis state.

[//]: # (end services)

<a name="logic/v1beta/types.proto"></a>
<a name="logic/v1beta2/types.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## logic/v1beta/types.proto
## logic/v1beta2/types.proto

<a name="logic.v1beta.Answer"></a>
<a name="logic.v1beta2.Answer"></a>

### Answer

Expand All @@ -309,19 +313,19 @@ Answer represents the answer to a logic query.
| `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. |
| `results` | [Result](#logic.v1beta2.Result) | repeated | results represent all the results of the query. |

<a name="logic.v1beta.Result"></a>
<a name="logic.v1beta2.Result"></a>

### 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. |
| `substitutions` | [Substitution](#logic.v1beta2.Substitution) | repeated | substitutions represent all the substitutions made to the variables in the query to obtain the answer. |

<a name="logic.v1beta.Substitution"></a>
<a name="logic.v1beta2.Substitution"></a>

### Substitution

Expand All @@ -330,9 +334,9 @@ Substitution represents a substitution made to the variables in the query to obt
| 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](#logic.v1beta2.Term) | | term is the term that the variable is substituted with. |

<a name="logic.v1beta.Term"></a>
<a name="logic.v1beta2.Term"></a>

### Term

Expand All @@ -341,7 +345,7 @@ Term is the representation of a piece of data and can be a constant, a variable,
| 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. |
| `arguments` | [Term](#logic.v1beta2.Term) | repeated | arguments are the arguments of the term, which can be constants, variables, or atoms. |

[//]: # (end messages)

Expand All @@ -351,12 +355,12 @@ Term is the representation of a piece of data and can be a constant, a variable,

[//]: # (end services)

<a name="logic/v1beta/query.proto"></a>
<a name="logic/v1beta2/query.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## logic/v1beta/query.proto
## logic/v1beta2/query.proto

<a name="logic.v1beta.QueryServiceAskRequest"></a>
<a name="logic.v1beta2.QueryServiceAskRequest"></a>

### QueryServiceAskRequest

Expand All @@ -367,7 +371,7 @@ QueryServiceAskRequest is request type for the QueryService/Ask RPC method.
| `program` | [string](#string) | | program is the logic program to be queried. |
| `query` | [string](#string) | | query is the query string to be executed. |

<a name="logic.v1beta.QueryServiceAskResponse"></a>
<a name="logic.v1beta2.QueryServiceAskResponse"></a>

### QueryServiceAskResponse

Expand All @@ -377,55 +381,73 @@ QueryServiceAskResponse is response type for the QueryService/Ask RPC method.
| ----- | ---- | ----- | ----------- |
| `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. |
| `answer` | [Answer](#logic.v1beta2.Answer) | | answer is the answer to the query. |

<a name="logic.v1beta.QueryServiceParamsRequest"></a>
<a name="logic.v1beta2.QueryServiceParamsRequest"></a>

### QueryServiceParamsRequest

QueryServiceParamsRequest is request type for the QueryService/Params RPC method.

<a name="logic.v1beta.QueryServiceParamsResponse"></a>
<a name="logic.v1beta2.QueryServiceParamsResponse"></a>

### QueryServiceParamsResponse

QueryServiceParamsResponse is response type for the QueryService/Params RPC method.

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `params` | [Params](#logic.v1beta.Params) | | params holds all the parameters of this module. |
| `params` | [Params](#logic.v1beta2.Params) | | params holds all the parameters of this module. |

[//]: # (end messages)

[//]: # (end enums)

[//]: # (end HasExtensions)

<a name="logic.v1beta.QueryService"></a>
<a name="logic.v1beta2.QueryService"></a>

### QueryService

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) | Params queries all parameters for the logic module. | GET|/okp4/okp4d/logic/params|
| `Ask` | [QueryServiceAskRequest](#logic.v1beta.QueryServiceAskRequest) | [QueryServiceAskResponse](#logic.v1beta.QueryServiceAskResponse) | Ask 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/ask|
| `Params` | [QueryServiceParamsRequest](#logic.v1beta2.QueryServiceParamsRequest) | [QueryServiceParamsResponse](#logic.v1beta2.QueryServiceParamsResponse) | Params queries all parameters for the logic module. | GET|/okp4/okp4d/logic/params|
| `Ask` | [QueryServiceAskRequest](#logic.v1beta2.QueryServiceAskRequest) | [QueryServiceAskResponse](#logic.v1beta2.QueryServiceAskResponse) | Ask 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/ask|

[//]: # (end services)

<a name="logic/v1beta/tx.proto"></a>
<a name="logic/v1beta2/tx.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## logic/v1beta/tx.proto
## logic/v1beta2/tx.proto

<a name="logic.v1beta2.MsgUpdateParams"></a>

### MsgUpdateParams

MsgUpdateParams defines a Msg for updating the x/logic module parameters.

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `authority` | [string](#string) | | authority is the address of the governance account. |
| `params` | [Params](#logic.v1beta2.Params) | | params defines the x/logic parameters to update. NOTE: All parameters must be supplied. |

<a name="logic.v1beta2.MsgUpdateParamsResponse"></a>

### MsgUpdateParamsResponse

MsgUpdateParamsResponse defines the response structure for executing a
MsgUpdateParams message.

[//]: # (end messages)

[//]: # (end enums)

[//]: # (end HasExtensions)

<a name="logic.v1beta.MsgService"></a>
<a name="logic.v1beta2.MsgService"></a>

### MsgService

Expand All @@ -434,6 +456,7 @@ Do nothing for now as the service is without any side effects.

| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `UpdateParams` | [MsgUpdateParams](#logic.v1beta2.MsgUpdateParams) | [MsgUpdateParamsResponse](#logic.v1beta2.MsgUpdateParamsResponse) | UpdateParams defined a governance operation for updating the x/logic module parameters. The authority is hard-coded to the Cosmos SDK x/gov module account | |

[//]: # (end services)

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ require (
github.com/rakyll/statik v0.1.7 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/regen-network/cosmos-proto v0.3.1 // indirect
github.com/rjNemo/underscore v0.5.0 // indirect
github.com/rs/cors v1.8.2 // indirect
github.com/rs/zerolog v1.27.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,10 @@ github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNw
github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4=
github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI=
github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc=
github.com/rjNemo/underscore v0.3.1-0.20220323145844-235b36b7f6e8 h1:4gIyk0JDuOJaKQyPWv9wXL0F128xIMjw4c0z61yAnxE=
github.com/rjNemo/underscore v0.3.1-0.20220323145844-235b36b7f6e8/go.mod h1:y3LuKy2UP6zp7yZff5ZGRm1s/s9QvCoCoQZVqAkk3hM=
github.com/rjNemo/underscore v0.5.0 h1:Pa58PfchgZWgCY1eBKjER/lm0repbGrTzq6RRxtnGmg=
github.com/rjNemo/underscore v0.5.0/go.mod h1:y3LuKy2UP6zp7yZff5ZGRm1s/s9QvCoCoQZVqAkk3hM=
github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
Expand Down
9 changes: 0 additions & 9 deletions proto/logic/v1beta/tx.proto

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
syntax = "proto3";

package logic.v1beta;
package logic.v1beta2;

import "gogoproto/gogo.proto";
import "logic/v1beta/params.proto";
import "logic/v1beta2/params.proto";

option go_package = "github.com/okp4/okp4d/x/logic/types";

Expand Down
Loading