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

🧠 Use our own axone/prolog fork in logic module #703

Merged
merged 9 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: 3876
gas_used: 4140
answer:
has_more: false
variables: ["Address"]
Expand Down Expand Up @@ -72,7 +72,7 @@ bech32_address(-(Hrp, Address), 'axone15wn30a9z4uc692s0kkx5fp5d4qfr3ac77gvjg4').

``` yaml
height: 42
gas_used: 3876
gas_used: 4140
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: 3876
gas_used: 4140
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: 3876
gas_used: 4140
answer:
has_more: false
variables: ["Bech32"]
Expand Down Expand Up @@ -162,7 +162,7 @@ axone_addr('axone1p8u47en82gmzfm259y6z93r9qe63l25d858vqu').

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

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

``` yaml
height: 42
gas_used: 3876
gas_used: 4140
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: 3876
gas_used: 4140
answer:
has_more: false
variables: ["Height"]
Expand Down Expand Up @@ -79,7 +79,7 @@ Height > 100.

``` yaml
height: 101
gas_used: 3877
gas_used: 4141
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: 3876
gas_used: 4140
answer:
has_more: false
variables: ["Time"]
Expand Down Expand Up @@ -80,7 +80,7 @@ Time > 1709550216.

``` yaml
height: 42
gas_used: 3877
gas_used: 4141
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: 3878
gas_used: 4142
answer:
has_more: false
variables: ["Who"]
Expand Down Expand Up @@ -129,7 +129,7 @@ response: |

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

``` yaml
height: 42
gas_used: 3877
gas_used: 4141
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: 3976
gas_used: 4240
answer:
has_more: false
variables:
Expand Down Expand Up @@ -108,7 +108,7 @@ log_message('Hello world!').

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

``` yaml
height: 42
gas_used: 3976
gas_used: 4240
answer:
has_more: false
variables:
Expand Down Expand Up @@ -205,7 +205,7 @@ log_message("Hello πŸ§™!").

``` yaml
height: 42
gas_used: 3990
gas_used: 4254
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: 3877
gas_used: 4141
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: 3882
gas_used: 4146
answer:
has_more: false
variables: ["URI"]
Expand Down Expand Up @@ -152,7 +152,7 @@ read_resource('cosmwasm:storage:axone15ekvz3qdter33mdnk98v8whv5qdr53yusksnfgc08x

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

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

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

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

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

``` yaml
height: 42
gas_used: 3876
gas_used: 4140
answer:
has_more: false
variables: ["Stream"]
Expand Down
1 change: 1 addition & 0 deletions docs/proto/logic.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ 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. |
| `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. |
| `max_variables` | [string](#string) | | max_variables specifies the maximum number of variables that can be create by the interpreter. nil value or 0 value means that no limit is set. |

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

Expand Down
9 changes: 9 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ require (
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.9.0
github.com/wk8/go-ordered-map/v2 v2.1.8
golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0
golang.org/x/net v0.24.0
google.golang.org/genproto/googleapis/api v0.0.0-20240311132316-a219d84964c2
Expand All @@ -73,6 +74,10 @@ replace (
// Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities.
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.0

// Use cutom fork of prolog interpreter
github.com/ichiban/prolog => github.com/axone-protocol/prolog v1.0.0

// replace broken goleveldb
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
)
Expand All @@ -96,20 +101,23 @@ require (
github.com/VictoriaMetrics/fastcache v1.5.7 // indirect
github.com/VividCortex/ewma v1.2.0 // indirect
github.com/aws/aws-sdk-go v1.44.224 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
github.com/bits-and-blooms/bitset v1.8.0 // indirect
github.com/btcsuite/btcd v0.22.0-beta // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cheggaaa/pb/v3 v3.0.8 // indirect
github.com/chzyer/readline v1.5.1 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/cockroachdb/apd/v2 v2.0.2 // indirect
github.com/cockroachdb/apd/v3 v3.2.1 // indirect
github.com/cockroachdb/errors v1.11.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v1.1.0 // indirect
Expand Down Expand Up @@ -216,6 +224,7 @@ require (
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/linxGnu/grocksdb v1.8.14 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/manifoldco/promptui v0.9.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
Expand Down
15 changes: 13 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX
github.com/aws/aws-sdk-go v1.44.224 h1:09CiaaF35nRmxrzWZ2uRq5v6Ghg/d2RiPjZnSgtt+RQ=
github.com/aws/aws-sdk-go v1.44.224/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
github.com/axone-protocol/prolog v1.0.0 h1:CASA1QrPOWhYox8YUStML33rekoA/7Gnp/ldDPZqCTA=
github.com/axone-protocol/prolog v1.0.0/go.mod h1:lbZPekEi6qr5WX29GgEmhZlTxUkeWeiJ8cZZRq8qjAE=
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
Expand Down Expand Up @@ -326,6 +330,8 @@ github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtE
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY=
github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE=
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
github.com/bytedance/sonic v1.8.0 h1:ea0Xadu+sHlu7x5O3gKhRpQ1IKiMrSiHttPF0ybECuA=
Expand Down Expand Up @@ -377,6 +383,8 @@ github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWH
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E=
github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw=
github.com/cockroachdb/apd/v3 v3.2.1 h1:U+8j7t0axsIgvQUqthuNm82HIrYXodOV2iWLWtEaIwg=
github.com/cockroachdb/apd/v3 v3.2.1/go.mod h1:klXJcjp+FffLTHlhIG69tezTDvdP065naDsHzKhYSqc=
github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4=
github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU=
Expand Down Expand Up @@ -832,8 +840,6 @@ github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSAS
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ichiban/prolog v1.2.0 h1:DrwolRMxdzI3126nCSpyxJtK4OVVqmbu7XpGhy8phXs=
github.com/ichiban/prolog v1.2.0/go.mod h1:RmvNfGaSktvEVZ7nmpn0gkWa5u0Y3zQcK0G+Pl+ul+s=
github.com/ignite/cli v0.27.2 h1:NFzZqQrt8vhRQeStSvAMhpq65ag+lEAVP5ulw7cu3Y4=
github.com/ignite/cli v0.27.2/go.mod h1:7uaYQQ07tyOBiVAlRYAcZk2g/Y1vtgU0J09oPNntR4E=
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
Expand Down Expand Up @@ -861,6 +867,7 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfC
github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U=
github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
Expand Down Expand Up @@ -931,6 +938,8 @@ github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0Q
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA=
github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg=
github.com/matryer/is v1.3.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
Expand Down Expand Up @@ -1269,6 +1278,8 @@ github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8=
github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
github.com/x-cray/logrus-prefixed-formatter v0.5.2 h1:00txxvfBM9muc0jiLIEAkAcIMJzfthRT6usrui8uGmg=
github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE=
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
Expand Down
8 changes: 8 additions & 0 deletions proto/logic/v1beta2/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ message Limits {
(gogoproto.customtype) = "cosmossdk.io/math.Uint",
(gogoproto.nullable) = true
];

// max_variables specifies the maximum number of variables that can be create by the interpreter.
// nil value or 0 value means that no limit is set.
string max_variables = 5 [
(gogoproto.moretags) = "yaml:\"max_variables\"",
(gogoproto.customtype) = "cosmossdk.io/math.Uint",
(gogoproto.nullable) = true
];
}

// Filter defines the parameters for filtering the set of strings which can designate anything.
Expand Down
Loading
Loading