diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c813c3110f..01e078f0c8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased](https://github.com/line/ibc-go/tree/HEAD) +### Features +* [\#5](https://github.com/line/ibc-go/pull/5) apply the changes of lbm-sdk and ostracon proto + ### Improvements * [\#1](https://github.com/line/ibc-go/pull/1) apply all changes of `x/ibc` in lbm-sdk until [lbm-sdk@0fbc2fcae6dba90fa80b815cf3219d6fcf46fc64](https://github.com/line/lbm-sdk/tree/0fbc2fcae6dba90fa80b815cf3219d6fcf46fc64) * [\#3](https://github.com/line/ibc-go/pull/3) bump up github.com/cosmos/ibc-go from v3.0.0 to v3.3.1 diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index 709b6641220..4261f07a09c 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -3448,12 +3448,10 @@ trusted validator set at the TrustedHeight. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `signed_header` | [ostracon.types.SignedHeader](#ostracon.types.SignedHeader) | | | -| `validator_set` | [ostracon.types.ValidatorSet](#ostracon.types.ValidatorSet) | | | -| `voter_set` | [ostracon.types.VoterSet](#ostracon.types.VoterSet) | | | +| `signed_header` | [tendermint.types.SignedHeader](#tendermint.types.SignedHeader) | | | +| `validator_set` | [tendermint.types.ValidatorSet](#tendermint.types.ValidatorSet) | | | | `trusted_height` | [ibc.core.client.v1.Height](#ibc.core.client.v1.Height) | | | -| `trusted_validators` | [ostracon.types.ValidatorSet](#ostracon.types.ValidatorSet) | | | -| `trusted_voters` | [ostracon.types.VoterSet](#ostracon.types.VoterSet) | | | +| `trusted_validators` | [tendermint.types.ValidatorSet](#tendermint.types.ValidatorSet) | | | diff --git a/go.mod b/go.mod index e8a0455c2d6..732563d8255 100644 --- a/go.mod +++ b/go.mod @@ -11,17 +11,18 @@ require ( github.com/golang/protobuf v1.5.2 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/line/lbm-sdk v0.0.0-20230113004822-8fb974447422 - github.com/line/ostracon v1.0.7 + github.com/line/lbm-sdk v0.46.1-0.20230209105703-b88647308597 + github.com/line/ostracon v1.0.9-0.20230209043112-5aca894db3a6 github.com/rakyll/statik v0.1.7 github.com/regen-network/cosmos-proto v0.3.1 github.com/spf13/cast v1.5.0 github.com/spf13/cobra v1.6.1 - github.com/spf13/viper v1.14.0 + github.com/spf13/viper v1.15.0 github.com/stretchr/testify v1.8.1 + github.com/tendermint/tendermint v0.34.24 github.com/tendermint/tm-db v0.6.7 - google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e - google.golang.org/grpc v1.50.1 + google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef + google.golang.org/grpc v1.52.3 google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8 gopkg.in/yaml.v2 v2.4.0 ) @@ -56,10 +57,10 @@ require ( github.com/dvsekhvalnov/jose2go v1.5.0 // indirect github.com/felixge/httpsnoop v1.0.1 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/gin-gonic/gin v1.7.0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect - github.com/go-logfmt/logfmt v0.5.1 // indirect + github.com/go-logfmt/logfmt v0.6.0 // indirect + github.com/go-playground/validator/v10 v10.4.1 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/gateway v1.1.0 // indirect github.com/golang/glog v1.0.0 // indirect @@ -76,7 +77,6 @@ require ( github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 // indirect - github.com/herumi/bls-eth-go-binary v0.0.0-20220509081320-2d8ab06de53c // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/jmhodges/levigo v1.0.0 // indirect @@ -93,8 +93,7 @@ require ( github.com/minio/highwayhash v1.0.2 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mtibben/percent v0.2.1 // indirect - github.com/pelletier/go-toml v1.9.5 // indirect - github.com/pelletier/go-toml/v2 v2.0.5 // indirect + github.com/pelletier/go-toml/v2 v2.0.6 // indirect github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect @@ -104,18 +103,17 @@ require ( github.com/prometheus/procfs v0.8.0 // indirect github.com/r2ishiguro/vrf v0.0.0-20180716233122-192de52975eb // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect - github.com/rs/cors v1.8.2 // indirect - github.com/rs/zerolog v1.28.0 // indirect + github.com/rs/cors v1.8.3 // indirect + github.com/rs/zerolog v1.29.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect - github.com/spf13/afero v1.9.2 // indirect + github.com/spf13/afero v1.9.3 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/subosito/gotenv v1.4.1 // indirect + github.com/subosito/gotenv v1.4.2 // indirect github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect github.com/tendermint/btcd v0.1.1 // indirect github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect github.com/tendermint/go-amino v0.16.0 // indirect - github.com/tendermint/tendermint v0.34.24 // indirect github.com/zondax/hid v0.9.1 // indirect github.com/zondax/ledger-go v0.14.0 // indirect go.etcd.io/bbolt v1.3.6 // indirect @@ -126,6 +124,7 @@ require ( golang.org/x/term v0.4.0 // indirect golang.org/x/text v0.6.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect ) diff --git a/go.sum b/go.sum index c30781b88a2..6ee04c71189 100644 --- a/go.sum +++ b/go.sum @@ -198,9 +198,8 @@ github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbS github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= -github.com/gin-gonic/gin v1.7.0 h1:jGB9xAJQ12AIGNB4HguylppmDK1Am9ppF7XnGXXJuoU= -github.com/gin-gonic/gin v1.7.0/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -214,8 +213,8 @@ github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBj github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= +github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= @@ -372,8 +371,6 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 h1:aSVUgRRRtOrZOC1fYmY9gV0e9z/Iu+xNVSASWjsuyGU= github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3/go.mod h1:5PC6ZNPde8bBqU/ewGZig35+UIZtw9Ytxez8/q5ZyFE= -github.com/herumi/bls-eth-go-binary v0.0.0-20220509081320-2d8ab06de53c h1:ppGSVyhAFh8VAGyDuNeLEGMYRJR5iDI92QgDNrMIqK0= -github.com/herumi/bls-eth-go-binary v0.0.0-20220509081320-2d8ab06de53c/go.mod h1:luAnRm3OsMQeokhGzpYmc0ZKwawY7o87PUEP11Z7r7U= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -427,10 +424,10 @@ github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6 github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= -github.com/line/lbm-sdk v0.0.0-20230113004822-8fb974447422 h1:/LP6ZNrAs+Ba/08+YtEA7nzU/jEBaevVlOVzKKcbMUc= -github.com/line/lbm-sdk v0.0.0-20230113004822-8fb974447422/go.mod h1:wpkaELNQd8x+DdXC/blxYoEExOaZBKFhby6AujzGTC0= -github.com/line/ostracon v1.0.7 h1:8vh/gsM6Sf6z2s38og8YufIhrWN2TwXpm4I3DqKEVyI= -github.com/line/ostracon v1.0.7/go.mod h1:gmEKYdaMaDAl5xJ8sJJo0s6OvzBSZwM01nWRCGA5oDY= +github.com/line/lbm-sdk v0.46.1-0.20230209105703-b88647308597 h1:J0Pr378D5JmHNjifZXVigAIunJXD2JDHJE/lY3tYTQc= +github.com/line/lbm-sdk v0.46.1-0.20230209105703-b88647308597/go.mod h1:Od+QeMi4JO4HB3HEdPTqzI7mAvn1w99PZ9pmKmtNDco= +github.com/line/ostracon v1.0.9-0.20230209043112-5aca894db3a6 h1:nuM0PTB04PCax35+u8LRpTufdmwoPZcBhhKjqbezMYA= +github.com/line/ostracon v1.0.9-0.20230209043112-5aca894db3a6/go.mod h1:iLRth/ryufyNePzJ1ULJ4S8SYGUD/lF+aIFUTRKY9tQ= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= @@ -453,6 +450,7 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5 github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/miekg/dns v1.1.50 h1:DQUfb9uc6smULcREF09Uc+/Gd46YWqJd5DbpPE9xkcA= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 h1:QRUSJEgZn2Snx0EmT/QLXibWjSUDjKWvXIT19NBVp94= github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= @@ -521,10 +519,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= -github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg= -github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas= +github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= +github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= @@ -588,11 +584,11 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.8.2 h1:KCooALfAYGs415Cwu5ABvv9n9509fSiG5SQJn/AQo4U= -github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= +github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.28.0 h1:MirSo27VyNi7RJYP3078AA1+Cyzd2GB66qy3aUHvsWY= -github.com/rs/zerolog v1.28.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0= +github.com/rs/zerolog v1.29.0 h1:Zes4hju04hjbvkVkOhdl2HpZa+0PmVwigmo8XoORE5w= +github.com/rs/zerolog v1.29.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -615,8 +611,8 @@ github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasO github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.9.2 h1:j49Hj62F0n+DaZ1dDCvhABaPNSGNkt32oRFxI33IEMw= -github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= +github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= +github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= @@ -632,8 +628,8 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.14.0 h1:Rg7d3Lo706X9tHsJMUjdiwMpHB7W8WnSVOssIY+JElU= -github.com/spf13/viper v1.14.0/go.mod h1:WT//axPky3FdvXHzGw33dNdXXXfFQqmEalje+egj8As= +github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU= +github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= @@ -652,8 +648,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs= -github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= +github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= @@ -1040,8 +1036,8 @@ google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e h1:S9GbmC1iCgvbLyAokVCwiO6tVIrU9Y7c5oMx1V/ki/Y= -google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= +google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef h1:uQ2vjV/sHTsWSqdKeLqmwitzgvjMl7o4IdtHwUDXSJY= +google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -1066,8 +1062,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= -google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ= +google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1094,6 +1090,8 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= +gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= diff --git a/modules/apps/27-interchain-accounts/host/client/cli/query.go b/modules/apps/27-interchain-accounts/host/client/cli/query.go index b195fd0ba2a..9fafd557506 100644 --- a/modules/apps/27-interchain-accounts/host/client/cli/query.go +++ b/modules/apps/27-interchain-accounts/host/client/cli/query.go @@ -4,13 +4,14 @@ import ( "fmt" "strconv" + "github.com/spf13/cobra" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/line/lbm-sdk/client" "github.com/line/lbm-sdk/client/flags" sdk "github.com/line/lbm-sdk/types" "github.com/line/lbm-sdk/version" "github.com/line/lbm-sdk/x/auth/tx" - abci "github.com/line/ostracon/abci/types" - "github.com/spf13/cobra" "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts/host/types" icatypes "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts/types" diff --git a/modules/apps/27-interchain-accounts/host/ibc_module_test.go b/modules/apps/27-interchain-accounts/host/ibc_module_test.go index 3afb82e4135..4e2d58a1179 100644 --- a/modules/apps/27-interchain-accounts/host/ibc_module_test.go +++ b/modules/apps/27-interchain-accounts/host/ibc_module_test.go @@ -5,13 +5,14 @@ import ( "testing" "github.com/gogo/protobuf/proto" + "github.com/stretchr/testify/suite" + abcitypes "github.com/tendermint/tendermint/abci/types" + sdk "github.com/line/lbm-sdk/types" banktypes "github.com/line/lbm-sdk/x/bank/types" capabilitytypes "github.com/line/lbm-sdk/x/capability/types" - abcitypes "github.com/line/ostracon/abci/types" ocprotostate "github.com/line/ostracon/proto/ostracon/state" ocstate "github.com/line/ostracon/state" - "github.com/stretchr/testify/suite" "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts/host/types" icatypes "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts/types" diff --git a/modules/apps/27-interchain-accounts/host/types/ack_test.go b/modules/apps/27-interchain-accounts/host/types/ack_test.go index c2c0661c758..52aa01e827c 100644 --- a/modules/apps/27-interchain-accounts/host/types/ack_test.go +++ b/modules/apps/27-interchain-accounts/host/types/ack_test.go @@ -3,11 +3,12 @@ package types_test import ( "testing" + "github.com/stretchr/testify/suite" + abcitypes "github.com/tendermint/tendermint/abci/types" + sdkerrors "github.com/line/lbm-sdk/types/errors" - abcitypes "github.com/line/ostracon/abci/types" ocprotostate "github.com/line/ostracon/proto/ostracon/state" ocstate "github.com/line/ostracon/state" - "github.com/stretchr/testify/suite" "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts/host/types" ibctesting "github.com/line/ibc-go/v3/testing" diff --git a/modules/apps/27-interchain-accounts/module.go b/modules/apps/27-interchain-accounts/module.go index 515ac3dbab6..13e8d7ba401 100644 --- a/modules/apps/27-interchain-accounts/module.go +++ b/modules/apps/27-interchain-accounts/module.go @@ -6,8 +6,8 @@ import ( "fmt" "github.com/grpc-ecosystem/grpc-gateway/runtime" - abci "github.com/line/ostracon/abci/types" "github.com/spf13/cobra" + abci "github.com/tendermint/tendermint/abci/types" "github.com/line/lbm-sdk/client" "github.com/line/lbm-sdk/codec" diff --git a/modules/apps/27-interchain-accounts/module_test.go b/modules/apps/27-interchain-accounts/module_test.go index ccbed8a2076..4d696e11cd6 100644 --- a/modules/apps/27-interchain-accounts/module_test.go +++ b/modules/apps/27-interchain-accounts/module_test.go @@ -3,11 +3,12 @@ package ica_test import ( "testing" - "github.com/line/ostracon/libs/log" - ocproto "github.com/line/ostracon/proto/ostracon/types" "github.com/stretchr/testify/suite" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" dbm "github.com/tendermint/tm-db" + "github.com/line/ostracon/libs/log" + ica "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts" controllertypes "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts/controller/types" hosttypes "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts/host/types" @@ -36,7 +37,7 @@ func (suite *InterchainAccountsTestSuite) TestInitModule() { appModule, ok := app.GetModuleManager().Modules[types.ModuleName].(ica.AppModule) suite.Require().True(ok) - header := ocproto.Header{ + header := tmproto.Header{ ChainID: "testchain", Height: 1, Time: suite.coordinator.CurrentTime.UTC(), @@ -99,7 +100,7 @@ func (suite *InterchainAccountsTestSuite) TestInitModule() { // reset app state app = simapp.NewSimApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, map[int64]bool{}, simapp.DefaultNodeHome, 5, simapp.MakeTestEncodingConfig(), simapp.EmptyAppOptions{}) - header := ocproto.Header{ + header := tmproto.Header{ ChainID: "testchain", Height: 1, Time: suite.coordinator.CurrentTime.UTC(), diff --git a/modules/apps/transfer/module.go b/modules/apps/transfer/module.go index bc9021e1ccf..96d53a3a1dc 100644 --- a/modules/apps/transfer/module.go +++ b/modules/apps/transfer/module.go @@ -7,8 +7,8 @@ import ( "math/rand" "github.com/grpc-ecosystem/grpc-gateway/runtime" - abci "github.com/line/ostracon/abci/types" "github.com/spf13/cobra" + abci "github.com/tendermint/tendermint/abci/types" "github.com/line/lbm-sdk/client" "github.com/line/lbm-sdk/codec" diff --git a/modules/apps/transfer/types/ack_test.go b/modules/apps/transfer/types/ack_test.go index c093620d174..6973c30504e 100644 --- a/modules/apps/transfer/types/ack_test.go +++ b/modules/apps/transfer/types/ack_test.go @@ -3,11 +3,12 @@ package types_test import ( "testing" + "github.com/stretchr/testify/suite" + abcitypes "github.com/tendermint/tendermint/abci/types" + sdkerrors "github.com/line/lbm-sdk/types/errors" - abcitypes "github.com/line/ostracon/abci/types" ocprotostate "github.com/line/ostracon/proto/ostracon/state" ocstate "github.com/line/ostracon/state" - "github.com/stretchr/testify/suite" "github.com/line/ibc-go/v3/modules/apps/transfer/types" ibctesting "github.com/line/ibc-go/v3/testing" diff --git a/modules/core/02-client/abci_test.go b/modules/core/02-client/abci_test.go index 37f83b5fde1..0a9d9240d63 100644 --- a/modules/core/02-client/abci_test.go +++ b/modules/core/02-client/abci_test.go @@ -3,10 +3,11 @@ package client_test import ( "testing" - upgradetypes "github.com/line/lbm-sdk/x/upgrade/types" - abci "github.com/line/ostracon/abci/types" - ocproto "github.com/line/ostracon/proto/ostracon/types" "github.com/stretchr/testify/suite" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + + upgradetypes "github.com/line/lbm-sdk/x/upgrade/types" + ocabci "github.com/line/ostracon/abci/types" client "github.com/line/ibc-go/v3/modules/core/02-client" "github.com/line/ibc-go/v3/modules/core/02-client/types" @@ -74,7 +75,7 @@ func (suite *ClientTestSuite) TestBeginBlockerConsensusState() { store.Set(upgradetypes.PlanKey(), bz) nextValsHash := []byte("nextValsHash") - newCtx := suite.chainA.GetContext().WithBlockHeader(ocproto.Header{ + newCtx := suite.chainA.GetContext().WithBlockHeader(tmproto.Header{ Height: suite.chainA.GetContext().BlockHeight(), NextValidatorsHash: nextValsHash, }) @@ -82,7 +83,7 @@ func (suite *ClientTestSuite) TestBeginBlockerConsensusState() { err := suite.chainA.GetSimApp().UpgradeKeeper.SetUpgradedClient(newCtx, plan.Height, []byte("client state")) suite.Require().NoError(err) - req := abci.RequestBeginBlock{Header: newCtx.BlockHeader()} + req := ocabci.RequestBeginBlock{Header: newCtx.BlockHeader()} suite.chainA.App.BeginBlock(req) // plan Height is at ctx.BlockHeight+1 diff --git a/modules/core/02-client/client/utils/utils.go b/modules/core/02-client/client/utils/utils.go index 811b5004e01..db235b8002f 100644 --- a/modules/core/02-client/client/utils/utils.go +++ b/modules/core/02-client/client/utils/utils.go @@ -150,28 +150,15 @@ func QueryOstraconHeader(clientCtx client.Context) (ibcoctypes.Header, int64, er return ibcoctypes.Header{}, 0, err } - page = 0 - count = 10_000 - voters, err := node.Voters(context.Background(), &height, &page, &count) - if err != nil { - return ibcoctypes.Header{}, 0, err - } - protoCommit := commit.SignedHeader.ToProto() protoValset, err := octypes.NewValidatorSet(validators.Validators).ToProto() if err != nil { return ibcoctypes.Header{}, 0, err } - protoVoterSet, err := octypes.WrapValidatorsToVoterSet(voters.Voters).ToProto() - if err != nil { - return ibcoctypes.Header{}, 0, err - } - header := ibcoctypes.Header{ SignedHeader: protoCommit, ValidatorSet: protoValset, - VoterSet: protoVoterSet, } return header, height, nil diff --git a/modules/core/02-client/keeper/client_test.go b/modules/core/02-client/keeper/client_test.go index 4ebf924db05..9c99f540b4f 100644 --- a/modules/core/02-client/keeper/client_test.go +++ b/modules/core/02-client/keeper/client_test.go @@ -54,12 +54,11 @@ func (suite *KeeperTestSuite) TestUpdateClientOstracon() { return header } createPastUpdateFn := func(fillHeight, trustedHeight clienttypes.Height) *ibcoctypes.Header { - voterSet := octypes.WrapValidatorsToVoterSet(suite.chainB.Vals.Validators) consState, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientConsensusState(suite.chainA.GetContext(), path.EndpointA.ClientID, trustedHeight) suite.Require().True(found) return suite.chainB.CreateOCClientHeader(suite.chainB.ChainID, int64(fillHeight.RevisionHeight), trustedHeight, consState.(*ibcoctypes.ConsensusState).Timestamp.Add(time.Second*5), - suite.chainB.Vals, suite.chainB.Vals, voterSet, voterSet, suite.chainB.Signers) + suite.chainB.Vals, suite.chainB.Vals, suite.chainB.Signers) } cases := []struct { @@ -442,9 +441,6 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() { // Create alternative validator set with only altVal altValSet := octypes.NewValidatorSet([]*octypes.Validator{altVal}) - bothVoterSet := octypes.WrapValidatorsToVoterSet(bothValSet.Validators) - voterSet := octypes.WrapValidatorsToVoterSet(valSet.Validators) - // Create signer array and ensure it is in same order as bothValSet _, suiteVal := suite.valSet.GetByIndex(0) bothSigners := ibctesting.CreateSortedSignerArray(altPrivVal, suite.privVal, altVal, suiteVal) @@ -466,8 +462,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() { { "trusting period misbehavior should pass", &ibcoctypes.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(testChainID, int64(testClientHeight.RevisionHeight+1), testClientHeight, altTime, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(testChainID, int64(testClientHeight.RevisionHeight+1), testClientHeight, suite.ctx.BlockTime(), bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), + Header1: suite.chainA.CreateOCClientHeader(testChainID, int64(testClientHeight.RevisionHeight+1), testClientHeight, altTime, bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(testChainID, int64(testClientHeight.RevisionHeight+1), testClientHeight, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners), ClientId: clientID, }, func() error { @@ -482,8 +478,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() { { "time misbehavior should pass", &ibcoctypes.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(testChainID, int64(testClientHeight.RevisionHeight+5), testClientHeight, suite.ctx.BlockTime(), bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(testChainID, int64(testClientHeight.RevisionHeight+1), testClientHeight, altTime, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), + Header1: suite.chainA.CreateOCClientHeader(testChainID, int64(testClientHeight.RevisionHeight+5), testClientHeight, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(testChainID, int64(testClientHeight.RevisionHeight+1), testClientHeight, altTime, bothValSet, bothValSet, bothSigners), ClientId: clientID, }, func() error { @@ -498,8 +494,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() { { "misbehavior at later height should pass", &ibcoctypes.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(testChainID, int64(heightPlus5.RevisionHeight+1), testClientHeight, altTime, bothValSet, valSet, bothVoterSet, voterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(testChainID, int64(heightPlus5.RevisionHeight+1), testClientHeight, suite.ctx.BlockTime(), bothValSet, valSet, bothVoterSet, voterSet, bothSigners), + Header1: suite.chainA.CreateOCClientHeader(testChainID, int64(heightPlus5.RevisionHeight+1), testClientHeight, altTime, bothValSet, valSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(testChainID, int64(heightPlus5.RevisionHeight+1), testClientHeight, suite.ctx.BlockTime(), bothValSet, valSet, bothSigners), ClientId: clientID, }, func() error { @@ -524,8 +520,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() { { "misbehavior at later height with different trusted heights should pass", &ibcoctypes.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(testChainID, int64(heightPlus5.RevisionHeight+1), testClientHeight, altTime, bothValSet, valSet, bothVoterSet, voterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(testChainID, int64(heightPlus5.RevisionHeight+1), heightPlus3, suite.ctx.BlockTime(), bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), + Header1: suite.chainA.CreateOCClientHeader(testChainID, int64(heightPlus5.RevisionHeight+1), testClientHeight, altTime, bothValSet, valSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(testChainID, int64(heightPlus5.RevisionHeight+1), heightPlus3, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners), ClientId: clientID, }, func() error { @@ -550,8 +546,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() { { "misbehavior ValidateBasic fails: misbehaviour height is at same height as trusted height", &ibcoctypes.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(testChainID, int64(testClientHeight.RevisionHeight), testClientHeight, altTime, bothValSet, valSet, bothVoterSet, voterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(testChainID, int64(testClientHeight.RevisionHeight), testClientHeight, suite.ctx.BlockTime(), bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), + Header1: suite.chainA.CreateOCClientHeader(testChainID, int64(testClientHeight.RevisionHeight), testClientHeight, altTime, bothValSet, valSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(testChainID, int64(testClientHeight.RevisionHeight), testClientHeight, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners), ClientId: clientID, }, func() error { @@ -566,8 +562,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() { { "trusted ConsensusState1 not found", &ibcoctypes.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(testChainID, int64(heightPlus5.RevisionHeight+1), heightPlus3, altTime, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(testChainID, int64(heightPlus5.RevisionHeight+1), testClientHeight, suite.ctx.BlockTime(), bothValSet, valSet, bothVoterSet, voterSet, bothSigners), + Header1: suite.chainA.CreateOCClientHeader(testChainID, int64(heightPlus5.RevisionHeight+1), heightPlus3, altTime, bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(testChainID, int64(heightPlus5.RevisionHeight+1), testClientHeight, suite.ctx.BlockTime(), bothValSet, valSet, bothSigners), ClientId: clientID, }, func() error { @@ -582,8 +578,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() { { "trusted ConsensusState2 not found", &ibcoctypes.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(testChainID, int64(heightPlus5.RevisionHeight+1), testClientHeight, altTime, bothValSet, valSet, bothVoterSet, voterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(testChainID, int64(heightPlus5.RevisionHeight+1), heightPlus3, suite.ctx.BlockTime(), bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), + Header1: suite.chainA.CreateOCClientHeader(testChainID, int64(heightPlus5.RevisionHeight+1), testClientHeight, altTime, bothValSet, valSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(testChainID, int64(heightPlus5.RevisionHeight+1), heightPlus3, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners), ClientId: clientID, }, func() error { @@ -604,8 +600,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() { { "client already is not active - client is frozen", &ibcoctypes.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(testChainID, int64(testClientHeight.RevisionHeight+1), testClientHeight, altTime, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(testChainID, int64(testClientHeight.RevisionHeight+1), testClientHeight, suite.ctx.BlockTime(), bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), + Header1: suite.chainA.CreateOCClientHeader(testChainID, int64(testClientHeight.RevisionHeight+1), testClientHeight, altTime, bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(testChainID, int64(testClientHeight.RevisionHeight+1), testClientHeight, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners), ClientId: clientID, }, func() error { @@ -623,8 +619,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() { { "misbehaviour check failed", &ibcoctypes.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(testChainID, int64(testClientHeight.RevisionHeight+1), testClientHeight, altTime, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(testChainID, int64(testClientHeight.RevisionHeight+1), testClientHeight, suite.ctx.BlockTime(), altValSet, bothValSet, octypes.WrapValidatorsToVoterSet(altValSet.Validators), bothVoterSet, altSigners), + Header1: suite.chainA.CreateOCClientHeader(testChainID, int64(testClientHeight.RevisionHeight+1), testClientHeight, altTime, bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(testChainID, int64(testClientHeight.RevisionHeight+1), testClientHeight, suite.ctx.BlockTime(), altValSet, bothValSet, altSigners), ClientId: clientID, }, func() error { diff --git a/modules/core/02-client/keeper/keeper_test.go b/modules/core/02-client/keeper/keeper_test.go index e752560c497..1ce72174237 100644 --- a/modules/core/02-client/keeper/keeper_test.go +++ b/modules/core/02-client/keeper/keeper_test.go @@ -5,15 +5,16 @@ import ( "testing" "time" + "github.com/stretchr/testify/suite" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + "github.com/line/lbm-sdk/baseapp" "github.com/line/lbm-sdk/codec" cryptocodec "github.com/line/lbm-sdk/crypto/codec" sdk "github.com/line/lbm-sdk/types" stakingtypes "github.com/line/lbm-sdk/x/staking/types" ocbytes "github.com/line/ostracon/libs/bytes" - ocproto "github.com/line/ostracon/proto/ostracon/types" octypes "github.com/line/ostracon/types" - "github.com/stretchr/testify/suite" "github.com/line/ibc-go/v3/modules/core/02-client/keeper" "github.com/line/ibc-go/v3/modules/core/02-client/types" @@ -83,7 +84,7 @@ func (suite *KeeperTestSuite) SetupTest() { app := simapp.Setup(isCheckTx) suite.cdc = app.AppCodec() - suite.ctx = app.BaseApp.NewContext(isCheckTx, ocproto.Header{Height: height, ChainID: testClientID, Time: now2}) + suite.ctx = app.BaseApp.NewContext(isCheckTx, tmproto.Header{Height: height, ChainID: testClientID, Time: now2}) suite.keeper = &app.IBCKeeper.ClientKeeper suite.privVal = ibctestingmock.NewPV() @@ -95,8 +96,7 @@ func (suite *KeeperTestSuite) SetupTest() { validator := ibctesting.NewTestValidator(pubKey, 1) suite.valSet = octypes.NewValidatorSet([]*octypes.Validator{validator}) suite.valSetHash = suite.valSet.Hash() - voterSet := octypes.WrapValidatorsToVoterSet(suite.valSet.Validators) - suite.header = suite.chainA.CreateOCClientHeader(testChainID, int64(testClientHeight.RevisionHeight), testClientHeightMinus1, now2, suite.valSet, suite.valSet, voterSet, voterSet, []octypes.PrivValidator{suite.privVal}) + suite.header = suite.chainA.CreateOCClientHeader(testChainID, int64(testClientHeight.RevisionHeight), testClientHeightMinus1, now2, suite.valSet, suite.valSet, []octypes.PrivValidator{suite.privVal}) suite.consensusState = ibcoctypes.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot([]byte("hash")), suite.valSetHash) var validators stakingtypes.Validators @@ -328,10 +328,9 @@ func (suite KeeperTestSuite) TestConsensusStateHelpers() { nextState := ibcoctypes.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot([]byte("next")), suite.valSetHash) testClientHeightPlus5 := types.NewHeight(0, height+5) - voterSet := octypes.WrapValidatorsToVoterSet(suite.valSet.Validators) header := suite.chainA.CreateOCClientHeader(testClientID, int64(testClientHeightPlus5.RevisionHeight), testClientHeight, suite.header.Header.Time.Add(time.Minute), - suite.valSet, suite.valSet, voterSet, voterSet, []octypes.PrivValidator{suite.privVal}) + suite.valSet, suite.valSet, []octypes.PrivValidator{suite.privVal}) // mock update functionality clientState.LatestHeight = header.GetHeight().(types.Height) diff --git a/modules/core/02-client/types/genesis_test.go b/modules/core/02-client/types/genesis_test.go index a1dbe3d5c0f..19bcf4b7857 100644 --- a/modules/core/02-client/types/genesis_test.go +++ b/modules/core/02-client/types/genesis_test.go @@ -54,10 +54,9 @@ func (suite *TypesTestSuite) TestValidateGenesis() { val := ibctesting.NewTestValidator(pubKey, 10) valSet := octypes.NewValidatorSet([]*octypes.Validator{val}) - voterSet := octypes.WrapValidatorsToVoterSet(valSet.Validators) heightMinus1 := types.NewHeight(0, height-1) - header := suite.chainA.CreateOCClientHeader(chainID, int64(clientHeight.RevisionHeight), heightMinus1, now, valSet, valSet, voterSet, voterSet, []octypes.PrivValidator{privVal}) + header := suite.chainA.CreateOCClientHeader(chainID, int64(clientHeight.RevisionHeight), heightMinus1, now, valSet, valSet, []octypes.PrivValidator{privVal}) testCases := []struct { name string diff --git a/modules/core/02-client/types/msgs_test.go b/modules/core/02-client/types/msgs_test.go index 82d78d88246..89843a9756d 100644 --- a/modules/core/02-client/types/msgs_test.go +++ b/modules/core/02-client/types/msgs_test.go @@ -489,8 +489,8 @@ func (suite *TypesTestSuite) TestMarshalMsgSubmitMisbehaviour() { "ostracon client", func() { height := types.NewHeight(0, uint64(suite.chainA.CurrentHeader.Height)) heightMinus1 := types.NewHeight(0, uint64(suite.chainA.CurrentHeader.Height)-1) - header1 := suite.chainA.CreateOCClientHeader(suite.chainA.ChainID, int64(height.RevisionHeight), heightMinus1, suite.chainA.CurrentHeader.Time, suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Voters, suite.chainA.Voters, suite.chainA.Signers) - header2 := suite.chainA.CreateOCClientHeader(suite.chainA.ChainID, int64(height.RevisionHeight), heightMinus1, suite.chainA.CurrentHeader.Time.Add(time.Minute), suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Voters, suite.chainA.Voters, suite.chainA.Signers) + header1 := suite.chainA.CreateOCClientHeader(suite.chainA.ChainID, int64(height.RevisionHeight), heightMinus1, suite.chainA.CurrentHeader.Time, suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers) + header2 := suite.chainA.CreateOCClientHeader(suite.chainA.ChainID, int64(height.RevisionHeight), heightMinus1, suite.chainA.CurrentHeader.Time.Add(time.Minute), suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers) misbehaviour := ibcoctypes.NewMisbehaviour("ostracon-0", header1, header2) msg, err = types.NewMsgSubmitMisbehaviour("ostracon-0", misbehaviour, suite.chainA.SenderAccount.GetAddress().String()) @@ -546,8 +546,8 @@ func (suite *TypesTestSuite) TestMsgSubmitMisbehaviour_ValidateBasic() { func() { height := types.NewHeight(0, uint64(suite.chainA.CurrentHeader.Height)) heightMinus1 := types.NewHeight(0, uint64(suite.chainA.CurrentHeader.Height)-1) - header1 := suite.chainA.CreateOCClientHeader(suite.chainA.ChainID, int64(height.RevisionHeight), heightMinus1, suite.chainA.CurrentHeader.Time, suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Voters, suite.chainA.Voters, suite.chainA.Signers) - header2 := suite.chainA.CreateOCClientHeader(suite.chainA.ChainID, int64(height.RevisionHeight), heightMinus1, suite.chainA.CurrentHeader.Time.Add(time.Minute), suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Voters, suite.chainA.Voters, suite.chainA.Signers) + header1 := suite.chainA.CreateOCClientHeader(suite.chainA.ChainID, int64(height.RevisionHeight), heightMinus1, suite.chainA.CurrentHeader.Time, suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers) + header2 := suite.chainA.CreateOCClientHeader(suite.chainA.ChainID, int64(height.RevisionHeight), heightMinus1, suite.chainA.CurrentHeader.Time.Add(time.Minute), suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers) misbehaviour := ibcoctypes.NewMisbehaviour("ostracon-0", header1, header2) msg, err = types.NewMsgSubmitMisbehaviour("ostracon-0", misbehaviour, suite.chainA.SenderAccount.GetAddress().String()) diff --git a/modules/core/03-connection/types/msgs_test.go b/modules/core/03-connection/types/msgs_test.go index 6a05a59692a..e334290d9dc 100644 --- a/modules/core/03-connection/types/msgs_test.go +++ b/modules/core/03-connection/types/msgs_test.go @@ -5,13 +5,14 @@ import ( "testing" "time" + "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" + dbm "github.com/tendermint/tm-db" + "github.com/line/lbm-sdk/store/iavl" "github.com/line/lbm-sdk/store/rootmulti" storetypes "github.com/line/lbm-sdk/store/types" - abci "github.com/line/ostracon/abci/types" "github.com/line/ostracon/libs/log" - "github.com/stretchr/testify/suite" - dbm "github.com/tendermint/tm-db" clienttypes "github.com/line/ibc-go/v3/modules/core/02-client/types" "github.com/line/ibc-go/v3/modules/core/03-connection/types" diff --git a/modules/core/04-channel/types/msgs_test.go b/modules/core/04-channel/types/msgs_test.go index 4113342f82e..92c260eb31e 100644 --- a/modules/core/04-channel/types/msgs_test.go +++ b/modules/core/04-channel/types/msgs_test.go @@ -4,11 +4,14 @@ import ( "fmt" "testing" - sdk "github.com/line/lbm-sdk/types" "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" dbm "github.com/tendermint/tm-db" - abci "github.com/line/ostracon/abci/types" + "github.com/line/lbm-sdk/store/iavl" + "github.com/line/lbm-sdk/store/rootmulti" + storetypes "github.com/line/lbm-sdk/store/types" + sdk "github.com/line/lbm-sdk/types" "github.com/line/ostracon/libs/log" clienttypes "github.com/line/ibc-go/v3/modules/core/02-client/types" @@ -16,9 +19,6 @@ import ( commitmenttypes "github.com/line/ibc-go/v3/modules/core/23-commitment/types" "github.com/line/ibc-go/v3/modules/core/exported" "github.com/line/ibc-go/v3/testing/simapp" - "github.com/line/lbm-sdk/store/iavl" - "github.com/line/lbm-sdk/store/rootmulti" - storetypes "github.com/line/lbm-sdk/store/types" ) const ( diff --git a/modules/core/05-port/keeper/keeper_test.go b/modules/core/05-port/keeper/keeper_test.go index 8947687ddde..958ca3e8179 100644 --- a/modules/core/05-port/keeper/keeper_test.go +++ b/modules/core/05-port/keeper/keeper_test.go @@ -3,10 +3,11 @@ package keeper_test import ( "testing" - sdk "github.com/line/lbm-sdk/types" - ocproto "github.com/line/ostracon/proto/ostracon/types" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + + sdk "github.com/line/lbm-sdk/types" "github.com/line/ibc-go/v3/modules/core/05-port/keeper" "github.com/line/ibc-go/v3/testing/simapp" @@ -28,7 +29,7 @@ func (suite *KeeperTestSuite) SetupTest() { isCheckTx := false app := simapp.Setup(isCheckTx) - suite.ctx = app.BaseApp.NewContext(isCheckTx, ocproto.Header{}) + suite.ctx = app.BaseApp.NewContext(isCheckTx, tmproto.Header{}) suite.keeper = &app.IBCKeeper.PortKeeper } diff --git a/modules/core/23-commitment/types/merkle.go b/modules/core/23-commitment/types/merkle.go index 8bf60742571..8e45fd121c5 100644 --- a/modules/core/23-commitment/types/merkle.go +++ b/modules/core/23-commitment/types/merkle.go @@ -7,8 +7,9 @@ import ( ics23 "github.com/confio/ics23/go" "github.com/gogo/protobuf/proto" + "github.com/tendermint/tendermint/proto/tendermint/crypto" + sdkerrors "github.com/line/lbm-sdk/types/errors" - occrypto "github.com/line/ostracon/proto/ostracon/crypto" "github.com/line/ibc-go/v3/modules/core/exported" ) @@ -273,7 +274,7 @@ func verifyChainedMembershipProof(root []byte, specs []*ics23.ProofSpec, proofs // and are declared as globals to avoid having to unnecessarily re-allocate on every comparison. var ( blankMerkleProof = &MerkleProof{} - blankProofOps = &occrypto.ProofOps{} + blankProofOps = &crypto.ProofOps{} ) // Empty returns true if the root is empty diff --git a/modules/core/23-commitment/types/merkle_test.go b/modules/core/23-commitment/types/merkle_test.go index 446c384b03a..8dc3d136187 100644 --- a/modules/core/23-commitment/types/merkle_test.go +++ b/modules/core/23-commitment/types/merkle_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - abci "github.com/line/ostracon/abci/types" "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" "github.com/line/ibc-go/v3/modules/core/23-commitment/types" ) diff --git a/modules/core/23-commitment/types/utils.go b/modules/core/23-commitment/types/utils.go index e5105eb7702..b08297ea780 100644 --- a/modules/core/23-commitment/types/utils.go +++ b/modules/core/23-commitment/types/utils.go @@ -2,8 +2,9 @@ package types import ( ics23 "github.com/confio/ics23/go" + "github.com/tendermint/tendermint/proto/tendermint/crypto" + sdkerrors "github.com/line/lbm-sdk/types/errors" - crypto "github.com/line/ostracon/proto/ostracon/crypto" ) // ConvertProofs converts crypto.ProofOps into MerkleProof diff --git a/modules/core/23-commitment/types/utils_test.go b/modules/core/23-commitment/types/utils_test.go index b60874682a2..1ab583006ad 100644 --- a/modules/core/23-commitment/types/utils_test.go +++ b/modules/core/23-commitment/types/utils_test.go @@ -3,9 +3,9 @@ package types_test import ( "fmt" - abci "github.com/line/ostracon/abci/types" - crypto "github.com/line/ostracon/proto/ostracon/crypto" "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/proto/tendermint/crypto" "github.com/line/ibc-go/v3/modules/core/23-commitment/types" ) diff --git a/modules/core/client/query.go b/modules/core/client/query.go index 4803afd52b9..74292ad3c42 100644 --- a/modules/core/client/query.go +++ b/modules/core/client/query.go @@ -3,9 +3,10 @@ package client import ( "fmt" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/line/lbm-sdk/client" "github.com/line/lbm-sdk/codec" - abci "github.com/line/ostracon/abci/types" clienttypes "github.com/line/ibc-go/v3/modules/core/02-client/types" commitmenttypes "github.com/line/ibc-go/v3/modules/core/23-commitment/types" diff --git a/modules/core/genesis_test.go b/modules/core/genesis_test.go index 3f641f56cbc..7fb2ba2e1e3 100644 --- a/modules/core/genesis_test.go +++ b/modules/core/genesis_test.go @@ -4,9 +4,10 @@ import ( "fmt" "testing" - "github.com/line/lbm-sdk/codec" - ocproto "github.com/line/ostracon/proto/ostracon/types" "github.com/stretchr/testify/suite" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + + "github.com/line/lbm-sdk/codec" ibc "github.com/line/ibc-go/v3/modules/core" clienttypes "github.com/line/ibc-go/v3/modules/core/02-client/types" @@ -59,7 +60,7 @@ func TestIBCTestSuite(t *testing.T) { } func (suite *IBCTestSuite) TestValidateGenesis() { - header := suite.chainA.CreateOCClientHeader(suite.chainA.ChainID, suite.chainA.CurrentHeader.Height, clienttypes.NewHeight(0, uint64(suite.chainA.CurrentHeader.Height-1)), suite.chainA.CurrentHeader.Time, suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Voters, suite.chainA.Voters, suite.chainA.Signers) + header := suite.chainA.CreateOCClientHeader(suite.chainA.ChainID, suite.chainA.CurrentHeader.Height, clienttypes.NewHeight(0, uint64(suite.chainA.CurrentHeader.Height-1)), suite.chainA.CurrentHeader.Time, suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers) testCases := []struct { name string @@ -225,7 +226,7 @@ func (suite *IBCTestSuite) TestValidateGenesis() { } func (suite *IBCTestSuite) TestInitGenesis() { - header := suite.chainA.CreateOCClientHeader(suite.chainA.ChainID, suite.chainA.CurrentHeader.Height, clienttypes.NewHeight(0, uint64(suite.chainA.CurrentHeader.Height-1)), suite.chainA.CurrentHeader.Time, suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Voters, suite.chainA.Voters, suite.chainA.Signers) + header := suite.chainA.CreateOCClientHeader(suite.chainA.ChainID, suite.chainA.CurrentHeader.Height, clienttypes.NewHeight(0, uint64(suite.chainA.CurrentHeader.Height-1)), suite.chainA.CurrentHeader.Time, suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers) testCases := []struct { name string @@ -320,7 +321,7 @@ func (suite *IBCTestSuite) TestInitGenesis() { app := simapp.Setup(false) suite.NotPanics(func() { - ibc.InitGenesis(app.BaseApp.NewContext(false, ocproto.Header{Height: 1}), *app.IBCKeeper, true, tc.genState) + ibc.InitGenesis(app.BaseApp.NewContext(false, tmproto.Header{Height: 1}), *app.IBCKeeper, true, tc.genState) }) } } diff --git a/modules/core/module.go b/modules/core/module.go index 9133679397b..2f38b68a586 100644 --- a/modules/core/module.go +++ b/modules/core/module.go @@ -7,8 +7,8 @@ import ( "math/rand" "github.com/grpc-ecosystem/grpc-gateway/runtime" - abci "github.com/line/ostracon/abci/types" "github.com/spf13/cobra" + abci "github.com/tendermint/tendermint/abci/types" "github.com/line/lbm-sdk/client" "github.com/line/lbm-sdk/codec" @@ -16,6 +16,7 @@ import ( sdk "github.com/line/lbm-sdk/types" "github.com/line/lbm-sdk/types/module" simtypes "github.com/line/lbm-sdk/types/simulation" + ocabci "github.com/line/ostracon/abci/types" ibcclient "github.com/line/ibc-go/v3/modules/core/02-client" clientkeeper "github.com/line/ibc-go/v3/modules/core/02-client/keeper" @@ -166,7 +167,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return 2 } // BeginBlock returns the begin blocker for the ibc module. -func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { +func (am AppModule) BeginBlock(ctx sdk.Context, req ocabci.RequestBeginBlock) { ibcclient.BeginBlocker(ctx, am.keeper.ClientKeeper) } diff --git a/modules/light-clients/09-localhost/types/localhost_test.go b/modules/light-clients/09-localhost/types/localhost_test.go index 3d7c9d157f0..ac5a57e4efb 100644 --- a/modules/light-clients/09-localhost/types/localhost_test.go +++ b/modules/light-clients/09-localhost/types/localhost_test.go @@ -3,10 +3,11 @@ package types_test import ( "testing" + "github.com/stretchr/testify/suite" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + "github.com/line/lbm-sdk/codec" sdk "github.com/line/lbm-sdk/types" - ocproto "github.com/line/ostracon/proto/ostracon/types" - "github.com/stretchr/testify/suite" clienttypes "github.com/line/ibc-go/v3/modules/core/02-client/types" "github.com/line/ibc-go/v3/modules/core/exported" @@ -32,7 +33,7 @@ func (suite *LocalhostTestSuite) SetupTest() { app := simapp.Setup(isCheckTx) suite.cdc = app.AppCodec() - suite.ctx = app.BaseApp.NewContext(isCheckTx, ocproto.Header{Height: 1, ChainID: "ibc-chain"}) + suite.ctx = app.BaseApp.NewContext(isCheckTx, tmproto.Header{Height: 1, ChainID: "ibc-chain"}) suite.store = app.IBCKeeper.ClientKeeper.ClientStore(suite.ctx, exported.Localhost) } diff --git a/modules/light-clients/99-ostracon/types/errors.go b/modules/light-clients/99-ostracon/types/errors.go index a7de88e3f2f..2be76ee678d 100644 --- a/modules/light-clients/99-ostracon/types/errors.go +++ b/modules/light-clients/99-ostracon/types/errors.go @@ -23,5 +23,4 @@ var ( ErrUnbondingPeriodExpired = sdkerrors.Register(SubModuleName, 12, "time since latest trusted state has passed the unbonding period") ErrInvalidProofSpecs = sdkerrors.Register(SubModuleName, 13, "invalid proof specs") ErrInvalidValidatorSet = sdkerrors.Register(SubModuleName, 14, "invalid validator set") - ErrInvalidVoterSet = sdkerrors.Register(SubModuleName, 99, "invalid voter set") ) diff --git a/modules/light-clients/99-ostracon/types/header_test.go b/modules/light-clients/99-ostracon/types/header_test.go index b0feabb3f76..70074547ca3 100644 --- a/modules/light-clients/99-ostracon/types/header_test.go +++ b/modules/light-clients/99-ostracon/types/header_test.go @@ -3,7 +3,7 @@ package types_test import ( "time" - ocprotocrypto "github.com/line/ostracon/proto/ostracon/crypto" + "github.com/tendermint/tendermint/proto/tendermint/crypto" clienttypes "github.com/line/ibc-go/v3/modules/core/02-client/types" "github.com/line/ibc-go/v3/modules/core/exported" @@ -48,7 +48,7 @@ func (suite *OstraconTestSuite) TestHeaderValidateBasic() { header.ValidatorSet = nil }, false}, {"ValidatorSetFromProto failed", func() { - header.ValidatorSet.Validators[0].PubKey = ocprotocrypto.PublicKey{} + header.ValidatorSet.Validators[0].PubKey = crypto.PublicKey{} }, false}, {"header validator hash does not equal hash of validator set", func() { // use chainB's randomly generated validator set diff --git a/modules/light-clients/99-ostracon/types/misbehaviour.go b/modules/light-clients/99-ostracon/types/misbehaviour.go index bb955f91ef1..7c8c6a20e75 100644 --- a/modules/light-clients/99-ostracon/types/misbehaviour.go +++ b/modules/light-clients/99-ostracon/types/misbehaviour.go @@ -3,8 +3,9 @@ package types import ( "time" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + sdkerrors "github.com/line/lbm-sdk/types/errors" - ocproto "github.com/line/ostracon/proto/ostracon/types" octypes "github.com/line/ostracon/types" clienttypes "github.com/line/ibc-go/v3/modules/core/02-client/types" @@ -64,15 +65,9 @@ func (misbehaviour Misbehaviour) ValidateBasic() error { if misbehaviour.Header1.TrustedValidators == nil { return sdkerrors.Wrap(ErrInvalidValidatorSet, "trusted validator set in Header1 cannot be empty") } - if misbehaviour.Header1.TrustedVoters == nil { - return sdkerrors.Wrap(ErrInvalidVoterSet, "trusted voter set in Header1 cannot be empty") - } if misbehaviour.Header2.TrustedValidators == nil { return sdkerrors.Wrap(ErrInvalidValidatorSet, "trusted validator set in Header2 cannot be empty") } - if misbehaviour.Header2.TrustedVoters == nil { - return sdkerrors.Wrap(ErrInvalidVoterSet, "trusted voter set in Header2 cannot be empty") - } if misbehaviour.Header1.Header.ChainID != misbehaviour.Header2.Header.ChainID { return sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "headers must have identical chainIDs") } @@ -109,29 +104,29 @@ func (misbehaviour Misbehaviour) ValidateBasic() error { } if err := validCommit(misbehaviour.Header1.Header.ChainID, *blockID1, - misbehaviour.Header1.Commit, misbehaviour.Header1.VoterSet); err != nil { + misbehaviour.Header1.Commit, misbehaviour.Header1.ValidatorSet); err != nil { return err } if err := validCommit(misbehaviour.Header2.Header.ChainID, *blockID2, - misbehaviour.Header2.Commit, misbehaviour.Header2.VoterSet); err != nil { + misbehaviour.Header2.Commit, misbehaviour.Header2.ValidatorSet); err != nil { return err } return nil } // validCommit checks if the given commit is a valid commit from the passed-in validatorset -func validCommit(chainID string, blockID octypes.BlockID, commit *ocproto.Commit, voterSet *ocproto.VoterSet) (err error) { +func validCommit(chainID string, blockID octypes.BlockID, commit *tmproto.Commit, valSet *tmproto.ValidatorSet) (err error) { tmCommit, err := octypes.CommitFromProto(commit) if err != nil { return sdkerrors.Wrap(err, "commit is not ostracon commit type") } - tmVoterSet, err := octypes.VoterSetFromProto(voterSet) + tmValset, err := octypes.ValidatorSetFromProto(valSet) if err != nil { return sdkerrors.Wrap(err, "validator set is not ostracon validator set type") } - if err := tmVoterSet.VerifyCommitLight(chainID, blockID, tmCommit.Height, tmCommit); err != nil { - return sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "voter set did not commit to header") + if err := tmValset.VerifyCommitLight(chainID, blockID, tmCommit.Height, tmCommit); err != nil { + return sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "validator set did not commit to header") } return nil diff --git a/modules/light-clients/99-ostracon/types/misbehaviour_handle.go b/modules/light-clients/99-ostracon/types/misbehaviour_handle.go index 04adabd1648..67a9b57db19 100644 --- a/modules/light-clients/99-ostracon/types/misbehaviour_handle.go +++ b/modules/light-clients/99-ostracon/types/misbehaviour_handle.go @@ -101,7 +101,7 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState( func checkMisbehaviourHeader( clientState *ClientState, consState *ConsensusState, header *Header, currentTimestamp time.Time, ) error { - tmTrustedVoterSet, err := octypes.VoterSetFromProto(header.TrustedVoters) + tmTrustedValset, err := octypes.ValidatorSetFromProto(header.TrustedValidators) if err != nil { return sdkerrors.Wrap(err, "trusted validator set is not ostracon validator set type") } @@ -134,7 +134,7 @@ func checkMisbehaviourHeader( // - ValidatorSet must have TrustLevel similarity with trusted FromValidatorSet // - ValidatorSets on both headers are valid given the last trusted ValidatorSet - if err := tmTrustedVoterSet.VerifyCommitLightTrusting( + if err := tmTrustedValset.VerifyCommitLightTrusting( chainID, tmCommit, clientState.TrustLevel.ToOstracon(), ); err != nil { return sdkerrors.Wrapf(clienttypes.ErrInvalidMisbehaviour, "validator set in header has too much change from trusted validator set: %v", err) diff --git a/modules/light-clients/99-ostracon/types/misbehaviour_handle_test.go b/modules/light-clients/99-ostracon/types/misbehaviour_handle_test.go index 390a8c2e05c..80838c7746c 100644 --- a/modules/light-clients/99-ostracon/types/misbehaviour_handle_test.go +++ b/modules/light-clients/99-ostracon/types/misbehaviour_handle_test.go @@ -24,7 +24,6 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { // Create bothValSet with both suite validator and altVal bothValSet := octypes.NewValidatorSet(append(suite.valSet.Validators, altVal)) - bothVoterSet := octypes.WrapValidatorsToVoterSet(bothValSet.Validators) // OSTRACON_CODE bothValsHash := bothValSet.Hash() // Create alternative validator set with only altVal altValSet := octypes.NewValidatorSet([]*octypes.Validator{altVal}) @@ -58,8 +57,8 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), + Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), ClientId: chainID, }, suite.now, @@ -73,8 +72,8 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+3), height, suite.now, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), + Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+3), height, suite.now, bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothSigners), ClientId: chainID, }, suite.now, @@ -88,8 +87,8 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+3), height, suite.now, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Hour), bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), + Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+3), height, suite.now, bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Hour), bothValSet, bothValSet, bothSigners), ClientId: chainID, }, suite.now, @@ -103,8 +102,8 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), heightMinus1, &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now.Add(time.Minute), bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), + Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), ClientId: chainID, }, suite.now, @@ -118,8 +117,8 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash), heightMinus3, &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus3, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothVoterSet, octypes.WrapValidatorsToVoterSet(suite.valSet.Validators), bothSigners), + Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus3, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners), ClientId: chainID, }, suite.now, @@ -133,8 +132,8 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash), heightMinus3, &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainIDRevision0, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(chainIDRevision0, int64(height.RevisionHeight+1), heightMinus3, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothVoterSet, octypes.WrapValidatorsToVoterSet(suite.valSet.Validators), bothSigners), + Header1: suite.chainA.CreateOCClientHeader(chainIDRevision0, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(chainIDRevision0, int64(height.RevisionHeight+1), heightMinus3, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners), ClientId: chainID, }, suite.now, @@ -148,8 +147,8 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash), heightMinus3, &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainIDRevision0, 3, heightMinus1, suite.now, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(chainIDRevision0, 3, heightMinus3, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothVoterSet, octypes.WrapValidatorsToVoterSet(suite.valSet.Validators), bothSigners), + Header1: suite.chainA.CreateOCClientHeader(chainIDRevision0, 3, heightMinus1, suite.now, bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(chainIDRevision0, 3, heightMinus3, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners), ClientId: chainID, }, suite.now, @@ -163,8 +162,8 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash), heightMinus3, &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainIDRevision1, 1, heightMinus1, suite.now, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(chainIDRevision1, 1, heightMinus3, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothVoterSet, octypes.WrapValidatorsToVoterSet(suite.valSet.Validators), bothSigners), + Header1: suite.chainA.CreateOCClientHeader(chainIDRevision1, 1, heightMinus1, suite.now, bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(chainIDRevision1, 1, heightMinus3, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners), ClientId: chainID, }, suite.now, @@ -178,8 +177,8 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash), height, &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, suite.valSet, bothVoterSet, octypes.WrapValidatorsToVoterSet(suite.valSet.Validators), bothSigners), - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothVoterSet, octypes.WrapValidatorsToVoterSet(suite.valSet.Validators), bothSigners), + Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, suite.valSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners), ClientId: chainID, }, suite.now, @@ -193,8 +192,8 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), + Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothSigners), ClientId: chainID, }, suite.now, @@ -208,8 +207,8 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+3), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), + Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+3), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothSigners), ClientId: chainID, }, suite.now, @@ -223,8 +222,8 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader("ethermint", int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader("ethermint", int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), + Header1: suite.chainA.CreateOCClientHeader("ethermint", int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader("ethermint", int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), ClientId: chainID, }, suite.now, @@ -238,8 +237,8 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash), heightMinus3, &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothVoterSet, octypes.WrapValidatorsToVoterSet(suite.valSet.Validators), bothSigners), + Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners), ClientId: chainID, }, suite.now, @@ -253,8 +252,8 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash), heightMinus3, &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus3, suite.now.Add(time.Minute), bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), + Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus3, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), ClientId: chainID, }, suite.now, @@ -268,8 +267,8 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), + Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), ClientId: chainID, }, suite.now, @@ -283,8 +282,8 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), + Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), ClientId: chainID, }, suite.now, @@ -309,8 +308,8 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now.Add(time.Minute), bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), + Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), ClientId: chainID, }, suite.now, @@ -324,8 +323,8 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), + Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), ClientId: chainID, }, suite.now.Add(trustingPeriod), @@ -339,8 +338,8 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, suite.valSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothVoterSet, octypes.WrapValidatorsToVoterSet(suite.valSet.Validators), bothSigners), + Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, suite.valSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners), ClientId: chainID, }, suite.now, @@ -354,8 +353,8 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, altValSet, bothValSet, octypes.WrapValidatorsToVoterSet(altValSet.Validators), bothVoterSet, altSigners), - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), + Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, altValSet, bothValSet, altSigners), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), ClientId: chainID, }, suite.now, @@ -369,8 +368,8 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners), - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), altValSet, bothValSet, octypes.WrapValidatorsToVoterSet(altValSet.Validators), bothVoterSet, altSigners), + Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, bothValSet, bothValSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), altValSet, bothValSet, altSigners), ClientId: chainID, }, suite.now, @@ -384,8 +383,8 @@ func (suite *OstraconTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash), height, &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, altValSet, bothValSet, octypes.WrapValidatorsToVoterSet(altValSet.Validators), bothVoterSet, altSigners), - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), altValSet, bothValSet, octypes.WrapValidatorsToVoterSet(altValSet.Validators), bothVoterSet, altSigners), + Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now, altValSet, bothValSet, altSigners), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight+1), height, suite.now.Add(time.Minute), altValSet, bothValSet, altSigners), ClientId: chainID, }, suite.now, diff --git a/modules/light-clients/99-ostracon/types/misbehaviour_test.go b/modules/light-clients/99-ostracon/types/misbehaviour_test.go index 782922b314e..075db6c55fe 100644 --- a/modules/light-clients/99-ostracon/types/misbehaviour_test.go +++ b/modules/light-clients/99-ostracon/types/misbehaviour_test.go @@ -3,8 +3,9 @@ package types_test import ( "time" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + "github.com/line/ostracon/crypto/tmhash" - ocproto "github.com/line/ostracon/proto/ostracon/types" octypes "github.com/line/ostracon/types" clienttypes "github.com/line/ibc-go/v3/modules/core/02-client/types" @@ -18,10 +19,9 @@ func (suite *OstraconTestSuite) TestMisbehaviour() { signers := []octypes.PrivValidator{suite.privVal} heightMinus1 := clienttypes.NewHeight(0, height.RevisionHeight-1) - voterSet := octypes.WrapValidatorsToVoterSet(suite.valSet.Validators) misbehaviour := &types.Misbehaviour{ Header1: suite.header, - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, voterSet, voterSet, signers), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, signers), ClientId: clientID, } @@ -53,9 +53,6 @@ func (suite *OstraconTestSuite) TestMisbehaviourValidateBasic() { heightMinus1 := clienttypes.NewHeight(0, height.RevisionHeight-1) - voterSet := octypes.WrapValidatorsToVoterSet(suite.valSet.Validators) - bothVoterSet := octypes.WrapValidatorsToVoterSet(bothValSet.Validators) - testCases := []struct { name string misbehaviour *types.Misbehaviour @@ -66,7 +63,7 @@ func (suite *OstraconTestSuite) TestMisbehaviourValidateBasic() { "valid fork misbehaviour, two headers at same height have different time", &types.Misbehaviour{ Header1: suite.header, - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, suite.valSet, voterSet, voterSet, signers), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, suite.valSet, signers), ClientId: clientID, }, func(misbehaviour *types.Misbehaviour) error { return nil }, @@ -75,7 +72,7 @@ func (suite *OstraconTestSuite) TestMisbehaviourValidateBasic() { { "valid time misbehaviour, both headers at different heights are at same time", &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, suite.valSet, voterSet, voterSet, signers), + Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, suite.valSet, signers), Header2: suite.header, ClientId: clientID, }, @@ -98,7 +95,7 @@ func (suite *OstraconTestSuite) TestMisbehaviourValidateBasic() { "valid misbehaviour with different trusted headers", &types.Misbehaviour{ Header1: suite.header, - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), clienttypes.NewHeight(0, height.RevisionHeight-3), suite.now.Add(time.Minute), suite.valSet, bothValSet, voterSet, bothVoterSet, signers), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), clienttypes.NewHeight(0, height.RevisionHeight-3), suite.now.Add(time.Minute), suite.valSet, bothValSet, signers), ClientId: clientID, }, func(misbehaviour *types.Misbehaviour) error { return nil }, @@ -107,7 +104,7 @@ func (suite *OstraconTestSuite) TestMisbehaviourValidateBasic() { { "trusted height is 0 in Header1", &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), clienttypes.ZeroHeight(), suite.now.Add(time.Minute), suite.valSet, suite.valSet, voterSet, voterSet, signers), + Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), clienttypes.ZeroHeight(), suite.now.Add(time.Minute), suite.valSet, suite.valSet, signers), Header2: suite.header, ClientId: clientID, }, @@ -118,7 +115,7 @@ func (suite *OstraconTestSuite) TestMisbehaviourValidateBasic() { "trusted height is 0 in Header2", &types.Misbehaviour{ Header1: suite.header, - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), clienttypes.ZeroHeight(), suite.now.Add(time.Minute), suite.valSet, suite.valSet, voterSet, voterSet, signers), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), clienttypes.ZeroHeight(), suite.now.Add(time.Minute), suite.valSet, suite.valSet, signers), ClientId: clientID, }, func(misbehaviour *types.Misbehaviour) error { return nil }, @@ -127,7 +124,7 @@ func (suite *OstraconTestSuite) TestMisbehaviourValidateBasic() { { "trusted valset is nil in Header1", &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, nil, voterSet, nil, signers), + Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, nil, signers), Header2: suite.header, ClientId: clientID, }, @@ -138,7 +135,7 @@ func (suite *OstraconTestSuite) TestMisbehaviourValidateBasic() { "trusted valset is nil in Header2", &types.Misbehaviour{ Header1: suite.header, - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, nil, voterSet, nil, signers), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, nil, signers), ClientId: clientID, }, func(misbehaviour *types.Misbehaviour) error { return nil }, @@ -148,7 +145,7 @@ func (suite *OstraconTestSuite) TestMisbehaviourValidateBasic() { "invalid client ID ", &types.Misbehaviour{ Header1: suite.header, - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, voterSet, voterSet, signers), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, signers), ClientId: "GAIA", }, func(misbehaviour *types.Misbehaviour) error { return nil }, @@ -158,7 +155,7 @@ func (suite *OstraconTestSuite) TestMisbehaviourValidateBasic() { "chainIDs do not match", &types.Misbehaviour{ Header1: suite.header, - Header2: suite.chainA.CreateOCClientHeader("ethermint", int64(height.RevisionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, voterSet, voterSet, signers), + Header2: suite.chainA.CreateOCClientHeader("ethermint", int64(height.RevisionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, signers), ClientId: clientID, }, func(misbehaviour *types.Misbehaviour) error { return nil }, @@ -168,7 +165,7 @@ func (suite *OstraconTestSuite) TestMisbehaviourValidateBasic() { "header2 height is greater", &types.Misbehaviour{ Header1: suite.header, - Header2: suite.chainA.CreateOCClientHeader(chainID, 6, clienttypes.NewHeight(0, height.RevisionHeight+1), suite.now, suite.valSet, suite.valSet, voterSet, voterSet, signers), + Header2: suite.chainA.CreateOCClientHeader(chainID, 6, clienttypes.NewHeight(0, height.RevisionHeight+1), suite.now, suite.valSet, suite.valSet, signers), ClientId: clientID, }, func(misbehaviour *types.Misbehaviour) error { return nil }, @@ -177,13 +174,13 @@ func (suite *OstraconTestSuite) TestMisbehaviourValidateBasic() { { "header 1 doesn't have 2/3 majority", &types.Misbehaviour{ - Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, suite.valSet, bothVoterSet, voterSet, bothSigners), + Header1: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, suite.valSet, bothSigners), Header2: suite.header, ClientId: clientID, }, func(misbehaviour *types.Misbehaviour) error { // voteSet contains only altVal which is less than 2/3 of total power (height/1height) - wrongVoteSet := octypes.NewVoteSet(chainID, int64(misbehaviour.Header1.GetHeight().GetRevisionHeight()), 1, ocproto.PrecommitType, octypes.WrapValidatorsToVoterSet(altValSet.Validators)) + wrongVoteSet := octypes.NewVoteSet(chainID, int64(misbehaviour.Header1.GetHeight().GetRevisionHeight()), 1, tmproto.PrecommitType, altValSet) blockID, err := octypes.BlockIDFromProto(&misbehaviour.Header1.Commit.BlockID) if err != nil { return err @@ -199,12 +196,12 @@ func (suite *OstraconTestSuite) TestMisbehaviourValidateBasic() { "header 2 doesn't have 2/3 majority", &types.Misbehaviour{ Header1: suite.header, - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, suite.valSet, bothVoterSet, voterSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, suite.valSet, bothSigners), ClientId: clientID, }, func(misbehaviour *types.Misbehaviour) error { // voteSet contains only altVal which is less than 2/3 of total power (height/1height) - wrongVoteSet := octypes.NewVoteSet(chainID, int64(misbehaviour.Header2.GetHeight().GetRevisionHeight()), 1, ocproto.PrecommitType, octypes.WrapValidatorsToVoterSet(altValSet.Validators)) + wrongVoteSet := octypes.NewVoteSet(chainID, int64(misbehaviour.Header2.GetHeight().GetRevisionHeight()), 1, tmproto.PrecommitType, altValSet) blockID, err := octypes.BlockIDFromProto(&misbehaviour.Header2.Commit.BlockID) if err != nil { return err @@ -220,7 +217,7 @@ func (suite *OstraconTestSuite) TestMisbehaviourValidateBasic() { "validators sign off on wrong commit", &types.Misbehaviour{ Header1: suite.header, - Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, suite.valSet, bothVoterSet, voterSet, bothSigners), + Header2: suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, suite.valSet, bothSigners), ClientId: clientID, }, func(misbehaviour *types.Misbehaviour) error { diff --git a/modules/light-clients/99-ostracon/types/ostracon.pb.go b/modules/light-clients/99-ostracon/types/ostracon.pb.go index 7f2f02d9238..36408229bf0 100644 --- a/modules/light-clients/99-ostracon/types/ostracon.pb.go +++ b/modules/light-clients/99-ostracon/types/ostracon.pb.go @@ -12,7 +12,7 @@ import ( types "github.com/line/ibc-go/v3/modules/core/02-client/types" types1 "github.com/line/ibc-go/v3/modules/core/23-commitment/types" github_com_line_ostracon_libs_bytes "github.com/line/ostracon/libs/bytes" - types2 "github.com/line/ostracon/proto/ostracon/types" + types2 "github.com/tendermint/tendermint/proto/tendermint/types" _ "google.golang.org/protobuf/types/known/durationpb" _ "google.golang.org/protobuf/types/known/timestamppb" io "io" @@ -198,10 +198,8 @@ var xxx_messageInfo_Misbehaviour proto.InternalMessageInfo type Header struct { *types2.SignedHeader `protobuf:"bytes,1,opt,name=signed_header,json=signedHeader,proto3,embedded=signed_header" json:"signed_header,omitempty" yaml:"signed_header"` ValidatorSet *types2.ValidatorSet `protobuf:"bytes,2,opt,name=validator_set,json=validatorSet,proto3" json:"validator_set,omitempty" yaml:"validator_set"` - VoterSet *types2.VoterSet `protobuf:"bytes,3,opt,name=voter_set,json=voterSet,proto3" json:"voter_set,omitempty" yaml:"voter_set"` - TrustedHeight types.Height `protobuf:"bytes,4,opt,name=trusted_height,json=trustedHeight,proto3" json:"trusted_height" yaml:"trusted_height"` - TrustedValidators *types2.ValidatorSet `protobuf:"bytes,5,opt,name=trusted_validators,json=trustedValidators,proto3" json:"trusted_validators,omitempty" yaml:"trusted_validators"` - TrustedVoters *types2.VoterSet `protobuf:"bytes,6,opt,name=trusted_voters,json=trustedVoters,proto3" json:"trusted_voters,omitempty" yaml:"trusted_voters"` + TrustedHeight types.Height `protobuf:"bytes,3,opt,name=trusted_height,json=trustedHeight,proto3" json:"trusted_height" yaml:"trusted_height"` + TrustedValidators *types2.ValidatorSet `protobuf:"bytes,4,opt,name=trusted_validators,json=trustedValidators,proto3" json:"trusted_validators,omitempty" yaml:"trusted_validators"` } func (m *Header) Reset() { *m = Header{} } @@ -244,13 +242,6 @@ func (m *Header) GetValidatorSet() *types2.ValidatorSet { return nil } -func (m *Header) GetVoterSet() *types2.VoterSet { - if m != nil { - return m.VoterSet - } - return nil -} - func (m *Header) GetTrustedHeight() types.Height { if m != nil { return m.TrustedHeight @@ -265,13 +256,6 @@ func (m *Header) GetTrustedValidators() *types2.ValidatorSet { return nil } -func (m *Header) GetTrustedVoters() *types2.VoterSet { - if m != nil { - return m.TrustedVoters - } - return nil -} - // Fraction defines the protobuf message type for tmmath.Fraction that only // supports positive values. type Fraction struct { @@ -339,78 +323,75 @@ func init() { } var fileDescriptor_049a55681d0db341 = []byte{ - // 1128 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xbf, 0x73, 0x1b, 0x45, - 0x14, 0xb6, 0x1c, 0x11, 0x4b, 0x2b, 0x39, 0x0e, 0x87, 0x49, 0xce, 0x42, 0xd1, 0x69, 0x0e, 0x26, - 0x78, 0x86, 0xe4, 0x6e, 0x24, 0x57, 0xf1, 0xd0, 0xe4, 0x1c, 0x18, 0x1b, 0xc8, 0xe0, 0x39, 0x43, - 0x8a, 0x64, 0x98, 0x63, 0x75, 0xb7, 0x92, 0x96, 0xdc, 0xdd, 0xde, 0xdc, 0xae, 0x84, 0x4d, 0x47, - 0xc7, 0x0c, 0x4d, 0x4a, 0x0a, 0x0a, 0xfe, 0x11, 0xfa, 0x94, 0x2e, 0xa9, 0x04, 0x63, 0x77, 0x94, - 0x2a, 0xa9, 0x98, 0xfd, 0x71, 0x3f, 0x24, 0xc7, 0xce, 0xb8, 0xd1, 0xec, 0xdb, 0xf7, 0xbd, 0xef, - 0xd3, 0x7b, 0xfb, 0xf6, 0xed, 0x81, 0x4f, 0xf0, 0xc0, 0xb7, 0x43, 0x3c, 0x1a, 0x33, 0x3f, 0xc4, - 0x28, 0x66, 0xd4, 0x26, 0x94, 0xa5, 0xd0, 0x27, 0xb1, 0x3d, 0xed, 0xe5, 0x6b, 0x2b, 0x49, 0x09, - 0x23, 0x5a, 0x1b, 0x0f, 0x7c, 0xab, 0x0c, 0xb6, 0x72, 0xc0, 0xb4, 0xd7, 0xea, 0xe4, 0x91, 0xec, - 0x24, 0x41, 0xd4, 0x9e, 0xc2, 0x10, 0x07, 0x90, 0x91, 0x54, 0x46, 0xb7, 0x5a, 0xcb, 0x7e, 0xc2, - 0xd0, 0x65, 0x3e, 0xf1, 0xab, 0x7c, 0xcd, 0x24, 0x25, 0x64, 0x98, 0x59, 0x9d, 0x11, 0x21, 0xa3, - 0x10, 0xd9, 0xc2, 0x1a, 0x4c, 0x86, 0x76, 0x30, 0x49, 0x21, 0xc3, 0xd9, 0x7f, 0x6c, 0x19, 0xcb, - 0x7e, 0x86, 0x23, 0x44, 0x19, 0x8c, 0x92, 0x0c, 0xc0, 0x33, 0xf6, 0x49, 0x8a, 0x6c, 0x99, 0x04, - 0xcf, 0x53, 0xae, 0x14, 0xe0, 0xe3, 0x02, 0x40, 0xa2, 0x08, 0xb3, 0x28, 0x03, 0xe5, 0x96, 0x02, - 0x6e, 0x8e, 0xc8, 0x88, 0x88, 0xa5, 0xcd, 0x57, 0x72, 0xd7, 0xfc, 0x77, 0x0d, 0x34, 0xf6, 0x04, - 0xdf, 0x11, 0x83, 0x0c, 0x69, 0x5b, 0xa0, 0xe6, 0x8f, 0x21, 0x8e, 0x3d, 0x1c, 0xe8, 0x95, 0x6e, - 0x65, 0xbb, 0xee, 0xae, 0x09, 0xfb, 0x20, 0xd0, 0x7c, 0xd0, 0x60, 0xe9, 0x84, 0x32, 0x2f, 0x44, - 0x53, 0x14, 0xea, 0xab, 0xdd, 0xca, 0x76, 0xa3, 0x7f, 0xdf, 0xba, 0xaa, 0xca, 0xd6, 0xe7, 0x29, - 0xf4, 0x79, 0xba, 0x4e, 0xeb, 0xf5, 0xcc, 0x58, 0x99, 0xcf, 0x0c, 0xed, 0x04, 0x46, 0xe1, 0xae, - 0x59, 0x22, 0x32, 0x5d, 0x20, 0xac, 0xaf, 0xb8, 0xa1, 0x0d, 0xc1, 0x86, 0xb0, 0x70, 0x3c, 0xf2, - 0x12, 0x94, 0x62, 0x12, 0xe8, 0x37, 0x84, 0xd0, 0x96, 0x25, 0x4b, 0x65, 0x65, 0xa5, 0xb2, 0x9e, - 0xa8, 0x52, 0x3a, 0xa6, 0xe2, 0xbe, 0x53, 0xe2, 0x2e, 0xe2, 0xcd, 0xdf, 0xfe, 0x36, 0x2a, 0xee, - 0xad, 0x6c, 0xf7, 0x50, 0x6c, 0x6a, 0x18, 0xdc, 0x9e, 0xc4, 0x03, 0x12, 0x07, 0x25, 0xa1, 0xea, - 0xdb, 0x84, 0x3e, 0x54, 0x42, 0x77, 0xa5, 0xd0, 0x32, 0x81, 0x54, 0xda, 0xc8, 0xb7, 0x95, 0x14, - 0x02, 0x1b, 0x11, 0x3c, 0xf6, 0xfc, 0x90, 0xf8, 0x2f, 0xbd, 0x20, 0xc5, 0x43, 0xa6, 0xbf, 0x73, - 0xcd, 0x94, 0x96, 0xe2, 0xa5, 0xd0, 0x7a, 0x04, 0x8f, 0xf7, 0xf8, 0xe6, 0x13, 0xbe, 0xa7, 0x7d, - 0x07, 0xd6, 0x87, 0x29, 0xf9, 0x09, 0xc5, 0xde, 0x18, 0xf1, 0xe3, 0xd0, 0x6f, 0x0a, 0x91, 0x96, - 0x38, 0x20, 0xde, 0x20, 0x96, 0xea, 0x9b, 0x69, 0xcf, 0xda, 0x17, 0x08, 0xa7, 0xad, 0x54, 0x36, - 0xa5, 0xca, 0x42, 0xb8, 0xe9, 0x36, 0xa5, 0x2d, 0xb1, 0x9c, 0x3e, 0x84, 0x0c, 0x51, 0x96, 0xd1, - 0xaf, 0x5d, 0x97, 0x7e, 0x21, 0xdc, 0x74, 0x9b, 0xd2, 0x56, 0xf4, 0x07, 0xa0, 0x21, 0x2e, 0x8e, - 0x47, 0x13, 0xe4, 0x53, 0xbd, 0xd6, 0xbd, 0xb1, 0xdd, 0xe8, 0xdf, 0xb6, 0xb0, 0x4f, 0xfb, 0x3b, - 0xd6, 0x21, 0xf7, 0x1c, 0x25, 0xc8, 0x77, 0xee, 0x14, 0x2d, 0x54, 0x82, 0x9b, 0x2e, 0x48, 0x32, - 0x08, 0xd5, 0x76, 0x41, 0x73, 0x92, 0x8c, 0x52, 0x18, 0x20, 0x2f, 0x81, 0x6c, 0xac, 0xd7, 0xbb, - 0x37, 0xb6, 0xeb, 0xce, 0xdd, 0xf9, 0xcc, 0x78, 0x4f, 0x9d, 0x5b, 0xc9, 0x6b, 0xba, 0x0d, 0x65, - 0x1e, 0x42, 0x36, 0xd6, 0x20, 0xd8, 0x82, 0x61, 0x48, 0x7e, 0xf4, 0x26, 0x49, 0x00, 0x19, 0xf2, - 0xe0, 0x90, 0xa1, 0xd4, 0x43, 0xc7, 0x09, 0x4e, 0x4f, 0x74, 0xd0, 0xad, 0x6c, 0xd7, 0x9c, 0xfb, - 0xf3, 0x99, 0xd1, 0x95, 0x44, 0x97, 0x42, 0x4d, 0xbd, 0xe2, 0xde, 0x11, 0xde, 0x6f, 0x85, 0xf3, - 0x31, 0xf7, 0x7d, 0x26, 0x5c, 0x1a, 0x05, 0xc6, 0x1b, 0xe2, 0x22, 0x4c, 0x07, 0x68, 0x0c, 0xa7, - 0x98, 0x4c, 0x52, 0xbd, 0x21, 0x84, 0x1e, 0xcc, 0x67, 0xc6, 0xfd, 0x4b, 0x85, 0xca, 0x01, 0x5c, - 0xae, 0xbd, 0x2c, 0xf7, 0xb4, 0x04, 0xd8, 0xad, 0xfe, 0xf2, 0x87, 0xb1, 0x62, 0xfe, 0xbe, 0x0a, - 0x6e, 0xed, 0x91, 0x98, 0xa2, 0x98, 0x4e, 0xa8, 0xbc, 0xef, 0x0e, 0xa8, 0xe7, 0x23, 0x47, 0x5c, - 0x78, 0x7e, 0xa4, 0xcb, 0x6d, 0xf9, 0x4d, 0x86, 0x70, 0x6a, 0xfc, 0x48, 0x5f, 0xf1, 0xee, 0x2b, - 0xc2, 0xb4, 0x4f, 0x41, 0x35, 0x25, 0x84, 0xa9, 0x89, 0x60, 0x96, 0x3a, 0xa2, 0x98, 0x41, 0xd3, - 0x9e, 0xf5, 0x14, 0xa5, 0x2f, 0x43, 0xe4, 0x12, 0xc2, 0x9c, 0x2a, 0xa7, 0x71, 0x45, 0x94, 0xf6, - 0x73, 0x05, 0x6c, 0xc6, 0xe8, 0x98, 0x79, 0xf9, 0x04, 0xa6, 0xde, 0x18, 0xd2, 0xb1, 0xb8, 0xf7, - 0x4d, 0xe7, 0xeb, 0xf9, 0xcc, 0xf8, 0x40, 0x56, 0xe1, 0x4d, 0x28, 0xf3, 0xbf, 0x99, 0xf1, 0x60, - 0x84, 0xd9, 0x78, 0x32, 0xe0, 0x72, 0x76, 0x88, 0x63, 0x54, 0x3c, 0x0a, 0x21, 0x1e, 0x50, 0x7b, - 0x70, 0xc2, 0x10, 0xb5, 0xf6, 0xd1, 0xb1, 0xc3, 0x17, 0xae, 0xc6, 0x69, 0x9e, 0xe5, 0x2c, 0xfb, - 0x90, 0x8e, 0x55, 0x79, 0x7e, 0x5d, 0x05, 0xcd, 0x72, 0xd5, 0xb4, 0x1d, 0x50, 0x97, 0x4d, 0x9d, - 0x4f, 0x43, 0xd1, 0x80, 0xb7, 0xe5, 0xdf, 0xc9, 0x5d, 0xbc, 0xfc, 0x35, 0x69, 0x1d, 0x04, 0x9a, - 0x07, 0x6a, 0x63, 0x04, 0x03, 0x94, 0x7a, 0x3d, 0x55, 0x91, 0x8f, 0xae, 0x9e, 0x91, 0xfb, 0x02, - 0xed, 0x74, 0xce, 0x66, 0xc6, 0x9a, 0x5c, 0xf7, 0xe6, 0x33, 0x63, 0x43, 0x8a, 0x64, 0x54, 0xa6, - 0xbb, 0x26, 0x97, 0xbd, 0x92, 0x40, 0x5f, 0xcd, 0xc6, 0x6b, 0x0b, 0xf4, 0x2f, 0x08, 0xf4, 0x73, - 0x81, 0xbe, 0xaa, 0xc6, 0x9f, 0x55, 0x70, 0x53, 0xa2, 0x35, 0x0f, 0xac, 0x53, 0x3c, 0x8a, 0x51, - 0xe0, 0x49, 0x88, 0x6a, 0x94, 0x76, 0xa1, 0x22, 0x5f, 0xc0, 0x23, 0x01, 0x52, 0x72, 0xed, 0xd3, - 0x99, 0x51, 0x29, 0x6e, 0xff, 0x02, 0x81, 0xe9, 0x36, 0x69, 0x09, 0xab, 0xbd, 0x00, 0xeb, 0xf9, - 0xb9, 0x7a, 0x14, 0x65, 0xad, 0x74, 0x41, 0x20, 0x3f, 0xb6, 0x23, 0xc4, 0x1c, 0xbd, 0x20, 0x5f, - 0x08, 0x36, 0xdd, 0xe6, 0xb4, 0x84, 0xd3, 0xbe, 0x04, 0x75, 0xf1, 0x78, 0x0b, 0x62, 0x59, 0x30, - 0xfd, 0x02, 0x31, 0x07, 0x70, 0xd2, 0xcd, 0xe2, 0x7c, 0xf3, 0x20, 0xd3, 0xad, 0x4d, 0x95, 0x5f, - 0xfb, 0x1e, 0xc8, 0x97, 0x44, 0xa4, 0x22, 0xe6, 0x60, 0xf5, 0xad, 0x73, 0xf0, 0x9e, 0x9a, 0x83, - 0xef, 0x97, 0xde, 0xa7, 0x3c, 0xde, 0x74, 0xd7, 0xd5, 0x86, 0x9a, 0x84, 0x3f, 0x00, 0x2d, 0x43, - 0x14, 0xbd, 0xae, 0x5e, 0x8c, 0xab, 0x0b, 0x72, 0x6f, 0x3e, 0x33, 0xb6, 0x16, 0x35, 0x0a, 0x06, - 0xd3, 0x7d, 0x57, 0x6d, 0x16, 0xbd, 0xaf, 0x3d, 0x2f, 0xb2, 0x11, 0x19, 0x52, 0xf5, 0x68, 0x5c, - 0x5e, 0x9f, 0xad, 0x8b, 0x79, 0xc8, 0xc8, 0x22, 0x8f, 0x67, 0xd2, 0xfe, 0x02, 0xd4, 0xb2, 0xd7, - 0x5f, 0x6b, 0x83, 0x7a, 0x3c, 0x89, 0x50, 0xca, 0x55, 0x45, 0xf3, 0x54, 0xdd, 0x62, 0x43, 0xeb, - 0x82, 0x46, 0x80, 0x62, 0x12, 0xe1, 0x58, 0xf8, 0x57, 0x85, 0xbf, 0xbc, 0xe5, 0xbc, 0x78, 0x7d, - 0xd6, 0xa9, 0x9c, 0x9e, 0x75, 0x2a, 0xff, 0x9c, 0x75, 0x2a, 0xaf, 0xce, 0x3b, 0x2b, 0xa7, 0xe7, - 0x9d, 0x95, 0xbf, 0xce, 0x3b, 0x2b, 0xcf, 0x1f, 0x2f, 0xdf, 0x7d, 0x3c, 0xf0, 0x1f, 0x8e, 0x88, - 0x3d, 0xdd, 0xb1, 0x23, 0x12, 0x4c, 0x42, 0x44, 0xe5, 0xf7, 0xe2, 0xc3, 0xec, 0x83, 0xf1, 0xd1, - 0xa3, 0x87, 0x8b, 0x5f, 0x6f, 0x83, 0x9b, 0x62, 0xce, 0xed, 0xfc, 0x1f, 0x00, 0x00, 0xff, 0xff, - 0xcd, 0x65, 0x06, 0x68, 0x5d, 0x0a, 0x00, 0x00, + // 1085 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xcf, 0x6f, 0xe3, 0xc4, + 0x17, 0x6f, 0xda, 0x7e, 0xdb, 0x64, 0x92, 0x6e, 0xfb, 0x35, 0xa5, 0x9b, 0x96, 0x6c, 0x1c, 0x19, + 0x54, 0x2a, 0xb1, 0xb5, 0x95, 0xf4, 0xb4, 0x15, 0x97, 0x75, 0x17, 0xd4, 0x22, 0x56, 0x54, 0x2e, + 0x70, 0x00, 0x21, 0x33, 0xb1, 0x27, 0xc9, 0x68, 0x6d, 0x8f, 0xe5, 0x19, 0x87, 0x96, 0x1b, 0x37, + 0x24, 0x2e, 0x7b, 0x44, 0x88, 0x03, 0x7f, 0xce, 0x1e, 0x7b, 0xe4, 0x64, 0x50, 0x7b, 0xe3, 0x98, + 0x23, 0x27, 0x34, 0x3f, 0xfc, 0xa3, 0xd9, 0xee, 0x56, 0xbd, 0x44, 0xf3, 0xde, 0xfb, 0xbc, 0xcf, + 0xc7, 0xf3, 0xe6, 0xcd, 0x9b, 0x80, 0x8f, 0xf0, 0xd0, 0xb3, 0x02, 0x3c, 0x9e, 0x30, 0x2f, 0xc0, + 0x28, 0x62, 0xd4, 0x22, 0x94, 0x25, 0xd0, 0x23, 0x91, 0x35, 0xed, 0x17, 0x6b, 0x33, 0x4e, 0x08, + 0x23, 0x5a, 0x07, 0x0f, 0x3d, 0xb3, 0x0a, 0x36, 0x0b, 0xc0, 0xb4, 0xbf, 0xd3, 0x63, 0x28, 0xf2, + 0x51, 0x12, 0xe2, 0x88, 0x59, 0xec, 0x22, 0x46, 0xd4, 0x9a, 0xc2, 0x00, 0xfb, 0x90, 0x91, 0x44, + 0xe6, 0xef, 0x74, 0x5e, 0x43, 0x88, 0x5f, 0x15, 0x6d, 0xc5, 0x09, 0x21, 0xa3, 0xdc, 0xea, 0x8e, + 0x09, 0x19, 0x07, 0xc8, 0x12, 0xd6, 0x30, 0x1d, 0x59, 0x7e, 0x9a, 0x40, 0x86, 0xf3, 0x6f, 0xd9, + 0xd1, 0xe7, 0xe3, 0x0c, 0x87, 0x88, 0x32, 0x18, 0xc6, 0x39, 0x80, 0xef, 0xcc, 0x23, 0x09, 0xb2, + 0xe4, 0xc7, 0xf2, 0xfd, 0xc8, 0x95, 0x02, 0x7c, 0x58, 0x02, 0x48, 0x18, 0x62, 0x16, 0xe6, 0xa0, + 0xc2, 0x52, 0xc0, 0xcd, 0x31, 0x19, 0x13, 0xb1, 0xb4, 0xf8, 0x4a, 0x7a, 0x8d, 0x7f, 0x56, 0x41, + 0xf3, 0x48, 0xf0, 0x9d, 0x31, 0xc8, 0x90, 0xb6, 0x0d, 0xea, 0xde, 0x04, 0xe2, 0xc8, 0xc5, 0x7e, + 0xbb, 0xd6, 0xab, 0xed, 0x35, 0x9c, 0x55, 0x61, 0x9f, 0xf8, 0x9a, 0x07, 0x9a, 0x2c, 0x49, 0x29, + 0x73, 0x03, 0x34, 0x45, 0x41, 0x7b, 0xb1, 0x57, 0xdb, 0x6b, 0x0e, 0x76, 0xcd, 0xb7, 0x55, 0xd3, + 0xfc, 0x34, 0x81, 0x1e, 0xdf, 0xae, 0xbd, 0xf3, 0x2a, 0xd3, 0x17, 0x66, 0x99, 0xae, 0x5d, 0xc0, + 0x30, 0x38, 0x34, 0x2a, 0x44, 0x86, 0x03, 0x84, 0xf5, 0x39, 0x37, 0xb4, 0x11, 0x58, 0x17, 0x16, + 0x8e, 0xc6, 0x6e, 0x8c, 0x12, 0x4c, 0xfc, 0xf6, 0x92, 0x10, 0xda, 0x36, 0x65, 0xa9, 0xcc, 0xbc, + 0x54, 0xe6, 0x33, 0x55, 0x4a, 0xdb, 0x50, 0xdc, 0x5b, 0x15, 0xee, 0x32, 0xdf, 0xf8, 0xf5, 0x2f, + 0xbd, 0xe6, 0x3c, 0xc8, 0xbd, 0xa7, 0xc2, 0xa9, 0x61, 0xb0, 0x91, 0x46, 0x43, 0x12, 0xf9, 0x15, + 0xa1, 0xe5, 0xbb, 0x84, 0xde, 0x57, 0x42, 0x0f, 0xa5, 0xd0, 0x3c, 0x81, 0x54, 0x5a, 0x2f, 0xdc, + 0x4a, 0x0a, 0x81, 0xf5, 0x10, 0x9e, 0xbb, 0x5e, 0x40, 0xbc, 0x17, 0xae, 0x9f, 0xe0, 0x11, 0x6b, + 0xff, 0xef, 0x9e, 0x5b, 0x9a, 0xcb, 0x97, 0x42, 0x6b, 0x21, 0x3c, 0x3f, 0xe2, 0xce, 0x67, 0xdc, + 0xa7, 0x7d, 0x07, 0xd6, 0x46, 0x09, 0xf9, 0x11, 0x45, 0xee, 0x04, 0xf1, 0xe3, 0x68, 0xaf, 0x08, + 0x91, 0x1d, 0x71, 0x40, 0xbc, 0x41, 0x4c, 0xd5, 0x37, 0xd3, 0xbe, 0x79, 0x2c, 0x10, 0x76, 0x47, + 0xa9, 0x6c, 0x4a, 0x95, 0x1b, 0xe9, 0x86, 0xd3, 0x92, 0xb6, 0xc4, 0x72, 0xfa, 0x00, 0x32, 0x44, + 0x59, 0x4e, 0xbf, 0x7a, 0x5f, 0xfa, 0x1b, 0xe9, 0x86, 0xd3, 0x92, 0xb6, 0xa2, 0x3f, 0x01, 0x4d, + 0x71, 0x71, 0x5c, 0x1a, 0x23, 0x8f, 0xb6, 0xeb, 0xbd, 0xa5, 0xbd, 0xe6, 0x60, 0xc3, 0xc4, 0x1e, + 0x1d, 0x1c, 0x98, 0xa7, 0x3c, 0x72, 0x16, 0x23, 0xcf, 0xde, 0x2a, 0x5b, 0xa8, 0x02, 0x37, 0x1c, + 0x10, 0xe7, 0x10, 0xaa, 0x1d, 0x82, 0x56, 0x1a, 0x8f, 0x13, 0xe8, 0x23, 0x37, 0x86, 0x6c, 0xd2, + 0x6e, 0xf4, 0x96, 0xf6, 0x1a, 0xf6, 0xc3, 0x59, 0xa6, 0xbf, 0xa3, 0xce, 0xad, 0x12, 0x35, 0x9c, + 0xa6, 0x32, 0x4f, 0x21, 0x9b, 0x68, 0x10, 0x6c, 0xc3, 0x20, 0x20, 0x3f, 0xb8, 0x69, 0xec, 0x43, + 0x86, 0x5c, 0x38, 0x62, 0x28, 0x71, 0xd1, 0x79, 0x8c, 0x93, 0x8b, 0x36, 0xe8, 0xd5, 0xf6, 0xea, + 0xf6, 0xee, 0x2c, 0xd3, 0x7b, 0x92, 0xe8, 0x8d, 0x50, 0xa3, 0x5d, 0x73, 0xb6, 0x44, 0xf4, 0x2b, + 0x11, 0x7c, 0xca, 0x63, 0x9f, 0x88, 0x90, 0x46, 0x81, 0x7e, 0x4b, 0x5e, 0x88, 0xe9, 0x10, 0x4d, + 0xe0, 0x14, 0x93, 0x34, 0x69, 0x37, 0x85, 0xd0, 0xe3, 0x59, 0xa6, 0xef, 0xbe, 0x51, 0xa8, 0x9a, + 0xc0, 0xe5, 0x3a, 0xf3, 0x72, 0xcf, 0x2b, 0x80, 0xc3, 0xe5, 0x9f, 0xff, 0xd0, 0x17, 0x8c, 0xdf, + 0x17, 0xc1, 0x83, 0x23, 0x12, 0x51, 0x14, 0xd1, 0x94, 0xca, 0xfb, 0x6e, 0x83, 0x46, 0x31, 0x72, + 0xc4, 0x85, 0xe7, 0x47, 0x3a, 0xdf, 0x96, 0x5f, 0xe6, 0x08, 0xbb, 0xce, 0x8f, 0xf4, 0x25, 0xef, + 0xbe, 0x32, 0x4d, 0xfb, 0x18, 0x2c, 0x27, 0x84, 0x30, 0x35, 0x11, 0x8c, 0x4a, 0x47, 0x94, 0x33, + 0x68, 0xda, 0x37, 0x9f, 0xa3, 0xe4, 0x45, 0x80, 0x1c, 0x42, 0x98, 0xbd, 0xcc, 0x69, 0x1c, 0x91, + 0xa5, 0xfd, 0x54, 0x03, 0x9b, 0x11, 0x3a, 0x67, 0x6e, 0x31, 0x67, 0xa9, 0x3b, 0x81, 0x74, 0x22, + 0xee, 0x7d, 0xcb, 0xfe, 0x62, 0x96, 0xe9, 0xef, 0xc9, 0x2a, 0xdc, 0x86, 0x32, 0xfe, 0xcd, 0xf4, + 0xc7, 0x63, 0xcc, 0x26, 0xe9, 0x90, 0xcb, 0x59, 0x01, 0x8e, 0x50, 0x39, 0xfc, 0x03, 0x3c, 0xa4, + 0xd6, 0xf0, 0x82, 0x21, 0x6a, 0x1e, 0xa3, 0x73, 0x9b, 0x2f, 0x1c, 0x8d, 0xd3, 0x7c, 0x5d, 0xb0, + 0x1c, 0x43, 0x3a, 0x51, 0xe5, 0xf9, 0x65, 0x11, 0xb4, 0xaa, 0x55, 0xd3, 0x0e, 0x40, 0x43, 0x36, + 0x75, 0x31, 0x0d, 0x45, 0x03, 0x6e, 0xc8, 0xcf, 0x29, 0x42, 0xbc, 0xfc, 0x75, 0x69, 0x9d, 0xf8, + 0x9a, 0x0b, 0xea, 0x13, 0x04, 0x7d, 0x94, 0xb8, 0x7d, 0x55, 0x91, 0x0f, 0xde, 0x3e, 0x23, 0x8f, + 0x05, 0xda, 0xee, 0x5e, 0x65, 0xfa, 0xaa, 0x5c, 0xf7, 0x67, 0x99, 0xbe, 0x2e, 0x45, 0x72, 0x2a, + 0xc3, 0x59, 0x95, 0xcb, 0x7e, 0x45, 0x60, 0xa0, 0x66, 0xe3, 0xbd, 0x05, 0x06, 0xaf, 0x09, 0x0c, + 0x0a, 0x81, 0x81, 0xaa, 0xc6, 0x6f, 0x4b, 0x60, 0x45, 0xa2, 0x35, 0x08, 0xd6, 0x28, 0x1e, 0x47, + 0xc8, 0x77, 0x25, 0x44, 0x35, 0x4a, 0xd7, 0x2c, 0x5f, 0x42, 0x53, 0xbe, 0x81, 0x67, 0x02, 0xa6, + 0x04, 0x3b, 0x97, 0x99, 0x5e, 0x2b, 0xef, 0xff, 0x0d, 0x0a, 0xc3, 0x69, 0xd1, 0x0a, 0x96, 0x8f, + 0x97, 0xe2, 0x64, 0x5d, 0x8a, 0xf2, 0x66, 0xba, 0x45, 0xa2, 0x38, 0xba, 0x33, 0xc4, 0xec, 0x76, + 0x49, 0x7f, 0x23, 0xdd, 0x70, 0x5a, 0xd3, 0x0a, 0x4e, 0xfb, 0x1e, 0xc8, 0x07, 0x40, 0xe8, 0x8b, + 0xf1, 0xb5, 0x74, 0xe7, 0xf8, 0x7a, 0xa4, 0xc6, 0xd7, 0xbb, 0x95, 0x67, 0xa5, 0xc8, 0x37, 0x9c, + 0x35, 0xe5, 0x50, 0x03, 0x2c, 0x00, 0x5a, 0x8e, 0x28, 0x5b, 0x54, 0x3d, 0x29, 0x77, 0xed, 0xe2, + 0xd1, 0x2c, 0xd3, 0xb7, 0x6f, 0xaa, 0x94, 0x1c, 0x86, 0xf3, 0x7f, 0xe5, 0x2c, 0x9b, 0xd6, 0xf8, + 0x0c, 0xd4, 0xf3, 0xa7, 0x55, 0xeb, 0x80, 0x46, 0x94, 0x86, 0x28, 0xe1, 0x11, 0x71, 0x32, 0xcb, + 0x4e, 0xe9, 0xd0, 0x7a, 0xa0, 0xe9, 0xa3, 0x88, 0x84, 0x38, 0x12, 0xf1, 0x45, 0x11, 0xaf, 0xba, + 0xec, 0x6f, 0x5f, 0x5d, 0x75, 0x6b, 0x97, 0x57, 0xdd, 0xda, 0xdf, 0x57, 0xdd, 0xda, 0xcb, 0xeb, + 0xee, 0xc2, 0xe5, 0x75, 0x77, 0xe1, 0xcf, 0xeb, 0xee, 0xc2, 0x37, 0x4f, 0xe7, 0x2f, 0x16, 0x1e, + 0x7a, 0xfb, 0x63, 0x62, 0x4d, 0x0f, 0xac, 0x90, 0xf8, 0x69, 0x80, 0xa8, 0xfc, 0xd3, 0xb5, 0x9f, + 0xff, 0xeb, 0x7a, 0xf2, 0x64, 0xbf, 0xb8, 0x7b, 0x62, 0x9f, 0xc3, 0x15, 0x31, 0x44, 0x0e, 0xfe, + 0x0b, 0x00, 0x00, 0xff, 0xff, 0x52, 0xbf, 0x32, 0x98, 0xa2, 0x09, 0x00, 0x00, } func (m *ClientState) Marshal() (dAtA []byte, err error) { @@ -662,18 +643,6 @@ func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.TrustedVoters != nil { - { - size, err := m.TrustedVoters.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintOstracon(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } if m.TrustedValidators != nil { { size, err := m.TrustedValidators.MarshalToSizedBuffer(dAtA[:i]) @@ -684,7 +653,7 @@ func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintOstracon(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a + dAtA[i] = 0x22 } { size, err := m.TrustedHeight.MarshalToSizedBuffer(dAtA[:i]) @@ -695,19 +664,7 @@ func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintOstracon(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 - if m.VoterSet != nil { - { - size, err := m.VoterSet.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintOstracon(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } + dAtA[i] = 0x1a if m.ValidatorSet != nil { { size, err := m.ValidatorSet.MarshalToSizedBuffer(dAtA[:i]) @@ -874,20 +831,12 @@ func (m *Header) Size() (n int) { l = m.ValidatorSet.Size() n += 1 + l + sovOstracon(uint64(l)) } - if m.VoterSet != nil { - l = m.VoterSet.Size() - n += 1 + l + sovOstracon(uint64(l)) - } l = m.TrustedHeight.Size() n += 1 + l + sovOstracon(uint64(l)) if m.TrustedValidators != nil { l = m.TrustedValidators.Size() n += 1 + l + sovOstracon(uint64(l)) } - if m.TrustedVoters != nil { - l = m.TrustedVoters.Size() - n += 1 + l + sovOstracon(uint64(l)) - } return n } @@ -1704,42 +1653,6 @@ func (m *Header) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VoterSet", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOstracon - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthOstracon - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthOstracon - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VoterSet == nil { - m.VoterSet = &types2.VoterSet{} - } - if err := m.VoterSet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TrustedHeight", wireType) } @@ -1772,7 +1685,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TrustedValidators", wireType) } @@ -1808,42 +1721,6 @@ func (m *Header) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TrustedVoters", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOstracon - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthOstracon - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthOstracon - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.TrustedVoters == nil { - m.TrustedVoters = &types2.VoterSet{} - } - if err := m.TrustedVoters.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipOstracon(dAtA[iNdEx:]) diff --git a/modules/light-clients/99-ostracon/types/ostracon_test.go b/modules/light-clients/99-ostracon/types/ostracon_test.go index b0816eda609..c2c28b5dda6 100644 --- a/modules/light-clients/99-ostracon/types/ostracon_test.go +++ b/modules/light-clients/99-ostracon/types/ostracon_test.go @@ -4,12 +4,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/suite" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + "github.com/line/lbm-sdk/codec" sdk "github.com/line/lbm-sdk/types" ocbytes "github.com/line/ostracon/libs/bytes" - ocproto "github.com/line/ostracon/proto/ostracon/types" octypes "github.com/line/ostracon/types" - "github.com/stretchr/testify/suite" clienttypes "github.com/line/ibc-go/v3/modules/core/02-client/types" ibcoctypes "github.com/line/ibc-go/v3/modules/light-clients/99-ostracon/types" @@ -86,9 +87,8 @@ func (suite *OstraconTestSuite) SetupTest() { val := ibctesting.NewTestValidator(pubKey, 10) suite.valSet = octypes.NewValidatorSet([]*octypes.Validator{val}) suite.valsHash = suite.valSet.Hash() - voterSet := octypes.WrapValidatorsToVoterSet(suite.valSet.Validators) - suite.header = suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, voterSet, voterSet, []octypes.PrivValidator{suite.privVal}) - suite.ctx = app.BaseApp.NewContext(checkTx, ocproto.Header{Height: 1, Time: suite.now}) + suite.header = suite.chainA.CreateOCClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, []octypes.PrivValidator{suite.privVal}) + suite.ctx = app.BaseApp.NewContext(checkTx, tmproto.Header{Height: 1, Time: suite.now}) } func getSuiteSigners(suite *OstraconTestSuite) []octypes.PrivValidator { diff --git a/modules/light-clients/99-ostracon/types/update.go b/modules/light-clients/99-ostracon/types/update.go index ecf55e78458..ee525e8c057 100644 --- a/modules/light-clients/99-ostracon/types/update.go +++ b/modules/light-clients/99-ostracon/types/update.go @@ -182,7 +182,7 @@ func checkValidity( ) } - tmTrustedVoters, err := octypes.VoterSetFromProto(header.TrustedVoters) + tmTrustedValidators, err := octypes.ValidatorSetFromProto(header.TrustedValidators) if err != nil { return sdkerrors.Wrap(err, "trusted validator set in not ostracon validator set type") } @@ -192,7 +192,7 @@ func checkValidity( return sdkerrors.Wrap(err, "signed header in not ostracon signed header type") } - tmVoterSet, err := octypes.VoterSetFromProto(header.VoterSet) + tmValidatorSet, err := octypes.ValidatorSetFromProto(header.ValidatorSet) if err != nil { return sdkerrors.Wrap(err, "validator set in not ostracon validator set type") } @@ -233,9 +233,9 @@ func checkValidity( // - 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 - err = light.VerifyWithVoterSet( + err = light.Verify( &signedHeader, - tmTrustedVoters, tmSignedHeader, tmVoterSet, + tmTrustedValidators, tmSignedHeader, tmValidatorSet, clientState.TrustingPeriod, currentTimestamp, clientState.MaxClockDrift, clientState.TrustLevel.ToOstracon(), ) if err != nil { diff --git a/modules/light-clients/99-ostracon/types/update_test.go b/modules/light-clients/99-ostracon/types/update_test.go index 7484176bb1e..772240c4098 100644 --- a/modules/light-clients/99-ostracon/types/update_test.go +++ b/modules/light-clients/99-ostracon/types/update_test.go @@ -22,8 +22,6 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { newHeader *types.Header currentTime time.Time bothValSet *octypes.ValidatorSet - voterSet *octypes.VoterSet - bothVoterSet *octypes.VoterSet signers []octypes.PrivValidator bothSigners []octypes.PrivValidator ) @@ -44,7 +42,6 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { altVal := ibctesting.NewTestValidator(altPubKey, revisionHeight) // Create alternative validator set with only altVal, invalid update (too much change in valSet) altValSet := octypes.NewValidatorSet([]*octypes.Validator{altVal}) - altVoterSet := octypes.WrapValidatorsToVoterSet(altValSet.Validators) altSigners := []octypes.PrivValidator{altPrivVal} testCases := []struct { @@ -58,7 +55,7 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { setup: func(suite *OstraconTestSuite) { clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false) consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash) - newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, voterSet, voterSet, signers) + newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, signers) currentTime = suite.now }, expFrozen: false, @@ -69,7 +66,7 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { setup: func(suite *OstraconTestSuite) { clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false) consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash) - newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus5.RevisionHeight), height, suite.headerTime, bothValSet, suite.valSet, bothVoterSet, voterSet, bothSigners) + newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus5.RevisionHeight), height, suite.headerTime, bothValSet, suite.valSet, bothSigners) currentTime = suite.now }, expFrozen: false, @@ -80,7 +77,7 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { setup: func(suite *OstraconTestSuite) { clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false) consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), bothValSet.Hash()) - newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners) + newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, bothValSet, bothValSet, bothSigners) currentTime = suite.now }, expFrozen: false, @@ -92,7 +89,7 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false) consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash) consStateHeight = heightMinus3 - newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightMinus1.RevisionHeight), heightMinus3, suite.headerTime, bothValSet, suite.valSet, bothVoterSet, voterSet, bothSigners) + newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightMinus1.RevisionHeight), heightMinus3, suite.headerTime, bothValSet, suite.valSet, bothSigners) currentTime = suite.now }, expFrozen: false, @@ -104,7 +101,7 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { clientState = types.NewClientState(chainIDRevision1, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false) consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash) consStateHeight = heightMinus3 - newHeader = suite.chainA.CreateOCClientHeader(chainIDRevision0, int64(height.RevisionHeight), heightMinus3, suite.headerTime, bothValSet, suite.valSet, bothVoterSet, voterSet, bothSigners) + newHeader = suite.chainA.CreateOCClientHeader(chainIDRevision0, int64(height.RevisionHeight), heightMinus3, suite.headerTime, bothValSet, suite.valSet, bothSigners) currentTime = suite.now }, expPass: true, @@ -114,7 +111,7 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { setup: func(suite *OstraconTestSuite) { clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, heightPlus1, commitmenttypes.GetSDKSpecs(), upgradePath, false, false) consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash) - newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, voterSet, voterSet, signers) + newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, signers) currentTime = suite.now ctx := suite.chainA.GetContext().WithBlockTime(currentTime) // Store the header's consensus state in client store before UpdateClient call @@ -128,7 +125,7 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { setup: func(suite *OstraconTestSuite) { clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, heightPlus1, commitmenttypes.GetSDKSpecs(), upgradePath, false, false) consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash) - newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, voterSet, voterSet, signers) + newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, signers) currentTime = suite.now ctx := suite.chainA.GetContext().WithBlockTime(currentTime) // Change the consensus state of header and store in client store to create a conflict @@ -146,7 +143,7 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { // create an intermediate consensus state with the same time as the newHeader to create a time violation. // header time is after client time consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash) - newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus5.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, voterSet, voterSet, signers) + newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus5.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, signers) currentTime = suite.now prevConsensusState := types.NewConsensusState(suite.headerTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash) ctx := suite.chainA.GetContext().WithBlockTime(currentTime) @@ -164,7 +161,7 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { // create the next consensus state with the same time as the intermediate newHeader to create a time violation. // header time is after clientTime consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash) - newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, voterSet, voterSet, signers) + newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, signers) currentTime = suite.now nextConsensusState := types.NewConsensusState(suite.headerTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash) ctx := suite.chainA.GetContext().WithBlockTime(currentTime) @@ -180,7 +177,7 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { setup: func(suite *OstraconTestSuite) { clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false) consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash) - newHeader = suite.chainA.CreateOCClientHeader("ethermint", int64(heightPlus1.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, voterSet, voterSet, signers) + newHeader = suite.chainA.CreateOCClientHeader("ethermint", int64(heightPlus1.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, signers) currentTime = suite.now }, expFrozen: false, @@ -191,7 +188,7 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { setup: func(suite *OstraconTestSuite) { clientState = types.NewClientState(chainIDRevision0, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false) consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash) - newHeader = suite.chainA.CreateOCClientHeader(chainIDRevision1, 1, height, suite.headerTime, suite.valSet, suite.valSet, voterSet, voterSet, signers) + newHeader = suite.chainA.CreateOCClientHeader(chainIDRevision1, 1, height, suite.headerTime, suite.valSet, suite.valSet, signers) currentTime = suite.now }, expPass: false, @@ -201,7 +198,7 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { setup: func(suite *OstraconTestSuite) { clientState = types.NewClientState(chainIDRevision1, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clienttypes.NewHeight(1, 1), commitmenttypes.GetSDKSpecs(), upgradePath, false, false) consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash) - newHeader = suite.chainA.CreateOCClientHeader(chainIDRevision1, 3, height, suite.headerTime, suite.valSet, suite.valSet, voterSet, voterSet, signers) + newHeader = suite.chainA.CreateOCClientHeader(chainIDRevision1, 3, height, suite.headerTime, suite.valSet, suite.valSet, signers) currentTime = suite.now }, expFrozen: false, @@ -212,7 +209,7 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { setup: func(suite *OstraconTestSuite) { clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false) consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash) - newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, bothValSet, suite.valSet, bothVoterSet, voterSet, bothSigners) + newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, bothValSet, suite.valSet, bothSigners) currentTime = suite.now }, expFrozen: false, @@ -223,7 +220,7 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { setup: func(suite *OstraconTestSuite) { clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false) consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), bothValSet.Hash()) - newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, suite.valSet, bothValSet, voterSet, bothVoterSet, signers) + newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, suite.valSet, bothValSet, signers) currentTime = suite.now }, expFrozen: false, @@ -234,7 +231,7 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { setup: func(suite *OstraconTestSuite) { clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false) consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash) - newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus5.RevisionHeight), height, suite.headerTime, altValSet, suite.valSet, altVoterSet, voterSet, altSigners) + newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus5.RevisionHeight), height, suite.headerTime, altValSet, suite.valSet, altSigners) currentTime = suite.now }, expFrozen: false, @@ -245,7 +242,7 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { setup: func(suite *OstraconTestSuite) { clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false) consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash) - newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus5.RevisionHeight), height, suite.headerTime, bothValSet, bothValSet, bothVoterSet, bothVoterSet, bothSigners) + newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus5.RevisionHeight), height, suite.headerTime, bothValSet, bothValSet, bothSigners) currentTime = suite.now }, expFrozen: false, @@ -256,7 +253,7 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { setup: func(suite *OstraconTestSuite) { clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false) consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash) - newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, voterSet, voterSet, signers) + newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, signers) // make current time pass trusting period from last timestamp on clientstate currentTime = suite.now.Add(trustingPeriod) }, @@ -268,7 +265,7 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { setup: func(suite *OstraconTestSuite) { clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false) consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash) - newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.now.Add(time.Minute), suite.valSet, suite.valSet, voterSet, voterSet, signers) + newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.now.Add(time.Minute), suite.valSet, suite.valSet, signers) currentTime = suite.now }, expFrozen: false, @@ -279,7 +276,7 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { setup: func(suite *OstraconTestSuite) { clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false) consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash) - newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.clientTime, suite.valSet, suite.valSet, voterSet, voterSet, signers) + newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.clientTime, suite.valSet, suite.valSet, signers) currentTime = suite.now }, expFrozen: false, @@ -290,7 +287,7 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { setup: func(suite *OstraconTestSuite) { clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false) consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash) - newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, voterSet, voterSet, signers) + newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, signers) // cause new header to fail validatebasic by changing commit height to mismatch header height newHeader.SignedHeader.Commit.Height = revisionHeight - 1 currentTime = suite.now @@ -304,7 +301,7 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clienttypes.NewHeight(height.RevisionNumber, heightPlus5.RevisionHeight), commitmenttypes.GetSDKSpecs(), upgradePath, false, false) consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash) // Make new header at height less than latest client state - newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightMinus1.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, voterSet, voterSet, signers) + newHeader = suite.chainA.CreateOCClientHeader(chainID, int64(heightMinus1.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, signers) currentTime = suite.now }, expFrozen: false, @@ -324,9 +321,6 @@ func (suite *OstraconTestSuite) TestCheckHeaderAndUpdateState() { _, suiteVal := suite.valSet.GetByIndex(0) bothSigners = ibctesting.CreateSortedSignerArray(altPrivVal, suite.privVal, altVal, suiteVal) - voterSet = octypes.WrapValidatorsToVoterSet(suite.valSet.Validators) - bothVoterSet = octypes.WrapValidatorsToVoterSet(bothValSet.Validators) - consStateHeight = height // must be explicitly changed // setup test tc.setup(suite) diff --git a/proto/ibc/lightclients/ostracon/v1/ostracon.proto b/proto/ibc/lightclients/ostracon/v1/ostracon.proto index 4df3d80efb7..aef8a6611f2 100644 --- a/proto/ibc/lightclients/ostracon/v1/ostracon.proto +++ b/proto/ibc/lightclients/ostracon/v1/ostracon.proto @@ -4,9 +4,8 @@ package ibc.lightclients.ostracon.v1; option go_package = "github.com/line/ibc-go/v3/modules/light-clients/99-ostracon/types"; -import "ostracon/types/validator.proto"; -import "ostracon/types/voter.proto"; -import "ostracon/types/types.proto"; +import "tendermint/types/validator.proto"; +import "tendermint/types/types.proto"; import "proofs.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; @@ -99,15 +98,13 @@ message Misbehaviour { // hash to TrustedConsensusState.NextValidatorsHash since that is the last // trusted validator set at the TrustedHeight. message Header { - .ostracon.types.SignedHeader signed_header = 1 + .tendermint.types.SignedHeader signed_header = 1 [(gogoproto.embed) = true, (gogoproto.moretags) = "yaml:\"signed_header\""]; - .ostracon.types.ValidatorSet validator_set = 2 [(gogoproto.moretags) = "yaml:\"validator_set\""]; - .ostracon.types.VoterSet voter_set = 3 [(gogoproto.moretags) = "yaml:\"voter_set\""]; - ibc.core.client.v1.Height trusted_height = 4 + .tendermint.types.ValidatorSet validator_set = 2 [(gogoproto.moretags) = "yaml:\"validator_set\""]; + ibc.core.client.v1.Height trusted_height = 3 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"trusted_height\""]; - .ostracon.types.ValidatorSet trusted_validators = 5 [(gogoproto.moretags) = "yaml:\"trusted_validators\""]; - .ostracon.types.VoterSet trusted_voters = 6 [(gogoproto.moretags) = "yaml:\"trusted_voters\""]; + .tendermint.types.ValidatorSet trusted_validators = 4 [(gogoproto.moretags) = "yaml:\"trusted_validators\""]; } // Fraction defines the protobuf message type for tmmath.Fraction that only diff --git a/testing/app.go b/testing/app.go index 92f789558d2..d275fa00404 100644 --- a/testing/app.go +++ b/testing/app.go @@ -5,6 +5,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + dbm "github.com/tendermint/tm-db" + "github.com/line/lbm-sdk/baseapp" "github.com/line/lbm-sdk/client" "github.com/line/lbm-sdk/codec" @@ -16,12 +21,9 @@ import ( capabilitykeeper "github.com/line/lbm-sdk/x/capability/keeper" stakingkeeper "github.com/line/lbm-sdk/x/staking/keeper" stakingtypes "github.com/line/lbm-sdk/x/staking/types" - abci "github.com/line/ostracon/abci/types" + ocabci "github.com/line/ostracon/abci/types" "github.com/line/ostracon/libs/log" - ocproto "github.com/line/ostracon/proto/ostracon/types" octypes "github.com/line/ostracon/types" - "github.com/stretchr/testify/require" - dbm "github.com/tendermint/tm-db" "github.com/line/ibc-go/v3/modules/core/keeper" "github.com/line/ibc-go/v3/testing/simapp" @@ -30,7 +32,7 @@ import ( var DefaultTestingAppInit func() (TestingApp, map[string]json.RawMessage) = SetupTestingApp type TestingApp interface { - abci.Application + ocabci.Application // ibc-go additions GetBaseApp() *baseapp.BaseApp @@ -131,8 +133,8 @@ func SetupWithGenesisValSet(t *testing.T, valSet *octypes.ValidatorSet, genAccs // commit genesis changes app.Commit() app.BeginBlock( - abci.RequestBeginBlock{ - Header: ocproto.Header{ + ocabci.RequestBeginBlock{ + Header: tmproto.Header{ ChainID: chainID, Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, diff --git a/testing/chain.go b/testing/chain.go index cbe061cd7a6..97ee677d9ed 100644 --- a/testing/chain.go +++ b/testing/chain.go @@ -6,6 +6,10 @@ import ( "testing" "time" + abci "github.com/tendermint/tendermint/abci/types" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + protoversion "github.com/tendermint/tendermint/proto/tendermint/version" + "github.com/line/lbm-sdk/client" "github.com/line/lbm-sdk/codec" "github.com/line/lbm-sdk/crypto/keys/secp256k1" @@ -18,11 +22,9 @@ import ( capabilitytypes "github.com/line/lbm-sdk/x/capability/types" "github.com/line/lbm-sdk/x/staking/teststaking" stakingtypes "github.com/line/lbm-sdk/x/staking/types" - abci "github.com/line/ostracon/abci/types" + ocabci "github.com/line/ostracon/abci/types" "github.com/line/ostracon/crypto" "github.com/line/ostracon/crypto/tmhash" - ocproto "github.com/line/ostracon/proto/ostracon/types" - ocprotoversion "github.com/line/ostracon/proto/ostracon/version" octypes "github.com/line/ostracon/types" ocversion "github.com/line/ostracon/version" "github.com/stretchr/testify/require" @@ -56,13 +58,12 @@ type TestChain struct { App TestingApp ChainID string LastHeader *ibcoctypes.Header // header for last block height committed - CurrentHeader ocproto.Header // header for current block height + CurrentHeader tmproto.Header // header for current block height QueryServer types.QueryServer TxConfig client.TxConfig Codec codec.BinaryCodec Vals *octypes.ValidatorSet - Voters *octypes.VoterSet Signers []octypes.PrivValidator // autogenerated sender private key @@ -74,7 +75,6 @@ type TestChain struct { func NewTestValidator(pubkey crypto.PubKey, votingPower int64) *octypes.Validator { val := octypes.NewValidator(pubkey, votingPower) - val.VotingWeight = val.VotingPower return val } @@ -124,7 +124,7 @@ func NewTestChainWithValSet(t *testing.T, coord *Coordinator, chainID string, va app := SetupWithGenesisValSet(t, valSet, genAccs, chainID, sdk.DefaultPowerReduction, genBals...) // create current header and call begin block - header := ocproto.Header{ + header := tmproto.Header{ ChainID: chainID, Height: 1, Time: coord.CurrentTime.UTC(), @@ -143,7 +143,6 @@ func NewTestChainWithValSet(t *testing.T, coord *Coordinator, chainID string, va TxConfig: txConfig, Codec: app.AppCodec(), Vals: valSet, - Voters: octypes.WrapValidatorsToVoterSet(valSet.Validators), Signers: signers, SenderPrivKey: senderAccs[0].SenderPrivKey, SenderAccount: senderAccs[0].SenderAccount, @@ -278,7 +277,7 @@ func (chain *TestChain) NextBlock() { chain.LastHeader = chain.CurrentOCClientHeader() // increment the current header - chain.CurrentHeader = ocproto.Header{ + chain.CurrentHeader = tmproto.Header{ ChainID: chain.ChainID, Height: chain.App.LastBlockHeight() + 1, AppHash: chain.App.LastCommitID().Hash, @@ -289,15 +288,15 @@ func (chain *TestChain) NextBlock() { NextValidatorsHash: chain.Vals.Hash(), } - chain.App.BeginBlock(abci.RequestBeginBlock{Header: chain.CurrentHeader}) + chain.App.BeginBlock(ocabci.RequestBeginBlock{Header: chain.CurrentHeader}) } func (chain *TestChain) CommitBlock() { chain.App.EndBlock(abci.RequestEndBlock{Height: chain.CurrentHeader.Height}) chain.App.Commit() - chain.App.BeginRecheckTx(abci.RequestBeginRecheckTx{Header: chain.CurrentHeader}) - chain.App.EndRecheckTx(abci.RequestEndRecheckTx{Height: chain.CurrentHeader.Height}) + chain.App.BeginRecheckTx(ocabci.RequestBeginRecheckTx{Header: chain.CurrentHeader}) + chain.App.EndRecheckTx(ocabci.RequestEndRecheckTx{Height: chain.CurrentHeader.Height}) } // sendMsgs delivers a transaction through the application without returning the result. @@ -371,26 +370,6 @@ func (chain *TestChain) GetValsAtHeight(height int64) (*octypes.ValidatorSet, bo return octypes.NewValidatorSet(tmValidators), true } -func (chain *TestChain) GetVotersAtHeight(height int64) (*octypes.VoterSet, bool) { - histInfo, ok := chain.App.GetStakingKeeper().GetHistoricalInfo(chain.GetContext(), height) - if !ok { - return nil, false - } - - // Voters of test chain is always same to validator set - voters := stakingtypes.Validators(histInfo.Valset) - ocVoters, err := teststaking.ToOcValidators(voters, sdk.DefaultPowerReduction) - if err != nil { - panic(err) - } - // Validators saved in HistoricalInfo store have no voting power. - // We set voting weight same as voting power for test. - for i := 0; i < len(ocVoters); i++ { - ocVoters[i].VotingWeight = ocVoters[i].VotingPower - } - return octypes.WrapValidatorsToVoterSet(ocVoters), true -} - // GetAcknowledgement retrieves an acknowledgement for the provided packet. If the // acknowledgement does not exist then testing will fail. func (chain *TestChain) GetAcknowledgement(packet exported.PacketI) []byte { @@ -420,16 +399,14 @@ func (chain *TestChain) ConstructUpdateOCClientHeaderWithTrustedHeight(counterpa trustedHeight = chain.GetClientState(clientID).GetLatestHeight().(clienttypes.Height) } var ( - tmTrustedVals *octypes.ValidatorSet - tmTrustedVoters *octypes.VoterSet - ok bool + tmTrustedVals *octypes.ValidatorSet + ok bool ) // Once we get TrustedHeight from client, we must query the validators from the counterparty chain // If the LatestHeight == LastHeader.Height, then TrustedValidators are current validators // If LatestHeight < LastHeader.Height, we can query the historical validator set from HistoricalInfo if trustedHeight == counterparty.LastHeader.GetHeight() { tmTrustedVals = counterparty.Vals - tmTrustedVoters = counterparty.Voters } else { // NOTE: We need to get validators from counterparty at height: trustedHeight+1 // since the last trusted validators for a header at height h @@ -439,11 +416,6 @@ func (chain *TestChain) ConstructUpdateOCClientHeaderWithTrustedHeight(counterpa if !ok { return nil, sdkerrors.Wrapf(ibcoctypes.ErrInvalidHeaderHeight, "could not retrieve trusted validators at trustedHeight: %d", trustedHeight) } - - tmTrustedVoters, ok = counterparty.GetVotersAtHeight(int64(trustedHeight.RevisionHeight + 1)) - if !ok { - return nil, sdkerrors.Wrapf(ibcoctypes.ErrInvalidHeaderHeight, "could not retrieve trusted voters at trustedHeight: %d", trustedHeight) - } } // inject trusted fields into last header // for now assume revision number is 0 @@ -453,12 +425,7 @@ func (chain *TestChain) ConstructUpdateOCClientHeaderWithTrustedHeight(counterpa if err != nil { return nil, err } - trustedVoters, err := tmTrustedVoters.ToProto() - if err != nil { - return nil, err - } header.TrustedValidators = trustedVals - header.TrustedVoters = trustedVoters return header, nil } @@ -472,25 +439,22 @@ func (chain *TestChain) ExpireClient(amount time.Duration) { // CurrentOCClientHeader creates a OC header using the current header parameters // on the chain. The trusted fields in the header are set to nil. func (chain *TestChain) CurrentOCClientHeader() *ibcoctypes.Header { - return chain.CreateOCClientHeader(chain.ChainID, chain.CurrentHeader.Height, clienttypes.Height{}, chain.CurrentHeader.Time, chain.Vals, nil, chain.Voters, nil, chain.Signers) + return chain.CreateOCClientHeader(chain.ChainID, chain.CurrentHeader.Height, clienttypes.Height{}, chain.CurrentHeader.Time, chain.Vals, nil, chain.Signers) } // CreateOCClientHeader creates a OC header to update the OC client. Args are passed in to allow // caller flexibility to use params that differ from the chain. -func (chain *TestChain) CreateOCClientHeader(chainID string, blockHeight int64, trustedHeight clienttypes.Height, timestamp time.Time, tmValSet, tmTrustedVals *octypes.ValidatorSet, tmVoterSet, tmTrustedVoterSet *octypes.VoterSet, signers []octypes.PrivValidator) *ibcoctypes.Header { +func (chain *TestChain) CreateOCClientHeader(chainID string, blockHeight int64, trustedHeight clienttypes.Height, timestamp time.Time, tmValSet, tmTrustedVals *octypes.ValidatorSet, signers []octypes.PrivValidator) *ibcoctypes.Header { var ( - valSet *ocproto.ValidatorSet - trustedVals *ocproto.ValidatorSet - voterSet *ocproto.VoterSet - trustedVoters *ocproto.VoterSet + valSet *tmproto.ValidatorSet + trustedVals *tmproto.ValidatorSet ) require.NotNil(chain.T, tmValSet) - require.NotNil(chain.T, tmVoterSet) vsetHash := tmValSet.Hash() tmHeader := octypes.Header{ - Version: ocprotoversion.Consensus{Block: ocversion.BlockProtocol, App: 2}, + Version: protoversion.Consensus{Block: ocversion.BlockProtocol, App: 2}, ChainID: chainID, Height: blockHeight, Time: timestamp, @@ -498,7 +462,6 @@ func (chain *TestChain) CreateOCClientHeader(chainID string, blockHeight int64, LastCommitHash: chain.App.LastCommitID().Hash, DataHash: tmhash.Sum([]byte("data_hash")), ValidatorsHash: vsetHash, - VotersHash: tmVoterSet.Hash(), NextValidatorsHash: vsetHash, ConsensusHash: tmhash.Sum([]byte("consensus_hash")), AppHash: chain.CurrentHeader.AppHash, @@ -509,12 +472,12 @@ func (chain *TestChain) CreateOCClientHeader(chainID string, blockHeight int64, hhash := tmHeader.Hash() blockID := MakeBlockID(hhash, 3, tmhash.Sum([]byte("part_set"))) - voteSet := octypes.NewVoteSet(chainID, blockHeight, 1, ocproto.PrecommitType, tmVoterSet) + voteSet := octypes.NewVoteSet(chainID, blockHeight, 1, tmproto.PrecommitType, tmValSet) commit, err := octypes.MakeCommit(blockID, blockHeight, 1, voteSet, signers, timestamp) require.NoError(chain.T, err) - signedHeader := &ocproto.SignedHeader{ + signedHeader := &tmproto.SignedHeader{ Header: tmHeader.ToProto(), Commit: commit.ToProto(), } @@ -529,25 +492,13 @@ func (chain *TestChain) CreateOCClientHeader(chainID string, blockHeight int64, require.NoError(chain.T, err) } - if tmVoterSet != nil { - voterSet, err = tmVoterSet.ToProto() - require.NoError(chain.T, err) - } - - if tmTrustedVoterSet != nil { - trustedVoters, err = tmTrustedVoterSet.ToProto() - require.NoError(chain.T, err) - } - // The trusted fields may be nil. They may be filled before relaying messages to a client. // The relayer is responsible for querying client and injecting appropriate trusted fields. return &ibcoctypes.Header{ SignedHeader: signedHeader, ValidatorSet: valSet, - VoterSet: voterSet, TrustedHeight: trustedHeight, TrustedValidators: trustedVals, - TrustedVoters: trustedVoters, } } diff --git a/testing/coordinator.go b/testing/coordinator.go index 57504466a14..d83fc832bc4 100644 --- a/testing/coordinator.go +++ b/testing/coordinator.go @@ -6,7 +6,8 @@ import ( "testing" "time" - abci "github.com/line/ostracon/abci/types" + ocabci "github.com/line/ostracon/abci/types" + "github.com/stretchr/testify/require" ) @@ -67,7 +68,7 @@ func (coord *Coordinator) UpdateTime() { // UpdateTimeForChain updates the clock for a specific chain. func (coord *Coordinator) UpdateTimeForChain(chain *TestChain) { chain.CurrentHeader.Time = coord.CurrentTime.UTC() - chain.App.BeginBlock(abci.RequestBeginBlock{Header: chain.CurrentHeader}) + chain.App.BeginBlock(ocabci.RequestBeginBlock{Header: chain.CurrentHeader}) } // Setup constructs a OC client, connection, and channel on both chains provided. It will @@ -190,7 +191,7 @@ func (coord *Coordinator) CommitBlock(chains ...*TestChain) { // CommitNBlocks commits n blocks to state and updates the block height by 1 for each commit. func (coord *Coordinator) CommitNBlocks(chain *TestChain, n uint64) { for i := uint64(0); i < n; i++ { - chain.App.BeginBlock(abci.RequestBeginBlock{Header: chain.CurrentHeader}) + chain.App.BeginBlock(ocabci.RequestBeginBlock{Header: chain.CurrentHeader}) chain.CommitBlock() chain.NextBlock() coord.IncrementTime() diff --git a/testing/mock/mock.go b/testing/mock/mock.go index 83419d9773d..5992fa00d1e 100644 --- a/testing/mock/mock.go +++ b/testing/mock/mock.go @@ -4,8 +4,8 @@ import ( "encoding/json" "github.com/grpc-ecosystem/grpc-gateway/runtime" - abci "github.com/line/ostracon/abci/types" "github.com/spf13/cobra" + abci "github.com/tendermint/tendermint/abci/types" "github.com/line/lbm-sdk/client" "github.com/line/lbm-sdk/codec" diff --git a/testing/mock/privval.go b/testing/mock/privval.go index 7201a896edc..cf1993582bc 100644 --- a/testing/mock/privval.go +++ b/testing/mock/privval.go @@ -1,11 +1,13 @@ package mock import ( + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmtypes "github.com/tendermint/tendermint/types" + cryptocodec "github.com/line/lbm-sdk/crypto/codec" "github.com/line/lbm-sdk/crypto/keys/ed25519" cryptotypes "github.com/line/lbm-sdk/crypto/types" "github.com/line/ostracon/crypto" - ocproto "github.com/line/ostracon/proto/ostracon/types" octypes "github.com/line/ostracon/types" ) @@ -27,8 +29,8 @@ func (pv PV) GetPubKey() (crypto.PubKey, error) { } // SignVote implements PrivValidator interface -func (pv PV) SignVote(chainID string, vote *ocproto.Vote) error { - signBytes := octypes.VoteSignBytes(chainID, vote) +func (pv PV) SignVote(chainID string, vote *tmproto.Vote) error { + signBytes := tmtypes.VoteSignBytes(chainID, vote) sig, err := pv.PrivKey.Sign(signBytes) if err != nil { return err @@ -38,8 +40,8 @@ func (pv PV) SignVote(chainID string, vote *ocproto.Vote) error { } // SignProposal implements PrivValidator interface -func (pv PV) SignProposal(chainID string, proposal *ocproto.Proposal) error { - signBytes := octypes.ProposalSignBytes(chainID, proposal) +func (pv PV) SignProposal(chainID string, proposal *tmproto.Proposal) error { + signBytes := tmtypes.ProposalSignBytes(chainID, proposal) sig, err := pv.PrivKey.Sign(signBytes) if err != nil { return err diff --git a/testing/mock/privval_test.go b/testing/mock/privval_test.go index 3af4854ba59..baf24f63fb4 100644 --- a/testing/mock/privval_test.go +++ b/testing/mock/privval_test.go @@ -3,9 +3,10 @@ package mock_test import ( "testing" - ocproto "github.com/line/ostracon/proto/ostracon/types" - octypes "github.com/line/ostracon/types" "github.com/stretchr/testify/require" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + + octypes "github.com/line/ostracon/types" "github.com/line/ibc-go/v3/testing/mock" ) @@ -23,7 +24,7 @@ func TestSignVote(t *testing.T) { pv := mock.NewPV() pk, _ := pv.GetPubKey() - vote := &ocproto.Vote{Height: 2} + vote := &tmproto.Vote{Height: 2} pv.SignVote(chainID, vote) msg := octypes.VoteSignBytes(chainID, vote) @@ -35,7 +36,7 @@ func TestSignProposal(t *testing.T) { pv := mock.NewPV() pk, _ := pv.GetPubKey() - proposal := &ocproto.Proposal{Round: 2} + proposal := &tmproto.Proposal{Round: 2} pv.SignProposal(chainID, proposal) msg := octypes.ProposalSignBytes(chainID, proposal) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index f232013016b..1a63f647014 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -8,14 +8,15 @@ import ( "path/filepath" "github.com/gorilla/mux" - abci "github.com/line/ostracon/abci/types" - "github.com/line/ostracon/libs/log" - tmos "github.com/line/ostracon/libs/os" "github.com/rakyll/statik/fs" "github.com/spf13/cast" + abci "github.com/tendermint/tendermint/abci/types" dbm "github.com/tendermint/tm-db" - simappparams "github.com/line/ibc-go/v3/testing/simapp/params" + ocabci "github.com/line/ostracon/abci/types" + "github.com/line/ostracon/libs/log" + tmos "github.com/line/ostracon/libs/os" + "github.com/line/lbm-sdk/baseapp" "github.com/line/lbm-sdk/client" "github.com/line/lbm-sdk/client/grpc/tmservice" @@ -43,25 +44,6 @@ import ( capabilitykeeper "github.com/line/lbm-sdk/x/capability/keeper" capabilitytypes "github.com/line/lbm-sdk/x/capability/types" - ica "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts" - icacontroller "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts/controller" - icacontrollerkeeper "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts/controller/keeper" - icacontrollertypes "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts/controller/types" - icahost "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts/host" - icahostkeeper "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts/host/keeper" - icahosttypes "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts/host/types" - icatypes "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts/types" - transfer "github.com/line/ibc-go/v3/modules/apps/transfer" - ibctransferkeeper "github.com/line/ibc-go/v3/modules/apps/transfer/keeper" - ibctransfertypes "github.com/line/ibc-go/v3/modules/apps/transfer/types" - ibc "github.com/line/ibc-go/v3/modules/core" - ibcclient "github.com/line/ibc-go/v3/modules/core/02-client" - ibcclientclient "github.com/line/ibc-go/v3/modules/core/02-client/client" - ibcclienttypes "github.com/line/ibc-go/v3/modules/core/02-client/types" - porttypes "github.com/line/ibc-go/v3/modules/core/05-port/types" - ibchost "github.com/line/ibc-go/v3/modules/core/24-host" - ibckeeper "github.com/line/ibc-go/v3/modules/core/keeper" - ibcmock "github.com/line/ibc-go/v3/testing/mock" "github.com/line/lbm-sdk/x/crisis" crisiskeeper "github.com/line/lbm-sdk/x/crisis/keeper" crisistypes "github.com/line/lbm-sdk/x/crisis/types" @@ -105,6 +87,27 @@ import ( // unnamed import of statik for swagger UI support _ "github.com/line/lbm-sdk/client/docs/statik" + + ica "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts" + icacontroller "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts/controller" + icacontrollerkeeper "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts/controller/keeper" + icacontrollertypes "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts/controller/types" + icahost "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts/host" + icahostkeeper "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts/host/keeper" + icahosttypes "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts/host/types" + icatypes "github.com/line/ibc-go/v3/modules/apps/27-interchain-accounts/types" + transfer "github.com/line/ibc-go/v3/modules/apps/transfer" + ibctransferkeeper "github.com/line/ibc-go/v3/modules/apps/transfer/keeper" + ibctransfertypes "github.com/line/ibc-go/v3/modules/apps/transfer/types" + ibc "github.com/line/ibc-go/v3/modules/core" + ibcclient "github.com/line/ibc-go/v3/modules/core/02-client" + ibcclientclient "github.com/line/ibc-go/v3/modules/core/02-client/client" + ibcclienttypes "github.com/line/ibc-go/v3/modules/core/02-client/types" + porttypes "github.com/line/ibc-go/v3/modules/core/05-port/types" + ibchost "github.com/line/ibc-go/v3/modules/core/24-host" + ibckeeper "github.com/line/ibc-go/v3/modules/core/keeper" + ibcmock "github.com/line/ibc-go/v3/testing/mock" + simappparams "github.com/line/ibc-go/v3/testing/simapp/params" ) const appName = "SimApp" @@ -533,7 +536,7 @@ func NewSimApp( func (app *SimApp) Name() string { return app.BaseApp.Name() } // BeginBlocker application updates every begin block -func (app *SimApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { +func (app *SimApp) BeginBlocker(ctx sdk.Context, req ocabci.RequestBeginBlock) abci.ResponseBeginBlock { return app.mm.BeginBlock(ctx, req) } diff --git a/testing/simapp/export.go b/testing/simapp/export.go index 1cdb68ec785..1c5436a89f2 100644 --- a/testing/simapp/export.go +++ b/testing/simapp/export.go @@ -4,12 +4,13 @@ import ( "encoding/json" "log" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + servertypes "github.com/line/lbm-sdk/server/types" sdk "github.com/line/lbm-sdk/types" slashingtypes "github.com/line/lbm-sdk/x/slashing/types" "github.com/line/lbm-sdk/x/staking" stakingtypes "github.com/line/lbm-sdk/x/staking/types" - tmproto "github.com/line/ostracon/proto/ostracon/types" ) // ExportAppStateAndValidators exports the state of the application for a genesis diff --git a/testing/simapp/sim_bench_test.go b/testing/simapp/sim_bench_test.go index c3c2bd7f420..0517cd9bc36 100644 --- a/testing/simapp/sim_bench_test.go +++ b/testing/simapp/sim_bench_test.go @@ -5,9 +5,10 @@ import ( "os" "testing" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + simtypes "github.com/line/lbm-sdk/types/simulation" "github.com/line/lbm-sdk/x/simulation" - tmproto "github.com/line/ostracon/proto/ostracon/types" ) // Profile with: diff --git a/testing/simapp/sim_test.go b/testing/simapp/sim_test.go index 1f3232bc5e6..db2931bbb2b 100644 --- a/testing/simapp/sim_test.go +++ b/testing/simapp/sim_test.go @@ -7,6 +7,11 @@ import ( "os" "testing" + "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + dbm "github.com/tendermint/tm-db" + "github.com/line/lbm-sdk/baseapp" "github.com/line/lbm-sdk/store" "github.com/line/lbm-sdk/store/cache" @@ -24,11 +29,7 @@ import ( "github.com/line/lbm-sdk/x/simulation" slashingtypes "github.com/line/lbm-sdk/x/slashing/types" stakingtypes "github.com/line/lbm-sdk/x/staking/types" - abci "github.com/line/ostracon/abci/types" "github.com/line/ostracon/libs/log" - tmproto "github.com/line/ostracon/proto/ostracon/types" - "github.com/stretchr/testify/require" - dbm "github.com/tendermint/tm-db" ibctransfertypes "github.com/line/ibc-go/v3/modules/apps/transfer/types" ibchost "github.com/line/ibc-go/v3/modules/core/24-host" diff --git a/testing/simapp/test_helpers.go b/testing/simapp/test_helpers.go index bb39cfcc35b..c664add7afb 100644 --- a/testing/simapp/test_helpers.go +++ b/testing/simapp/test_helpers.go @@ -9,6 +9,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + dbm "github.com/tendermint/tm-db" + bam "github.com/line/lbm-sdk/baseapp" "github.com/line/lbm-sdk/client" "github.com/line/lbm-sdk/crypto/keys/ed25519" @@ -18,12 +23,9 @@ import ( authtypes "github.com/line/lbm-sdk/x/auth/types" banktypes "github.com/line/lbm-sdk/x/bank/types" minttypes "github.com/line/lbm-sdk/x/mint/types" - abci "github.com/line/ostracon/abci/types" + ocabci "github.com/line/ostracon/abci/types" "github.com/line/ostracon/libs/log" - tmproto "github.com/line/ostracon/proto/ostracon/types" tmtypes "github.com/line/ostracon/types" - "github.com/stretchr/testify/require" - dbm "github.com/tendermint/tm-db" "github.com/line/ibc-go/v3/testing/simapp/helpers" ) @@ -109,7 +111,7 @@ func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, balances ...ba ) app.Commit() - app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1}}) + app.BeginBlock(ocabci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1}}) return app } @@ -251,7 +253,7 @@ func SignAndDeliver( require.NoError(t, err) // Simulate a sending a transaction and committing a block - app.BeginBlock(abci.RequestBeginBlock{Header: header}) + app.BeginBlock(ocabci.RequestBeginBlock{Header: header}) gInfo, res, err := app.Deliver(txCfg.TxEncoder(), tx) if expPass { diff --git a/testing/simapp/types.go b/testing/simapp/types.go index 981497481c7..0227610724a 100644 --- a/testing/simapp/types.go +++ b/testing/simapp/types.go @@ -1,11 +1,13 @@ package simapp import ( + abci "github.com/tendermint/tendermint/abci/types" + "github.com/line/lbm-sdk/codec" "github.com/line/lbm-sdk/server/types" sdk "github.com/line/lbm-sdk/types" "github.com/line/lbm-sdk/types/module" - abci "github.com/line/ostracon/abci/types" + ocabci "github.com/line/ostracon/abci/types" ) // App implements the common methods for a Cosmos SDK-based application @@ -19,7 +21,7 @@ type App interface { LegacyAmino() *codec.LegacyAmino // Application updates every begin block. - BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock + BeginBlocker(ctx sdk.Context, req ocabci.RequestBeginBlock) abci.ResponseBeginBlock // Application updates every end block. EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock diff --git a/third_party/proto/ostracon/abci/types.proto b/third_party/proto/ostracon/abci/types.proto new file mode 100644 index 00000000000..2410ca340c4 --- /dev/null +++ b/third_party/proto/ostracon/abci/types.proto @@ -0,0 +1,137 @@ +syntax = "proto3"; +package ostracon.abci; + +option go_package = "github.com/line/ostracon/abci/types"; + +// For more information on gogo.proto, see: +// https://github.com/gogo/protobuf/blob/master/extensions.md +import "tendermint/crypto/proof.proto"; +import "tendermint/types/params.proto"; +import "tendermint/abci/types.proto"; +import "tendermint/types/types.proto"; +import "ostracon/types/types.proto"; +import "tendermint/crypto/keys.proto"; +import "google/protobuf/timestamp.proto"; +import "gogoproto/gogo.proto"; + +// This file is copied from http://github.com/tendermint/abci +// NOTE: When using custom types, mind the warnings. +// https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues + +//---------------------------------------- +// Request types + +message Request { + oneof value { + tendermint.abci.RequestEcho echo = 1; + tendermint.abci.RequestFlush flush = 2; + tendermint.abci.RequestInfo info = 3; + tendermint.abci.RequestSetOption set_option = 4; + tendermint.abci.RequestInitChain init_chain = 5; + tendermint.abci.RequestQuery query = 6; + RequestBeginBlock begin_block = 7; + tendermint.abci.RequestCheckTx check_tx = 8; + tendermint.abci.RequestDeliverTx deliver_tx = 9; + tendermint.abci.RequestEndBlock end_block = 10; + tendermint.abci.RequestCommit commit = 11; + tendermint.abci.RequestListSnapshots list_snapshots = 12; + tendermint.abci.RequestOfferSnapshot offer_snapshot = 13; + tendermint.abci.RequestLoadSnapshotChunk load_snapshot_chunk = 14; + tendermint.abci.RequestApplySnapshotChunk apply_snapshot_chunk = 15; + RequestBeginRecheckTx begin_recheck_tx = 1000; // 16~99 are reserved for merging original tendermint + RequestEndRecheckTx end_recheck_tx = 1001; + } +} + +message RequestBeginBlock { + bytes hash = 1; + tendermint.types.Header header = 2 [(gogoproto.nullable) = false]; + tendermint.abci.LastCommitInfo last_commit_info = 3 [(gogoproto.nullable) = false]; + repeated tendermint.abci.Evidence byzantine_validators = 4 [(gogoproto.nullable) = false]; + + // *** Ostracon Extended Fields *** + ostracon.types.Entropy entropy = 1000 [(gogoproto.nullable) = false]; +} + +message RequestBeginRecheckTx { + tendermint.types.Header header = 1 [(gogoproto.nullable) = false]; +} + +message RequestEndRecheckTx { + int64 height = 1; +} + +//---------------------------------------- +// Response types + +message Response { + oneof value { + tendermint.abci.ResponseException exception = 1; + tendermint.abci.ResponseEcho echo = 2; + tendermint.abci.ResponseFlush flush = 3; + tendermint.abci.ResponseInfo info = 4; + tendermint.abci.ResponseSetOption set_option = 5; + tendermint.abci.ResponseInitChain init_chain = 6; + tendermint.abci.ResponseQuery query = 7; + tendermint.abci.ResponseBeginBlock begin_block = 8; + ResponseCheckTx check_tx = 9; + tendermint.abci.ResponseDeliverTx deliver_tx = 10; + tendermint.abci.ResponseEndBlock end_block = 11; + tendermint.abci.ResponseCommit commit = 12; + tendermint.abci.ResponseListSnapshots list_snapshots = 13; + tendermint.abci.ResponseOfferSnapshot offer_snapshot = 14; + tendermint.abci.ResponseLoadSnapshotChunk load_snapshot_chunk = 15; + tendermint.abci.ResponseApplySnapshotChunk apply_snapshot_chunk = 16; + ResponseBeginRecheckTx begin_recheck_tx = 1000; // 17~99 are reserved for merging original tendermint + ResponseEndRecheckTx end_recheck_tx = 1001; + } +} + +message ResponseCheckTx { + uint32 code = 1; + bytes data = 2; + string log = 3; // nondeterministic + string info = 4; // nondeterministic + int64 gas_wanted = 5 [json_name = "gas_wanted"]; + int64 gas_used = 6 [json_name = "gas_used"]; + repeated tendermint.abci.Event events = 7 + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; + string codespace = 8; + string sender = 9; // MEMO: not used, just reservation to implement https://github.com/tendermint/tendermint/pull/6740 first + int64 priority = 10; // MEMO: not used, just reservation to implement https://github.com/tendermint/tendermint/pull/6740 first + + // mempool_error is set by Ostracon. + // ABCI applictions creating a ResponseCheckTX should not set mempool_error. + string mempool_error = 11; +} + +message ResponseBeginRecheckTx { + uint32 code = 1; +} + +message ResponseEndRecheckTx { + uint32 code = 1; +} + +//---------------------------------------- +// Service Definition + +service ABCIApplication { + rpc Echo(tendermint.abci.RequestEcho) returns (tendermint.abci.ResponseEcho); + rpc Flush(tendermint.abci.RequestFlush) returns (tendermint.abci.ResponseFlush); + rpc Info(tendermint.abci.RequestInfo) returns (tendermint.abci.ResponseInfo); + rpc SetOption(tendermint.abci.RequestSetOption) returns (tendermint.abci.ResponseSetOption); + rpc DeliverTx(tendermint.abci.RequestDeliverTx) returns (tendermint.abci.ResponseDeliverTx); + rpc CheckTx(tendermint.abci.RequestCheckTx) returns (ResponseCheckTx); + rpc Query(tendermint.abci.RequestQuery) returns (tendermint.abci.ResponseQuery); + rpc Commit(tendermint.abci.RequestCommit) returns (tendermint.abci.ResponseCommit); + rpc InitChain(tendermint.abci.RequestInitChain) returns (tendermint.abci.ResponseInitChain); + rpc BeginBlock(RequestBeginBlock) returns (tendermint.abci.ResponseBeginBlock); + rpc EndBlock(tendermint.abci.RequestEndBlock) returns (tendermint.abci.ResponseEndBlock); + rpc ListSnapshots(tendermint.abci.RequestListSnapshots) returns (tendermint.abci.ResponseListSnapshots); + rpc OfferSnapshot(tendermint.abci.RequestOfferSnapshot) returns (tendermint.abci.ResponseOfferSnapshot); + rpc LoadSnapshotChunk(tendermint.abci.RequestLoadSnapshotChunk) returns (tendermint.abci.ResponseLoadSnapshotChunk); + rpc ApplySnapshotChunk(tendermint.abci.RequestApplySnapshotChunk) returns (tendermint.abci.ResponseApplySnapshotChunk); + rpc BeginRecheckTx(RequestBeginRecheckTx) returns (ResponseBeginRecheckTx); + rpc EndRecheckTx(RequestEndRecheckTx) returns (ResponseEndRecheckTx); +} diff --git a/third_party/proto/ostracon/crypto/keys.proto b/third_party/proto/ostracon/crypto/keys.proto deleted file mode 100644 index c375549cb20..00000000000 --- a/third_party/proto/ostracon/crypto/keys.proto +++ /dev/null @@ -1,17 +0,0 @@ -syntax = "proto3"; -package ostracon.crypto; - -option go_package = "github.com/line/ostracon/proto/ostracon/crypto"; - -import "gogoproto/gogo.proto"; - -// PublicKey defines the keys available for use with Ostracon Validators -message PublicKey { - option (gogoproto.compare) = true; - option (gogoproto.equal) = true; - - oneof sum { - bytes ed25519 = 1; - bytes secp256k1 = 2; - } -} diff --git a/third_party/proto/ostracon/crypto/proof.proto b/third_party/proto/ostracon/crypto/proof.proto deleted file mode 100644 index 7ea7b277f75..00000000000 --- a/third_party/proto/ostracon/crypto/proof.proto +++ /dev/null @@ -1,41 +0,0 @@ -syntax = "proto3"; -package ostracon.crypto; - -option go_package = "github.com/line/ostracon/proto/ostracon/crypto"; - -import "gogoproto/gogo.proto"; - -message Proof { - int64 total = 1; - int64 index = 2; - bytes leaf_hash = 3; - repeated bytes aunts = 4; -} - -message ValueOp { - // Encoded in ProofOp.Key. - bytes key = 1; - - // To encode in ProofOp.Data - Proof proof = 2; -} - -message DominoOp { - string key = 1; - string input = 2; - string output = 3; -} - -// ProofOp defines an operation used for calculating Merkle root -// The data could be arbitrary format, providing nessecary data -// for example neighbouring node hash -message ProofOp { - string type = 1; - bytes key = 2; - bytes data = 3; -} - -// ProofOps is Merkle proof defined by the list of ProofOps -message ProofOps { - repeated ProofOp ops = 1 [(gogoproto.nullable) = false]; -} diff --git a/third_party/proto/ostracon/libs/bits/types.proto b/third_party/proto/ostracon/libs/bits/types.proto deleted file mode 100644 index bead2db26f4..00000000000 --- a/third_party/proto/ostracon/libs/bits/types.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto3"; -package ostracon.libs.bits; - -option go_package = "github.com/line/ostracon/proto/ostracon/libs/bits"; - -message BitArray { - int64 bits = 1; - repeated uint64 elems = 2; -} diff --git a/third_party/proto/ostracon/types/block.proto b/third_party/proto/ostracon/types/block.proto new file mode 100644 index 00000000000..525b00e5041 --- /dev/null +++ b/third_party/proto/ostracon/types/block.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; +package ostracon.types; + +option go_package = "github.com/line/ostracon/proto/ostracon/types"; + +import "gogoproto/gogo.proto"; +import "ostracon/types/types.proto"; +import "tendermint/types/evidence.proto"; +import "tendermint/types/types.proto"; + +message Block { + tendermint.types.Header header = 1 [(gogoproto.nullable) = false]; + tendermint.types.Data data = 2 [(gogoproto.nullable) = false]; + tendermint.types.EvidenceList evidence = 3 [(gogoproto.nullable) = false]; + tendermint.types.Commit last_commit = 4; + + // *** Ostracon Extended Fields *** + ostracon.types.Entropy entropy = 1000 [(gogoproto.nullable) = false]; +} diff --git a/third_party/proto/ostracon/types/types.proto b/third_party/proto/ostracon/types/types.proto index d3310f66b38..c1452df114b 100644 --- a/third_party/proto/ostracon/types/types.proto +++ b/third_party/proto/ostracon/types/types.proto @@ -3,155 +3,12 @@ package ostracon.types; option go_package = "github.com/line/ostracon/proto/ostracon/types"; -import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "ostracon/crypto/proof.proto"; -import "ostracon/version/types.proto"; -import "ostracon/types/validator.proto"; - -// BlockIdFlag indicates which BlcokID the signature is for -enum BlockIDFlag { - option (gogoproto.goproto_enum_stringer) = true; - option (gogoproto.goproto_enum_prefix) = false; - - BLOCK_ID_FLAG_UNKNOWN = 0 [(gogoproto.enumvalue_customname) = "BlockIDFlagUnknown"]; - BLOCK_ID_FLAG_ABSENT = 1 [(gogoproto.enumvalue_customname) = "BlockIDFlagAbsent"]; - BLOCK_ID_FLAG_COMMIT = 2 [(gogoproto.enumvalue_customname) = "BlockIDFlagCommit"]; - BLOCK_ID_FLAG_NIL = 3 [(gogoproto.enumvalue_customname) = "BlockIDFlagNil"]; -} - -// SignedMsgType is a type of signed message in the consensus. -enum SignedMsgType { - option (gogoproto.goproto_enum_stringer) = true; - option (gogoproto.goproto_enum_prefix) = false; - - SIGNED_MSG_TYPE_UNKNOWN = 0 [(gogoproto.enumvalue_customname) = "UnknownType"]; - // Votes - SIGNED_MSG_TYPE_PREVOTE = 1 [(gogoproto.enumvalue_customname) = "PrevoteType"]; - SIGNED_MSG_TYPE_PRECOMMIT = 2 [(gogoproto.enumvalue_customname) = "PrecommitType"]; - - // Proposals - SIGNED_MSG_TYPE_PROPOSAL = 32 [(gogoproto.enumvalue_customname) = "ProposalType"]; -} - -// PartsetHeader -message PartSetHeader { - uint32 total = 1; - bytes hash = 2; -} - -message Part { - uint32 index = 1; - bytes bytes = 2; - ostracon.crypto.Proof proof = 3 [(gogoproto.nullable) = false]; -} - -// BlockID -message BlockID { - bytes hash = 1; - PartSetHeader part_set_header = 2 [(gogoproto.nullable) = false]; -} - // -------------------------------- -// Header defines the structure of a Tendermint block header. -message Header { - // basic block info - ostracon.version.Consensus version = 1 [(gogoproto.nullable) = false]; - string chain_id = 2 [(gogoproto.customname) = "ChainID"]; - int64 height = 3; - google.protobuf.Timestamp time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - - // prev block info - BlockID last_block_id = 5 [(gogoproto.nullable) = false]; - - // hashes of block data - bytes last_commit_hash = 6; // commit from validators from the last block - bytes data_hash = 7; // transactions - - // hashes from the app output from the prev block - bytes validators_hash = 8; // validators for the current block - bytes next_validators_hash = 9; // validators for the next block - bytes consensus_hash = 10; // consensus params for current block - bytes app_hash = 11; // state after txs from the previous block - bytes last_results_hash = 12; // root hash of all results from the txs from the previous block - - // consensus info - bytes evidence_hash = 13; // evidence included in the block - bytes proposer_address = 14; // original proposer of the block -} - -// Data contains the set of transactions included in the block -message Data { - // Txs that will be applied by state @ block.Height+1. - // NOTE: not all txs here are valid. We're just agreeing on the order first. - // This means that block.AppHash does not include these txs. - repeated bytes txs = 1; -} - -// Vote represents a prevote, precommit, or commit vote from validators for -// consensus. -message Vote { - SignedMsgType type = 1; - int64 height = 2; - int32 round = 3; - BlockID block_id = 4 - [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; // zero if vote is nil. - google.protobuf.Timestamp timestamp = 5 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - bytes validator_address = 6; - int32 validator_index = 7; - bytes signature = 8; -} - -// Commit contains the evidence that a block was committed by a set of validators. -message Commit { - int64 height = 1; - int32 round = 2; - BlockID block_id = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; - repeated CommitSig signatures = 4 [(gogoproto.nullable) = false]; -} - -// CommitSig is a part of the Vote included in a Commit. -message CommitSig { - BlockIDFlag block_id_flag = 1; - bytes validator_address = 2; - google.protobuf.Timestamp timestamp = 3 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - bytes signature = 4; -} - -message Proposal { - SignedMsgType type = 1; - int64 height = 2; - int32 round = 3; - int32 pol_round = 4; - BlockID block_id = 5 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; - google.protobuf.Timestamp timestamp = 6 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - bytes signature = 7; -} - -message SignedHeader { - Header header = 1; - Commit commit = 2; -} - -message LightBlock { - SignedHeader signed_header = 1; - ostracon.types.ValidatorSet validator_set = 2; -} - -message BlockMeta { - BlockID block_id = 1 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; - int64 block_size = 2; - Header header = 3 [(gogoproto.nullable) = false]; - int64 num_txs = 4; -} - -// TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. -message TxProof { - bytes root_hash = 1; - bytes data = 2; - ostracon.crypto.Proof proof = 3; +// Entropy represents height-specific complexity and used in proposer-election. +// Entropy contains vrf proof and generated round. The relationship of each field is as follows. +// Entropy.proof = VRFProof(last_proof_hash, current_height, Entropy.round) +message Entropy { + int32 round = 1; + bytes proof = 2; } diff --git a/third_party/proto/ostracon/types/validator.proto b/third_party/proto/ostracon/types/validator.proto deleted file mode 100644 index 378bde5ce84..00000000000 --- a/third_party/proto/ostracon/types/validator.proto +++ /dev/null @@ -1,28 +0,0 @@ -syntax = "proto3"; -package ostracon.types; - -option go_package = "github.com/line/ostracon/proto/ostracon/types"; - -import "gogoproto/gogo.proto"; -import "ostracon/crypto/keys.proto"; - -message ValidatorSet { - repeated Validator validators = 1; - Validator proposer = 2; - int64 total_voting_power = 3; -} - -message Validator { - bytes address = 1; - ostracon.crypto.PublicKey pub_key = 2 [(gogoproto.nullable) = false]; - int64 voting_power = 3; - int64 proposer_priority = 4; - - // *** Ostracon Extended Fields *** - int64 voting_weight = 1000; -} - -message SimpleValidator { - ostracon.crypto.PublicKey pub_key = 1; - int64 voting_power = 2; -} diff --git a/third_party/proto/ostracon/types/voter.proto b/third_party/proto/ostracon/types/voter.proto deleted file mode 100644 index 648ceca414f..00000000000 --- a/third_party/proto/ostracon/types/voter.proto +++ /dev/null @@ -1,11 +0,0 @@ -syntax = "proto3"; -package ostracon.types; - -option go_package = "github.com/line/ostracon/proto/ostracon/types"; - -import "ostracon/types/validator.proto"; - -message VoterSet { - repeated ostracon.types.Validator voters = 1; - int64 total_voting_weight = 2; -} diff --git a/third_party/proto/ostracon/version/types.proto b/third_party/proto/ostracon/version/types.proto deleted file mode 100644 index 135dbd49ee3..00000000000 --- a/third_party/proto/ostracon/version/types.proto +++ /dev/null @@ -1,24 +0,0 @@ -syntax = "proto3"; -package ostracon.version; - -option go_package = "github.com/line/ostracon/proto/ostracon/version"; - -import "gogoproto/gogo.proto"; - -// App includes the protocol and software version for the application. -// This information is included in ResponseInfo. The App.Protocol can be -// updated in ResponseEndBlock. -message App { - uint64 protocol = 1; - string software = 2; -} - -// Consensus captures the consensus rules for processing a block in the blockchain, -// including all blockchain data structures and the rules of the application's -// state transition machine. -message Consensus { - option (gogoproto.equal) = true; - - uint64 block = 1; - uint64 app = 2; -} diff --git a/third_party/proto/tendermint/abci/types.proto b/third_party/proto/tendermint/abci/types.proto new file mode 100644 index 00000000000..8e3a9093638 --- /dev/null +++ b/third_party/proto/tendermint/abci/types.proto @@ -0,0 +1,407 @@ +syntax = "proto3"; +package tendermint.abci; + +option go_package = "github.com/tendermint/tendermint/abci/types"; + +// For more information on gogo.proto, see: +// https://github.com/gogo/protobuf/blob/master/extensions.md +import "tendermint/crypto/proof.proto"; +import "tendermint/types/types.proto"; +import "tendermint/crypto/keys.proto"; +import "tendermint/types/params.proto"; +import "google/protobuf/timestamp.proto"; +import "gogoproto/gogo.proto"; + +// This file is copied from http://github.com/tendermint/abci +// NOTE: When using custom types, mind the warnings. +// https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues + +//---------------------------------------- +// Request types + +message Request { + oneof value { + RequestEcho echo = 1; + RequestFlush flush = 2; + RequestInfo info = 3; + RequestSetOption set_option = 4; + RequestInitChain init_chain = 5; + RequestQuery query = 6; + RequestBeginBlock begin_block = 7; + RequestCheckTx check_tx = 8; + RequestDeliverTx deliver_tx = 9; + RequestEndBlock end_block = 10; + RequestCommit commit = 11; + RequestListSnapshots list_snapshots = 12; + RequestOfferSnapshot offer_snapshot = 13; + RequestLoadSnapshotChunk load_snapshot_chunk = 14; + RequestApplySnapshotChunk apply_snapshot_chunk = 15; + } +} + +message RequestEcho { + string message = 1; +} + +message RequestFlush {} + +message RequestInfo { + string version = 1; + uint64 block_version = 2; + uint64 p2p_version = 3; +} + +// nondeterministic +message RequestSetOption { + string key = 1; + string value = 2; +} + +message RequestInitChain { + google.protobuf.Timestamp time = 1 + [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + string chain_id = 2; + ConsensusParams consensus_params = 3; + repeated ValidatorUpdate validators = 4 [(gogoproto.nullable) = false]; + bytes app_state_bytes = 5; + int64 initial_height = 6; +} + +message RequestQuery { + bytes data = 1; + string path = 2; + int64 height = 3; + bool prove = 4; +} + +message RequestBeginBlock { + bytes hash = 1; + tendermint.types.Header header = 2 [(gogoproto.nullable) = false]; + LastCommitInfo last_commit_info = 3 [(gogoproto.nullable) = false]; + repeated Evidence byzantine_validators = 4 [(gogoproto.nullable) = false]; +} + +enum CheckTxType { + NEW = 0 [(gogoproto.enumvalue_customname) = "New"]; + RECHECK = 1 [(gogoproto.enumvalue_customname) = "Recheck"]; +} + +message RequestCheckTx { + bytes tx = 1; + CheckTxType type = 2; +} + +message RequestDeliverTx { + bytes tx = 1; +} + +message RequestEndBlock { + int64 height = 1; +} + +message RequestCommit {} + +// lists available snapshots +message RequestListSnapshots { +} + +// offers a snapshot to the application +message RequestOfferSnapshot { + Snapshot snapshot = 1; // snapshot offered by peers + bytes app_hash = 2; // light client-verified app hash for snapshot height +} + +// loads a snapshot chunk +message RequestLoadSnapshotChunk { + uint64 height = 1; + uint32 format = 2; + uint32 chunk = 3; +} + +// Applies a snapshot chunk +message RequestApplySnapshotChunk { + uint32 index = 1; + bytes chunk = 2; + string sender = 3; +} + +//---------------------------------------- +// Response types + +message Response { + oneof value { + ResponseException exception = 1; + ResponseEcho echo = 2; + ResponseFlush flush = 3; + ResponseInfo info = 4; + ResponseSetOption set_option = 5; + ResponseInitChain init_chain = 6; + ResponseQuery query = 7; + ResponseBeginBlock begin_block = 8; + ResponseCheckTx check_tx = 9; + ResponseDeliverTx deliver_tx = 10; + ResponseEndBlock end_block = 11; + ResponseCommit commit = 12; + ResponseListSnapshots list_snapshots = 13; + ResponseOfferSnapshot offer_snapshot = 14; + ResponseLoadSnapshotChunk load_snapshot_chunk = 15; + ResponseApplySnapshotChunk apply_snapshot_chunk = 16; + } +} + +// nondeterministic +message ResponseException { + string error = 1; +} + +message ResponseEcho { + string message = 1; +} + +message ResponseFlush {} + +message ResponseInfo { + string data = 1; + + string version = 2; + uint64 app_version = 3; + + int64 last_block_height = 4; + bytes last_block_app_hash = 5; +} + +// nondeterministic +message ResponseSetOption { + uint32 code = 1; + // bytes data = 2; + string log = 3; + string info = 4; +} + +message ResponseInitChain { + ConsensusParams consensus_params = 1; + repeated ValidatorUpdate validators = 2 [(gogoproto.nullable) = false]; + bytes app_hash = 3; +} + +message ResponseQuery { + uint32 code = 1; + // bytes data = 2; // use "value" instead. + string log = 3; // nondeterministic + string info = 4; // nondeterministic + int64 index = 5; + bytes key = 6; + bytes value = 7; + tendermint.crypto.ProofOps proof_ops = 8; + int64 height = 9; + string codespace = 10; +} + +message ResponseBeginBlock { + repeated Event events = 1 + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; +} + +message ResponseCheckTx { + uint32 code = 1; + bytes data = 2; + string log = 3; // nondeterministic + string info = 4; // nondeterministic + int64 gas_wanted = 5 [json_name = "gas_wanted"]; + int64 gas_used = 6 [json_name = "gas_used"]; + repeated Event events = 7 + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; + string codespace = 8; +} + +message ResponseDeliverTx { + uint32 code = 1; + bytes data = 2; + string log = 3; // nondeterministic + string info = 4; // nondeterministic + int64 gas_wanted = 5 [json_name = "gas_wanted"]; + int64 gas_used = 6 [json_name = "gas_used"]; + repeated Event events = 7 + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; // nondeterministic + string codespace = 8; +} + +message ResponseEndBlock { + repeated ValidatorUpdate validator_updates = 1 + [(gogoproto.nullable) = false]; + ConsensusParams consensus_param_updates = 2; + repeated Event events = 3 + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; +} + +message ResponseCommit { + // reserve 1 + bytes data = 2; + int64 retain_height = 3; +} + +message ResponseListSnapshots { + repeated Snapshot snapshots = 1; +} + +message ResponseOfferSnapshot { + Result result = 1; + + enum Result { + UNKNOWN = 0; // Unknown result, abort all snapshot restoration + ACCEPT = 1; // Snapshot accepted, apply chunks + ABORT = 2; // Abort all snapshot restoration + REJECT = 3; // Reject this specific snapshot, try others + REJECT_FORMAT = 4; // Reject all snapshots of this format, try others + REJECT_SENDER = 5; // Reject all snapshots from the sender(s), try others + } +} + +message ResponseLoadSnapshotChunk { + bytes chunk = 1; +} + +message ResponseApplySnapshotChunk { + Result result = 1; + repeated uint32 refetch_chunks = 2; // Chunks to refetch and reapply + repeated string reject_senders = 3; // Chunk senders to reject and ban + + enum Result { + UNKNOWN = 0; // Unknown result, abort all snapshot restoration + ACCEPT = 1; // Chunk successfully accepted + ABORT = 2; // Abort all snapshot restoration + RETRY = 3; // Retry chunk (combine with refetch and reject) + RETRY_SNAPSHOT = 4; // Retry snapshot (combine with refetch and reject) + REJECT_SNAPSHOT = 5; // Reject this snapshot, try others + } +} + +//---------------------------------------- +// Misc. + +// ConsensusParams contains all consensus-relevant parameters +// that can be adjusted by the abci app +message ConsensusParams { + BlockParams block = 1; + tendermint.types.EvidenceParams evidence = 2; + tendermint.types.ValidatorParams validator = 3; + tendermint.types.VersionParams version = 4; +} + +// BlockParams contains limits on the block size. +message BlockParams { + // Note: must be greater than 0 + int64 max_bytes = 1; + // Note: must be greater or equal to -1 + int64 max_gas = 2; +} + +message LastCommitInfo { + int32 round = 1; + repeated VoteInfo votes = 2 [(gogoproto.nullable) = false]; +} + +// Event allows application developers to attach additional information to +// ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. +// Later, transactions may be queried using these events. +message Event { + string type = 1; + repeated EventAttribute attributes = 2 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "attributes,omitempty" + ]; +} + +// EventAttribute is a single key-value pair, associated with an event. +message EventAttribute { + bytes key = 1; + bytes value = 2; + bool index = 3; // nondeterministic +} + +// TxResult contains results of executing the transaction. +// +// One usage is indexing transaction results. +message TxResult { + int64 height = 1; + uint32 index = 2; + bytes tx = 3; + ResponseDeliverTx result = 4 [(gogoproto.nullable) = false]; +} + +//---------------------------------------- +// Blockchain Types + +// Validator +message Validator { + bytes address = 1; // The first 20 bytes of SHA256(public key) + // PubKey pub_key = 2 [(gogoproto.nullable)=false]; + int64 power = 3; // The voting power +} + +// ValidatorUpdate +message ValidatorUpdate { + tendermint.crypto.PublicKey pub_key = 1 [(gogoproto.nullable) = false]; + int64 power = 2; +} + +// VoteInfo +message VoteInfo { + Validator validator = 1 [(gogoproto.nullable) = false]; + bool signed_last_block = 2; +} + +enum EvidenceType { + UNKNOWN = 0; + DUPLICATE_VOTE = 1; + LIGHT_CLIENT_ATTACK = 2; +} + +message Evidence { + EvidenceType type = 1; + // The offending validator + Validator validator = 2 [(gogoproto.nullable) = false]; + // The height when the offense occurred + int64 height = 3; + // The corresponding time where the offense occurred + google.protobuf.Timestamp time = 4 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true + ]; + // Total voting power of the validator set in case the ABCI application does + // not store historical validators. + // https://github.com/tendermint/tendermint/issues/4581 + int64 total_voting_power = 5; +} + +//---------------------------------------- +// State Sync Types + +message Snapshot { + uint64 height = 1; // The height at which the snapshot was taken + uint32 format = 2; // The application-specific snapshot format + uint32 chunks = 3; // Number of chunks in the snapshot + bytes hash = 4; // Arbitrary snapshot hash, equal only if identical + bytes metadata = 5; // Arbitrary application metadata +} + +//---------------------------------------- +// Service Definition + +service ABCIApplication { + rpc Echo(RequestEcho) returns (ResponseEcho); + rpc Flush(RequestFlush) returns (ResponseFlush); + rpc Info(RequestInfo) returns (ResponseInfo); + rpc SetOption(RequestSetOption) returns (ResponseSetOption); + rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx); + rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx); + rpc Query(RequestQuery) returns (ResponseQuery); + rpc Commit(RequestCommit) returns (ResponseCommit); + rpc InitChain(RequestInitChain) returns (ResponseInitChain); + rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock); + rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock); + rpc ListSnapshots(RequestListSnapshots) returns (ResponseListSnapshots); + rpc OfferSnapshot(RequestOfferSnapshot) returns (ResponseOfferSnapshot); + rpc LoadSnapshotChunk(RequestLoadSnapshotChunk) returns (ResponseLoadSnapshotChunk); + rpc ApplySnapshotChunk(RequestApplySnapshotChunk) returns (ResponseApplySnapshotChunk); +} diff --git a/third_party/proto/tendermint/blockchain/types.proto b/third_party/proto/tendermint/blockchain/types.proto new file mode 100644 index 00000000000..f5c143cf5b0 --- /dev/null +++ b/third_party/proto/tendermint/blockchain/types.proto @@ -0,0 +1,41 @@ +syntax = "proto3"; +package tendermint.blockchain; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/blockchain"; + +import "tendermint/types/block.proto"; + +// BlockRequest requests a block for a specific height +message BlockRequest { + int64 height = 1; +} + +// NoBlockResponse informs the node that the peer does not have block at the requested height +message NoBlockResponse { + int64 height = 1; +} + +// BlockResponse returns block to the requested +message BlockResponse { + tendermint.types.Block block = 1; +} + +// StatusRequest requests the status of a peer. +message StatusRequest { +} + +// StatusResponse is a peer response to inform their status. +message StatusResponse { + int64 height = 1; + int64 base = 2; +} + +message Message { + oneof sum { + BlockRequest block_request = 1; + NoBlockResponse no_block_response = 2; + BlockResponse block_response = 3; + StatusRequest status_request = 4; + StatusResponse status_response = 5; + } +} diff --git a/third_party/proto/tendermint/consensus/types.proto b/third_party/proto/tendermint/consensus/types.proto new file mode 100644 index 00000000000..6e1f4137110 --- /dev/null +++ b/third_party/proto/tendermint/consensus/types.proto @@ -0,0 +1,92 @@ +syntax = "proto3"; +package tendermint.consensus; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/consensus"; + +import "gogoproto/gogo.proto"; +import "tendermint/types/types.proto"; +import "tendermint/libs/bits/types.proto"; + +// NewRoundStep is sent for every step taken in the ConsensusState. +// For every height/round/step transition +message NewRoundStep { + int64 height = 1; + int32 round = 2; + uint32 step = 3; + int64 seconds_since_start_time = 4; + int32 last_commit_round = 5; +} + +// NewValidBlock is sent when a validator observes a valid block B in some round r, +//i.e., there is a Proposal for block B and 2/3+ prevotes for the block B in the round r. +// In case the block is also committed, then IsCommit flag is set to true. +message NewValidBlock { + int64 height = 1; + int32 round = 2; + tendermint.types.PartSetHeader block_part_set_header = 3 [(gogoproto.nullable) = false]; + tendermint.libs.bits.BitArray block_parts = 4; + bool is_commit = 5; +} + +// Proposal is sent when a new block is proposed. +message Proposal { + tendermint.types.Proposal proposal = 1 [(gogoproto.nullable) = false]; +} + +// ProposalPOL is sent when a previous proposal is re-proposed. +message ProposalPOL { + int64 height = 1; + int32 proposal_pol_round = 2; + tendermint.libs.bits.BitArray proposal_pol = 3 [(gogoproto.nullable) = false]; +} + +// BlockPart is sent when gossipping a piece of the proposed block. +message BlockPart { + int64 height = 1; + int32 round = 2; + tendermint.types.Part part = 3 [(gogoproto.nullable) = false]; +} + +// Vote is sent when voting for a proposal (or lack thereof). +message Vote { + tendermint.types.Vote vote = 1; +} + +// HasVote is sent to indicate that a particular vote has been received. +message HasVote { + int64 height = 1; + int32 round = 2; + tendermint.types.SignedMsgType type = 3; + int32 index = 4; +} + +// VoteSetMaj23 is sent to indicate that a given BlockID has seen +2/3 votes. +message VoteSetMaj23 { + int64 height = 1; + int32 round = 2; + tendermint.types.SignedMsgType type = 3; + tendermint.types.BlockID block_id = 4 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; +} + +// VoteSetBits is sent to communicate the bit-array of votes seen for the BlockID. +message VoteSetBits { + int64 height = 1; + int32 round = 2; + tendermint.types.SignedMsgType type = 3; + tendermint.types.BlockID block_id = 4 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; + tendermint.libs.bits.BitArray votes = 5 [(gogoproto.nullable) = false]; +} + +message Message { + oneof sum { + NewRoundStep new_round_step = 1; + NewValidBlock new_valid_block = 2; + Proposal proposal = 3; + ProposalPOL proposal_pol = 4; + BlockPart block_part = 5; + Vote vote = 6; + HasVote has_vote = 7; + VoteSetMaj23 vote_set_maj23 = 8; + VoteSetBits vote_set_bits = 9; + } +} diff --git a/third_party/proto/tendermint/consensus/wal.proto b/third_party/proto/tendermint/consensus/wal.proto new file mode 100644 index 00000000000..44afa2c0c3d --- /dev/null +++ b/third_party/proto/tendermint/consensus/wal.proto @@ -0,0 +1,46 @@ +syntax = "proto3"; +package tendermint.consensus; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/consensus"; + +import "gogoproto/gogo.proto"; +import "tendermint/consensus/types.proto"; +import "tendermint/types/events.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +// MsgInfo are msgs from the reactor which may update the state +message MsgInfo { + Message msg = 1 [(gogoproto.nullable) = false]; + string peer_id = 2 [(gogoproto.customname) = "PeerID"]; +} + +// TimeoutInfo internally generated messages which may update the state +message TimeoutInfo { + google.protobuf.Duration duration = 1 + [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; + int64 height = 2; + int32 round = 3; + uint32 step = 4; +} + +// EndHeight marks the end of the given height inside WAL. +// @internal used by scripts/wal2json util. +message EndHeight { + int64 height = 1; +} + +message WALMessage { + oneof sum { + tendermint.types.EventDataRoundState event_data_round_state = 1; + MsgInfo msg_info = 2; + TimeoutInfo timeout_info = 3; + EndHeight end_height = 4; + } +} + +// TimedWALMessage wraps WALMessage and adds Time for debugging purposes. +message TimedWALMessage { + google.protobuf.Timestamp time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + WALMessage msg = 2; +} diff --git a/third_party/proto/tendermint/mempool/types.proto b/third_party/proto/tendermint/mempool/types.proto new file mode 100644 index 00000000000..b55d9717b1b --- /dev/null +++ b/third_party/proto/tendermint/mempool/types.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package tendermint.mempool; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/mempool"; + +message Txs { + repeated bytes txs = 1; +} + +message Message { + oneof sum { + Txs txs = 1; + } +} diff --git a/third_party/proto/tendermint/p2p/pex.proto b/third_party/proto/tendermint/p2p/pex.proto new file mode 100644 index 00000000000..dfe238dbe60 --- /dev/null +++ b/third_party/proto/tendermint/p2p/pex.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; +package tendermint.p2p; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/p2p"; + +import "tendermint/p2p/types.proto"; +import "gogoproto/gogo.proto"; + +message PexRequest {} + +message PexAddrs { + repeated NetAddress addrs = 1 [(gogoproto.nullable) = false]; +} + +message Message { + oneof sum { + PexRequest pex_request = 1; + PexAddrs pex_addrs = 2; + } +} diff --git a/third_party/proto/tendermint/p2p/types.proto b/third_party/proto/tendermint/p2p/types.proto new file mode 100644 index 00000000000..0d42ea40029 --- /dev/null +++ b/third_party/proto/tendermint/p2p/types.proto @@ -0,0 +1,34 @@ +syntax = "proto3"; +package tendermint.p2p; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/p2p"; + +import "gogoproto/gogo.proto"; + +message NetAddress { + string id = 1 [(gogoproto.customname) = "ID"]; + string ip = 2 [(gogoproto.customname) = "IP"]; + uint32 port = 3; +} + +message ProtocolVersion { + uint64 p2p = 1 [(gogoproto.customname) = "P2P"]; + uint64 block = 2; + uint64 app = 3; +} + +message DefaultNodeInfo { + ProtocolVersion protocol_version = 1 [(gogoproto.nullable) = false]; + string default_node_id = 2 [(gogoproto.customname) = "DefaultNodeID"]; + string listen_addr = 3; + string network = 4; + string version = 5; + bytes channels = 6; + string moniker = 7; + DefaultNodeInfoOther other = 8 [(gogoproto.nullable) = false]; +} + +message DefaultNodeInfoOther { + string tx_index = 1; + string rpc_address = 2 [(gogoproto.customname) = "RPCAddress"]; +} diff --git a/third_party/proto/tendermint/privval/types.proto b/third_party/proto/tendermint/privval/types.proto new file mode 100644 index 00000000000..0fc8b61dc93 --- /dev/null +++ b/third_party/proto/tendermint/privval/types.proto @@ -0,0 +1,76 @@ +syntax = "proto3"; +package tendermint.privval; + +import "tendermint/crypto/keys.proto"; +import "tendermint/types/types.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/privval"; + +enum Errors { + ERRORS_UNKNOWN = 0; + ERRORS_UNEXPECTED_RESPONSE = 1; + ERRORS_NO_CONNECTION = 2; + ERRORS_CONNECTION_TIMEOUT = 3; + ERRORS_READ_TIMEOUT = 4; + ERRORS_WRITE_TIMEOUT = 5; +} + +message RemoteSignerError { + int32 code = 1; + string description = 2; +} + +// PubKeyRequest requests the consensus public key from the remote signer. +message PubKeyRequest { + string chain_id = 1; +} + +// PubKeyResponse is a response message containing the public key. +message PubKeyResponse { + tendermint.crypto.PublicKey pub_key = 1 [(gogoproto.nullable) = false]; + RemoteSignerError error = 2; +} + +// SignVoteRequest is a request to sign a vote +message SignVoteRequest { + tendermint.types.Vote vote = 1; + string chain_id = 2; +} + +// SignedVoteResponse is a response containing a signed vote or an error +message SignedVoteResponse { + tendermint.types.Vote vote = 1 [(gogoproto.nullable) = false]; + RemoteSignerError error = 2; +} + +// SignProposalRequest is a request to sign a proposal +message SignProposalRequest { + tendermint.types.Proposal proposal = 1; + string chain_id = 2; +} + +// SignedProposalResponse is response containing a signed proposal or an error +message SignedProposalResponse { + tendermint.types.Proposal proposal = 1 [(gogoproto.nullable) = false]; + RemoteSignerError error = 2; +} + +// PingRequest is a request to confirm that the connection is alive. +message PingRequest {} + +// PingResponse is a response to confirm that the connection is alive. +message PingResponse {} + +message Message { + oneof sum { + PubKeyRequest pub_key_request = 1; + PubKeyResponse pub_key_response = 2; + SignVoteRequest sign_vote_request = 3; + SignedVoteResponse signed_vote_response = 4; + SignProposalRequest sign_proposal_request = 5; + SignedProposalResponse signed_proposal_response = 6; + PingRequest ping_request = 7; + PingResponse ping_response = 8; + } +} diff --git a/third_party/proto/tendermint/state/types.proto b/third_party/proto/tendermint/state/types.proto new file mode 100644 index 00000000000..919da91e528 --- /dev/null +++ b/third_party/proto/tendermint/state/types.proto @@ -0,0 +1,75 @@ +syntax = "proto3"; +package tendermint.state; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/state"; + +import "gogoproto/gogo.proto"; +import "tendermint/abci/types.proto"; +import "tendermint/types/types.proto"; +import "tendermint/types/validator.proto"; +import "tendermint/types/params.proto"; +import "tendermint/version/types.proto"; +import "google/protobuf/timestamp.proto"; + +// ABCIResponses retains the responses +// of the various ABCI calls during block processing. +// It is persisted to disk for each height before calling Commit. +message ABCIResponses { + repeated tendermint.abci.ResponseDeliverTx deliver_txs = 1; + tendermint.abci.ResponseEndBlock end_block = 2; + tendermint.abci.ResponseBeginBlock begin_block = 3; +} + +// ValidatorsInfo represents the latest validator set, or the last height it changed +message ValidatorsInfo { + tendermint.types.ValidatorSet validator_set = 1; + int64 last_height_changed = 2; +} + +// ConsensusParamsInfo represents the latest consensus params, or the last height it changed +message ConsensusParamsInfo { + tendermint.types.ConsensusParams consensus_params = 1 [(gogoproto.nullable) = false]; + int64 last_height_changed = 2; +} + +message Version { + tendermint.version.Consensus consensus = 1 [(gogoproto.nullable) = false]; + string software = 2; +} + +message State { + Version version = 1 [(gogoproto.nullable) = false]; + + // immutable + string chain_id = 2 [(gogoproto.customname) = "ChainID"]; + int64 initial_height = 14; + + // LastBlockHeight=0 at genesis (ie. block(H=0) does not exist) + int64 last_block_height = 3; + tendermint.types.BlockID last_block_id = 4 + [(gogoproto.nullable) = false, (gogoproto.customname) = "LastBlockID"]; + google.protobuf.Timestamp last_block_time = 5 + [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + + // LastValidators is used to validate block.LastCommit. + // Validators are persisted to the database separately every time they change, + // so we can query for historical validator sets. + // Note that if s.LastBlockHeight causes a valset change, + // we set s.LastHeightValidatorsChanged = s.LastBlockHeight + 1 + 1 + // Extra +1 due to nextValSet delay. + tendermint.types.ValidatorSet next_validators = 6; + tendermint.types.ValidatorSet validators = 7; + tendermint.types.ValidatorSet last_validators = 8; + int64 last_height_validators_changed = 9; + + // Consensus parameters used for validating blocks. + // Changes returned by EndBlock and updated after Commit. + tendermint.types.ConsensusParams consensus_params = 10 [(gogoproto.nullable) = false]; + int64 last_height_consensus_params_changed = 11; + + // Merkle root of the results from executing prev block + bytes last_results_hash = 12; + + // the latest AppHash we've received from calling abci.Commit() + bytes app_hash = 13; +} diff --git a/third_party/proto/tendermint/statesync/types.proto b/third_party/proto/tendermint/statesync/types.proto new file mode 100644 index 00000000000..8d4a714c1db --- /dev/null +++ b/third_party/proto/tendermint/statesync/types.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; +package tendermint.statesync; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/statesync"; + +message Message { + oneof sum { + SnapshotsRequest snapshots_request = 1; + SnapshotsResponse snapshots_response = 2; + ChunkRequest chunk_request = 3; + ChunkResponse chunk_response = 4; + } +} + +message SnapshotsRequest {} + +message SnapshotsResponse { + uint64 height = 1; + uint32 format = 2; + uint32 chunks = 3; + bytes hash = 4; + bytes metadata = 5; +} + +message ChunkRequest { + uint64 height = 1; + uint32 format = 2; + uint32 index = 3; +} + +message ChunkResponse { + uint64 height = 1; + uint32 format = 2; + uint32 index = 3; + bytes chunk = 4; + bool missing = 5; +} diff --git a/third_party/proto/tendermint/store/types.proto b/third_party/proto/tendermint/store/types.proto new file mode 100644 index 00000000000..af2f97ad08c --- /dev/null +++ b/third_party/proto/tendermint/store/types.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; +package tendermint.store; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/store"; + +message BlockStoreState { + int64 base = 1; + int64 height = 2; +} diff --git a/third_party/proto/tendermint/types/block.proto b/third_party/proto/tendermint/types/block.proto new file mode 100644 index 00000000000..84e9bb15d86 --- /dev/null +++ b/third_party/proto/tendermint/types/block.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package tendermint.types; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; + +import "gogoproto/gogo.proto"; +import "tendermint/types/types.proto"; +import "tendermint/types/evidence.proto"; + +message Block { + Header header = 1 [(gogoproto.nullable) = false]; + Data data = 2 [(gogoproto.nullable) = false]; + tendermint.types.EvidenceList evidence = 3 [(gogoproto.nullable) = false]; + Commit last_commit = 4; +} diff --git a/third_party/proto/tendermint/types/canonical.proto b/third_party/proto/tendermint/types/canonical.proto new file mode 100644 index 00000000000..e88fd6ffe31 --- /dev/null +++ b/third_party/proto/tendermint/types/canonical.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; +package tendermint.types; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; + +import "gogoproto/gogo.proto"; +import "tendermint/types/types.proto"; +import "google/protobuf/timestamp.proto"; + +message CanonicalBlockID { + bytes hash = 1; + CanonicalPartSetHeader part_set_header = 2 [(gogoproto.nullable) = false]; +} + +message CanonicalPartSetHeader { + uint32 total = 1; + bytes hash = 2; +} + +message CanonicalProposal { + SignedMsgType type = 1; // type alias for byte + sfixed64 height = 2; // canonicalization requires fixed size encoding here + sfixed64 round = 3; // canonicalization requires fixed size encoding here + int64 pol_round = 4 [(gogoproto.customname) = "POLRound"]; + CanonicalBlockID block_id = 5 [(gogoproto.customname) = "BlockID"]; + google.protobuf.Timestamp timestamp = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + string chain_id = 7 [(gogoproto.customname) = "ChainID"]; +} + +message CanonicalVote { + SignedMsgType type = 1; // type alias for byte + sfixed64 height = 2; // canonicalization requires fixed size encoding here + sfixed64 round = 3; // canonicalization requires fixed size encoding here + CanonicalBlockID block_id = 4 [(gogoproto.customname) = "BlockID"]; + google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + string chain_id = 6 [(gogoproto.customname) = "ChainID"]; +} diff --git a/third_party/proto/tendermint/types/events.proto b/third_party/proto/tendermint/types/events.proto new file mode 100644 index 00000000000..a1e5cc498d2 --- /dev/null +++ b/third_party/proto/tendermint/types/events.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; +package tendermint.types; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; + +message EventDataRoundState { + int64 height = 1; + int32 round = 2; + string step = 3; +} diff --git a/third_party/proto/tendermint/types/evidence.proto b/third_party/proto/tendermint/types/evidence.proto new file mode 100644 index 00000000000..3b234571ba6 --- /dev/null +++ b/third_party/proto/tendermint/types/evidence.proto @@ -0,0 +1,38 @@ +syntax = "proto3"; +package tendermint.types; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; +import "tendermint/types/types.proto"; +import "tendermint/types/validator.proto"; + +message Evidence { + oneof sum { + DuplicateVoteEvidence duplicate_vote_evidence = 1; + LightClientAttackEvidence light_client_attack_evidence = 2; + } +} + +// DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. +message DuplicateVoteEvidence { + tendermint.types.Vote vote_a = 1; + tendermint.types.Vote vote_b = 2; + int64 total_voting_power = 3; + int64 validator_power = 4; + google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; +} + +// LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. +message LightClientAttackEvidence { + tendermint.types.LightBlock conflicting_block = 1; + int64 common_height = 2; + repeated tendermint.types.Validator byzantine_validators = 3; + int64 total_voting_power = 4; + google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; +} + +message EvidenceList { + repeated Evidence evidence = 1 [(gogoproto.nullable) = false]; +} diff --git a/third_party/proto/tendermint/types/params.proto b/third_party/proto/tendermint/types/params.proto new file mode 100644 index 00000000000..0de7d846fbd --- /dev/null +++ b/third_party/proto/tendermint/types/params.proto @@ -0,0 +1,80 @@ +syntax = "proto3"; +package tendermint.types; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; + +import "gogoproto/gogo.proto"; +import "google/protobuf/duration.proto"; + +option (gogoproto.equal_all) = true; + +// ConsensusParams contains consensus critical parameters that determine the +// validity of blocks. +message ConsensusParams { + BlockParams block = 1 [(gogoproto.nullable) = false]; + EvidenceParams evidence = 2 [(gogoproto.nullable) = false]; + ValidatorParams validator = 3 [(gogoproto.nullable) = false]; + VersionParams version = 4 [(gogoproto.nullable) = false]; +} + +// BlockParams contains limits on the block size. +message BlockParams { + // Max block size, in bytes. + // Note: must be greater than 0 + int64 max_bytes = 1; + // Max gas per block. + // Note: must be greater or equal to -1 + int64 max_gas = 2; + // Minimum time increment between consecutive blocks (in milliseconds) If the + // block header timestamp is ahead of the system clock, decrease this value. + // + // Not exposed to the application. + int64 time_iota_ms = 3; +} + +// EvidenceParams determine how we handle evidence of malfeasance. +message EvidenceParams { + // Max age of evidence, in blocks. + // + // The basic formula for calculating this is: MaxAgeDuration / {average block + // time}. + int64 max_age_num_blocks = 1; + + // Max age of evidence, in time. + // + // It should correspond with an app's "unbonding period" or other similar + // mechanism for handling [Nothing-At-Stake + // attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + google.protobuf.Duration max_age_duration = 2 + [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; + + // This sets the maximum size of total evidence in bytes that can be committed in a single block. + // and should fall comfortably under the max block bytes. + // Default is 1048576 or 1MB + int64 max_bytes = 3; +} + +// ValidatorParams restrict the public key types validators can use. +// NOTE: uses ABCI pubkey naming, not Amino names. +message ValidatorParams { + option (gogoproto.populate) = true; + option (gogoproto.equal) = true; + + repeated string pub_key_types = 1; +} + +// VersionParams contains the ABCI application version. +message VersionParams { + option (gogoproto.populate) = true; + option (gogoproto.equal) = true; + + uint64 app_version = 1; +} + +// HashedParams is a subset of ConsensusParams. +// +// It is hashed into the Header.ConsensusHash. +message HashedParams { + int64 block_max_bytes = 1; + int64 block_max_gas = 2; +}