Skip to content

Commit

Permalink
feat(logic): improve parameters configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ccamel committed Jan 2, 2023
1 parent 208e5c0 commit d1396bb
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 104 deletions.
81 changes: 32 additions & 49 deletions proto/logic/v1beta/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ syntax = "proto3";
package logic.v1beta;

import "gogoproto/gogo.proto";
import "google/protobuf/duration.proto";
import "logic/v1beta/types.proto";

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

Expand All @@ -13,69 +11,54 @@ message Params {
option (gogoproto.goproto_stringer) = false;

// Specify the parameter for the logic interpreter.
Interpreter interpreter = 1
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"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\""
];

// Specify the limits for query executions.
QueryExecutionLimits query_execution_limits = 2
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"query_execution_limits\""];

// Specify the limits for programs.
ProgramLimits program_limits = 3
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"program_limits\""];

// Specify the access control list that applies to the module.
//
// ACLs are expressed as a combination set of tag, qualifier and permission, where:
//
// - `tag` denotes the authorization scheme to use. Possible values are:
// - `address`: authorization is evaluated according to the address wallet of the transaction.
// - `qualifier` denotes the identifier in the tag scope.
// - `permission` denotes a permission, i.e. the operation allowed on the considered domain object. Possible values are:
// - `store`: if authorization is granted to store a program in the module.
// - `remove`: if authorization is granted to remove a program from the module.
//
// It is important to note that if no ACL is configured, all requests are allowed. If an empty ACL set is configured,
// all requests are denied and explicit permissions must be defined.
repeated ACL acls = 4
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"acls\""];
}

// QueryExecutionLimits defines the limits for query executions.
message QueryExecutionLimits {
// Limits defines the limits of the logic module.
message Limits {
option (gogoproto.goproto_stringer) = true;

// Specify the maximum amount of computing power allowed to be consumed to execute the request by the interpreter,
// in "gas", the unit of this quantity.
uint32 max_gas = 1
[(gogoproto.moretags) = "yaml:\"max_execution_time\",omitempty"];
// The maximum amount of computing power, measured in "gas," that is allowed to be consumed when executing a request
// by the interpreter is specified here. 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"];

// Specify the maximum number of results that can be asked for a query.
uint32 max_result_count = 2
[(gogoproto.moretags) = "yaml:\"max_result_count\""];
}
// Specify the maximum size, in bytes, that is accepted for a program.
uint32 max_size = 3 [(gogoproto.moretags) = "yaml:\"max_size\""];

// ProgramLimits defines the limits for a program.
message ProgramLimits {
option (gogoproto.goproto_stringer) = true;
// Specify the maximum number of results that can be requested for a query.
uint32 max_result_count = 2 [(gogoproto.moretags) = "yaml:\"max_result_count\""];

// Specify the maximum accepted size (in bytes) of a program.
uint32 max_size = 1
[(gogoproto.moretags) = "yaml:\"max_size\""];
}

// Interpreter defines the various parameters for the interpreter.
message Interpreter {
option (gogoproto.goproto_stringer) = true;

// Specify the list of registered predicates/operators, in the form of: "<predicate_name>/<arity>".
// For instance: "findall/3".
// Specify 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.
repeated string registered_predicates = 1
[(gogoproto.nullable) = true, (gogoproto.moretags) = "yaml:\"registered_predicates\""];
repeated string registered_predicates = 1 [
(gogoproto.nullable) = true,
(gogoproto.moretags) = "yaml:\"registered_predicates\""
];

// Specify 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\""];
string bootstrap = 2 [
(gogoproto.nullable) = true,
(gogoproto.moretags) = "yaml:\"bootstrap\""
];
}
6 changes: 4 additions & 2 deletions proto/logic/v1beta/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ syntax = "proto3";

package logic.v1beta;

import "gogoproto/gogo.proto";

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

// Msg defines the Msg service.
service MsgService {}
service MsgService {
}
53 changes: 0 additions & 53 deletions proto/logic/v1beta/types.proto

This file was deleted.

0 comments on commit d1396bb

Please sign in to comment.