diff --git a/go.mod b/go.mod index 72f36873..54f89e63 100644 --- a/go.mod +++ b/go.mod @@ -3,21 +3,25 @@ module github.com/dymensionxyz/dymension-rdk go 1.22.1 require ( - cosmossdk.io/errors v1.0.0-beta.7 - cosmossdk.io/math v1.2.0 + cosmossdk.io/errors v1.0.1 + cosmossdk.io/math v1.3.0 + github.com/armon/go-metrics v0.4.1 github.com/cometbft/cometbft v0.37.2 - github.com/cosmos/cosmos-sdk v0.46.15 - github.com/cosmos/ibc-go/v6 v6.1.1 - github.com/dymensionxyz/dymint v1.0.1-alpha + github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-sdk v0.46.16 + github.com/cosmos/ibc-go/v6 v6.2.1 + github.com/dymensionxyz/dymint v1.1.0-rc01 github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.3 github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/libp2p/go-libp2p v0.33.1 + github.com/pkg/errors v0.9.1 github.com/rakyll/statik v0.1.7 github.com/sirupsen/logrus v1.9.3 github.com/spf13/cast v1.5.1 github.com/spf13/cobra v1.8.0 + github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.8.4 github.com/tendermint/tendermint v0.34.29 github.com/tendermint/tm-db v0.6.8-0.20220506192307-f628bb5dc95b @@ -26,6 +30,7 @@ require ( google.golang.org/protobuf v1.32.0 gopkg.in/natefinch/lumberjack.v2 v2.0.0 gopkg.in/yaml.v2 v2.4.0 + sigs.k8s.io/yaml v1.4.0 ) require ( @@ -38,8 +43,8 @@ require ( github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect + github.com/DataDog/zstd v1.5.2 // indirect github.com/Workiva/go-datastructures v1.0.53 // indirect - github.com/armon/go-metrics v0.4.1 // indirect github.com/aws/aws-sdk-go v1.44.122 // indirect github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -54,13 +59,17 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // 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 + github.com/cockroachdb/redact v1.1.5 // indirect + github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/coinbase/rosetta-sdk-go v0.7.9 // indirect - github.com/cometbft/cometbft-db v0.7.0 // indirect + github.com/cometbft/cometbft-db v0.11.0 // indirect github.com/confio/ics23/go v0.9.0 // indirect github.com/containerd/cgroups v1.1.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogoproto v1.4.11 // indirect github.com/cosmos/gorocksdb v1.2.0 // indirect @@ -84,6 +93,7 @@ require ( github.com/flynn/noise v1.1.0 // indirect github.com/francoispqt/gojay v1.2.13 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/getsentry/sentry-go v0.18.0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.5.1 // indirect @@ -133,6 +143,8 @@ require ( github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/klauspost/reedsolomon v1.11.8 // indirect github.com/koron/go-ssdp v0.0.4 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/libp2p/go-flow-metrics v0.1.0 // indirect @@ -142,6 +154,7 @@ require ( github.com/libp2p/go-netroute v0.2.1 // indirect github.com/libp2p/go-reuseport v0.4.0 // indirect github.com/libp2p/go-yamux/v4 v4.0.1 // indirect + github.com/linxGnu/grocksdb v1.8.12 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect @@ -174,7 +187,6 @@ require ( github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect github.com/pelletier/go-toml/v2 v2.0.7 // indirect github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_golang v1.18.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect @@ -186,6 +198,7 @@ require ( github.com/raulk/go-watchdog v1.3.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/regen-network/cosmos-proto v0.3.1 // indirect + github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/rollkit/celestia-openrpc v0.0.0-00010101000000-000000000000 // indirect github.com/rs/cors v1.9.0 // indirect github.com/rs/zerolog v1.29.1 // indirect @@ -193,17 +206,15 @@ require ( github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/afero v1.9.3 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.15.0 // indirect github.com/subosito/gotenv v1.4.2 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect - github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect github.com/tendermint/go-amino v0.16.0 // indirect github.com/tidwall/btree v1.5.0 // indirect github.com/ulikunitz/xz v0.5.10 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect - go.etcd.io/bbolt v1.3.6 // indirect + go.etcd.io/bbolt v1.3.8 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/otel v1.19.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect @@ -213,14 +224,14 @@ require ( go.uber.org/mock v0.4.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/crypto v0.19.0 // indirect + golang.org/x/crypto v0.22.0 // indirect golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/net v0.24.0 // indirect golang.org/x/oauth2 v0.16.0 // indirect golang.org/x/sync v0.6.0 // indirect - golang.org/x/sys v0.17.0 // indirect - golang.org/x/term v0.17.0 // indirect + golang.org/x/sys v0.19.0 // indirect + golang.org/x/term v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/tools v0.18.0 // indirect google.golang.org/api v0.149.0 // indirect @@ -231,7 +242,6 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.2.1 // indirect nhooyr.io/websocket v1.8.7 // indirect - sigs.k8s.io/yaml v1.3.0 // indirect ) replace ( diff --git a/go.sum b/go.sum index ceb263b7..7eb727d4 100644 --- a/go.sum +++ b/go.sum @@ -192,11 +192,13 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= +code.cloudfoundry.org/go-diodes v0.0.0-20220725190411-383eb6634c40 h1:wzkYwwcf4uMGcDpn48WAbq8GtoqDny49tdQ4zJVAsmo= +code.cloudfoundry.org/go-diodes v0.0.0-20220725190411-383eb6634c40/go.mod h1:Nx9ASXN4nIlRDEXv+qXE3dpuhnTnO28Lxl/bMUd6BMc= collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= -cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= -cosmossdk.io/errors v1.0.0-beta.7/go.mod h1:mz6FQMJRku4bY7aqS/Gwfcmr/ue91roMEKAmDUDpBfE= -cosmossdk.io/math v1.2.0 h1:8gudhTkkD3NxOP2YyyJIYYmt6dQ55ZfJkDOaxXpy7Ig= -cosmossdk.io/math v1.2.0/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= +cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= +cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= +cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= @@ -225,6 +227,8 @@ github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.0/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= +github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8= +github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= @@ -245,6 +249,8 @@ github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= github.com/adlio/schema v1.3.3/go.mod h1:1EsRssiv9/Ce2CMzq5DoL7RiMshhuigQxrR4DMV9fHg= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= +github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 h1:w1UutsfOrms1J05zt7ISrnJIXKzwaspym5BTKGx93EI= +github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -385,6 +391,18 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH 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/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= +github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= +github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/pebble v1.1.0 h1:pcFh8CdCIt2kmEpK0OIatq67Ln9uGDYY3d5XnE0LJG4= +github.com/cockroachdb/pebble v1.1.0/go.mod h1:sEHm5NOXxyiAoKWhoFxT8xMgd/f3RA6qUqQ1BXKrh2E= +github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= +github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/coinbase/kryptology v1.8.0/go.mod h1:RYXOAPdzOGUe3qlSFkMGn58i3xUA8hmxYHksuq+8ciI= github.com/coinbase/rosetta-sdk-go v0.7.9 h1:lqllBjMnazTjIqYrOGv8h8jxjg9+hJazIGZr9ZvoCcA= @@ -393,8 +411,8 @@ github.com/cometbft/cometbft v0.34.28 h1:gwryf55P1SWMUP4nOXpRVI2D0yPoYEzN+IBqmRB github.com/cometbft/cometbft v0.34.28/go.mod h1:L9shMfbkZ8B+7JlwANEr+NZbBcn+hBpwdbeYvA5rLCw= github.com/cometbft/cometbft v0.37.2 h1:XB0yyHGT0lwmJlFmM4+rsRnczPlHoAKFX6K8Zgc2/Jc= github.com/cometbft/cometbft v0.37.2/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs= -github.com/cometbft/cometbft-db v0.7.0 h1:uBjbrBx4QzU0zOEnU8KxoDl18dMNgDh+zZRUE0ucsbo= -github.com/cometbft/cometbft-db v0.7.0/go.mod h1:yiKJIm2WKrt6x8Cyxtq9YTEcIMPcEe4XPxhgX59Fzf0= +github.com/cometbft/cometbft-db v0.11.0 h1:M3Lscmpogx5NTbb1EGyGDaFRdsoLWrUWimFEyf7jej8= +github.com/cometbft/cometbft-db v0.11.0/go.mod h1:GDPJAC/iFHNjmZZPN8V8C1yr/eyityhi2W1hz2MGKSc= github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= github.com/consensys/bavard v0.1.8-0.20210915155054-088da2f7f54a/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= @@ -417,8 +435,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= -github.com/cosmos/cosmos-sdk v0.46.15 h1:50QSEO4ZU9QUHJ8Ul9N/o/hn/IE5dL7DwL/OY1wcoMg= -github.com/cosmos/cosmos-sdk v0.46.15/go.mod h1:9MRixWsgoJ2UmVsCRRePtENFPP3cM+gTC5azEpxgllo= +github.com/cosmos/cosmos-sdk v0.46.16 h1:RVGv1+RulLZeNyfCaPZrZtv0kY7ZZNAI6JGpub0Uh6o= +github.com/cosmos/cosmos-sdk v0.46.16/go.mod h1:05U50tAsOzQ8JOAePshJCbJQw5ib1YJR6IXcqyVI1Xg= github.com/cosmos/cosmos-sdk/ics23/go v0.8.0 h1:iKclrn3YEOwk4jQHT2ulgzuXyxmzmPczUalMwW4XH9k= github.com/cosmos/cosmos-sdk/ics23/go v0.8.0/go.mod h1:2a4dBq88TUoqoWAU5eu0lGvpFP3wWDPgdHPargtyw30= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= @@ -430,8 +448,8 @@ github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4 github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= github.com/cosmos/iavl v0.19.6 h1:XY78yEeNPrEYyNCKlqr9chrwoeSDJ0bV2VjocTk//OU= github.com/cosmos/iavl v0.19.6/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= -github.com/cosmos/ibc-go/v6 v6.1.1 h1:oqqMNyjj6SLQF8rvgCaDGwfdITEIsbhs8F77/8xvRIo= -github.com/cosmos/ibc-go/v6 v6.1.1/go.mod h1:NL17FpFAaWjRFVb1T7LUKuOoMSsATPpu+Icc4zL5/Ik= +github.com/cosmos/ibc-go/v6 v6.2.1 h1:NiaDXTRhKwf3n9kELD4VRIe5zby1yk1jBvaz9tXTQ6k= +github.com/cosmos/ibc-go/v6 v6.2.1/go.mod h1:XLsARy4Y7+GtAqzMcxNdlQf6lx+ti1e8KcMGv5NIK7A= github.com/cosmos/ledger-cosmos-go v0.12.4 h1:drvWt+GJP7Aiw550yeb3ON/zsrgW0jgh5saFCr7pDnw= github.com/cosmos/ledger-cosmos-go v0.12.4/go.mod h1:fjfVWRf++Xkygt9wzCsjEBdjcf7wiiY35fv3ctT+k4M= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= @@ -459,6 +477,8 @@ github.com/decred/base58 v1.0.4/go.mod h1:jJswKPEdvpFpvf7dsDvFZyLT22xZ9lWqEByX38 github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= +github.com/decred/dcrd/dcrec/edwards v1.0.0 h1:UDcPNzclKiJlWqV3x1Fl8xMCJrolo4PB4X9t8LwKDWU= +github.com/decred/dcrd/dcrec/edwards v1.0.0/go.mod h1:HblVh1OfMt7xSxUL1ufjToaEvpbjpWvvTAUx4yem8BI= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= @@ -498,14 +518,14 @@ github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac h1:opbrjaN/L8 github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM= github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= -github.com/dymensionxyz/cosmosclient v0.4.2-beta h1:sokBefcN1tIOlUKmB8Q2E9XMJ93LueqtFThiM/kA4DI= -github.com/dymensionxyz/cosmosclient v0.4.2-beta/go.mod h1:GQQu3ITEjWfi5ULR2B6X2i2YZNennY1yzcT5qdL4MGI= -github.com/dymensionxyz/dymension/v3 v3.0.0-rc02.0.20240304125623-d447bab68709 h1:97pOWOKbFtyMOASZ6mqanqXmlBRzg/eIFa5SkBhewFc= -github.com/dymensionxyz/dymension/v3 v3.0.0-rc02.0.20240304125623-d447bab68709/go.mod h1:4PY6Y8pSTRrTmwVue9avSm3hzCOrOcCNQFz79cdgg8s= -github.com/dymensionxyz/dymint v1.0.1-alpha h1:WrSl6WnYm/zTxQkh35WcxuREozB6dAFz8q5jjd4/h38= -github.com/dymensionxyz/dymint v1.0.1-alpha/go.mod h1:t35R4+GZ+jgDx3wr+xXEo4to38T27jLOXGm/d599Sss= -github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.3 h1:vmAdUGUc4rTIiO3Phezr7vGq+0uPDVKSA4WAe8+yl6w= -github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.3/go.mod h1:LfPv2O1HXMgETpka81Pg3nXy+U/7urq8dn85ZnSXK5Y= +github.com/dymensionxyz/cosmosclient v0.4.2-beta.0.20240421130646-b8980ec7aade h1:LHbwDuI4hPNGSA+gWQz4ev0xt8p+ztPLEcZWR7e5YzA= +github.com/dymensionxyz/cosmosclient v0.4.2-beta.0.20240421130646-b8980ec7aade/go.mod h1:UxhLdtWOWg7l6+5Hpkm39Khd23wcr5H62YxM04rMbh8= +github.com/dymensionxyz/dymension/v3 v3.1.0-rc03.0.20240411195658-f7cd96f53b56 h1:cmpJYdRviuUfmlJdHrcAND8Jd6JIY4rp63bWAQzPr54= +github.com/dymensionxyz/dymension/v3 v3.1.0-rc03.0.20240411195658-f7cd96f53b56/go.mod h1:3Pfrr8j/BR9ztNKztGfC5PqDiO6CcrzMLCJtFtPEVW4= +github.com/dymensionxyz/dymint v1.1.0-rc01 h1:kiN+HSXOMi7V3cVOPvjrWTRIS0kyKJnooJ1T8v/2umk= +github.com/dymensionxyz/dymint v1.1.0-rc01/go.mod h1:QSXwtiNaxGQLguAsDMubrr18fY4ss72sEBVOu+nVLj8= +github.com/dymensionxyz/rpc v1.3.1 h1:7EXWIobaBes5zldRvTIg7TmNsEKjicrWA/OjCc0NaGs= +github.com/dymensionxyz/rpc v1.3.1/go.mod h1:f+WpX8ysy8wt95iGc6auYlHcnHj2bUkhiRVkkKNys8c= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= @@ -526,8 +546,10 @@ github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go. github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ethereum/go-ethereum v1.10.17/go.mod h1:Lt5WzjM07XlXc95YzrhosmR4J9Ahd6X2wyEV2SvGhk0= -github.com/ethereum/go-ethereum v1.12.0 h1:bdnhLPtqETd4m3mS8BGMNvBTf36bO5bx/hxE2zljOa0= -github.com/ethereum/go-ethereum v1.12.0/go.mod h1:/oo2X/dZLJjf2mJ6YT9wcWxa4nNJDBKDBU6sFIpx1Gs= +github.com/ethereum/go-ethereum v1.10.26 h1:i/7d9RBBwiXCEuyduBQzJw/mKmnvzsN14jqBmytw72s= +github.com/ethereum/go-ethereum v1.10.26/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= +github.com/evmos/ethermint v0.22.0 h1:ebJbC3Il+IbEbiGSBKUOv5lshJOibgTTgV2tNkJeo20= +github.com/evmos/ethermint v0.22.0/go.mod h1:6ne20tWhba7JnkdOUZZSCSL8wbb3KSaSP+YHFOPvllI= github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= @@ -560,18 +582,22 @@ github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbS github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= +github.com/getsentry/sentry-go v0.18.0 h1:MtBW5H9QgdcJabtZcuJG80BMOwaBpkRDZkxRkNC1sN0= +github.com/getsentry/sentry-go v0.18.0/go.mod h1:Kgon4Mby+FJ7ZWHFUAZgVaIa8sxHtnRJRLTXZr51aKQ= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= -github.com/gin-gonic/gin v1.7.0 h1:jGB9xAJQ12AIGNB4HguylppmDK1Am9ppF7XnGXXJuoU= -github.com/gin-gonic/gin v1.7.0/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= +github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= +github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= +github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= +github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -596,12 +622,15 @@ github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dT github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= +github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY= +github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= +github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= +github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= +github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= @@ -619,6 +648,8 @@ github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6Wezm github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/gobwas/ws v1.2.1 h1:F2aeBZrm2NDsc7vbovKrWSogd4wvfAxg0FQ89/iqOTk= github.com/gobwas/ws v1.2.1/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY= +github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= +github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -849,8 +880,6 @@ github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 h1:aSV github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3/go.mod h1:5PC6ZNPde8bBqU/ewGZig35+UIZtw9Ytxez8/q5ZyFE= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= -github.com/holiman/uint256 v1.2.2 h1:TXKcSGc2WaxPD2+bmzAsVthL4+pEN0YwXcL5qED83vk= -github.com/holiman/uint256 v1.2.2/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/huin/goupnp v1.0.3-0.20220313090229-ca81a64b4204/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= @@ -882,8 +911,16 @@ github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= github.com/ipfs/go-datastore v0.6.0 h1:JKyz+Gvz1QEZw0LsX1IBn+JFCJQH4SJVFtM4uWU0Myk= github.com/ipfs/go-datastore v0.6.0/go.mod h1:rt5M3nNbSO/8q1t4LNkLyUwRs8HupMeN/8O4Vn9YAT8= +github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2POp8= +github.com/ipfs/go-ipfs-util v0.0.2/go.mod h1:CbPtkWJzjLdEcezDns2XYaehFVNXG9zrdrtMecczcsQ= +github.com/ipfs/go-ipns v0.2.0 h1:BgmNtQhqOw5XEZ8RAfWEpK4DhqaYiuP6h71MhIp7xXU= +github.com/ipfs/go-ipns v0.2.0/go.mod h1:3cLT2rbvgPZGkHJoPO1YMJeh6LtkxopCkKFcio/wE24= +github.com/ipfs/go-log v1.0.5 h1:2dOuUCB1Z7uoczMWgAyDck5JLb72zHzrMnGnCNNbvY8= +github.com/ipfs/go-log v1.0.5/go.mod h1:j0b8ZoR+7+R99LD9jZ6+AJsrzkPbSXbZfGakb5JPtIo= github.com/ipfs/go-log/v2 v2.5.1 h1:1XdUzF7048prq4aBjDQQ4SL5RxftpRGdXhNRwKSAlcY= github.com/ipfs/go-log/v2 v2.5.1/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI= +github.com/ipld/go-ipld-prime v0.9.0 h1:N2OjJMb+fhyFPwPnVvJcWU/NsumP8etal+d2v3G4eww= +github.com/ipld/go-ipld-prime v0.9.0/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jbenet/go-temp-err-catcher v0.1.0 h1:zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABoLk/+KKHggpk= @@ -958,21 +995,30 @@ github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+ github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= -github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= +github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= +github.com/libp2p/go-cidranger v1.1.0 h1:ewPN8EZ0dd1LSnrtuwd4709PXVcITVeuwbag38yPW7c= +github.com/libp2p/go-cidranger v1.1.0/go.mod h1:KWZTfSr+r9qEo9OkI9/SIEeAtw+NNoU0dXIXt15Okic= github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= github.com/libp2p/go-libp2p v0.33.1 h1:tvJl9b9M6nSLBtZSXSguq+/lRhRj2oLRkyhBmQNMFLA= github.com/libp2p/go-libp2p v0.33.1/go.mod h1:zOUTMjG4I7TXwMndNyOBn/CNtVBLlvBlnxfi+8xzx+E= github.com/libp2p/go-libp2p-asn-util v0.4.1 h1:xqL7++IKD9TBFMgnLPZR6/6iYhawHKHl950SO9L6n94= github.com/libp2p/go-libp2p-asn-util v0.4.1/go.mod h1:d/NI6XZ9qxw67b4e+NgpQexCIiFYJjErASrYW4PFDN8= +github.com/libp2p/go-libp2p-kad-dht v0.21.1 h1:xpfp8/t9+X2ip1l8Umap1/UGNnJ3RHJgKGAEsnRAlTo= +github.com/libp2p/go-libp2p-kad-dht v0.21.1/go.mod h1:Oy8wvbdjpB70eS5AaFaI68tOtrdo3KylTvXDjikxqFo= +github.com/libp2p/go-libp2p-kbucket v0.5.0 h1:g/7tVm8ACHDxH29BGrpsQlnNeu+6OF1A9bno/4/U1oA= +github.com/libp2p/go-libp2p-kbucket v0.5.0/go.mod h1:zGzGCpQd78b5BNTDGHNDLaTt9aDK/A02xeZp9QeFC4U= github.com/libp2p/go-libp2p-pubsub v0.9.3 h1:ihcz9oIBMaCK9kcx+yHWm3mLAFBMAUsM4ux42aikDxo= github.com/libp2p/go-libp2p-pubsub v0.9.3/go.mod h1:RYA7aM9jIic5VV47WXu4GkcRxRhrdElWf8xtyli+Dzc= +github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0= +github.com/libp2p/go-libp2p-record v0.2.0/go.mod h1:I+3zMkvvg5m2OcSdoL0KPljyJyvNDFGKX7QdlpYUcwk= github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA= github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg= github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0= @@ -987,6 +1033,8 @@ github.com/libp2p/go-yamux/v4 v4.0.1 h1:FfDR4S1wj6Bw2Pqbc8Uz7pCxeRBPbwsBbEdfwiCy github.com/libp2p/go-yamux/v4 v4.0.1/go.mod h1:NWjl8ZTLOGlozrXSOZ/HlfG++39iKNnM5wwmtQP1YB4= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/linxGnu/grocksdb v1.8.12 h1:1/pCztQUOa3BX/1gR3jSZDoaKFpeHFvQ1XrqZpSvZVo= +github.com/linxGnu/grocksdb v1.8.12/go.mod h1:xZCIb5Muw+nhbDK4Y5UJuOrin5MceOuiXkVUR7vp4WY= github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4= github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= @@ -1153,6 +1201,8 @@ github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKw github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= @@ -1183,6 +1233,9 @@ github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0 github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/xxHash v0.1.5 h1:n/jBpwTHiER4xYvK3/CdPVnLDPchj8eTJFFLUb4QHBo= github.com/pierrec/xxHash v0.1.5/go.mod h1:w2waW5Zoa/Wc4Yqe0wgrIYAGKqRMf7czn2HNKXmuL+I= +github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -1192,6 +1245,8 @@ github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qR github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e h1:ZOcivgkkFRnjfoTcGsDq3UQYiBmekwLA+qg0OjyB/ls= +github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -1253,6 +1308,7 @@ github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRr 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= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= @@ -1358,8 +1414,6 @@ github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNG github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= github.com/tendermint/tm-db v0.6.8-0.20220506192307-f628bb5dc95b h1:Y3ZPG6gdDCAV2sdGkD759ji/09GzaNu1X3qKTmZIbTo= @@ -1392,8 +1446,9 @@ github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3C github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= +github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8= github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= @@ -1409,6 +1464,8 @@ github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49u github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= +github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k= +github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= @@ -1430,8 +1487,8 @@ gitlab.com/NebulousLabs/errors v0.0.0-20200929122200-06c536cf6975/go.mod h1:ZkMZ gitlab.com/NebulousLabs/fastrand v0.0.0-20181126182046-603482d69e40 h1:dizWJqTWjwyD8KGcMOwgrkqu1JIkofYgKkmDeNE7oAs= gitlab.com/NebulousLabs/fastrand v0.0.0-20181126182046-603482d69e40/go.mod h1:rOnSnoRyxMI3fe/7KIbVcsHRGxe30OONv8dEgo+vCfA= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= -go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= +go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= +go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -1511,8 +1568,8 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1627,8 +1684,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1734,7 +1791,6 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1791,14 +1847,14 @@ golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= -golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= +golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -2213,8 +2269,8 @@ rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= -sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= -sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= diff --git a/proto/denommetadata/genesis.proto b/proto/denommetadata/genesis.proto index 9d40bac0..32128e9c 100644 --- a/proto/denommetadata/genesis.proto +++ b/proto/denommetadata/genesis.proto @@ -1,13 +1,7 @@ syntax = "proto3"; package rollapp.denommetadata.types; -import "gogoproto/gogo.proto"; -import "denommetadata/params.proto"; - option go_package = "github.com/dymensionxyz/dymension-rdk/x/denommetadata/types"; // GenesisState defines the test module's genesis state. -message GenesisState { - // params are all parameters for the module - Params params = 1 [ (gogoproto.nullable) = false ]; -} +message GenesisState {} diff --git a/proto/denommetadata/params.proto b/proto/denommetadata/params.proto deleted file mode 100644 index e3d3b50b..00000000 --- a/proto/denommetadata/params.proto +++ /dev/null @@ -1,13 +0,0 @@ -syntax = "proto3"; -package rollapp.denommetadata.types; -import "gogoproto/gogo.proto"; - -option go_package = "github.com/dymensionxyz/dymension-rdk/x/denommetadata/types"; - -// Params defines the parameters for the module. -message Params { - // allowed_addresses defines the list of addresses authorized to use the - // module - repeated string allowed_addresses = 1 - [ (gogoproto.moretags) = "yaml:\"allowed_addresses\"" ]; -} diff --git a/proto/denommetadata/query.proto b/proto/denommetadata/query.proto index fa6619d8..1228079e 100644 --- a/proto/denommetadata/query.proto +++ b/proto/denommetadata/query.proto @@ -1,19 +1,12 @@ syntax = "proto3"; package rollapp.denommetadata.types; -import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -import "denommetadata/params.proto"; option go_package = "github.com/dymensionxyz/dymension-rdk/x/denommetadata/types"; // Query defines the gRPC querier service. service Query { - // Parameters retrieves the denom metadata module params - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = - "/dymensionxyz/dymension-rdk/denommetadata/params"; - } // Queries an IBC denom base on denom trace rpc IBCDenomByDenomTrace(QueryGetIBCDenomByDenomTraceRequest) returns (QueryIBCDenomByDenomTraceResponse) { @@ -22,15 +15,6 @@ service Query { } } -// QueryParamsRequest is request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is response type for the Query/Params RPC method. -message QueryParamsResponse { - // params holds all the parameters of this module. - Params params = 1 [ (gogoproto.nullable) = false ]; -} - // QueryGetIBCDenomByDenomTraceRequest is the request type for the // Query/IBCDenomByDenomTrace RPC method. message QueryGetIBCDenomByDenomTraceRequest { diff --git a/proto/hub-genesis/genesis.proto b/proto/hub-genesis/genesis.proto old mode 100755 new mode 100644 index 3e226f34..12a64a74 --- a/proto/hub-genesis/genesis.proto +++ b/proto/hub-genesis/genesis.proto @@ -2,14 +2,9 @@ syntax = "proto3"; package rollapp.hub_genesis; import "gogoproto/gogo.proto"; -import "hub-genesis/params.proto"; import "hub-genesis/state.proto"; option go_package = "github.com/dymensionxyz/dymension-rdk/x/hub-genesis/types"; // GenesisState defines the hub-genesis module's genesis state. -message GenesisState { - // params defines all the parameters of the module. - Params params = 1 [ (gogoproto.nullable) = false ]; - State state = 2 [(gogoproto.nullable) = false]; -} +message GenesisState { State state = 1 [ (gogoproto.nullable) = false ]; } diff --git a/proto/hub-genesis/params.proto b/proto/hub-genesis/params.proto deleted file mode 100644 index 6e3aada0..00000000 --- a/proto/hub-genesis/params.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto3"; -package rollapp.hub_genesis; - -option go_package = "github.com/dymensionxyz/dymension-rdk/x/hub-genesis/types"; - -import "gogoproto/gogo.proto"; - -// Params holds parameters for the hub-genesis module. -message Params { - option (gogoproto.goproto_stringer) = false; - - // genesis_triggerer_allowlist is a list of the - // accounts that are allowed to trigger a genesis event on the rollapp. - // In the case of an empty list, there are no restrictions - repeated GenesisTriggererParams genesis_triggerer_allowlist = 1 [ - (gogoproto.moretags) = "yaml:\"genesis_triggerer_allowlist\"", - (gogoproto.nullable) = false - ]; -} - -message GenesisTriggererParams { - // address is a bech32-encoded address of the - // accounts that are allowed to trigger a rollapp genesis event. - string address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; -} diff --git a/proto/hub-genesis/query.proto b/proto/hub-genesis/query.proto index 35b30535..caf7bbc0 100644 --- a/proto/hub-genesis/query.proto +++ b/proto/hub-genesis/query.proto @@ -3,40 +3,24 @@ package rollapp.hub_genesis; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -import "hub-genesis/params.proto"; import "hub-genesis/state.proto"; option go_package = "github.com/dymensionxyz/dymension-rdk/x/hub-genesis/types"; // Query provides defines the gRPC querier service. service Query { - // Params returns the total set of hub-genesis parameters. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = - "/dymensionxyz/dymension-rdk/hub-genesis/params"; - } - - // State returns the state of the genesis event. - rpc State(QueryStateRequest) returns (QueryStateResponse) { + // State returns the state of the genesis event. + rpc State(QueryStateRequest) returns (QueryStateResponse) { option (google.api.http).get = "/dymensionxyz/dymension-rdk/hub-genesis/state"; } } -// QueryParamsRequest is the request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is the response type for the Query/Params RPC method. -message QueryParamsResponse { - // params defines the parameters of the module. - Params params = 1 [ (gogoproto.nullable) = false ]; -} - // QueryStateRequest is the request type for the Query/State RPC method. message QueryStateRequest {} // QueryStateResponse is the response type for the Query/State RPC method. message QueryStateResponse { // state holds the state of the genesis event - State state = 1 [(gogoproto.nullable) = false]; + State state = 1 [ (gogoproto.nullable) = false ]; } \ No newline at end of file diff --git a/proto/hub-genesis/state.proto b/proto/hub-genesis/state.proto index 5d80f756..30ed0f57 100644 --- a/proto/hub-genesis/state.proto +++ b/proto/hub-genesis/state.proto @@ -8,13 +8,13 @@ option go_package = "github.com/dymensionxyz/dymension-rdk/x/hub-genesis/types"; // State holds the state of the genesis event message State { - // is_locked is a boolean that indicates if the genesis event has occured - bool is_locked = 1; - - // genesis_tokens is the list of tokens that are expected to be locked on genesis event - repeated cosmos.base.v1beta1.Coin genesis_tokens = 2 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; + // is_locked is a boolean that indicates if the genesis event has occured + bool is_locked = 1; + // genesis_tokens is the list of tokens that are expected to be locked on + // genesis event + repeated cosmos.base.v1beta1.Coin genesis_tokens = 2 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; } diff --git a/proto/sequencers/genesis.proto b/proto/sequencers/genesis.proto index e1d888ab..002412be 100644 --- a/proto/sequencers/genesis.proto +++ b/proto/sequencers/genesis.proto @@ -3,6 +3,7 @@ package rollapp.sequencers.types; import "gogoproto/gogo.proto"; import "sequencers/params.proto"; +import "sequencers/permission.proto"; // this line is used by starport scaffolding # genesis/proto/import @@ -12,7 +13,14 @@ option go_package = "github.com/dymensionxyz/dymension-rdk/x/sequencers/types"; message GenesisState { Params params = 1 [ (gogoproto.nullable) = false ]; + // the address and its permissions to trigger some special actions + // on the rollapp + repeated AddressPermissions address_permissions = 2 [ + (gogoproto.moretags) = "yaml:\"address_permissions\"", + (gogoproto.nullable) = false + ]; + // genesis_operator_address defines the genesis operator address of the // sequencer. - string genesis_operator_address = 2; -} \ No newline at end of file + string genesis_operator_address = 3; +} diff --git a/proto/sequencers/gov_permission.proto b/proto/sequencers/gov_permission.proto new file mode 100644 index 00000000..310478e8 --- /dev/null +++ b/proto/sequencers/gov_permission.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; +package rollapp.sequencers.types; + +import "gogoproto/gogo.proto"; +import "sequencers/permission.proto"; + +option go_package = "github.com/dymensionxyz/dymension-rdk/x/sequencers/types"; + +message GrantPermissionsProposal { + option (gogoproto.equal) = true; + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + string title = 1; + string description = 2; + + repeated AddressPermissions address_permissions = 3 + [ (gogoproto.nullable) = false ]; +} + +message RevokePermissionsProposal { + option (gogoproto.equal) = true; + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + string title = 1; + string description = 2; + + repeated AddressPermissions address_permissions = 3 + [ (gogoproto.nullable) = false ]; +} \ No newline at end of file diff --git a/proto/sequencers/permission.proto b/proto/sequencers/permission.proto new file mode 100644 index 00000000..6491d179 --- /dev/null +++ b/proto/sequencers/permission.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; +package rollapp.sequencers.types; + +import "gogoproto/gogo.proto"; + +// this line is used by starport scaffolding # genesis/proto/import + +option go_package = "github.com/dymensionxyz/dymension-rdk/x/sequencers/types"; + +message AddressPermissions { + option (gogoproto.equal) = true; + + string address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; + // list of the module name that addresses have permission to execute msg + PermissionList permission_list = 2 [ + (gogoproto.moretags) = "yaml:\"permission_list\"", + (gogoproto.nullable) = false + ]; +} + +message PermissionList { + option (gogoproto.equal) = true; + + repeated string permissions = 1 + [ (gogoproto.moretags) = "yaml:\"permissions\"" ]; +} \ No newline at end of file diff --git a/proto/sequencers/query.proto b/proto/sequencers/query.proto index ee751b58..81b74c4c 100644 --- a/proto/sequencers/query.proto +++ b/proto/sequencers/query.proto @@ -32,6 +32,12 @@ service Query { "/dymensionxyz/dymension-rdk/sequencers/historical_info/{height}"; } + // Permissions queries the permissions for given address. + rpc Permissions(QueryPermissionsRequest) returns (QueryPermissionsResponse) { + option (google.api.http).get = + "/dymensionxyz/dymension-rdk/sequencers/permissions/{address}"; + } + // Parameters queries the staking parameters. rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/cosmos/staking/v1beta1/params"; @@ -84,6 +90,20 @@ message QueryHistoricalInfoResponse { cosmos.staking.v1beta1.HistoricalInfo hist = 1; } +// QueryPermissionsRequest is request type for the Query/Permissions RPC +// method. +message QueryPermissionsRequest { + // address defines the address to query for. + string address = 1; +} + +// QueryPermissionsResponse is response type for the Query/Permissions RPC +// method. +message QueryPermissionsResponse { + // permissions defines the permissions for the given address. + string permissions = 1; +} + // QueryParamsRequest is request type for the Query/Params RPC method. message QueryParamsRequest {} diff --git a/testutil/app/app.go b/testutil/app/app.go index f99ca0af..3b51a8fb 100644 --- a/testutil/app/app.go +++ b/testutil/app/app.go @@ -38,7 +38,6 @@ import ( authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" "github.com/cosmos/cosmos-sdk/x/auth/posthandler" authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" - "github.com/cosmos/cosmos-sdk/x/auth/tx" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/auth/vesting" @@ -379,6 +378,7 @@ func NewRollapp( AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)). AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). + AddRoute(seqtypes.RouterKey, sequencers.NewUpdatePermissionProposalHandler(&app.SequencersKeeper)). AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)) govConfig := govtypes.DefaultConfig() @@ -414,10 +414,10 @@ func NewRollapp( app.DenommetadataKeeper = denommetadatakeeper.NewKeeper( appCodec, keys[denommetadatatypes.StoreKey], + app.SequencersKeeper, app.BankKeeper, app.TransferKeeper, nil, - app.GetSubspace(denommetadatatypes.ModuleName), ) // set hook for denom metadata keeper later app.DenommetadataKeeper.SetHooks( @@ -429,8 +429,8 @@ func NewRollapp( app.HubGenesisKeeper = hubgenkeeper.NewKeeper( appCodec, keys[hubgentypes.StoreKey], - app.GetSubspace(hubgentypes.ModuleName), app.IBCKeeper.ChannelKeeper, + app.SequencersKeeper, app.BankKeeper, app.AccountKeeper, ) @@ -843,13 +843,11 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(stakingtypes.ModuleName) paramsKeeper.Subspace(seqtypes.ModuleName) paramsKeeper.Subspace(minttypes.ModuleName) - paramsKeeper.Subspace(denommetadatatypes.ModuleName) paramsKeeper.Subspace(epochstypes.ModuleName) paramsKeeper.Subspace(distrtypes.ModuleName) paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable()) paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(ibchost.ModuleName) - paramsKeeper.Subspace(hubgentypes.ModuleName) return paramsKeeper } @@ -866,7 +864,7 @@ func MakeEncodingConfig() EncodingConfig { amino := codec.NewLegacyAmino() interfaceRegistry := types.NewInterfaceRegistry() codec := codec.NewProtoCodec(interfaceRegistry) - txCfg := tx.NewTxConfig(codec, tx.DefaultSignModes) + txCfg := authtx.NewTxConfig(codec, authtx.DefaultSignModes) encodingConfig := EncodingConfig{ InterfaceRegistry: interfaceRegistry, diff --git a/x/denommetadata/client/cli/query.go b/x/denommetadata/client/cli/query.go index 7eb4cb3f..f1c9d96e 100644 --- a/x/denommetadata/client/cli/query.go +++ b/x/denommetadata/client/cli/query.go @@ -23,42 +23,12 @@ func GetQueryCmd() *cobra.Command { } denommetadataQueryCmd.AddCommand( - GetCmdQueryParams(), GetCmdIBCDenomBaseOnDenomTrace(), ) return denommetadataQueryCmd } -// GetCmdQueryParams implements a command to return the current parameters. -func GetCmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "Query the current denom metadata module parameters", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, _ []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryParamsRequest{} - - res, err := queryClient.Params(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(&res.Params) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - // GetCmdIBCDenomBaseOnDenomTrace implements a command to return the IBC denom base on a denom trace. func GetCmdIBCDenomBaseOnDenomTrace() *cobra.Command { cmd := &cobra.Command{ diff --git a/x/denommetadata/client/cli/test-proposals/create_multiple_denom_metadatas_proposal_test.json b/x/denommetadata/client/cli/test-proposals/create_multiple_denom_metadatas_proposal_test.json index f5313972..77a86db2 100644 --- a/x/denommetadata/client/cli/test-proposals/create_multiple_denom_metadatas_proposal_test.json +++ b/x/denommetadata/client/cli/test-proposals/create_multiple_denom_metadatas_proposal_test.json @@ -17,7 +17,7 @@ "name": "DYM", "symbol": "DYM" }, - "denom_trace": "transfer/channel-0/dym" + "denom_trace": "transfer/channel-0/adym" }, { "token_metadata": { diff --git a/x/denommetadata/genesis.go b/x/denommetadata/genesis.go index 1f38810d..c651c85d 100644 --- a/x/denommetadata/genesis.go +++ b/x/denommetadata/genesis.go @@ -9,27 +9,10 @@ import ( // DefaultGenesis returns the default Capability genesis state func DefaultGenesis() *types.GenesisState { - return &types.GenesisState{ - Params: types.DefaultParams(), - } -} - -// InitGenesis import module genesis -func InitGenesis( - ctx sdk.Context, - k keeper.Keeper, - data types.GenesisState, -) { - k.SetParams(ctx, data.Params) + return &types.GenesisState{} } // ExportGenesis export module state func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - return &types.GenesisState{ - Params: k.GetParams(ctx), - } -} - -func ValidateGenesis(gs types.GenesisState) error { - return gs.Params.Validate() + return &types.GenesisState{} } diff --git a/x/denommetadata/keeper/grpc_query.go b/x/denommetadata/keeper/grpc_query.go index 2deb1d61..5926588c 100644 --- a/x/denommetadata/keeper/grpc_query.go +++ b/x/denommetadata/keeper/grpc_query.go @@ -4,7 +4,6 @@ import ( "context" "strings" - sdk "github.com/cosmos/cosmos-sdk/types" transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" "google.golang.org/grpc/codes" @@ -25,16 +24,6 @@ func NewQuerier(k Keeper) Querier { return Querier{Keeper: k} } -// Params returns denommetadata module params -func (q Querier) Params( - c context.Context, - _ *types.QueryParamsRequest, -) (*types.QueryParamsResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - params := q.GetParams(ctx) - return &types.QueryParamsResponse{Params: params}, nil -} - // IBCDenomByDenomTrace returns IBC denom base on denom trace func (q Querier) IBCDenomByDenomTrace( _ context.Context, diff --git a/x/denommetadata/keeper/grpc_query_test.go b/x/denommetadata/keeper/grpc_query_test.go deleted file mode 100644 index 90134dfb..00000000 --- a/x/denommetadata/keeper/grpc_query_test.go +++ /dev/null @@ -1,23 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/dymensionxyz/dymension-rdk/x/denommetadata/keeper" - "github.com/dymensionxyz/dymension-rdk/x/denommetadata/testutils" - "github.com/dymensionxyz/dymension-rdk/x/denommetadata/types" - "github.com/stretchr/testify/require" -) - -func TestParamsQuery(t *testing.T) { - app, ctx := testutils.NewTestDenommetadataKeeper(t) - - q := keeper.Querier{Keeper: app.DenommetadataKeeper} - - wctx := sdk.WrapSDKContext(ctx) - - response, err := q.Params(wctx, &types.QueryParamsRequest{}) - require.NoError(t, err) - require.Equal(t, &types.QueryParamsResponse{Params: types.DefaultParams()}, response) -} diff --git a/x/denommetadata/keeper/keeper.go b/x/denommetadata/keeper/keeper.go index 45695242..a3506de3 100644 --- a/x/denommetadata/keeper/keeper.go +++ b/x/denommetadata/keeper/keeper.go @@ -3,67 +3,38 @@ package keeper import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/dymensionxyz/dymension-rdk/x/denommetadata/types" ) // Keeper of this module maintains distributing tokens to all stakers. type Keeper struct { - storeKey storetypes.StoreKey - cdc codec.BinaryCodec - paramSpace paramtypes.Subspace + storeKey storetypes.StoreKey + cdc codec.BinaryCodec - bankKeeper types.BankKeeper - transferKeeper types.TransferKeeper - hooks types.MultiDenomMetadataHooks + sequencerKeeper types.SequencerKeeper + bankKeeper types.BankKeeper + transferKeeper types.TransferKeeper + hooks types.MultiDenomMetadataHooks } // NewKeeper creates new instances of the Keeper func NewKeeper( cdc codec.BinaryCodec, storeKey storetypes.StoreKey, + sk types.SequencerKeeper, bk types.BankKeeper, tk types.TransferKeeper, hooks types.MultiDenomMetadataHooks, - paramSpace paramtypes.Subspace, ) Keeper { - // set KeyTable if it has not already been set - if !paramSpace.HasKeyTable() { - paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) - } - return Keeper{ - storeKey: storeKey, - cdc: cdc, - paramSpace: paramSpace, - bankKeeper: bk, - transferKeeper: tk, - hooks: hooks, - } -} - -// GetParams returns the total set of denommetadata parameters. -func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { - k.paramSpace.GetParamSet(ctx, ¶ms) - return -} - -// SetParams sets the total set of denommetadata parameters. -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramSpace.SetParamSet(ctx, ¶ms) -} - -// IsAddressPermissioned checks if the given address is permissioned to create or update denom metadata -func (k Keeper) IsAddressPermissioned(ctx sdk.Context, address string) bool { - params := k.GetParams(ctx) - for _, PermissionedAddress := range params.AllowedAddresses { - if PermissionedAddress == address { - return true - } + storeKey: storeKey, + cdc: cdc, + sequencerKeeper: sk, + bankKeeper: bk, + transferKeeper: tk, + hooks: hooks, } - return false } // SetHooks set the denommetadata hooks diff --git a/x/denommetadata/keeper/keeper_test.go b/x/denommetadata/keeper/keeper_test.go deleted file mode 100644 index 2563903b..00000000 --- a/x/denommetadata/keeper/keeper_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/dymensionxyz/dymension-rdk/x/denommetadata/testutils" - "github.com/dymensionxyz/dymension-rdk/x/denommetadata/types" - "github.com/stretchr/testify/require" -) - -func TestParams(t *testing.T) { - // Setup the test environment - app, ctx := testutils.NewTestDenommetadataKeeper(t) // Assume you have a similar utility function for denommetadata keeper - k := app.DenommetadataKeeper - - // Set some initial parameters - initialParams := types.DefaultParams() - initialParams.AllowedAddresses = []string{"cosmos19crd4fwzm9qtf5ln5l3e2vmquhevjwprk8tgxp", "cosmos1gusne8eh37myphx09hgdsy85zpl2t0kzdvu3en"} // Example addresses - k.SetParams(ctx, initialParams) - - // Retrieve the parameters - retrievedParams := k.GetParams(ctx) - - // Assert that the retrieved parameters match the initial ones - require.Equal(t, initialParams, retrievedParams, "retrieved parameters should match the initial ones") - - // Test setting and getting a different set of parameters - updatedParams := initialParams - updatedParams.AllowedAddresses = append(updatedParams.AllowedAddresses, "cosmos1s77x8wr2gzdhq8gt8c085vate0s23xu9u80wtx") - k.SetParams(ctx, updatedParams) - retrievedParams = k.GetParams(ctx) - require.Equal(t, updatedParams, retrievedParams, "retrieved parameters should match the updated ones") -} diff --git a/x/denommetadata/keeper/msg_server.go b/x/denommetadata/keeper/msg_server.go index 85dc1e33..2012ccc4 100644 --- a/x/denommetadata/keeper/msg_server.go +++ b/x/denommetadata/keeper/msg_server.go @@ -33,7 +33,12 @@ func (k msgServer) CreateDenomMetadata( return nil, err } - if !k.IsAddressPermissioned(ctx, msg.SenderAddress) { + accAddr, err := sdk.AccAddressFromBech32(msg.SenderAddress) + if err != nil { + return nil, err + } + + if !k.sequencerKeeper.HasPermission(ctx, accAddr, types.ModuleName) { return nil, types.ErrNoPermission } @@ -72,7 +77,12 @@ func (k msgServer) UpdateDenomMetadata( return nil, err } - if !k.IsAddressPermissioned(ctx, msg.SenderAddress) { + accAddr, err := sdk.AccAddressFromBech32(msg.SenderAddress) + if err != nil { + return nil, err + } + + if !k.sequencerKeeper.HasPermission(ctx, accAddr, types.ModuleName) { return nil, types.ErrNoPermission } diff --git a/x/denommetadata/keeper/msg_server_test.go b/x/denommetadata/keeper/msg_server_test.go index 8c131af7..671c305e 100644 --- a/x/denommetadata/keeper/msg_server_test.go +++ b/x/denommetadata/keeper/msg_server_test.go @@ -5,14 +5,16 @@ import ( "sync" "testing" + "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/dymensionxyz/dymension-rdk/testutil/app" "github.com/dymensionxyz/dymension-rdk/x/denommetadata/keeper" "github.com/dymensionxyz/dymension-rdk/x/denommetadata/testutils" - "github.com/stretchr/testify/suite" - - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/dymensionxyz/dymension-rdk/x/denommetadata/types" + sequencerstypes "github.com/dymensionxyz/dymension-rdk/x/sequencers/types" ) type DenomMetadataMsgServerTestSuite struct { @@ -34,9 +36,8 @@ func (suite *DenomMetadataMsgServerTestSuite) setupTest(hooks types.DenomMetadat suite.k.SetHooks(types.NewMultiDenommetadataHooks(hooks)) suite.msgServer = keeper.NewMsgServerImpl(suite.k) // Set allowed addresses - initialParams := types.DefaultParams() - initialParams.AllowedAddresses = []string{senderAddress} - suite.k.SetParams(suite.ctx, initialParams) + senderAccAddr := sdk.MustAccAddressFromBech32(senderAddress) + suite.app.SequencersKeeper.GrantPermissions(suite.ctx, senderAccAddr, sequencerstypes.NewPermissionsList([]string{types.ModuleName})) } const ( @@ -92,9 +93,8 @@ func (suite *DenomMetadataMsgServerTestSuite) TestCreateDenomMetadata() { }, }, malleate: func() { - initialParams := types.DefaultParams() - initialParams.AllowedAddresses = []string{} - suite.k.SetParams(suite.ctx, initialParams) + senderAccAddr := sdk.MustAccAddressFromBech32(senderAddress) + suite.app.SequencersKeeper.RevokeAllPermissions(suite.ctx, senderAccAddr) }, hooks: &mockERC20Hook{}, expectHookCalled: false, diff --git a/x/denommetadata/module.go b/x/denommetadata/module.go index 32ba848f..34afd91a 100644 --- a/x/denommetadata/module.go +++ b/x/denommetadata/module.go @@ -56,7 +56,7 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod if err := cdc.UnmarshalJSON(bz, &genState); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) } - return ValidateGenesis(genState) + return nil } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. @@ -130,10 +130,6 @@ func (am AppModule) RegisterInvariants(sdk.InvariantRegistry) {} // InitGenesis performs the capability module's genesis initialization It returns // no validator updates. func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - // Initialize global index to index in genesis state - var genState types.GenesisState - cdc.MustUnmarshalJSON(gs, &genState) - InitGenesis(ctx, am.keeper, genState) return []abci.ValidatorUpdate{} } diff --git a/x/denommetadata/types/expected_keeper.go b/x/denommetadata/types/expected_keeper.go index 04577e5c..30143e60 100644 --- a/x/denommetadata/types/expected_keeper.go +++ b/x/denommetadata/types/expected_keeper.go @@ -19,3 +19,8 @@ type TransferKeeper interface { HasDenomTrace(ctx sdk.Context, denomTraceHash tmbytes.HexBytes) bool SetDenomTrace(ctx sdk.Context, denomTrace transfertypes.DenomTrace) } + +// SequencerKeeper defines the expected interface needed to check for address permission. +type SequencerKeeper interface { + HasPermission(ctx sdk.Context, accAddr sdk.AccAddress, permission string) bool +} diff --git a/x/denommetadata/types/genesis.pb.go b/x/denommetadata/types/genesis.pb.go index 997cacc1..ddbaa4c7 100644 --- a/x/denommetadata/types/genesis.pb.go +++ b/x/denommetadata/types/genesis.pb.go @@ -5,7 +5,6 @@ package types import ( fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -25,8 +24,6 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the test module's genesis state. type GenesisState struct { - // params are all parameters for the module - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -62,13 +59,6 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - func init() { proto.RegisterType((*GenesisState)(nil), "rollapp.denommetadata.types.GenesisState") } @@ -76,21 +66,17 @@ func init() { func init() { proto.RegisterFile("denommetadata/genesis.proto", fileDescriptor_d7024f2838e64694) } var fileDescriptor_d7024f2838e64694 = []byte{ - // 209 bytes of a gzipped FileDescriptorProto + // 154 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0x49, 0xcd, 0xcb, 0xcf, 0xcd, 0x4d, 0x2d, 0x49, 0x4c, 0x49, 0x2c, 0x49, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x2e, 0xca, 0xcf, 0xc9, 0x49, 0x2c, 0x28, - 0xd0, 0x43, 0x51, 0xa4, 0x57, 0x52, 0x59, 0x90, 0x5a, 0x2c, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, - 0x56, 0xa7, 0x0f, 0x62, 0x41, 0xb4, 0x48, 0x49, 0xa1, 0x9a, 0x57, 0x90, 0x58, 0x94, 0x98, 0x0b, - 0x35, 0x4e, 0x29, 0x90, 0x8b, 0xc7, 0x1d, 0x62, 0x7e, 0x70, 0x49, 0x62, 0x49, 0xaa, 0x90, 0x23, - 0x17, 0x1b, 0x44, 0x5e, 0x82, 0x51, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x59, 0x0f, 0x8f, 0x7d, 0x7a, - 0x01, 0x60, 0xa5, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x41, 0x35, 0x3a, 0x85, 0x9e, 0x78, - 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, - 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x75, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, - 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x4a, 0x65, 0x6e, 0x6a, 0x5e, 0x71, 0x66, 0x7e, 0x5e, 0x45, 0x65, - 0x15, 0x82, 0xa3, 0x5b, 0x94, 0x92, 0xad, 0x5f, 0xa1, 0x8f, 0xea, 0x60, 0xb0, 0x5d, 0x49, 0x6c, - 0x60, 0x07, 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x08, 0x12, 0x62, 0x3a, 0x1e, 0x01, 0x00, - 0x00, + 0xd0, 0x43, 0x51, 0xa4, 0x57, 0x52, 0x59, 0x90, 0x5a, 0xac, 0xc4, 0xc7, 0xc5, 0xe3, 0x0e, 0x51, + 0x1d, 0x5c, 0x92, 0x58, 0x92, 0xea, 0x14, 0x7a, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, + 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, + 0x0c, 0x51, 0xd6, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x29, 0x95, + 0xb9, 0xa9, 0x79, 0xc5, 0x99, 0xf9, 0x79, 0x15, 0x95, 0x55, 0x08, 0x8e, 0x6e, 0x51, 0x4a, 0xb6, + 0x7e, 0x85, 0x3e, 0xaa, 0x5b, 0xc0, 0xd6, 0x24, 0xb1, 0x81, 0x9d, 0x62, 0x0c, 0x08, 0x00, 0x00, + 0xff, 0xff, 0x1f, 0xe4, 0x6f, 0x96, 0xa9, 0x00, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -113,16 +99,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -143,8 +119,6 @@ func (m *GenesisState) Size() (n int) { } var l int _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) return n } @@ -183,39 +157,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/denommetadata/types/params.go b/x/denommetadata/types/params.go deleted file mode 100644 index 3cb65ab6..00000000 --- a/x/denommetadata/types/params.go +++ /dev/null @@ -1,68 +0,0 @@ -package types - -import ( - "fmt" - - errorsmod "cosmossdk.io/errors" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var ( - KeyAllowedAddresses = []byte("AllowedAddresses") - DefaultAllowedAddresses = []string(nil) // no one allowed -) - -// ParamKeyTable for minting module. -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params object -func NewParams( - allowedAddresses []string, -) Params { - return Params{ - AllowedAddresses: allowedAddresses, - } -} - -// DefaultParams returns default x/denommetadata module parameters. -func DefaultParams() Params { - return Params{ - AllowedAddresses: DefaultAllowedAddresses, - } -} - -func (p Params) Validate() error { - return assertValidAddresses(p.AllowedAddresses) -} - -func assertValidAddresses(i any) error { - addrs, ok := i.([]string) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - idx := make(map[string]struct{}, len(addrs)) - for _, a := range addrs { - - // this also checks for empty addresses - if _, err := sdk.AccAddressFromBech32(a); err != nil { - return errorsmod.Wrapf(err, "address: %s", a) - } - if _, exists := idx[a]; exists { - return ErrDuplicate.Wrapf("address: %s", a) - } - idx[a] = struct{}{} - } - return nil -} - -// Implements params.ParamSet. -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyAllowedAddresses, &p.AllowedAddresses, assertValidAddresses), - } -} diff --git a/x/denommetadata/types/params.pb.go b/x/denommetadata/types/params.pb.go deleted file mode 100644 index 66ef3f40..00000000 --- a/x/denommetadata/types/params.pb.go +++ /dev/null @@ -1,326 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: denommetadata/params.proto - -package types - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Params defines the parameters for the module. -type Params struct { - // allowed_addresses defines the list of addresses authorized to use the - // module - AllowedAddresses []string `protobuf:"bytes,1,rep,name=allowed_addresses,json=allowedAddresses,proto3" json:"allowed_addresses,omitempty" yaml:"allowed_addresses"` -} - -func (m *Params) Reset() { *m = Params{} } -func (m *Params) String() string { return proto.CompactTextString(m) } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_c251c710bb35ef69, []int{0} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func (m *Params) GetAllowedAddresses() []string { - if m != nil { - return m.AllowedAddresses - } - return nil -} - -func init() { - proto.RegisterType((*Params)(nil), "rollapp.denommetadata.types.Params") -} - -func init() { proto.RegisterFile("denommetadata/params.proto", fileDescriptor_c251c710bb35ef69) } - -var fileDescriptor_c251c710bb35ef69 = []byte{ - // 210 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0x49, 0xcd, 0xcb, - 0xcf, 0xcd, 0x4d, 0x2d, 0x49, 0x4c, 0x49, 0x2c, 0x49, 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, - 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x2e, 0xca, 0xcf, 0xc9, 0x49, 0x2c, 0x28, 0xd0, - 0x43, 0x51, 0xa3, 0x57, 0x52, 0x59, 0x90, 0x5a, 0x2c, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, - 0xa7, 0x0f, 0x62, 0x41, 0xb4, 0x28, 0x05, 0x73, 0xb1, 0x05, 0x80, 0x8d, 0x10, 0xf2, 0xe4, 0x12, - 0x4c, 0xcc, 0xc9, 0xc9, 0x2f, 0x4f, 0x4d, 0x89, 0x4f, 0x4c, 0x49, 0x29, 0x4a, 0x2d, 0x2e, 0x4e, - 0x2d, 0x96, 0x60, 0x54, 0x60, 0xd6, 0xe0, 0x74, 0x92, 0xf9, 0x74, 0x4f, 0x5e, 0xa2, 0x32, 0x31, - 0x37, 0xc7, 0x4a, 0x09, 0x43, 0x89, 0x52, 0x90, 0x00, 0x54, 0xcc, 0x11, 0x26, 0xe4, 0x14, 0x7a, - 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, - 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0xd6, 0xe9, 0x99, 0x25, 0x19, 0xa5, - 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x29, 0x95, 0xb9, 0xa9, 0x79, 0xc5, 0x99, 0xf9, 0x79, 0x15, - 0x95, 0x55, 0x08, 0x8e, 0x6e, 0x51, 0x4a, 0xb6, 0x7e, 0x85, 0x3e, 0xaa, 0x2f, 0xc1, 0x3e, 0x48, - 0x62, 0x03, 0x3b, 0xd9, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x51, 0xf5, 0x4c, 0x14, 0x03, 0x01, - 0x00, 0x00, -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.AllowedAddresses) > 0 { - for iNdEx := len(m.AllowedAddresses) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.AllowedAddresses[iNdEx]) - copy(dAtA[i:], m.AllowedAddresses[iNdEx]) - i = encodeVarintParams(dAtA, i, uint64(len(m.AllowedAddresses[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintParams(dAtA []byte, offset int, v uint64) int { - offset -= sovParams(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.AllowedAddresses) > 0 { - for _, s := range m.AllowedAddresses { - l = len(s) - n += 1 + l + sovParams(uint64(l)) - } - } - return n -} - -func sovParams(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozParams(x uint64) (n int) { - return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AllowedAddresses", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AllowedAddresses = append(m.AllowedAddresses, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipParams(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthParams - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipParams(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthParams - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupParams - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthParams - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/denommetadata/types/query.pb.go b/x/denommetadata/types/query.pb.go index 77fd4b94..d3c40375 100644 --- a/x/denommetadata/types/query.pb.go +++ b/x/denommetadata/types/query.pb.go @@ -6,7 +6,6 @@ package types import ( context "context" fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -29,89 +28,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// QueryParamsRequest is request type for the Query/Params RPC method. -type QueryParamsRequest struct { -} - -func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } -func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamsRequest) ProtoMessage() {} -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_81a3ad864530e6e9, []int{0} -} -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) -} -func (m *QueryParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo - -// QueryParamsResponse is response type for the Query/Params RPC method. -type QueryParamsResponse struct { - // params holds all the parameters of this module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` -} - -func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } -func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryParamsResponse) ProtoMessage() {} -func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_81a3ad864530e6e9, []int{1} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -func (m *QueryParamsResponse) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - // QueryGetIBCDenomByDenomTraceRequest is the request type for the // Query/IBCDenomByDenomTrace RPC method. type QueryGetIBCDenomByDenomTraceRequest struct { @@ -123,7 +39,7 @@ func (m *QueryGetIBCDenomByDenomTraceRequest) Reset() { *m = QueryGetIBC func (m *QueryGetIBCDenomByDenomTraceRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetIBCDenomByDenomTraceRequest) ProtoMessage() {} func (*QueryGetIBCDenomByDenomTraceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_81a3ad864530e6e9, []int{2} + return fileDescriptor_81a3ad864530e6e9, []int{0} } func (m *QueryGetIBCDenomByDenomTraceRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -170,7 +86,7 @@ func (m *QueryIBCDenomByDenomTraceResponse) Reset() { *m = QueryIBCDenom func (m *QueryIBCDenomByDenomTraceResponse) String() string { return proto.CompactTextString(m) } func (*QueryIBCDenomByDenomTraceResponse) ProtoMessage() {} func (*QueryIBCDenomByDenomTraceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_81a3ad864530e6e9, []int{3} + return fileDescriptor_81a3ad864530e6e9, []int{1} } func (m *QueryIBCDenomByDenomTraceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -207,8 +123,6 @@ func (m *QueryIBCDenomByDenomTraceResponse) GetIbcDenom() string { } func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "rollapp.denommetadata.types.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "rollapp.denommetadata.types.QueryParamsResponse") proto.RegisterType((*QueryGetIBCDenomByDenomTraceRequest)(nil), "rollapp.denommetadata.types.QueryGetIBCDenomByDenomTraceRequest") proto.RegisterType((*QueryIBCDenomByDenomTraceResponse)(nil), "rollapp.denommetadata.types.QueryIBCDenomByDenomTraceResponse") } @@ -216,32 +130,26 @@ func init() { func init() { proto.RegisterFile("denommetadata/query.proto", fileDescriptor_81a3ad864530e6e9) } var fileDescriptor_81a3ad864530e6e9 = []byte{ - // 397 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x3f, 0x4b, 0xc3, 0x40, - 0x14, 0x4f, 0xfc, 0x53, 0xec, 0x75, 0x3b, 0x3b, 0x68, 0x2a, 0xa9, 0xa6, 0x8b, 0x8b, 0xb9, 0x52, - 0x17, 0x41, 0x90, 0x36, 0x15, 0xa5, 0x9b, 0x16, 0x05, 0x71, 0x29, 0x97, 0xe4, 0x88, 0xc1, 0x26, - 0x97, 0x26, 0x57, 0x68, 0x14, 0x17, 0x3f, 0x81, 0x20, 0x7e, 0x04, 0xbf, 0x4b, 0xc7, 0x82, 0x8b, - 0x93, 0x48, 0xe3, 0x07, 0x91, 0x5c, 0x42, 0xb5, 0x5a, 0xd2, 0x4e, 0x49, 0xde, 0x7b, 0xbf, 0x7f, - 0xef, 0x05, 0x6c, 0x9a, 0xc4, 0xa5, 0x8e, 0x43, 0x18, 0x36, 0x31, 0xc3, 0xa8, 0xd7, 0x27, 0x7e, - 0xa8, 0x7a, 0x3e, 0x65, 0x14, 0x96, 0x7c, 0xda, 0xed, 0x62, 0xcf, 0x53, 0xa7, 0x46, 0x54, 0x16, - 0x7a, 0x24, 0x90, 0x8a, 0x16, 0xb5, 0x28, 0x9f, 0x43, 0xf1, 0x5b, 0x02, 0x91, 0xb6, 0x2c, 0x4a, - 0xad, 0x2e, 0x41, 0xd8, 0xb3, 0x11, 0x76, 0x5d, 0xca, 0x30, 0xb3, 0xa9, 0x1b, 0xa4, 0x5d, 0x69, - 0x5a, 0xcb, 0xc3, 0x3e, 0x76, 0xd2, 0x9e, 0x52, 0x04, 0xf0, 0x3c, 0xd6, 0x3e, 0xe3, 0xc5, 0x36, - 0xe9, 0xf5, 0x49, 0xc0, 0x94, 0x2b, 0xb0, 0x3e, 0x55, 0x0d, 0x3c, 0xea, 0x06, 0x04, 0x36, 0x40, - 0x2e, 0x01, 0x6f, 0x88, 0xdb, 0xe2, 0x6e, 0xa1, 0x56, 0x51, 0x33, 0xac, 0xaa, 0x09, 0x58, 0x5b, - 0x19, 0x7e, 0x94, 0x85, 0x76, 0x0a, 0x54, 0x4e, 0x40, 0x85, 0x33, 0x9f, 0x12, 0xd6, 0xd2, 0x9a, - 0xc7, 0x31, 0x4c, 0x0b, 0xf9, 0xe3, 0xc2, 0xc7, 0x06, 0x49, 0x0d, 0xc0, 0x32, 0x28, 0x70, 0xca, - 0x0e, 0x8b, 0xab, 0x5c, 0x2e, 0xdf, 0x06, 0xe6, 0x64, 0x4e, 0xa9, 0x83, 0x1d, 0xce, 0x33, 0x9b, - 0x24, 0xf5, 0x5b, 0x02, 0x79, 0x5b, 0x37, 0x3a, 0x1c, 0x96, 0x72, 0xac, 0xd9, 0xba, 0xc1, 0x27, - 0x6b, 0x2f, 0xcb, 0x60, 0x95, 0x53, 0xc0, 0x57, 0x11, 0xe4, 0x12, 0xb3, 0x10, 0x65, 0x26, 0xfa, - 0xbf, 0x29, 0xa9, 0xba, 0x38, 0x20, 0x31, 0xa5, 0x1c, 0x3c, 0xbe, 0x7d, 0x3d, 0x2f, 0xd5, 0x60, - 0x15, 0x99, 0xa1, 0x43, 0xdc, 0xc0, 0xa6, 0xee, 0x20, 0xbc, 0xfb, 0xf9, 0xd8, 0xf3, 0xcd, 0x5b, - 0x34, 0xeb, 0x62, 0x30, 0x12, 0x41, 0x71, 0x56, 0x5e, 0x58, 0x9f, 0x6f, 0x22, 0x7b, 0xdf, 0xd2, - 0xd1, 0x7c, 0x86, 0xac, 0x4d, 0x2b, 0x2d, 0x1e, 0xaa, 0x09, 0x1b, 0x8b, 0x87, 0x9a, 0x5c, 0x06, - 0xdd, 0xff, 0x3a, 0xf5, 0x83, 0x76, 0x39, 0x1c, 0xcb, 0xe2, 0x68, 0x2c, 0x8b, 0x9f, 0x63, 0x59, - 0x7c, 0x8a, 0x64, 0x61, 0x14, 0xc9, 0xc2, 0x7b, 0x24, 0x0b, 0xd7, 0x87, 0x96, 0xcd, 0x6e, 0xfa, - 0xba, 0x6a, 0x50, 0x27, 0x4b, 0x66, 0xf0, 0x47, 0x88, 0x67, 0xd0, 0x73, 0xfc, 0x7f, 0xdf, 0xff, - 0x0e, 0x00, 0x00, 0xff, 0xff, 0xdf, 0x22, 0x9e, 0x64, 0x79, 0x03, 0x00, 0x00, + // 304 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0x49, 0xcd, 0xcb, + 0xcf, 0xcd, 0x4d, 0x2d, 0x49, 0x4c, 0x49, 0x2c, 0x49, 0xd4, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, + 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x2e, 0xca, 0xcf, 0xc9, 0x49, 0x2c, 0x28, 0xd0, 0x43, + 0x51, 0xa2, 0x57, 0x52, 0x59, 0x90, 0x5a, 0x2c, 0x25, 0x93, 0x9e, 0x9f, 0x9f, 0x9e, 0x93, 0xaa, + 0x9f, 0x58, 0x90, 0xa9, 0x9f, 0x98, 0x97, 0x97, 0x5f, 0x92, 0x58, 0x92, 0x99, 0x9f, 0x57, 0x0c, + 0xd1, 0xaa, 0xe4, 0xc6, 0xa5, 0x1c, 0x08, 0x32, 0xc9, 0x3d, 0xb5, 0xc4, 0xd3, 0xc9, 0xd9, 0x05, + 0xa4, 0xdf, 0xa9, 0x12, 0x4c, 0x85, 0x14, 0x25, 0x26, 0xa7, 0x06, 0xa5, 0x16, 0x96, 0xa6, 0x16, + 0x97, 0x08, 0xc9, 0x73, 0x71, 0x83, 0xcd, 0x8e, 0x2f, 0x01, 0x89, 0x4a, 0x30, 0x2a, 0x30, 0x6a, + 0x70, 0x06, 0x71, 0xa5, 0xc0, 0xd5, 0x29, 0x39, 0x70, 0x29, 0x82, 0xcd, 0xc1, 0x6e, 0x48, 0x71, + 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0x90, 0x34, 0x17, 0x67, 0x66, 0x52, 0x72, 0x3c, 0x58, 0x1b, 0xd4, + 0x0c, 0x8e, 0xcc, 0xa4, 0x64, 0xb0, 0x4a, 0xa3, 0xb7, 0x8c, 0x5c, 0xac, 0x60, 0x23, 0x84, 0x1e, + 0x33, 0x72, 0x89, 0x60, 0x33, 0x47, 0xc8, 0x41, 0x0f, 0x8f, 0x47, 0xf5, 0x88, 0xf0, 0x87, 0x94, + 0x1d, 0x61, 0x13, 0xf0, 0xf9, 0x40, 0xc9, 0xb3, 0xe9, 0xf2, 0x93, 0xc9, 0x4c, 0xce, 0x42, 0x8e, + 0xfa, 0x29, 0x95, 0xb9, 0xa9, 0x79, 0xc5, 0x99, 0xf9, 0x79, 0x15, 0x95, 0x55, 0x08, 0x8e, 0x6e, + 0x51, 0x4a, 0xb6, 0x3e, 0x6a, 0x44, 0xc1, 0x7d, 0xac, 0x5f, 0x8d, 0x14, 0x84, 0xb5, 0x4e, 0xa1, + 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, + 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x65, 0x9d, 0x9e, 0x59, 0x92, 0x51, + 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0x8b, 0xcf, 0x9a, 0x0a, 0x34, 0x8b, 0xc0, 0x7e, 0x48, 0x62, 0x03, + 0xc7, 0xab, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xd1, 0x5c, 0x95, 0xf5, 0x2f, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -256,8 +164,6 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - // Parameters retrieves the denom metadata module params - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // Queries an IBC denom base on denom trace IBCDenomByDenomTrace(ctx context.Context, in *QueryGetIBCDenomByDenomTraceRequest, opts ...grpc.CallOption) (*QueryIBCDenomByDenomTraceResponse, error) } @@ -270,15 +176,6 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/rollapp.denommetadata.types.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) IBCDenomByDenomTrace(ctx context.Context, in *QueryGetIBCDenomByDenomTraceRequest, opts ...grpc.CallOption) (*QueryIBCDenomByDenomTraceResponse, error) { out := new(QueryIBCDenomByDenomTraceResponse) err := c.cc.Invoke(ctx, "/rollapp.denommetadata.types.Query/IBCDenomByDenomTrace", in, out, opts...) @@ -290,8 +187,6 @@ func (c *queryClient) IBCDenomByDenomTrace(ctx context.Context, in *QueryGetIBCD // QueryServer is the server API for Query service. type QueryServer interface { - // Parameters retrieves the denom metadata module params - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // Queries an IBC denom base on denom trace IBCDenomByDenomTrace(context.Context, *QueryGetIBCDenomByDenomTraceRequest) (*QueryIBCDenomByDenomTraceResponse, error) } @@ -300,9 +195,6 @@ type QueryServer interface { type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} func (*UnimplementedQueryServer) IBCDenomByDenomTrace(ctx context.Context, req *QueryGetIBCDenomByDenomTraceRequest) (*QueryIBCDenomByDenomTraceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method IBCDenomByDenomTrace not implemented") } @@ -311,24 +203,6 @@ func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rollapp.denommetadata.types.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_IBCDenomByDenomTrace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryGetIBCDenomByDenomTraceRequest) if err := dec(in); err != nil { @@ -351,10 +225,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "rollapp.denommetadata.types.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, { MethodName: "IBCDenomByDenomTrace", Handler: _Query_IBCDenomByDenomTrace_Handler, @@ -364,62 +234,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Metadata: "denommetadata/query.proto", } -func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - func (m *QueryGetIBCDenomByDenomTraceRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -491,26 +305,6 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - func (m *QueryGetIBCDenomByDenomTraceRequest) Size() (n int) { if m == nil { return 0 @@ -543,139 +337,6 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *QueryGetIBCDenomByDenomTraceRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/denommetadata/types/query.pb.gw.go b/x/denommetadata/types/query.pb.gw.go index 016d386a..d91ac044 100644 --- a/x/denommetadata/types/query.pb.gw.go +++ b/x/denommetadata/types/query.pb.gw.go @@ -33,24 +33,6 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_IBCDenomByDenomTrace_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryGetIBCDenomByDenomTraceRequest var metadata runtime.ServerMetadata @@ -111,29 +93,6 @@ func local_request_Query_IBCDenomByDenomTrace_0(ctx context.Context, marshaler r // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_IBCDenomByDenomTrace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -198,26 +157,6 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_IBCDenomByDenomTrace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -242,13 +181,9 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"dymensionxyz", "dymension-rdk", "denommetadata", "params"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_IBCDenomByDenomTrace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"dymensionxyz", "dymension-rdk", "denommetadata", "ibc_denom", "denom_trace"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage - forward_Query_IBCDenomByDenomTrace_0 = runtime.ForwardResponseMessage ) diff --git a/x/genutil/client/cli/collect.go b/x/genutil/client/cli/collect.go new file mode 100644 index 00000000..e83d8d78 --- /dev/null +++ b/x/genutil/client/cli/collect.go @@ -0,0 +1,103 @@ +package cli + +import ( + "encoding/json" + "fmt" + "os" + "path/filepath" + + "github.com/pkg/errors" + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/server" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/genutil" + "github.com/cosmos/cosmos-sdk/x/genutil/types" + rdk "github.com/dymensionxyz/dymension-rdk/x/genutil" + rdktypes "github.com/dymensionxyz/dymension-rdk/x/genutil/types" +) + +const flagGenTxDir = "gentx-dir" + +type printInfo struct { + Moniker string `json:"moniker" yaml:"moniker"` + ChainID string `json:"chain_id" yaml:"chain_id"` + NodeID string `json:"node_id" yaml:"node_id"` + GenTxsDir string `json:"gentxs_dir" yaml:"gentxs_dir"` + AppMessage json.RawMessage `json:"app_message" yaml:"app_message"` +} + +func newPrintInfo(moniker, chainID, nodeID, genTxsDir string, appMessage json.RawMessage) printInfo { + return printInfo{ + Moniker: moniker, + ChainID: chainID, + NodeID: nodeID, + GenTxsDir: genTxsDir, + AppMessage: appMessage, + } +} + +func displayInfo(info printInfo) error { + out, err := json.MarshalIndent(info, "", " ") + if err != nil { + return err + } + + _, err = fmt.Fprintf(os.Stderr, "%s\n", sdk.MustSortJSON(out)) + + return err +} + +// CollectGenTxsCmd - return the cobra command to collect genesis transactions +func CollectGenTxsCmd(genBalIterator types.GenesisBalancesIterator, defaultNodeHome string) *cobra.Command { + cmd := &cobra.Command{ + Use: "collect-gentxs", + Short: "Collect genesis txs and output a genesis.json file", + RunE: func(cmd *cobra.Command, _ []string) error { + serverCtx := server.GetServerContextFromCmd(cmd) + config := serverCtx.Config + + clientCtx := client.GetClientContextFromCmd(cmd) + cdc := clientCtx.Codec + + config.SetRoot(clientCtx.HomeDir) + + nodeID, valPubKey, err := genutil.InitializeNodeValidatorFiles(config) + if err != nil { + return errors.Wrap(err, "failed to initialize node validator files") + } + + genDoc, err := rdktypes.GenesisDocFromFile(config.GenesisFile()) + if err != nil { + return errors.Wrap(err, "failed to read genesis doc from file") + } + + genTxDir, _ := cmd.Flags().GetString(flagGenTxDir) + genTxsDir := genTxDir + if genTxsDir == "" { + genTxsDir = filepath.Join(config.RootDir, "config", "gentx") + } + + toPrint := newPrintInfo(config.Moniker, genDoc["chain_id"].(string), nodeID, genTxsDir, json.RawMessage("")) + initCfg := types.NewInitConfig(genDoc["chain_id"].(string), genTxsDir, nodeID, valPubKey) + + appMessage, err := rdk.GenAppStateFromConfig(cdc, + clientCtx.TxConfig, + config, initCfg, genDoc, genBalIterator) + if err != nil { + return errors.Wrap(err, "failed to get genesis app state from config") + } + + toPrint.AppMessage = appMessage + + return displayInfo(toPrint) + }, + } + + cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") + cmd.Flags().String(flagGenTxDir, "", "override default \"gentx\" directory from which collect and execute genesis transactions; default [--home]/config/gentx/") + + return cmd +} diff --git a/x/genutil/collect.go b/x/genutil/collect.go new file mode 100644 index 00000000..bdf28217 --- /dev/null +++ b/x/genutil/collect.go @@ -0,0 +1,201 @@ +package genutil + +import ( + "encoding/json" + "fmt" + "os" + "path/filepath" + "runtime" + "sort" + "strings" + + "github.com/pkg/errors" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + bankexported "github.com/cosmos/cosmos-sdk/x/bank/exported" + "github.com/cosmos/cosmos-sdk/x/genutil" + "github.com/cosmos/cosmos-sdk/x/genutil/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + cfg "github.com/tendermint/tendermint/config" +) + +// GenAppStateFromConfig gets the genesis app state from the config +func GenAppStateFromConfig(cdc codec.JSONCodec, txEncodingConfig client.TxEncodingConfig, + config *cfg.Config, initCfg types.InitConfig, genDoc map[string]interface{}, genBalIterator types.GenesisBalancesIterator, +) (appState json.RawMessage, err error) { + // process genesis transactions, else create default genesis.json + appGenTxs, persistentPeers, err := CollectTxs( + cdc, txEncodingConfig.TxJSONDecoder(), config.Moniker, initCfg.GenTxsDir, genDoc, genBalIterator, + ) + if err != nil { + return appState, err + } + + config.P2P.PersistentPeers = persistentPeers + cfg.WriteConfigFile(filepath.Join(config.RootDir, "config", "config.toml"), config) + + // if there are no gen txs to be processed, return the default empty state + if len(appGenTxs) == 0 { + return appState, errors.New("there must be at least one genesis tx") + } + + var appGenesisState map[string]json.RawMessage + + bz, err := json.Marshal(genDoc["app_state"]) + if err != nil { + return appState, err + } + + err = json.Unmarshal(bz, &appGenesisState) + if err != nil { + return appState, err + } + + appGenesisState, err = genutil.SetGenTxsInAppGenesisState(cdc, txEncodingConfig.TxJSONEncoder(), appGenesisState, appGenTxs) + if err != nil { + return appState, err + } + + appState, err = json.MarshalIndent(appGenesisState, "", " ") + if err != nil { + return appState, err + } + + genDoc["app_state"] = appState + genDocBytes, err := json.MarshalIndent(genDoc, "", " ") + if err != nil { + return appState, err + } + err = os.WriteFile(config.GenesisFile(), genDocBytes, 0o644) + if err != nil { + return appState, err + } + + return appState, err +} + +// CollectTxs processes and validates application's genesis Txs and returns +// the list of appGenTxs, and persistent peers required to generate genesis.json. +func CollectTxs(cdc codec.JSONCodec, txJSONDecoder sdk.TxDecoder, moniker, genTxsDir string, + genDoc map[string]interface{}, genBalIterator types.GenesisBalancesIterator, +) (appGenTxs []sdk.Tx, persistentPeers string, err error) { + // prepare a map of all balances in genesis state to then validate + // against the validators addresses + var appState map[string]json.RawMessage + bz, err := json.Marshal(genDoc["app_state"]) + if err != nil { + return appGenTxs, persistentPeers, err + } + + if err := json.Unmarshal(bz, &appState); err != nil { + return appGenTxs, persistentPeers, err + } + + var fos []os.DirEntry + fos, err = os.ReadDir(genTxsDir) + if err != nil { + return appGenTxs, persistentPeers, err + } + + balancesMap := make(map[string]bankexported.GenesisBalance) + + genBalIterator.IterateGenesisBalances( + cdc, appState, + func(balance bankexported.GenesisBalance) (stop bool) { + balancesMap[balance.GetAddress().String()] = balance + return false + }, + ) + + // addresses and IPs (and port) validator server info + var addressesIPs []string + + for _, fo := range fos { + if fo.IsDir() { + continue + } + if !strings.HasSuffix(fo.Name(), ".json") { + continue + } + + // get the genTx + jsonRawTx, err := os.ReadFile(filepath.Join(genTxsDir, fo.Name())) + if err != nil { + return appGenTxs, persistentPeers, err + } + + genTx, err := types.ValidateAndGetGenTx(jsonRawTx, txJSONDecoder) + if err != nil { + return appGenTxs, persistentPeers, err + } + + appGenTxs = append(appGenTxs, genTx) + + // the memo flag is used to store + // the ip and node-id, for example this may be: + // "528fd3df22b31f4969b05652bfe8f0fe921321d5@192.168.2.37:26656" + + memoTx, ok := genTx.(sdk.TxWithMemo) + if !ok { + return appGenTxs, persistentPeers, fmt.Errorf("expected TxWithMemo, got %T", genTx) + } + nodeAddrIP := memoTx.GetMemo() + if len(nodeAddrIP) == 0 { + return appGenTxs, persistentPeers, fmt.Errorf("failed to find node's address and IP in %s", fo.Name()) + } + + // genesis transactions must be single-message + msgs := genTx.GetMsgs() + + // TODO abstract out staking message validation back to staking + msg, ok := msgs[0].(*stakingtypes.MsgCreateValidator) + if !ok { + return appGenTxs, persistentPeers, fmt.Errorf("expected msg should be stakingtypes.MsgCreateValidator, got %T", msgs[0]) + } + + // validate delegator and validator addresses and funds against the accounts in the state + delAddr := msg.DelegatorAddress + valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress) + if err != nil { + return appGenTxs, persistentPeers, err + } + + delBal, delOk := balancesMap[delAddr] + if !delOk { + _, file, no, ok := runtime.Caller(1) + if ok { + fmt.Printf("CollectTxs-1, called from %s#%d\n", file, no) + } + + return appGenTxs, persistentPeers, fmt.Errorf("account %s balance not in genesis state: %+v", delAddr, balancesMap) + } + + _, valOk := balancesMap[sdk.AccAddress(valAddr).String()] + if !valOk { + _, file, no, ok := runtime.Caller(1) + if ok { + fmt.Printf("CollectTxs-2, called from %s#%d - %s\n", file, no, sdk.AccAddress(msg.ValidatorAddress).String()) + } + return appGenTxs, persistentPeers, fmt.Errorf("account %s balance not in genesis state: %+v", valAddr, balancesMap) + } + + if delBal.GetCoins().AmountOf(msg.Value.Denom).LT(msg.Value.Amount) { + return appGenTxs, persistentPeers, fmt.Errorf( + "insufficient fund for delegation %v: %v < %v", + delBal.GetAddress().String(), delBal.GetCoins().AmountOf(msg.Value.Denom), msg.Value.Amount, + ) + } + + // exclude itself from persistent peers + if msg.Description.Moniker != moniker { + addressesIPs = append(addressesIPs, nodeAddrIP) + } + } + + sort.Strings(addressesIPs) + persistentPeers = strings.Join(addressesIPs, ",") + + return appGenTxs, persistentPeers, nil +} diff --git a/x/genutil/types/types.go b/x/genutil/types/types.go new file mode 100644 index 00000000..92336bb9 --- /dev/null +++ b/x/genutil/types/types.go @@ -0,0 +1,32 @@ +package types + +import ( + "encoding/json" + "fmt" + "os" +) + +// GenesisDocFromFile reads JSON data from a file and unmarshalls it into a GenesisDoc. +func GenesisDocFromFile(genDocFile string) (map[string]interface{}, error) { + jsonBlob, err := os.ReadFile(genDocFile) + if err != nil { + return nil, fmt.Errorf("couldn't read GenesisDoc file: %w", err) + } + + genDoc, err := GenesisDocFromJSON(jsonBlob) + if err != nil { + return nil, fmt.Errorf("error reading GenesisDoc at %s: %w", genDocFile, err) + } + return genDoc, nil +} + +// GenesisDocFromJSON unmarshalls JSON data into a GenesisDoc. +func GenesisDocFromJSON(jsonBlob []byte) (map[string]interface{}, error) { + genDoc := make(map[string]interface{}) + err := json.Unmarshal(jsonBlob, &genDoc) + if err != nil { + return nil, err + } + + return genDoc, err +} diff --git a/x/hub-genesis/client/cli/query.go b/x/hub-genesis/client/cli/query.go index b33b8d82..0140f826 100644 --- a/x/hub-genesis/client/cli/query.go +++ b/x/hub-genesis/client/cli/query.go @@ -22,42 +22,12 @@ func GetQueryCmd() *cobra.Command { } hubGenQueryCmd.AddCommand( - GetCmdQueryParams(), GetCmdQueryState(), ) return hubGenQueryCmd } -// GetCmdQueryParams implements a command to return the current hub-genesis -// parameters. -func GetCmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "Query the current hub-genesis parameters", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryParamsRequest{} - res, err := queryClient.Params(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(&res.Params) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - // GetCmdQueryState implements a command to return the current hub-genesis // state. func GetCmdQueryState() *cobra.Command { diff --git a/x/hub-genesis/keeper/genesis.go b/x/hub-genesis/keeper/genesis.go index de560863..d381783a 100644 --- a/x/hub-genesis/keeper/genesis.go +++ b/x/hub-genesis/keeper/genesis.go @@ -7,8 +7,6 @@ import ( // InitGenesis new hub-genesis genesis. func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) { - k.SetParams(ctx, genState.Params) - modAddress := k.accountKeeper.GetModuleAddress(types.ModuleName) if !k.accountKeeper.HasAccount(ctx, modAddress) { k.accountKeeper.GetModuleAccount(ctx, types.ModuleName) @@ -29,7 +27,6 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) { // ExportGenesis returns a GenesisState for a given context and keeper. func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { genesis := types.DefaultGenesisState() - genesis.Params = k.GetParams(ctx) genesis.State = k.GetState(ctx) return genesis diff --git a/x/hub-genesis/keeper/grpc_query.go b/x/hub-genesis/keeper/grpc_query.go index 0f1e37a4..0ab067e8 100644 --- a/x/hub-genesis/keeper/grpc_query.go +++ b/x/hub-genesis/keeper/grpc_query.go @@ -20,14 +20,6 @@ func NewQuerier(k Keeper) Querier { return Querier{Keeper: k} } -// Params returns params of the hub-genesis module. -func (q Querier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - params := q.Keeper.GetParams(ctx) - - return &types.QueryParamsResponse{Params: params}, nil -} - func (q Querier) State(goCtx context.Context, request *types.QueryStateRequest) (*types.QueryStateResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) return &types.QueryStateResponse{State: q.Keeper.GetState(ctx)}, nil diff --git a/x/hub-genesis/keeper/keeper.go b/x/hub-genesis/keeper/keeper.go index ecdf2946..8e590a87 100644 --- a/x/hub-genesis/keeper/keeper.go +++ b/x/hub-genesis/keeper/keeper.go @@ -11,42 +11,35 @@ import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) type ( Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - paramstore paramtypes.Subspace + cdc codec.BinaryCodec + storeKey storetypes.StoreKey - channelKeeper types.ChannelKeeper - bankKeeper types.BankKeeper - accountKeeper types.AccountKeeper + sequencerKeeper types.SequencerKeeper + channelKeeper types.ChannelKeeper + bankKeeper types.BankKeeper + accountKeeper types.AccountKeeper } ) func NewKeeper( cdc codec.BinaryCodec, storeKey storetypes.StoreKey, - ps paramtypes.Subspace, channelKeeper types.ChannelKeeper, + sequencerKeeper types.SequencerKeeper, bankKeeper types.BankKeeper, accountKeeper types.AccountKeeper, ) Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - table := types.ParamKeyTable() - ps = ps.WithKeyTable(table) - } - return Keeper{ - cdc: cdc, - storeKey: storeKey, - paramstore: ps, - channelKeeper: channelKeeper, - bankKeeper: bankKeeper, - accountKeeper: accountKeeper, + cdc: cdc, + storeKey: storeKey, + sequencerKeeper: sequencerKeeper, + channelKeeper: channelKeeper, + bankKeeper: bankKeeper, + accountKeeper: accountKeeper, } } diff --git a/x/hub-genesis/keeper/msg_server.go b/x/hub-genesis/keeper/msg_server.go index 9c54fce4..3503ff29 100644 --- a/x/hub-genesis/keeper/msg_server.go +++ b/x/hub-genesis/keeper/msg_server.go @@ -27,7 +27,12 @@ func (m msgServer) TriggerGenesisEvent(goCtx context.Context, msg *types.MsgHubG ctx := sdk.UnwrapSDKContext(goCtx) // Get the sender and validate they are in the Allowlist - if !m.IsAddressInGenesisTriggererAllowList(ctx, msg.Address) { + accAddr, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + return nil, err + } + + if !m.sequencerKeeper.HasPermission(ctx, accAddr, types.ModuleName) { return nil, sdkerrors.ErrUnauthorized } diff --git a/x/hub-genesis/keeper/msg_server_test.go b/x/hub-genesis/keeper/msg_server_test.go index cc7b4bd5..c02f29df 100644 --- a/x/hub-genesis/keeper/msg_server_test.go +++ b/x/hub-genesis/keeper/msg_server_test.go @@ -15,6 +15,7 @@ import ( "github.com/dymensionxyz/dymension-rdk/testutil/ibctest" "github.com/dymensionxyz/dymension-rdk/x/hub-genesis/keeper" "github.com/dymensionxyz/dymension-rdk/x/hub-genesis/types" + sequencerstypes "github.com/dymensionxyz/dymension-rdk/x/sequencers/types" ) const ( @@ -57,6 +58,7 @@ func (suite *HubGenesisMsgServerTestSuite) TestTriggerGenesisEvent() { cases := []struct { name string genesisState *types.GenesisState + permissionAddress sdk.AccAddress msg *types.MsgHubGenesisEvent rollappBalanceBefore sdk.Coin expErr error @@ -65,11 +67,9 @@ func (suite *HubGenesisMsgServerTestSuite) TestTriggerGenesisEvent() { { name: "successful hub genesis event", genesisState: &types.GenesisState{ - Params: types.Params{ - GenesisTriggererAllowlist: []types.GenesisTriggererParams{{Address: authorisedAddress.String()}}, - }, State: types.State{GenesisTokens: sdk.NewCoins(initialRollappBalance)}, }, + permissionAddress: authorisedAddress, msg: &types.MsgHubGenesisEvent{ Address: authorisedAddress.String(), ChannelId: path.EndpointA.ChannelID, @@ -80,11 +80,9 @@ func (suite *HubGenesisMsgServerTestSuite) TestTriggerGenesisEvent() { }, { name: "invalid rollapp genesis event - genesis event already triggered", genesisState: &types.GenesisState{ - Params: types.Params{ - GenesisTriggererAllowlist: []types.GenesisTriggererParams{{Address: authorisedAddress.String()}}, - }, State: types.State{IsLocked: true, GenesisTokens: sdk.NewCoins(initialRollappBalance)}, }, + permissionAddress: authorisedAddress, msg: &types.MsgHubGenesisEvent{ Address: authorisedAddress.String(), ChannelId: path.EndpointA.ChannelID, @@ -95,11 +93,9 @@ func (suite *HubGenesisMsgServerTestSuite) TestTriggerGenesisEvent() { }, { name: "invalid rollapp genesis event - address not in Allowlist", genesisState: &types.GenesisState{ - Params: types.Params{ - GenesisTriggererAllowlist: []types.GenesisTriggererParams{{Address: utils.AccAddress().String()}}, - }, State: types.State{GenesisTokens: sdk.NewCoins(initialRollappBalance)}, }, + permissionAddress: utils.AccAddress(), msg: &types.MsgHubGenesisEvent{ Address: authorisedAddress.String(), ChannelId: path.EndpointA.ChannelID, @@ -110,11 +106,9 @@ func (suite *HubGenesisMsgServerTestSuite) TestTriggerGenesisEvent() { }, { name: "invalid rollapp genesis event - invalid channel id", genesisState: &types.GenesisState{ - Params: types.Params{ - GenesisTriggererAllowlist: []types.GenesisTriggererParams{{Address: authorisedAddress.String()}}, - }, State: types.State{GenesisTokens: sdk.NewCoins(initialRollappBalance)}, }, + permissionAddress: authorisedAddress, msg: &types.MsgHubGenesisEvent{ Address: authorisedAddress.String(), ChannelId: "invalid-channel", @@ -125,11 +119,9 @@ func (suite *HubGenesisMsgServerTestSuite) TestTriggerGenesisEvent() { }, { name: "invalid rollapp genesis event - invalid chain id", genesisState: &types.GenesisState{ - Params: types.Params{ - GenesisTriggererAllowlist: []types.GenesisTriggererParams{{Address: authorisedAddress.String()}}, - }, State: types.State{GenesisTokens: sdk.NewCoins(initialRollappBalance)}, }, + permissionAddress: authorisedAddress, msg: &types.MsgHubGenesisEvent{ Address: authorisedAddress.String(), ChannelId: path.EndpointA.ChannelID, @@ -140,11 +132,9 @@ func (suite *HubGenesisMsgServerTestSuite) TestTriggerGenesisEvent() { }, { name: "invalid rollapp genesis event - module account has no coins", genesisState: &types.GenesisState{ - Params: types.Params{ - GenesisTriggererAllowlist: []types.GenesisTriggererParams{{Address: authorisedAddress.String()}}, - }, State: types.State{GenesisTokens: sdk.NewCoins(initialRollappBalance)}, }, + permissionAddress: authorisedAddress, msg: &types.MsgHubGenesisEvent{ Address: authorisedAddress.String(), ChannelId: path.EndpointA.ChannelID, @@ -175,8 +165,8 @@ func (suite *HubGenesisMsgServerTestSuite) TestTriggerGenesisEvent() { } suite.k.SetState(suite.ctx, tc.genesisState.State) - suite.k.SetParams(suite.ctx, tc.genesisState.Params) moduleAddr := suite.app.AccountKeeper.GetModuleAddress(types.ModuleName) + suite.app.SequencersKeeper.GrantPermissions(suite.ctx, tc.permissionAddress, sequencerstypes.NewPermissionsList([]string{types.ModuleName})) // check the initial module balance rollappBalanceBefore := suite.app.BankKeeper.GetBalance(suite.ctx, moduleAddr, rollappDenom) diff --git a/x/hub-genesis/keeper/params.go b/x/hub-genesis/keeper/params.go deleted file mode 100644 index 1e6f8f47..00000000 --- a/x/hub-genesis/keeper/params.go +++ /dev/null @@ -1,33 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/dymensionxyz/dymension-rdk/x/hub-genesis/types" -) - -// GetParams returns the total set of minting parameters. -func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { - k.paramstore.GetParamSet(ctx, ¶ms) - return params -} - -// SetParams sets the total set of minting parameters. -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} - -// GenesisTriggererAllowlist returns the GenesisTriggererAllowlist param -func (k Keeper) GenesisTriggererAllowlist(ctx sdk.Context) (res []types.GenesisTriggererParams) { - k.paramstore.Get(ctx, types.KeyGenesisTriggererAllowlist, &res) - return -} - -func (k Keeper) IsAddressInGenesisTriggererAllowList(ctx sdk.Context, address string) bool { - Allowlist := k.GenesisTriggererAllowlist(ctx) - for _, item := range Allowlist { - if item.Address == address { - return true - } - } - return false -} diff --git a/x/hub-genesis/types/expected_keepers.go b/x/hub-genesis/types/expected_keepers.go index cc5bcb0a..931b2046 100644 --- a/x/hub-genesis/types/expected_keepers.go +++ b/x/hub-genesis/types/expected_keepers.go @@ -23,3 +23,8 @@ type BankKeeper interface { type ChannelKeeper interface { GetChannelClientState(ctx sdk.Context, portID, channelID string) (string, exported.ClientState, error) } + +// SequencerKeeper defines the expected interface needed to check for address permission. +type SequencerKeeper interface { + HasPermission(ctx sdk.Context, accAddr sdk.AccAddress, permission string) bool +} diff --git a/x/hub-genesis/types/genesis.go b/x/hub-genesis/types/genesis.go index 68a905ea..12de5f51 100644 --- a/x/hub-genesis/types/genesis.go +++ b/x/hub-genesis/types/genesis.go @@ -1,25 +1,20 @@ package types // NewGenesisState creates a new GenesisState object. -func NewGenesisState(params Params, state State) *GenesisState { +func NewGenesisState(state State) *GenesisState { return &GenesisState{ - Params: params, - State: state, + State: state, } } // DefaultGenesisState creates a default GenesisState object. func DefaultGenesisState() *GenesisState { - return NewGenesisState(DefaultParams(), State{}) + return NewGenesisState(State{}) } // ValidateGenesis validates the provided genesis state to ensure the // expected invariants holds. func ValidateGenesis(data GenesisState) error { - if err := data.Params.Validate(); err != nil { - return err - } - if err := data.State.Validate(); err != nil { return err } diff --git a/x/hub-genesis/types/genesis.pb.go b/x/hub-genesis/types/genesis.pb.go index 5cb6727f..83a6622c 100644 --- a/x/hub-genesis/types/genesis.pb.go +++ b/x/hub-genesis/types/genesis.pb.go @@ -25,9 +25,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the hub-genesis module's genesis state. type GenesisState struct { - // params defines all the parameters of the module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - State State `protobuf:"bytes,2,opt,name=state,proto3" json:"state"` + State State `protobuf:"bytes,1,opt,name=state,proto3" json:"state"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -63,13 +61,6 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - func (m *GenesisState) GetState() State { if m != nil { return m.State @@ -84,22 +75,20 @@ func init() { func init() { proto.RegisterFile("hub-genesis/genesis.proto", fileDescriptor_6deac3d79fd587fe) } var fileDescriptor_6deac3d79fd587fe = []byte{ - // 231 bytes of a gzipped FileDescriptorProto + // 198 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0x28, 0x4d, 0xd2, 0x4d, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x87, 0xd2, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0xc2, 0x45, 0xf9, 0x39, 0x39, 0x89, 0x05, 0x05, 0x7a, 0x19, 0xa5, 0x49, 0xf1, 0x50, 0x29, - 0x29, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0xb0, 0xbc, 0x3e, 0x88, 0x05, 0x51, 0x2a, 0x25, 0x81, 0x6c, - 0x4a, 0x41, 0x62, 0x51, 0x62, 0x2e, 0xd4, 0x10, 0x29, 0x71, 0x64, 0x99, 0xe2, 0x92, 0xc4, 0x92, - 0x54, 0x88, 0x84, 0x52, 0x23, 0x23, 0x17, 0x8f, 0x3b, 0x44, 0x3c, 0x18, 0x24, 0x2c, 0x64, 0xc9, - 0xc5, 0x06, 0xd1, 0x29, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x6d, 0x24, 0xad, 0x87, 0xc5, 0x7e, 0xbd, - 0x00, 0xb0, 0x12, 0x27, 0x96, 0x13, 0xf7, 0xe4, 0x19, 0x82, 0xa0, 0x1a, 0x84, 0xcc, 0xb8, 0x58, - 0xc1, 0x46, 0x4b, 0x30, 0x81, 0x75, 0x4a, 0x61, 0xd5, 0x09, 0xb6, 0x05, 0xaa, 0x11, 0xa2, 0xdc, - 0x29, 0xf8, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, - 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x2c, 0xd3, 0x33, 0x4b, - 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x53, 0x2a, 0x73, 0x53, 0xf3, 0x8a, 0x33, 0xf3, - 0xf3, 0x2a, 0x2a, 0xab, 0x10, 0x1c, 0xdd, 0xa2, 0x94, 0x6c, 0xfd, 0x0a, 0x7d, 0x64, 0xef, 0x95, - 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0xfd, 0x67, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xd3, - 0x81, 0x05, 0x3c, 0x5a, 0x01, 0x00, 0x00, + 0x29, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0xb0, 0xbc, 0x3e, 0x88, 0x05, 0x51, 0x2a, 0x25, 0x8e, 0x6c, + 0x4a, 0x71, 0x49, 0x62, 0x49, 0x2a, 0x44, 0x42, 0xc9, 0x8d, 0x8b, 0xc7, 0x1d, 0x22, 0x1c, 0x0c, + 0x12, 0x15, 0x32, 0xe3, 0x62, 0x05, 0x4b, 0x4b, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x1b, 0x49, 0xe9, + 0x61, 0xb1, 0x43, 0x0f, 0xac, 0xd4, 0x89, 0xe5, 0xc4, 0x3d, 0x79, 0x86, 0x20, 0x88, 0x72, 0xa7, + 0xe0, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, + 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xb2, 0x4c, 0xcf, 0x2c, 0xc9, + 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xa9, 0xcc, 0x4d, 0xcd, 0x2b, 0xce, 0xcc, 0xcf, + 0xab, 0xa8, 0xac, 0x42, 0x70, 0x74, 0x8b, 0x52, 0xb2, 0xf5, 0x2b, 0xf4, 0x91, 0x9d, 0x58, 0x52, + 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x76, 0xa3, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x3d, 0x44, + 0x3e, 0x32, 0x04, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -131,16 +120,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -162,8 +141,6 @@ func (m *GenesisState) Size() (n int) { } var l int _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) l = m.State.Size() n += 1 + l + sovGenesis(uint64(l)) return n @@ -205,39 +182,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) } diff --git a/x/hub-genesis/types/params.go b/x/hub-genesis/types/params.go deleted file mode 100644 index 50064780..00000000 --- a/x/hub-genesis/types/params.go +++ /dev/null @@ -1,73 +0,0 @@ -package types - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "gopkg.in/yaml.v2" -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -// GenesisTriggererAllowlist is store's key for GenesisTriggererAllowlist Params -var KeyGenesisTriggererAllowlist = []byte("GenesisTriggererAllowlist") - -// ParamTable for hub_genesis module. -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -func NewParams(genesisTriggererAllowlist []GenesisTriggererParams) Params { - return Params{ - GenesisTriggererAllowlist: genesisTriggererAllowlist, - } -} - -func DefaultParams() Params { - return NewParams([]GenesisTriggererParams{}) -} - -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} - -// Implements params.ParamSet. -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyGenesisTriggererAllowlist, &p.GenesisTriggererAllowlist, validateGenesisTriggererAllowlist), - } -} - -// Validate checks that the parameters have valid values. -func (p Params) Validate() error { - return validateGenesisTriggererAllowlist(p.GenesisTriggererAllowlist) -} - -// validateGenesisTriggererAllowlist validates the GenesisTriggererAllowlist param -func validateGenesisTriggererAllowlist(v interface{}) error { - genesisTriggererAllowlist, ok := v.([]GenesisTriggererParams) - if !ok { - return fmt.Errorf("invalid parameter type: %T", v) - } - - // Check for duplicated index in genesis triggerer address - rollappGenesisTriggererIndexMap := make(map[string]struct{}) - - for i, item := range genesisTriggererAllowlist { - // check Bech32 format - if _, err := sdk.AccAddressFromBech32(item.Address); err != nil { - return fmt.Errorf("genesisTriggererAllowlist[%d] format error: %s", i, err.Error()) - } - - // check duplicate - if _, ok := rollappGenesisTriggererIndexMap[item.Address]; ok { - return fmt.Errorf("duplicated genesis trigerrer address in genesisTriggererAllowlist") - } - rollappGenesisTriggererIndexMap[item.Address] = struct{}{} - } - - return nil -} diff --git a/x/hub-genesis/types/params.pb.go b/x/hub-genesis/types/params.pb.go deleted file mode 100644 index ce48175b..00000000 --- a/x/hub-genesis/types/params.pb.go +++ /dev/null @@ -1,509 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: hub-genesis/params.proto - -package types - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Params holds parameters for the hub-genesis module. -type Params struct { - // genesis_triggerer_allowlist is a list of the - // accounts that are allowed to trigger a genesis event on the rollapp. - // In the case of an empty list, there are no restrictions - GenesisTriggererAllowlist []GenesisTriggererParams `protobuf:"bytes,1,rep,name=genesis_triggerer_allowlist,json=genesisTriggererAllowlist,proto3" json:"genesis_triggerer_allowlist" yaml:"genesis_triggerer_allowlist"` -} - -func (m *Params) Reset() { *m = Params{} } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_a8d0b00d1bcc9c95, []int{0} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func (m *Params) GetGenesisTriggererAllowlist() []GenesisTriggererParams { - if m != nil { - return m.GenesisTriggererAllowlist - } - return nil -} - -type GenesisTriggererParams struct { - // address is a bech32-encoded address of the - // accounts that are allowed to trigger a rollapp genesis event. - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` -} - -func (m *GenesisTriggererParams) Reset() { *m = GenesisTriggererParams{} } -func (m *GenesisTriggererParams) String() string { return proto.CompactTextString(m) } -func (*GenesisTriggererParams) ProtoMessage() {} -func (*GenesisTriggererParams) Descriptor() ([]byte, []int) { - return fileDescriptor_a8d0b00d1bcc9c95, []int{1} -} -func (m *GenesisTriggererParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisTriggererParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisTriggererParams.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GenesisTriggererParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisTriggererParams.Merge(m, src) -} -func (m *GenesisTriggererParams) XXX_Size() int { - return m.Size() -} -func (m *GenesisTriggererParams) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisTriggererParams.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisTriggererParams proto.InternalMessageInfo - -func (m *GenesisTriggererParams) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -func init() { - proto.RegisterType((*Params)(nil), "rollapp.hub_genesis.Params") - proto.RegisterType((*GenesisTriggererParams)(nil), "rollapp.hub_genesis.GenesisTriggererParams") -} - -func init() { proto.RegisterFile("hub-genesis/params.proto", fileDescriptor_a8d0b00d1bcc9c95) } - -var fileDescriptor_a8d0b00d1bcc9c95 = []byte{ - // 280 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xc8, 0x28, 0x4d, 0xd2, - 0x4d, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, - 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x2e, 0xca, 0xcf, 0xc9, 0x49, 0x2c, 0x28, 0xd0, 0xcb, 0x28, - 0x4d, 0x8a, 0x87, 0xaa, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xcb, 0xeb, 0x83, 0x58, 0x10, - 0xa5, 0x4a, 0x2b, 0x18, 0xb9, 0xd8, 0x02, 0xc0, 0x7a, 0x85, 0xa6, 0x33, 0x72, 0x49, 0x43, 0x15, - 0xc7, 0x97, 0x14, 0x65, 0xa6, 0xa7, 0xa7, 0x16, 0xa5, 0x16, 0xc5, 0x27, 0xe6, 0xe4, 0xe4, 0x97, - 0xe7, 0x64, 0x16, 0x97, 0x48, 0x30, 0x2a, 0x30, 0x6b, 0x70, 0x1b, 0x69, 0xeb, 0x61, 0x31, 0x5c, - 0xcf, 0x1d, 0x42, 0x87, 0xc0, 0xb4, 0x41, 0x8c, 0x74, 0xd2, 0x3a, 0x71, 0x4f, 0x9e, 0xe1, 0xd3, - 0x3d, 0x79, 0xa5, 0xca, 0xc4, 0xdc, 0x1c, 0x2b, 0x25, 0x3c, 0xa6, 0x2b, 0x05, 0x49, 0xa6, 0xa3, - 0x99, 0xe1, 0x08, 0x93, 0xb3, 0x62, 0x99, 0xb1, 0x40, 0x9e, 0x41, 0xc9, 0x8d, 0x4b, 0x0c, 0xbb, - 0x35, 0x42, 0x3a, 0x5c, 0xec, 0x89, 0x29, 0x29, 0x45, 0xa9, 0xc5, 0xc5, 0x12, 0x8c, 0x0a, 0x8c, - 0x1a, 0x9c, 0x4e, 0x42, 0x9f, 0xee, 0xc9, 0xf3, 0x41, 0xec, 0x84, 0x4a, 0x28, 0x05, 0xc1, 0x94, - 0x38, 0x05, 0x9f, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, - 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x65, 0x7a, 0x66, - 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x4a, 0x65, 0x6e, 0x6a, 0x5e, 0x71, 0x66, - 0x7e, 0x5e, 0x45, 0x65, 0x15, 0x82, 0xa3, 0x5b, 0x94, 0x92, 0xad, 0x5f, 0xa1, 0x8f, 0x1c, 0xf2, - 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0xe0, 0x34, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, - 0xaa, 0x00, 0x8d, 0x77, 0x95, 0x01, 0x00, 0x00, -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.GenesisTriggererAllowlist) > 0 { - for iNdEx := len(m.GenesisTriggererAllowlist) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.GenesisTriggererAllowlist[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintParams(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *GenesisTriggererParams) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GenesisTriggererParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisTriggererParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintParams(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintParams(dAtA []byte, offset int, v uint64) int { - offset -= sovParams(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.GenesisTriggererAllowlist) > 0 { - for _, e := range m.GenesisTriggererAllowlist { - l = e.Size() - n += 1 + l + sovParams(uint64(l)) - } - } - return n -} - -func (m *GenesisTriggererParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } - return n -} - -func sovParams(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozParams(x uint64) (n int) { - return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GenesisTriggererAllowlist", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.GenesisTriggererAllowlist = append(m.GenesisTriggererAllowlist, GenesisTriggererParams{}) - if err := m.GenesisTriggererAllowlist[len(m.GenesisTriggererAllowlist)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipParams(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthParams - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GenesisTriggererParams) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GenesisTriggererParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisTriggererParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipParams(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthParams - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipParams(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthParams - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupParams - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthParams - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/hub-genesis/types/query.pb.go b/x/hub-genesis/types/query.pb.go index a1a82d10..f8733b8a 100644 --- a/x/hub-genesis/types/query.pb.go +++ b/x/hub-genesis/types/query.pb.go @@ -29,89 +29,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// QueryParamsRequest is the request type for the Query/Params RPC method. -type QueryParamsRequest struct { -} - -func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } -func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamsRequest) ProtoMessage() {} -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_361b89f8abfb35e2, []int{0} -} -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) -} -func (m *QueryParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo - -// QueryParamsResponse is the response type for the Query/Params RPC method. -type QueryParamsResponse struct { - // params defines the parameters of the module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` -} - -func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } -func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryParamsResponse) ProtoMessage() {} -func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_361b89f8abfb35e2, []int{1} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -func (m *QueryParamsResponse) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - // QueryStateRequest is the request type for the Query/State RPC method. type QueryStateRequest struct { } @@ -120,7 +37,7 @@ func (m *QueryStateRequest) Reset() { *m = QueryStateRequest{} } func (m *QueryStateRequest) String() string { return proto.CompactTextString(m) } func (*QueryStateRequest) ProtoMessage() {} func (*QueryStateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_361b89f8abfb35e2, []int{2} + return fileDescriptor_361b89f8abfb35e2, []int{0} } func (m *QueryStateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -159,7 +76,7 @@ func (m *QueryStateResponse) Reset() { *m = QueryStateResponse{} } func (m *QueryStateResponse) String() string { return proto.CompactTextString(m) } func (*QueryStateResponse) ProtoMessage() {} func (*QueryStateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_361b89f8abfb35e2, []int{3} + return fileDescriptor_361b89f8abfb35e2, []int{1} } func (m *QueryStateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -196,8 +113,6 @@ func (m *QueryStateResponse) GetState() State { } func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "rollapp.hub_genesis.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "rollapp.hub_genesis.QueryParamsResponse") proto.RegisterType((*QueryStateRequest)(nil), "rollapp.hub_genesis.QueryStateRequest") proto.RegisterType((*QueryStateResponse)(nil), "rollapp.hub_genesis.QueryStateResponse") } @@ -205,30 +120,25 @@ func init() { func init() { proto.RegisterFile("hub-genesis/query.proto", fileDescriptor_361b89f8abfb35e2) } var fileDescriptor_361b89f8abfb35e2 = []byte{ - // 361 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xb1, 0x4e, 0x3a, 0x31, - 0x1c, 0xc7, 0xaf, 0xe4, 0x0f, 0x43, 0xff, 0x93, 0x85, 0x44, 0x72, 0x9a, 0xd3, 0xdc, 0x20, 0x2c, - 0x5c, 0x0d, 0x46, 0x12, 0x56, 0x66, 0x07, 0x84, 0xcd, 0xc5, 0xf4, 0xa4, 0x39, 0x2e, 0x42, 0x5b, - 0xae, 0xbd, 0x84, 0x73, 0xf4, 0x05, 0x34, 0xe1, 0x41, 0x7c, 0x0d, 0x46, 0x12, 0x17, 0x27, 0x63, - 0xc0, 0x07, 0x31, 0xb4, 0x25, 0x42, 0x40, 0x71, 0x83, 0xfe, 0xbe, 0xbf, 0xef, 0xe7, 0x73, 0xbd, - 0x83, 0x87, 0xfd, 0x34, 0xac, 0x45, 0x94, 0x51, 0x19, 0x4b, 0x3c, 0x4a, 0x69, 0x92, 0x05, 0x22, - 0xe1, 0x8a, 0xa3, 0x62, 0xc2, 0x07, 0x03, 0x22, 0x44, 0xd0, 0x4f, 0xc3, 0x5b, 0x1b, 0x70, 0x4b, - 0x11, 0x8f, 0xb8, 0x9e, 0xe3, 0xe5, 0x2f, 0x13, 0x75, 0x8f, 0x23, 0xce, 0xa3, 0x01, 0xc5, 0x44, - 0xc4, 0x98, 0x30, 0xc6, 0x15, 0x51, 0x31, 0x67, 0xd2, 0x4e, 0xcb, 0xeb, 0x04, 0x41, 0x12, 0x32, - 0x5c, 0x4d, 0x36, 0xd8, 0x52, 0x11, 0x45, 0xcd, 0xc0, 0x2f, 0x41, 0x74, 0xbd, 0x54, 0x69, 0xeb, - 0x74, 0x87, 0x8e, 0x52, 0x2a, 0x95, 0xdf, 0x86, 0xc5, 0x8d, 0x53, 0x29, 0x38, 0x93, 0x14, 0x35, - 0x61, 0xc1, 0xb4, 0x96, 0xc1, 0x29, 0xa8, 0xfe, 0xaf, 0x1f, 0x05, 0x3b, 0xcc, 0x03, 0xb3, 0xd4, - 0xfa, 0x37, 0x7d, 0x3f, 0x71, 0x3a, 0x76, 0xc1, 0x2f, 0xc2, 0x03, 0xdd, 0xd8, 0x5d, 0xb2, 0x57, - 0x98, 0x2b, 0x0b, 0xb7, 0x87, 0x96, 0xd2, 0x80, 0x79, 0x6d, 0x68, 0x21, 0xee, 0x4e, 0x88, 0x5e, - 0xb1, 0x0c, 0x13, 0xaf, 0xbf, 0xe4, 0x60, 0x5e, 0xd7, 0xa1, 0x09, 0x80, 0x05, 0x63, 0x81, 0x2a, - 0x3b, 0xb7, 0xb7, 0x1f, 0xd9, 0xad, 0xee, 0x0f, 0x1a, 0x3f, 0xbf, 0xf1, 0xf8, 0xfa, 0x39, 0xc9, - 0x9d, 0xa3, 0x00, 0xf7, 0xb2, 0x21, 0x65, 0x32, 0xe6, 0x6c, 0x9c, 0x3d, 0x7c, 0xff, 0xa9, 0x25, - 0xbd, 0x7b, 0xbc, 0xfd, 0x26, 0xd0, 0x13, 0x80, 0x79, 0xad, 0x8d, 0xce, 0x7e, 0x66, 0xad, 0xdf, - 0x8f, 0x5b, 0xd9, 0x9b, 0xb3, 0x4a, 0x97, 0x5a, 0x09, 0xa3, 0xda, 0x5f, 0x95, 0xf4, 0x8d, 0xb5, - 0xba, 0xd3, 0xb9, 0x07, 0x66, 0x73, 0x0f, 0x7c, 0xcc, 0x3d, 0xf0, 0xbc, 0xf0, 0x9c, 0xd9, 0xc2, - 0x73, 0xde, 0x16, 0x9e, 0x73, 0xd3, 0x8c, 0x62, 0xd5, 0x4f, 0xc3, 0xe0, 0x8e, 0x0f, 0x7f, 0xab, - 0x1c, 0x6f, 0x94, 0xaa, 0x4c, 0x50, 0x19, 0x16, 0xf4, 0x87, 0x75, 0xf1, 0x15, 0x00, 0x00, 0xff, - 0xff, 0x4a, 0x6a, 0xbc, 0x50, 0xef, 0x02, 0x00, 0x00, + // 287 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcf, 0x28, 0x4d, 0xd2, + 0x4d, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, + 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x2e, 0xca, 0xcf, 0xc9, 0x49, 0x2c, 0x28, 0xd0, 0xcb, 0x28, 0x4d, + 0x8a, 0x87, 0x2a, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xcb, 0xeb, 0x83, 0x58, 0x10, 0xa5, + 0x52, 0x32, 0xe9, 0xf9, 0xf9, 0xe9, 0x39, 0xa9, 0xfa, 0x89, 0x05, 0x99, 0xfa, 0x89, 0x79, 0x79, + 0xf9, 0x25, 0x89, 0x25, 0x99, 0xf9, 0x79, 0xc5, 0x50, 0x59, 0x14, 0x1b, 0x8a, 0x4b, 0x12, 0x4b, + 0x52, 0x21, 0x12, 0x4a, 0xc2, 0x5c, 0x82, 0x81, 0x20, 0x0b, 0x83, 0x41, 0x62, 0x41, 0xa9, 0x85, + 0xa5, 0xa9, 0xc5, 0x25, 0x4a, 0x3e, 0x5c, 0x42, 0xc8, 0x82, 0xc5, 0x05, 0xf9, 0x79, 0xc5, 0xa9, + 0x42, 0x66, 0x5c, 0xac, 0x60, 0x9d, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x52, 0x7a, 0x58, + 0x1c, 0xa7, 0x07, 0xd6, 0xe2, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x44, 0xb9, 0xd1, 0x4c, + 0x46, 0x2e, 0x56, 0xb0, 0x71, 0x42, 0xfd, 0x8c, 0x5c, 0xac, 0x60, 0x05, 0x42, 0x6a, 0x58, 0x35, + 0x63, 0xb8, 0x44, 0x4a, 0x9d, 0xa0, 0x3a, 0x88, 0xe3, 0x94, 0x4c, 0x9b, 0x2e, 0x3f, 0x99, 0xcc, + 0xa4, 0x2f, 0xa4, 0xab, 0x9f, 0x52, 0x99, 0x9b, 0x9a, 0x57, 0x9c, 0x99, 0x9f, 0x57, 0x51, 0x59, + 0x85, 0xe0, 0xe8, 0x16, 0xa5, 0x64, 0xeb, 0x63, 0x04, 0x82, 0x53, 0xf0, 0x89, 0x47, 0x72, 0x8c, + 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, + 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x59, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, + 0xe7, 0xe2, 0x33, 0xb2, 0x02, 0xc5, 0xd0, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0x70, 0xd0, + 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x08, 0x19, 0x55, 0xd6, 0xd7, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -243,8 +153,6 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - // Params returns the total set of hub-genesis parameters. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // State returns the state of the genesis event. State(ctx context.Context, in *QueryStateRequest, opts ...grpc.CallOption) (*QueryStateResponse, error) } @@ -257,15 +165,6 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/rollapp.hub_genesis.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) State(ctx context.Context, in *QueryStateRequest, opts ...grpc.CallOption) (*QueryStateResponse, error) { out := new(QueryStateResponse) err := c.cc.Invoke(ctx, "/rollapp.hub_genesis.Query/State", in, out, opts...) @@ -277,8 +176,6 @@ func (c *queryClient) State(ctx context.Context, in *QueryStateRequest, opts ... // QueryServer is the server API for Query service. type QueryServer interface { - // Params returns the total set of hub-genesis parameters. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // State returns the state of the genesis event. State(context.Context, *QueryStateRequest) (*QueryStateResponse, error) } @@ -287,9 +184,6 @@ type QueryServer interface { type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} func (*UnimplementedQueryServer) State(ctx context.Context, req *QueryStateRequest) (*QueryStateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method State not implemented") } @@ -298,24 +192,6 @@ func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rollapp.hub_genesis.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_State_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryStateRequest) if err := dec(in); err != nil { @@ -338,10 +214,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "rollapp.hub_genesis.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, { MethodName: "State", Handler: _Query_State_Handler, @@ -351,62 +223,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Metadata: "hub-genesis/query.proto", } -func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - func (m *QueryStateRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -474,26 +290,6 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - func (m *QueryStateRequest) Size() (n int) { if m == nil { return 0 @@ -520,139 +316,6 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *QueryStateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/hub-genesis/types/query.pb.gw.go b/x/hub-genesis/types/query.pb.gw.go index 16c5d1a9..609f1662 100644 --- a/x/hub-genesis/types/query.pb.gw.go +++ b/x/hub-genesis/types/query.pb.gw.go @@ -33,24 +33,6 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_State_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryStateRequest var metadata runtime.ServerMetadata @@ -75,29 +57,6 @@ func local_request_Query_State_0(ctx context.Context, marshaler runtime.Marshale // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_State_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -162,26 +121,6 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_State_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -206,13 +145,9 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"dymensionxyz", "dymension-rdk", "hub-genesis", "params"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_State_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"dymensionxyz", "dymension-rdk", "hub-genesis", "state"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage - forward_Query_State_0 = runtime.ForwardResponseMessage ) diff --git a/x/hub-genesis/types/state.pb.go b/x/hub-genesis/types/state.pb.go index 5df134aa..aa54cc6e 100644 --- a/x/hub-genesis/types/state.pb.go +++ b/x/hub-genesis/types/state.pb.go @@ -29,7 +29,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type State struct { // is_locked is a boolean that indicates if the genesis event has occured IsLocked bool `protobuf:"varint,1,opt,name=is_locked,json=isLocked,proto3" json:"is_locked,omitempty"` - // genesis_tokens is the list of tokens that are expected to be locked on genesis event + // genesis_tokens is the list of tokens that are expected to be locked on + // genesis event GenesisTokens github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=genesis_tokens,json=genesisTokens,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"genesis_tokens"` } diff --git a/x/sequencers/client/cli/query.go b/x/sequencers/client/cli/query.go index 72e73610..4d9a11bc 100644 --- a/x/sequencers/client/cli/query.go +++ b/x/sequencers/client/cli/query.go @@ -22,6 +22,7 @@ func GetQueryCmd() *cobra.Command { } cmd.AddCommand(CmdQueryParams()) + cmd.AddCommand(CmdQueryPermissions()) cmd.AddCommand(CmdQuerySequencers()) cmd.AddCommand(CmdQuerySequencer()) diff --git a/x/sequencers/client/cli/query_permissions.go b/x/sequencers/client/cli/query_permissions.go new file mode 100644 index 00000000..b1a763be --- /dev/null +++ b/x/sequencers/client/cli/query_permissions.go @@ -0,0 +1,43 @@ +package cli + +import ( + "context" + + "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/dymensionxyz/dymension-rdk/x/sequencers/types" + "github.com/spf13/cobra" +) + +func CmdQueryPermissions() *cobra.Command { + cmd := &cobra.Command{ + Use: "address-permissions [address]", + Short: "shows the address's permission", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + address := args[0] + if _, err := sdk.AccAddressFromBech32(address); err != nil { + return errors.Wrapf(err, "address format error") + } + + res, err := queryClient.Permissions(context.Background(), &types.QueryPermissionsRequest{ + Address: address, + }) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/sequencers/keeper/genesis.go b/x/sequencers/keeper/genesis.go index db49a5a0..1837f85a 100644 --- a/x/sequencers/keeper/genesis.go +++ b/x/sequencers/keeper/genesis.go @@ -25,6 +25,14 @@ func (k *Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) []abc } k.DeleteSequencer(ctx, seq) + for _, addressPermission := range genState.AddressPermissions { + address, err := sdk.AccAddressFromBech32(addressPermission.Address) + if err != nil { + panic(err) + } + k.GrantPermissions(ctx, address, addressPermission.GetPermissionList()) + } + pubkey, err := seq.ConsPubKey() if err != nil { panic(err) diff --git a/x/sequencers/keeper/grpc_query.go b/x/sequencers/keeper/grpc_query.go index 8732259c..71243e5c 100644 --- a/x/sequencers/keeper/grpc_query.go +++ b/x/sequencers/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "strings" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/dymensionxyz/dymension-rdk/x/sequencers/types" @@ -25,6 +26,24 @@ func (k Querier) Params(c context.Context, req *types.QueryParamsRequest) (*type return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil } +// Permissions queries all the permissions for the given address. +func (k Querier) Permissions(c context.Context, req *types.QueryPermissionsRequest) (*types.QueryPermissionsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + accAddress, err := sdk.AccAddressFromBech32(req.Address) + if err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + permissionList := k.GetPermissionList(ctx, accAddress) + return &types.QueryPermissionsResponse{ + Permissions: strings.Join(permissionList.Permissions, "\n"), + }, nil +} + // Sequencers queries all sequencers that match the given status. func (k Querier) Sequencers(c context.Context, req *types.QuerySequencersRequest) (*types.QuerySequencersResponse, error) { if req == nil { diff --git a/x/sequencers/keeper/grpc_query_test.go b/x/sequencers/keeper/grpc_query_test.go index dbce577c..77180390 100644 --- a/x/sequencers/keeper/grpc_query_test.go +++ b/x/sequencers/keeper/grpc_query_test.go @@ -23,3 +23,26 @@ func TestParamsQuery(t *testing.T) { require.NoError(t, err) require.Equal(t, &types.QueryParamsResponse{Params: types.DefaultParams()}, response) } + +func TestPermissionsQuery(t *testing.T) { + app := utils.Setup(t, false) + k, ctx := testkeepers.NewTestSequencerKeeperFromApp(app) + q := keeper.Querier{Keeper: *k} + + wctx := sdk.WrapSDKContext(ctx) + + accAddr := utils.AccAddress() + + request := &types.QueryPermissionsRequest{ + Address: sdk.MustBech32ifyAddressBytes(sdk.Bech32PrefixAccAddr, accAddr), + } + + response, err := q.Permissions(wctx, request) + require.NoError(t, err) + require.Equal(t, &types.QueryPermissionsResponse{Permissions: ""}, response) + + k.GrantPermissions(ctx, accAddr, types.NewPermissionsList([]string{"test1", "test2"})) + response, err = q.Permissions(wctx, request) + require.NoError(t, err) + require.Equal(t, &types.QueryPermissionsResponse{Permissions: "test1\ntest2"}, response) +} diff --git a/x/sequencers/keeper/permission.go b/x/sequencers/keeper/permission.go new file mode 100644 index 00000000..fd2c7692 --- /dev/null +++ b/x/sequencers/keeper/permission.go @@ -0,0 +1,62 @@ +package keeper + +import ( + "slices" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/dymensionxyz/dymension-rdk/x/sequencers/types" +) + +func (k Keeper) GetPermissionList(ctx sdk.Context, accAddr sdk.AccAddress) types.PermissionList { + store := ctx.KVStore(k.storeKey) + keys := types.GetAddressPermissionsKey(accAddr) + bz := store.Get(keys) + if bz == nil { + return types.EmptyPermissionList() + } + + var perms types.PermissionList + k.cdc.MustUnmarshal(bz, &perms) + return perms +} + +func (k Keeper) HasPermission(ctx sdk.Context, accAddr sdk.AccAddress, permission string) bool { + permissions := k.GetPermissionList(ctx, accAddr).Permissions + + return slices.Contains(permissions, permission) +} + +func (k Keeper) GrantPermissions(ctx sdk.Context, accAddr sdk.AccAddress, grantPermList types.PermissionList) { + perms := k.GetPermissionList(ctx, accAddr).Permissions + + newPerms := append(perms, grantPermList.Permissions...) + slices.Sort(newPerms) + newPermissionList := types.NewPermissionsList(slices.Compact(newPerms)) + + bz := k.cdc.MustMarshal(&newPermissionList) + store := ctx.KVStore(k.storeKey) + store.Set(types.GetAddressPermissionsKey(accAddr), bz) +} + +func (k Keeper) RevokePermissions(ctx sdk.Context, accAddr sdk.AccAddress, revokePermList types.PermissionList) { + store := ctx.KVStore(k.storeKey) + permissionList := k.GetPermissionList(ctx, accAddr) + + newPerms := slices.DeleteFunc(permissionList.Permissions, func(perm string) bool { + return slices.Contains(revokePermList.Permissions, perm) + }) + if len(newPerms) == 0 { + store.Delete(types.GetAddressPermissionsKey(accAddr)) + return + } + + slices.Sort(newPerms) + newPermList := types.NewPermissionsList(newPerms) + bz := k.cdc.MustMarshal(&newPermList) + store.Set(types.GetAddressPermissionsKey(accAddr), bz) +} + +func (k Keeper) RevokeAllPermissions(ctx sdk.Context, accAddr sdk.AccAddress) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.GetAddressPermissionsKey(accAddr)) +} diff --git a/x/sequencers/keeper/permission_test.go b/x/sequencers/keeper/permission_test.go new file mode 100644 index 00000000..f6a79ce4 --- /dev/null +++ b/x/sequencers/keeper/permission_test.go @@ -0,0 +1,54 @@ +package keeper_test + +import ( + "testing" + + testkeepers "github.com/dymensionxyz/dymension-rdk/testutil/keepers" + "github.com/dymensionxyz/dymension-rdk/testutil/utils" + "github.com/dymensionxyz/dymension-rdk/x/sequencers/types" + "github.com/stretchr/testify/assert" +) + +func TestGrantRevokePermissions(t *testing.T) { + app := utils.Setup(t, false) + k, ctx := testkeepers.NewTestSequencerKeeperFromApp(app) + + accAddr := utils.AccAddress() + accAddr2 := utils.AccAddress() + + // Grant the permissions and make sure that the store will save them ordered + k.GrantPermissions(ctx, accAddr, types.NewPermissionsList([]string{"test3", "test1", "test2", "abc"})) + + permissions := k.GetPermissionList(ctx, accAddr) + assert.Equal(t, permissions.Permissions, []string{"abc", "test1", "test2", "test3"}) + + // Grant existed permissions + k.GrantPermissions(ctx, accAddr, types.NewPermissionsList([]string{"test3", "test1", "test4"})) + permissions = k.GetPermissionList(ctx, accAddr) + assert.Equal(t, permissions.Permissions, []string{"abc", "test1", "test2", "test3", "test4"}) + + // Grant to different account address, make sure original permissions not changed + k.GrantPermissions(ctx, accAddr2, types.NewPermissionsList([]string{"diff-test"})) + permissions = k.GetPermissionList(ctx, accAddr) + assert.Equal(t, permissions.Permissions, []string{"abc", "test1", "test2", "test3", "test4"}) + + // Revoke permissions + k.RevokePermissions(ctx, accAddr, types.NewPermissionsList([]string{"test1", "test2"})) + permissions = k.GetPermissionList(ctx, accAddr) + assert.Equal(t, permissions.Permissions, []string{"abc", "test3", "test4"}) + + // Revoke non exist permissions and make sure it doesn't panic + k.RevokePermissions(ctx, accAddr, types.NewPermissionsList([]string{"diff-test"})) + permissions = k.GetPermissionList(ctx, accAddr) + assert.Equal(t, permissions.Permissions, []string{"abc", "test3", "test4"}) + + // Revoke all permissions and check if the store delete account address + k.RevokePermissions(ctx, accAddr2, types.NewPermissionsList([]string{"diff-test"})) + permissions = k.GetPermissionList(ctx, accAddr2) + assert.Equal(t, permissions, types.EmptyPermissionList()) + + // Revoke permissions from non-permissions account + k.RevokePermissions(ctx, accAddr2, types.NewPermissionsList([]string{"diff-test"})) + permissions = k.GetPermissionList(ctx, accAddr2) + assert.Equal(t, permissions, types.EmptyPermissionList()) +} \ No newline at end of file diff --git a/x/sequencers/proposal_handler.go b/x/sequencers/proposal_handler.go new file mode 100644 index 00000000..9ec0f919 --- /dev/null +++ b/x/sequencers/proposal_handler.go @@ -0,0 +1,57 @@ +package sequencers + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + "github.com/dymensionxyz/dymension-rdk/x/sequencers/keeper" + "github.com/dymensionxyz/dymension-rdk/x/sequencers/types" +) + +func NewUpdatePermissionProposalHandler(k *keeper.Keeper) govtypes.Handler { + return func(ctx sdk.Context, content govtypes.Content) error { + switch c := content.(type) { + case *types.GrantPermissionsProposal: + return HandleGrantPermissionsProposal(ctx, k, c) + case *types.RevokePermissionsProposal: + return HandleRevokePermissionsProposal(ctx, k, c) + default: + return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized permissions proposal content type: %T", c) + } + } +} + +// HandleGrantPermissionsProposal is a handler for executing a grant permissions proposal +func HandleGrantPermissionsProposal(ctx sdk.Context, k *keeper.Keeper, p *types.GrantPermissionsProposal) error { + if err := p.ValidateBasic(); err != nil { + return err + } + + for _, addrPerms := range p.AddressPermissions { + accAddr, err := sdk.AccAddressFromBech32(addrPerms.Address) + if err != nil { + return err + } + + k.GrantPermissions(ctx, accAddr, addrPerms.PermissionList) + } + return nil +} + +// HandleRevokePermissionsProposal is a handler for executing a revoke permissions proposal +func HandleRevokePermissionsProposal(ctx sdk.Context, k *keeper.Keeper, p *types.RevokePermissionsProposal) error { + if err := p.ValidateBasic(); err != nil { + return err + } + + for _, addrPerms := range p.AddressPermissions { + accAddr, err := sdk.AccAddressFromBech32(addrPerms.Address) + if err != nil { + return err + } + + k.RevokePermissions(ctx, accAddr, addrPerms.PermissionList) + } + return nil +} diff --git a/x/sequencers/types/genesis.go b/x/sequencers/types/genesis.go index 53afe4ba..a6446f26 100644 --- a/x/sequencers/types/genesis.go +++ b/x/sequencers/types/genesis.go @@ -9,10 +9,13 @@ import ( // DefaultIndex is the default capability global index const DefaultIndex uint64 = 1 +var DefaultAddressPermissions = []AddressPermissions{} // no one allowed + // DefaultGenesis returns the default Capability genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ - Params: DefaultParams(), + Params: DefaultParams(), + AddressPermissions: DefaultAddressPermissions, } } @@ -22,6 +25,12 @@ func (gs GenesisState) ValidateGenesis() error { return err } + for _, accPerms := range gs.AddressPermissions { + if err := accPerms.Validate(); err != nil { + return err + } + } + _, err = sdk.ValAddressFromBech32(gs.GenesisOperatorAddress) if err != nil { return fmt.Errorf("genesis operator address is invalid: %w", err) diff --git a/x/sequencers/types/genesis.pb.go b/x/sequencers/types/genesis.pb.go index 61a057cc..123d666a 100644 --- a/x/sequencers/types/genesis.pb.go +++ b/x/sequencers/types/genesis.pb.go @@ -26,9 +26,12 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the test module's genesis state. type GenesisState struct { Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + // the address and its permissions to trigger some special actions + // on the rollapp + AddressPermissions []AddressPermissions `protobuf:"bytes,2,rep,name=address_permissions,json=addressPermissions,proto3" json:"address_permissions" yaml:"address_permissions"` // genesis_operator_address defines the genesis operator address of the // sequencer. - GenesisOperatorAddress string `protobuf:"bytes,2,opt,name=genesis_operator_address,json=genesisOperatorAddress,proto3" json:"genesis_operator_address,omitempty"` + GenesisOperatorAddress string `protobuf:"bytes,3,opt,name=genesis_operator_address,json=genesisOperatorAddress,proto3" json:"genesis_operator_address,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -71,6 +74,13 @@ func (m *GenesisState) GetParams() Params { return Params{} } +func (m *GenesisState) GetAddressPermissions() []AddressPermissions { + if m != nil { + return m.AddressPermissions + } + return nil +} + func (m *GenesisState) GetGenesisOperatorAddress() string { if m != nil { return m.GenesisOperatorAddress @@ -85,23 +95,27 @@ func init() { func init() { proto.RegisterFile("sequencers/genesis.proto", fileDescriptor_56ef324f83e482d4) } var fileDescriptor_56ef324f83e482d4 = []byte{ - // 246 bytes of a gzipped FileDescriptorProto + // 309 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x28, 0x4e, 0x2d, 0x2c, 0x4d, 0xcd, 0x4b, 0x4e, 0x2d, 0x2a, 0xd6, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x28, 0xca, 0xcf, 0xc9, 0x49, 0x2c, 0x28, 0xd0, 0x43, 0xa8, 0xd0, 0x2b, 0xa9, 0x2c, 0x48, 0x2d, 0x96, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, 0xd2, 0x07, - 0xb1, 0x20, 0xea, 0xa5, 0xc4, 0x91, 0x4c, 0x2a, 0x48, 0x2c, 0x4a, 0xcc, 0x85, 0x1a, 0xa4, 0xd4, - 0xc1, 0xc8, 0xc5, 0xe3, 0x0e, 0x31, 0x3a, 0xb8, 0x24, 0xb1, 0x24, 0x55, 0xc8, 0x8e, 0x8b, 0x0d, - 0xa2, 0x40, 0x82, 0x51, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x41, 0x0f, 0x97, 0x55, 0x7a, 0x01, 0x60, - 0x75, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x41, 0x75, 0x09, 0x59, 0x70, 0x49, 0x40, 0x9d, - 0x1a, 0x9f, 0x5f, 0x90, 0x5a, 0x94, 0x58, 0x92, 0x5f, 0x14, 0x9f, 0x98, 0x92, 0x52, 0x94, 0x5a, - 0x5c, 0x2c, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0x19, 0x24, 0x06, 0x95, 0xf7, 0x87, 0x4a, 0x3b, 0x42, - 0x64, 0x9d, 0x82, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, - 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x22, 0x3d, - 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x3f, 0xa5, 0x32, 0x37, 0x35, 0xaf, 0x38, - 0x33, 0x3f, 0xaf, 0xa2, 0xb2, 0x0a, 0xc1, 0xd1, 0x2d, 0x4a, 0xc9, 0xd6, 0xaf, 0xd0, 0x47, 0xf2, - 0x25, 0xd8, 0x89, 0x49, 0x6c, 0x60, 0x5f, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x41, 0xd4, - 0x1f, 0x75, 0x4a, 0x01, 0x00, 0x00, + 0xb1, 0x20, 0xea, 0xa5, 0xc4, 0x91, 0x4c, 0x2a, 0x48, 0x2c, 0x4a, 0xcc, 0x85, 0x1a, 0x24, 0x25, + 0x8d, 0x2c, 0x91, 0x5a, 0x94, 0x9b, 0x59, 0x5c, 0x9c, 0x99, 0x9f, 0x07, 0x91, 0x54, 0xea, 0x61, + 0xe2, 0xe2, 0x71, 0x87, 0xd8, 0x1b, 0x5c, 0x92, 0x58, 0x92, 0x2a, 0x64, 0xc7, 0xc5, 0x06, 0xd1, + 0x2d, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x6d, 0xa4, 0xa0, 0x87, 0xcb, 0x1d, 0x7a, 0x01, 0x60, 0x75, + 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x41, 0x75, 0x09, 0x35, 0x32, 0x72, 0x09, 0x27, 0xa6, + 0xa4, 0x14, 0xa5, 0x16, 0x17, 0xc7, 0x23, 0x6c, 0x2b, 0x96, 0x60, 0x52, 0x60, 0xd6, 0xe0, 0x36, + 0xd2, 0xc1, 0x6d, 0x9a, 0x23, 0x44, 0x53, 0x00, 0x42, 0x8f, 0x93, 0x12, 0xc8, 0xe4, 0x4f, 0xf7, + 0xe4, 0xa5, 0x2a, 0x13, 0x73, 0x73, 0xac, 0x94, 0xb0, 0x18, 0xab, 0x14, 0x24, 0x94, 0x88, 0xa1, + 0x4f, 0xc8, 0x82, 0x4b, 0x02, 0x1a, 0x96, 0xf1, 0xf9, 0x05, 0xa9, 0x45, 0x89, 0x25, 0xf9, 0x45, + 0xf1, 0x50, 0x65, 0x12, 0xcc, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x62, 0x50, 0x79, 0x7f, 0xa8, 0x34, + 0xd4, 0x72, 0xa7, 0xa0, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, + 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xb2, 0x48, + 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xa9, 0xcc, 0x4d, 0xcd, 0x03, + 0x59, 0x55, 0x51, 0x59, 0x85, 0xe0, 0xe8, 0x16, 0xa5, 0x64, 0xeb, 0x57, 0xe8, 0x23, 0x85, 0x36, + 0xd8, 0x63, 0x49, 0x6c, 0xe0, 0x90, 0x36, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xca, 0x51, 0xd2, + 0x61, 0xeb, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -129,7 +143,21 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.GenesisOperatorAddress) i = encodeVarintGenesis(dAtA, i, uint64(len(m.GenesisOperatorAddress))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a + } + if len(m.AddressPermissions) > 0 { + for iNdEx := len(m.AddressPermissions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AddressPermissions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } } { size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) @@ -163,6 +191,12 @@ func (m *GenesisState) Size() (n int) { _ = l l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) + if len(m.AddressPermissions) > 0 { + for _, e := range m.AddressPermissions { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } l = len(m.GenesisOperatorAddress) if l > 0 { n += 1 + l + sovGenesis(uint64(l)) @@ -239,6 +273,40 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AddressPermissions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AddressPermissions = append(m.AddressPermissions, AddressPermissions{}) + if err := m.AddressPermissions[len(m.AddressPermissions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field GenesisOperatorAddress", wireType) } diff --git a/x/sequencers/types/genesis_test.go b/x/sequencers/types/genesis_test.go index 987f88f6..2abe85a2 100644 --- a/x/sequencers/types/genesis_test.go +++ b/x/sequencers/types/genesis_test.go @@ -12,6 +12,7 @@ import ( func TestGenesisState_Validate(t *testing.T) { pk := ed25519.GenPrivKey().PubKey() + accAddr := sdk.AccAddress(pk.Address()) for _, tc := range []struct { desc string @@ -22,6 +23,7 @@ func TestGenesisState_Validate(t *testing.T) { desc: "valid", genState: types.GenesisState{ Params: types.DefaultParams(), + AddressPermissions: types.DefaultAddressPermissions, GenesisOperatorAddress: sdk.ValAddress(pk.Address()).String(), }, valid: true, @@ -35,7 +37,43 @@ func TestGenesisState_Validate(t *testing.T) { desc: "not a val address", genState: types.GenesisState{ Params: types.DefaultParams(), - GenesisOperatorAddress: sdk.AccAddress(pk.Address()).String(), + GenesisOperatorAddress: accAddr.String(), + }, + valid: false, + }, + { + desc: "empty operator address", + genState: types.GenesisState{ + Params: types.DefaultParams(), + GenesisOperatorAddress: "", + }, + valid: false, + }, + { + desc: "empty address in address permissions", + genState: types.GenesisState{ + Params: types.DefaultParams(), + AddressPermissions: []types.AddressPermissions{ + { + Address: "", + PermissionList: types.PermissionList{ + Permissions: []string{"test"}, + }, + }, + }, + }, + valid: false, + }, + { + desc: "invalid permission list", + genState: types.GenesisState{ + Params: types.DefaultParams(), + AddressPermissions: []types.AddressPermissions{ + { + Address: sdk.MustBech32ifyAddressBytes(sdk.Bech32PrefixAccAddr, accAddr), + PermissionList: types.EmptyPermissionList(), + }, + }, }, valid: false, }, diff --git a/x/sequencers/types/gov_permission.pb.go b/x/sequencers/types/gov_permission.pb.go new file mode 100644 index 00000000..2c6aa534 --- /dev/null +++ b/x/sequencers/types/gov_permission.pb.go @@ -0,0 +1,746 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: sequencers/gov_permission.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type GrantPermissionsProposal struct { + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + AddressPermissions []AddressPermissions `protobuf:"bytes,3,rep,name=address_permissions,json=addressPermissions,proto3" json:"address_permissions"` +} + +func (m *GrantPermissionsProposal) Reset() { *m = GrantPermissionsProposal{} } +func (*GrantPermissionsProposal) ProtoMessage() {} +func (*GrantPermissionsProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_d40c11f5a74a5529, []int{0} +} +func (m *GrantPermissionsProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GrantPermissionsProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GrantPermissionsProposal.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GrantPermissionsProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_GrantPermissionsProposal.Merge(m, src) +} +func (m *GrantPermissionsProposal) XXX_Size() int { + return m.Size() +} +func (m *GrantPermissionsProposal) XXX_DiscardUnknown() { + xxx_messageInfo_GrantPermissionsProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_GrantPermissionsProposal proto.InternalMessageInfo + +type RevokePermissionsProposal struct { + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + AddressPermissions []AddressPermissions `protobuf:"bytes,3,rep,name=address_permissions,json=addressPermissions,proto3" json:"address_permissions"` +} + +func (m *RevokePermissionsProposal) Reset() { *m = RevokePermissionsProposal{} } +func (*RevokePermissionsProposal) ProtoMessage() {} +func (*RevokePermissionsProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_d40c11f5a74a5529, []int{1} +} +func (m *RevokePermissionsProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RevokePermissionsProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RevokePermissionsProposal.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RevokePermissionsProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_RevokePermissionsProposal.Merge(m, src) +} +func (m *RevokePermissionsProposal) XXX_Size() int { + return m.Size() +} +func (m *RevokePermissionsProposal) XXX_DiscardUnknown() { + xxx_messageInfo_RevokePermissionsProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_RevokePermissionsProposal proto.InternalMessageInfo + +func init() { + proto.RegisterType((*GrantPermissionsProposal)(nil), "rollapp.sequencers.types.GrantPermissionsProposal") + proto.RegisterType((*RevokePermissionsProposal)(nil), "rollapp.sequencers.types.RevokePermissionsProposal") +} + +func init() { proto.RegisterFile("sequencers/gov_permission.proto", fileDescriptor_d40c11f5a74a5529) } + +var fileDescriptor_d40c11f5a74a5529 = []byte{ + // 297 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2f, 0x4e, 0x2d, 0x2c, + 0x4d, 0xcd, 0x4b, 0x4e, 0x2d, 0x2a, 0xd6, 0x4f, 0xcf, 0x2f, 0x8b, 0x2f, 0x48, 0x2d, 0xca, 0xcd, + 0x2c, 0x2e, 0xce, 0xcc, 0xcf, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x28, 0xca, 0xcf, + 0xc9, 0x49, 0x2c, 0x28, 0xd0, 0x43, 0x28, 0xd4, 0x2b, 0xa9, 0x2c, 0x48, 0x2d, 0x96, 0x12, 0x49, + 0xcf, 0x4f, 0xcf, 0x07, 0x2b, 0xd2, 0x07, 0xb1, 0x20, 0xea, 0xa5, 0xa4, 0x91, 0x0c, 0x44, 0x37, + 0x4c, 0xe9, 0x28, 0x23, 0x97, 0x84, 0x7b, 0x51, 0x62, 0x5e, 0x49, 0x00, 0x5c, 0xa6, 0x38, 0xa0, + 0x28, 0xbf, 0x20, 0xbf, 0x38, 0x31, 0x47, 0x48, 0x84, 0x8b, 0xb5, 0x24, 0xb3, 0x24, 0x27, 0x55, + 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, 0x08, 0xc2, 0x11, 0x52, 0xe0, 0xe2, 0x4e, 0x49, 0x2d, 0x4e, + 0x2e, 0xca, 0x2c, 0x28, 0xc9, 0xcc, 0xcf, 0x93, 0x60, 0x02, 0xcb, 0x21, 0x0b, 0x09, 0x25, 0x73, + 0x09, 0x27, 0xa6, 0xa4, 0x14, 0xa5, 0x16, 0x17, 0x23, 0xb9, 0xbe, 0x58, 0x82, 0x59, 0x81, 0x59, + 0x83, 0xdb, 0x48, 0x47, 0x0f, 0x97, 0xfb, 0xf5, 0x1c, 0x21, 0x9a, 0x90, 0x9c, 0xe2, 0xc4, 0x72, + 0xe2, 0x9e, 0x3c, 0x43, 0x90, 0x50, 0x22, 0x86, 0x8c, 0x15, 0x4f, 0xc7, 0x02, 0x79, 0x86, 0x19, + 0x0b, 0xe4, 0x19, 0x5e, 0x2c, 0x90, 0x67, 0x54, 0x3a, 0xc6, 0xc8, 0x25, 0x19, 0x94, 0x5a, 0x96, + 0x9f, 0x9d, 0x3a, 0xb4, 0x3d, 0xe2, 0x14, 0x74, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, + 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, + 0x0c, 0x51, 0x16, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x29, 0x95, + 0xb9, 0xa9, 0x79, 0x20, 0xed, 0x15, 0x95, 0x55, 0x08, 0x8e, 0x6e, 0x51, 0x4a, 0xb6, 0x7e, 0x85, + 0x3e, 0x52, 0x7c, 0x83, 0x9d, 0x93, 0xc4, 0x06, 0x8e, 0x6b, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x87, 0x43, 0xb4, 0x54, 0x5b, 0x02, 0x00, 0x00, +} + +func (this *GrantPermissionsProposal) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GrantPermissionsProposal) + if !ok { + that2, ok := that.(GrantPermissionsProposal) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Title != that1.Title { + return false + } + if this.Description != that1.Description { + return false + } + if len(this.AddressPermissions) != len(that1.AddressPermissions) { + return false + } + for i := range this.AddressPermissions { + if !this.AddressPermissions[i].Equal(&that1.AddressPermissions[i]) { + return false + } + } + return true +} +func (this *RevokePermissionsProposal) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RevokePermissionsProposal) + if !ok { + that2, ok := that.(RevokePermissionsProposal) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Title != that1.Title { + return false + } + if this.Description != that1.Description { + return false + } + if len(this.AddressPermissions) != len(that1.AddressPermissions) { + return false + } + for i := range this.AddressPermissions { + if !this.AddressPermissions[i].Equal(&that1.AddressPermissions[i]) { + return false + } + } + return true +} +func (m *GrantPermissionsProposal) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GrantPermissionsProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GrantPermissionsProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AddressPermissions) > 0 { + for iNdEx := len(m.AddressPermissions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AddressPermissions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGovPermission(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintGovPermission(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintGovPermission(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RevokePermissionsProposal) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RevokePermissionsProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RevokePermissionsProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AddressPermissions) > 0 { + for iNdEx := len(m.AddressPermissions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AddressPermissions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGovPermission(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintGovPermission(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintGovPermission(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintGovPermission(dAtA []byte, offset int, v uint64) int { + offset -= sovGovPermission(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GrantPermissionsProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovGovPermission(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovGovPermission(uint64(l)) + } + if len(m.AddressPermissions) > 0 { + for _, e := range m.AddressPermissions { + l = e.Size() + n += 1 + l + sovGovPermission(uint64(l)) + } + } + return n +} + +func (m *RevokePermissionsProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovGovPermission(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovGovPermission(uint64(l)) + } + if len(m.AddressPermissions) > 0 { + for _, e := range m.AddressPermissions { + l = e.Size() + n += 1 + l + sovGovPermission(uint64(l)) + } + } + return n +} + +func sovGovPermission(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGovPermission(x uint64) (n int) { + return sovGovPermission(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GrantPermissionsProposal) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGovPermission + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GrantPermissionsProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GrantPermissionsProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGovPermission + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGovPermission + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGovPermission + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGovPermission + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGovPermission + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGovPermission + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AddressPermissions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGovPermission + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGovPermission + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGovPermission + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AddressPermissions = append(m.AddressPermissions, AddressPermissions{}) + if err := m.AddressPermissions[len(m.AddressPermissions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGovPermission(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGovPermission + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RevokePermissionsProposal) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGovPermission + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RevokePermissionsProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RevokePermissionsProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGovPermission + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGovPermission + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGovPermission + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGovPermission + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGovPermission + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGovPermission + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AddressPermissions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGovPermission + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGovPermission + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGovPermission + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AddressPermissions = append(m.AddressPermissions, AddressPermissions{}) + if err := m.AddressPermissions[len(m.AddressPermissions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGovPermission(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGovPermission + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGovPermission(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGovPermission + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGovPermission + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGovPermission + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGovPermission + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGovPermission + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGovPermission + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGovPermission = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGovPermission = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGovPermission = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/sequencers/types/keys.go b/x/sequencers/types/keys.go index 83db6d68..93e6f90c 100644 --- a/x/sequencers/types/keys.go +++ b/x/sequencers/types/keys.go @@ -29,7 +29,10 @@ var ( SequencersKey = []byte{0x21} // prefix for each key to a sequencer SequencersByConsAddrKey = []byte{0x22} // prefix for each key to a sequencer index, by pubkey + AddressPermissionsKey = []byte{0x30} // prefix for each key to a permission address + HistoricalInfoKey = []byte{0x50} // prefix for the historical info + ) // GetSequencerKey creates the key for the sequencer with address @@ -42,6 +45,11 @@ func GetSequencerByConsAddrKey(addr sdk.ConsAddress) []byte { return append(SequencersByConsAddrKey, address.MustLengthPrefix(addr)...) } +// GetAddressPermissionsKey creates the key for address's permissions +func GetAddressPermissionsKey(addr sdk.AccAddress) []byte { + return append(AddressPermissionsKey, address.MustLengthPrefix(addr)...) +} + // GetHistoricalInfoKey returns a key prefix for indexing HistoricalInfo objects. func GetHistoricalInfoKey(height int64) []byte { return append(HistoricalInfoKey, []byte(strconv.FormatInt(height, 10))...) diff --git a/x/sequencers/types/permission.go b/x/sequencers/types/permission.go new file mode 100644 index 00000000..97da525e --- /dev/null +++ b/x/sequencers/types/permission.go @@ -0,0 +1,56 @@ +package types + +import ( + "errors" + "fmt" + "slices" + "strings" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (ap *AddressPermissions) Validate() error { + if strings.TrimSpace(ap.Address) == "" { + return errors.New("address field cannot be blank") + } + if _, err := sdk.AccAddressFromBech32(ap.Address); err != nil { + return fmt.Errorf("address format error: %s", err.Error()) + } + + return ap.PermissionList.Validate() +} + +func (p *PermissionList) Validate() error { + if len(p.Permissions) == 0 { + return errors.New("permissions field cannot be empty") + } + perms := p.Permissions + slices.Sort(perms) + perms = slices.Compact(perms) + + // Check if duplicates + if len(perms) != len(p.Permissions) { + return fmt.Errorf("duplicated permission in AddressPermissions") + } + + // Check if permissions list is sorted + if !p.Equal(NewPermissionsList(perms)) { + return fmt.Errorf("PermissionList is not sorted yet") + } + return nil +} + +func EmptyPermissionList() PermissionList { + return PermissionList{ + Permissions: []string{}, + } +} + +func NewPermissionsList(permission []string) PermissionList { + if len(permission) == 0 || permission == nil { + return EmptyPermissionList() + } + return PermissionList{ + Permissions: permission, + } +} diff --git a/x/sequencers/types/permission.pb.go b/x/sequencers/types/permission.pb.go new file mode 100644 index 00000000..4354940c --- /dev/null +++ b/x/sequencers/types/permission.pb.go @@ -0,0 +1,608 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: sequencers/permission.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type AddressPermissions struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` + // list of the module name that addresses have permission to execute msg + PermissionList PermissionList `protobuf:"bytes,2,opt,name=permission_list,json=permissionList,proto3" json:"permission_list" yaml:"permission_list"` +} + +func (m *AddressPermissions) Reset() { *m = AddressPermissions{} } +func (m *AddressPermissions) String() string { return proto.CompactTextString(m) } +func (*AddressPermissions) ProtoMessage() {} +func (*AddressPermissions) Descriptor() ([]byte, []int) { + return fileDescriptor_c76c2ae8ca24ef11, []int{0} +} +func (m *AddressPermissions) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AddressPermissions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AddressPermissions.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AddressPermissions) XXX_Merge(src proto.Message) { + xxx_messageInfo_AddressPermissions.Merge(m, src) +} +func (m *AddressPermissions) XXX_Size() int { + return m.Size() +} +func (m *AddressPermissions) XXX_DiscardUnknown() { + xxx_messageInfo_AddressPermissions.DiscardUnknown(m) +} + +var xxx_messageInfo_AddressPermissions proto.InternalMessageInfo + +func (m *AddressPermissions) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *AddressPermissions) GetPermissionList() PermissionList { + if m != nil { + return m.PermissionList + } + return PermissionList{} +} + +type PermissionList struct { + Permissions []string `protobuf:"bytes,1,rep,name=permissions,proto3" json:"permissions,omitempty" yaml:"permissions"` +} + +func (m *PermissionList) Reset() { *m = PermissionList{} } +func (m *PermissionList) String() string { return proto.CompactTextString(m) } +func (*PermissionList) ProtoMessage() {} +func (*PermissionList) Descriptor() ([]byte, []int) { + return fileDescriptor_c76c2ae8ca24ef11, []int{1} +} +func (m *PermissionList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PermissionList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PermissionList.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PermissionList) XXX_Merge(src proto.Message) { + xxx_messageInfo_PermissionList.Merge(m, src) +} +func (m *PermissionList) XXX_Size() int { + return m.Size() +} +func (m *PermissionList) XXX_DiscardUnknown() { + xxx_messageInfo_PermissionList.DiscardUnknown(m) +} + +var xxx_messageInfo_PermissionList proto.InternalMessageInfo + +func (m *PermissionList) GetPermissions() []string { + if m != nil { + return m.Permissions + } + return nil +} + +func init() { + proto.RegisterType((*AddressPermissions)(nil), "rollapp.sequencers.types.AddressPermissions") + proto.RegisterType((*PermissionList)(nil), "rollapp.sequencers.types.PermissionList") +} + +func init() { proto.RegisterFile("sequencers/permission.proto", fileDescriptor_c76c2ae8ca24ef11) } + +var fileDescriptor_c76c2ae8ca24ef11 = []byte{ + // 291 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2e, 0x4e, 0x2d, 0x2c, + 0x4d, 0xcd, 0x4b, 0x4e, 0x2d, 0x2a, 0xd6, 0x2f, 0x48, 0x2d, 0xca, 0xcd, 0x2c, 0x2e, 0xce, 0xcc, + 0xcf, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x28, 0xca, 0xcf, 0xc9, 0x49, 0x2c, 0x28, + 0xd0, 0x43, 0x28, 0xd2, 0x2b, 0xa9, 0x2c, 0x48, 0x2d, 0x96, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, + 0x2b, 0xd2, 0x07, 0xb1, 0x20, 0xea, 0x95, 0x76, 0x33, 0x72, 0x09, 0x39, 0xa6, 0xa4, 0x14, 0xa5, + 0x16, 0x17, 0x07, 0xc0, 0xcd, 0x2a, 0x16, 0xd2, 0xe1, 0x62, 0x4f, 0x84, 0x88, 0x4a, 0x30, 0x2a, + 0x30, 0x6a, 0x70, 0x3a, 0x09, 0x7d, 0xba, 0x27, 0xcf, 0x57, 0x99, 0x98, 0x9b, 0x63, 0xa5, 0x04, + 0x95, 0x50, 0x0a, 0x82, 0x29, 0x11, 0x2a, 0xe4, 0xe2, 0x47, 0x38, 0x24, 0x3e, 0x27, 0xb3, 0xb8, + 0x44, 0x82, 0x49, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x43, 0x0f, 0x97, 0x73, 0xf4, 0x10, 0xb6, 0xf9, + 0x64, 0x16, 0x97, 0x38, 0xc9, 0x9d, 0xb8, 0x27, 0xcf, 0xf0, 0xe9, 0x9e, 0xbc, 0x18, 0xc4, 0x0e, + 0x34, 0xe3, 0x94, 0x82, 0xf8, 0x0a, 0x50, 0xd4, 0x5b, 0xb1, 0xbc, 0x58, 0x20, 0xcf, 0xa8, 0x14, + 0xc0, 0xc5, 0x87, 0x6a, 0x8e, 0x90, 0x05, 0x17, 0x37, 0x42, 0x25, 0xc8, 0xf1, 0xcc, 0x1a, 0x9c, + 0x4e, 0x62, 0x9f, 0xee, 0xc9, 0x0b, 0xa1, 0x1b, 0x5c, 0xac, 0x14, 0x84, 0xac, 0x14, 0x62, 0xa2, + 0x53, 0xd0, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, + 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x59, 0xa4, 0x67, 0x96, + 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0x54, 0xe6, 0xa6, 0xe6, 0x81, 0xb4, 0x55, + 0x54, 0x56, 0x21, 0x38, 0xba, 0x45, 0x29, 0xd9, 0xfa, 0x15, 0xfa, 0x48, 0xd1, 0x03, 0xf6, 0x6a, + 0x12, 0x1b, 0x38, 0xa8, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x84, 0x15, 0x53, 0x9c, 0xb9, + 0x01, 0x00, 0x00, +} + +func (this *AddressPermissions) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*AddressPermissions) + if !ok { + that2, ok := that.(AddressPermissions) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Address != that1.Address { + return false + } + if !this.PermissionList.Equal(&that1.PermissionList) { + return false + } + return true +} +func (this *PermissionList) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*PermissionList) + if !ok { + that2, ok := that.(PermissionList) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.Permissions) != len(that1.Permissions) { + return false + } + for i := range this.Permissions { + if this.Permissions[i] != that1.Permissions[i] { + return false + } + } + return true +} +func (m *AddressPermissions) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AddressPermissions) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AddressPermissions) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.PermissionList.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPermission(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintPermission(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PermissionList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PermissionList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PermissionList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Permissions) > 0 { + for iNdEx := len(m.Permissions) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Permissions[iNdEx]) + copy(dAtA[i:], m.Permissions[iNdEx]) + i = encodeVarintPermission(dAtA, i, uint64(len(m.Permissions[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintPermission(dAtA []byte, offset int, v uint64) int { + offset -= sovPermission(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *AddressPermissions) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovPermission(uint64(l)) + } + l = m.PermissionList.Size() + n += 1 + l + sovPermission(uint64(l)) + return n +} + +func (m *PermissionList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Permissions) > 0 { + for _, s := range m.Permissions { + l = len(s) + n += 1 + l + sovPermission(uint64(l)) + } + } + return n +} + +func sovPermission(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozPermission(x uint64) (n int) { + return sovPermission(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *AddressPermissions) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPermission + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AddressPermissions: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AddressPermissions: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPermission + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPermission + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPermission + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PermissionList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPermission + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPermission + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPermission + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.PermissionList.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPermission(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPermission + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PermissionList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPermission + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PermissionList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PermissionList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Permissions", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPermission + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPermission + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPermission + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Permissions = append(m.Permissions, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPermission(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPermission + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipPermission(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPermission + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPermission + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPermission + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthPermission + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupPermission + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthPermission + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthPermission = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowPermission = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupPermission = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/sequencers/types/proposal_permission.go b/x/sequencers/types/proposal_permission.go new file mode 100644 index 00000000..db2c8a5c --- /dev/null +++ b/x/sequencers/types/proposal_permission.go @@ -0,0 +1,103 @@ +package types + +import ( + "fmt" + "strings" + + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" +) + +const ( + // ProposalTypeGrantPermissions defines the type for a RevokePermissions + ProposalTypeGrantPermissions = "GrantPermissions" + + // ProposalTypeRevokePermissions defines the type for a RevokePermissions + ProposalTypeRevokePermissions = "RevokePermissions" +) + +// Assert CreateDenomMetadataProposal implements govtypes.Content at compile-time +var ( + _ govtypes.Content = &GrantPermissionsProposal{} + _ govtypes.Content = &RevokePermissionsProposal{} +) + +func init() { + govtypes.RegisterProposalType(ProposalTypeGrantPermissions) + govtypes.RegisterProposalType(ProposalTypeRevokePermissions) +} + +// GetTitle returns the title of a grant permissions proposal. +func (gpp *GrantPermissionsProposal) GetTitle() string { return gpp.Title } + +// GetDescription returns the description of a community pool spend proposal. +func (gpp *GrantPermissionsProposal) GetDescription() string { return gpp.Description } + +// ProposalRoute returns the routing key of a community pool spend proposal. +func (gpp *GrantPermissionsProposal) ProposalRoute() string { return RouterKey } + +// ProposalType returns the type of community pool spend proposal. +func (gpp *GrantPermissionsProposal) ProposalType() string { return ProposalTypeGrantPermissions } + +// ValidateBasic runs basic stateless validity checks +func (gpp *GrantPermissionsProposal) ValidateBasic() error { + err := govtypes.ValidateAbstract(gpp) + if err != nil { + return err + } + + for _, addrPerms := range gpp.AddressPermissions { + if err := addrPerms.Validate(); err != nil { + return err + } + } + return nil +} + +// String implements the Stringer interface. +func (gpp GrantPermissionsProposal) String() string { + var b strings.Builder + b.WriteString(fmt.Sprintf(`Grant permissions Proposal: + Title: %s + Description: %s + AddressPermissions: %s +`, gpp.Title, gpp.Description, &gpp.AddressPermissions)) + return b.String() +} + +// GetTitle returns the title of a revoke permissions proposal. +func (rpp *RevokePermissionsProposal) GetTitle() string { return rpp.Title } + +// GetDescription returns the description of a revoke permissions proposal. +func (rpp *RevokePermissionsProposal) GetDescription() string { return rpp.Description } + +// ProposalRoute returns the routing key of a revoke permissions proposal. +func (rpp *RevokePermissionsProposal) ProposalRoute() string { return RouterKey } + +// ProposalType returns the type of revoke permissions proposal. +func (rpp *RevokePermissionsProposal) ProposalType() string { return ProposalTypeRevokePermissions } + +// ValidateBasic runs basic stateless validity checks +func (rpp *RevokePermissionsProposal) ValidateBasic() error { + err := govtypes.ValidateAbstract(rpp) + if err != nil { + return err + } + + for _, addrPerms := range rpp.AddressPermissions { + if err := addrPerms.Validate(); err != nil { + return err + } + } + return nil +} + +// String implements the Stringer interface. +func (rpp RevokePermissionsProposal) String() string { + var b strings.Builder + b.WriteString(fmt.Sprintf(`Revoke permissions Proposal: + Title: %s + Description: %s + AddressPermissions: %s +`, rpp.Title, rpp.Description, &rpp.AddressPermissions)) + return b.String() +} diff --git a/x/sequencers/types/query.pb.go b/x/sequencers/types/query.pb.go index b6776fac..f23f4820 100644 --- a/x/sequencers/types/query.pb.go +++ b/x/sequencers/types/query.pb.go @@ -327,6 +327,100 @@ func (m *QueryHistoricalInfoResponse) GetHist() *types.HistoricalInfo { return nil } +// QueryPermissionsRequest is request type for the Query/Permissions RPC +// method. +type QueryPermissionsRequest struct { + // address defines the address to query for. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *QueryPermissionsRequest) Reset() { *m = QueryPermissionsRequest{} } +func (m *QueryPermissionsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPermissionsRequest) ProtoMessage() {} +func (*QueryPermissionsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1707b8f76abec2d9, []int{6} +} +func (m *QueryPermissionsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPermissionsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPermissionsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryPermissionsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPermissionsRequest.Merge(m, src) +} +func (m *QueryPermissionsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryPermissionsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPermissionsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPermissionsRequest proto.InternalMessageInfo + +func (m *QueryPermissionsRequest) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +// QueryPermissionsResponse is response type for the Query/Permissions RPC +// method. +type QueryPermissionsResponse struct { + // permissions defines the permissions for the given address. + Permissions string `protobuf:"bytes,1,opt,name=permissions,proto3" json:"permissions,omitempty"` +} + +func (m *QueryPermissionsResponse) Reset() { *m = QueryPermissionsResponse{} } +func (m *QueryPermissionsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPermissionsResponse) ProtoMessage() {} +func (*QueryPermissionsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1707b8f76abec2d9, []int{7} +} +func (m *QueryPermissionsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPermissionsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPermissionsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryPermissionsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPermissionsResponse.Merge(m, src) +} +func (m *QueryPermissionsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryPermissionsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPermissionsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPermissionsResponse proto.InternalMessageInfo + +func (m *QueryPermissionsResponse) GetPermissions() string { + if m != nil { + return m.Permissions + } + return "" +} + // QueryParamsRequest is request type for the Query/Params RPC method. type QueryParamsRequest struct { } @@ -335,7 +429,7 @@ func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1707b8f76abec2d9, []int{6} + return fileDescriptor_1707b8f76abec2d9, []int{8} } func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -374,7 +468,7 @@ func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1707b8f76abec2d9, []int{7} + return fileDescriptor_1707b8f76abec2d9, []int{9} } func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -417,6 +511,8 @@ func init() { proto.RegisterType((*QuerySequencerResponse)(nil), "rollapp.sequencers.types.QuerySequencerResponse") proto.RegisterType((*QueryHistoricalInfoRequest)(nil), "rollapp.sequencers.types.QueryHistoricalInfoRequest") proto.RegisterType((*QueryHistoricalInfoResponse)(nil), "rollapp.sequencers.types.QueryHistoricalInfoResponse") + proto.RegisterType((*QueryPermissionsRequest)(nil), "rollapp.sequencers.types.QueryPermissionsRequest") + proto.RegisterType((*QueryPermissionsResponse)(nil), "rollapp.sequencers.types.QueryPermissionsResponse") proto.RegisterType((*QueryParamsRequest)(nil), "rollapp.sequencers.types.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "rollapp.sequencers.types.QueryParamsResponse") } @@ -424,48 +520,52 @@ func init() { func init() { proto.RegisterFile("sequencers/query.proto", fileDescriptor_1707b8f76abec2d9) } var fileDescriptor_1707b8f76abec2d9 = []byte{ - // 641 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcd, 0x6e, 0xd3, 0x4e, - 0x14, 0xc5, 0x33, 0xfd, 0x88, 0xd4, 0xa9, 0xfe, 0x5d, 0xcc, 0xbf, 0xb4, 0x91, 0x41, 0x26, 0x58, - 0x10, 0x22, 0x44, 0xed, 0x36, 0x14, 0x09, 0xb1, 0x28, 0x6a, 0x04, 0x14, 0x58, 0x15, 0x23, 0x90, - 0x60, 0x13, 0x4d, 0xe2, 0xa9, 0x33, 0x6a, 0xe2, 0x71, 0x3d, 0x13, 0x94, 0x50, 0x75, 0xc3, 0x1e, - 0x09, 0x89, 0x27, 0x60, 0xcd, 0x1b, 0xb0, 0x63, 0x83, 0xba, 0xac, 0xc4, 0x86, 0x15, 0x42, 0x09, - 0x0f, 0x82, 0x32, 0x1e, 0x7f, 0xb5, 0x09, 0x49, 0x76, 0x9e, 0xcc, 0x3d, 0xe7, 0xfe, 0xee, 0xf5, - 0x89, 0xe1, 0x1a, 0x27, 0x47, 0x1d, 0xe2, 0x35, 0x48, 0xc0, 0xad, 0xa3, 0x0e, 0x09, 0x7a, 0xa6, - 0x1f, 0x30, 0xc1, 0x50, 0x21, 0x60, 0xad, 0x16, 0xf6, 0x7d, 0x33, 0xb9, 0x37, 0x45, 0xcf, 0x27, - 0x5c, 0x5b, 0x75, 0x99, 0xcb, 0x64, 0x91, 0x35, 0x7c, 0x0a, 0xeb, 0xb5, 0xeb, 0x0d, 0xc6, 0xdb, - 0x8c, 0x5b, 0x5c, 0xe0, 0x43, 0xea, 0xb9, 0xd6, 0xdb, 0xad, 0x3a, 0x11, 0x78, 0x2b, 0x3a, 0xab, - 0xaa, 0x2b, 0x2e, 0x63, 0x6e, 0x8b, 0x58, 0xd8, 0xa7, 0x16, 0xf6, 0x3c, 0x26, 0xb0, 0xa0, 0xcc, - 0xe3, 0xea, 0xf6, 0x96, 0xf2, 0xa8, 0x63, 0x4e, 0x42, 0x98, 0xd8, 0xc6, 0xc7, 0x2e, 0xf5, 0x64, - 0xb1, 0xaa, 0x5d, 0x4f, 0x71, 0xfb, 0x38, 0xc0, 0x6d, 0x65, 0x62, 0x74, 0xe1, 0xda, 0xf3, 0xa1, - 0xf4, 0x45, 0x7c, 0x6f, 0x0f, 0x9f, 0xb8, 0x40, 0x6b, 0x30, 0xcf, 0x05, 0x16, 0x1d, 0x5e, 0x00, - 0x45, 0x50, 0x5e, 0xb2, 0xd5, 0x09, 0x3d, 0x86, 0x30, 0xb1, 0x2f, 0xcc, 0x15, 0x41, 0x79, 0xb9, - 0x52, 0x32, 0x43, 0x16, 0x73, 0xc8, 0x62, 0x86, 0x8b, 0x51, 0x2c, 0xe6, 0x3e, 0x76, 0x89, 0xf2, - 0xb4, 0x53, 0x4a, 0xe3, 0x0b, 0x80, 0xeb, 0x17, 0x5a, 0x73, 0x9f, 0x79, 0x9c, 0xa0, 0x3d, 0x08, - 0x13, 0xe0, 0x02, 0x28, 0xce, 0x97, 0x97, 0x2b, 0xd7, 0xa2, 0x1e, 0xd1, 0x8e, 0xa2, 0x06, 0xaf, - 0x70, 0x8b, 0x3a, 0x58, 0xb0, 0xa0, 0xba, 0x70, 0xfa, 0xeb, 0x6a, 0xce, 0x4e, 0x49, 0x87, 0x46, - 0x17, 0x60, 0x6f, 0x4e, 0x84, 0x0d, 0x29, 0x32, 0xb4, 0x3b, 0xf0, 0x52, 0x16, 0x36, 0x5a, 0xd3, - 0x0d, 0xb8, 0x12, 0xf7, 0xab, 0x61, 0xc7, 0x09, 0xd4, 0xba, 0xfe, 0x8b, 0x7f, 0xdd, 0x75, 0x9c, - 0xc0, 0xa8, 0x9d, 0xdf, 0x73, 0x3c, 0xeb, 0x23, 0xb8, 0x14, 0x97, 0x4a, 0xed, 0x0c, 0xa3, 0x26, - 0x4a, 0x63, 0x1b, 0x6a, 0xb2, 0xc1, 0x13, 0xca, 0x05, 0x0b, 0x68, 0x03, 0xb7, 0x9e, 0x7a, 0x07, - 0x2c, 0xf5, 0x32, 0x9b, 0x84, 0xba, 0x4d, 0x21, 0x3b, 0xcc, 0xdb, 0xea, 0x64, 0xbc, 0x86, 0x97, - 0x47, 0xaa, 0x14, 0xdb, 0x7d, 0xb8, 0xd0, 0xa4, 0x5c, 0x28, 0xac, 0xd2, 0x38, 0xac, 0x73, 0x6a, - 0xa9, 0x31, 0x56, 0x21, 0x92, 0xd6, 0xfb, 0x32, 0x6e, 0x0a, 0xc4, 0x78, 0x09, 0xff, 0xcf, 0xfc, - 0xaa, 0x1a, 0xed, 0xc0, 0x7c, 0x18, 0x4b, 0xd5, 0xaa, 0x68, 0x8e, 0xfb, 0x43, 0x99, 0xa1, 0x52, - 0x2d, 0x40, 0xa9, 0x2a, 0xdf, 0x16, 0xe1, 0xa2, 0xf4, 0x45, 0x9f, 0x01, 0x84, 0x49, 0xa2, 0xd0, - 0xe6, 0x78, 0xa3, 0xd1, 0xb9, 0xd7, 0xb6, 0x66, 0x50, 0x84, 0xf4, 0x86, 0xf9, 0xfe, 0xc7, 0x9f, - 0x4f, 0x73, 0x65, 0x54, 0xb2, 0x9c, 0x5e, 0x9b, 0x78, 0x9c, 0x32, 0xaf, 0xdb, 0x7b, 0x97, 0x1c, - 0x36, 0x02, 0xe7, 0xd0, 0x4a, 0xa5, 0xf2, 0x2b, 0x80, 0x4b, 0xb1, 0x0d, 0xb2, 0xa6, 0x6d, 0x18, - 0x11, 0x6e, 0x4e, 0x2f, 0x50, 0x80, 0xcf, 0x24, 0xe0, 0x43, 0x54, 0x9d, 0x0e, 0x30, 0xfd, 0x78, - 0x9c, 0x4d, 0xf7, 0x09, 0xfa, 0x0e, 0xe0, 0x4a, 0xf6, 0x85, 0xa3, 0xed, 0x09, 0x40, 0x23, 0x33, - 0xa9, 0xdd, 0x9d, 0x51, 0xa5, 0x66, 0xd9, 0x93, 0xb3, 0xec, 0xa2, 0x07, 0x53, 0xce, 0xd2, 0x8c, - 0x6d, 0x6a, 0xd4, 0x3b, 0x60, 0xd6, 0x71, 0x18, 0xfd, 0x13, 0xf4, 0x01, 0xc0, 0x7c, 0x18, 0x26, - 0x74, 0x7b, 0x02, 0x4a, 0x26, 0xc3, 0xda, 0xc6, 0x94, 0xd5, 0x0a, 0xb8, 0x24, 0x81, 0x8b, 0x48, - 0xb7, 0xc6, 0x7c, 0xf4, 0xc3, 0x0c, 0x57, 0xed, 0xd3, 0xbe, 0x0e, 0xce, 0xfa, 0x3a, 0xf8, 0xdd, - 0xd7, 0xc1, 0xc7, 0x81, 0x9e, 0x3b, 0x1b, 0xe8, 0xb9, 0x9f, 0x03, 0x3d, 0xf7, 0xe6, 0x9e, 0x4b, - 0x45, 0xb3, 0x53, 0x37, 0x1b, 0xac, 0xfd, 0xaf, 0xa1, 0xbb, 0xe9, 0xb1, 0x25, 0x4f, 0x3d, 0x2f, - 0xbf, 0xf2, 0x77, 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, 0x63, 0x6a, 0xc8, 0xb0, 0xb8, 0x06, 0x00, - 0x00, + // 711 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x95, 0x4f, 0x4f, 0x13, 0x4f, + 0x18, 0xc7, 0xbb, 0xc0, 0xaf, 0xbf, 0xf0, 0x34, 0x72, 0x18, 0x11, 0x9a, 0xd5, 0xac, 0x75, 0xa3, + 0xb5, 0x31, 0xb2, 0x0b, 0x05, 0x13, 0x63, 0x08, 0x06, 0x82, 0xa2, 0x9e, 0xb0, 0x46, 0x13, 0xbd, + 0x90, 0x69, 0x77, 0xd8, 0x6e, 0x68, 0x77, 0x96, 0x9d, 0xa9, 0xa1, 0x12, 0x2e, 0xde, 0x4d, 0x4c, + 0x7c, 0x05, 0x9e, 0x7d, 0x07, 0xbe, 0x00, 0xc3, 0x91, 0xc4, 0x8b, 0x27, 0x63, 0xc0, 0xd7, 0x61, + 0xcc, 0xce, 0xcc, 0xfe, 0x29, 0xa5, 0xb6, 0xbd, 0xed, 0xcc, 0x3c, 0xdf, 0xe7, 0xf9, 0x3c, 0xcf, + 0xcc, 0x37, 0x0b, 0x73, 0x8c, 0xec, 0x77, 0x88, 0xdf, 0x20, 0x21, 0xb3, 0xf7, 0x3b, 0x24, 0xec, + 0x5a, 0x41, 0x48, 0x39, 0x45, 0xc5, 0x90, 0xb6, 0x5a, 0x38, 0x08, 0xac, 0xf4, 0xdc, 0xe2, 0xdd, + 0x80, 0x30, 0x7d, 0xd6, 0xa5, 0x2e, 0x15, 0x41, 0x76, 0xf4, 0x25, 0xe3, 0xf5, 0x9b, 0x0d, 0xca, + 0xda, 0x94, 0xd9, 0x8c, 0xe3, 0x3d, 0xcf, 0x77, 0xed, 0xb7, 0x4b, 0x75, 0xc2, 0xf1, 0x52, 0xbc, + 0x56, 0x51, 0xd7, 0x5c, 0x4a, 0xdd, 0x16, 0xb1, 0x71, 0xe0, 0xd9, 0xd8, 0xf7, 0x29, 0xc7, 0xdc, + 0xa3, 0x3e, 0x53, 0xa7, 0x77, 0x54, 0x8e, 0x3a, 0x66, 0x44, 0xc2, 0x24, 0x69, 0x02, 0xec, 0x7a, + 0xbe, 0x08, 0x56, 0xb1, 0xf3, 0x19, 0xee, 0x00, 0x87, 0xb8, 0xad, 0x92, 0x98, 0x07, 0x30, 0xf7, + 0x3c, 0x92, 0xbe, 0x48, 0xce, 0x6b, 0xd1, 0x17, 0xe3, 0x68, 0x0e, 0xf2, 0x8c, 0x63, 0xde, 0x61, + 0x45, 0xad, 0xa4, 0x55, 0xa6, 0x6b, 0x6a, 0x85, 0x1e, 0x03, 0xa4, 0xe9, 0x8b, 0x13, 0x25, 0xad, + 0x52, 0xa8, 0x96, 0x2d, 0xc9, 0x62, 0x45, 0x2c, 0x96, 0x1c, 0x8c, 0x62, 0xb1, 0xb6, 0xb1, 0x4b, + 0x54, 0xce, 0x5a, 0x46, 0x69, 0x7e, 0xd1, 0x60, 0xbe, 0xaf, 0x34, 0x0b, 0xa8, 0xcf, 0x08, 0xda, + 0x02, 0x48, 0x81, 0x8b, 0x5a, 0x69, 0xb2, 0x52, 0xa8, 0xde, 0x88, 0x6b, 0xc4, 0x33, 0x8a, 0x0b, + 0xbc, 0xc2, 0x2d, 0xcf, 0xc1, 0x9c, 0x86, 0x1b, 0x53, 0xc7, 0x3f, 0xaf, 0xe7, 0x6a, 0x19, 0x69, + 0x94, 0xa8, 0x0f, 0xf6, 0xf6, 0x50, 0x58, 0x49, 0xd1, 0x43, 0xbb, 0x06, 0x57, 0x7a, 0x61, 0xe3, + 0x31, 0xdd, 0x82, 0x99, 0xa4, 0xde, 0x0e, 0x76, 0x9c, 0x50, 0x8d, 0xeb, 0x52, 0xb2, 0xbb, 0xee, + 0x38, 0xa1, 0xb9, 0x73, 0x7e, 0xce, 0x49, 0xaf, 0x8f, 0x60, 0x3a, 0x09, 0x15, 0xda, 0x31, 0x5a, + 0x4d, 0x95, 0xe6, 0x0a, 0xe8, 0xa2, 0xc0, 0x13, 0x8f, 0x71, 0x1a, 0x7a, 0x0d, 0xdc, 0x7a, 0xea, + 0xef, 0xd2, 0xcc, 0x65, 0x36, 0x89, 0xe7, 0x36, 0xb9, 0xa8, 0x30, 0x59, 0x53, 0x2b, 0xf3, 0x35, + 0x5c, 0xbd, 0x50, 0xa5, 0xd8, 0x1e, 0xc0, 0x54, 0xd3, 0x63, 0x5c, 0x61, 0x95, 0x07, 0x61, 0x9d, + 0x53, 0x0b, 0x8d, 0xb9, 0xac, 0xae, 0x77, 0x9b, 0x84, 0x6d, 0x8f, 0xb1, 0xe8, 0xe1, 0xc6, 0x34, + 0x45, 0xf8, 0x3f, 0x9a, 0x14, 0x61, 0xf1, 0xdb, 0x8a, 0x97, 0xe6, 0x2a, 0x14, 0xfb, 0x45, 0x0a, + 0xa6, 0x04, 0x85, 0x20, 0xdd, 0x56, 0xca, 0xec, 0x96, 0x39, 0x0b, 0x48, 0xaa, 0xc5, 0x0b, 0x57, + 0xd5, 0xcc, 0x97, 0x70, 0xb9, 0x67, 0x57, 0xa5, 0x5b, 0x83, 0xbc, 0x74, 0x82, 0xea, 0xae, 0x64, + 0x0d, 0xf2, 0xb0, 0x25, 0x95, 0x6a, 0xe6, 0x4a, 0x55, 0xfd, 0x93, 0x87, 0xff, 0x44, 0x5e, 0xf4, + 0x59, 0x03, 0x48, 0x1f, 0x31, 0x5a, 0x1c, 0x9c, 0xe8, 0x62, 0xab, 0xe9, 0x4b, 0x63, 0x28, 0x24, + 0xbd, 0x69, 0xbd, 0xff, 0xfe, 0xfb, 0xd3, 0x44, 0x05, 0x95, 0x6d, 0xa7, 0xdb, 0x26, 0x7e, 0xd4, + 0xff, 0x41, 0xf7, 0x5d, 0xba, 0x58, 0x08, 0x9d, 0x3d, 0x3b, 0x63, 0x84, 0xaf, 0x1a, 0x4c, 0x27, + 0x69, 0x90, 0x3d, 0x6a, 0xc1, 0x98, 0x70, 0x71, 0x74, 0x81, 0x02, 0x7c, 0x26, 0x00, 0x37, 0xd1, + 0xc6, 0x68, 0x80, 0xd9, 0xcf, 0xc3, 0x5e, 0x43, 0x1d, 0xa1, 0x6f, 0x1a, 0xcc, 0xf4, 0xbe, 0x31, + 0xb4, 0x32, 0x04, 0xe8, 0x42, 0x1b, 0xe8, 0xf7, 0xc6, 0x54, 0xa9, 0x5e, 0xb6, 0x44, 0x2f, 0xeb, + 0xe8, 0xe1, 0x88, 0xbd, 0x34, 0x93, 0x34, 0x3b, 0x9e, 0xbf, 0x4b, 0xed, 0x43, 0xe9, 0xb6, 0xa3, + 0xe8, 0x16, 0x0a, 0x99, 0xa7, 0x8d, 0x86, 0x5d, 0x7c, 0xbf, 0x77, 0xf4, 0xea, 0x38, 0x12, 0xc5, + 0xbf, 0x29, 0xf8, 0xd7, 0xd0, 0xea, 0x88, 0xfc, 0x19, 0x4f, 0xd9, 0x87, 0xca, 0x9a, 0x47, 0xe8, + 0x83, 0x06, 0x79, 0xe9, 0x04, 0x74, 0x77, 0x18, 0x44, 0xd6, 0x80, 0xfa, 0xc2, 0x88, 0xd1, 0x8a, + 0xb6, 0x2c, 0x68, 0x4b, 0xc8, 0xb0, 0x07, 0xfc, 0x24, 0xa5, 0x01, 0x37, 0x6a, 0xc7, 0xa7, 0x86, + 0x76, 0x72, 0x6a, 0x68, 0xbf, 0x4e, 0x0d, 0xed, 0xe3, 0x99, 0x91, 0x3b, 0x39, 0x33, 0x72, 0x3f, + 0xce, 0x8c, 0xdc, 0x9b, 0xfb, 0xae, 0xc7, 0x9b, 0x9d, 0xba, 0xd5, 0xa0, 0xed, 0x7f, 0x75, 0x7c, + 0x90, 0xed, 0x59, 0xf0, 0xd4, 0xf3, 0xe2, 0xaf, 0xb8, 0xfc, 0x37, 0x00, 0x00, 0xff, 0xff, 0x16, + 0xe8, 0x86, 0xb4, 0xe8, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -486,6 +586,8 @@ type QueryClient interface { Sequencer(ctx context.Context, in *QuerySequencerRequest, opts ...grpc.CallOption) (*QuerySequencerResponse, error) // HistoricalInfo queries the historical info for given height. HistoricalInfo(ctx context.Context, in *QueryHistoricalInfoRequest, opts ...grpc.CallOption) (*QueryHistoricalInfoResponse, error) + // Permissions queries the permissions for given address. + Permissions(ctx context.Context, in *QueryPermissionsRequest, opts ...grpc.CallOption) (*QueryPermissionsResponse, error) // Parameters queries the staking parameters. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) } @@ -525,6 +627,15 @@ func (c *queryClient) HistoricalInfo(ctx context.Context, in *QueryHistoricalInf return out, nil } +func (c *queryClient) Permissions(ctx context.Context, in *QueryPermissionsRequest, opts ...grpc.CallOption) (*QueryPermissionsResponse, error) { + out := new(QueryPermissionsResponse) + err := c.cc.Invoke(ctx, "/rollapp.sequencers.types.Query/Permissions", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { out := new(QueryParamsResponse) err := c.cc.Invoke(ctx, "/rollapp.sequencers.types.Query/Params", in, out, opts...) @@ -542,6 +653,8 @@ type QueryServer interface { Sequencer(context.Context, *QuerySequencerRequest) (*QuerySequencerResponse, error) // HistoricalInfo queries the historical info for given height. HistoricalInfo(context.Context, *QueryHistoricalInfoRequest) (*QueryHistoricalInfoResponse, error) + // Permissions queries the permissions for given address. + Permissions(context.Context, *QueryPermissionsRequest) (*QueryPermissionsResponse, error) // Parameters queries the staking parameters. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) } @@ -559,6 +672,9 @@ func (*UnimplementedQueryServer) Sequencer(ctx context.Context, req *QuerySequen func (*UnimplementedQueryServer) HistoricalInfo(ctx context.Context, req *QueryHistoricalInfoRequest) (*QueryHistoricalInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method HistoricalInfo not implemented") } +func (*UnimplementedQueryServer) Permissions(ctx context.Context, req *QueryPermissionsRequest) (*QueryPermissionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Permissions not implemented") +} func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } @@ -621,6 +737,24 @@ func _Query_HistoricalInfo_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +func _Query_Permissions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPermissionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Permissions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rollapp.sequencers.types.Query/Permissions", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Permissions(ctx, req.(*QueryPermissionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryParamsRequest) if err := dec(in); err != nil { @@ -655,6 +789,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "HistoricalInfo", Handler: _Query_HistoricalInfo_Handler, }, + { + MethodName: "Permissions", + Handler: _Query_Permissions_Handler, + }, { MethodName: "Params", Handler: _Query_Params_Handler, @@ -881,6 +1019,66 @@ func (m *QueryHistoricalInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } +func (m *QueryPermissionsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryPermissionsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPermissionsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryPermissionsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryPermissionsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPermissionsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Permissions) > 0 { + i -= len(m.Permissions) + copy(dAtA[i:], m.Permissions) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Permissions))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1033,6 +1231,32 @@ func (m *QueryHistoricalInfoResponse) Size() (n int) { return n } +func (m *QueryPermissionsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPermissionsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Permissions) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func (m *QueryParamsRequest) Size() (n int) { if m == nil { return 0 @@ -1617,6 +1841,170 @@ func (m *QueryHistoricalInfoResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryPermissionsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryPermissionsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPermissionsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryPermissionsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryPermissionsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPermissionsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Permissions", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Permissions = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/sequencers/types/query.pb.gw.go b/x/sequencers/types/query.pb.gw.go index a239cff9..ea79cb1d 100644 --- a/x/sequencers/types/query.pb.gw.go +++ b/x/sequencers/types/query.pb.gw.go @@ -177,6 +177,60 @@ func local_request_Query_HistoricalInfo_0(ctx context.Context, marshaler runtime } +func request_Query_Permissions_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPermissionsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + msg, err := client.Permissions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Permissions_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPermissionsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + msg, err := server.Permissions(ctx, &protoReq) + return msg, metadata, err + +} + func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryParamsRequest var metadata runtime.ServerMetadata @@ -270,6 +324,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_Permissions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Permissions_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Permissions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -394,6 +471,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_Permissions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Permissions_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Permissions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -424,6 +521,8 @@ var ( pattern_Query_HistoricalInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"dymensionxyz", "dymension-rdk", "sequencers", "historical_info", "height"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Permissions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"dymensionxyz", "dymension-rdk", "sequencers", "permissions", "address"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "staking", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(false))) ) @@ -434,5 +533,7 @@ var ( forward_Query_HistoricalInfo_0 = runtime.ForwardResponseMessage + forward_Query_Permissions_0 = runtime.ForwardResponseMessage + forward_Query_Params_0 = runtime.ForwardResponseMessage )