Skip to content

Commit

Permalink
Merge pull request #708 from axone-protocol/fix/logic-gas-limit
Browse files Browse the repository at this point in the history
  • Loading branch information
amimart authored Jul 24, 2024
2 parents e354a2d + dc1b52e commit 8bd193e
Show file tree
Hide file tree
Showing 26 changed files with 172 additions and 280 deletions.
14 changes: 7 additions & 7 deletions docs/predicate/bech32_address_2.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ bech32_address(Address, 'axone15wn30a9z4uc692s0kkx5fp5d4qfr3ac77gvjg4').

``` yaml
height: 42
gas_used: 2222
gas_used: 3876
answer:
has_more: false
variables: ["Address"]
Expand Down Expand Up @@ -72,7 +72,7 @@ bech32_address(-(Hrp, Address), 'axone15wn30a9z4uc692s0kkx5fp5d4qfr3ac77gvjg4').

``` yaml
height: 42
gas_used: 2222
gas_used: 3876
answer:
has_more: false
variables: ["Hrp", "Address"]
Expand Down Expand Up @@ -102,7 +102,7 @@ bech32_address(-(axone, Address), 'axone15wn30a9z4uc692s0kkx5fp5d4qfr3ac77gvjg4'

``` yaml
height: 42
gas_used: 2222
gas_used: 3876
answer:
has_more: false
variables: ["Address"]
Expand All @@ -129,7 +129,7 @@ bech32_address(-('axone', [163,167,23,244,162,175,49,162,170,15,181,141,68,134,1

``` yaml
height: 42
gas_used: 2222
gas_used: 3876
answer:
has_more: false
variables: ["Bech32"]
Expand Down Expand Up @@ -162,7 +162,7 @@ axone_addr('axone1p8u47en82gmzfm259y6z93r9qe63l25d858vqu').

``` yaml
height: 42
gas_used: 2222
gas_used: 3876
answer:
has_more: false
results:
Expand All @@ -188,7 +188,7 @@ bech32_address(Address, axoneincorrect).

``` yaml
height: 42
gas_used: 2222
gas_used: 3876
answer:
has_more: false
variables: ["Address"]
Expand All @@ -215,7 +215,7 @@ bech32_address(-('axone', X), foo(bar)).

``` yaml
height: 42
gas_used: 2222
gas_used: 3876
answer:
has_more: false
variables: ["X"]
Expand Down
4 changes: 2 additions & 2 deletions docs/predicate/block_height_1.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ block_height(Height).

``` yaml
height: 100
gas_used: 2222
gas_used: 3876
answer:
has_more: false
variables: ["Height"]
Expand Down Expand Up @@ -79,7 +79,7 @@ Height > 100.

``` yaml
height: 101
gas_used: 2223
gas_used: 3877
answer:
has_more: false
variables: ["Height"]
Expand Down
4 changes: 2 additions & 2 deletions docs/predicate/block_time_1.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ block_time(Time).

``` yaml
height: 42
gas_used: 2222
gas_used: 3876
answer:
has_more: false
variables: ["Time"]
Expand Down Expand Up @@ -80,7 +80,7 @@ Time > 1709550216.

``` yaml
height: 42
gas_used: 2223
gas_used: 3877
answer:
has_more: false
variables: ["Time"]
Expand Down
6 changes: 3 additions & 3 deletions docs/predicate/consult_1.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ hello(Who).

``` yaml
height: 42
gas_used: 2224
gas_used: 3878
answer:
has_more: false
variables: ["Who"]
Expand Down Expand Up @@ -129,7 +129,7 @@ response: |

``` yaml
height: 42
gas_used: 2223
gas_used: 3877
answer:
has_more: false
variables: ["X"]
Expand Down Expand Up @@ -194,7 +194,7 @@ source_file(File).

``` yaml
height: 42
gas_used: 2223
gas_used: 3877
answer:
has_more: false
variables: ["File"]
Expand Down
8 changes: 4 additions & 4 deletions docs/predicate/current_output_1.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ write_char_to_user_output(x).

``` yaml
height: 42
gas_used: 2241
gas_used: 3976
answer:
has_more: false
variables:
Expand Down Expand Up @@ -108,7 +108,7 @@ log_message('Hello world!').

``` yaml
height: 42
gas_used: 2248
gas_used: 4010
answer:
has_more: false
variables:
Expand Down Expand Up @@ -155,7 +155,7 @@ log_message('Hello world!').

``` yaml
height: 42
gas_used: 2241
gas_used: 3976
answer:
has_more: false
variables:
Expand Down Expand Up @@ -205,7 +205,7 @@ log_message("Hello 🧙!").

``` yaml
height: 42
gas_used: 2255
gas_used: 3990
answer:
has_more: false
variables:
Expand Down
2 changes: 1 addition & 1 deletion docs/predicate/open_3.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ open(

``` yaml
height: 42
gas_used: 2223
gas_used: 3877
answer:
has_more: false
variables:
Expand Down
14 changes: 7 additions & 7 deletions docs/predicate/open_4.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ open(URI, read, _, []).

``` yaml
height: 42
gas_used: 2228
gas_used: 3882
answer:
has_more: false
variables: ["URI"]
Expand Down Expand Up @@ -152,7 +152,7 @@ read_resource('cosmwasm:storage:axone15ekvz3qdter33mdnk98v8whv5qdr53yusksnfgc08x

``` yaml
height: 42
gas_used: 2224
gas_used: 3878
answer:
has_more: false
variables: ["Chars"]
Expand Down Expand Up @@ -202,7 +202,7 @@ read_resource('cosmwasm:storage:axone15ekvz3qdter33mdnk98v8whv5qdr53yusksnfgc08x

``` yaml
height: 42
gas_used: 2224
gas_used: 3878
answer:
has_more: false
variables: ["Chars"]
Expand All @@ -229,7 +229,7 @@ open('cosmwasm:storage:axone15ekvz3qdter33mdnk98v8whv5qdr53yusksnfgc08xd26fpdn3t

``` yaml
height: 42
gas_used: 2222
gas_used: 3876
answer:
has_more: false
variables: ["Stream"]
Expand All @@ -255,7 +255,7 @@ open('cosmwasm:storage:axone15ekvz3qdter33mdnk98v8whv5qdr53yusksnfgc08xd26fpdn3t

``` yaml
height: 42
gas_used: 2222
gas_used: 3876
answer:
has_more: false
variables: ["Stream"]
Expand All @@ -281,7 +281,7 @@ open('cosmwasm:storage:axone15ekvz3qdter33mdnk98v8whv5qdr53yusksnfgc08xd26fpdn3t

``` yaml
height: 42
gas_used: 2222
gas_used: 3876
answer:
has_more: false
variables: ["Stream"]
Expand All @@ -306,7 +306,7 @@ open('cosmwasm:storage:axone15ekvz3qdter33mdnk98v8whv5qdr53yusksnfgc08xd26fpdn3t

``` yaml
height: 42
gas_used: 2222
gas_used: 3876
answer:
has_more: false
variables: ["Stream"]
Expand Down
5 changes: 3 additions & 2 deletions docs/proto/logic.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,12 @@ to submit transactions or make changes to the blockchain's state. It is therefor

To control the cpu and memory usage of the module, the module is limited by several different mechanisms:

- `max_gas`: the maximum amount of gas that can be used to evaluate a query.
- `max_size`: the maximum size of the program that can be evaluated.
- `max_result_count`: the maximum number of results that can be returned by a query.

The existing `query-gas-limit` configuration present in the `app.toml` can be used to constraint gas usage when not used
in the context of a transaction.

Additional limitations are being considered for the future, such as restricting the number of variables that can be
utilized within a query, or limiting the depth of the backtracking algorithm.

Expand Down Expand Up @@ -274,7 +276,6 @@ Limits defines the limits of the logic module.

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `max_gas` | [string](#string) | | 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. nil value remove max gas limitation. |
| `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. |
| `max_user_output_size` | [string](#string) | | max_user_output_size specifies the maximum number of bytes to keep in the user output. If the user output exceeds this size, the interpreter will overwrite the oldest bytes with the new ones to keep the size constant. nil value or 0 value means that no user output is used at all. |
Expand Down
4 changes: 3 additions & 1 deletion proto/logic/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,11 @@ description: |
To control the cpu and memory usage of the module, the module is limited by several different mechanisms:
- `max_gas`: the maximum amount of gas that can be used to evaluate a query.
- `max_size`: the maximum size of the program that can be evaluated.
- `max_result_count`: the maximum number of results that can be returned by a query.
The existing `query-gas-limit` configuration present in the `app.toml` can be used to constraint gas usage when not used
in the context of a transaction.
Additional limitations are being considered for the future, such as restricting the number of variables that can be
utilized within a query, or limiting the depth of the backtracking algorithm.
10 changes: 0 additions & 10 deletions proto/logic/v1beta2/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,6 @@ message Params {
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.
// nil value remove max gas limitation.
string max_gas = 1 [
(gogoproto.moretags) = "yaml:\"max_gas\",omitempty",
(gogoproto.customtype) = "cosmossdk.io/math.Uint",
(gogoproto.nullable) = true
];

// max_size specifies the maximum size, in bytes, that is accepted for a program.
// nil value remove size limitation.
string max_size = 3 [
Expand Down
Loading

0 comments on commit 8bd193e

Please sign in to comment.