diff --git a/go.mod b/go.mod index 59b8d48de..28dcb186c 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( github.com/cometbft/cometbft v0.38.17 github.com/cosmos/cosmos-db v1.1.1 github.com/cosmos/cosmos-proto v1.0.0-beta.5 - github.com/cosmos/cosmos-sdk v0.53.0 + github.com/cosmos/cosmos-sdk v0.53.4 github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/gogoproto v1.7.0 github.com/cosmos/ibc-go/v10 v10.2.0 @@ -46,7 +46,7 @@ require ( github.com/spf13/viper v1.20.1 github.com/stretchr/testify v1.10.0 golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 - golang.org/x/sync v0.14.0 + golang.org/x/sync v0.16.0 google.golang.org/genproto/googleapis/api v0.0.0-20250414145226-207652e42e2e google.golang.org/grpc v1.72.0 google.golang.org/protobuf v1.36.6 @@ -54,6 +54,12 @@ require ( pgregory.net/rapid v1.2.0 ) +require ( + github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect + github.com/btcsuite/btcd/btcutil v1.1.6 // indirect + github.com/valyala/bytebufferpool v1.0.0 // indirect +) + require ( cel.dev/expr v0.20.0 // indirect cloud.google.com/go v0.116.0 // indirect @@ -121,6 +127,7 @@ require ( github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/getsentry/sentry-go v0.32.0 // indirect + github.com/gnolang/gno v0.0.0-20251010155040-3f1cc0962a5f github.com/go-jose/go-jose/v4 v4.0.5 // indirect github.com/go-kit/kit v0.13.0 // indirect github.com/go-kit/log v0.2.1 // indirect @@ -231,12 +238,12 @@ require ( go.opentelemetry.io/otel/trace v1.34.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/arch v0.15.0 // indirect - golang.org/x/crypto v0.38.0 // indirect - golang.org/x/net v0.39.0 // indirect + golang.org/x/crypto v0.40.0 // indirect + golang.org/x/net v0.42.0 // indirect golang.org/x/oauth2 v0.27.0 // indirect - golang.org/x/sys v0.33.0 // indirect - golang.org/x/term v0.32.0 // indirect - golang.org/x/text v0.25.0 // indirect + golang.org/x/sys v0.34.0 // indirect + golang.org/x/term v0.33.0 // indirect + golang.org/x/text v0.28.0 // indirect golang.org/x/time v0.10.0 // indirect google.golang.org/api v0.222.0 // indirect google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 // indirect diff --git a/go.sum b/go.sum index 3bdcb32f5..6dbe0088e 100644 --- a/go.sum +++ b/go.sum @@ -679,6 +679,7 @@ github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrd github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/adlio/schema v1.3.6 h1:k1/zc2jNfeiZBA5aFTRy37jlBIuCkXCm0XmvpzCKI9I= github.com/adlio/schema v1.3.6/go.mod h1:qkxwLgPBd1FgLRHYVCmQT/rrBr3JH38J9LjmVzWNudg= +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/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY= github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk= @@ -725,10 +726,31 @@ github.com/bits-and-blooms/bitset v1.22.0 h1:Tquv9S8+SGaS3EhyA+up3FXzmkhxPGjQQCk github.com/bits-and-blooms/bitset v1.22.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= +github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= +github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A= +github.com/btcsuite/btcd v0.24.2/go.mod h1:5C8ChTkl5ejr3WHj8tkQSCmydiMEPB0ZhQhehpq7Dgg= +github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= +github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A= +github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE= +github.com/btcsuite/btcd/btcutil v1.1.5/go.mod h1:PSZZ4UitpLBWzxGd5VGOrLnmOjtPP/a6HaFo12zMs00= github.com/btcsuite/btcd/btcutil v1.1.6 h1:zFL2+c3Lb9gEgqKNzowKUPQNb8jV7v5Oaodi/AYFd6c= github.com/btcsuite/btcd/btcutil v1.1.6/go.mod h1:9dFymx8HpuLqBnsPELrImQeTQfKBQqzqGbbV3jK55aE= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= +github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= +github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= +github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= +github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= +github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= +github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= +github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= +github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE= github.com/bytedance/sonic v1.14.0 h1:/OfKt8HFw0kh2rj8N0F6C/qPGRESq0BbaNZgcNXXzQQ= @@ -845,14 +867,18 @@ github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/danieljoos/wincred v1.2.1 h1:dl9cBrupW8+r5250DYkYxocLeZ1Y4vB1kxgtjxw8GQs= github.com/danieljoos/wincred v1.2.1/go.mod h1:uGaFL9fDn3OLTvzCGulzE+SzjEe5NGlh5FdCcyfPwps= +github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= github.com/decred/dcrd/crypto/blake256 v1.1.0 h1:zPMNGQCm0g4QTY27fOCorQW7EryeQ/U0x++OzVrdms8= github.com/decred/dcrd/crypto/blake256 v1.1.0/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 h1:NMZiJj8QnKe1LgsbDayM4UoHwbvwDRwnI3hwNaAHRnc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0/go.mod h1:ZXNYxsqcloTdSy/rNShjYzMhyjf0LaoftYK0p+A3h40= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= github.com/desertbit/timer v1.0.1 h1:yRpYNn5Vaaj6QXecdLMPMJsW81JLiI1eokUft5nBmeo= github.com/desertbit/timer v1.0.1/go.mod h1:htRrYeY5V/t4iu1xCJ5XsQvp4xve8QulXXctAzxqcwE= @@ -935,6 +961,8 @@ 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.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= +github.com/gnolang/gno v0.0.0-20251010155040-3f1cc0962a5f h1:5lf//p9OafnjpYArec9dOsisFy7SwQSEAitzIuiAIIA= +github.com/gnolang/gno v0.0.0-20251010155040-3f1cc0962a5f/go.mod h1:HFxg7s2sqFtjTP5F7BjewpWKMS8RSe1JwZe19jLwme0= 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-fonts/dejavu v0.1.0/go.mod h1:4Wt4I4OU2Nq9asgDCteaAaWZOV24E+0/Pwo0gppep4g= @@ -1150,6 +1178,7 @@ github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= @@ -1235,6 +1264,8 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= @@ -1246,6 +1277,7 @@ github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -1266,6 +1298,7 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j0HLHbNSE= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= @@ -1385,6 +1418,7 @@ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108 github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= @@ -1559,6 +1593,7 @@ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1F github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -1582,6 +1617,8 @@ github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= @@ -1662,6 +1699,7 @@ go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= golang.org/x/arch v0.15.0 h1:QtOrQd0bTUnhNVNndMpLHNWrDmYzZ2KDqSrEymqInZw= golang.org/x/arch v0.15.0/go.mod h1:JmwW7aLIoRUKgaTzhkiEFxvcEiQGyOg9BMonBJUS7EE= +golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -1682,6 +1720,8 @@ golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8= golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= +golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= +golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= 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= @@ -1745,6 +1785,7 @@ golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1822,6 +1863,8 @@ golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY= golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E= +golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= +golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1875,6 +1918,8 @@ golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= +golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1990,6 +2035,8 @@ golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= +golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= 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= @@ -2007,6 +2054,8 @@ golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg= golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ= +golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg= +golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0= 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= @@ -2029,6 +2078,8 @@ golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/modules/10-gno/client_state.go b/modules/10-gno/client_state.go new file mode 100644 index 000000000..9e59d806e --- /dev/null +++ b/modules/10-gno/client_state.go @@ -0,0 +1,326 @@ +package gno + +import ( + "strings" + "time" + + ics23 "github.com/cosmos/ics23/go" + + errorsmod "cosmossdk.io/errors" + storetypes "cosmossdk.io/store/types" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/cometbft/cometbft/light" + bfttypes "github.com/gnolang/gno/tm2/pkg/bft/types" + + clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" + commitmenttypes "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types" + commitmenttypesv2 "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types/v2" + ibcerrors "github.com/cosmos/ibc-go/v10/modules/core/errors" + "github.com/cosmos/ibc-go/v10/modules/core/exported" +) + +var _ exported.ClientState = (*ClientState)(nil) + +// NewClientState creates a new ClientState instance +func NewClientState( + chainID string, trustLevel Fraction, + trustingPeriod, ubdPeriod, maxClockDrift time.Duration, + latestHeight clienttypes.Height, specs []*ics23.ProofSpec, + upgradePath []string, +) *ClientState { + return &ClientState{ + ChainId: chainID, + TrustLevel: trustLevel, + TrustingPeriod: trustingPeriod, + UnbondingPeriod: ubdPeriod, + MaxClockDrift: maxClockDrift, + LatestHeight: latestHeight, + FrozenHeight: clienttypes.ZeroHeight(), + ProofSpecs: specs, + UpgradePath: upgradePath, + } +} + +// GetChainID returns the chain-id +func (cs ClientState) GetChainID() string { + return cs.ChainId +} + +// ClientType is gno. +func (ClientState) ClientType() string { + return Gno +} + +// getTimestampAtHeight returns the timestamp in nanoseconds of the consensus state at the given height. +func (ClientState) getTimestampAtHeight( + clientStore storetypes.KVStore, + cdc codec.BinaryCodec, + height exported.Height, +) (uint64, error) { + // get consensus state at height from clientStore to check for expiry + consState, found := GetConsensusState(clientStore, cdc, height) + if !found { + return 0, errorsmod.Wrapf(clienttypes.ErrConsensusStateNotFound, "height (%s)", height) + } + return consState.GetTimestamp(), nil +} + +// status returns the status of the gno client. +// The client may be: +// - Active: FrozenHeight is zero and client is not expired +// - Frozen: Frozen Height is not zero +// - Expired: the latest consensus state timestamp + trusting period <= current time +// +// A frozen client will become expired, so the Frozen status +// has higher precedence. +func (cs ClientState) status( + ctx sdk.Context, + clientStore storetypes.KVStore, + cdc codec.BinaryCodec, +) exported.Status { + if !cs.FrozenHeight.IsZero() { + return exported.Frozen + } + + // get latest consensus state from clientStore to check for expiry + consState, found := GetConsensusState(clientStore, cdc, cs.LatestHeight) + if !found { + // if the client state does not have an associated consensus state for its latest height + // then it must be expired + return exported.Expired + } + + if cs.IsExpired(consState.Timestamp, ctx.BlockTime()) { + return exported.Expired + } + + return exported.Active +} + +// IsExpired returns whether or not the client has passed the trusting period since the last +// update (in which case no headers are considered valid). +func (cs ClientState) IsExpired(latestTimestamp, now time.Time) bool { + expirationTime := latestTimestamp.Add(cs.TrustingPeriod) + return !expirationTime.After(now) +} + +// Validate performs a basic validation of the client state fields. +func (cs ClientState) Validate() error { + if strings.TrimSpace(cs.ChainId) == "" { + return errorsmod.Wrap(ErrInvalidChainID, "chain id cannot be empty string") + } + + // NOTE: the value of bfttypes.MaxChainIDLen may change in the future. + // If this occurs, the code here must account for potential difference + // between the gno/tm2 version being run by the counterparty chain + // and the gno/tm2 version used by this light client. + // https://github.com/cosmos/ibc-go/issues/177 + if len(cs.ChainId) > bfttypes.MaxChainIDLen { + return errorsmod.Wrapf(ErrInvalidChainID, "chainID is too long; got: %d, max: %d", len(cs.ChainId), bfttypes.MaxChainIDLen) + } + + if err := light.ValidateTrustLevel(cs.TrustLevel.ToTendermint()); err != nil { + return errorsmod.Wrap(ErrInvalidTrustLevel, err.Error()) + } + if cs.TrustingPeriod <= 0 { + return errorsmod.Wrap(ErrInvalidTrustingPeriod, "trusting period must be greater than zero") + } + if cs.UnbondingPeriod <= 0 { + return errorsmod.Wrap(ErrInvalidUnbondingPeriod, "unbonding period must be greater than zero") + } + if cs.MaxClockDrift <= 0 { + return errorsmod.Wrap(ErrInvalidMaxClockDrift, "max clock drift must be greater than zero") + } + + // the latest height revision number must match the chain id revision number + if cs.LatestHeight.RevisionNumber != clienttypes.ParseChainID(cs.ChainId) { + return errorsmod.Wrapf(ErrInvalidHeaderHeight, + "latest height revision number must match chain id revision number (%d != %d)", cs.LatestHeight.RevisionNumber, clienttypes.ParseChainID(cs.ChainId)) + } + if cs.LatestHeight.RevisionHeight == 0 { + return errorsmod.Wrap(ErrInvalidHeaderHeight, "tendermint client's latest height revision height cannot be zero") + } + if cs.TrustingPeriod >= cs.UnbondingPeriod { + return errorsmod.Wrapf( + ErrInvalidTrustingPeriod, + "trusting period (%s) should be < unbonding period (%s)", cs.TrustingPeriod, cs.UnbondingPeriod, + ) + } + + if cs.ProofSpecs == nil { + return errorsmod.Wrap(ErrInvalidProofSpecs, "proof specs cannot be nil for gno client") + } + for i, spec := range cs.ProofSpecs { + if spec == nil { + return errorsmod.Wrapf(ErrInvalidProofSpecs, "proof spec cannot be nil at index: %d", i) + } + } + // UpgradePath may be empty, but if it isn't, each key must be non-empty + for i, k := range cs.UpgradePath { + if strings.TrimSpace(k) == "" { + return errorsmod.Wrapf(clienttypes.ErrInvalidClient, "key in upgrade path at index %d cannot be empty", i) + } + } + + return nil +} + +// ZeroCustomFields returns a ClientState that is a copy of the current ClientState +// with all client customizable fields zeroed out. All chain specific fields must +// remain unchanged. This client state will be used to verify chain upgrades when a +// chain breaks a light client verification parameter such as chainID. +func (cs ClientState) ZeroCustomFields() *ClientState { + // copy over all chain-specified fields + // and leave custom fields empty + return &ClientState{ + ChainId: cs.ChainId, + UnbondingPeriod: cs.UnbondingPeriod, + LatestHeight: cs.LatestHeight, + ProofSpecs: cs.ProofSpecs, + UpgradePath: cs.UpgradePath, + } +} + +// initialize checks that the initial consensus state is an 10-gno consensus state and +// sets the client state, consensus state and associated metadata in the provided client store. +func (cs ClientState) initialize(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, consState exported.ConsensusState) error { + consensusState, ok := consState.(*ConsensusState) + if !ok { + return errorsmod.Wrapf(clienttypes.ErrInvalidConsensus, "invalid initial consensus state. expected type: %T, got: %T", + &ConsensusState{}, consState) + } + + setClientState(clientStore, cdc, &cs) + setConsensusState(clientStore, cdc, consensusState, cs.LatestHeight) + setConsensusMetadata(ctx, clientStore, cs.LatestHeight) + + return nil +} + +// verifyMembership is a generic proof verification method which verifies a proof of the existence of a value at a given CommitmentPath at the specified height. +// The caller is expected to construct the full CommitmentPath from a CommitmentPrefix and a standardized path (as defined in ICS 24). +// If a zero proof height is passed in, it will fail to retrieve the associated consensus state. +func (cs ClientState) verifyMembership( + ctx sdk.Context, + clientStore storetypes.KVStore, + cdc codec.BinaryCodec, + height exported.Height, + delayTimePeriod uint64, + delayBlockPeriod uint64, + proof []byte, + path exported.Path, + value []byte, +) error { + if cs.LatestHeight.LT(height) { + return errorsmod.Wrapf( + ibcerrors.ErrInvalidHeight, + "client state height < proof height (%d < %d), please ensure the client has been updated", cs.LatestHeight, height, + ) + } + + if err := verifyDelayPeriodPassed(ctx, clientStore, height, delayTimePeriod, delayBlockPeriod); err != nil { + return err + } + + var merkleProof commitmenttypes.MerkleProof + if err := cdc.Unmarshal(proof, &merkleProof); err != nil { + return errorsmod.Wrap(commitmenttypes.ErrInvalidProof, "failed to unmarshal proof into ICS 23 commitment merkle proof") + } + + merklePath, ok := path.(commitmenttypesv2.MerklePath) + if !ok { + return errorsmod.Wrapf(ibcerrors.ErrInvalidType, "expected %T, got %T", commitmenttypesv2.MerklePath{}, path) + } + + consensusState, found := GetConsensusState(clientStore, cdc, height) + if !found { + return errorsmod.Wrap(clienttypes.ErrConsensusStateNotFound, "please ensure the proof was constructed against a height that exists on the client") + } + + return merkleProof.VerifyMembership(cs.ProofSpecs, consensusState.GetRoot(), merklePath, value) +} + +// verifyNonMembership is a generic proof verification method which verifies the absence of a given CommitmentPath at a specified height. +// The caller is expected to construct the full CommitmentPath from a CommitmentPrefix and a standardized path (as defined in ICS 24). +// If a zero proof height is passed in, it will fail to retrieve the associated consensus state. +func (cs ClientState) verifyNonMembership( + ctx sdk.Context, + clientStore storetypes.KVStore, + cdc codec.BinaryCodec, + height exported.Height, + delayTimePeriod uint64, + delayBlockPeriod uint64, + proof []byte, + path exported.Path, +) error { + if cs.LatestHeight.LT(height) { + return errorsmod.Wrapf( + ibcerrors.ErrInvalidHeight, + "client state height < proof height (%d < %d), please ensure the client has been updated", cs.LatestHeight, height, + ) + } + + if err := verifyDelayPeriodPassed(ctx, clientStore, height, delayTimePeriod, delayBlockPeriod); err != nil { + return err + } + + var merkleProof commitmenttypes.MerkleProof + if err := cdc.Unmarshal(proof, &merkleProof); err != nil { + return errorsmod.Wrap(commitmenttypes.ErrInvalidProof, "failed to unmarshal proof into ICS 23 commitment merkle proof") + } + + merklePath, ok := path.(commitmenttypesv2.MerklePath) + if !ok { + return errorsmod.Wrapf(ibcerrors.ErrInvalidType, "expected %T, got %T", commitmenttypesv2.MerklePath{}, path) + } + + consensusState, found := GetConsensusState(clientStore, cdc, height) + if !found { + return errorsmod.Wrap(clienttypes.ErrConsensusStateNotFound, "please ensure the proof was constructed against a height that exists on the client") + } + + return merkleProof.VerifyNonMembership(cs.ProofSpecs, consensusState.GetRoot(), merklePath) +} + +// verifyDelayPeriodPassed will ensure that at least delayTimePeriod amount of time and delayBlockPeriod number of blocks have passed +// since consensus state was submitted before allowing verification to continue. +func verifyDelayPeriodPassed(ctx sdk.Context, store storetypes.KVStore, proofHeight exported.Height, delayTimePeriod, delayBlockPeriod uint64) error { + if delayTimePeriod != 0 { + // check that executing chain's timestamp has passed consensusState's processed time + delay time period + processedTime, ok := GetProcessedTime(store, proofHeight) + if !ok { + return errorsmod.Wrapf(ErrProcessedTimeNotFound, "processed time not found for height: %s", proofHeight) + } + + currentTimestamp := uint64(ctx.BlockTime().UnixNano()) + validTime := processedTime + delayTimePeriod + + // NOTE: delay time period is inclusive, so if currentTimestamp is validTime, then we return no error + if currentTimestamp < validTime { + return errorsmod.Wrapf(ErrDelayPeriodNotPassed, "cannot verify packet until time: %d, current time: %d", + validTime, currentTimestamp) + } + } + + if delayBlockPeriod != 0 { + // check that executing chain's height has passed consensusState's processed height + delay block period + processedHeight, ok := GetProcessedHeight(store, proofHeight) + if !ok { + return errorsmod.Wrapf(ErrProcessedHeightNotFound, "processed height not found for height: %s", proofHeight) + } + + currentHeight := clienttypes.GetSelfHeight(ctx) + validHeight := clienttypes.NewHeight(processedHeight.GetRevisionNumber(), processedHeight.GetRevisionHeight()+delayBlockPeriod) + + // NOTE: delay block period is inclusive, so if currentHeight is validHeight, then we return no error + if currentHeight.LT(validHeight) { + return errorsmod.Wrapf(ErrDelayPeriodNotPassed, "cannot verify packet until height: %s, current height: %s", + validHeight, currentHeight) + } + } + + return nil +} diff --git a/modules/10-gno/codec.go b/modules/10-gno/codec.go new file mode 100644 index 000000000..59f0eaa26 --- /dev/null +++ b/modules/10-gno/codec.go @@ -0,0 +1,28 @@ +package gno + +import ( + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + + "github.com/cosmos/ibc-go/v10/modules/core/exported" +) + +// RegisterInterfaces registers the tendermint concrete client-related +// implementations and interfaces. +func RegisterInterfaces(registry codectypes.InterfaceRegistry) { + registry.RegisterImplementations( + (*exported.ClientState)(nil), + &ClientState{}, + ) + registry.RegisterImplementations( + (*exported.ConsensusState)(nil), + &ConsensusState{}, + ) + registry.RegisterImplementations( + (*exported.ClientMessage)(nil), + &Header{}, + ) + registry.RegisterImplementations( + (*exported.ClientMessage)(nil), + &Misbehaviour{}, + ) +} diff --git a/modules/10-gno/consensus_state.go b/modules/10-gno/consensus_state.go new file mode 100644 index 000000000..54ea550e4 --- /dev/null +++ b/modules/10-gno/consensus_state.go @@ -0,0 +1,61 @@ +package gno + +import ( + "time" + + errorsmod "cosmossdk.io/errors" + + cmtbytes "github.com/cometbft/cometbft/libs/bytes" + cmttypes "github.com/cometbft/cometbft/types" + + clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" + commitmenttypes "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types" + "github.com/cosmos/ibc-go/v10/modules/core/exported" +) + +var _ exported.ConsensusState = (*ConsensusState)(nil) + +// SentinelRoot is used as a stand-in root value for the consensus state set at the upgrade height +const SentinelRoot = "sentinel_root" + +// NewConsensusState creates a new ConsensusState instance. +func NewConsensusState( + timestamp time.Time, root commitmenttypes.MerkleRoot, nextValsHash cmtbytes.HexBytes, +) *ConsensusState { + return &ConsensusState{ + Timestamp: timestamp, + Root: root, + NextValidatorsHash: nextValsHash, + } +} + +// ClientType returns Gno +func (ConsensusState) ClientType() string { + return Gno +} + +// GetRoot returns the commitment Root for the specific +func (cs ConsensusState) GetRoot() exported.Root { + return cs.Root +} + +// GetTimestamp returns block time in nanoseconds of the header that created consensus state +func (cs ConsensusState) GetTimestamp() uint64 { + return uint64(cs.Timestamp.UnixNano()) +} + +// ValidateBasic defines a basic validation for the tendermint consensus state. +// NOTE: ProcessedTimestamp may be zero if this is an initial consensus state passed in by relayer +// as opposed to a consensus state constructed by the chain. +func (cs ConsensusState) ValidateBasic() error { + if cs.Root.Empty() { + return errorsmod.Wrap(clienttypes.ErrInvalidConsensus, "root cannot be empty") + } + if err := cmttypes.ValidateHash(cs.NextValidatorsHash); err != nil { + return errorsmod.Wrap(err, "next validators hash is invalid") + } + if cs.Timestamp.Unix() <= 0 { + return errorsmod.Wrap(clienttypes.ErrInvalidConsensus, "timestamp must be a positive Unix time") + } + return nil +} diff --git a/modules/10-gno/doc.go b/modules/10-gno/doc.go new file mode 100644 index 000000000..9ecd24107 --- /dev/null +++ b/modules/10-gno/doc.go @@ -0,0 +1,11 @@ +/* +DONE +package gno implements a concrete LightClientModule, ClientState, ConsensusState, +Header, Misbehaviour and types for the Tendermint 2 / GNO consensus light client. +This implementation is based off the ICS 07 specification for Tendermint consensus +(https://github.com/cosmos/ibc/tree/main/spec/client/ics-007-tendermint-client) + +Note that client identifiers are expected to be in the form: 10-gno-{N}. +Client identifiers are generated and validated by core IBC, unexpected client identifiers will result in errors. +*/ +package gno diff --git a/modules/10-gno/errors.go b/modules/10-gno/errors.go new file mode 100644 index 000000000..3269e86e7 --- /dev/null +++ b/modules/10-gno/errors.go @@ -0,0 +1,23 @@ +package gno + +import ( + errorsmod "cosmossdk.io/errors" +) + +// IBC tendermint client sentinel errors +var ( + ErrInvalidChainID = errorsmod.Register(ModuleName, 2, "invalid chain-id") + ErrInvalidTrustingPeriod = errorsmod.Register(ModuleName, 3, "invalid trusting period") + ErrInvalidUnbondingPeriod = errorsmod.Register(ModuleName, 4, "invalid unbonding period") + ErrInvalidHeaderHeight = errorsmod.Register(ModuleName, 5, "invalid header height") + ErrInvalidHeader = errorsmod.Register(ModuleName, 6, "invalid header") + ErrInvalidMaxClockDrift = errorsmod.Register(ModuleName, 7, "invalid max clock drift") + ErrProcessedTimeNotFound = errorsmod.Register(ModuleName, 8, "processed time not found") + ErrProcessedHeightNotFound = errorsmod.Register(ModuleName, 9, "processed height not found") + ErrDelayPeriodNotPassed = errorsmod.Register(ModuleName, 10, "packet-specified delay period has not been reached") + ErrTrustingPeriodExpired = errorsmod.Register(ModuleName, 11, "time since latest trusted state has passed the trusting period") + ErrUnbondingPeriodExpired = errorsmod.Register(ModuleName, 12, "time since latest trusted state has passed the unbonding period") + ErrInvalidProofSpecs = errorsmod.Register(ModuleName, 13, "invalid proof specs") + ErrInvalidValidatorSet = errorsmod.Register(ModuleName, 14, "invalid validator set") + ErrInvalidTrustLevel = errorsmod.Register(ModuleName, 15, "invalid trust level") +) diff --git a/modules/10-gno/fraction.go b/modules/10-gno/fraction.go new file mode 100644 index 000000000..145ff22e7 --- /dev/null +++ b/modules/10-gno/fraction.go @@ -0,0 +1,25 @@ +package gno + +import ( + cmtmath "github.com/cometbft/cometbft/libs/math" + "github.com/cometbft/cometbft/light" +) + +// DefaultTrustLevel is the tendermint light client default trust level +var DefaultTrustLevel = NewFractionFromTm(light.DefaultTrustLevel) + +// NewFractionFromTm returns a new Fraction instance from a tmmath.Fraction +func NewFractionFromTm(f cmtmath.Fraction) Fraction { + return Fraction{ + Numerator: f.Numerator, + Denominator: f.Denominator, + } +} + +// ToTendermint converts Fraction to tmmath.Fraction +func (f Fraction) ToTendermint() cmtmath.Fraction { + return cmtmath.Fraction{ + Numerator: f.Numerator, + Denominator: f.Denominator, + } +} diff --git a/modules/10-gno/gno.pb.go b/modules/10-gno/gno.pb.go new file mode 100644 index 000000000..aa4545332 --- /dev/null +++ b/modules/10-gno/gno.pb.go @@ -0,0 +1,6127 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ibc/lightclients/gno/v1/gno.proto + +package gno + +import ( + fmt "fmt" + _ "github.com/cometbft/cometbft/proto/tendermint/types" + types2 "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" + types "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" + types1 "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types" + _go "github.com/cosmos/ics23/go" + _ "google.golang.org/protobuf/types/known/durationpb" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// 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 + +// ClientState from Gno tracks the current validator set, latest height, +// and a possible frozen height. +type ClientState struct { + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + TrustLevel Fraction `protobuf:"bytes,2,opt,name=trust_level,json=trustLevel,proto3" json:"trust_level"` + // duration of the period since the LatestTimestamp during which the + // submitted headers are valid for upgrade + TrustingPeriod time.Duration `protobuf:"bytes,3,opt,name=trusting_period,json=trustingPeriod,proto3,stdduration" json:"trusting_period"` + // duration of the staking unbonding period + UnbondingPeriod time.Duration `protobuf:"bytes,4,opt,name=unbonding_period,json=unbondingPeriod,proto3,stdduration" json:"unbonding_period"` + // defines how much new (untrusted) header's Time can drift into the future. + MaxClockDrift time.Duration `protobuf:"bytes,5,opt,name=max_clock_drift,json=maxClockDrift,proto3,stdduration" json:"max_clock_drift"` + // Block height when the client was frozen due to a misbehaviour + FrozenHeight types.Height `protobuf:"bytes,6,opt,name=frozen_height,json=frozenHeight,proto3" json:"frozen_height"` + // Latest height the client was updated to + LatestHeight types.Height `protobuf:"bytes,7,opt,name=latest_height,json=latestHeight,proto3" json:"latest_height"` + // Proof specifications used in verifying counterparty state + ProofSpecs []*_go.ProofSpec `protobuf:"bytes,8,rep,name=proof_specs,json=proofSpecs,proto3" json:"proof_specs,omitempty"` + // Path at which next upgraded client will be committed. + // Each element corresponds to the key for a single CommitmentProof in the + // chained proof. NOTE: ClientState must stored under + // `{upgradePath}/{upgradeHeight}/clientState` ConsensusState must be stored + // under `{upgradepath}/{upgradeHeight}/consensusState` For SDK chains using + // the default upgrade module, upgrade_path should be []string{"upgrade", + // "upgradedIBCState"}` + UpgradePath []string `protobuf:"bytes,9,rep,name=upgrade_path,json=upgradePath,proto3" json:"upgrade_path,omitempty"` + // allow_update_after_expiry is deprecated + AllowUpdateAfterExpiry bool `protobuf:"varint,10,opt,name=allow_update_after_expiry,json=allowUpdateAfterExpiry,proto3" json:"allow_update_after_expiry,omitempty"` // Deprecated: Do not use. + // allow_update_after_misbehaviour is deprecated + AllowUpdateAfterMisbehaviour bool `protobuf:"varint,11,opt,name=allow_update_after_misbehaviour,json=allowUpdateAfterMisbehaviour,proto3" json:"allow_update_after_misbehaviour,omitempty"` // Deprecated: Do not use. +} + +func (m *ClientState) Reset() { *m = ClientState{} } +func (m *ClientState) String() string { return proto.CompactTextString(m) } +func (*ClientState) ProtoMessage() {} +func (*ClientState) Descriptor() ([]byte, []int) { + return fileDescriptor_30a4bac44dcc3529, []int{0} +} +func (m *ClientState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClientState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClientState.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 *ClientState) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClientState.Merge(m, src) +} +func (m *ClientState) XXX_Size() int { + return m.Size() +} +func (m *ClientState) XXX_DiscardUnknown() { + xxx_messageInfo_ClientState.DiscardUnknown(m) +} + +var xxx_messageInfo_ClientState proto.InternalMessageInfo + +// ConsensusState defines the consensus state from Tendermint. +type ConsensusState struct { + // timestamp that corresponds to the block height in which the ConsensusState + // was stored. + Timestamp time.Time `protobuf:"bytes,1,opt,name=timestamp,proto3,stdtime" json:"timestamp"` + // commitment root (i.e app hash) + Root types1.MerkleRoot `protobuf:"bytes,2,opt,name=root,proto3" json:"root"` + NextValidatorsHash []byte `protobuf:"bytes,3,opt,name=next_validators_hash,json=nextValidatorsHash,proto3" json:"next_validators_hash,omitempty"` +} + +func (m *ConsensusState) Reset() { *m = ConsensusState{} } +func (m *ConsensusState) String() string { return proto.CompactTextString(m) } +func (*ConsensusState) ProtoMessage() {} +func (*ConsensusState) Descriptor() ([]byte, []int) { + return fileDescriptor_30a4bac44dcc3529, []int{1} +} +func (m *ConsensusState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConsensusState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConsensusState.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 *ConsensusState) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsensusState.Merge(m, src) +} +func (m *ConsensusState) XXX_Size() int { + return m.Size() +} +func (m *ConsensusState) XXX_DiscardUnknown() { + xxx_messageInfo_ConsensusState.DiscardUnknown(m) +} + +var xxx_messageInfo_ConsensusState proto.InternalMessageInfo + +// Misbehaviour is a wrapper over two conflicting Headers +// that implements Misbehaviour interface expected by ICS-02 +type Misbehaviour struct { + // ClientID is deprecated + ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` // Deprecated: Do not use. + Header1 *Header `protobuf:"bytes,2,opt,name=header_1,json=header1,proto3" json:"header_1,omitempty"` + Header2 *Header `protobuf:"bytes,3,opt,name=header_2,json=header2,proto3" json:"header_2,omitempty"` +} + +func (m *Misbehaviour) Reset() { *m = Misbehaviour{} } +func (m *Misbehaviour) String() string { return proto.CompactTextString(m) } +func (*Misbehaviour) ProtoMessage() {} +func (*Misbehaviour) Descriptor() ([]byte, []int) { + return fileDescriptor_30a4bac44dcc3529, []int{2} +} +func (m *Misbehaviour) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Misbehaviour) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Misbehaviour.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 *Misbehaviour) XXX_Merge(src proto.Message) { + xxx_messageInfo_Misbehaviour.Merge(m, src) +} +func (m *Misbehaviour) XXX_Size() int { + return m.Size() +} +func (m *Misbehaviour) XXX_DiscardUnknown() { + xxx_messageInfo_Misbehaviour.DiscardUnknown(m) +} + +var xxx_messageInfo_Misbehaviour proto.InternalMessageInfo + +// Header defines the Tendermint client consensus Header. +// It encapsulates all the information necessary to update from a trusted +// Tendermint ConsensusState. The inclusion of TrustedHeight and +// TrustedValidators allows this update to process correctly, so long as the +// ConsensusState for the TrustedHeight exists, this removes race conditions +// among relayers The SignedHeader and ValidatorSet are the new untrusted update +// fields for the client. The TrustedHeight is the height of a stored +// ConsensusState on the client that will be used to verify the new untrusted +// header. The Trusted ConsensusState must be within the unbonding period of +// current time in order to correctly verify, and the TrustedValidators must +// hash to TrustedConsensusState.NextValidatorsHash since that is the last +// trusted validator set at the TrustedHeight. +type Header struct { + SignedHeader *SignedHeader `protobuf:"bytes,1,opt,name=signed_header,json=signedHeader,proto3" json:"signed_header,omitempty"` + ValidatorSet *ValidatorSet `protobuf:"bytes,2,opt,name=validator_set,json=validatorSet,proto3" json:"validator_set,omitempty"` + TrustedHeight types.Height `protobuf:"bytes,3,opt,name=trusted_height,json=trustedHeight,proto3" json:"trusted_height"` + TrustedValidators *ValidatorSet `protobuf:"bytes,4,opt,name=trusted_validators,json=trustedValidators,proto3" json:"trusted_validators,omitempty"` +} + +func (m *Header) Reset() { *m = Header{} } +func (m *Header) String() string { return proto.CompactTextString(m) } +func (*Header) ProtoMessage() {} +func (*Header) Descriptor() ([]byte, []int) { + return fileDescriptor_30a4bac44dcc3529, []int{3} +} +func (m *Header) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Header.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 *Header) XXX_Merge(src proto.Message) { + xxx_messageInfo_Header.Merge(m, src) +} +func (m *Header) XXX_Size() int { + return m.Size() +} +func (m *Header) XXX_DiscardUnknown() { + xxx_messageInfo_Header.DiscardUnknown(m) +} + +var xxx_messageInfo_Header proto.InternalMessageInfo + +func (m *Header) GetSignedHeader() *SignedHeader { + if m != nil { + return m.SignedHeader + } + return nil +} + +func (m *Header) GetValidatorSet() *ValidatorSet { + if m != nil { + return m.ValidatorSet + } + return nil +} + +func (m *Header) GetTrustedHeight() types.Height { + if m != nil { + return m.TrustedHeight + } + return types.Height{} +} + +func (m *Header) GetTrustedValidators() *ValidatorSet { + if m != nil { + return m.TrustedValidators + } + return nil +} + +type Block struct { + Header *GnoHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Data *Data `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + LastCommit *Commit `protobuf:"bytes,3,opt,name=last_commit,json=lastCommit,proto3" json:"last_commit,omitempty"` +} + +func (m *Block) Reset() { *m = Block{} } +func (m *Block) String() string { return proto.CompactTextString(m) } +func (*Block) ProtoMessage() {} +func (*Block) Descriptor() ([]byte, []int) { + return fileDescriptor_30a4bac44dcc3529, []int{4} +} +func (m *Block) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Block) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Block.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 *Block) XXX_Merge(src proto.Message) { + xxx_messageInfo_Block.Merge(m, src) +} +func (m *Block) XXX_Size() int { + return m.Size() +} +func (m *Block) XXX_DiscardUnknown() { + xxx_messageInfo_Block.DiscardUnknown(m) +} + +var xxx_messageInfo_Block proto.InternalMessageInfo + +func (m *Block) GetHeader() *GnoHeader { + if m != nil { + return m.Header + } + return nil +} + +func (m *Block) GetData() *Data { + if m != nil { + return m.Data + } + return nil +} + +func (m *Block) GetLastCommit() *Commit { + if m != nil { + return m.LastCommit + } + return nil +} + +type GnoHeader struct { + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + Height int64 `protobuf:"zigzag64,3,opt,name=height,proto3" json:"height,omitempty"` + Time time.Time `protobuf:"bytes,4,opt,name=time,proto3,stdtime" json:"time"` + NumTxs int64 `protobuf:"zigzag64,5,opt,name=num_txs,json=numTxs,proto3" json:"num_txs,omitempty"` + TotalTxs int64 `protobuf:"zigzag64,6,opt,name=total_txs,json=totalTxs,proto3" json:"total_txs,omitempty"` + AppVersion string `protobuf:"bytes,7,opt,name=app_version,json=appVersion,proto3" json:"app_version,omitempty"` + LastBlockId *BlockID `protobuf:"bytes,8,opt,name=last_block_id,json=lastBlockId,proto3" json:"last_block_id,omitempty"` + LastCommitHash []byte `protobuf:"bytes,9,opt,name=last_commit_hash,json=lastCommitHash,proto3" json:"last_commit_hash,omitempty"` + DataHash []byte `protobuf:"bytes,10,opt,name=data_hash,json=dataHash,proto3" json:"data_hash,omitempty"` + ValidatorsHash []byte `protobuf:"bytes,11,opt,name=validators_hash,json=validatorsHash,proto3" json:"validators_hash,omitempty"` + NextValidatorsHash []byte `protobuf:"bytes,12,opt,name=next_validators_hash,json=nextValidatorsHash,proto3" json:"next_validators_hash,omitempty"` + ConsensusHash []byte `protobuf:"bytes,13,opt,name=consensus_hash,json=consensusHash,proto3" json:"consensus_hash,omitempty"` + AppHash []byte `protobuf:"bytes,14,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` + LastResultsHash []byte `protobuf:"bytes,15,opt,name=last_results_hash,json=lastResultsHash,proto3" json:"last_results_hash,omitempty"` + ProposerAddress string `protobuf:"bytes,16,opt,name=proposer_address,json=proposerAddress,proto3" json:"proposer_address,omitempty"` +} + +func (m *GnoHeader) Reset() { *m = GnoHeader{} } +func (m *GnoHeader) String() string { return proto.CompactTextString(m) } +func (*GnoHeader) ProtoMessage() {} +func (*GnoHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_30a4bac44dcc3529, []int{5} +} +func (m *GnoHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GnoHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GnoHeader.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 *GnoHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_GnoHeader.Merge(m, src) +} +func (m *GnoHeader) XXX_Size() int { + return m.Size() +} +func (m *GnoHeader) XXX_DiscardUnknown() { + xxx_messageInfo_GnoHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_GnoHeader proto.InternalMessageInfo + +func (m *GnoHeader) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +func (m *GnoHeader) GetChainId() string { + if m != nil { + return m.ChainId + } + return "" +} + +func (m *GnoHeader) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *GnoHeader) GetTime() time.Time { + if m != nil { + return m.Time + } + return time.Time{} +} + +func (m *GnoHeader) GetNumTxs() int64 { + if m != nil { + return m.NumTxs + } + return 0 +} + +func (m *GnoHeader) GetTotalTxs() int64 { + if m != nil { + return m.TotalTxs + } + return 0 +} + +func (m *GnoHeader) GetAppVersion() string { + if m != nil { + return m.AppVersion + } + return "" +} + +func (m *GnoHeader) GetLastBlockId() *BlockID { + if m != nil { + return m.LastBlockId + } + return nil +} + +func (m *GnoHeader) GetLastCommitHash() []byte { + if m != nil { + return m.LastCommitHash + } + return nil +} + +func (m *GnoHeader) GetDataHash() []byte { + if m != nil { + return m.DataHash + } + return nil +} + +func (m *GnoHeader) GetValidatorsHash() []byte { + if m != nil { + return m.ValidatorsHash + } + return nil +} + +func (m *GnoHeader) GetNextValidatorsHash() []byte { + if m != nil { + return m.NextValidatorsHash + } + return nil +} + +func (m *GnoHeader) GetConsensusHash() []byte { + if m != nil { + return m.ConsensusHash + } + return nil +} + +func (m *GnoHeader) GetAppHash() []byte { + if m != nil { + return m.AppHash + } + return nil +} + +func (m *GnoHeader) GetLastResultsHash() []byte { + if m != nil { + return m.LastResultsHash + } + return nil +} + +func (m *GnoHeader) GetProposerAddress() string { + if m != nil { + return m.ProposerAddress + } + return "" +} + +type Data struct { + Txs [][]byte `protobuf:"bytes,1,rep,name=txs,proto3" json:"txs,omitempty"` +} + +func (m *Data) Reset() { *m = Data{} } +func (m *Data) String() string { return proto.CompactTextString(m) } +func (*Data) ProtoMessage() {} +func (*Data) Descriptor() ([]byte, []int) { + return fileDescriptor_30a4bac44dcc3529, []int{6} +} +func (m *Data) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Data) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Data.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 *Data) XXX_Merge(src proto.Message) { + xxx_messageInfo_Data.Merge(m, src) +} +func (m *Data) XXX_Size() int { + return m.Size() +} +func (m *Data) XXX_DiscardUnknown() { + xxx_messageInfo_Data.DiscardUnknown(m) +} + +var xxx_messageInfo_Data proto.InternalMessageInfo + +func (m *Data) GetTxs() [][]byte { + if m != nil { + return m.Txs + } + return nil +} + +type Commit struct { + BlockId *BlockID `protobuf:"bytes,1,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"` + Precommits []*CommitSig `protobuf:"bytes,2,rep,name=precommits,proto3" json:"precommits,omitempty"` +} + +func (m *Commit) Reset() { *m = Commit{} } +func (m *Commit) String() string { return proto.CompactTextString(m) } +func (*Commit) ProtoMessage() {} +func (*Commit) Descriptor() ([]byte, []int) { + return fileDescriptor_30a4bac44dcc3529, []int{7} +} +func (m *Commit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Commit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Commit.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 *Commit) XXX_Merge(src proto.Message) { + xxx_messageInfo_Commit.Merge(m, src) +} +func (m *Commit) XXX_Size() int { + return m.Size() +} +func (m *Commit) XXX_DiscardUnknown() { + xxx_messageInfo_Commit.DiscardUnknown(m) +} + +var xxx_messageInfo_Commit proto.InternalMessageInfo + +func (m *Commit) GetBlockId() *BlockID { + if m != nil { + return m.BlockId + } + return nil +} + +func (m *Commit) GetPrecommits() []*CommitSig { + if m != nil { + return m.Precommits + } + return nil +} + +type BlockID struct { + Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + PartsHeader *PartSetHeader `protobuf:"bytes,2,opt,name=parts_header,json=parts,proto3" json:"parts_header,omitempty"` +} + +func (m *BlockID) Reset() { *m = BlockID{} } +func (m *BlockID) String() string { return proto.CompactTextString(m) } +func (*BlockID) ProtoMessage() {} +func (*BlockID) Descriptor() ([]byte, []int) { + return fileDescriptor_30a4bac44dcc3529, []int{8} +} +func (m *BlockID) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BlockID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BlockID.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 *BlockID) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockID.Merge(m, src) +} +func (m *BlockID) XXX_Size() int { + return m.Size() +} +func (m *BlockID) XXX_DiscardUnknown() { + xxx_messageInfo_BlockID.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockID proto.InternalMessageInfo + +func (m *BlockID) GetHash() []byte { + if m != nil { + return m.Hash + } + return nil +} + +func (m *BlockID) GetPartsHeader() *PartSetHeader { + if m != nil { + return m.PartsHeader + } + return nil +} + +type SignedHeader struct { + Header *GnoHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Commit *Commit `protobuf:"bytes,2,opt,name=commit,proto3" json:"commit,omitempty"` +} + +func (m *SignedHeader) Reset() { *m = SignedHeader{} } +func (m *SignedHeader) String() string { return proto.CompactTextString(m) } +func (*SignedHeader) ProtoMessage() {} +func (*SignedHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_30a4bac44dcc3529, []int{9} +} +func (m *SignedHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SignedHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SignedHeader.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 *SignedHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_SignedHeader.Merge(m, src) +} +func (m *SignedHeader) XXX_Size() int { + return m.Size() +} +func (m *SignedHeader) XXX_DiscardUnknown() { + xxx_messageInfo_SignedHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_SignedHeader proto.InternalMessageInfo + +func (m *SignedHeader) GetHeader() *GnoHeader { + if m != nil { + return m.Header + } + return nil +} + +func (m *SignedHeader) GetCommit() *Commit { + if m != nil { + return m.Commit + } + return nil +} + +type LightBlock struct { + SignedHeader *SignedHeader `protobuf:"bytes,1,opt,name=signed_header,json=signedHeader,proto3" json:"signed_header,omitempty"` + ValidatorSet *ValidatorSet `protobuf:"bytes,2,opt,name=validator_set,json=validatorSet,proto3" json:"validator_set,omitempty"` +} + +func (m *LightBlock) Reset() { *m = LightBlock{} } +func (m *LightBlock) String() string { return proto.CompactTextString(m) } +func (*LightBlock) ProtoMessage() {} +func (*LightBlock) Descriptor() ([]byte, []int) { + return fileDescriptor_30a4bac44dcc3529, []int{10} +} +func (m *LightBlock) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LightBlock) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LightBlock.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 *LightBlock) XXX_Merge(src proto.Message) { + xxx_messageInfo_LightBlock.Merge(m, src) +} +func (m *LightBlock) XXX_Size() int { + return m.Size() +} +func (m *LightBlock) XXX_DiscardUnknown() { + xxx_messageInfo_LightBlock.DiscardUnknown(m) +} + +var xxx_messageInfo_LightBlock proto.InternalMessageInfo + +func (m *LightBlock) GetSignedHeader() *SignedHeader { + if m != nil { + return m.SignedHeader + } + return nil +} + +func (m *LightBlock) GetValidatorSet() *ValidatorSet { + if m != nil { + return m.ValidatorSet + } + return nil +} + +type CommitSig struct { + Type uint32 `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"` + Height int64 `protobuf:"zigzag64,2,opt,name=height,proto3" json:"height,omitempty"` + Round int64 `protobuf:"zigzag64,3,opt,name=round,proto3" json:"round,omitempty"` + BlockId *BlockID `protobuf:"bytes,4,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"` + Timestamp time.Time `protobuf:"bytes,5,opt,name=timestamp,proto3,stdtime" json:"timestamp"` + ValidatorAddress string `protobuf:"bytes,6,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + ValidatorIndex int64 `protobuf:"zigzag64,7,opt,name=validator_index,json=validatorIndex,proto3" json:"validator_index,omitempty"` + Signature []byte `protobuf:"bytes,8,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (m *CommitSig) Reset() { *m = CommitSig{} } +func (m *CommitSig) String() string { return proto.CompactTextString(m) } +func (*CommitSig) ProtoMessage() {} +func (*CommitSig) Descriptor() ([]byte, []int) { + return fileDescriptor_30a4bac44dcc3529, []int{11} +} +func (m *CommitSig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommitSig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CommitSig.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 *CommitSig) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommitSig.Merge(m, src) +} +func (m *CommitSig) XXX_Size() int { + return m.Size() +} +func (m *CommitSig) XXX_DiscardUnknown() { + xxx_messageInfo_CommitSig.DiscardUnknown(m) +} + +var xxx_messageInfo_CommitSig proto.InternalMessageInfo + +func (m *CommitSig) GetType() uint32 { + if m != nil { + return m.Type + } + return 0 +} + +func (m *CommitSig) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *CommitSig) GetRound() int64 { + if m != nil { + return m.Round + } + return 0 +} + +func (m *CommitSig) GetBlockId() *BlockID { + if m != nil { + return m.BlockId + } + return nil +} + +func (m *CommitSig) GetTimestamp() time.Time { + if m != nil { + return m.Timestamp + } + return time.Time{} +} + +func (m *CommitSig) GetValidatorAddress() string { + if m != nil { + return m.ValidatorAddress + } + return "" +} + +func (m *CommitSig) GetValidatorIndex() int64 { + if m != nil { + return m.ValidatorIndex + } + return 0 +} + +func (m *CommitSig) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +type Vote struct { + Type uint32 `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"` + Height int64 `protobuf:"zigzag64,2,opt,name=height,proto3" json:"height,omitempty"` + Round int64 `protobuf:"zigzag64,3,opt,name=round,proto3" json:"round,omitempty"` + BlockId *BlockID `protobuf:"bytes,4,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"` + Timestamp time.Time `protobuf:"bytes,5,opt,name=timestamp,proto3,stdtime" json:"timestamp"` + ValidatorAddress string `protobuf:"bytes,6,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + ValidatorIndex int64 `protobuf:"zigzag64,7,opt,name=validator_index,json=validatorIndex,proto3" json:"validator_index,omitempty"` + Signature []byte `protobuf:"bytes,8,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (m *Vote) Reset() { *m = Vote{} } +func (m *Vote) String() string { return proto.CompactTextString(m) } +func (*Vote) ProtoMessage() {} +func (*Vote) Descriptor() ([]byte, []int) { + return fileDescriptor_30a4bac44dcc3529, []int{12} +} +func (m *Vote) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Vote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Vote.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 *Vote) XXX_Merge(src proto.Message) { + xxx_messageInfo_Vote.Merge(m, src) +} +func (m *Vote) XXX_Size() int { + return m.Size() +} +func (m *Vote) XXX_DiscardUnknown() { + xxx_messageInfo_Vote.DiscardUnknown(m) +} + +var xxx_messageInfo_Vote proto.InternalMessageInfo + +func (m *Vote) GetType() uint32 { + if m != nil { + return m.Type + } + return 0 +} + +func (m *Vote) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *Vote) GetRound() int64 { + if m != nil { + return m.Round + } + return 0 +} + +func (m *Vote) GetBlockId() *BlockID { + if m != nil { + return m.BlockId + } + return nil +} + +func (m *Vote) GetTimestamp() time.Time { + if m != nil { + return m.Timestamp + } + return time.Time{} +} + +func (m *Vote) GetValidatorAddress() string { + if m != nil { + return m.ValidatorAddress + } + return "" +} + +func (m *Vote) GetValidatorIndex() int64 { + if m != nil { + return m.ValidatorIndex + } + return 0 +} + +func (m *Vote) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +type PartSet struct { +} + +func (m *PartSet) Reset() { *m = PartSet{} } +func (m *PartSet) String() string { return proto.CompactTextString(m) } +func (*PartSet) ProtoMessage() {} +func (*PartSet) Descriptor() ([]byte, []int) { + return fileDescriptor_30a4bac44dcc3529, []int{13} +} +func (m *PartSet) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PartSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PartSet.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 *PartSet) XXX_Merge(src proto.Message) { + xxx_messageInfo_PartSet.Merge(m, src) +} +func (m *PartSet) XXX_Size() int { + return m.Size() +} +func (m *PartSet) XXX_DiscardUnknown() { + xxx_messageInfo_PartSet.DiscardUnknown(m) +} + +var xxx_messageInfo_PartSet proto.InternalMessageInfo + +type PartSetHeader struct { + Total int64 `protobuf:"zigzag64,1,opt,name=total,proto3" json:"total,omitempty"` + Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` +} + +func (m *PartSetHeader) Reset() { *m = PartSetHeader{} } +func (m *PartSetHeader) String() string { return proto.CompactTextString(m) } +func (*PartSetHeader) ProtoMessage() {} +func (*PartSetHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_30a4bac44dcc3529, []int{14} +} +func (m *PartSetHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PartSetHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PartSetHeader.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 *PartSetHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_PartSetHeader.Merge(m, src) +} +func (m *PartSetHeader) XXX_Size() int { + return m.Size() +} +func (m *PartSetHeader) XXX_DiscardUnknown() { + xxx_messageInfo_PartSetHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_PartSetHeader proto.InternalMessageInfo + +func (m *PartSetHeader) GetTotal() int64 { + if m != nil { + return m.Total + } + return 0 +} + +func (m *PartSetHeader) GetHash() []byte { + if m != nil { + return m.Hash + } + return nil +} + +type Validator struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + PubKey *types2.Any `protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` + VotingPower int64 `protobuf:"zigzag64,3,opt,name=voting_power,json=votingPower,proto3" json:"voting_power,omitempty"` + ProposerPriority int64 `protobuf:"zigzag64,4,opt,name=proposer_priority,json=proposerPriority,proto3" json:"proposer_priority,omitempty"` +} + +func (m *Validator) Reset() { *m = Validator{} } +func (m *Validator) String() string { return proto.CompactTextString(m) } +func (*Validator) ProtoMessage() {} +func (*Validator) Descriptor() ([]byte, []int) { + return fileDescriptor_30a4bac44dcc3529, []int{15} +} +func (m *Validator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Validator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Validator.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 *Validator) XXX_Merge(src proto.Message) { + xxx_messageInfo_Validator.Merge(m, src) +} +func (m *Validator) XXX_Size() int { + return m.Size() +} +func (m *Validator) XXX_DiscardUnknown() { + xxx_messageInfo_Validator.DiscardUnknown(m) +} + +var xxx_messageInfo_Validator proto.InternalMessageInfo + +func (m *Validator) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *Validator) GetPubKey() *types2.Any { + if m != nil { + return m.PubKey + } + return nil +} + +func (m *Validator) GetVotingPower() int64 { + if m != nil { + return m.VotingPower + } + return 0 +} + +func (m *Validator) GetProposerPriority() int64 { + if m != nil { + return m.ProposerPriority + } + return 0 +} + +type ValidatorSet struct { + Validators []*Validator `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators,omitempty"` + Proposer *Validator `protobuf:"bytes,2,opt,name=proposer,proto3" json:"proposer,omitempty"` +} + +func (m *ValidatorSet) Reset() { *m = ValidatorSet{} } +func (m *ValidatorSet) String() string { return proto.CompactTextString(m) } +func (*ValidatorSet) ProtoMessage() {} +func (*ValidatorSet) Descriptor() ([]byte, []int) { + return fileDescriptor_30a4bac44dcc3529, []int{16} +} +func (m *ValidatorSet) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ValidatorSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ValidatorSet.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 *ValidatorSet) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorSet.Merge(m, src) +} +func (m *ValidatorSet) XXX_Size() int { + return m.Size() +} +func (m *ValidatorSet) XXX_DiscardUnknown() { + xxx_messageInfo_ValidatorSet.DiscardUnknown(m) +} + +var xxx_messageInfo_ValidatorSet proto.InternalMessageInfo + +func (m *ValidatorSet) GetValidators() []*Validator { + if m != nil { + return m.Validators + } + return nil +} + +func (m *ValidatorSet) GetProposer() *Validator { + if m != nil { + return m.Proposer + } + return nil +} + +// Fraction defines the protobuf message type for tmmath.Fraction that only +// supports positive values. +type Fraction struct { + Numerator uint64 `protobuf:"varint,1,opt,name=numerator,proto3" json:"numerator,omitempty"` + Denominator uint64 `protobuf:"varint,2,opt,name=denominator,proto3" json:"denominator,omitempty"` +} + +func (m *Fraction) Reset() { *m = Fraction{} } +func (m *Fraction) String() string { return proto.CompactTextString(m) } +func (*Fraction) ProtoMessage() {} +func (*Fraction) Descriptor() ([]byte, []int) { + return fileDescriptor_30a4bac44dcc3529, []int{17} +} +func (m *Fraction) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Fraction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Fraction.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 *Fraction) XXX_Merge(src proto.Message) { + xxx_messageInfo_Fraction.Merge(m, src) +} +func (m *Fraction) XXX_Size() int { + return m.Size() +} +func (m *Fraction) XXX_DiscardUnknown() { + xxx_messageInfo_Fraction.DiscardUnknown(m) +} + +var xxx_messageInfo_Fraction proto.InternalMessageInfo + +func (m *Fraction) GetNumerator() uint64 { + if m != nil { + return m.Numerator + } + return 0 +} + +func (m *Fraction) GetDenominator() uint64 { + if m != nil { + return m.Denominator + } + return 0 +} + +func init() { + proto.RegisterType((*ClientState)(nil), "ibc.lightclients.gno.v1.ClientState") + proto.RegisterType((*ConsensusState)(nil), "ibc.lightclients.gno.v1.ConsensusState") + proto.RegisterType((*Misbehaviour)(nil), "ibc.lightclients.gno.v1.Misbehaviour") + proto.RegisterType((*Header)(nil), "ibc.lightclients.gno.v1.Header") + proto.RegisterType((*Block)(nil), "ibc.lightclients.gno.v1.Block") + proto.RegisterType((*GnoHeader)(nil), "ibc.lightclients.gno.v1.GnoHeader") + proto.RegisterType((*Data)(nil), "ibc.lightclients.gno.v1.Data") + proto.RegisterType((*Commit)(nil), "ibc.lightclients.gno.v1.Commit") + proto.RegisterType((*BlockID)(nil), "ibc.lightclients.gno.v1.BlockID") + proto.RegisterType((*SignedHeader)(nil), "ibc.lightclients.gno.v1.SignedHeader") + proto.RegisterType((*LightBlock)(nil), "ibc.lightclients.gno.v1.LightBlock") + proto.RegisterType((*CommitSig)(nil), "ibc.lightclients.gno.v1.CommitSig") + proto.RegisterType((*Vote)(nil), "ibc.lightclients.gno.v1.Vote") + proto.RegisterType((*PartSet)(nil), "ibc.lightclients.gno.v1.PartSet") + proto.RegisterType((*PartSetHeader)(nil), "ibc.lightclients.gno.v1.PartSetHeader") + proto.RegisterType((*Validator)(nil), "ibc.lightclients.gno.v1.Validator") + proto.RegisterType((*ValidatorSet)(nil), "ibc.lightclients.gno.v1.ValidatorSet") + proto.RegisterType((*Fraction)(nil), "ibc.lightclients.gno.v1.Fraction") +} + +func init() { proto.RegisterFile("ibc/lightclients/gno/v1/gno.proto", fileDescriptor_30a4bac44dcc3529) } + +var fileDescriptor_30a4bac44dcc3529 = []byte{ + // 1576 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x57, 0xcf, 0x6f, 0x23, 0x49, + 0x15, 0x4e, 0x3b, 0x8e, 0x7f, 0x3c, 0xdb, 0x49, 0xa6, 0x14, 0xed, 0x3a, 0xc3, 0x10, 0x7b, 0x5a, + 0x5a, 0x36, 0x80, 0xc6, 0x5e, 0x67, 0x0f, 0xc0, 0x0e, 0x20, 0xc6, 0xc9, 0x32, 0xc9, 0xce, 0x2c, + 0x8a, 0x3a, 0xc3, 0x1c, 0xb8, 0xb4, 0xca, 0xee, 0x8a, 0xdd, 0x1a, 0x77, 0x57, 0xab, 0xaa, 0xda, + 0x9b, 0x70, 0xe5, 0x02, 0xb7, 0x15, 0x27, 0x8e, 0x1c, 0xf8, 0x23, 0xb8, 0x20, 0x24, 0x2e, 0xac, + 0x38, 0xed, 0x11, 0x09, 0x69, 0x40, 0x99, 0x1b, 0x7f, 0x05, 0xaa, 0x57, 0xd5, 0xed, 0x76, 0xc0, + 0x8c, 0x67, 0xb8, 0x70, 0xd8, 0x53, 0xaa, 0xea, 0x7d, 0xef, 0x4b, 0xd5, 0xf7, 0xea, 0x7d, 0xd5, + 0x86, 0xfb, 0xe1, 0x68, 0xdc, 0x9f, 0x85, 0x93, 0xa9, 0x1a, 0xcf, 0x42, 0x16, 0x2b, 0xd9, 0x9f, + 0xc4, 0xbc, 0x3f, 0x1f, 0xe8, 0x3f, 0xbd, 0x44, 0x70, 0xc5, 0xc9, 0xbb, 0xe1, 0x68, 0xdc, 0x2b, + 0x42, 0x7a, 0x3a, 0x36, 0x1f, 0xdc, 0xbd, 0x37, 0xe6, 0x32, 0xe2, 0xb2, 0x1f, 0x8e, 0xe5, 0xd1, + 0x87, 0x3a, 0x27, 0x11, 0x9c, 0x5f, 0x4a, 0x93, 0x76, 0x77, 0x6f, 0xc2, 0x27, 0x1c, 0x87, 0x7d, + 0x3d, 0xb2, 0xab, 0x07, 0x13, 0xce, 0x27, 0x33, 0xd6, 0xc7, 0xd9, 0x28, 0xbd, 0xec, 0x07, 0xa9, + 0xa0, 0x2a, 0xe4, 0xb1, 0x8d, 0xef, 0xdf, 0x8e, 0xd3, 0xf8, 0xda, 0x86, 0x3a, 0xb7, 0x43, 0x2a, + 0x8c, 0x98, 0x54, 0x34, 0x4a, 0x32, 0x80, 0x3e, 0xcb, 0x98, 0x0b, 0xd6, 0x37, 0x1b, 0xd5, 0x5b, + 0x32, 0x23, 0x0b, 0x78, 0x7f, 0x01, 0xe0, 0x51, 0x14, 0xaa, 0x28, 0x03, 0xe5, 0x33, 0x0b, 0xec, + 0x2a, 0x16, 0x07, 0x4c, 0x44, 0x61, 0xac, 0xfa, 0xea, 0x3a, 0x61, 0xb2, 0x3f, 0xa7, 0xb3, 0x30, + 0xa0, 0x8a, 0x0b, 0x83, 0x70, 0xff, 0xb6, 0x05, 0x8d, 0x63, 0xe4, 0xbe, 0x50, 0x54, 0x31, 0xb2, + 0x0f, 0xb5, 0xf1, 0x94, 0x86, 0xb1, 0x1f, 0x06, 0x6d, 0xa7, 0xeb, 0x1c, 0xd6, 0xbd, 0x2a, 0xce, + 0xcf, 0x02, 0x72, 0x0a, 0x0d, 0x25, 0x52, 0xa9, 0xfc, 0x19, 0x9b, 0xb3, 0x59, 0xbb, 0xd4, 0x75, + 0x0e, 0x1b, 0x47, 0xf7, 0x7b, 0x2b, 0x54, 0xed, 0xfd, 0x58, 0xd0, 0xb1, 0x16, 0x64, 0x58, 0xfe, + 0xe2, 0x65, 0x67, 0xc3, 0x03, 0xcc, 0x7d, 0xaa, 0x53, 0xc9, 0x53, 0xd8, 0xc1, 0x59, 0x18, 0x4f, + 0xfc, 0x84, 0x89, 0x90, 0x07, 0xed, 0x4d, 0x64, 0xdb, 0xef, 0x19, 0x6d, 0x7a, 0x99, 0x36, 0xbd, + 0x13, 0x2b, 0xeb, 0xb0, 0xa6, 0x59, 0x7e, 0xf3, 0xf7, 0x8e, 0xe3, 0x6d, 0x67, 0xb9, 0xe7, 0x98, + 0x4a, 0x7e, 0x02, 0xbb, 0x69, 0x3c, 0xe2, 0x71, 0x50, 0xa0, 0x2b, 0xaf, 0x4f, 0xb7, 0x93, 0x27, + 0x5b, 0xbe, 0x27, 0xb0, 0x13, 0xd1, 0x2b, 0x7f, 0x3c, 0xe3, 0xe3, 0x17, 0x7e, 0x20, 0xc2, 0x4b, + 0xd5, 0xde, 0x5a, 0x9f, 0xae, 0x15, 0xd1, 0xab, 0x63, 0x9d, 0x7a, 0xa2, 0x33, 0xc9, 0xc7, 0xd0, + 0xba, 0x14, 0xfc, 0xe7, 0x2c, 0xf6, 0xa7, 0x4c, 0x8b, 0xd4, 0xae, 0x20, 0xd5, 0x5d, 0x94, 0x4d, + 0x97, 0xb0, 0x67, 0x2b, 0x3b, 0x1f, 0xf4, 0x4e, 0x11, 0x61, 0xf5, 0x6a, 0x9a, 0x34, 0xb3, 0xa6, + 0x69, 0x66, 0x54, 0x31, 0xa9, 0x32, 0x9a, 0xea, 0xba, 0x34, 0x26, 0xcd, 0xd2, 0x3c, 0x84, 0x06, + 0xde, 0x6d, 0x5f, 0x26, 0x6c, 0x2c, 0xdb, 0xb5, 0xee, 0x26, 0x92, 0x98, 0xfb, 0xdf, 0xc3, 0xfb, + 0xaf, 0x19, 0xce, 0x35, 0xe6, 0x22, 0x61, 0x63, 0x0f, 0x92, 0x6c, 0x28, 0xc9, 0x7d, 0x68, 0xa6, + 0xc9, 0x44, 0xd0, 0x80, 0xf9, 0x09, 0x55, 0xd3, 0x76, 0xbd, 0xbb, 0x79, 0x58, 0xf7, 0x1a, 0x76, + 0xed, 0x9c, 0xaa, 0x29, 0xf9, 0x01, 0xec, 0xd3, 0xd9, 0x8c, 0x7f, 0xe6, 0xa7, 0x49, 0x40, 0x15, + 0xf3, 0xe9, 0xa5, 0x62, 0xc2, 0x67, 0x57, 0x49, 0x28, 0xae, 0xdb, 0xd0, 0x75, 0x0e, 0x6b, 0xc3, + 0x52, 0xdb, 0xf1, 0xde, 0x41, 0xd0, 0x4f, 0x11, 0xf3, 0x48, 0x43, 0x3e, 0x46, 0x04, 0x39, 0x83, + 0xce, 0x7f, 0x48, 0x8f, 0x42, 0x39, 0x62, 0x53, 0x3a, 0x0f, 0x79, 0x2a, 0xda, 0x8d, 0x9c, 0xe4, + 0xde, 0x6d, 0x92, 0x4f, 0x0b, 0xb8, 0x8f, 0xca, 0xbf, 0xfc, 0x6d, 0x67, 0xc3, 0xfd, 0x8b, 0x03, + 0xdb, 0xc7, 0x3c, 0x96, 0x2c, 0x96, 0xa9, 0x34, 0x17, 0x7c, 0x08, 0xf5, 0xbc, 0xdf, 0xf0, 0x86, + 0x6b, 0x01, 0x6e, 0xd7, 0xf5, 0x59, 0x86, 0x30, 0x85, 0xfd, 0x5c, 0x17, 0x76, 0x91, 0x46, 0xbe, + 0x0f, 0x65, 0xc1, 0xb9, 0xb2, 0x2d, 0xe0, 0x16, 0x8a, 0xb0, 0x68, 0xc0, 0xf9, 0xa0, 0xf7, 0x29, + 0x13, 0x2f, 0x66, 0xcc, 0xe3, 0x3c, 0x2b, 0x06, 0x66, 0x91, 0x0f, 0x60, 0x2f, 0x66, 0x57, 0xca, + 0xcf, 0x5b, 0x51, 0xfa, 0x53, 0x2a, 0xa7, 0xd8, 0x02, 0x4d, 0x8f, 0xe8, 0xd8, 0xf3, 0x3c, 0x74, + 0x4a, 0xe5, 0xd4, 0x1e, 0xe6, 0xcf, 0x0e, 0x34, 0x8b, 0x67, 0x24, 0x1d, 0xa8, 0x9b, 0xaa, 0xe7, + 0xcd, 0x8a, 0xc2, 0xd4, 0xcc, 0xe2, 0x59, 0x40, 0x1e, 0x43, 0x6d, 0xca, 0x68, 0xc0, 0x84, 0x3f, + 0xb0, 0x7b, 0xed, 0xac, 0x6c, 0xd7, 0x53, 0x04, 0x0e, 0x1b, 0x37, 0x2f, 0x3b, 0x55, 0x33, 0x1e, + 0x78, 0x55, 0x93, 0x3d, 0x28, 0x10, 0x1d, 0xd9, 0x4e, 0x7d, 0x13, 0xa2, 0xa3, 0x8c, 0xe8, 0xc8, + 0x9e, 0xe4, 0x8f, 0x25, 0xa8, 0x98, 0x10, 0xf9, 0x04, 0x5a, 0x32, 0x9c, 0xc4, 0x2c, 0xf0, 0x0d, + 0xc4, 0x96, 0xe4, 0xbd, 0x95, 0xf4, 0x17, 0x88, 0x36, 0xd9, 0x5e, 0x53, 0x16, 0x66, 0x9a, 0x2b, + 0xd7, 0xd4, 0x97, 0x2c, 0xab, 0xcf, 0x6a, 0xae, 0x5c, 0xe6, 0x0b, 0xa6, 0xbc, 0xe6, 0xbc, 0x30, + 0x23, 0x8f, 0xc1, 0xd8, 0x0c, 0x6e, 0x0c, 0x3b, 0x6e, 0x73, 0xcd, 0x8e, 0x6b, 0xd9, 0x3c, 0xdb, + 0x72, 0xcf, 0x80, 0x64, 0x44, 0x8b, 0x82, 0x5b, 0x7f, 0x5a, 0x73, 0x67, 0x77, 0x2c, 0xc1, 0xe2, + 0x56, 0xb8, 0xbf, 0x77, 0x60, 0x6b, 0xa8, 0x5d, 0x86, 0x7c, 0x04, 0x95, 0x25, 0xe5, 0xdc, 0x95, + 0x9c, 0x8f, 0x63, 0x6e, 0x65, 0xb3, 0x19, 0x64, 0x00, 0xe5, 0x80, 0x2a, 0x6a, 0x75, 0xfa, 0xfa, + 0xca, 0xcc, 0x13, 0xaa, 0xa8, 0x87, 0x50, 0xf2, 0x23, 0x68, 0xcc, 0xa8, 0x54, 0xbe, 0xb9, 0xe9, + 0xaf, 0xbd, 0x0c, 0xc7, 0x08, 0xf3, 0x40, 0xe7, 0x98, 0xb1, 0xfb, 0xcf, 0x32, 0xd4, 0xf3, 0xad, + 0x90, 0x36, 0x54, 0xe7, 0x4c, 0xc8, 0x90, 0xc7, 0xd9, 0x73, 0x63, 0xa7, 0x4b, 0x2f, 0x51, 0x69, + 0xf9, 0x25, 0x7a, 0x47, 0x9f, 0x39, 0x2f, 0x0a, 0xf1, 0xec, 0x8c, 0x7c, 0x17, 0xca, 0xba, 0x49, + 0xad, 0xba, 0xeb, 0xb5, 0x35, 0x66, 0x90, 0x77, 0xa1, 0x1a, 0xa7, 0x91, 0xaf, 0xae, 0x24, 0x7a, + 0x3d, 0xf1, 0x2a, 0x71, 0x1a, 0x3d, 0xbb, 0x92, 0xe4, 0x6b, 0x50, 0x57, 0x5c, 0xd1, 0x19, 0x86, + 0x2a, 0x18, 0xaa, 0xe1, 0x82, 0x0e, 0x76, 0xa0, 0x41, 0x93, 0xc4, 0xcf, 0x0e, 0x50, 0xc5, 0x5d, + 0x02, 0x4d, 0x92, 0xe7, 0xf6, 0x0c, 0x27, 0xda, 0xb6, 0xa5, 0xf2, 0x47, 0xf8, 0x96, 0x84, 0x41, + 0xbb, 0x86, 0x3b, 0xeb, 0xae, 0xd4, 0x0b, 0x6b, 0x7a, 0x76, 0xe2, 0xa1, 0xc8, 0x66, 0x12, 0x90, + 0x43, 0xd8, 0x2d, 0x68, 0x6e, 0xcc, 0xa2, 0x8e, 0x66, 0xb1, 0xbd, 0xd0, 0x55, 0x1b, 0x85, 0xde, + 0xad, 0xae, 0x92, 0x81, 0x00, 0x42, 0x6a, 0x7a, 0x01, 0x83, 0xef, 0xc3, 0xce, 0x6d, 0xcb, 0x69, + 0x18, 0x96, 0xf9, 0x92, 0xdd, 0xac, 0x34, 0xa8, 0xe6, 0x2a, 0x83, 0x22, 0xef, 0xc1, 0xf6, 0x38, + 0xb3, 0x59, 0x83, 0x6d, 0x21, 0xb6, 0x95, 0xaf, 0x22, 0x6c, 0x1f, 0x6a, 0x5a, 0x2f, 0x04, 0x6c, + 0x23, 0xa0, 0x4a, 0x93, 0x04, 0x43, 0xdf, 0x82, 0x3b, 0x78, 0x46, 0xc1, 0x64, 0x3a, 0x53, 0x96, + 0x64, 0x07, 0x31, 0x3b, 0x3a, 0xe0, 0x99, 0x75, 0xc4, 0x7e, 0x13, 0x76, 0x13, 0xc1, 0x13, 0x2e, + 0x99, 0xf0, 0x69, 0x10, 0x08, 0x26, 0x65, 0x7b, 0x17, 0xb5, 0xdf, 0xc9, 0xd6, 0x1f, 0x99, 0x65, + 0xb7, 0x0d, 0x65, 0x7d, 0x79, 0xc9, 0x2e, 0x6c, 0xea, 0x02, 0x3a, 0xdd, 0xcd, 0xc3, 0xa6, 0xa7, + 0x87, 0xee, 0xaf, 0x1c, 0xa8, 0x18, 0xe5, 0xc8, 0x43, 0xa8, 0xe5, 0x05, 0x72, 0xd6, 0x2c, 0x50, + 0x75, 0x64, 0x8b, 0x33, 0x04, 0x48, 0x04, 0x33, 0xa5, 0x91, 0xed, 0x12, 0xbe, 0xa8, 0xee, 0x6b, + 0xfa, 0xe1, 0x22, 0x9c, 0x78, 0x85, 0x2c, 0x77, 0x04, 0x55, 0xcb, 0x4b, 0x08, 0x94, 0xf1, 0xe8, + 0x0e, 0x1e, 0x1d, 0xc7, 0xe4, 0x18, 0x9a, 0x09, 0x15, 0x5a, 0x14, 0xd3, 0xe8, 0xa6, 0x5d, 0xbf, + 0xb1, 0xf2, 0x9f, 0x9c, 0x53, 0xa1, 0x2e, 0x98, 0xb2, 0xcd, 0xbe, 0x85, 0xb9, 0xee, 0x2f, 0x1c, + 0x68, 0x16, 0xbd, 0xf3, 0x7f, 0x32, 0x8e, 0xef, 0x40, 0xc5, 0x1a, 0x40, 0x69, 0x3d, 0x03, 0xb0, + 0x70, 0xf7, 0x77, 0x0e, 0xc0, 0x53, 0x34, 0x4b, 0x34, 0xaf, 0xff, 0x53, 0xf7, 0x77, 0xff, 0x54, + 0x82, 0x7a, 0x5e, 0x2a, 0x5d, 0x13, 0xfd, 0xf1, 0x8c, 0x9b, 0x6b, 0x79, 0x38, 0x2e, 0x58, 0x50, + 0x69, 0xc9, 0x82, 0xf6, 0x60, 0x4b, 0xf0, 0x34, 0x0e, 0xac, 0x33, 0x99, 0xc9, 0xd2, 0x0d, 0x2b, + 0xbf, 0xf9, 0x0d, 0x2b, 0x7c, 0xb1, 0x6c, 0xbd, 0xdd, 0x17, 0xcb, 0xb7, 0xe1, 0xce, 0x42, 0x9c, + 0xac, 0x67, 0x2a, 0xd8, 0x33, 0xbb, 0x79, 0xc0, 0x36, 0xcd, 0x92, 0x51, 0xf8, 0x61, 0x1c, 0xb0, + 0x2b, 0xb4, 0x36, 0x52, 0x30, 0x8a, 0x33, 0xbd, 0x4a, 0xee, 0x41, 0x5d, 0x97, 0x80, 0xaa, 0x54, + 0x30, 0xb4, 0xb6, 0xa6, 0xb7, 0x58, 0x70, 0xff, 0x50, 0x82, 0xf2, 0x73, 0xae, 0xd8, 0x57, 0xfa, + 0xbd, 0x9d, 0x7e, 0x75, 0xa8, 0xda, 0x4e, 0x76, 0xbf, 0x07, 0xad, 0xa5, 0xa6, 0xd6, 0x32, 0xe1, + 0x2b, 0x84, 0x9a, 0x12, 0xcf, 0x4c, 0x72, 0xf3, 0x28, 0x2d, 0xcc, 0x43, 0x77, 0x5c, 0x3d, 0xbf, + 0xe9, 0xfa, 0xb9, 0xcd, 0x76, 0x6f, 0x9f, 0x5b, 0x3b, 0x25, 0x0f, 0xa0, 0x9a, 0xa4, 0x23, 0xff, + 0x05, 0xbb, 0xb6, 0x8d, 0xb3, 0xf7, 0x6f, 0x1a, 0x3d, 0x8a, 0xaf, 0xbd, 0x4a, 0x92, 0x8e, 0x9e, + 0xb0, 0x6b, 0xfd, 0x63, 0x60, 0xce, 0xcd, 0x0f, 0x38, 0xfe, 0x19, 0x13, 0xb6, 0x5c, 0x0d, 0xb3, + 0x76, 0xae, 0x97, 0xb4, 0x66, 0xb9, 0x4d, 0x27, 0x22, 0xe4, 0x22, 0x54, 0xd7, 0x58, 0x3d, 0xe2, + 0xe5, 0xfe, 0x7d, 0x6e, 0xd7, 0xdd, 0x5f, 0x3b, 0xd0, 0x2c, 0x36, 0xa4, 0xf6, 0xd5, 0xc2, 0xf7, + 0x92, 0xf3, 0x1a, 0x5f, 0xcd, 0x53, 0xbd, 0x42, 0x16, 0xf9, 0x21, 0xd4, 0xb2, 0x7f, 0xb4, 0xf4, + 0xad, 0xfe, 0xdf, 0x19, 0xf2, 0x1c, 0xf7, 0x13, 0xa8, 0x65, 0xbf, 0x62, 0x75, 0xad, 0xe2, 0x34, + 0x62, 0x42, 0x43, 0x50, 0xbb, 0xb2, 0xb7, 0x58, 0x20, 0x5d, 0x68, 0x04, 0x2c, 0xe6, 0x51, 0x18, + 0x63, 0xbc, 0x84, 0xf1, 0xe2, 0xd2, 0xf0, 0xc9, 0x17, 0x37, 0x07, 0xce, 0x97, 0x37, 0x07, 0xce, + 0x3f, 0x6e, 0x0e, 0x9c, 0xcf, 0x5f, 0x1d, 0x6c, 0x7c, 0xf9, 0xea, 0x60, 0xe3, 0xaf, 0xaf, 0x0e, + 0x36, 0x7e, 0x36, 0x98, 0x84, 0x6a, 0x9a, 0x8e, 0xf4, 0x8f, 0x87, 0x3e, 0x55, 0x3c, 0xe2, 0x31, + 0x7b, 0x30, 0x4d, 0x47, 0xd9, 0xb8, 0x1f, 0xf1, 0x20, 0x9d, 0x31, 0xd9, 0x1f, 0x7c, 0xf0, 0x60, + 0x12, 0xf3, 0x87, 0x93, 0x98, 0x8f, 0x2a, 0x58, 0x93, 0x0f, 0xff, 0x15, 0x00, 0x00, 0xff, 0xff, + 0xe2, 0x1a, 0xc2, 0x18, 0xf6, 0x10, 0x00, 0x00, +} + +func (m *ClientState) 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 *ClientState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClientState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AllowUpdateAfterMisbehaviour { + i-- + if m.AllowUpdateAfterMisbehaviour { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x58 + } + if m.AllowUpdateAfterExpiry { + i-- + if m.AllowUpdateAfterExpiry { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x50 + } + if len(m.UpgradePath) > 0 { + for iNdEx := len(m.UpgradePath) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.UpgradePath[iNdEx]) + copy(dAtA[i:], m.UpgradePath[iNdEx]) + i = encodeVarintGno(dAtA, i, uint64(len(m.UpgradePath[iNdEx]))) + i-- + dAtA[i] = 0x4a + } + } + if len(m.ProofSpecs) > 0 { + for iNdEx := len(m.ProofSpecs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ProofSpecs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + } + { + size, err := m.LatestHeight.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + { + size, err := m.FrozenHeight.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + n3, err3 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.MaxClockDrift, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.MaxClockDrift):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintGno(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x2a + n4, err4 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.UnbondingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.UnbondingPeriod):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintGno(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x22 + n5, err5 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.TrustingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.TrustingPeriod):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintGno(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0x1a + { + size, err := m.TrustLevel.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.ChainId) > 0 { + i -= len(m.ChainId) + copy(dAtA[i:], m.ChainId) + i = encodeVarintGno(dAtA, i, uint64(len(m.ChainId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ConsensusState) 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 *ConsensusState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConsensusState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NextValidatorsHash) > 0 { + i -= len(m.NextValidatorsHash) + copy(dAtA[i:], m.NextValidatorsHash) + i = encodeVarintGno(dAtA, i, uint64(len(m.NextValidatorsHash))) + i-- + dAtA[i] = 0x1a + } + { + size, err := m.Root.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + n8, err8 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp):]) + if err8 != nil { + return 0, err8 + } + i -= n8 + i = encodeVarintGno(dAtA, i, uint64(n8)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Misbehaviour) 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 *Misbehaviour) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Misbehaviour) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Header2 != nil { + { + size, err := m.Header2.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.Header1 != nil { + { + size, err := m.Header1.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.ClientId) > 0 { + i -= len(m.ClientId) + copy(dAtA[i:], m.ClientId) + i = encodeVarintGno(dAtA, i, uint64(len(m.ClientId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Header) 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 *Header) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.TrustedValidators != nil { + { + size, err := m.TrustedValidators.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + { + size, err := m.TrustedHeight.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.ValidatorSet != nil { + { + size, err := m.ValidatorSet.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.SignedHeader != nil { + { + size, err := m.SignedHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Block) 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 *Block) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Block) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LastCommit != nil { + { + size, err := m.LastCommit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.Data != nil { + { + size, err := m.Data.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GnoHeader) 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 *GnoHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GnoHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ProposerAddress) > 0 { + i -= len(m.ProposerAddress) + copy(dAtA[i:], m.ProposerAddress) + i = encodeVarintGno(dAtA, i, uint64(len(m.ProposerAddress))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + } + if len(m.LastResultsHash) > 0 { + i -= len(m.LastResultsHash) + copy(dAtA[i:], m.LastResultsHash) + i = encodeVarintGno(dAtA, i, uint64(len(m.LastResultsHash))) + i-- + dAtA[i] = 0x7a + } + if len(m.AppHash) > 0 { + i -= len(m.AppHash) + copy(dAtA[i:], m.AppHash) + i = encodeVarintGno(dAtA, i, uint64(len(m.AppHash))) + i-- + dAtA[i] = 0x72 + } + if len(m.ConsensusHash) > 0 { + i -= len(m.ConsensusHash) + copy(dAtA[i:], m.ConsensusHash) + i = encodeVarintGno(dAtA, i, uint64(len(m.ConsensusHash))) + i-- + dAtA[i] = 0x6a + } + if len(m.NextValidatorsHash) > 0 { + i -= len(m.NextValidatorsHash) + copy(dAtA[i:], m.NextValidatorsHash) + i = encodeVarintGno(dAtA, i, uint64(len(m.NextValidatorsHash))) + i-- + dAtA[i] = 0x62 + } + if len(m.ValidatorsHash) > 0 { + i -= len(m.ValidatorsHash) + copy(dAtA[i:], m.ValidatorsHash) + i = encodeVarintGno(dAtA, i, uint64(len(m.ValidatorsHash))) + i-- + dAtA[i] = 0x5a + } + if len(m.DataHash) > 0 { + i -= len(m.DataHash) + copy(dAtA[i:], m.DataHash) + i = encodeVarintGno(dAtA, i, uint64(len(m.DataHash))) + i-- + dAtA[i] = 0x52 + } + if len(m.LastCommitHash) > 0 { + i -= len(m.LastCommitHash) + copy(dAtA[i:], m.LastCommitHash) + i = encodeVarintGno(dAtA, i, uint64(len(m.LastCommitHash))) + i-- + dAtA[i] = 0x4a + } + if m.LastBlockId != nil { + { + size, err := m.LastBlockId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + if len(m.AppVersion) > 0 { + i -= len(m.AppVersion) + copy(dAtA[i:], m.AppVersion) + i = encodeVarintGno(dAtA, i, uint64(len(m.AppVersion))) + i-- + dAtA[i] = 0x3a + } + if m.TotalTxs != 0 { + i = encodeVarintGno(dAtA, i, uint64((uint64(m.TotalTxs)<<1)^uint64((m.TotalTxs>>63)))) + i-- + dAtA[i] = 0x30 + } + if m.NumTxs != 0 { + i = encodeVarintGno(dAtA, i, uint64((uint64(m.NumTxs)<<1)^uint64((m.NumTxs>>63)))) + i-- + dAtA[i] = 0x28 + } + n19, err19 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time):]) + if err19 != nil { + return 0, err19 + } + i -= n19 + i = encodeVarintGno(dAtA, i, uint64(n19)) + i-- + dAtA[i] = 0x22 + if m.Height != 0 { + i = encodeVarintGno(dAtA, i, uint64((uint64(m.Height)<<1)^uint64((m.Height>>63)))) + i-- + dAtA[i] = 0x18 + } + if len(m.ChainId) > 0 { + i -= len(m.ChainId) + copy(dAtA[i:], m.ChainId) + i = encodeVarintGno(dAtA, i, uint64(len(m.ChainId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintGno(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Data) 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 *Data) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Data) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Txs) > 0 { + for iNdEx := len(m.Txs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Txs[iNdEx]) + copy(dAtA[i:], m.Txs[iNdEx]) + i = encodeVarintGno(dAtA, i, uint64(len(m.Txs[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *Commit) 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 *Commit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Commit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Precommits) > 0 { + for iNdEx := len(m.Precommits) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Precommits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.BlockId != nil { + { + size, err := m.BlockId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BlockID) 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 *BlockID) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlockID) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PartsHeader != nil { + { + size, err := m.PartsHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintGno(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SignedHeader) 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 *SignedHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SignedHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Commit != nil { + { + size, err := m.Commit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *LightBlock) 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 *LightBlock) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LightBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ValidatorSet != nil { + { + size, err := m.ValidatorSet.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.SignedHeader != nil { + { + size, err := m.SignedHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CommitSig) 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 *CommitSig) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CommitSig) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintGno(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x42 + } + if m.ValidatorIndex != 0 { + i = encodeVarintGno(dAtA, i, uint64((uint64(m.ValidatorIndex)<<1)^uint64((m.ValidatorIndex>>63)))) + i-- + dAtA[i] = 0x38 + } + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintGno(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x32 + } + n26, err26 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp):]) + if err26 != nil { + return 0, err26 + } + i -= n26 + i = encodeVarintGno(dAtA, i, uint64(n26)) + i-- + dAtA[i] = 0x2a + if m.BlockId != nil { + { + size, err := m.BlockId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.Round != 0 { + i = encodeVarintGno(dAtA, i, uint64((uint64(m.Round)<<1)^uint64((m.Round>>63)))) + i-- + dAtA[i] = 0x18 + } + if m.Height != 0 { + i = encodeVarintGno(dAtA, i, uint64((uint64(m.Height)<<1)^uint64((m.Height>>63)))) + i-- + dAtA[i] = 0x10 + } + if m.Type != 0 { + i = encodeVarintGno(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Vote) 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 *Vote) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintGno(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x42 + } + if m.ValidatorIndex != 0 { + i = encodeVarintGno(dAtA, i, uint64((uint64(m.ValidatorIndex)<<1)^uint64((m.ValidatorIndex>>63)))) + i-- + dAtA[i] = 0x38 + } + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintGno(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x32 + } + n28, err28 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp):]) + if err28 != nil { + return 0, err28 + } + i -= n28 + i = encodeVarintGno(dAtA, i, uint64(n28)) + i-- + dAtA[i] = 0x2a + if m.BlockId != nil { + { + size, err := m.BlockId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.Round != 0 { + i = encodeVarintGno(dAtA, i, uint64((uint64(m.Round)<<1)^uint64((m.Round>>63)))) + i-- + dAtA[i] = 0x18 + } + if m.Height != 0 { + i = encodeVarintGno(dAtA, i, uint64((uint64(m.Height)<<1)^uint64((m.Height>>63)))) + i-- + dAtA[i] = 0x10 + } + if m.Type != 0 { + i = encodeVarintGno(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *PartSet) 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 *PartSet) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PartSet) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *PartSetHeader) 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 *PartSetHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PartSetHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintGno(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0x12 + } + if m.Total != 0 { + i = encodeVarintGno(dAtA, i, uint64((uint64(m.Total)<<1)^uint64((m.Total>>63)))) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Validator) 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 *Validator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Validator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ProposerPriority != 0 { + i = encodeVarintGno(dAtA, i, uint64((uint64(m.ProposerPriority)<<1)^uint64((m.ProposerPriority>>63)))) + i-- + dAtA[i] = 0x20 + } + if m.VotingPower != 0 { + i = encodeVarintGno(dAtA, i, uint64((uint64(m.VotingPower)<<1)^uint64((m.VotingPower>>63)))) + i-- + dAtA[i] = 0x18 + } + if m.PubKey != nil { + { + size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintGno(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ValidatorSet) 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 *ValidatorSet) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorSet) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Proposer != nil { + { + size, err := m.Proposer.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Validators) > 0 { + for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Validators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGno(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *Fraction) 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 *Fraction) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Fraction) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Denominator != 0 { + i = encodeVarintGno(dAtA, i, uint64(m.Denominator)) + i-- + dAtA[i] = 0x10 + } + if m.Numerator != 0 { + i = encodeVarintGno(dAtA, i, uint64(m.Numerator)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintGno(dAtA []byte, offset int, v uint64) int { + offset -= sovGno(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *ClientState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovGno(uint64(l)) + } + l = m.TrustLevel.Size() + n += 1 + l + sovGno(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.TrustingPeriod) + n += 1 + l + sovGno(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.UnbondingPeriod) + n += 1 + l + sovGno(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.MaxClockDrift) + n += 1 + l + sovGno(uint64(l)) + l = m.FrozenHeight.Size() + n += 1 + l + sovGno(uint64(l)) + l = m.LatestHeight.Size() + n += 1 + l + sovGno(uint64(l)) + if len(m.ProofSpecs) > 0 { + for _, e := range m.ProofSpecs { + l = e.Size() + n += 1 + l + sovGno(uint64(l)) + } + } + if len(m.UpgradePath) > 0 { + for _, s := range m.UpgradePath { + l = len(s) + n += 1 + l + sovGno(uint64(l)) + } + } + if m.AllowUpdateAfterExpiry { + n += 2 + } + if m.AllowUpdateAfterMisbehaviour { + n += 2 + } + return n +} + +func (m *ConsensusState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp) + n += 1 + l + sovGno(uint64(l)) + l = m.Root.Size() + n += 1 + l + sovGno(uint64(l)) + l = len(m.NextValidatorsHash) + if l > 0 { + n += 1 + l + sovGno(uint64(l)) + } + return n +} + +func (m *Misbehaviour) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClientId) + if l > 0 { + n += 1 + l + sovGno(uint64(l)) + } + if m.Header1 != nil { + l = m.Header1.Size() + n += 1 + l + sovGno(uint64(l)) + } + if m.Header2 != nil { + l = m.Header2.Size() + n += 1 + l + sovGno(uint64(l)) + } + return n +} + +func (m *Header) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SignedHeader != nil { + l = m.SignedHeader.Size() + n += 1 + l + sovGno(uint64(l)) + } + if m.ValidatorSet != nil { + l = m.ValidatorSet.Size() + n += 1 + l + sovGno(uint64(l)) + } + l = m.TrustedHeight.Size() + n += 1 + l + sovGno(uint64(l)) + if m.TrustedValidators != nil { + l = m.TrustedValidators.Size() + n += 1 + l + sovGno(uint64(l)) + } + return n +} + +func (m *Block) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Header != nil { + l = m.Header.Size() + n += 1 + l + sovGno(uint64(l)) + } + if m.Data != nil { + l = m.Data.Size() + n += 1 + l + sovGno(uint64(l)) + } + if m.LastCommit != nil { + l = m.LastCommit.Size() + n += 1 + l + sovGno(uint64(l)) + } + return n +} + +func (m *GnoHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Version) + if l > 0 { + n += 1 + l + sovGno(uint64(l)) + } + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovGno(uint64(l)) + } + if m.Height != 0 { + n += 1 + sozGno(uint64(m.Height)) + } + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time) + n += 1 + l + sovGno(uint64(l)) + if m.NumTxs != 0 { + n += 1 + sozGno(uint64(m.NumTxs)) + } + if m.TotalTxs != 0 { + n += 1 + sozGno(uint64(m.TotalTxs)) + } + l = len(m.AppVersion) + if l > 0 { + n += 1 + l + sovGno(uint64(l)) + } + if m.LastBlockId != nil { + l = m.LastBlockId.Size() + n += 1 + l + sovGno(uint64(l)) + } + l = len(m.LastCommitHash) + if l > 0 { + n += 1 + l + sovGno(uint64(l)) + } + l = len(m.DataHash) + if l > 0 { + n += 1 + l + sovGno(uint64(l)) + } + l = len(m.ValidatorsHash) + if l > 0 { + n += 1 + l + sovGno(uint64(l)) + } + l = len(m.NextValidatorsHash) + if l > 0 { + n += 1 + l + sovGno(uint64(l)) + } + l = len(m.ConsensusHash) + if l > 0 { + n += 1 + l + sovGno(uint64(l)) + } + l = len(m.AppHash) + if l > 0 { + n += 1 + l + sovGno(uint64(l)) + } + l = len(m.LastResultsHash) + if l > 0 { + n += 1 + l + sovGno(uint64(l)) + } + l = len(m.ProposerAddress) + if l > 0 { + n += 2 + l + sovGno(uint64(l)) + } + return n +} + +func (m *Data) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Txs) > 0 { + for _, b := range m.Txs { + l = len(b) + n += 1 + l + sovGno(uint64(l)) + } + } + return n +} + +func (m *Commit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BlockId != nil { + l = m.BlockId.Size() + n += 1 + l + sovGno(uint64(l)) + } + if len(m.Precommits) > 0 { + for _, e := range m.Precommits { + l = e.Size() + n += 1 + l + sovGno(uint64(l)) + } + } + return n +} + +func (m *BlockID) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovGno(uint64(l)) + } + if m.PartsHeader != nil { + l = m.PartsHeader.Size() + n += 1 + l + sovGno(uint64(l)) + } + return n +} + +func (m *SignedHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Header != nil { + l = m.Header.Size() + n += 1 + l + sovGno(uint64(l)) + } + if m.Commit != nil { + l = m.Commit.Size() + n += 1 + l + sovGno(uint64(l)) + } + return n +} + +func (m *LightBlock) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SignedHeader != nil { + l = m.SignedHeader.Size() + n += 1 + l + sovGno(uint64(l)) + } + if m.ValidatorSet != nil { + l = m.ValidatorSet.Size() + n += 1 + l + sovGno(uint64(l)) + } + return n +} + +func (m *CommitSig) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Type != 0 { + n += 1 + sovGno(uint64(m.Type)) + } + if m.Height != 0 { + n += 1 + sozGno(uint64(m.Height)) + } + if m.Round != 0 { + n += 1 + sozGno(uint64(m.Round)) + } + if m.BlockId != nil { + l = m.BlockId.Size() + n += 1 + l + sovGno(uint64(l)) + } + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp) + n += 1 + l + sovGno(uint64(l)) + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovGno(uint64(l)) + } + if m.ValidatorIndex != 0 { + n += 1 + sozGno(uint64(m.ValidatorIndex)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovGno(uint64(l)) + } + return n +} + +func (m *Vote) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Type != 0 { + n += 1 + sovGno(uint64(m.Type)) + } + if m.Height != 0 { + n += 1 + sozGno(uint64(m.Height)) + } + if m.Round != 0 { + n += 1 + sozGno(uint64(m.Round)) + } + if m.BlockId != nil { + l = m.BlockId.Size() + n += 1 + l + sovGno(uint64(l)) + } + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp) + n += 1 + l + sovGno(uint64(l)) + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovGno(uint64(l)) + } + if m.ValidatorIndex != 0 { + n += 1 + sozGno(uint64(m.ValidatorIndex)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovGno(uint64(l)) + } + return n +} + +func (m *PartSet) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *PartSetHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Total != 0 { + n += 1 + sozGno(uint64(m.Total)) + } + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovGno(uint64(l)) + } + return n +} + +func (m *Validator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovGno(uint64(l)) + } + if m.PubKey != nil { + l = m.PubKey.Size() + n += 1 + l + sovGno(uint64(l)) + } + if m.VotingPower != 0 { + n += 1 + sozGno(uint64(m.VotingPower)) + } + if m.ProposerPriority != 0 { + n += 1 + sozGno(uint64(m.ProposerPriority)) + } + return n +} + +func (m *ValidatorSet) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Validators) > 0 { + for _, e := range m.Validators { + l = e.Size() + n += 1 + l + sovGno(uint64(l)) + } + } + if m.Proposer != nil { + l = m.Proposer.Size() + n += 1 + l + sovGno(uint64(l)) + } + return n +} + +func (m *Fraction) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Numerator != 0 { + n += 1 + sovGno(uint64(m.Numerator)) + } + if m.Denominator != 0 { + n += 1 + sovGno(uint64(m.Denominator)) + } + return n +} + +func sovGno(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGno(x uint64) (n int) { + return sovGno(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ClientState) 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 ErrIntOverflowGno + } + 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: ClientState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClientState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + 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 ErrInvalidLengthGno + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TrustLevel", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TrustLevel.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TrustingPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.TrustingPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.UnbondingPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxClockDrift", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.MaxClockDrift, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FrozenHeight", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.FrozenHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestHeight", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LatestHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofSpecs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProofSpecs = append(m.ProofSpecs, &_go.ProofSpec{}) + if err := m.ProofSpecs[len(m.ProofSpecs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpgradePath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + 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 ErrInvalidLengthGno + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UpgradePath = append(m.UpgradePath, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowUpdateAfterExpiry", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.AllowUpdateAfterExpiry = bool(v != 0) + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowUpdateAfterMisbehaviour", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.AllowUpdateAfterMisbehaviour = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipGno(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGno + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConsensusState) 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 ErrIntOverflowGno + } + 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: ConsensusState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConsensusState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Root", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Root.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NextValidatorsHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NextValidatorsHash = append(m.NextValidatorsHash[:0], dAtA[iNdEx:postIndex]...) + if m.NextValidatorsHash == nil { + m.NextValidatorsHash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGno(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGno + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Misbehaviour) 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 ErrIntOverflowGno + } + 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: Misbehaviour: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Misbehaviour: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + 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 ErrInvalidLengthGno + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header1", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Header1 == nil { + m.Header1 = &Header{} + } + if err := m.Header1.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header2", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Header2 == nil { + m.Header2 = &Header{} + } + if err := m.Header2.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGno(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGno + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Header) 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 ErrIntOverflowGno + } + 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: Header: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Header: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SignedHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SignedHeader == nil { + m.SignedHeader = &SignedHeader{} + } + if err := m.SignedHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSet", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ValidatorSet == nil { + m.ValidatorSet = &ValidatorSet{} + } + if err := m.ValidatorSet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TrustedHeight", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TrustedHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TrustedValidators", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TrustedValidators == nil { + m.TrustedValidators = &ValidatorSet{} + } + if err := m.TrustedValidators.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGno(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGno + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Block) 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 ErrIntOverflowGno + } + 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: Block: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Block: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Header == nil { + m.Header = &GnoHeader{} + } + if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Data == nil { + m.Data = &Data{} + } + if err := m.Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastCommit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LastCommit == nil { + m.LastCommit = &Commit{} + } + if err := m.LastCommit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGno(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGno + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GnoHeader) 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 ErrIntOverflowGno + } + 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: GnoHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GnoHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + 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 ErrInvalidLengthGno + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + 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 ErrInvalidLengthGno + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.Height = int64(v) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Time", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Time, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumTxs", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.NumTxs = int64(v) + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalTxs", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.TotalTxs = int64(v) + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AppVersion", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + 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 ErrInvalidLengthGno + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AppVersion = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastBlockId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LastBlockId == nil { + m.LastBlockId = &BlockID{} + } + if err := m.LastBlockId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastCommitHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LastCommitHash = append(m.LastCommitHash[:0], dAtA[iNdEx:postIndex]...) + if m.LastCommitHash == nil { + m.LastCommitHash = []byte{} + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DataHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DataHash = append(m.DataHash[:0], dAtA[iNdEx:postIndex]...) + if m.DataHash == nil { + m.DataHash = []byte{} + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorsHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorsHash = append(m.ValidatorsHash[:0], dAtA[iNdEx:postIndex]...) + if m.ValidatorsHash == nil { + m.ValidatorsHash = []byte{} + } + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NextValidatorsHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NextValidatorsHash = append(m.NextValidatorsHash[:0], dAtA[iNdEx:postIndex]...) + if m.NextValidatorsHash == nil { + m.NextValidatorsHash = []byte{} + } + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsensusHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsensusHash = append(m.ConsensusHash[:0], dAtA[iNdEx:postIndex]...) + if m.ConsensusHash == nil { + m.ConsensusHash = []byte{} + } + iNdEx = postIndex + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AppHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AppHash = append(m.AppHash[:0], dAtA[iNdEx:postIndex]...) + if m.AppHash == nil { + m.AppHash = []byte{} + } + iNdEx = postIndex + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastResultsHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LastResultsHash = append(m.LastResultsHash[:0], dAtA[iNdEx:postIndex]...) + if m.LastResultsHash == nil { + m.LastResultsHash = []byte{} + } + iNdEx = postIndex + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + 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 ErrInvalidLengthGno + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProposerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGno(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGno + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Data) 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 ErrIntOverflowGno + } + 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: Data: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Data: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Txs", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Txs = append(m.Txs, make([]byte, postIndex-iNdEx)) + copy(m.Txs[len(m.Txs)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGno(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGno + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Commit) 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 ErrIntOverflowGno + } + 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: Commit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Commit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BlockId == nil { + m.BlockId = &BlockID{} + } + if err := m.BlockId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Precommits", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Precommits = append(m.Precommits, &CommitSig{}) + if err := m.Precommits[len(m.Precommits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGno(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGno + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BlockID) 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 ErrIntOverflowGno + } + 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: BlockID: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BlockID: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PartsHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PartsHeader == nil { + m.PartsHeader = &PartSetHeader{} + } + if err := m.PartsHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGno(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGno + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SignedHeader) 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 ErrIntOverflowGno + } + 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: SignedHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SignedHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Header == nil { + m.Header = &GnoHeader{} + } + if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Commit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Commit == nil { + m.Commit = &Commit{} + } + if err := m.Commit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGno(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGno + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LightBlock) 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 ErrIntOverflowGno + } + 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: LightBlock: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LightBlock: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SignedHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SignedHeader == nil { + m.SignedHeader = &SignedHeader{} + } + if err := m.SignedHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSet", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ValidatorSet == nil { + m.ValidatorSet = &ValidatorSet{} + } + if err := m.ValidatorSet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGno(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGno + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CommitSig) 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 ErrIntOverflowGno + } + 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: CommitSig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommitSig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.Height = int64(v) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Round", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.Round = int64(v) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BlockId == nil { + m.BlockId = &BlockID{} + } + if err := m.BlockId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + 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 ErrInvalidLengthGno + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorIndex", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.ValidatorIndex = int64(v) + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGno(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGno + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Vote) 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 ErrIntOverflowGno + } + 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: Vote: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Vote: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.Height = int64(v) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Round", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.Round = int64(v) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BlockId == nil { + m.BlockId = &BlockID{} + } + if err := m.BlockId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + 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 ErrInvalidLengthGno + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorIndex", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.ValidatorIndex = int64(v) + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGno(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGno + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PartSet) 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 ErrIntOverflowGno + } + 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: PartSet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PartSet: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGno(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGno + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PartSetHeader) 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 ErrIntOverflowGno + } + 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: PartSetHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PartSetHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.Total = int64(v) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGno(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGno + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Validator) 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 ErrIntOverflowGno + } + 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: Validator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Validator: 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 ErrIntOverflowGno + } + 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 ErrInvalidLengthGno + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGno + } + 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 PubKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PubKey == nil { + m.PubKey = &types2.Any{} + } + if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingPower", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.VotingPower = int64(v) + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposerPriority", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.ProposerPriority = int64(v) + default: + iNdEx = preIndex + skippy, err := skipGno(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGno + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ValidatorSet) 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 ErrIntOverflowGno + } + 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: ValidatorSet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValidatorSet: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validators", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Validators = append(m.Validators, &Validator{}) + if err := m.Validators[len(m.Validators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGno + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGno + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Proposer == nil { + m.Proposer = &Validator{} + } + if err := m.Proposer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGno(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGno + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Fraction) 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 ErrIntOverflowGno + } + 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: Fraction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Fraction: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Numerator", wireType) + } + m.Numerator = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Numerator |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Denominator", wireType) + } + m.Denominator = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGno + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Denominator |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGno(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGno + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGno(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, ErrIntOverflowGno + } + 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, ErrIntOverflowGno + } + 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, ErrIntOverflowGno + } + 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, ErrInvalidLengthGno + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGno + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGno + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGno = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGno = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGno = fmt.Errorf("proto: unexpected end of group") +) diff --git a/modules/10-gno/header.go b/modules/10-gno/header.go new file mode 100644 index 000000000..aff79f6f2 --- /dev/null +++ b/modules/10-gno/header.go @@ -0,0 +1,137 @@ +package gno + +import ( + "bytes" + "errors" + "time" + + errorsmod "cosmossdk.io/errors" + clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" + commitmenttypes "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types" + "github.com/cosmos/ibc-go/v10/modules/core/exported" + bfttypes "github.com/gnolang/gno/tm2/pkg/bft/types" + "github.com/gnolang/gno/tm2/pkg/crypto" +) + +var _ exported.ClientMessage = (*Header)(nil) + +// ConsensusState returns the updated consensus state associated with the header +func (h Header) ConsensusState() *ConsensusState { + return &ConsensusState{ + Timestamp: h.GetTime(), + Root: commitmenttypes.NewMerkleRoot(h.SignedHeader.Header.AppHash), + NextValidatorsHash: h.SignedHeader.Header.NextValidatorsHash, + } +} + +// ClientType defines that the Header is a Gno consensus algorithm +func (Header) ClientType() string { + return Gno +} + +// GetHeight returns the current height. It returns 0 if the gno +// header is nil. +// NOTE: the header.Header is checked to be non nil in ValidateBasic. +func (h Header) GetHeight() exported.Height { + revision := clienttypes.ParseChainID(h.SignedHeader.Header.ChainId) + return clienttypes.NewHeight(revision, uint64(h.SignedHeader.Header.Height)) +} + +// GetTime returns the current block timestamp. It returns a zero time if +// the gno header is nil. +// NOTE: the header.Header is checked to be non nil in ValidateBasic. +func (h Header) GetTime() time.Time { + return h.SignedHeader.Header.Time +} + +// ValidateBasic calls the SignedHeader ValidateBasic function and checks +// that validatorsets are not nil. +// NOTE: TrustedHeight and TrustedValidators may be empty when creating client +// with MsgCreateClient +func (h Header) ValidateBasic() error { + if h.SignedHeader == nil { + return errorsmod.Wrap(clienttypes.ErrInvalidHeader, "gno signed header cannot be nil") + } + // SignedHeader ValidateBasic() checks that Header and Commit are not nil + if h.SignedHeader.Header == nil { + return errorsmod.Wrap(clienttypes.ErrInvalidHeader, "gno header cannot be nil") + } + if h.SignedHeader.Commit == nil { + return errorsmod.Wrap(errors.New("missing commit"), "gno commit cannot be nil") + } + // GnoHeader ValidateBasic() + gnoHeader := bfttypes.Header{ + Version: h.SignedHeader.Header.Version, + ChainID: h.SignedHeader.Header.ChainId, + Height: h.SignedHeader.Header.Height, + Time: h.SignedHeader.Header.Time, + LastBlockID: bfttypes.BlockID{Hash: h.SignedHeader.Header.LastBlockId.Hash, PartsHeader: bfttypes.PartSetHeader{Total: int(h.SignedHeader.Header.LastBlockId.PartsHeader.Total), Hash: h.SignedHeader.Header.LastBlockId.PartsHeader.Hash}}, + LastCommitHash: h.SignedHeader.Header.LastCommitHash, + DataHash: h.SignedHeader.Header.DataHash, + ValidatorsHash: h.SignedHeader.Header.ValidatorsHash, + NextValidatorsHash: h.SignedHeader.Header.NextValidatorsHash, + ConsensusHash: h.SignedHeader.Header.ConsensusHash, + AppHash: h.SignedHeader.Header.AppHash, + LastResultsHash: h.SignedHeader.Header.LastResultsHash, + ProposerAddress: crypto.MustAddressFromString(h.SignedHeader.Header.ProposerAddress), + } + gnoCommit := bfttypes.Commit{ + BlockID: bfttypes.BlockID{Hash: h.SignedHeader.Commit.BlockId.Hash, PartsHeader: bfttypes.PartSetHeader{Total: int(h.SignedHeader.Commit.BlockId.PartsHeader.Total), Hash: h.SignedHeader.Commit.BlockId.PartsHeader.Hash}}, + Precommits: make([]*bfttypes.CommitSig, len(h.SignedHeader.Commit.Precommits)), + } + for i, sig := range h.SignedHeader.Commit.Precommits { + if sig == nil { + continue + } + gnoCommit.Precommits[i] = &bfttypes.CommitSig{ + ValidatorIndex: int(sig.ValidatorIndex), + Signature: sig.Signature, + BlockID: bfttypes.BlockID{Hash: sig.BlockId.Hash, PartsHeader: bfttypes.PartSetHeader{Total: int(sig.BlockId.PartsHeader.Total), Hash: sig.BlockId.PartsHeader.Hash}}, + Type: bfttypes.SignedMsgType(sig.Type), + Height: sig.Height, + Round: int(sig.Round), + Timestamp: sig.Timestamp, + ValidatorAddress: crypto.MustAddressFromString(sig.ValidatorAddress), + } + } + gnoSignedHeader := bfttypes.SignedHeader{ + Header: &gnoHeader, + Commit: &gnoCommit, + } + // NOTE: SignedHeader ValidateBasic checks + if err := gnoSignedHeader.ValidateBasic(h.SignedHeader.Header.ChainId); err != nil { + return errorsmod.Wrap(err, "header failed basic validation") + } + + // TrustedHeight is less than Header for updates and misbehaviour + if h.TrustedHeight.GTE(h.GetHeight()) { + return errorsmod.Wrapf(ErrInvalidHeaderHeight, "TrustedHeight %d must be less than header height %d", + h.TrustedHeight, h.GetHeight()) + } + + if h.ValidatorSet == nil { + return errorsmod.Wrap(clienttypes.ErrInvalidHeader, "validator set is nil") + } + gnoValset := bfttypes.ValidatorSet{ + Validators: make([]*bfttypes.Validator, len(h.ValidatorSet.Validators)), + Proposer: nil, + } + for i, val := range h.ValidatorSet.Validators { + key, err := crypto.PubKeyFromBytes(val.PubKey.Value) + if err != nil { + return errorsmod.Wrap(err, "validator set is not gno validator set") + } + gnoValset.Validators[i] = &bfttypes.Validator{ + Address: crypto.MustAddressFromString(val.Address), + PubKey: key, + VotingPower: val.VotingPower, + ProposerPriority: val.ProposerPriority, + } + } + gnoValset.TotalVotingPower() // ensure TotalVotingPower is set + + if !bytes.Equal(h.SignedHeader.Header.ValidatorsHash, gnoValset.Hash()) { + return errorsmod.Wrap(clienttypes.ErrInvalidHeader, "validator set does not match hash") + } + return nil +} diff --git a/modules/10-gno/keys.go b/modules/10-gno/keys.go new file mode 100644 index 000000000..9c752d202 --- /dev/null +++ b/modules/10-gno/keys.go @@ -0,0 +1,6 @@ +/* DONE */ +package gno + +const ( + ModuleName = "10-gno" +) diff --git a/modules/10-gno/light_client_module.go b/modules/10-gno/light_client_module.go new file mode 100644 index 000000000..78327c59d --- /dev/null +++ b/modules/10-gno/light_client_module.go @@ -0,0 +1,240 @@ +package gno + +import ( + "fmt" + + errorsmod "cosmossdk.io/errors" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + + clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" + ibcerrors "github.com/cosmos/ibc-go/v10/modules/core/errors" + "github.com/cosmos/ibc-go/v10/modules/core/exported" +) + +var _ exported.LightClientModule = (*LightClientModule)(nil) + +// LightClientModule implements the core IBC api.LightClientModule interface. +type LightClientModule struct { + cdc codec.BinaryCodec + storeProvider clienttypes.StoreProvider +} + +// NewLightClientModule creates and returns a new 07-tendermint LightClientModule. +func NewLightClientModule(cdc codec.BinaryCodec, storeProvider clienttypes.StoreProvider) LightClientModule { + return LightClientModule{ + cdc: cdc, + storeProvider: storeProvider, + } +} + +// Initialize unmarshals the provided client and consensus states and performs basic validation. It calls into the +// clientState.initialize method. +func (l LightClientModule) Initialize(ctx sdk.Context, clientID string, clientStateBz, consensusStateBz []byte) error { + var clientState ClientState + if err := l.cdc.Unmarshal(clientStateBz, &clientState); err != nil { + return fmt.Errorf("failed to unmarshal client state bytes into client state: %w", err) + } + + if err := clientState.Validate(); err != nil { + return err + } + + var consensusState ConsensusState + if err := l.cdc.Unmarshal(consensusStateBz, &consensusState); err != nil { + return fmt.Errorf("failed to unmarshal consensus state bytes into consensus state: %w", err) + } + + if err := consensusState.ValidateBasic(); err != nil { + return err + } + + clientStore := l.storeProvider.ClientStore(ctx, clientID) + + return clientState.initialize(ctx, l.cdc, clientStore, &consensusState) +} + +// VerifyClientMessage obtains the client state associated with the client identifier and calls into the clientState.VerifyClientMessage method. +func (l LightClientModule) VerifyClientMessage(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage) error { + clientStore := l.storeProvider.ClientStore(ctx, clientID) + clientState, found := getClientState(clientStore, l.cdc) + if !found { + return errorsmod.Wrap(clienttypes.ErrClientNotFound, clientID) + } + + return clientState.VerifyClientMessage(ctx, l.cdc, clientStore, clientMsg) +} + +// CheckForMisbehaviour obtains the client state associated with the client identifier and calls into the clientState.CheckForMisbehaviour method. +func (l LightClientModule) CheckForMisbehaviour(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage) bool { + clientStore := l.storeProvider.ClientStore(ctx, clientID) + clientState, found := getClientState(clientStore, l.cdc) + if !found { + panic(errorsmod.Wrap(clienttypes.ErrClientNotFound, clientID)) + } + + return clientState.CheckForMisbehaviour(ctx, l.cdc, clientStore, clientMsg) +} + +// UpdateStateOnMisbehaviour obtains the client state associated with the client identifier and calls into the clientState.UpdateStateOnMisbehaviour method. +func (l LightClientModule) UpdateStateOnMisbehaviour(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage) { + clientStore := l.storeProvider.ClientStore(ctx, clientID) + clientState, found := getClientState(clientStore, l.cdc) + if !found { + panic(errorsmod.Wrap(clienttypes.ErrClientNotFound, clientID)) + } + + clientState.UpdateStateOnMisbehaviour(ctx, l.cdc, clientStore, clientMsg) +} + +// UpdateState obtains the client state associated with the client identifier and calls into the clientState.UpdateState method. +func (l LightClientModule) UpdateState(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage) []exported.Height { + clientStore := l.storeProvider.ClientStore(ctx, clientID) + clientState, found := getClientState(clientStore, l.cdc) + if !found { + panic(errorsmod.Wrap(clienttypes.ErrClientNotFound, clientID)) + } + + return clientState.UpdateState(ctx, l.cdc, clientStore, clientMsg) +} + +// VerifyMembership obtains the client state associated with the client identifier and calls into the clientState.verifyMembership method. +func (l LightClientModule) VerifyMembership( + ctx sdk.Context, + clientID string, + height exported.Height, + delayTimePeriod uint64, + delayBlockPeriod uint64, + proof []byte, + path exported.Path, + value []byte, +) error { + clientStore := l.storeProvider.ClientStore(ctx, clientID) + clientState, found := getClientState(clientStore, l.cdc) + if !found { + return errorsmod.Wrap(clienttypes.ErrClientNotFound, clientID) + } + + return clientState.verifyMembership(ctx, clientStore, l.cdc, height, delayTimePeriod, delayBlockPeriod, proof, path, value) +} + +// VerifyNonMembership obtains the client state associated with the client identifier and calls into the clientState.verifyNonMembership method. +func (l LightClientModule) VerifyNonMembership( + ctx sdk.Context, + clientID string, + height exported.Height, + delayTimePeriod uint64, + delayBlockPeriod uint64, + proof []byte, + path exported.Path, +) error { + clientStore := l.storeProvider.ClientStore(ctx, clientID) + clientState, found := getClientState(clientStore, l.cdc) + if !found { + return errorsmod.Wrap(clienttypes.ErrClientNotFound, clientID) + } + + return clientState.verifyNonMembership(ctx, clientStore, l.cdc, height, delayTimePeriod, delayBlockPeriod, proof, path) +} + +// Status obtains the client state associated with the client identifier and calls into the clientState.status method. +func (l LightClientModule) Status(ctx sdk.Context, clientID string) exported.Status { + clientStore := l.storeProvider.ClientStore(ctx, clientID) + clientState, found := getClientState(clientStore, l.cdc) + if !found { + return exported.Unknown + } + + return clientState.status(ctx, clientStore, l.cdc) +} + +// LatestHeight returns the latest height for the client state for the given client identifier. +// If no client is present for the provided client identifier a zero value height is returned. +func (l LightClientModule) LatestHeight(ctx sdk.Context, clientID string) exported.Height { + clientStore := l.storeProvider.ClientStore(ctx, clientID) + clientState, found := getClientState(clientStore, l.cdc) + if !found { + return clienttypes.ZeroHeight() + } + + return clientState.LatestHeight +} + +// TimestampAtHeight obtains the client state associated with the client identifier and calls into the clientState.getTimestampAtHeight method. +func (l LightClientModule) TimestampAtHeight( + ctx sdk.Context, + clientID string, + height exported.Height, +) (uint64, error) { + clientStore := l.storeProvider.ClientStore(ctx, clientID) + clientState, found := getClientState(clientStore, l.cdc) + if !found { + return 0, errorsmod.Wrap(clienttypes.ErrClientNotFound, clientID) + } + + return clientState.getTimestampAtHeight(clientStore, l.cdc, height) +} + +// RecoverClient asserts that the substitute client is a tendermint client. It obtains the client state associated with the +// subject client and calls into the subjectClientState.CheckSubstituteAndUpdateState method. +func (l LightClientModule) RecoverClient(ctx sdk.Context, clientID, substituteClientID string) error { + substituteClientType, _, err := clienttypes.ParseClientIdentifier(substituteClientID) + if err != nil { + return err + } + + if substituteClientType != exported.Tendermint { + return errorsmod.Wrapf(clienttypes.ErrInvalidClientType, "expected: %s, got: %s", exported.Tendermint, substituteClientType) + } + + clientStore := l.storeProvider.ClientStore(ctx, clientID) + clientState, found := getClientState(clientStore, l.cdc) + if !found { + return errorsmod.Wrap(clienttypes.ErrClientNotFound, clientID) + } + + substituteClientStore := l.storeProvider.ClientStore(ctx, substituteClientID) + substituteClient, found := getClientState(substituteClientStore, l.cdc) + if !found { + return errorsmod.Wrap(clienttypes.ErrClientNotFound, substituteClientID) + } + + return clientState.CheckSubstituteAndUpdateState(ctx, l.cdc, clientStore, substituteClientStore, substituteClient) +} + +// VerifyUpgradeAndUpdateState obtains the client state associated with the client identifier and calls into the clientState.VerifyUpgradeAndUpdateState method. +// The new client and consensus states will be unmarshaled and an error is returned if the new client state is not at a height greater +// than the existing client. +func (l LightClientModule) VerifyUpgradeAndUpdateState( + ctx sdk.Context, + clientID string, + newClient []byte, + newConsState []byte, + upgradeClientProof, + upgradeConsensusStateProof []byte, +) error { + var newClientState ClientState + if err := l.cdc.Unmarshal(newClient, &newClientState); err != nil { + return errorsmod.Wrap(clienttypes.ErrInvalidClient, err.Error()) + } + + var newConsensusState ConsensusState + if err := l.cdc.Unmarshal(newConsState, &newConsensusState); err != nil { + return errorsmod.Wrap(clienttypes.ErrInvalidConsensus, err.Error()) + } + + clientStore := l.storeProvider.ClientStore(ctx, clientID) + clientState, found := getClientState(clientStore, l.cdc) + if !found { + return errorsmod.Wrap(clienttypes.ErrClientNotFound, clientID) + } + + // last height of current counterparty chain must be client's latest height + lastHeight := clientState.LatestHeight + if !newClientState.LatestHeight.GT(lastHeight) { + return errorsmod.Wrapf(ibcerrors.ErrInvalidHeight, "upgraded client height %s must be at greater than current client height %s", newClientState.LatestHeight, lastHeight) + } + + return clientState.VerifyUpgradeAndUpdateState(ctx, l.cdc, clientStore, &newClientState, &newConsensusState, upgradeClientProof, upgradeConsensusStateProof) +} diff --git a/modules/10-gno/migrations/expected_keepers.go b/modules/10-gno/migrations/expected_keepers.go new file mode 100644 index 000000000..b143f56f1 --- /dev/null +++ b/modules/10-gno/migrations/expected_keepers.go @@ -0,0 +1,18 @@ +package migrations + +import ( + "cosmossdk.io/log" + storetypes "cosmossdk.io/store/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/cosmos/ibc-go/v10/modules/core/exported" +) + +// ClientKeeper expected account IBC client keeper +type ClientKeeper interface { + GetClientState(ctx sdk.Context, clientID string) (exported.ClientState, bool) + IterateClientStates(ctx sdk.Context, prefix []byte, cb func(string, exported.ClientState) bool) + ClientStore(ctx sdk.Context, clientID string) storetypes.KVStore + Logger(ctx sdk.Context) log.Logger +} diff --git a/modules/10-gno/migrations/migrations.go b/modules/10-gno/migrations/migrations.go new file mode 100644 index 000000000..748308907 --- /dev/null +++ b/modules/10-gno/migrations/migrations.go @@ -0,0 +1,46 @@ +package migrations + +import ( + errorsmod "cosmossdk.io/errors" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + + ibcgno "github.com/atomone-hub/atomone/modules/10-gno" + clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" + "github.com/cosmos/ibc-go/v10/modules/core/exported" +) + +// PruneExpiredConsensusStates prunes all expired GNO consensus states. This function +// may optionally be called during in-place store migrations. The ibc store key must be provided. +func PruneExpiredConsensusStates(ctx sdk.Context, cdc codec.BinaryCodec, clientKeeper ClientKeeper) (int, error) { + var clientIDs []string + clientKeeper.IterateClientStates(ctx, []byte(ibcgno.Gno), func(clientID string, _ exported.ClientState) bool { + clientIDs = append(clientIDs, clientID) + return false + }) + + // keep track of the total consensus states pruned so chains can + // understand how much space is saved when the migration is run + var totalPruned int + + for _, clientID := range clientIDs { + clientStore := clientKeeper.ClientStore(ctx, clientID) + + clientState, ok := clientKeeper.GetClientState(ctx, clientID) + if !ok { + return 0, errorsmod.Wrapf(clienttypes.ErrClientNotFound, "clientID %s", clientID) + } + + gnoClientState, ok := clientState.(*ibcgno.ClientState) + if !ok { + return 0, errorsmod.Wrap(clienttypes.ErrInvalidClient, "client state is not GNO even though client id contains 10-gno") + } + + totalPruned += ibcgno.PruneAllExpiredConsensusStates(ctx, clientStore, cdc, gnoClientState) + } + + clientKeeper.Logger(ctx).Info("pruned expired gno consensus states", "total", totalPruned) + + return totalPruned, nil +} diff --git a/modules/10-gno/migrations/migrations_test.go b/modules/10-gno/migrations/migrations_test.go new file mode 100644 index 000000000..2b1c01973 --- /dev/null +++ b/modules/10-gno/migrations/migrations_test.go @@ -0,0 +1,178 @@ +package migrations_test + +import ( + "testing" + "time" + + testifysuite "github.com/stretchr/testify/suite" + + clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" + host "github.com/cosmos/ibc-go/v10/modules/core/24-host" + "github.com/cosmos/ibc-go/v10/modules/core/exported" + ibctm "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint" + ibctmmigrations "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint/migrations" + ibctesting "github.com/cosmos/ibc-go/v10/testing" +) + +type MigrationsTestSuite struct { + testifysuite.Suite + + coordinator *ibctesting.Coordinator + + // testing chains used for convenience and readability + chainA *ibctesting.TestChain + chainB *ibctesting.TestChain +} + +func (suite *MigrationsTestSuite) SetupTest() { + suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2) + suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1)) + suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2)) +} + +func TestTendermintTestSuite(t *testing.T) { + testifysuite.Run(t, new(MigrationsTestSuite)) +} + +// test pruning of multiple expired tendermint consensus states +func (suite *MigrationsTestSuite) TestPruneExpiredConsensusStates() { + // create multiple tendermint clients and a solo machine client + // the solo machine is used to verify this pruning function only modifies + // the tendermint store. + + numTMClients := 3 + paths := make([]*ibctesting.Path, numTMClients) + + for i := range numTMClients { + path := ibctesting.NewPath(suite.chainA, suite.chainB) + path.SetupClients() + + paths[i] = path + } + + solomachine := ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, ibctesting.DefaultSolomachineClientID, "testing", 1) + smClientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), solomachine.ClientID) + + // set client state + bz, err := suite.chainA.App.AppCodec().MarshalInterface(solomachine.ClientState()) + suite.Require().NoError(err) + smClientStore.Set(host.ClientStateKey(), bz) + + bz, err = suite.chainA.App.AppCodec().MarshalInterface(solomachine.ConsensusState()) + suite.Require().NoError(err) + smHeight := clienttypes.NewHeight(0, 1) + smClientStore.Set(host.ConsensusStateKey(smHeight), bz) + + pruneHeightMap := make(map[*ibctesting.Path][]exported.Height) + unexpiredHeightMap := make(map[*ibctesting.Path][]exported.Height) + + for _, path := range paths { + // collect all heights expected to be pruned + var pruneHeights []exported.Height + pruneHeights = append(pruneHeights, path.EndpointA.GetClientLatestHeight()) + + // these heights will be expired and also pruned + for range 3 { + err := path.EndpointA.UpdateClient() + suite.Require().NoError(err) + + pruneHeights = append(pruneHeights, path.EndpointA.GetClientLatestHeight()) + } + + // double chedck all information is currently stored + for _, pruneHeight := range pruneHeights { + consState, ok := suite.chainA.GetConsensusState(path.EndpointA.ClientID, pruneHeight) + suite.Require().True(ok) + suite.Require().NotNil(consState) + + ctx := suite.chainA.GetContext() + clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(ctx, path.EndpointA.ClientID) + + processedTime, ok := ibctm.GetProcessedTime(clientStore, pruneHeight) + suite.Require().True(ok) + suite.Require().NotNil(processedTime) + + processedHeight, ok := ibctm.GetProcessedHeight(clientStore, pruneHeight) + suite.Require().True(ok) + suite.Require().NotNil(processedHeight) + + expectedConsKey := ibctm.GetIterationKey(clientStore, pruneHeight) + suite.Require().NotNil(expectedConsKey) + } + pruneHeightMap[path] = pruneHeights + } + + // Increment the time by a week + suite.coordinator.IncrementTimeBy(7 * 24 * time.Hour) + + for _, path := range paths { + // create the consensus state that can be used as trusted height for next update + var unexpiredHeights []exported.Height + err := path.EndpointA.UpdateClient() + suite.Require().NoError(err) + unexpiredHeights = append(unexpiredHeights, path.EndpointA.GetClientLatestHeight()) + + err = path.EndpointA.UpdateClient() + suite.Require().NoError(err) + unexpiredHeights = append(unexpiredHeights, path.EndpointA.GetClientLatestHeight()) + + unexpiredHeightMap[path] = unexpiredHeights + } + + // Increment the time by another week, then update the client. + // This will cause the consensus states created before the first time increment + // to be expired + suite.coordinator.IncrementTimeBy(7 * 24 * time.Hour) + totalPruned, err := ibctmmigrations.PruneExpiredConsensusStates(suite.chainA.GetContext(), suite.chainA.App.AppCodec(), suite.chainA.GetSimApp().IBCKeeper.ClientKeeper) + suite.Require().NoError(err) + suite.Require().NotZero(totalPruned) + + for _, path := range paths { + ctx := suite.chainA.GetContext() + clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(ctx, path.EndpointA.ClientID) + + // ensure everything has been pruned + for i, pruneHeight := range pruneHeightMap[path] { + consState, ok := suite.chainA.GetConsensusState(path.EndpointA.ClientID, pruneHeight) + suite.Require().False(ok, i) + suite.Require().Nil(consState, i) + + processedTime, ok := ibctm.GetProcessedTime(clientStore, pruneHeight) + suite.Require().False(ok, i) + suite.Require().Equal(uint64(0), processedTime, i) + + processedHeight, ok := ibctm.GetProcessedHeight(clientStore, pruneHeight) + suite.Require().False(ok, i) + suite.Require().Nil(processedHeight, i) + + expectedConsKey := ibctm.GetIterationKey(clientStore, pruneHeight) + suite.Require().Nil(expectedConsKey, i) + } + + // ensure metadata is set for unexpired consensus state + for _, height := range unexpiredHeightMap[path] { + consState, ok := suite.chainA.GetConsensusState(path.EndpointA.ClientID, height) + suite.Require().True(ok) + suite.Require().NotNil(consState) + + processedTime, ok := ibctm.GetProcessedTime(clientStore, height) + suite.Require().True(ok) + suite.Require().NotEqual(uint64(0), processedTime) + + processedHeight, ok := ibctm.GetProcessedHeight(clientStore, height) + suite.Require().True(ok) + suite.Require().NotEqual(clienttypes.ZeroHeight(), processedHeight) + + consKey := ibctm.GetIterationKey(clientStore, height) + suite.Require().Equal(host.ConsensusStateKey(height), consKey) + } + } + + // verify that solomachine client and consensus state were not removed + smClientStore = suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), solomachine.ClientID) + bz = smClientStore.Get(host.ClientStateKey()) + suite.Require().NotEmpty(bz) + + bz = smClientStore.Get(host.ConsensusStateKey(smHeight)) + suite.Require().NotEmpty(bz) +} diff --git a/modules/10-gno/misbehaviour.go b/modules/10-gno/misbehaviour.go new file mode 100644 index 000000000..846b1a95b --- /dev/null +++ b/modules/10-gno/misbehaviour.go @@ -0,0 +1,174 @@ +package gno + +import ( + "time" + + errorsmod "cosmossdk.io/errors" + + clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" + host "github.com/cosmos/ibc-go/v10/modules/core/24-host" + "github.com/cosmos/ibc-go/v10/modules/core/exported" + bfttypes "github.com/gnolang/gno/tm2/pkg/bft/types" + "github.com/gnolang/gno/tm2/pkg/crypto" +) + +var _ exported.ClientMessage = (*Misbehaviour)(nil) + +// FrozenHeight is same for all misbehaviour +var FrozenHeight = clienttypes.NewHeight(0, 1) + +// NewMisbehaviour creates a new Misbehaviour instance. +func NewMisbehaviour(clientID string, header1, header2 *Header) *Misbehaviour { + return &Misbehaviour{ + ClientId: clientID, + Header1: header1, + Header2: header2, + } +} + +// ClientType is Tendermint light client +func (Misbehaviour) ClientType() string { + return exported.Tendermint +} + +// GetTime returns the timestamp at which misbehaviour occurred. It uses the +// maximum value from both headers to prevent producing an invalid header outside +// of the misbehaviour age range. +func (misbehaviour Misbehaviour) GetTime() time.Time { + t1, t2 := misbehaviour.Header1.GetTime(), misbehaviour.Header2.GetTime() + if t1.After(t2) { + return t1 + } + return t2 +} + +// ValidateBasic implements Misbehaviour interface +func (misbehaviour Misbehaviour) ValidateBasic() error { + if misbehaviour.Header1 == nil { + return errorsmod.Wrap(ErrInvalidHeader, "misbehaviour Header1 cannot be nil") + } + if misbehaviour.Header2 == nil { + return errorsmod.Wrap(ErrInvalidHeader, "misbehaviour Header2 cannot be nil") + } + if misbehaviour.Header1.TrustedHeight.RevisionHeight == 0 { + return errorsmod.Wrapf(ErrInvalidHeaderHeight, "misbehaviour Header1 cannot have zero revision height") + } + if misbehaviour.Header2.TrustedHeight.RevisionHeight == 0 { + return errorsmod.Wrapf(ErrInvalidHeaderHeight, "misbehaviour Header2 cannot have zero revision height") + } + if misbehaviour.Header1.TrustedValidators == nil { + return errorsmod.Wrap(ErrInvalidValidatorSet, "trusted validator set in Header1 cannot be empty") + } + if misbehaviour.Header2.TrustedValidators == nil { + return errorsmod.Wrap(ErrInvalidValidatorSet, "trusted validator set in Header2 cannot be empty") + } + if misbehaviour.Header1.SignedHeader.Header.ChainId != misbehaviour.Header2.SignedHeader.Header.ChainId { + return errorsmod.Wrap(clienttypes.ErrInvalidMisbehaviour, "headers must have identical chainIDs") + } + + if err := host.ClientIdentifierValidator(misbehaviour.ClientId); err != nil { + return errorsmod.Wrap(err, "misbehaviour client ID is invalid") + } + + // ValidateBasic on both validators + if err := misbehaviour.Header1.ValidateBasic(); err != nil { + return errorsmod.Wrap( + clienttypes.ErrInvalidMisbehaviour, + errorsmod.Wrap(err, "header 1 failed validation").Error(), + ) + } + if err := misbehaviour.Header2.ValidateBasic(); err != nil { + return errorsmod.Wrap( + clienttypes.ErrInvalidMisbehaviour, + errorsmod.Wrap(err, "header 2 failed validation").Error(), + ) + } + // Ensure that Height1 is greater than or equal to Height2 + if misbehaviour.Header1.GetHeight().LT(misbehaviour.Header2.GetHeight()) { + return errorsmod.Wrapf(clienttypes.ErrInvalidMisbehaviour, "Header1 height is less than Header2 height (%s < %s)", misbehaviour.Header1.GetHeight(), misbehaviour.Header2.GetHeight()) + } + + blockId1 := bfttypes.BlockID{ + Hash: misbehaviour.Header1.SignedHeader.Header.LastBlockId.Hash, + PartsHeader: bfttypes.PartSetHeader{Total: int(misbehaviour.Header1.SignedHeader.Header.LastBlockId.PartsHeader.Total), Hash: misbehaviour.Header1.SignedHeader.Header.LastBlockId.PartsHeader.Hash}, + } + err := blockId1.ValidateBasic() + if err != nil { + return errorsmod.Wrap(err, "invalid block ID from header 1 in misbehaviour") + } + blockId2 := bfttypes.BlockID{ + Hash: misbehaviour.Header2.SignedHeader.Header.LastBlockId.Hash, + PartsHeader: bfttypes.PartSetHeader{Total: int(misbehaviour.Header2.SignedHeader.Header.LastBlockId.PartsHeader.Total), Hash: misbehaviour.Header2.SignedHeader.Header.LastBlockId.PartsHeader.Hash}, + } + err = blockId2.ValidateBasic() + if err != nil { + return errorsmod.Wrap(err, "invalid block ID from header 2 in misbehaviour") + } + + if err := validCommit(misbehaviour.Header1.SignedHeader.Header.ChainId, blockId1, + *misbehaviour.Header1.SignedHeader.Commit, misbehaviour.Header1.ValidatorSet); err != nil { + return err + } + return validCommit(misbehaviour.Header2.SignedHeader.Header.ChainId, blockId2, + *misbehaviour.Header2.SignedHeader.Commit, misbehaviour.Header2.ValidatorSet) +} + +// validCommit checks if the given commit is a valid commit from the passed-in validatorset +func validCommit(chainID string, blockID bfttypes.BlockID, commit Commit, valSet *ValidatorSet) (err error) { + + err = blockID.ValidateBasic() + if err != nil { + return errorsmod.Wrap(err, "block ID is not gno block ID type") + } + gnoCommit := bfttypes.Commit{ + BlockID: bfttypes.BlockID{Hash: commit.BlockId.Hash, PartsHeader: bfttypes.PartSetHeader{Total: int(commit.BlockId.PartsHeader.Total), Hash: commit.BlockId.PartsHeader.Hash}}, + Precommits: make([]*bfttypes.CommitSig, len(commit.Precommits)), + } + for i, sig := range commit.Precommits { + if sig == nil { + continue + } + gnoCommit.Precommits[i] = &bfttypes.CommitSig{ + ValidatorIndex: int(sig.ValidatorIndex), + Signature: sig.Signature, + BlockID: bfttypes.BlockID{Hash: sig.BlockId.Hash, PartsHeader: bfttypes.PartSetHeader{Total: int(sig.BlockId.PartsHeader.Total), Hash: sig.BlockId.PartsHeader.Hash}}, + Type: bfttypes.SignedMsgType(sig.Type), + Height: sig.Height, + Round: int(sig.Round), + Timestamp: sig.Timestamp, + ValidatorAddress: crypto.MustAddressFromString(sig.ValidatorAddress), + } + } + err = gnoCommit.ValidateBasic() + if err != nil { + return errorsmod.Wrap(err, "commit is not tendermint commit type") + } + + gnoValset := bfttypes.ValidatorSet{ + Validators: make([]*bfttypes.Validator, len(valSet.Validators)), + Proposer: nil, + } + for i, val := range valSet.Validators { + key, err := crypto.PubKeyFromBytes(val.PubKey.Value) + if err != nil { + return errorsmod.Wrap(err, "validator set is not gno validator set") + } + gnoValset.Validators[i] = &bfttypes.Validator{ + Address: crypto.MustAddressFromString(val.Address), + PubKey: key, + VotingPower: val.VotingPower, + ProposerPriority: val.ProposerPriority, + } + } + gnoValset.TotalVotingPower() // ensure TotalVotingPower is set + empty := gnoValset.IsNilOrEmpty() + if empty { + return errorsmod.Wrap(err, "validator set is not gno validator set type") + } + + if err := gnoValset.VerifyCommit(chainID, blockID, gnoCommit.Height(), &gnoCommit); err != nil { + return errorsmod.Wrap(clienttypes.ErrInvalidMisbehaviour, "validator set did not commit to header") + } + + return nil +} diff --git a/modules/10-gno/misbehaviour_handle.go b/modules/10-gno/misbehaviour_handle.go new file mode 100644 index 000000000..3c4ab9e8a --- /dev/null +++ b/modules/10-gno/misbehaviour_handle.go @@ -0,0 +1,214 @@ +package gno + +import ( + "bytes" + "errors" + "reflect" + "time" + + errorsmod "cosmossdk.io/errors" + storetypes "cosmossdk.io/store/types" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + + clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" + "github.com/cosmos/ibc-go/v10/modules/core/exported" + bfttypes "github.com/gnolang/gno/tm2/pkg/bft/types" + "github.com/gnolang/gno/tm2/pkg/crypto" +) + +// CheckForMisbehaviour detects duplicate height misbehaviour and BFT time violation misbehaviour +// in a submitted Header message and verifies the correctness of a submitted Misbehaviour ClientMessage +func (ClientState) CheckForMisbehaviour(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, msg exported.ClientMessage) bool { + switch msg := msg.(type) { + case *Header: + header := msg + consState := header.ConsensusState() + + // Check if the Client store already has a consensus state for the header's height + // If the consensus state exists, and it matches the header then we return early + // since header has already been submitted in a previous UpdateClient. + if existingConsState, found := GetConsensusState(clientStore, cdc, header.GetHeight()); found { + // This header has already been submitted and the necessary state is already stored + // in client store, thus we can return early without further validation. + if reflect.DeepEqual(existingConsState, header.ConsensusState()) { //nolint:gosimple + return false + } + + // A consensus state already exists for this height, but it does not match the provided header. + // The assumption is that Header has already been validated. Thus we can return true as misbehaviour is present + return true + } + + // Check that consensus state timestamps are monotonic + prevCons, prevOk := GetPreviousConsensusState(clientStore, cdc, header.GetHeight()) + nextCons, nextOk := GetNextConsensusState(clientStore, cdc, header.GetHeight()) + // if previous consensus state exists, check consensus state time is greater than previous consensus state time + // if previous consensus state is not before current consensus state return true + if prevOk && !prevCons.Timestamp.Before(consState.Timestamp) { + return true + } + // if next consensus state exists, check consensus state time is less than next consensus state time + // if next consensus state is not after current consensus state return true + if nextOk && !nextCons.Timestamp.After(consState.Timestamp) { + return true + } + case *Misbehaviour: + // if heights are equal check that this is valid misbehaviour of a fork + // otherwise if heights are unequal check that this is valid misbehavior of BFT time violation + if msg.Header1.GetHeight().EQ(msg.Header2.GetHeight()) { + + blockID1 := bfttypes.BlockID{ + Hash: msg.Header1.SignedHeader.Header.LastBlockId.Hash, + PartsHeader: bfttypes.PartSetHeader{Total: int(msg.Header1.SignedHeader.Header.LastBlockId.PartsHeader.Total), Hash: msg.Header1.SignedHeader.Header.LastBlockId.PartsHeader.Hash}, + } + if blockID1.ValidateBasic() != nil { + return false + } + blockID2 := bfttypes.BlockID{ + Hash: msg.Header2.SignedHeader.Header.LastBlockId.Hash, + PartsHeader: bfttypes.PartSetHeader{Total: int(msg.Header2.SignedHeader.Header.LastBlockId.PartsHeader.Total), Hash: msg.Header2.SignedHeader.Header.LastBlockId.PartsHeader.Hash}, + } + if blockID2.ValidateBasic() != nil { + return false + } + + // Ensure that Commit Hashes are different + if !bytes.Equal(blockID1.Hash, blockID2.Hash) { + return true + } + + } else if !msg.Header1.SignedHeader.Header.Time.After(msg.Header2.SignedHeader.Header.Time) { + // Header1 is at greater height than Header2, therefore Header1 time must be less than or equal to + // Header2 time in order to be valid misbehaviour (violation of monotonic time). + return true + } + } + + return false +} + +// verifyMisbehaviour determines whether or not two conflicting +// headers at the same height would have convinced the light client. +// +// NOTE: consensusState1 is the trusted consensus state that corresponds to the TrustedHeight +// of misbehaviour.Header1 +// Similarly, consensusState2 is the trusted consensus state that corresponds +// to misbehaviour.Header2 +// Misbehaviour sets frozen height to {0, 1} since it is only used as a boolean value (zero or non-zero). +func (cs *ClientState) verifyMisbehaviour(ctx sdk.Context, clientStore storetypes.KVStore, cdc codec.BinaryCodec, misbehaviour *Misbehaviour) error { + // Regardless of the type of misbehaviour, ensure that both headers are valid and would have been accepted by light-client + + // Retrieve trusted consensus states for each Header in misbehaviour + tmConsensusState1, found := GetConsensusState(clientStore, cdc, misbehaviour.Header1.TrustedHeight) + if !found { + return errorsmod.Wrapf(clienttypes.ErrConsensusStateNotFound, "could not get trusted consensus state from clientStore for Header1 at TrustedHeight: %s", misbehaviour.Header1.TrustedHeight) + } + + tmConsensusState2, found := GetConsensusState(clientStore, cdc, misbehaviour.Header2.TrustedHeight) + if !found { + return errorsmod.Wrapf(clienttypes.ErrConsensusStateNotFound, "could not get trusted consensus state from clientStore for Header2 at TrustedHeight: %s", misbehaviour.Header2.TrustedHeight) + } + + // Check the validity of the two conflicting headers against their respective + // trusted consensus states + // NOTE: header height and commitment root assertions are checked in + // misbehaviour.ValidateBasic by the client keeper and msg.ValidateBasic + // by the base application. + if err := checkMisbehaviourHeader( + cs, tmConsensusState1, misbehaviour.Header1, ctx.BlockTime(), + ); err != nil { + return errorsmod.Wrap(err, "verifying Header1 in Misbehaviour failed") + } + if err := checkMisbehaviourHeader( + cs, tmConsensusState2, misbehaviour.Header2, ctx.BlockTime(), + ); err != nil { + return errorsmod.Wrap(err, "verifying Header2 in Misbehaviour failed") + } + + return nil +} + +// checkMisbehaviourHeader checks that a Header in Misbehaviour is valid misbehaviour given +// a trusted ConsensusState +func checkMisbehaviourHeader( + clientState *ClientState, consState *ConsensusState, header *Header, currentTimestamp time.Time, +) error { + gnoTrustedValset := bfttypes.ValidatorSet{ + Validators: make([]*bfttypes.Validator, len(header.TrustedValidators.Validators)), + Proposer: nil, + } + for i, val := range header.TrustedValidators.Validators { + key, err := crypto.PubKeyFromBytes(val.PubKey.Value) + if err != nil { + return errorsmod.Wrap(err, "validator set is not gno validator set") + } + gnoTrustedValset.Validators[i] = &bfttypes.Validator{ + Address: crypto.MustAddressFromString(val.Address), + PubKey: key, + VotingPower: val.VotingPower, + ProposerPriority: val.ProposerPriority, + } + } + gnoTrustedValset.TotalVotingPower() // ensure TotalVotingPower is set + if gnoTrustedValset.IsNilOrEmpty() { + return errorsmod.Wrap(errors.New("Empty trusted validator set"), "trusted validator set is not gno validator set type") + } + + gnoCommit := bfttypes.Commit{ + BlockID: bfttypes.BlockID{Hash: header.SignedHeader.Commit.BlockId.Hash, PartsHeader: bfttypes.PartSetHeader{Total: int(header.SignedHeader.Commit.BlockId.PartsHeader.Total), Hash: header.SignedHeader.Commit.BlockId.PartsHeader.Hash}}, + Precommits: make([]*bfttypes.CommitSig, len(header.SignedHeader.Commit.Precommits)), + } + for i, sig := range header.SignedHeader.Commit.Precommits { + if sig == nil { + continue + } + gnoCommit.Precommits[i] = &bfttypes.CommitSig{ + ValidatorIndex: int(sig.ValidatorIndex), + Signature: sig.Signature, + BlockID: bfttypes.BlockID{Hash: sig.BlockId.Hash, PartsHeader: bfttypes.PartSetHeader{Total: int(sig.BlockId.PartsHeader.Total), Hash: sig.BlockId.PartsHeader.Hash}}, + Type: bfttypes.SignedMsgType(sig.Type), + Height: sig.Height, + Round: int(sig.Round), + Timestamp: sig.Timestamp, + ValidatorAddress: crypto.MustAddressFromString(sig.ValidatorAddress), + } + } + err := gnoCommit.ValidateBasic() + if err != nil { + return errorsmod.Wrap(err, "commit is not gno commit type") + } + + // check the trusted fields for the header against ConsensusState + if err := checkTrustedHeader(header, consState); err != nil { + return err + } + + // assert that the age of the trusted consensus state is not older than the trusting period + if currentTimestamp.Sub(consState.Timestamp) >= clientState.TrustingPeriod { + return errorsmod.Wrapf( + ErrTrustingPeriodExpired, + "current timestamp minus the latest consensus state timestamp is greater than or equal to the trusting period (%d >= %d)", + currentTimestamp.Sub(consState.Timestamp), clientState.TrustingPeriod, + ) + } + + chainID := clientState.GetChainID() + // If chainID is in revision format, then set revision number of chainID with the revision number + // of the misbehaviour header + // NOTE: misbehaviour verification is not supported for chains which upgrade to a new chainID without + // strictly following the chainID revision format + if clienttypes.IsRevisionFormat(chainID) { + chainID, _ = clienttypes.SetRevisionNumber(chainID, header.GetHeight().GetRevisionNumber()) + } + + // - ValidatorSet must have 2/3 similarity with trusted ValidatorSet + // - TODO: re-check + err = gnoTrustedValset.VerifyCommit(chainID, gnoCommit.BlockID, header.SignedHeader.Header.Height, &gnoCommit) + + if err != nil { + return errorsmod.Wrapf(clienttypes.ErrInvalidMisbehaviour, "validator set in header has too much change from trusted validator set: %v", err) + } + return nil +} diff --git a/modules/10-gno/module.go b/modules/10-gno/module.go new file mode 100644 index 000000000..ea066ce5e --- /dev/null +++ b/modules/10-gno/module.go @@ -0,0 +1,89 @@ +package gno + +import ( + "encoding/json" + + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + "cosmossdk.io/core/appmodule" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/types/module" +) + +var ( + _ module.AppModuleBasic = (*AppModuleBasic)(nil) + _ appmodule.AppModule = (*AppModule)(nil) +) + +// AppModuleBasic defines the basic application module used by the GNO light client. +// Only the RegisterInterfaces function needs to be implemented. All other function perform +// a no-op. +type AppModuleBasic struct{} + +const Gno string = "10-gno" + +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (AppModuleBasic) IsOnePerModuleType() {} + +// IsAppModule implements the appmodule.AppModule interface. +func (AppModuleBasic) IsAppModule() {} + +// Name returns the tendermint module name. +func (AppModuleBasic) Name() string { + return ModuleName +} + +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (AppModule) IsOnePerModuleType() {} + +// IsAppModule implements the appmodule.AppModule interface. +func (AppModule) IsAppModule() {} + +// RegisterLegacyAminoCodec performs a no-op. The gno client does not support amino. +func (AppModuleBasic) RegisterLegacyAminoCodec(*codec.LegacyAmino) {} + +// RegisterInterfaces registers module concrete types into protobuf Any. This allows core IBC +// to unmarshal gno light client types. +func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { + RegisterInterfaces(registry) +} + +// DefaultGenesis performs a no-op. Genesis is not supported for the gno light client. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return nil +} + +// ValidateGenesis performs a no-op. Genesis is not supported for the gno light client. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + return nil +} + +// RegisterGRPCGatewayRoutes performs a no-op. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {} + +// GetTxCmd performs a no-op. Please see the 02-client cli commands. +func (AppModuleBasic) GetTxCmd() *cobra.Command { + return nil +} + +// GetQueryCmd performs a no-op. Please see the 02-client cli commands. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return nil +} + +// AppModule is the application module for the GNO client module +type AppModule struct { + AppModuleBasic + lightClientModule LightClientModule +} + +// NewAppModule creates a new GNO client module +func NewAppModule(lightClientModule LightClientModule) AppModule { + return AppModule{ + lightClientModule: lightClientModule, + } +} diff --git a/modules/10-gno/proposal_handle.go b/modules/10-gno/proposal_handle.go new file mode 100644 index 000000000..0e10b8e68 --- /dev/null +++ b/modules/10-gno/proposal_handle.go @@ -0,0 +1,103 @@ +package gno + +import ( + "reflect" + "time" + + errorsmod "cosmossdk.io/errors" + storetypes "cosmossdk.io/store/types" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + + clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" + "github.com/cosmos/ibc-go/v10/modules/core/exported" +) + +// CheckSubstituteAndUpdateState will try to update the client with the state of the +// substitute. +// +// AllowUpdateAfterMisbehaviour and AllowUpdateAfterExpiry have been deprecated. +// Please see ADR 026 for more information. +// +// The following must always be true: +// - The substitute client is the same type as the subject client +// - The subject and substitute client states match in all parameters (expect frozen height, latest height, and chain-id) +// +// In case 1) before updating the client, the client will be unfrozen by resetting +// the FrozenHeight to the zero Height. +func (cs ClientState) CheckSubstituteAndUpdateState( + ctx sdk.Context, cdc codec.BinaryCodec, subjectClientStore, + substituteClientStore storetypes.KVStore, substituteClient exported.ClientState, +) error { + substituteClientState, ok := substituteClient.(*ClientState) + if !ok { + return errorsmod.Wrapf(clienttypes.ErrInvalidClient, "expected type %T, got %T", &ClientState{}, substituteClient) + } + + if !IsMatchingClientState(cs, *substituteClientState) { + return errorsmod.Wrap(clienttypes.ErrInvalidSubstitute, "subject client state does not match substitute client state") + } + + if cs.status(ctx, subjectClientStore, cdc) == exported.Frozen { + // unfreeze the client + cs.FrozenHeight = clienttypes.ZeroHeight() + } + + // copy consensus states and processed time from substitute to subject + // starting from initial height and ending on the latest height (inclusive) + height := substituteClientState.LatestHeight + + consensusState, found := GetConsensusState(substituteClientStore, cdc, height) + if !found { + return errorsmod.Wrap(clienttypes.ErrConsensusStateNotFound, "unable to retrieve latest consensus state for substitute client") + } + + setConsensusState(subjectClientStore, cdc, consensusState, height) + + // set metadata stored for the substitute consensus state + processedHeight, found := GetProcessedHeight(substituteClientStore, height) + if !found { + return errorsmod.Wrap(clienttypes.ErrUpdateClientFailed, "unable to retrieve processed height for substitute client latest height") + } + + processedTime, found := GetProcessedTime(substituteClientStore, height) + if !found { + return errorsmod.Wrap(clienttypes.ErrUpdateClientFailed, "unable to retrieve processed time for substitute client latest height") + } + + setConsensusMetadataWithValues(subjectClientStore, height, processedHeight, processedTime) + + cs.LatestHeight = substituteClientState.LatestHeight + cs.ChainId = substituteClientState.ChainId + + // set new trusting period based on the substitute client state + cs.TrustingPeriod = substituteClientState.TrustingPeriod + + // no validation is necessary since the substitute is verified to be Active + // in 02-client. + setClientState(subjectClientStore, cdc, &cs) + + return nil +} + +// IsMatchingClientState returns true if all the client state parameters match +// except for frozen height, latest height, trusting period, chain-id. +func IsMatchingClientState(subject, substitute ClientState) bool { + // zero out parameters which do not need to match + subject.LatestHeight = clienttypes.ZeroHeight() + subject.FrozenHeight = clienttypes.ZeroHeight() + subject.TrustingPeriod = time.Duration(0) + substitute.LatestHeight = clienttypes.ZeroHeight() + substitute.FrozenHeight = clienttypes.ZeroHeight() + substitute.TrustingPeriod = time.Duration(0) + subject.ChainId = "" + substitute.ChainId = "" + // sets both sets of flags to true as these flags have been DEPRECATED, see ADR-026 for more information + subject.AllowUpdateAfterExpiry = true + substitute.AllowUpdateAfterExpiry = true + subject.AllowUpdateAfterMisbehaviour = true + substitute.AllowUpdateAfterMisbehaviour = true + + return reflect.DeepEqual(subject, substitute) +} diff --git a/modules/10-gno/store.go b/modules/10-gno/store.go new file mode 100644 index 000000000..e971002de --- /dev/null +++ b/modules/10-gno/store.go @@ -0,0 +1,344 @@ +package gno + +import ( + "bytes" + "encoding/binary" + "fmt" + + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + + clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" + host "github.com/cosmos/ibc-go/v10/modules/core/24-host" + "github.com/cosmos/ibc-go/v10/modules/core/exported" +) + +/* +This file contains the logic for storage and iteration over `IterationKey` metadata that is stored +for each consensus state. The consensus state key specified in ICS-24 and expected by counterparty chains +stores the consensus state under the key: `consensusStates/{revision_number}-{revision_height}`, with each number +represented as a string. +While this works fine for IBC proof verification, it makes efficient iteration difficult since the lexicographic order +of the consensus state keys do not match the height order of consensus states. This makes consensus state pruning and +monotonic time enforcement difficult since it is inefficient to find the earliest consensus state or to find the neighboring +consensus states given a consensus state height. +Changing the ICS-24 representation will be a major breaking change that requires counterparty chains to accept a new key format. +Thus to avoid breaking IBC, we can store a lookup from a more efficiently formatted key: `iterationKey` to the consensus state key which +stores the underlying consensus state. This efficient iteration key will be formatted like so: `iterateConsensusStates{BigEndianRevisionBytes}{BigEndianHeightBytes}`. +This ensures that the lexicographic order of iteration keys match the height order of the consensus states. Thus, we can use the SDK store's +Iterators to iterate over the consensus states in ascending/descending order by providing a mapping from `iterationKey -> consensusStateKey -> ConsensusState`. +A future version of IBC may choose to replace the ICS24 ConsensusState path with the more efficient format and make this indirection unnecessary. +*/ + +const KeyIterateConsensusStatePrefix = "iterateConsensusStates" + +var ( + // KeyProcessedTime is appended to consensus state key to store the processed time + KeyProcessedTime = []byte("/processedTime") + // KeyProcessedHeight is appended to consensus state key to store the processed height + KeyProcessedHeight = []byte("/processedHeight") + // KeyIteration stores the key mapping to consensus state key for efficient iteration + KeyIteration = []byte("/iterationKey") +) + +// setClientState stores the client state +func setClientState(clientStore storetypes.KVStore, cdc codec.BinaryCodec, clientState *ClientState) { + key := host.ClientStateKey() + val := clienttypes.MustMarshalClientState(cdc, clientState) + clientStore.Set(key, val) +} + +// getClientState retrieves the client state from the store using the provided KVStore and codec. +// It returns the unmarshaled ClientState and a boolean indicating if the state was found. +func getClientState(store storetypes.KVStore, cdc codec.BinaryCodec) (*ClientState, bool) { + bz := store.Get(host.ClientStateKey()) + if len(bz) == 0 { + return nil, false + } + + clientStateI := clienttypes.MustUnmarshalClientState(cdc, bz) + var clientState *ClientState + clientState, ok := clientStateI.(*ClientState) + if !ok { + panic(fmt.Errorf("cannot convert %T into %T", clientStateI, clientState)) + } + return clientState, true +} + +// setConsensusState stores the consensus state at the given height. +func setConsensusState(clientStore storetypes.KVStore, cdc codec.BinaryCodec, consensusState *ConsensusState, height exported.Height) { + key := host.ConsensusStateKey(height) + val := clienttypes.MustMarshalConsensusState(cdc, consensusState) + clientStore.Set(key, val) +} + +// GetConsensusState retrieves the consensus state from the client prefixed store. +// If the ConsensusState does not exist in state for the provided height a nil value and false boolean flag is returned +func GetConsensusState(store storetypes.KVStore, cdc codec.BinaryCodec, height exported.Height) (*ConsensusState, bool) { + bz := store.Get(host.ConsensusStateKey(height)) + if len(bz) == 0 { + return nil, false + } + + consensusStateI := clienttypes.MustUnmarshalConsensusState(cdc, bz) + var consensusState *ConsensusState + consensusState, ok := consensusStateI.(*ConsensusState) + if !ok { + panic(fmt.Errorf("cannot convert %T into %T", consensusStateI, consensusState)) + } + + return consensusState, true +} + +// deleteConsensusState deletes the consensus state at the given height +func deleteConsensusState(clientStore storetypes.KVStore, height exported.Height) { + key := host.ConsensusStateKey(height) + clientStore.Delete(key) +} + +// ProcessedTimeKey returns the key under which the processed time will be stored in the client store. +func ProcessedTimeKey(height exported.Height) []byte { + return append(host.ConsensusStateKey(height), KeyProcessedTime...) +} + +// SetProcessedTime stores the time at which a header was processed and the corresponding consensus state was created. +// This is useful when validating whether a packet has reached the time specified delay period in the tendermint client's +// verification functions +func SetProcessedTime(clientStore storetypes.KVStore, height exported.Height, timeNs uint64) { + key := ProcessedTimeKey(height) + val := sdk.Uint64ToBigEndian(timeNs) + clientStore.Set(key, val) +} + +// GetProcessedTime gets the time (in nanoseconds) at which this chain received and processed a tendermint header. +// This is used to validate that a received packet has passed the time delay period. +func GetProcessedTime(clientStore storetypes.KVStore, height exported.Height) (uint64, bool) { + key := ProcessedTimeKey(height) + bz := clientStore.Get(key) + if len(bz) == 0 { + return 0, false + } + return sdk.BigEndianToUint64(bz), true +} + +// deleteProcessedTime deletes the processedTime for a given height +func deleteProcessedTime(clientStore storetypes.KVStore, height exported.Height) { + key := ProcessedTimeKey(height) + clientStore.Delete(key) +} + +// ProcessedHeightKey returns the key under which the processed height will be stored in the client store. +func ProcessedHeightKey(height exported.Height) []byte { + return append(host.ConsensusStateKey(height), KeyProcessedHeight...) +} + +// SetProcessedHeight stores the height at which a header was processed and the corresponding consensus state was created. +// This is useful when validating whether a packet has reached the specified block delay period in the tendermint client's +// verification functions +func SetProcessedHeight(clientStore storetypes.KVStore, consHeight, processedHeight exported.Height) { + key := ProcessedHeightKey(consHeight) + val := []byte(processedHeight.String()) + clientStore.Set(key, val) +} + +// GetProcessedHeight gets the height at which this chain received and processed a tendermint header. +// This is used to validate that a received packet has passed the block delay period. +func GetProcessedHeight(clientStore storetypes.KVStore, height exported.Height) (exported.Height, bool) { + key := ProcessedHeightKey(height) + bz := clientStore.Get(key) + if len(bz) == 0 { + return nil, false + } + processedHeight, err := clienttypes.ParseHeight(string(bz)) + if err != nil { + return nil, false + } + return processedHeight, true +} + +// deleteProcessedHeight deletes the processedHeight for a given height +func deleteProcessedHeight(clientStore storetypes.KVStore, height exported.Height) { + key := ProcessedHeightKey(height) + clientStore.Delete(key) +} + +// IterationKey returns the key under which the consensus state key will be stored. +// The iteration key is a BigEndian representation of the consensus state key to support efficient iteration. +func IterationKey(height exported.Height) []byte { + heightBytes := bigEndianHeightBytes(height) + return append([]byte(KeyIterateConsensusStatePrefix), heightBytes...) +} + +// SetIterationKey stores the consensus state key under a key that is more efficient for ordered iteration +func SetIterationKey(clientStore storetypes.KVStore, height exported.Height) { + key := IterationKey(height) + val := host.ConsensusStateKey(height) + clientStore.Set(key, val) +} + +// GetIterationKey returns the consensus state key stored under the efficient iteration key. +// NOTE: This function is currently only used for testing purposes +func GetIterationKey(clientStore storetypes.KVStore, height exported.Height) []byte { + key := IterationKey(height) + return clientStore.Get(key) +} + +// deleteIterationKey deletes the iteration key for a given height +func deleteIterationKey(clientStore storetypes.KVStore, height exported.Height) { + key := IterationKey(height) + clientStore.Delete(key) +} + +// GetHeightFromIterationKey takes an iteration key and returns the height that it references +func GetHeightFromIterationKey(iterKey []byte) exported.Height { + bigEndianBytes := iterKey[len([]byte(KeyIterateConsensusStatePrefix)):] + revisionBytes := bigEndianBytes[0:8] + heightBytes := bigEndianBytes[8:] + revision := binary.BigEndian.Uint64(revisionBytes) + height := binary.BigEndian.Uint64(heightBytes) + return clienttypes.NewHeight(revision, height) +} + +// IterateConsensusStateAscending iterates through the consensus states in ascending order. It calls the provided +// callback on each height, until stop=true is returned. +func IterateConsensusStateAscending(clientStore storetypes.KVStore, cb func(height exported.Height) (stop bool)) { + iterator := storetypes.KVStorePrefixIterator(clientStore, []byte(KeyIterateConsensusStatePrefix)) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + iterKey := iterator.Key() + height := GetHeightFromIterationKey(iterKey) + if cb(height) { + break + } + } +} + +// GetNextConsensusState returns the lowest consensus state that is larger than the given height. +// The Iterator returns a storetypes.Iterator which iterates from start (inclusive) to end (exclusive). +// If the starting height exists in store, we need to call iterator.Next() to get the next consensus state. +// Otherwise, the iterator is already at the next consensus state so we can call iterator.Value() immediately. +func GetNextConsensusState(clientStore storetypes.KVStore, cdc codec.BinaryCodec, height exported.Height) (*ConsensusState, bool) { + iterateStore := prefix.NewStore(clientStore, []byte(KeyIterateConsensusStatePrefix)) + iterator := iterateStore.Iterator(bigEndianHeightBytes(height), nil) + defer iterator.Close() + if !iterator.Valid() { + return nil, false + } + + // if iterator is at current height, ignore the consensus state at current height and get next height + // if iterator value is not at current height, it is already at next height. + if bytes.Equal(iterator.Value(), host.ConsensusStateKey(height)) { + iterator.Next() + if !iterator.Valid() { + return nil, false + } + } + + csKey := iterator.Value() + + return getTmConsensusState(clientStore, cdc, csKey) +} + +// GetPreviousConsensusState returns the highest consensus state that is lower than the given height. +// The Iterator returns a storetypes.Iterator which iterates from the end (exclusive) to start (inclusive). +// Thus to get previous consensus state we call iterator.Value() immediately. +func GetPreviousConsensusState(clientStore storetypes.KVStore, cdc codec.BinaryCodec, height exported.Height) (*ConsensusState, bool) { + iterateStore := prefix.NewStore(clientStore, []byte(KeyIterateConsensusStatePrefix)) + iterator := iterateStore.ReverseIterator(nil, bigEndianHeightBytes(height)) + defer iterator.Close() + + if !iterator.Valid() { + return nil, false + } + + csKey := iterator.Value() + + return getTmConsensusState(clientStore, cdc, csKey) +} + +// PruneAllExpiredConsensusStates iterates over all consensus states for a given +// client store. If a consensus state is expired, it is deleted and its metadata +// is deleted. The number of consensus states pruned is returned. +func PruneAllExpiredConsensusStates( + ctx sdk.Context, clientStore storetypes.KVStore, + cdc codec.BinaryCodec, clientState *ClientState, +) int { + var heights []exported.Height + + pruneCb := func(height exported.Height) bool { + consState, found := GetConsensusState(clientStore, cdc, height) + if !found { // consensus state should always be found + return true + } + if clientState.IsExpired(consState.Timestamp, ctx.BlockTime()) { + heights = append(heights, height) + } + + return false + } + + IterateConsensusStateAscending(clientStore, pruneCb) + + for _, height := range heights { + deleteConsensusState(clientStore, height) + deleteConsensusMetadata(clientStore, height) + } + + return len(heights) +} + +// Helper function for GetNextConsensusState and GetPreviousConsensusState +func getTmConsensusState(clientStore storetypes.KVStore, cdc codec.BinaryCodec, key []byte) (*ConsensusState, bool) { + bz := clientStore.Get(key) + if len(bz) == 0 { + return nil, false + } + + consensusStateI, err := clienttypes.UnmarshalConsensusState(cdc, bz) + if err != nil { + return nil, false + } + + consensusState, ok := consensusStateI.(*ConsensusState) + if !ok { + return nil, false + } + return consensusState, true +} + +func bigEndianHeightBytes(height exported.Height) []byte { + heightBytes := make([]byte, 16) + binary.BigEndian.PutUint64(heightBytes, height.GetRevisionNumber()) + binary.BigEndian.PutUint64(heightBytes[8:], height.GetRevisionHeight()) + return heightBytes +} + +// setConsensusMetadata sets context time as processed time and set context height as processed height +// as this is internal tendermint light client logic. +// client state and consensus state will be set by client keeper +// set iteration key to provide ability for efficient ordered iteration of consensus states. +func setConsensusMetadata(ctx sdk.Context, clientStore storetypes.KVStore, height exported.Height) { + setConsensusMetadataWithValues(clientStore, height, clienttypes.GetSelfHeight(ctx), uint64(ctx.BlockTime().UnixNano())) +} + +// setConsensusMetadataWithValues sets the consensus metadata with the provided values +func setConsensusMetadataWithValues( + clientStore storetypes.KVStore, height, + processedHeight exported.Height, + processedTime uint64, +) { + SetProcessedTime(clientStore, height, processedTime) + SetProcessedHeight(clientStore, height, processedHeight) + SetIterationKey(clientStore, height) +} + +// deleteConsensusMetadata deletes the metadata stored for a particular consensus state. +func deleteConsensusMetadata(clientStore storetypes.KVStore, height exported.Height) { + deleteProcessedTime(clientStore, height) + deleteProcessedHeight(clientStore, height) + deleteIterationKey(clientStore, height) +} diff --git a/modules/10-gno/update.go b/modules/10-gno/update.go new file mode 100644 index 000000000..6e1b1f179 --- /dev/null +++ b/modules/10-gno/update.go @@ -0,0 +1,327 @@ +package gno + +import ( + "bytes" + "errors" + "fmt" + + errorsmod "cosmossdk.io/errors" + storetypes "cosmossdk.io/store/types" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/cometbft/cometbft/light" + cmttypes "github.com/cometbft/cometbft/types" + bfttypes "github.com/gnolang/gno/tm2/pkg/bft/types" + + clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" + commitmenttypes "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types" + host "github.com/cosmos/ibc-go/v10/modules/core/24-host" + "github.com/cosmos/ibc-go/v10/modules/core/exported" + "github.com/gnolang/gno/tm2/pkg/crypto" +) + +// VerifyClientMessage checks if the clientMessage is of type Header or Misbehaviour and verifies the message +func (cs *ClientState) VerifyClientMessage( + ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, + clientMsg exported.ClientMessage, +) error { + switch msg := clientMsg.(type) { + case *Header: + return cs.verifyHeader(ctx, clientStore, cdc, msg) + case *Misbehaviour: + return cs.verifyMisbehaviour(ctx, clientStore, cdc, msg) + default: + return clienttypes.ErrInvalidClientType + } +} + +// verifyHeader returns an error if: +// - the client or header provided are not parseable to tendermint types +// - the header is invalid +// - header height is less than or equal to the trusted header height +// - header revision is not equal to trusted header revision +// - header valset commit verification fails +// - header timestamp is past the trusting period in relation to the consensus state +// - header timestamp is less than or equal to the consensus state timestamp +func (cs *ClientState) verifyHeader( + ctx sdk.Context, clientStore storetypes.KVStore, cdc codec.BinaryCodec, + header *Header, +) error { + currentTimestamp := ctx.BlockTime() + + // Retrieve trusted consensus states for each Header in misbehaviour + consState, found := GetConsensusState(clientStore, cdc, header.TrustedHeight) + if !found { + return errorsmod.Wrapf(clienttypes.ErrConsensusStateNotFound, "could not get trusted consensus state from clientStore for Header at TrustedHeight: %s", header.TrustedHeight) + } + + if err := checkTrustedHeader(header, consState); err != nil { + return err + } + + // UpdateClient only accepts updates with a header at the same revision + // as the trusted consensus state + if header.GetHeight().GetRevisionNumber() != header.TrustedHeight.RevisionNumber { + return errorsmod.Wrapf( + ErrInvalidHeaderHeight, + "header height revision %d does not match trusted header revision %d", + header.GetHeight().GetRevisionNumber(), header.TrustedHeight.RevisionNumber, + ) + } + + gnoTrustedValidators := bfttypes.ValidatorSet{ + Validators: make([]*bfttypes.Validator, len(header.TrustedValidators.Validators)), + Proposer: nil, + } + for i, val := range header.TrustedValidators.Validators { + key, err := crypto.PubKeyFromBytes(val.PubKey.Value) + if err != nil { + return errorsmod.Wrap(err, "validator set is not gno validator set") + } + gnoTrustedValidators.Validators[i] = &bfttypes.Validator{ + Address: crypto.MustAddressFromString(val.Address), + PubKey: key, + VotingPower: val.VotingPower, + ProposerPriority: val.ProposerPriority, + } + } + gnoTrustedValidators.TotalVotingPower() // ensure TotalVotingPower is set + if gnoTrustedValidators.IsNilOrEmpty() { + return errorsmod.Wrap(errors.New("Not gno validators"), "trusted validator set in not gno validator set type") + } + + gnoHeader := bfttypes.Header{ + Version: header.SignedHeader.Header.Version, + ChainID: header.SignedHeader.Header.ChainId, + Height: header.SignedHeader.Header.Height, + Time: header.SignedHeader.Header.Time, + LastBlockID: bfttypes.BlockID{Hash: header.SignedHeader.Header.LastBlockId.Hash, PartsHeader: bfttypes.PartSetHeader{Total: int(header.SignedHeader.Header.LastBlockId.PartsHeader.Total), Hash: header.SignedHeader.Header.LastBlockId.PartsHeader.Hash}}, + LastCommitHash: header.SignedHeader.Header.LastCommitHash, + DataHash: header.SignedHeader.Header.DataHash, + ValidatorsHash: header.SignedHeader.Header.ValidatorsHash, + NextValidatorsHash: header.SignedHeader.Header.NextValidatorsHash, + ConsensusHash: header.SignedHeader.Header.ConsensusHash, + AppHash: header.SignedHeader.Header.AppHash, + LastResultsHash: header.SignedHeader.Header.LastResultsHash, + ProposerAddress: crypto.MustAddressFromString(header.SignedHeader.Header.ProposerAddress), + } + gnoCommit := bfttypes.Commit{ + BlockID: bfttypes.BlockID{Hash: header.SignedHeader.Commit.BlockId.Hash, PartsHeader: bfttypes.PartSetHeader{Total: int(header.SignedHeader.Commit.BlockId.PartsHeader.Total), Hash: header.SignedHeader.Commit.BlockId.PartsHeader.Hash}}, + Precommits: make([]*bfttypes.CommitSig, len(header.SignedHeader.Commit.Precommits)), + } + for i, sig := range header.SignedHeader.Commit.Precommits { + if sig == nil { + continue + } + gnoCommit.Precommits[i] = &bfttypes.CommitSig{ + ValidatorIndex: int(sig.ValidatorIndex), + Signature: sig.Signature, + BlockID: bfttypes.BlockID{Hash: sig.BlockId.Hash, PartsHeader: bfttypes.PartSetHeader{Total: int(sig.BlockId.PartsHeader.Total), Hash: sig.BlockId.PartsHeader.Hash}}, + Type: bfttypes.SignedMsgType(sig.Type), + Height: sig.Height, + Round: int(sig.Round), + Timestamp: sig.Timestamp, + ValidatorAddress: crypto.MustAddressFromString(sig.ValidatorAddress), + } + } + gnoSignedHeader := bfttypes.SignedHeader{ + Header: &gnoHeader, + Commit: &gnoCommit, + } + err := gnoSignedHeader.ValidateBasic(header.SignedHeader.Header.ChainId) // ensure signed header is valid + if err != nil { + return errorsmod.Wrap(err, "signed header in not gno signed header type") + } + + gnoValidatorSet := bfttypes.ValidatorSet{ + Validators: make([]*bfttypes.Validator, len(header.ValidatorSet.Validators)), + Proposer: nil, + } + for i, val := range header.ValidatorSet.Validators { + key, err := crypto.PubKeyFromBytes(val.PubKey.Value) + if err != nil { + return errorsmod.Wrap(err, "validator set is not gno validator set") + } + gnoValidatorSet.Validators[i] = &bfttypes.Validator{ + Address: crypto.MustAddressFromString(val.Address), + PubKey: key, + VotingPower: val.VotingPower, + ProposerPriority: val.ProposerPriority, + } + } + gnoValidatorSet.TotalVotingPower() // ensure TotalVotingPower is set + if gnoValidatorSet.IsNilOrEmpty() { + return errorsmod.Wrap(errors.New("Not gno validators"), "trusted validator set in not gno validator set type") + } + + // assert header height is newer than consensus state + if header.GetHeight().LTE(header.TrustedHeight) { + return errorsmod.Wrapf( + clienttypes.ErrInvalidHeader, + "header height ≤ consensus state height (%s ≤ %s)", header.GetHeight(), header.TrustedHeight, + ) + } + + // Construct a trusted header using the fields in consensus state + // Only Height, Time, and NextValidatorsHash are necessary for verification + // NOTE: updates must be within the same revision + trustedHeader := cmttypes.Header{ + ChainID: cs.GetChainID(), + Height: int64(header.TrustedHeight.RevisionHeight), + Time: consState.Timestamp, + NextValidatorsHash: consState.NextValidatorsHash, + } + signedHeader := cmttypes.SignedHeader{ + Header: &trustedHeader, + } + + // Verify next header with the passed-in trustedVals + // - asserts trusting period not passed + // - assert header timestamp is not past the trusting period + // - assert header timestamp is past latest stored consensus state timestamp + // - assert that a TrustLevel proportion of TrustedValidators signed new Commit + + // TODO: replace with gno light client verification + err = light.Verify( + &signedHeader, + tmTrustedValidators, tmSignedHeader, tmValidatorSet, + cs.TrustingPeriod, currentTimestamp, cs.MaxClockDrift, cs.TrustLevel.ToTendermint(), + ) + if err != nil { + return errorsmod.Wrap(err, "failed to verify header") + } + + return nil +} + +// UpdateState may be used to either create a consensus state for: +// - a future height greater than the latest client state height +// - a past height that was skipped during bisection +// If we are updating to a past height, a consensus state is created for that height to be persisted in client store +// If we are updating to a future height, the consensus state is created and the client state is updated to reflect +// the new latest height +// A list containing the updated consensus height is returned. +// UpdateState must only be used to update within a single revision, thus header revision number and trusted height's revision +// number must be the same. To update to a new revision, use a separate upgrade path +// UpdateState will prune the oldest consensus state if it is expired. +// If the provided clientMsg is not of type of Header then the handler will noop and empty slice is returned. +func (cs ClientState) UpdateState(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, clientMsg exported.ClientMessage) []exported.Height { + header, ok := clientMsg.(*Header) + if !ok { + // clientMsg is invalid Misbehaviour, no update necessary + return []exported.Height{} + } + + // performance: do not prune in checkTx + // simulation must prune for accurate gas estimation + if (!ctx.IsCheckTx() && !ctx.IsReCheckTx()) || ctx.ExecMode() == sdk.ExecModeSimulate { + cs.pruneOldestConsensusState(ctx, cdc, clientStore) + } + + // check for duplicate update + if _, found := GetConsensusState(clientStore, cdc, header.GetHeight()); found { + // perform no-op + return []exported.Height{header.GetHeight()} + } + + height, ok := header.GetHeight().(clienttypes.Height) + if !ok { + panic(fmt.Errorf("cannot convert %T to %T", header.GetHeight(), &clienttypes.Height{})) + } + if height.GT(cs.LatestHeight) { + cs.LatestHeight = height + } + + consensusState := &ConsensusState{ + Timestamp: header.GetTime(), + Root: commitmenttypes.NewMerkleRoot(header.SignedHeader.Header.AppHash), + NextValidatorsHash: header.SignedHeader.Header.NextValidatorsHash, + } + + // set client state, consensus state and associated metadata + setClientState(clientStore, cdc, &cs) + setConsensusState(clientStore, cdc, consensusState, header.GetHeight()) + setConsensusMetadata(ctx, clientStore, header.GetHeight()) + + return []exported.Height{height} +} + +// pruneOldestConsensusState will retrieve the earliest consensus state for this clientID and check if it is expired. If it is, +// that consensus state will be pruned from store along with all associated metadata. This will prevent the client store from +// becoming bloated with expired consensus states that can no longer be used for updates and packet verification. +func (cs ClientState) pruneOldestConsensusState(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore) { + // Check the earliest consensus state to see if it is expired, if so then set the prune height + // so that we can delete consensus state and all associated metadata. + var ( + pruneHeight exported.Height + ) + + pruneCb := func(height exported.Height) bool { + consState, found := GetConsensusState(clientStore, cdc, height) + // this error should never occur + if !found { + panic(errorsmod.Wrapf(clienttypes.ErrConsensusStateNotFound, "failed to retrieve consensus state at height: %s", height)) + } + + if cs.IsExpired(consState.Timestamp, ctx.BlockTime()) { + pruneHeight = height + } + + return true + } + + IterateConsensusStateAscending(clientStore, pruneCb) + + // if pruneHeight is set, delete consensus state and metadata + if pruneHeight != nil { + deleteConsensusState(clientStore, pruneHeight) + deleteConsensusMetadata(clientStore, pruneHeight) + } +} + +// UpdateStateOnMisbehaviour updates state upon misbehaviour, freezing the ClientState. This method should only be called when misbehaviour is detected +// as it does not perform any misbehaviour checks. +func (cs ClientState) UpdateStateOnMisbehaviour(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, _ exported.ClientMessage) { + cs.FrozenHeight = FrozenHeight + + clientStore.Set(host.ClientStateKey(), clienttypes.MustMarshalClientState(cdc, &cs)) +} + +// checkTrustedHeader checks that consensus state matches trusted fields of Header +func checkTrustedHeader(header *Header, consState *ConsensusState) error { + + gnoTrustedValset := bfttypes.ValidatorSet{ + Validators: make([]*bfttypes.Validator, len(header.TrustedValidators.Validators)), + Proposer: nil, + } + for i, val := range header.TrustedValidators.Validators { + key, err := crypto.PubKeyFromBytes(val.PubKey.Value) + if err != nil { + return errorsmod.Wrap(err, "validator set is not gno validator set") + } + gnoTrustedValset.Validators[i] = &bfttypes.Validator{ + Address: crypto.MustAddressFromString(val.Address), + PubKey: key, + VotingPower: val.VotingPower, + ProposerPriority: val.ProposerPriority, + } + } + gnoTrustedValset.TotalVotingPower() // ensure TotalVotingPower is set + if gnoTrustedValset.IsNilOrEmpty() { + return errorsmod.Wrap(errors.New("Empty trusted validator set"), "trusted validator set is not gno validator set type") + } + + // assert that trustedVals is NextValidators of last trusted header + // to do this, we check that trustedVals.Hash() == consState.NextValidatorsHash + tvalHash := gnoTrustedValset.Hash() + if !bytes.Equal(consState.NextValidatorsHash, tvalHash) { + return errorsmod.Wrapf( + ErrInvalidValidatorSet, + "trusted validators %s, does not hash to latest trusted validators. Expected: %X, got: %X", + header.TrustedValidators, consState.NextValidatorsHash, tvalHash, + ) + } + return nil +} diff --git a/modules/10-gno/upgrade.go b/modules/10-gno/upgrade.go new file mode 100644 index 000000000..f728ec7d1 --- /dev/null +++ b/modules/10-gno/upgrade.go @@ -0,0 +1,188 @@ +package gno + +import ( + "fmt" + "time" + + errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" + upgradetypes "cosmossdk.io/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + + clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" + commitmenttypes "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types" + commitmenttypesv2 "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types/v2" + "github.com/cosmos/ibc-go/v10/modules/core/exported" +) + +// VerifyUpgradeAndUpdateState checks if the upgraded client has been committed by the current client +// It will zero out all client-specific fields and verify all data in client state that must +// be the same across all valid Tendermint clients for the new chain. +// Note, if there is a decrease in the UnbondingPeriod, then the TrustingPeriod, despite being a client-specific field +// is scaled down by the same ratio. +// VerifyUpgrade will return an error if: +// - the upgradedClient is not a Tendermint ClientState +// - the latest height of the client state does not have the same revision number or has a greater +// height than the committed client. +// - the height of upgraded client is not greater than that of current client +// - the latest height of the new client does not match or is greater than the height in committed client +// - any Tendermint chain specified parameter in upgraded client such as ChainID, UnbondingPeriod, +// and ProofSpecs do not match parameters set by committed client +func (cs ClientState) VerifyUpgradeAndUpdateState( + ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, + upgradedClient exported.ClientState, upgradedConsState exported.ConsensusState, + upgradeClientProof, upgradeConsStateProof []byte, +) error { + if len(cs.UpgradePath) == 0 { + return errorsmod.Wrap(clienttypes.ErrInvalidUpgradeClient, "cannot upgrade client, no upgrade path set") + } + + // upgraded client state and consensus state must be IBC tendermint client state and consensus state + // this may be modified in the future to upgrade to a new IBC tendermint type + // counterparty must also commit to the upgraded consensus state at a sub-path under the upgrade path specified + tmUpgradeClient, ok := upgradedClient.(*ClientState) + if !ok { + return errorsmod.Wrapf(clienttypes.ErrInvalidClientType, "upgraded client must be Tendermint client. expected: %T got: %T", + &ClientState{}, upgradedClient) + } + + tmUpgradeConsState, ok := upgradedConsState.(*ConsensusState) + if !ok { + return errorsmod.Wrapf(clienttypes.ErrInvalidConsensus, "upgraded consensus state must be Tendermint consensus state. expected %T, got: %T", + &ConsensusState{}, upgradedConsState) + } + + // unmarshal proofs + var merkleProofClient, merkleProofConsState commitmenttypes.MerkleProof + if err := cdc.Unmarshal(upgradeClientProof, &merkleProofClient); err != nil { + return errorsmod.Wrapf(commitmenttypes.ErrInvalidProof, "could not unmarshal client merkle proof: %v", err) + } + if err := cdc.Unmarshal(upgradeConsStateProof, &merkleProofConsState); err != nil { + return errorsmod.Wrapf(commitmenttypes.ErrInvalidProof, "could not unmarshal consensus state merkle proof: %v", err) + } + + // last height of current counterparty chain must be client's latest height + lastHeight := cs.LatestHeight + + // Must prove against latest consensus state to ensure we are verifying against latest upgrade plan + // This verifies that upgrade is intended for the provided revision, since committed client must exist + // at this consensus state + consState, found := GetConsensusState(clientStore, cdc, lastHeight) + if !found { + return errorsmod.Wrap(clienttypes.ErrConsensusStateNotFound, "could not retrieve consensus state for lastHeight") + } + + // Verify client proof + bz, err := cdc.MarshalInterface(tmUpgradeClient.ZeroCustomFields()) + if err != nil { + return errorsmod.Wrapf(clienttypes.ErrInvalidClient, "could not marshal client state: %v", err) + } + // construct clientState Merkle path + upgradeClientPath := constructUpgradeClientMerklePath(cs.UpgradePath, lastHeight) + if err := merkleProofClient.VerifyMembership(cs.ProofSpecs, consState.GetRoot(), upgradeClientPath, bz); err != nil { + return errorsmod.Wrapf(err, "client state proof failed. Path: %s", upgradeClientPath.GetKeyPath()) + } + + // Verify consensus state proof + bz, err = cdc.MarshalInterface(upgradedConsState) + if err != nil { + return errorsmod.Wrapf(clienttypes.ErrInvalidConsensus, "could not marshal consensus state: %v", err) + } + // construct consensus state Merkle path + upgradeConsStatePath := constructUpgradeConsStateMerklePath(cs.UpgradePath, lastHeight) + if err := merkleProofConsState.VerifyMembership(cs.ProofSpecs, consState.GetRoot(), upgradeConsStatePath, bz); err != nil { + return errorsmod.Wrapf(err, "consensus state proof failed. Path: %s", upgradeConsStatePath.GetKeyPath()) + } + + trustingPeriod := cs.TrustingPeriod + if tmUpgradeClient.UnbondingPeriod < cs.UnbondingPeriod { + trustingPeriod = calculateNewTrustingPeriod(trustingPeriod, cs.UnbondingPeriod, tmUpgradeClient.UnbondingPeriod) + } + + // Construct new client state and consensus state + // Relayer chosen client parameters are ignored. + // All chain-chosen parameters come from committed client, all client-chosen parameters + // come from current client. + newClientState := NewClientState( + tmUpgradeClient.ChainId, cs.TrustLevel, trustingPeriod, tmUpgradeClient.UnbondingPeriod, + cs.MaxClockDrift, tmUpgradeClient.LatestHeight, tmUpgradeClient.ProofSpecs, tmUpgradeClient.UpgradePath, + ) + + if err := newClientState.Validate(); err != nil { + return errorsmod.Wrap(err, "updated client state failed basic validation") + } + + // The new consensus state is merely used as a trusted kernel against which headers on the new + // chain can be verified. The root is just a stand-in sentinel value as it cannot be known in advance, thus no proof verification will pass. + // The timestamp and the NextValidatorsHash of the consensus state is the blocktime and NextValidatorsHash + // of the last block committed by the old chain. This will allow the first block of the new chain to be verified against + // the last validators of the old chain so long as it is submitted within the TrustingPeriod of this client. + // NOTE: We do not set processed time for this consensus state since this consensus state should not be used for packet verification + // as the root is empty. The next consensus state submitted using update will be usable for packet-verification. + newConsState := NewConsensusState( + tmUpgradeConsState.Timestamp, commitmenttypes.NewMerkleRoot([]byte(SentinelRoot)), tmUpgradeConsState.NextValidatorsHash, + ) + + setClientState(clientStore, cdc, newClientState) + setConsensusState(clientStore, cdc, newConsState, newClientState.LatestHeight) + setConsensusMetadata(ctx, clientStore, tmUpgradeClient.LatestHeight) + + return nil +} + +// construct MerklePath for the committed client from upgradePath +func constructUpgradeClientMerklePath(upgradePath []string, lastHeight exported.Height) commitmenttypesv2.MerklePath { + // copy all elements from upgradePath except final element + clientPath := make([]string, len(upgradePath)-1) + copy(clientPath, upgradePath) + + // append lastHeight and `upgradedClient` to last key of upgradePath and use as lastKey of clientPath + // this will create the IAVL key that is used to store client in upgrade store + lastKey := upgradePath[len(upgradePath)-1] + appendedKey := fmt.Sprintf("%s/%d/%s", lastKey, lastHeight.GetRevisionHeight(), upgradetypes.KeyUpgradedClient) + + clientPath = append(clientPath, appendedKey) + + var clientKey [][]byte + for _, part := range clientPath { + clientKey = append(clientKey, []byte(part)) + } + + return commitmenttypes.NewMerklePath(clientKey...) +} + +// construct MerklePath for the committed consensus state from upgradePath +func constructUpgradeConsStateMerklePath(upgradePath []string, lastHeight exported.Height) commitmenttypesv2.MerklePath { + // copy all elements from upgradePath except final element + consPath := make([]string, len(upgradePath)-1) + copy(consPath, upgradePath) + + // append lastHeight and `upgradedClient` to last key of upgradePath and use as lastKey of clientPath + // this will create the IAVL key that is used to store client in upgrade store + lastKey := upgradePath[len(upgradePath)-1] + appendedKey := fmt.Sprintf("%s/%d/%s", lastKey, lastHeight.GetRevisionHeight(), upgradetypes.KeyUpgradedConsState) + + consPath = append(consPath, appendedKey) + + var consStateKey [][]byte + for _, part := range consPath { + consStateKey = append(consStateKey, []byte(part)) + } + + return commitmenttypes.NewMerklePath(consStateKey...) +} + +// calculateNewTrustingPeriod converts the provided durations to decimal representation to avoid floating-point precision issues +// and calculates the new trusting period, decreasing it by the ratio between the original and new unbonding period. +func calculateNewTrustingPeriod(trustingPeriod, originalUnbonding, newUnbonding time.Duration) time.Duration { + origUnbondingDec := sdkmath.LegacyNewDec(originalUnbonding.Nanoseconds()) + newUnbondingDec := sdkmath.LegacyNewDec(newUnbonding.Nanoseconds()) + trustingPeriodDec := sdkmath.LegacyNewDec(trustingPeriod.Nanoseconds()) + + // compute new trusting period: trustingPeriod * newUnbonding / originalUnbonding + newTrustingPeriodDec := trustingPeriodDec.Mul(newUnbondingDec).Quo(origUnbondingDec) + return time.Duration(newTrustingPeriodDec.TruncateInt64()) +} diff --git a/proto/atomone/coredaos/v1/coredaos.proto b/proto/atomone/coredaos/v1/coredaos.proto index 858ebf135..3900b67f7 100644 --- a/proto/atomone/coredaos/v1/coredaos.proto +++ b/proto/atomone/coredaos/v1/coredaos.proto @@ -9,19 +9,22 @@ option go_package = "github.com/atomone-hub/atomone/x/coredaos/types"; // Params defines the parameters for the x/coredaos module. message Params { - // steering_dao_address defines the address which has authority - // to execute messages as Steering DAO. - string steering_dao_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // steering_dao_address defines the address which has authority + // to execute messages as Steering DAO. + string steering_dao_address = 1 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - // oversight_dao_address defines the address which has authority - // to execute messages as Oversight DAO. - string oversight_dao_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // oversight_dao_address defines the address which has authority + // to execute messages as Oversight DAO. + string oversight_dao_address = 2 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - // voting_period_extensions_limit defines the maximum number of times - // a proposal's voting period can be extended. - uint32 voting_period_extensions_limit = 3; + // voting_period_extensions_limit defines the maximum number of times + // a proposal's voting period can be extended. + uint32 voting_period_extensions_limit = 3; - // voting_period_extension_duration defines the duration for which - // a proposal's voting period can be extended. - google.protobuf.Duration voting_period_extension_duration = 4 [(gogoproto.stdduration) = true]; + // voting_period_extension_duration defines the duration for which + // a proposal's voting period can be extended. + google.protobuf.Duration voting_period_extension_duration = 4 + [ (gogoproto.stdduration) = true ]; } diff --git a/proto/atomone/coredaos/v1/genesis.proto b/proto/atomone/coredaos/v1/genesis.proto index c59b5c106..54f744d69 100644 --- a/proto/atomone/coredaos/v1/genesis.proto +++ b/proto/atomone/coredaos/v1/genesis.proto @@ -9,5 +9,6 @@ option go_package = "github.com/atomone-hub/atomone/x/coredaos/types"; // GenesisState defines the x/coredaos module's genesis state. message GenesisState { - Params params = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + Params params = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; } diff --git a/proto/atomone/coredaos/v1/query.proto b/proto/atomone/coredaos/v1/query.proto index fdd055395..b3ae731ba 100644 --- a/proto/atomone/coredaos/v1/query.proto +++ b/proto/atomone/coredaos/v1/query.proto @@ -13,10 +13,10 @@ option go_package = "github.com/atomone-hub/atomone/x/coredaos/types"; // Query defines the gRPC querier service. service Query { - // Parameters queries the parameters of the module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/atomone/coredaos/v1/params"; - } + // Parameters queries the parameters of the module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/atomone/coredaos/v1/params"; + } } // QueryParamsRequest is request type for the Query/Params RPC method. @@ -24,6 +24,6 @@ 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]; + // params holds all the parameters of this module. + Params params = 1 [ (gogoproto.nullable) = false ]; } diff --git a/proto/atomone/coredaos/v1/tx.proto b/proto/atomone/coredaos/v1/tx.proto index 068882ec1..92a4a0e34 100644 --- a/proto/atomone/coredaos/v1/tx.proto +++ b/proto/atomone/coredaos/v1/tx.proto @@ -11,48 +11,51 @@ option go_package = "github.com/atomone-hub/atomone/x/coredaos/types"; // Msg defines the Msg service. service Msg { - option (cosmos.msg.v1.service) = true; - - // AnnotateProposal defines a method to annotate a proposal with additional information. - // It is only available to the Steering DAO. - rpc AnnotateProposal(MsgAnnotateProposal) returns (MsgAnnotateProposalResponse); - - // EndorseProposal defines a method to endorse a proposal, and for law proposals this also - // results in the lowering of the passing threshold to the passing threshold of regular proposals. - // It is only available to the Steering DAO. - rpc EndorseProposal(MsgEndorseProposal) returns (MsgEndorseProposalResponse); - - // ExtendVotingPeriod defines a method to extend the voting period of a proposal. - // It is available to both the Steering DAO and the Oversight DAO. - rpc ExtendVotingPeriod(MsgExtendVotingPeriod) returns (MsgExtendVotingPeriodResponse); - - // VetoProposal defines a method to veto a proposal. - // It is only available to the Oversight DAO. - rpc VetoProposal(MsgVetoProposal) returns (MsgVetoProposalResponse); - - // UpdateParams defines a governance operation for updating the x/coredaos - // module parameters. The authority is defined in the keeper. - rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + option (cosmos.msg.v1.service) = true; + + // AnnotateProposal defines a method to annotate a proposal with additional + // information. It is only available to the Steering DAO. + rpc AnnotateProposal(MsgAnnotateProposal) + returns (MsgAnnotateProposalResponse); + + // EndorseProposal defines a method to endorse a proposal, and for law + // proposals this also results in the lowering of the passing threshold to the + // passing threshold of regular proposals. It is only available to the + // Steering DAO. + rpc EndorseProposal(MsgEndorseProposal) returns (MsgEndorseProposalResponse); + + // ExtendVotingPeriod defines a method to extend the voting period of a + // proposal. It is available to both the Steering DAO and the Oversight DAO. + rpc ExtendVotingPeriod(MsgExtendVotingPeriod) + returns (MsgExtendVotingPeriodResponse); + + // VetoProposal defines a method to veto a proposal. + // It is only available to the Oversight DAO. + rpc VetoProposal(MsgVetoProposal) returns (MsgVetoProposalResponse); + + // UpdateParams defines a governance operation for updating the x/coredaos + // module parameters. The authority is defined in the keeper. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgAnnotateProposal defines a message for annotating a proposal. message MsgAnnotateProposal { - option (cosmos.msg.v1.signer) = "annotator"; - option (amino.name) = "atomone/coredaos/v1/MsgAnnotateProposal"; + option (cosmos.msg.v1.signer) = "annotator"; + option (amino.name) = "atomone/coredaos/v1/MsgAnnotateProposal"; - // annotator is the address of the dao annotating the proposal. - string annotator = 1; + // annotator is the address of the dao annotating the proposal. + string annotator = 1; - // proposal_id is the ID of the proposal to annotate. - uint64 proposal_id = 2; + // proposal_id is the ID of the proposal to annotate. + uint64 proposal_id = 2; - // annotation is the annotation to add to the proposal. - string annotation = 3; + // annotation is the annotation to add to the proposal. + string annotation = 3; - // overwrite is a boolean indicating whether to overwrite the existing annotation. - // Must be set to true if the proposal already has an annotation. - // Ignored if the proposal does not have yet an annotation. - bool overwrite = 4; + // overwrite is a boolean indicating whether to overwrite the existing + // annotation. Must be set to true if the proposal already has an annotation. + // Ignored if the proposal does not have yet an annotation. + bool overwrite = 4; } // MsgAnnotateProposalResponse defines the response for MsgAnnotateProposal. @@ -60,29 +63,30 @@ message MsgAnnotateProposalResponse {} // MsgEndorseProposal defines a message for endorsing a proposal. message MsgEndorseProposal { - option (cosmos.msg.v1.signer) = "endorser"; - option (amino.name) = "atomone/coredaos/v1/MsgEndorseProposal"; + option (cosmos.msg.v1.signer) = "endorser"; + option (amino.name) = "atomone/coredaos/v1/MsgEndorseProposal"; - // endorser is the address of the dao endorsing the proposal. - string endorser = 1; + // endorser is the address of the dao endorsing the proposal. + string endorser = 1; - // proposal_id is the ID of the proposal to endorse. - uint64 proposal_id = 2; + // proposal_id is the ID of the proposal to endorse. + uint64 proposal_id = 2; } // MsgEndorseProposalResponse defines the response for MsgEndorseProposal. message MsgEndorseProposalResponse {} -// MsgExtendVotingPeriod defines a message for extending the voting period of a proposal. +// MsgExtendVotingPeriod defines a message for extending the voting period of a +// proposal. message MsgExtendVotingPeriod { - option (cosmos.msg.v1.signer) = "extender"; - option (amino.name) = "atomone/coredaos/v1/MsgExtendVotingPeriod"; + option (cosmos.msg.v1.signer) = "extender"; + option (amino.name) = "atomone/coredaos/v1/MsgExtendVotingPeriod"; - // extender is the address of the dao extending the voting period. - string extender = 1; + // extender is the address of the dao extending the voting period. + string extender = 1; - // proposal_id is the ID of the proposal to extend. - uint64 proposal_id = 2; + // proposal_id is the ID of the proposal to extend. + uint64 proposal_id = 2; } // MsgExtendVotingPeriodResponse defines the response for MsgExtendVotingPeriod. @@ -90,18 +94,18 @@ message MsgExtendVotingPeriodResponse {} // MsgVetoProposal defines a message for vetoing a proposal. message MsgVetoProposal { - option (cosmos.msg.v1.signer) = "vetoer"; - option (amino.name) = "atomone/coredaos/v1/MsgVetoProposal"; + option (cosmos.msg.v1.signer) = "vetoer"; + option (amino.name) = "atomone/coredaos/v1/MsgVetoProposal"; - // vetoer is the address of the dao vetoing the proposal. - string vetoer = 1; + // vetoer is the address of the dao vetoing the proposal. + string vetoer = 1; - // proposal_id is the ID of the proposal to veto. - uint64 proposal_id = 2; + // proposal_id is the ID of the proposal to veto. + uint64 proposal_id = 2; - // burn_deposit is a boolean indicating whether to burn the deposit of the proposal. - // If true, the deposit is burned and not refunded. - bool burn_deposit = 3; + // burn_deposit is a boolean indicating whether to burn the deposit of the + // proposal. If true, the deposit is burned and not refunded. + bool burn_deposit = 3; } // MsgVetoProposalResponse defines the response for MsgVetoProposal. @@ -109,15 +113,16 @@ message MsgVetoProposalResponse {} // MsgUpdateParams is the Msg/UpdateParams request type. message MsgUpdateParams { - option (cosmos.msg.v1.signer) = "authority"; - // authority is the address that controls the module (defaults to x/gov unless - // overwritten). - string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // params defines the x/coredaos parameters to update. - // - // NOTE: All parameters must be supplied. - Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + option (cosmos.msg.v1.signer) = "authority"; + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // params defines the x/coredaos parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; } // MsgUpdateParamsResponse defines the response structure for executing a diff --git a/proto/atomone/dynamicfee/v1/params.proto b/proto/atomone/dynamicfee/v1/params.proto index e1f1b58d0..830621dfb 100644 --- a/proto/atomone/dynamicfee/v1/params.proto +++ b/proto/atomone/dynamicfee/v1/params.proto @@ -58,7 +58,7 @@ message Params { (gogoproto.nullable) = false ]; - // DefaultMaxBlockGas is the default max block gas. + // DefaultMaxBlockGas is the default max block gas. // This parameter is used by the dynamicfee module // in the case consensus_params.block.max_gas returns 0 or -1. uint64 default_max_block_gas = 7; diff --git a/proto/atomone/dynamicfee/v1/tx.proto b/proto/atomone/dynamicfee/v1/tx.proto index cb34402f8..39b24a51e 100644 --- a/proto/atomone/dynamicfee/v1/tx.proto +++ b/proto/atomone/dynamicfee/v1/tx.proto @@ -14,7 +14,8 @@ option go_package = "github.com/atomone-hub/atomone/x/dynamicfee/types"; service Msg { option (cosmos.msg.v1.service) = true; - // UpdateParams defines a method for updating the dynamicfee module parameters. + // UpdateParams defines a method for updating the dynamicfee module + // parameters. rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } diff --git a/proto/atomone/gov/v1/genesis.proto b/proto/atomone/gov/v1/genesis.proto index 20860a74f..2942a2329 100644 --- a/proto/atomone/gov/v1/genesis.proto +++ b/proto/atomone/gov/v1/genesis.proto @@ -41,19 +41,20 @@ message GenesisState { // last updated value for the dynamic min initial deposit LastMinDeposit last_min_initial_deposit = 11; - + // governance participation EMA // If unset or set to 0, the quorum for the next proposal will be set to the // params.MinQuorum value. - string participation_ema = 12 [(cosmos_proto.scalar) = "cosmos.Dec"]; - + string participation_ema = 12 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; + // governance participation EMA for constitution amendment proposals. // If unset or set to 0, the quorum for the next constitution amendment // proposal will be set to the params.MinConstitutionAmendmentQuorum value. - string constitution_amendment_participation_ema = 13 [(cosmos_proto.scalar) = "cosmos.Dec"]; + string constitution_amendment_participation_ema = 13 + [ (cosmos_proto.scalar) = "cosmos.Dec" ]; // governance participation EMA for law proposals. // If unset or set to 0, the quorum for the next law proposal will be set to // the params.LawMinQuorum value. - string law_participation_ema = 14 [(cosmos_proto.scalar) = "cosmos.Dec"]; + string law_participation_ema = 14 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; } diff --git a/proto/atomone/gov/v1/gov.proto b/proto/atomone/gov/v1/gov.proto index b5b5889c5..0b5527afb 100644 --- a/proto/atomone/gov/v1/gov.proto +++ b/proto/atomone/gov/v1/gov.proto @@ -154,7 +154,7 @@ message TallyResult { // abstain_count is the number of abstain votes on a proposal. string abstain_count = 2 [ (cosmos_proto.scalar) = "cosmos.Int" ]; // no_count is the number of no votes on a proposal. - string no_count = 3 [(cosmos_proto.scalar) = "cosmos.Int"]; + string no_count = 3 [ (cosmos_proto.scalar) = "cosmos.Int" ]; } // Vote defines a vote on a governance proposal. @@ -179,7 +179,8 @@ message Vote { message QuorumCheckQueueEntry { // quorum_timeout_time is the time after which quorum checks start happening // and voting period is extended if proposal reaches quorum. - google.protobuf.Timestamp quorum_timeout_time = 1 [(gogoproto.stdtime) = true]; + google.protobuf.Timestamp quorum_timeout_time = 1 + [ (gogoproto.stdtime) = true ]; // quorum_check_count is the number of times quorum will be checked. // This is a snapshot of the parameter value with the same name when the @@ -216,75 +217,83 @@ message VotingParams { message TallyParams { // Minimum percentage of total stake needed to vote for a result to be // considered valid. - string quorum = 1 [ (cosmos_proto.scalar) = "cosmos.Dec", deprecated = true]; + string quorum = 1 [ (cosmos_proto.scalar) = "cosmos.Dec", deprecated = true ]; // Minimum proportion of Yes votes for proposal to pass. Default value: 2/3. - string threshold = 2 [(cosmos_proto.scalar) = "cosmos.Dec"]; + string threshold = 2 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; // quorum for constitution amendment proposals - string constitution_amendment_quorum = 3 [(cosmos_proto.scalar) = "cosmos.Dec", deprecated = true]; + string constitution_amendment_quorum = 3 + [ (cosmos_proto.scalar) = "cosmos.Dec", deprecated = true ]; - // Minimum proportion of Yes votes for a Constitution Amendment proposal to pass. Default value: 0.9. - string constitution_amendment_threshold = 4 [(cosmos_proto.scalar) = "cosmos.Dec"]; + // Minimum proportion of Yes votes for a Constitution Amendment proposal to + // pass. Default value: 0.9. + string constitution_amendment_threshold = 4 + [ (cosmos_proto.scalar) = "cosmos.Dec" ]; // quorum for law proposals - string law_quorum = 5 [(cosmos_proto.scalar) = "cosmos.Dec", deprecated = true]; + string law_quorum = 5 + [ (cosmos_proto.scalar) = "cosmos.Dec", deprecated = true ]; - // Minimum proportion of Yes votes for a Law proposal to pass. Default value: 0.9. - string law_threshold = 6 [(cosmos_proto.scalar) = "cosmos.Dec"]; + // Minimum proportion of Yes votes for a Law proposal to pass. Default value: + // 0.9. + string law_threshold = 6 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; } message MinDepositThrottler { - // Floor value for the minimum deposit required for a proposal to enter the voting period. + // Floor value for the minimum deposit required for a proposal to enter the + // voting period. repeated cosmos.base.v1beta1.Coin floor_value = 1 - [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; - // Duration that dictates after how long the dynamic minimum deposit should be recalculated - // for time-based decreases. - google.protobuf.Duration update_period = 2 [(gogoproto.stdduration) = true]; + // Duration that dictates after how long the dynamic minimum deposit should be + // recalculated for time-based decreases. + google.protobuf.Duration update_period = 2 [ (gogoproto.stdduration) = true ]; // The number of active proposals the dynamic minimum deposit should target. uint64 target_active_proposals = 3; - // The ratio of increase for the minimum deposit when the number of active proposals - // is at or above the target. - string increase_ratio = 4 [(cosmos_proto.scalar) = "cosmos.Dec"]; + // The ratio of increase for the minimum deposit when the number of active + // proposals is at or above the target. + string increase_ratio = 4 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; - // The ratio of decrease for the minimum deposit when the number of active proposals - // is 1 less than the target. - string decrease_ratio = 5 [(cosmos_proto.scalar) = "cosmos.Dec"]; + // The ratio of decrease for the minimum deposit when the number of active + // proposals is 1 less than the target. + string decrease_ratio = 5 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; - // A positive integer representing the sensitivity of dynamic minimum deposit + // A positive integer representing the sensitivity of dynamic minimum deposit // decreases to the distance from the target number of active proposals. - // The higher the number, the lower the sensitivity. A value of 1 represents the - // highest sensitivity. + // The higher the number, the lower the sensitivity. A value of 1 represents + // the highest sensitivity. uint64 decrease_sensitivity_target_distance = 6; } message MinInitialDepositThrottler { - // Floor value for the minimum initial deposit required for a proposal to enter the deposit period. + // Floor value for the minimum initial deposit required for a proposal to + // enter the deposit period. repeated cosmos.base.v1beta1.Coin floor_value = 1 - [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; - // Duration that dictates after how long the dynamic minimum deposit should be recalculated - // for time-based decreases. - google.protobuf.Duration update_period = 2 [(gogoproto.stdduration) = true]; + // Duration that dictates after how long the dynamic minimum deposit should be + // recalculated for time-based decreases. + google.protobuf.Duration update_period = 2 [ (gogoproto.stdduration) = true ]; - // The number of proposals in deposit period the dynamic minimum initial deposit should target. + // The number of proposals in deposit period the dynamic minimum initial + // deposit should target. uint64 target_proposals = 3; - // The ratio of increase for the minimum initial deposit when the number of proposals - // in deposit period is at or above the target. - string increase_ratio = 4 [(cosmos_proto.scalar) = "cosmos.Dec"]; + // The ratio of increase for the minimum initial deposit when the number of + // proposals in deposit period is at or above the target. + string increase_ratio = 4 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; - // The ratio of decrease for the minimum initial deposit when the number of proposals - // in deposit period is 1 less than the target. - string decrease_ratio = 5 [(cosmos_proto.scalar) = "cosmos.Dec"]; + // The ratio of decrease for the minimum initial deposit when the number of + // proposals in deposit period is 1 less than the target. + string decrease_ratio = 5 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; - // A positive integer representing the sensitivity of dynamic minimum initial + // A positive integer representing the sensitivity of dynamic minimum initial // deposit decreases to the distance from the target number of proposals - // in deposit period. The higher the number, the lower the sensitivity. A value - // of 1 represents the highest sensitivity. + // in deposit period. The higher the number, the lower the sensitivity. A + // value of 1 represents the highest sensitivity. uint64 decrease_sensitivity_target_distance = 6; } @@ -298,8 +307,11 @@ message Params { // While setting this value returns an error, when queried it is set to the // value of the current minimum deposit value as determined by the dynamic // system for backward compatibility. - repeated cosmos.base.v1beta1.Coin min_deposit = 1 - [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, deprecated = true ]; + repeated cosmos.base.v1beta1.Coin min_deposit = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + deprecated = true + ]; // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 // months. @@ -311,13 +323,15 @@ message Params { // Minimum percentage of total stake needed to vote for a result to be // considered valid. Default value: 0.25. - string quorum = 4 [(cosmos_proto.scalar) = "cosmos.Dec", deprecated = true]; + string quorum = 4 [ (cosmos_proto.scalar) = "cosmos.Dec", deprecated = true ]; // Minimum proportion of Yes votes for proposal to pass. Default value: 2/3. - string threshold = 5 [(cosmos_proto.scalar) = "cosmos.Dec"]; + string threshold = 5 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; - // The ratio representing the proportion of the deposit value that must be paid at proposal submission. - string min_initial_deposit_ratio = 7 [(cosmos_proto.scalar) = "cosmos.Dec", deprecated = true ]; + // The ratio representing the proportion of the deposit value that must be + // paid at proposal submission. + string min_initial_deposit_ratio = 7 + [ (cosmos_proto.scalar) = "cosmos.Dec", deprecated = true ]; // burn deposits if a proposal does not meet quorum bool burn_vote_quorum = 13; @@ -335,27 +349,35 @@ message Params { string min_deposit_ratio = 15 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; // quorum for constitution amendment proposals - string constitution_amendment_quorum = 16 [(cosmos_proto.scalar) = "cosmos.Dec", deprecated = true]; + string constitution_amendment_quorum = 16 + [ (cosmos_proto.scalar) = "cosmos.Dec", deprecated = true ]; - // Minimum proportion of Yes votes for a Constitution Amendment proposal to pass. Default value: 0.9. - string constitution_amendment_threshold = 17 [(cosmos_proto.scalar) = "cosmos.Dec"]; + // Minimum proportion of Yes votes for a Constitution Amendment proposal to + // pass. Default value: 0.9. + string constitution_amendment_threshold = 17 + [ (cosmos_proto.scalar) = "cosmos.Dec" ]; // quorum for law proposals - string law_quorum = 18 [(cosmos_proto.scalar) = "cosmos.Dec", deprecated = true]; + string law_quorum = 18 + [ (cosmos_proto.scalar) = "cosmos.Dec", deprecated = true ]; - // Minimum proportion of Yes votes for a Law proposal to pass. Default value: 0.9. - string law_threshold = 19 [(cosmos_proto.scalar) = "cosmos.Dec"]; + // Minimum proportion of Yes votes for a Law proposal to pass. Default value: + // 0.9. + string law_threshold = 19 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; - // Duration of time after a proposal enters the voting period, during which quorum - // must be achieved to not incur in a voting period extension. - google.protobuf.Duration quorum_timeout = 20 [(gogoproto.stdduration) = true]; + // Duration of time after a proposal enters the voting period, during which + // quorum must be achieved to not incur in a voting period extension. + google.protobuf.Duration quorum_timeout = 20 + [ (gogoproto.stdduration) = true ]; - // Duration that expresses the maximum amount of time by which a proposal voting period - // can be extended. - google.protobuf.Duration max_voting_period_extension = 21 [(gogoproto.stdduration) = true]; + // Duration that expresses the maximum amount of time by which a proposal + // voting period can be extended. + google.protobuf.Duration max_voting_period_extension = 21 + [ (gogoproto.stdduration) = true ]; - // Number of times a proposal should be checked for quorum after the quorum timeout - // has elapsed. Used to compute the amount of time in between quorum checks. + // Number of times a proposal should be checked for quorum after the quorum + // timeout has elapsed. Used to compute the amount of time in between quorum + // checks. uint64 quorum_check_count = 22; MinDepositThrottler min_deposit_throttler = 23; @@ -363,22 +385,24 @@ message Params { MinInitialDepositThrottler min_initial_deposit_throttler = 24; // Minimum proportion of No Votes for a proposal deposit to be burnt. - string burn_deposit_no_threshold = 25 [(cosmos_proto.scalar) = "cosmos.Dec"]; + string burn_deposit_no_threshold = 25 + [ (cosmos_proto.scalar) = "cosmos.Dec" ]; // Achievable quorum - QuorumRange quorum_range = 26 [(cosmos_proto.scalar) = "cosmos.Dec"]; + QuorumRange quorum_range = 26 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; // Achievable quorum for constitution amendment proposals - QuorumRange constitution_amendment_quorum_range = 27 [(cosmos_proto.scalar) = "cosmos.Dec"]; + QuorumRange constitution_amendment_quorum_range = 27 + [ (cosmos_proto.scalar) = "cosmos.Dec" ]; // Achievable quorum for law proposals - QuorumRange law_quorum_range = 28 [(cosmos_proto.scalar) = "cosmos.Dec"]; + QuorumRange law_quorum_range = 28 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; } message QuorumRange { // Maximum achievable quorum - string max = 1 [(cosmos_proto.scalar) = "cosmos.Dec"]; + string max = 1 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; // Minimum achievable quorum - string min = 2 [(cosmos_proto.scalar) = "cosmos.Dec"]; + string min = 2 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; } diff --git a/proto/atomone/gov/v1/query.proto b/proto/atomone/gov/v1/query.proto index 48efe8526..a61ab4390 100644 --- a/proto/atomone/gov/v1/query.proto +++ b/proto/atomone/gov/v1/query.proto @@ -15,7 +15,8 @@ option go_package = "github.com/atomone-hub/atomone/x/gov/types/v1"; // Query defines the gRPC querier service for gov module service Query { // Constitution queries the chain's constitution. - rpc Constitution(QueryConstitutionRequest) returns (QueryConstitutionResponse) { + rpc Constitution(QueryConstitutionRequest) + returns (QueryConstitutionResponse) { option (google.api.http).get = "/atomone/gov/v1/constitution"; } @@ -72,7 +73,8 @@ service Query { // MinInitialDeposit queries the minimum initial deposit // currently required for a proposal to be submitted. - rpc MinInitialDeposit(QueryMinInitialDepositRequest) returns (QueryMinInitialDepositResponse) { + rpc MinInitialDeposit(QueryMinInitialDepositRequest) + returns (QueryMinInitialDepositResponse) { option (google.api.http).get = "/atomone/gov/v1/mininitialdeposit"; } @@ -81,19 +83,21 @@ service Query { option (google.api.http).get = "/atomone/gov/v1/quorums"; } - // ParticipationEMAs queries the state of the proposal participation exponential moving averages. - rpc ParticipationEMAs(QueryParticipationEMAsRequest) returns (QueryParticipationEMAsResponse) { + // ParticipationEMAs queries the state of the proposal participation + // exponential moving averages. + rpc ParticipationEMAs(QueryParticipationEMAsRequest) + returns (QueryParticipationEMAsResponse) { option (google.api.http).get = "/atomone/gov/v1/participationemas"; } } -// QueryConstitutionRequest is the request type for the Query/Constitution RPC method +// QueryConstitutionRequest is the request type for the Query/Constitution RPC +// method message QueryConstitutionRequest {} -// QueryConstitutionResponse is the response type for the Query/Constitution RPC method -message QueryConstitutionResponse { - string constitution = 1; -} +// QueryConstitutionResponse is the response type for the Query/Constitution RPC +// method +message QueryConstitutionResponse { string constitution = 1; } // QueryProposalRequest is the request type for the Query/Proposal RPC method. message QueryProposalRequest { @@ -234,22 +238,30 @@ message QueryTallyResultResponse { TallyResult tally = 1; } -// QueryMinDepositRequest is the request type for the Query/MinDeposit RPC method. +// QueryMinDepositRequest is the request type for the Query/MinDeposit RPC +// method. message QueryMinDepositRequest {} -// QueryMinDepositResponse is the response type for the Query/MinDeposit RPC method. +// QueryMinDepositResponse is the response type for the Query/MinDeposit RPC +// method. message QueryMinDepositResponse { - // min_deposit defines the minimum deposit required for a proposal to enter voting period. - repeated cosmos.base.v1beta1.Coin min_deposit = 1 [ (gogoproto.nullable) = false]; + // min_deposit defines the minimum deposit required for a proposal to enter + // voting period. + repeated cosmos.base.v1beta1.Coin min_deposit = 1 + [ (gogoproto.nullable) = false ]; } -// QueryMinInitialDepositRequest is the request type for the Query/MinInitialDeposit RPC method. +// QueryMinInitialDepositRequest is the request type for the +// Query/MinInitialDeposit RPC method. message QueryMinInitialDepositRequest {} -// QueryMinInitialDepositResponse is the response type for the Query/MinInitialDeposit RPC method. +// QueryMinInitialDepositResponse is the response type for the +// Query/MinInitialDeposit RPC method. message QueryMinInitialDepositResponse { - // min_initial_deposit defines the minimum initial deposit required for a proposal to be submitted. - repeated cosmos.base.v1beta1.Coin min_initial_deposit = 1 [ (gogoproto.nullable) = false]; + // min_initial_deposit defines the minimum initial deposit required for a + // proposal to be submitted. + repeated cosmos.base.v1beta1.Coin min_initial_deposit = 1 + [ (gogoproto.nullable) = false ]; } // QueryQuorumsRequest is the request type for the Query/Quorums RPC method. @@ -262,24 +274,29 @@ message QueryQuorumsResponse { // constitution_amendment_quorum defines the requested quorum for // constitution amendment proposals. - string constitution_amendment_quorum = 2 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; + string constitution_amendment_quorum = 2 + [ (cosmos_proto.scalar) = "cosmos.Dec" ]; // law_quorum defines the requested quorum for law proposals. string law_quorum = 3 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; } -// QueryParticipationEMAsRequest is the request type for the Query/ParticipationEMAs RPC method. +// QueryParticipationEMAsRequest is the request type for the +// Query/ParticipationEMAs RPC method. message QueryParticipationEMAsRequest {} -// QueryParticipationEMAsResponse is the response type for the Query/ParticipationEMAs RPC method. +// QueryParticipationEMAsResponse is the response type for the +// Query/ParticipationEMAs RPC method. message QueryParticipationEMAsResponse { // participation_ema defines the requested participation EMA for proposals. string participation_ema = 1 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; - // constitution_amendment_participation_ema defines the requested participation EMA for - // constitution amendment proposals. - string constitution_amendment_participation_ema = 2 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; + // constitution_amendment_participation_ema defines the requested + // participation EMA for constitution amendment proposals. + string constitution_amendment_participation_ema = 2 + [ (cosmos_proto.scalar) = "cosmos.Dec" ]; - // law_participation_ema defines the requestedparticipation EMA for law proposals. + // law_participation_ema defines the requestedparticipation EMA for law + // proposals. string law_participation_ema = 3 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; } diff --git a/proto/atomone/gov/v1/tx.proto b/proto/atomone/gov/v1/tx.proto index f05db7f93..d1c22c8b3 100644 --- a/proto/atomone/gov/v1/tx.proto +++ b/proto/atomone/gov/v1/tx.proto @@ -205,7 +205,8 @@ message MsgProposeLaw { // MsgProposeLaw message. message MsgProposeLawResponse {} -// MsgConstitutionAmendment is the Msg/ProposeConstitutionAmendment request type. +// MsgConstitutionAmendment is the Msg/ProposeConstitutionAmendment request +// type. message MsgProposeConstitutionAmendment { option (cosmos.msg.v1.signer) = "authority"; option (amino.name) = "atomone/x/gov/v1/MsgProposeAmendment"; @@ -214,10 +215,11 @@ message MsgProposeConstitutionAmendment { // overwritten). string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - // amendment is the amendment to the constitution. It must be in valid GNU patch format. + // amendment is the amendment to the constitution. It must be in valid GNU + // patch format. string amendment = 2; } -// MsgProposeConstitutionAmendmentResponse defines the response structure for executing a -// MsgProposeConstitutionAmendment message. +// MsgProposeConstitutionAmendmentResponse defines the response structure for +// executing a MsgProposeConstitutionAmendment message. message MsgProposeConstitutionAmendmentResponse {} \ No newline at end of file diff --git a/proto/atomone/photon/v1/genesis.proto b/proto/atomone/photon/v1/genesis.proto index 8c06bb80a..7a3fd78b6 100644 --- a/proto/atomone/photon/v1/genesis.proto +++ b/proto/atomone/photon/v1/genesis.proto @@ -9,5 +9,6 @@ option go_package = "github.com/atomone-hub/atomone/x/photon/types"; // GenesisState defines the x/photon module's genesis state. message GenesisState { - Params params = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + Params params = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; } diff --git a/proto/atomone/photon/v1/query.proto b/proto/atomone/photon/v1/query.proto index ef9d5e5dc..2ef80ca02 100644 --- a/proto/atomone/photon/v1/query.proto +++ b/proto/atomone/photon/v1/query.proto @@ -15,7 +15,8 @@ service Query { option (google.api.http).get = "/atomone/photon/v1/params"; } // ConversionRate queries the photon's conversion rate - rpc ConversionRate(QueryConversionRateRequest) returns (QueryConversionRateResponse) { + rpc ConversionRate(QueryConversionRateRequest) + returns (QueryConversionRateResponse) { option (google.api.http).get = "/atomone/photon/v1/conversion_rate"; } } @@ -29,11 +30,13 @@ message QueryParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; } -// QueryConversionRateRequest is request type for the Query/ConversionRate RPC method. +// QueryConversionRateRequest is request type for the Query/ConversionRate RPC +// method. message QueryConversionRateRequest {} -// QueryConversionRateResponse is response type for the Query/ConversionRate RPC method. +// QueryConversionRateResponse is response type for the Query/ConversionRate RPC +// method. message QueryConversionRateResponse { - // conversion_rate represents the factor used to convert atone to photon. + // conversion_rate represents the factor used to convert atone to photon. string conversion_rate = 1 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; } diff --git a/proto/atomone/photon/v1/tx.proto b/proto/atomone/photon/v1/tx.proto index 9b8dc3019..6aaf9f356 100644 --- a/proto/atomone/photon/v1/tx.proto +++ b/proto/atomone/photon/v1/tx.proto @@ -38,11 +38,9 @@ message MsgMintPhoton { // MsgMintPhotonResponse defines the response structure for executing a // MsgMintPhoton message. message MsgMintPhotonResponse { - cosmos.base.v1beta1.Coin minted = 1 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - // conversion_rate represents the factor used to convert atone to photon. + cosmos.base.v1beta1.Coin minted = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + // conversion_rate represents the factor used to convert atone to photon. string conversion_rate = 2 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; } diff --git a/proto/buf.lock b/proto/buf.lock index 92f38120d..47bb44305 100644 --- a/proto/buf.lock +++ b/proto/buf.lock @@ -16,13 +16,23 @@ deps: repository: gogo-proto commit: 88ef6483f90f478fb938c37dde52ece3 digest: shake256:89c45df2aa11e0cff97b0d695436713db3d993d76792e9f8dc1ae90e6ab9a9bec55503d48ceedd6b86069ab07d3041b32001b2bfe0227fa725dd515ff381e5ba + - remote: buf.build + owner: cosmos + repository: ibc + commit: 857539074f9c4dda961f9db5dcf8e462 + digest: shake256:e8892cbffb31dd4daedda8dd293f224bc4b718b9854128a0dd35fdf984c8d4c31a006c49cc4bcdfb5d20782a6755f25eea8264f3674c83fcefd809d904102015 + - remote: buf.build + owner: cosmos + repository: ics23 + commit: dc427cb4519143d8996361c045a29ad7 + digest: shake256:f6611c56170e2cb6354fa6e367a225fed7b8b0defca3252f05e842fe311be46997680ebf57d8644b52c1f2cca49b366ffe89ce5e8db5fd055a15259c88e4e41e - remote: buf.build owner: googleapis repository: googleapis - commit: 61b203b9a9164be9a834f58c37be6f62 - digest: shake256:e619113001d6e284ee8a92b1561e5d4ea89a47b28bf0410815cb2fa23914df8be9f1a6a98dcf069f5bc2d829a2cfb1ac614863be45cd4f8a5ad8606c5f200224 + commit: 72c8614f3bd0466ea67931ef2c43d608 + digest: shake256:b3ac4d383db09f92ab0ca85d12bff8c49eddf7031bd3a854c260b6ac4ed6a2bb85b52b3393c316d28f8038bf3b8e70cb3d16470e8cc4423007678fb6d89d36d4 - remote: buf.build owner: protocolbuffers repository: wellknowntypes - commit: 3ddd61d1f53d485abd3d3a2b47a62b8e - digest: shake256:9e6799d56700d0470c3723a2fd027e8b4a41a07085a0c90c58e05f6c0038fac9b7a0170acd7692707a849983b1b8189aa33e7b73f91d68157f7136823115546b + commit: a4aee59cf3714106961b09d99b349cd1 + digest: shake256:7e2aa4fb37e2be8dc8a4bcbebaec00635abbcc7333df40ba6412a666335f66c5c0705ce4cc5c207e728412ac3d81850545f90e8535da66712a17ab42923be6bd diff --git a/proto/buf.yaml b/proto/buf.yaml index 3dcc274ec..c9c4c2117 100644 --- a/proto/buf.yaml +++ b/proto/buf.yaml @@ -11,7 +11,8 @@ deps: - buf.build/cosmos/gogo-proto - buf.build/googleapis/googleapis - buf.build/protocolbuffers/wellknowntypes - + - buf.build/cosmos/ics23 + - buf.build/cosmos/ibc breaking: use: - FILE diff --git a/proto/ibc/lightclients/gno/v1/gno.proto b/proto/ibc/lightclients/gno/v1/gno.proto new file mode 100644 index 000000000..9f08726c5 --- /dev/null +++ b/proto/ibc/lightclients/gno/v1/gno.proto @@ -0,0 +1,193 @@ +syntax = "proto3"; + +package ibc.lightclients.gno.v1; + +import "cosmos/ics23/v1/proofs.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/duration.proto"; + +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; +import "ibc/core/client/v1/client.proto"; +import "ibc/core/commitment/v1/commitment.proto"; +import "tendermint/types/validator.proto"; + +option go_package = "github.com/atomone-hub/atomone/modules/10-gno;gno"; + +// ClientState from Gno tracks the current validator set, latest height, +// and a possible frozen height. +message ClientState { + option (gogoproto.goproto_getters) = false; + + string chain_id = 1; + Fraction trust_level = 2 [ (gogoproto.nullable) = false ]; + // duration of the period since the LatestTimestamp during which the + // submitted headers are valid for upgrade + google.protobuf.Duration trusting_period = 3 + [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ]; + // duration of the staking unbonding period + google.protobuf.Duration unbonding_period = 4 + [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ]; + // defines how much new (untrusted) header's Time can drift into the future. + google.protobuf.Duration max_clock_drift = 5 + [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ]; + // Block height when the client was frozen due to a misbehaviour + ibc.core.client.v1.Height frozen_height = 6 [ (gogoproto.nullable) = false ]; + // Latest height the client was updated to + ibc.core.client.v1.Height latest_height = 7 [ (gogoproto.nullable) = false ]; + + // Proof specifications used in verifying counterparty state + repeated cosmos.ics23.v1.ProofSpec proof_specs = 8; + + // Path at which next upgraded client will be committed. + // Each element corresponds to the key for a single CommitmentProof in the + // chained proof. NOTE: ClientState must stored under + // `{upgradePath}/{upgradeHeight}/clientState` ConsensusState must be stored + // under `{upgradepath}/{upgradeHeight}/consensusState` For SDK chains using + // the default upgrade module, upgrade_path should be []string{"upgrade", + // "upgradedIBCState"}` + repeated string upgrade_path = 9; + + // allow_update_after_expiry is deprecated + bool allow_update_after_expiry = 10 [ deprecated = true ]; + // allow_update_after_misbehaviour is deprecated + bool allow_update_after_misbehaviour = 11 [ deprecated = true ]; +} + +// ConsensusState defines the consensus state from Tendermint. +message ConsensusState { + option (gogoproto.goproto_getters) = false; + + // timestamp that corresponds to the block height in which the ConsensusState + // was stored. + google.protobuf.Timestamp timestamp = 1 + [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; + // commitment root (i.e app hash) + ibc.core.commitment.v1.MerkleRoot root = 2 [ (gogoproto.nullable) = false ]; + bytes next_validators_hash = 3; +} + +// Misbehaviour is a wrapper over two conflicting Headers +// that implements Misbehaviour interface expected by ICS-02 +message Misbehaviour { + option (gogoproto.goproto_getters) = false; + + // ClientID is deprecated + string client_id = 1 [ deprecated = true ]; + Header header_1 = 2 [ (gogoproto.customname) = "Header1" ]; + Header header_2 = 3 [ (gogoproto.customname) = "Header2" ]; +} + +// Header defines the Tendermint client consensus Header. +// It encapsulates all the information necessary to update from a trusted +// Tendermint ConsensusState. The inclusion of TrustedHeight and +// TrustedValidators allows this update to process correctly, so long as the +// ConsensusState for the TrustedHeight exists, this removes race conditions +// among relayers The SignedHeader and ValidatorSet are the new untrusted update +// fields for the client. The TrustedHeight is the height of a stored +// ConsensusState on the client that will be used to verify the new untrusted +// header. The Trusted ConsensusState must be within the unbonding period of +// current time in order to correctly verify, and the TrustedValidators must +// hash to TrustedConsensusState.NextValidatorsHash since that is the last +// trusted validator set at the TrustedHeight. +message Header { + SignedHeader signed_header = 1; + + ValidatorSet validator_set = 2; + ibc.core.client.v1.Height trusted_height = 3 [ (gogoproto.nullable) = false ]; + ValidatorSet trusted_validators = 4; +} + +message Block { + GnoHeader header = 1; + Data data = 2; + Commit last_commit = 3; +} + +message GnoHeader { + string version = 1; + string chain_id = 2; + sint64 height = 3; + google.protobuf.Timestamp time = 4 [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; + sint64 num_txs = 5; + sint64 total_txs = 6; + string app_version = 7; + BlockID last_block_id = 8; + bytes last_commit_hash = 9; + bytes data_hash = 10; + bytes validators_hash = 11; + bytes next_validators_hash = 12; + bytes consensus_hash = 13; + bytes app_hash = 14; + bytes last_results_hash = 15; + string proposer_address = 16; +} + +message Data { repeated bytes txs = 1; } + +message Commit { + BlockID block_id = 1; + repeated CommitSig precommits = 2; +} + +message BlockID { + bytes hash = 1; + PartSetHeader parts_header = 2 [ json_name = "parts" ]; +} + +message SignedHeader { + GnoHeader header = 1; + Commit commit = 2; +} + +message LightBlock { + SignedHeader signed_header = 1; + ValidatorSet validator_set = 2; +} +message CommitSig { + uint32 type = 1; + sint64 height = 2; + sint64 round = 3; + BlockID block_id = 4; + google.protobuf.Timestamp timestamp = 5 [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; + string validator_address = 6; + sint64 validator_index = 7; + bytes signature = 8; +} + +message Vote { + uint32 type = 1; + sint64 height = 2; + sint64 round = 3; + BlockID block_id = 4; + google.protobuf.Timestamp timestamp = 5 [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; + string validator_address = 6; + sint64 validator_index = 7; + bytes signature = 8; +} + +message PartSet {} + +message PartSetHeader { + sint64 total = 1; + bytes hash = 2; +} + +message Validator { + string address = 1; + google.protobuf.Any pub_key = 2; + sint64 voting_power = 3; + sint64 proposer_priority = 4; +} + +message ValidatorSet { + repeated Validator validators = 1; + Validator proposer = 2; +} + +// Fraction defines the protobuf message type for tmmath.Fraction that only +// supports positive values. +message Fraction { + uint64 numerator = 1; + uint64 denominator = 2; +} diff --git a/proto/tm2/bft/abci/abci.proto b/proto/tm2/bft/abci/abci.proto new file mode 100644 index 000000000..75482bfcb --- /dev/null +++ b/proto/tm2/bft/abci/abci.proto @@ -0,0 +1,199 @@ +syntax = "proto3"; + +package tm2.bft.abci; + +// imports +import "tm2/crypto/merkle.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/gnolang/gno/tm2/pkg/bft/abci/types"; + +// messages +message RequestBase {} + +message RequestEcho { + RequestBase request_base = 1 [ json_name = "RequestBase" ]; + string message = 2 [ json_name = "Message" ]; +} + +message RequestFlush { + RequestBase request_base = 1 [ json_name = "RequestBase" ]; +} + +message RequestInfo { + RequestBase request_base = 1 [ json_name = "RequestBase" ]; +} + +message RequestSetOption { + RequestBase request_base = 1 [ json_name = "RequestBase" ]; + string key = 2 [ json_name = "Key" ]; + string value = 3 [ json_name = "Value" ]; +} + +message RequestInitChain { + RequestBase request_base = 1 [ json_name = "RequestBase" ]; + google.protobuf.Timestamp time = 2 [ json_name = "Time" ]; + string chain_id = 3 [ json_name = "ChainID" ]; + ConsensusParams consensus_params = 4 [ json_name = "ConsensusParams" ]; + repeated ValidatorUpdate validators = 5 [ json_name = "Validators" ]; + google.protobuf.Any app_state = 6 [ json_name = "AppState" ]; +} + +message RequestQuery { + RequestBase request_base = 1 [ json_name = "RequestBase" ]; + bytes data = 2 [ json_name = "Data" ]; + string path = 3 [ json_name = "Path" ]; + sint64 height = 4 [ json_name = "Height" ]; + bool prove = 5 [ json_name = "Prove" ]; +} + +message RequestBeginBlock { + RequestBase request_base = 1 [ json_name = "RequestBase" ]; + bytes hash = 2 [ json_name = "Hash" ]; + google.protobuf.Any header = 3 [ json_name = "Header" ]; + LastCommitInfo last_commit_info = 4 [ json_name = "LastCommitInfo" ]; +} + +message RequestCheckTx { + RequestBase request_base = 1 [ json_name = "RequestBase" ]; + bytes tx = 2 [ json_name = "Tx" ]; + sint64 type = 3 [ json_name = "Type" ]; +} + +message RequestDeliverTx { + RequestBase request_base = 1 [ json_name = "RequestBase" ]; + bytes tx = 2 [ json_name = "Tx" ]; +} + +message RequestEndBlock { + RequestBase request_base = 1 [ json_name = "RequestBase" ]; + sint64 height = 2 [ json_name = "Height" ]; +} + +message RequestCommit { + RequestBase request_base = 1 [ json_name = "RequestBase" ]; +} + +message ResponseBase { + google.protobuf.Any error = 1 [ json_name = "Error" ]; + bytes data = 2 [ json_name = "Data" ]; + repeated google.protobuf.Any events = 3 [ json_name = "Events" ]; + string log = 4 [ json_name = "Log" ]; + string info = 5 [ json_name = "Info" ]; +} + +message ResponseException { + ResponseBase response_base = 1 [ json_name = "ResponseBase" ]; +} + +message ResponseEcho { + ResponseBase response_base = 1 [ json_name = "ResponseBase" ]; + string message = 2 [ json_name = "Message" ]; +} + +message ResponseFlush { + ResponseBase response_base = 1 [ json_name = "ResponseBase" ]; +} + +message ResponseInfo { + ResponseBase response_base = 1 [ json_name = "ResponseBase" ]; + string abci_version = 2 [ json_name = "ABCIVersion" ]; + string app_version = 3 [ json_name = "AppVersion" ]; + sint64 last_block_height = 4 [ json_name = "LastBlockHeight" ]; + bytes last_block_app_hash = 5 [ json_name = "LastBlockAppHash" ]; +} + +message ResponseSetOption { + ResponseBase response_base = 1 [ json_name = "ResponseBase" ]; +} + +message ResponseInitChain { + ResponseBase response_base = 1 [ json_name = "ResponseBase" ]; + ConsensusParams consensus_params = 2 [ json_name = "ConsensusParams" ]; + repeated ValidatorUpdate validators = 3 [ json_name = "Validators" ]; + repeated ResponseDeliverTx tx_responses = 4 [ json_name = "TxResponses" ]; +} + +message ResponseQuery { + ResponseBase response_base = 1 [ json_name = "ResponseBase" ]; + bytes key = 2 [ json_name = "Key" ]; + bytes value = 3 [ json_name = "Value" ]; + tm2.crypto.Proof proof = 4 [ json_name = "Proof" ]; + sint64 height = 5 [ json_name = "Height" ]; +} + +message ResponseBeginBlock { + ResponseBase response_base = 1 [ json_name = "ResponseBase" ]; +} + +message ResponseCheckTx { + ResponseBase response_base = 1 [ json_name = "ResponseBase" ]; + sint64 gas_wanted = 2 [ json_name = "GasWanted" ]; + sint64 gas_used = 3 [ json_name = "GasUsed" ]; +} + +message ResponseDeliverTx { + ResponseBase response_base = 1 [ json_name = "ResponseBase" ]; + sint64 gas_wanted = 2 [ json_name = "GasWanted" ]; + sint64 gas_used = 3 [ json_name = "GasUsed" ]; +} + +message ResponseEndBlock { + ResponseBase response_base = 1 [ json_name = "ResponseBase" ]; + repeated ValidatorUpdate validator_updates = 2 + [ json_name = "ValidatorUpdates" ]; + ConsensusParams consensus_params = 3 [ json_name = "ConsensusParams" ]; + repeated google.protobuf.Any events = 4 [ json_name = "Events" ]; +} + +message ResponseCommit { + ResponseBase response_base = 1 [ json_name = "ResponseBase" ]; +} + +message StringError { string value = 1; } + +message ConsensusParams { + BlockParams block = 1 [ json_name = "Block" ]; + ValidatorParams validator = 2 [ json_name = "Validator" ]; +} + +message BlockParams { + sint64 max_tx_bytes = 1 [ json_name = "MaxTxBytes" ]; + sint64 max_data_bytes = 2 [ json_name = "MaxDataBytes" ]; + sint64 max_block_bytes = 3 [ json_name = "MaxBlockBytes" ]; + sint64 max_gas = 4 [ json_name = "MaxGas" ]; + sint64 time_iota_ms = 5 [ json_name = "TimeIotaMS" ]; +} + +message ValidatorParams { + repeated string pub_key_type_ur_ls = 1 [ json_name = "PubKeyTypeURLs" ]; +} + +message ValidatorUpdate { + string address = 1 [ json_name = "Address" ]; + google.protobuf.Any pub_key = 2 [ json_name = "PubKey" ]; + sint64 power = 3 [ json_name = "Power" ]; +} + +message LastCommitInfo { + sint32 round = 1 [ json_name = "Round" ]; + repeated VoteInfo votes = 2 [ json_name = "Votes" ]; +} + +message VoteInfo { + string address = 1 [ json_name = "Address" ]; + sint64 power = 2 [ json_name = "Power" ]; + bool signed_last_block = 3 [ json_name = "SignedLastBlock" ]; +} + +message EventString { string value = 1; } + +message MockHeader { + string version = 1; + string chain_id = 2; + sint64 height = 3; + google.protobuf.Timestamp time = 4; + sint64 num_txs = 5; + sint64 total_txs = 6; +} diff --git a/proto/tm2/bft/types.proto b/proto/tm2/bft/types.proto new file mode 100644 index 000000000..70be98435 --- /dev/null +++ b/proto/tm2/bft/types.proto @@ -0,0 +1,164 @@ +syntax = "proto3"; +package tm2.bft; + +// imports +import "tm2/bft/abci/abci.proto"; +import "tm2/crypto/merkle.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; + +// messages +message Proposal { + uint32 type = 1 [ json_name = "Type" ]; + sint64 height = 2; + sint64 round = 3; + sint64 pol_round = 4; + BlockID block_id = 5; + google.protobuf.Timestamp timestamp = 6; + bytes signature = 7; +} + +message Block { + Header header = 1; + Data data = 2; + Commit last_commit = 3; +} + +message Header { + string version = 1; + string chain_id = 2; + sint64 height = 3; + google.protobuf.Timestamp time = 4; + sint64 num_txs = 5; + sint64 total_txs = 6; + string app_version = 7; + BlockID last_block_id = 8; + bytes last_commit_hash = 9; + bytes data_hash = 10; + bytes validators_hash = 11; + bytes next_validators_hash = 12; + bytes consensus_hash = 13; + bytes app_hash = 14; + bytes last_results_hash = 15; + string proposer_address = 16; +} + +message Data { repeated bytes txs = 1; } + +message Commit { + BlockID block_id = 1; + repeated CommitSig precommits = 2; +} + +message BlockID { + bytes hash = 1; + PartSetHeader parts_header = 2 [ json_name = "parts" ]; +} + +message SignedHeader { + Header header = 1; + Commit commit = 2; +} + +message LightBlock { + SignedHeader signed_header = 1; + ValidatorSet validator_set = 2; +} +message CommitSig { + uint32 type = 1; + sint64 height = 2; + sint64 round = 3; + BlockID block_id = 4; + google.protobuf.Timestamp timestamp = 5; + string validator_address = 6; + sint64 validator_index = 7; + bytes signature = 8; +} + +message Vote { + uint32 type = 1; + sint64 height = 2; + sint64 round = 3; + BlockID block_id = 4; + google.protobuf.Timestamp timestamp = 5; + string validator_address = 6; + sint64 validator_index = 7; + bytes signature = 8; +} + +message Part { + sint64 index = 1; + bytes bytes = 2; + tm2.crypto.SimpleProof proof = 3; +} + +message PartSet {} + +message PartSetHeader { + sint64 total = 1; + bytes hash = 2; +} + +message Validator { + string address = 1; + google.protobuf.Any pub_key = 2; + sint64 voting_power = 3; + sint64 proposer_priority = 4; +} + +message ValidatorSet { + repeated Validator validators = 1; + Validator proposer = 2; +} + +message EventNewBlock { + Block block = 1; + tm2.bft.abci.ResponseBeginBlock result_begin_block = 2; + tm2.bft.abci.ResponseEndBlock result_end_block = 3; +} + +message EventNewBlockHeader { + Header header = 1; + tm2.bft.abci.ResponseBeginBlock result_begin_block = 2; + tm2.bft.abci.ResponseEndBlock result_end_block = 3; +} + +message EventTx { TxResult result = 1; } + +message EventVote { Vote vote = 1; } + +message EventValidatorSetUpdates { + repeated tm2.bft.abci.ValidatorUpdate validator_updates = 1; +} + +message DuplicateVoteEvidence { + google.protobuf.Any pub_key = 1 [ json_name = "PubKey" ]; + Vote vote_a = 2 [ json_name = "VoteA" ]; + Vote vote_b = 3 [ json_name = "VoteB" ]; +} + +message MockGoodEvidence { + sint64 height = 1 [ json_name = "Height" ]; + string address = 2 [ json_name = "Address" ]; +} + +message MockRandomGoodEvidence { + MockGoodEvidence mock_good_evidence = 1 [ json_name = "MockGoodEvidence" ]; +} + +message MockBadEvidence { + MockGoodEvidence mock_good_evidence = 1 [ json_name = "MockGoodEvidence" ]; +} + +message TxResult { + sint64 height = 1; + uint32 index = 2; + bytes tx = 3; + tm2.bft.abci.ResponseDeliverTx response = 4; +} + +message MockAppState { string account_owner = 1; } + +message VoteSet {} + +message TYPES_BytesList { repeated bytes Value = 1; } diff --git a/proto/tm2/bitarray/bitarray.proto b/proto/tm2/bitarray/bitarray.proto new file mode 100644 index 000000000..400c39aa8 --- /dev/null +++ b/proto/tm2/bitarray/bitarray.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; +package tm2.bitarray; + +option go_package = "github.com/gnolang/gno/tm2/pkg/bitarray/pb"; + +// messages +message BitArray { + sint64 bits = 1; + repeated uint64 elems = 2; +} \ No newline at end of file diff --git a/proto/tm2/crypto/merkle.proto b/proto/tm2/crypto/merkle.proto new file mode 100644 index 000000000..b5d4260f7 --- /dev/null +++ b/proto/tm2/crypto/merkle.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; + +package tm2.crypto; + +option go_package = "github.com/gnolang/gno/tm2/pkg/crypto/merkle/pb"; + +// messages +message ProofOp { + string type = 1; + bytes key = 2; + bytes data = 3; +} + +message Proof { repeated ProofOp ops = 1; } + +message SimpleProof { + sint64 total = 1; + sint64 index = 2; + bytes leaf_hash = 3; + repeated bytes aunts = 4; +} + +message SimpleProofNode { + bytes hash = 1 [ json_name = "Hash" ]; + SimpleProofNode parent = 2 [ json_name = "Parent" ]; + SimpleProofNode left = 3 [ json_name = "Left" ]; + SimpleProofNode right = 4 [ json_name = "Right" ]; +} + +message MERKLE_BytesList { repeated bytes Value = 1; } \ No newline at end of file diff --git a/proto/tm2/tx/tx.proto b/proto/tm2/tx/tx.proto new file mode 100644 index 000000000..64b0a4d5f --- /dev/null +++ b/proto/tm2/tx/tx.proto @@ -0,0 +1,32 @@ +syntax = 'proto3'; + +package tm2.tx; + +import "google/protobuf/any.proto"; + +message Tx { + // specific message types + repeated google.protobuf.Any messages = 1; + // transaction costs (fee) + TxFee fee = 2; + // the signatures for the transaction + repeated TxSignature signatures = 3; + // memo attached to the transaction + string memo = 4; +} + +message TxFee { + // gas limit + sint64 gas_wanted = 1; + // gas fee details () + string gas_fee = 2; +} + +message TxSignature { + // public key associated with the signature + google.protobuf.Any pub_key = 1; + // the signature + bytes signature = 2; +} + +message PubKeySecp256k1 { bytes key = 1; } diff --git a/x/coredaos/types/tx.pb.go b/x/coredaos/types/tx.pb.go index 84052150d..700e6326d 100644 --- a/x/coredaos/types/tx.pb.go +++ b/x/coredaos/types/tx.pb.go @@ -39,8 +39,8 @@ type MsgAnnotateProposal struct { ProposalId uint64 `protobuf:"varint,2,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` // annotation is the annotation to add to the proposal. Annotation string `protobuf:"bytes,3,opt,name=annotation,proto3" json:"annotation,omitempty"` - // overwrite is a boolean indicating whether to overwrite the existing annotation. - // Must be set to true if the proposal already has an annotation. + // overwrite is a boolean indicating whether to overwrite the existing + // annotation. Must be set to true if the proposal already has an annotation. // Ignored if the proposal does not have yet an annotation. Overwrite bool `protobuf:"varint,4,opt,name=overwrite,proto3" json:"overwrite,omitempty"` } @@ -235,7 +235,8 @@ func (m *MsgEndorseProposalResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgEndorseProposalResponse proto.InternalMessageInfo -// MsgExtendVotingPeriod defines a message for extending the voting period of a proposal. +// MsgExtendVotingPeriod defines a message for extending the voting period of a +// proposal. type MsgExtendVotingPeriod struct { // extender is the address of the dao extending the voting period. Extender string `protobuf:"bytes,1,opt,name=extender,proto3" json:"extender,omitempty"` @@ -333,8 +334,8 @@ type MsgVetoProposal struct { Vetoer string `protobuf:"bytes,1,opt,name=vetoer,proto3" json:"vetoer,omitempty"` // proposal_id is the ID of the proposal to veto. ProposalId uint64 `protobuf:"varint,2,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - // burn_deposit is a boolean indicating whether to burn the deposit of the proposal. - // If true, the deposit is burned and not refunded. + // burn_deposit is a boolean indicating whether to burn the deposit of the + // proposal. If true, the deposit is burned and not refunded. BurnDeposit bool `protobuf:"varint,3,opt,name=burn_deposit,json=burnDeposit,proto3" json:"burn_deposit,omitempty"` } @@ -598,15 +599,16 @@ 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 MsgClient interface { - // AnnotateProposal defines a method to annotate a proposal with additional information. - // It is only available to the Steering DAO. + // AnnotateProposal defines a method to annotate a proposal with additional + // information. It is only available to the Steering DAO. AnnotateProposal(ctx context.Context, in *MsgAnnotateProposal, opts ...grpc.CallOption) (*MsgAnnotateProposalResponse, error) - // EndorseProposal defines a method to endorse a proposal, and for law proposals this also - // results in the lowering of the passing threshold to the passing threshold of regular proposals. - // It is only available to the Steering DAO. + // EndorseProposal defines a method to endorse a proposal, and for law + // proposals this also results in the lowering of the passing threshold to the + // passing threshold of regular proposals. It is only available to the + // Steering DAO. EndorseProposal(ctx context.Context, in *MsgEndorseProposal, opts ...grpc.CallOption) (*MsgEndorseProposalResponse, error) - // ExtendVotingPeriod defines a method to extend the voting period of a proposal. - // It is available to both the Steering DAO and the Oversight DAO. + // ExtendVotingPeriod defines a method to extend the voting period of a + // proposal. It is available to both the Steering DAO and the Oversight DAO. ExtendVotingPeriod(ctx context.Context, in *MsgExtendVotingPeriod, opts ...grpc.CallOption) (*MsgExtendVotingPeriodResponse, error) // VetoProposal defines a method to veto a proposal. // It is only available to the Oversight DAO. @@ -671,15 +673,16 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts // MsgServer is the server API for Msg service. type MsgServer interface { - // AnnotateProposal defines a method to annotate a proposal with additional information. - // It is only available to the Steering DAO. + // AnnotateProposal defines a method to annotate a proposal with additional + // information. It is only available to the Steering DAO. AnnotateProposal(context.Context, *MsgAnnotateProposal) (*MsgAnnotateProposalResponse, error) - // EndorseProposal defines a method to endorse a proposal, and for law proposals this also - // results in the lowering of the passing threshold to the passing threshold of regular proposals. - // It is only available to the Steering DAO. + // EndorseProposal defines a method to endorse a proposal, and for law + // proposals this also results in the lowering of the passing threshold to the + // passing threshold of regular proposals. It is only available to the + // Steering DAO. EndorseProposal(context.Context, *MsgEndorseProposal) (*MsgEndorseProposalResponse, error) - // ExtendVotingPeriod defines a method to extend the voting period of a proposal. - // It is available to both the Steering DAO and the Oversight DAO. + // ExtendVotingPeriod defines a method to extend the voting period of a + // proposal. It is available to both the Steering DAO and the Oversight DAO. ExtendVotingPeriod(context.Context, *MsgExtendVotingPeriod) (*MsgExtendVotingPeriodResponse, error) // VetoProposal defines a method to veto a proposal. // It is only available to the Oversight DAO. diff --git a/x/dynamicfee/types/tx.pb.go b/x/dynamicfee/types/tx.pb.go index bc9dd384d..f6b35b677 100644 --- a/x/dynamicfee/types/tx.pb.go +++ b/x/dynamicfee/types/tx.pb.go @@ -171,7 +171,8 @@ 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 MsgClient interface { - // UpdateParams defines a method for updating the dynamicfee module parameters. + // UpdateParams defines a method for updating the dynamicfee module + // parameters. UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } @@ -194,7 +195,8 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts // MsgServer is the server API for Msg service. type MsgServer interface { - // UpdateParams defines a method for updating the dynamicfee module parameters. + // UpdateParams defines a method for updating the dynamicfee module + // parameters. UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } diff --git a/x/gov/types/v1/gov.pb.go b/x/gov/types/v1/gov.pb.go index a79510b2f..54184626d 100644 --- a/x/gov/types/v1/gov.pb.go +++ b/x/gov/types/v1/gov.pb.go @@ -807,11 +807,13 @@ type TallyParams struct { Threshold string `protobuf:"bytes,2,opt,name=threshold,proto3" json:"threshold,omitempty"` // quorum for constitution amendment proposals ConstitutionAmendmentQuorum string `protobuf:"bytes,3,opt,name=constitution_amendment_quorum,json=constitutionAmendmentQuorum,proto3" json:"constitution_amendment_quorum,omitempty"` // Deprecated: Do not use. - // Minimum proportion of Yes votes for a Constitution Amendment proposal to pass. Default value: 0.9. + // Minimum proportion of Yes votes for a Constitution Amendment proposal to + // pass. Default value: 0.9. ConstitutionAmendmentThreshold string `protobuf:"bytes,4,opt,name=constitution_amendment_threshold,json=constitutionAmendmentThreshold,proto3" json:"constitution_amendment_threshold,omitempty"` // quorum for law proposals LawQuorum string `protobuf:"bytes,5,opt,name=law_quorum,json=lawQuorum,proto3" json:"law_quorum,omitempty"` // Deprecated: Do not use. - // Minimum proportion of Yes votes for a Law proposal to pass. Default value: 0.9. + // Minimum proportion of Yes votes for a Law proposal to pass. Default value: + // 0.9. LawThreshold string `protobuf:"bytes,6,opt,name=law_threshold,json=lawThreshold,proto3" json:"law_threshold,omitempty"` } @@ -894,23 +896,24 @@ func (m *TallyParams) GetLawThreshold() string { } type MinDepositThrottler struct { - // Floor value for the minimum deposit required for a proposal to enter the voting period. + // Floor value for the minimum deposit required for a proposal to enter the + // voting period. FloorValue []types.Coin `protobuf:"bytes,1,rep,name=floor_value,json=floorValue,proto3" json:"floor_value"` - // Duration that dictates after how long the dynamic minimum deposit should be recalculated - // for time-based decreases. + // Duration that dictates after how long the dynamic minimum deposit should be + // recalculated for time-based decreases. UpdatePeriod *time.Duration `protobuf:"bytes,2,opt,name=update_period,json=updatePeriod,proto3,stdduration" json:"update_period,omitempty"` // The number of active proposals the dynamic minimum deposit should target. TargetActiveProposals uint64 `protobuf:"varint,3,opt,name=target_active_proposals,json=targetActiveProposals,proto3" json:"target_active_proposals,omitempty"` - // The ratio of increase for the minimum deposit when the number of active proposals - // is at or above the target. + // The ratio of increase for the minimum deposit when the number of active + // proposals is at or above the target. IncreaseRatio string `protobuf:"bytes,4,opt,name=increase_ratio,json=increaseRatio,proto3" json:"increase_ratio,omitempty"` - // The ratio of decrease for the minimum deposit when the number of active proposals - // is 1 less than the target. + // The ratio of decrease for the minimum deposit when the number of active + // proposals is 1 less than the target. DecreaseRatio string `protobuf:"bytes,5,opt,name=decrease_ratio,json=decreaseRatio,proto3" json:"decrease_ratio,omitempty"` // A positive integer representing the sensitivity of dynamic minimum deposit // decreases to the distance from the target number of active proposals. - // The higher the number, the lower the sensitivity. A value of 1 represents the - // highest sensitivity. + // The higher the number, the lower the sensitivity. A value of 1 represents + // the highest sensitivity. DecreaseSensitivityTargetDistance uint64 `protobuf:"varint,6,opt,name=decrease_sensitivity_target_distance,json=decreaseSensitivityTargetDistance,proto3" json:"decrease_sensitivity_target_distance,omitempty"` } @@ -990,23 +993,25 @@ func (m *MinDepositThrottler) GetDecreaseSensitivityTargetDistance() uint64 { } type MinInitialDepositThrottler struct { - // Floor value for the minimum initial deposit required for a proposal to enter the deposit period. + // Floor value for the minimum initial deposit required for a proposal to + // enter the deposit period. FloorValue []types.Coin `protobuf:"bytes,1,rep,name=floor_value,json=floorValue,proto3" json:"floor_value"` - // Duration that dictates after how long the dynamic minimum deposit should be recalculated - // for time-based decreases. + // Duration that dictates after how long the dynamic minimum deposit should be + // recalculated for time-based decreases. UpdatePeriod *time.Duration `protobuf:"bytes,2,opt,name=update_period,json=updatePeriod,proto3,stdduration" json:"update_period,omitempty"` - // The number of proposals in deposit period the dynamic minimum initial deposit should target. + // The number of proposals in deposit period the dynamic minimum initial + // deposit should target. TargetProposals uint64 `protobuf:"varint,3,opt,name=target_proposals,json=targetProposals,proto3" json:"target_proposals,omitempty"` - // The ratio of increase for the minimum initial deposit when the number of proposals - // in deposit period is at or above the target. + // The ratio of increase for the minimum initial deposit when the number of + // proposals in deposit period is at or above the target. IncreaseRatio string `protobuf:"bytes,4,opt,name=increase_ratio,json=increaseRatio,proto3" json:"increase_ratio,omitempty"` - // The ratio of decrease for the minimum initial deposit when the number of proposals - // in deposit period is 1 less than the target. + // The ratio of decrease for the minimum initial deposit when the number of + // proposals in deposit period is 1 less than the target. DecreaseRatio string `protobuf:"bytes,5,opt,name=decrease_ratio,json=decreaseRatio,proto3" json:"decrease_ratio,omitempty"` // A positive integer representing the sensitivity of dynamic minimum initial // deposit decreases to the distance from the target number of proposals - // in deposit period. The higher the number, the lower the sensitivity. A value - // of 1 represents the highest sensitivity. + // in deposit period. The higher the number, the lower the sensitivity. A + // value of 1 represents the highest sensitivity. DecreaseSensitivityTargetDistance uint64 `protobuf:"varint,6,opt,name=decrease_sensitivity_target_distance,json=decreaseSensitivityTargetDistance,proto3" json:"decrease_sensitivity_target_distance,omitempty"` } @@ -1106,7 +1111,8 @@ type Params struct { Quorum string `protobuf:"bytes,4,opt,name=quorum,proto3" json:"quorum,omitempty"` // Deprecated: Do not use. // Minimum proportion of Yes votes for proposal to pass. Default value: 2/3. Threshold string `protobuf:"bytes,5,opt,name=threshold,proto3" json:"threshold,omitempty"` - // The ratio representing the proportion of the deposit value that must be paid at proposal submission. + // The ratio representing the proportion of the deposit value that must be + // paid at proposal submission. MinInitialDepositRatio string `protobuf:"bytes,7,opt,name=min_initial_deposit_ratio,json=minInitialDepositRatio,proto3" json:"min_initial_deposit_ratio,omitempty"` // Deprecated: Do not use. // burn deposits if a proposal does not meet quorum BurnVoteQuorum bool `protobuf:"varint,13,opt,name=burn_vote_quorum,json=burnVoteQuorum,proto3" json:"burn_vote_quorum,omitempty"` @@ -1122,20 +1128,23 @@ type Params struct { MinDepositRatio string `protobuf:"bytes,15,opt,name=min_deposit_ratio,json=minDepositRatio,proto3" json:"min_deposit_ratio,omitempty"` // quorum for constitution amendment proposals ConstitutionAmendmentQuorum string `protobuf:"bytes,16,opt,name=constitution_amendment_quorum,json=constitutionAmendmentQuorum,proto3" json:"constitution_amendment_quorum,omitempty"` // Deprecated: Do not use. - // Minimum proportion of Yes votes for a Constitution Amendment proposal to pass. Default value: 0.9. + // Minimum proportion of Yes votes for a Constitution Amendment proposal to + // pass. Default value: 0.9. ConstitutionAmendmentThreshold string `protobuf:"bytes,17,opt,name=constitution_amendment_threshold,json=constitutionAmendmentThreshold,proto3" json:"constitution_amendment_threshold,omitempty"` // quorum for law proposals LawQuorum string `protobuf:"bytes,18,opt,name=law_quorum,json=lawQuorum,proto3" json:"law_quorum,omitempty"` // Deprecated: Do not use. - // Minimum proportion of Yes votes for a Law proposal to pass. Default value: 0.9. + // Minimum proportion of Yes votes for a Law proposal to pass. Default value: + // 0.9. LawThreshold string `protobuf:"bytes,19,opt,name=law_threshold,json=lawThreshold,proto3" json:"law_threshold,omitempty"` - // Duration of time after a proposal enters the voting period, during which quorum - // must be achieved to not incur in a voting period extension. + // Duration of time after a proposal enters the voting period, during which + // quorum must be achieved to not incur in a voting period extension. QuorumTimeout *time.Duration `protobuf:"bytes,20,opt,name=quorum_timeout,json=quorumTimeout,proto3,stdduration" json:"quorum_timeout,omitempty"` - // Duration that expresses the maximum amount of time by which a proposal voting period - // can be extended. + // Duration that expresses the maximum amount of time by which a proposal + // voting period can be extended. MaxVotingPeriodExtension *time.Duration `protobuf:"bytes,21,opt,name=max_voting_period_extension,json=maxVotingPeriodExtension,proto3,stdduration" json:"max_voting_period_extension,omitempty"` - // Number of times a proposal should be checked for quorum after the quorum timeout - // has elapsed. Used to compute the amount of time in between quorum checks. + // Number of times a proposal should be checked for quorum after the quorum + // timeout has elapsed. Used to compute the amount of time in between quorum + // checks. QuorumCheckCount uint64 `protobuf:"varint,22,opt,name=quorum_check_count,json=quorumCheckCount,proto3" json:"quorum_check_count,omitempty"` MinDepositThrottler *MinDepositThrottler `protobuf:"bytes,23,opt,name=min_deposit_throttler,json=minDepositThrottler,proto3" json:"min_deposit_throttler,omitempty"` MinInitialDepositThrottler *MinInitialDepositThrottler `protobuf:"bytes,24,opt,name=min_initial_deposit_throttler,json=minInitialDepositThrottler,proto3" json:"min_initial_deposit_throttler,omitempty"` diff --git a/x/gov/types/v1/query.pb.go b/x/gov/types/v1/query.pb.go index 60310a0ba..c1d7f18f0 100644 --- a/x/gov/types/v1/query.pb.go +++ b/x/gov/types/v1/query.pb.go @@ -32,7 +32,8 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// QueryConstitutionRequest is the request type for the Query/Constitution RPC method +// QueryConstitutionRequest is the request type for the Query/Constitution RPC +// method type QueryConstitutionRequest struct { } @@ -69,7 +70,8 @@ func (m *QueryConstitutionRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryConstitutionRequest proto.InternalMessageInfo -// QueryConstitutionResponse is the response type for the Query/Constitution RPC method +// QueryConstitutionResponse is the response type for the Query/Constitution RPC +// method type QueryConstitutionResponse struct { Constitution string `protobuf:"bytes,1,opt,name=constitution,proto3" json:"constitution,omitempty"` } @@ -977,7 +979,8 @@ func (m *QueryTallyResultResponse) GetTally() *TallyResult { return nil } -// QueryMinDepositRequest is the request type for the Query/MinDeposit RPC method. +// QueryMinDepositRequest is the request type for the Query/MinDeposit RPC +// method. type QueryMinDepositRequest struct { } @@ -1014,9 +1017,11 @@ func (m *QueryMinDepositRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryMinDepositRequest proto.InternalMessageInfo -// QueryMinDepositResponse is the response type for the Query/MinDeposit RPC method. +// QueryMinDepositResponse is the response type for the Query/MinDeposit RPC +// method. type QueryMinDepositResponse struct { - // min_deposit defines the minimum deposit required for a proposal to enter voting period. + // min_deposit defines the minimum deposit required for a proposal to enter + // voting period. MinDeposit []types.Coin `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3" json:"min_deposit"` } @@ -1060,7 +1065,8 @@ func (m *QueryMinDepositResponse) GetMinDeposit() []types.Coin { return nil } -// QueryMinInitialDepositRequest is the request type for the Query/MinInitialDeposit RPC method. +// QueryMinInitialDepositRequest is the request type for the +// Query/MinInitialDeposit RPC method. type QueryMinInitialDepositRequest struct { } @@ -1097,9 +1103,11 @@ func (m *QueryMinInitialDepositRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryMinInitialDepositRequest proto.InternalMessageInfo -// QueryMinInitialDepositResponse is the response type for the Query/MinInitialDeposit RPC method. +// QueryMinInitialDepositResponse is the response type for the +// Query/MinInitialDeposit RPC method. type QueryMinInitialDepositResponse struct { - // min_initial_deposit defines the minimum initial deposit required for a proposal to be submitted. + // min_initial_deposit defines the minimum initial deposit required for a + // proposal to be submitted. MinInitialDeposit []types.Coin `protobuf:"bytes,1,rep,name=min_initial_deposit,json=minInitialDeposit,proto3" json:"min_initial_deposit"` } @@ -1245,7 +1253,8 @@ func (m *QueryQuorumsResponse) GetLawQuorum() string { return "" } -// QueryParticipationEMAsRequest is the request type for the Query/ParticipationEMAs RPC method. +// QueryParticipationEMAsRequest is the request type for the +// Query/ParticipationEMAs RPC method. type QueryParticipationEMAsRequest struct { } @@ -1282,14 +1291,16 @@ func (m *QueryParticipationEMAsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryParticipationEMAsRequest proto.InternalMessageInfo -// QueryParticipationEMAsResponse is the response type for the Query/ParticipationEMAs RPC method. +// QueryParticipationEMAsResponse is the response type for the +// Query/ParticipationEMAs RPC method. type QueryParticipationEMAsResponse struct { // participation_ema defines the requested participation EMA for proposals. ParticipationEma string `protobuf:"bytes,1,opt,name=participation_ema,json=participationEma,proto3" json:"participation_ema,omitempty"` - // constitution_amendment_participation_ema defines the requested participation EMA for - // constitution amendment proposals. + // constitution_amendment_participation_ema defines the requested + // participation EMA for constitution amendment proposals. ConstitutionAmendmentParticipationEma string `protobuf:"bytes,2,opt,name=constitution_amendment_participation_ema,json=constitutionAmendmentParticipationEma,proto3" json:"constitution_amendment_participation_ema,omitempty"` - // law_participation_ema defines the requestedparticipation EMA for law proposals. + // law_participation_ema defines the requestedparticipation EMA for law + // proposals. LawParticipationEma string `protobuf:"bytes,3,opt,name=law_participation_ema,json=lawParticipationEma,proto3" json:"law_participation_ema,omitempty"` } @@ -1508,7 +1519,8 @@ type QueryClient interface { MinInitialDeposit(ctx context.Context, in *QueryMinInitialDepositRequest, opts ...grpc.CallOption) (*QueryMinInitialDepositResponse, error) // Quorums queries the dynamically set quorums. Quorums(ctx context.Context, in *QueryQuorumsRequest, opts ...grpc.CallOption) (*QueryQuorumsResponse, error) - // ParticipationEMAs queries the state of the proposal participation exponential moving averages. + // ParticipationEMAs queries the state of the proposal participation + // exponential moving averages. ParticipationEMAs(ctx context.Context, in *QueryParticipationEMAsRequest, opts ...grpc.CallOption) (*QueryParticipationEMAsResponse, error) } @@ -1665,7 +1677,8 @@ type QueryServer interface { MinInitialDeposit(context.Context, *QueryMinInitialDepositRequest) (*QueryMinInitialDepositResponse, error) // Quorums queries the dynamically set quorums. Quorums(context.Context, *QueryQuorumsRequest) (*QueryQuorumsResponse, error) - // ParticipationEMAs queries the state of the proposal participation exponential moving averages. + // ParticipationEMAs queries the state of the proposal participation + // exponential moving averages. ParticipationEMAs(context.Context, *QueryParticipationEMAsRequest) (*QueryParticipationEMAsResponse, error) } diff --git a/x/gov/types/v1/tx.pb.go b/x/gov/types/v1/tx.pb.go index 791d2634a..553ae3502 100644 --- a/x/gov/types/v1/tx.pb.go +++ b/x/gov/types/v1/tx.pb.go @@ -775,12 +775,14 @@ func (m *MsgProposeLawResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgProposeLawResponse proto.InternalMessageInfo -// MsgConstitutionAmendment is the Msg/ProposeConstitutionAmendment request type. +// MsgConstitutionAmendment is the Msg/ProposeConstitutionAmendment request +// type. type MsgProposeConstitutionAmendment struct { // authority is the address that controls the module (defaults to x/gov unless // overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // amendment is the amendment to the constitution. It must be in valid GNU patch format. + // amendment is the amendment to the constitution. It must be in valid GNU + // patch format. Amendment string `protobuf:"bytes,2,opt,name=amendment,proto3" json:"amendment,omitempty"` } @@ -831,8 +833,8 @@ func (m *MsgProposeConstitutionAmendment) GetAmendment() string { return "" } -// MsgProposeConstitutionAmendmentResponse defines the response structure for executing a -// MsgProposeConstitutionAmendment message. +// MsgProposeConstitutionAmendmentResponse defines the response structure for +// executing a MsgProposeConstitutionAmendment message. type MsgProposeConstitutionAmendmentResponse struct { } diff --git a/x/photon/types/query.pb.go b/x/photon/types/query.pb.go index 67f77195c..7efafd3ce 100644 --- a/x/photon/types/query.pb.go +++ b/x/photon/types/query.pb.go @@ -113,7 +113,8 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } -// QueryConversionRateRequest is request type for the Query/ConversionRate RPC method. +// QueryConversionRateRequest is request type for the Query/ConversionRate RPC +// method. type QueryConversionRateRequest struct { } @@ -150,7 +151,8 @@ func (m *QueryConversionRateRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryConversionRateRequest proto.InternalMessageInfo -// QueryConversionRateResponse is response type for the Query/ConversionRate RPC method. +// QueryConversionRateResponse is response type for the Query/ConversionRate RPC +// method. type QueryConversionRateResponse struct { // conversion_rate represents the factor used to convert atone to photon. ConversionRate string `protobuf:"bytes,1,opt,name=conversion_rate,json=conversionRate,proto3" json:"conversion_rate,omitempty"`