diff --git a/proto/logic/v1beta/params.proto b/proto/logic/v1beta/params.proto index 1b28b7cc..f05e2075 100644 --- a/proto/logic/v1beta/params.proto +++ b/proto/logic/v1beta/params.proto @@ -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"; @@ -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: "/". - // For instance: "findall/3". + // Specify 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\""]; + 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\"" + ]; } diff --git a/proto/logic/v1beta/tx.proto b/proto/logic/v1beta/tx.proto index 2819f6d1..0cb703d6 100644 --- a/proto/logic/v1beta/tx.proto +++ b/proto/logic/v1beta/tx.proto @@ -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 { +} diff --git a/proto/logic/v1beta/types.proto b/proto/logic/v1beta/types.proto deleted file mode 100644 index 0945966d..00000000 --- a/proto/logic/v1beta/types.proto +++ /dev/null @@ -1,53 +0,0 @@ -syntax = "proto3"; - -package logic.v1beta; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/okp4/okp4d/x/logic/types"; - -// An ACL specifies the access permissions on the associated resource for an actor, as a combination of actions such as -// read, write or delete. It is quite similar to UNIX file access permissions. -// -// Basically, an ACL is composed of: -// - a tag that denotes the authorization scheme to use, for instance: the wallet address which specifies an authorization scheme based on this address; -// - an optional tag qualifier that denotes the identifier in the tag scope. For instance the okp4 address of an actor for the tag "address"; -// - a set of permissions, denoting the combination of actions an actor is allowed to perform on the resource. -// -// ACLs can be expressed in the compact form of a URN: -// -// ::[,]* -// -// Here are some examples of ACLs and a description of their effects: -// -// - `address:okp41jyz4hc5tuweugs2xjn5fxd8rqehv6t3nl6y3le:store,remove` : the actor with the given okp4 address under control is authorized to perform the action "store". -// - `address::query` : any actor (with any address) is authorized to perform the action "query". -message ACL { - // Tag that denotes the authorization scheme to use. - // Several different tags may exist, depending on the domain objects and the services that manages them. - // - // For instance: - // - `address`: the ACL requires a specific wallet address. - string tag = 1 - [(gogoproto.moretags) = "yaml:\"tag\""]; - - // Qualifier that denotes the identifier in the tag scope. - // Several different qualifiers may exist in the system, depending on the tag. - // - // For instance: - // - `address`: for the tag `address`, the identifier represents the unique resource identifier of the user, e.g. `3AW302xlzVugABjjEJ`. - string qualifier = 2 - [(gogoproto.nullable) = true, (gogoproto.moretags) = "yaml:\"qualifier\""]; - - // Set of permissions (at least one). - // Several different permissions may exist depending on the nature of the domain objects and the different operations supported by - // these objects. - // - // - `store`: permission to store a program. - // For instance: - // - `remove`: permission to remove a program. - // - `query`: permission to query a program. - // - ... - repeated string permissions = 3 - [(gogoproto.moretags) = "yaml:\"permissions\""]; -}