From 6aec12f84cd95ec2985cec06400861fb761774d6 Mon Sep 17 00:00:00 2001 From: Michael Tsitrin Date: Wed, 29 Jan 2025 12:24:47 +0200 Subject: [PATCH 1/8] converting when paying to proposer --- go.mod | 23 +++++++-- go.sum | 75 ++++++++++++++++++++---------- testutil/utils/accounts.go | 11 +++++ x/dist/keeper/allocation.go | 80 +++++++++++++++++++++----------- x/dist/keeper/allocation_test.go | 9 ++-- x/dist/keeper/keeper.go | 3 ++ x/dist/types/expected_keepers.go | 9 ++++ x/staking/module.go | 2 +- 8 files changed, 153 insertions(+), 59 deletions(-) diff --git a/go.mod b/go.mod index 8605fc1c..12711726 100644 --- a/go.mod +++ b/go.mod @@ -18,6 +18,8 @@ require ( github.com/dymensionxyz/dymint v1.3.0-rc04 github.com/dymensionxyz/gerr-cosmos v1.0.0 github.com/dymensionxyz/sdk-utils v0.1.2-0.20240909101947-e1b483ada9c8 + github.com/ethereum/go-ethereum v1.12.0 + github.com/evmos/evmos/v12 v12.1.6 github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.4 github.com/gorilla/mux v1.8.1 @@ -51,6 +53,8 @@ require ( github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect github.com/DataDog/zstd v1.5.5 // indirect github.com/Jorropo/jsync v1.0.1 // indirect + github.com/StackExchange/wmi v1.2.1 // indirect + github.com/VictoriaMetrics/fastcache v1.6.0 // indirect github.com/Workiva/go-datastructures v1.0.53 // indirect github.com/armon/go-metrics v0.4.1 // indirect github.com/avast/retry-go/v4 v4.5.0 // indirect @@ -117,14 +121,14 @@ require ( github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.5.0 // indirect github.com/dymensionxyz/cosmosclient v0.4.2-beta.0.20241121093220-e0d7ad456fbd // indirect + github.com/edsrzf/mmap-go v1.0.0 // indirect github.com/elastic/gosigar v0.14.2 // indirect - github.com/ethereum/go-ethereum v1.12.0 // indirect - github.com/evmos/evmos/v12 v12.1.6 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/filecoin-project/go-jsonrpc v0.5.0 // indirect github.com/flynn/noise v1.1.0 // indirect github.com/francoispqt/gojay v1.2.13 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect github.com/getsentry/sentry-go v0.23.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect github.com/go-kit/kit v0.12.0 // indirect @@ -132,6 +136,7 @@ require ( github.com/go-logfmt/logfmt v0.6.0 // indirect github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect @@ -168,6 +173,7 @@ require ( github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 // indirect + github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/holiman/uint256 v1.2.2 // indirect github.com/huin/goupnp v1.3.0 // indirect github.com/ignite/cli v0.26.1 // indirect @@ -222,6 +228,7 @@ require ( github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-runewidth v0.0.14 // indirect github.com/miekg/dns v1.1.58 // indirect github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect @@ -243,6 +250,7 @@ require ( github.com/multiformats/go-multihash v0.2.3 // indirect github.com/multiformats/go-multistream v0.5.0 // indirect github.com/multiformats/go-varint v0.0.7 // indirect + github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/onsi/ginkgo v1.16.5 // indirect github.com/onsi/ginkgo/v2 v2.15.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect @@ -259,21 +267,26 @@ require ( github.com/prometheus/client_model v0.6.0 // indirect github.com/prometheus/common v0.47.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect + github.com/prometheus/tsdb v0.10.0 // indirect github.com/quic-go/qpack v0.4.0 // indirect github.com/quic-go/quic-go v0.42.0 // indirect github.com/quic-go/webtransport-go v0.6.0 // indirect github.com/raulk/go-watchdog v1.3.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/regen-network/cosmos-proto v0.3.1 // indirect + github.com/rivo/uniseg v0.2.0 // indirect + github.com/rjeczalik/notify v0.9.2 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/rs/cors v1.9.0 // indirect github.com/rs/zerolog v1.29.1 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect + github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/afero v1.9.3 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.15.0 // indirect + github.com/status-im/keycard-go v0.0.0-20200402102358-957c09536969 // indirect github.com/subosito/gotenv v1.4.2 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect @@ -282,6 +295,7 @@ require ( github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.1 // indirect github.com/tidwall/sjson v1.2.5 // indirect + github.com/tklauser/go-sysconf v0.3.11 // indirect github.com/tklauser/numcpus v0.6.0 // indirect github.com/tyler-smith/go-bip39 v1.1.0 // indirect github.com/ulikunitz/xz v0.5.10 // indirect @@ -338,7 +352,10 @@ replace ( // Dymension Forks replace ( github.com/cosmos/cosmos-sdk => github.com/dymensionxyz/cosmos-sdk v0.46.17-0.20241128210616-e9dfe47b8c73 - github.com/evmos/evmos/v12 => github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.3 + // use Evmos geth fork + github.com/ethereum/go-ethereum => github.com/evmos/go-ethereum v1.10.26 + github.com/evmos/evmos/v12 => github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.5.0-rc02 + github.com/gorilla/rpc => github.com/dymensionxyz/rpc v1.3.1 github.com/tendermint/tendermint => github.com/dymensionxyz/cometbft v0.34.29-0.20241128205759-2a9d5f015da5 ) diff --git a/go.sum b/go.sum index 622bfa46..54fc7ea7 100644 --- a/go.sum +++ b/go.sum @@ -225,6 +225,7 @@ github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= @@ -269,6 +270,8 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= +github.com/allegro/bigcache v1.2.1 h1:hg1sY1raCwic3Vnsvje6TT7/pnZba83LeFck5NrFKSc= +github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= @@ -327,8 +330,8 @@ github.com/btcsuite/btcd v0.23.0/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZg github.com/btcsuite/btcd v0.23.4 h1:IzV6qqkfwbItOS/sg/aDfPDsjPP8twrCOE2R93hxMlQ= github.com/btcsuite/btcd v0.23.4/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= -github.com/btcsuite/btcd/btcec/v2 v2.1.2/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= +github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A= @@ -379,6 +382,7 @@ github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInq github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= @@ -474,9 +478,12 @@ github.com/cosmos/interchain-accounts v0.4.3 h1:WedxEa/Hj/2GY7AF6CafkEPJ/Z9rhl3r github.com/cosmos/interchain-accounts v0.4.3/go.mod h1:qibHB6y/R2YsuuZdamI2BcIUBPMyhyELDWAr8Nk8x4g= github.com/cosmos/ledger-cosmos-go v0.12.4 h1:drvWt+GJP7Aiw550yeb3ON/zsrgW0jgh5saFCr7pDnw= github.com/cosmos/ledger-cosmos-go v0.12.4/go.mod h1:fjfVWRf++Xkygt9wzCsjEBdjcf7wiiY35fv3ctT+k4M= +github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creachadair/taskgroup v0.3.2 h1:zlfutDS+5XG40AOxcHDSThxKzns8Tnr9jnr6VqkYlkM= github.com/creachadair/taskgroup v0.3.2/go.mod h1:wieWwecHVzsidg2CsUnFinW1faVN4+kq+TDlRJQ0Wbk= @@ -501,8 +508,6 @@ github.com/decentrio/wasmd v0.33.0-sdk46.2 h1:cUgYN8crDXiQiKLBYfGR5IXg77Z/QrvZBo github.com/decentrio/wasmd v0.33.0-sdk46.2/go.mod h1:mPBiB+54La70eS2HHzvK2Vn7Frgf7rjnxDo70oopw+w= github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= -github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6dtGktsI= -github.com/deckarep/golang-set/v2 v2.1.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= github.com/decred/base58 v1.0.4 h1:QJC6B0E0rXOPA8U/kw2rP+qiRJsUaE2Er+pYb3siUeA= github.com/decred/base58 v1.0.4/go.mod h1:jJswKPEdvpFpvf7dsDvFZyLT22xZ9lWqEByX38oGd9E= github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= @@ -533,16 +538,15 @@ github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUn github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 h1:Izz0+t1Z5nI16/II7vuEo/nHjodOg0p7+OiDpjX5t1E= github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo= -github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= github.com/docker/cli v23.0.1+incompatible h1:LRyWITpGzl2C9e9uGxzisptnxAn1zfZKXy13Ul2Q5oM= github.com/docker/cli v23.0.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v1.6.2/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v23.0.1+incompatible h1:vjgvJZxprTTE1A37nm+CLNAdwu6xZekyoiVlUZEINcY= github.com/docker/docker v23.0.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= @@ -550,9 +554,8 @@ github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5Xh github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= -github.com/dop251/goja v0.0.0-20230122112309-96b1610dd4f7 h1:kgvzE5wLsLa7XKfV85VZl40QXaMCaeFtHpPwJ8fhotY= -github.com/dop251/goja v0.0.0-20230122112309-96b1610dd4f7/go.mod h1:yRkwfj0CBpOGre+TwBsqPV0IH0Pk73e4PXJOeNDboGs= +github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf h1:Yt+4K30SdjOkRoRRm3vYNQgR+/ZIy0RmeUDZo7Y8zeQ= +github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -568,8 +571,8 @@ github.com/dymensionxyz/cosmosclient v0.4.2-beta.0.20241121093220-e0d7ad456fbd h github.com/dymensionxyz/cosmosclient v0.4.2-beta.0.20241121093220-e0d7ad456fbd/go.mod h1:3weqpVj/TqTFpC0LjEB3H+HZSpm7BrQ1QkEg1Ahy6KY= github.com/dymensionxyz/dymint v1.3.0-rc04 h1:h7mEfgyQB+a4H+FxhPSm/Ewefhk90rRNge0+NV5IcDk= github.com/dymensionxyz/dymint v1.3.0-rc04/go.mod h1:sqE+4imdASE9lm63jv+K2zmOnclLJNZLPYbL9m6vR3o= -github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.3 h1:vmAdUGUc4rTIiO3Phezr7vGq+0uPDVKSA4WAe8+yl6w= -github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.3/go.mod h1:LfPv2O1HXMgETpka81Pg3nXy+U/7urq8dn85ZnSXK5Y= +github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.5.0-rc02 h1:G6rtzFNnzeYOHN33rkw0kMQX+xRantRLTip1AMXYmBg= +github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.5.0-rc02/go.mod h1:CI6D89pkoiIm4BjoMFNnEaCLdKBEobLuwvhS0c1zh7Y= github.com/dymensionxyz/gerr-cosmos v1.0.0 h1:oi91rgOkpJWr41oX9JOyjvvBnhGY54tj513x8VlDAEc= github.com/dymensionxyz/gerr-cosmos v1.0.0/go.mod h1:n+0olxPogzWqFKba45mCpvrHLGmeS8W9UZjggHnWk6c= github.com/dymensionxyz/rpc v1.3.1 h1:7EXWIobaBes5zldRvTIg7TmNsEKjicrWA/OjCc0NaGs= @@ -580,6 +583,7 @@ github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5m github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= +github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/elastic/gosigar v0.12.0/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4= @@ -595,9 +599,8 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ethereum/go-ethereum v1.10.17/go.mod h1:Lt5WzjM07XlXc95YzrhosmR4J9Ahd6X2wyEV2SvGhk0= -github.com/ethereum/go-ethereum v1.12.0 h1:bdnhLPtqETd4m3mS8BGMNvBTf36bO5bx/hxE2zljOa0= -github.com/ethereum/go-ethereum v1.12.0/go.mod h1:/oo2X/dZLJjf2mJ6YT9wcWxa4nNJDBKDBU6sFIpx1Gs= +github.com/evmos/go-ethereum v1.10.26 h1:7wlczxUWTwhzJJUyh3Kkqt3/5fdSJzh8c42boc9GuII= +github.com/evmos/go-ethereum v1.10.26/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= @@ -611,6 +614,8 @@ github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2 github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/filecoin-project/go-jsonrpc v0.5.0 h1:6PZghgMaM9wSjlhxkDD+YgZ+oucBUIkJOfVc7SdQBTE= github.com/filecoin-project/go-jsonrpc v0.5.0/go.mod h1:/n/niXcS4ZQua6i37LcVbY1TmlJR0UIK9mDFQq2ICek= +github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY= +github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/flynn/noise v1.1.0 h1:KjPQoQCEFdZDiP03phOvGi11+SVVhBG2wOWAorLsstg= @@ -628,6 +633,7 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61/go.mod h1:Q0X6pkwTILDlzrGEckF6HKjXe48EgsY/l7K7vhY4MW8= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= @@ -669,6 +675,7 @@ github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ4 github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= +github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= @@ -711,12 +718,11 @@ github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= -github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/gateway v1.1.0 h1:u0SuhL9+Il+UbjM9VIE3ntfRujKbvVpFvNB4HbjeVQ0= github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog= github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= @@ -759,6 +765,7 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= @@ -896,6 +903,7 @@ github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyN github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= @@ -945,7 +953,7 @@ github.com/holiman/uint256 v1.2.2 h1:TXKcSGc2WaxPD2+bmzAsVthL4+pEN0YwXcL5qED83vk github.com/holiman/uint256 v1.2.2/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/huin/goupnp v1.0.3-0.20220313090229-ca81a64b4204/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= +github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= @@ -1086,7 +1094,7 @@ github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= @@ -1208,6 +1216,7 @@ github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL8KKeFNecRCXFhaJ2qZ5SKA= github.com/moby/term v0.0.0-20221205130635-1aeaba878587/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= @@ -1277,6 +1286,7 @@ github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= @@ -1392,6 +1402,8 @@ github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/prometheus/tsdb v0.10.0 h1:If5rVCMTp6W2SiRAQFlbpJNgVlgMEd+U2GZckwK38ic= +github.com/prometheus/tsdb v0.10.0/go.mod h1:oi49uRhEe9dPUTlS3JRZOwJuVi6tmh10QSgwXEyGCt4= github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= github.com/quic-go/quic-go v0.42.0 h1:uSfdap0eveIl8KXnipv9K7nlwZ5IqLlYOpJ58u5utpM= @@ -1413,6 +1425,8 @@ github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1 github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= +github.com/rjeczalik/notify v0.9.2 h1:MiTWrPj55mNDHEiIX5YUSKefw/+lCQVoAFmD6oQm5w8= +github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= @@ -1425,8 +1439,10 @@ github.com/rs/cors v1.9.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc= github.com/rs/zerolog v1.29.1/go.mod h1:Le6ESbR7hc+DP6Lt1THiV8CQSdkkNrd3R0XbEgp3ZBU= +github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= 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 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= @@ -1502,8 +1518,8 @@ github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DM 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/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= -github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= -github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= +github.com/status-im/keycard-go v0.0.0-20200402102358-957c09536969 h1:Oo2KZNP70KE0+IUJSidPj/BFS/RXNHmKIJOdckzml2E= +github.com/status-im/keycard-go v0.0.0-20200402102358-957c09536969/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= 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= @@ -1521,12 +1537,14 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= 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/supranational/blst v0.3.8-0.20220526154634-513d2456b344/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= @@ -1575,8 +1593,11 @@ github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0o github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/urfave/cli v1.22.10 h1:p8Fspmz3iTctJstry1PYS3HVdllxnEzTEsgIgtxTrCk= github.com/urfave/cli v1.22.10/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= +github.com/urfave/cli/v2 v2.10.2 h1:x3p8awjp/2arX+Nl/G2040AZpOCHS/eMJJ1/a+mye4Y= +github.com/urfave/cli/v2 v2.10.2/go.mod h1:f8iq5LtQ/bLxafbdBSLPPNsgaW0l/2fYYEHhAyPlwvo= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= @@ -1604,12 +1625,15 @@ github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= github.com/ybbus/jsonrpc v2.1.2+incompatible/go.mod h1:XJrh1eMSzdIYFbM08flv0wp5G35eRniyeGut1z+LSiE= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= @@ -1725,6 +1749,7 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/exp v0.0.0-20220426173459-3bcf042a4bf5/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE= golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c h1:7dEasQXItcW1xKJ2+gg5VOiBnqWrJc+rq0DPKyvvdbY= golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= @@ -1754,6 +1779,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/mod v0.6.0-dev.0.20211013180041-c96bc1413d57/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= @@ -1878,6 +1905,7 @@ golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180926160741-c2ed4eda69e7/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1900,6 +1928,7 @@ golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1959,7 +1988,6 @@ golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -2046,6 +2074,7 @@ golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191126055441-b0650ceb63d9/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -2084,6 +2113,7 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.8-0.20211029000441-d6a9af8af023/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= @@ -2372,11 +2402,9 @@ gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXL gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= -gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= 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= -gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -2393,7 +2421,6 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY= gotest.tools/v3 v3.5.0/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= diff --git a/testutil/utils/accounts.go b/testutil/utils/accounts.go index 94b1497a..fa41548c 100644 --- a/testutil/utils/accounts.go +++ b/testutil/utils/accounts.go @@ -42,6 +42,17 @@ func AddTestAddrs(app *app.App, ctx sdk.Context, accNum int, accAmt math.Int) [] return testAddrs } +// ConvertAddrsToValAddrs converts the provided addresses to ValAddress. +func ConvertAddrsToValAddrs(addrs []sdk.AccAddress) []sdk.ValAddress { + valAddrs := make([]sdk.ValAddress, len(addrs)) + + for i, addr := range addrs { + valAddrs[i] = sdk.ValAddress(addr) + } + + return valAddrs +} + func InitAccountWithCoins(app *app.App, ctx sdk.Context, addr sdk.AccAddress, coins sdk.Coins) { err := app.BankKeeper.MintCoins(ctx, ibctransfertypes.ModuleName, coins) if err != nil { diff --git a/x/dist/keeper/allocation.go b/x/dist/keeper/allocation.go index 6b05ec6e..e76f9cdc 100644 --- a/x/dist/keeper/allocation.go +++ b/x/dist/keeper/allocation.go @@ -1,10 +1,14 @@ package keeper import ( + "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/distribution/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" disttypes "github.com/dymensionxyz/dymension-rdk/x/dist/types" + "github.com/ethereum/go-ethereum/common" + erc20types "github.com/evmos/evmos/v12/x/erc20/types" ) // AllocateTokens handles distribution of the collected fees @@ -19,46 +23,37 @@ func (k Keeper) AllocateTokens(ctx sdk.Context, blockProposer sdk.ConsAddress) { feesCollected := sdk.NewDecCoinsFromCoins(feesCollectedInt...) feePool := k.GetFeePool(ctx) - remainingFees := feesCollected - // transfer collected fees to the distribution module account err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, k.feeCollectorName, types.ModuleName, feesCollectedInt) if err != nil { - panic(err) + k.Logger(ctx).Error("Failed to transfer collected fees to the distribution module account", "err", err) + return } + remainingFees := feesCollected /* ---------------------------- Pay the proposer ---------------------------- */ - // calculate and pay proposer reward + proposerMultiplier := k.GetBaseProposerReward(ctx) + proposerReward := feesCollected.MulDecTruncate(k.GetBaseProposerReward(ctx)) + + // FIXME: wrap in cache context addr, found := k.seqKeeper.GetRewardAddrByConsAddr(ctx, blockProposer) if !found { logger.Error("Find the validator for this block. Reward not allocated.", "addr", blockProposer) } else { - proposerReward := feesCollected.MulDecTruncate(k.GetBaseProposerReward(ctx)) - proposerCoins, proposerRemainder := proposerReward.TruncateDecimal() - if !proposerCoins.IsZero() { - err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, addr, proposerCoins) - if err != nil { - logger.Error("Send rewards to proposer.", "err", err, "proposer reward addr", addr) - } else { - remainingFees = feesCollected.Sub(proposerReward).Add(proposerRemainder...) - // update outstanding rewards - ctx.EventManager().EmitEvent( - sdk.NewEvent( - disttypes.EventTypeDistSequencerRewards, - sdk.NewAttribute(sdk.AttributeKeyAmount, proposerCoins.String()), - sdk.NewAttribute(disttypes.AttributeKeyRewardee, addr.String()), - ), - ) - } + err := k.AllocateTokensToProposer(ctx, addr, proposerReward) + if err == nil { + remainingFees = feesCollected.Sub(proposerReward) + } else { + // in case of error, the fees will go to the community pool + logger.Error("Failed to allocate proposer reward", "err", err) } } /* ---------------------- reward the members/validators ---------------------- */ - totalPreviousPower := k.stakingKeeper.GetLastTotalPower(ctx) - - membersMultiplier := sdk.OneDec().Sub(k.GetBaseProposerReward(ctx)).Sub(k.GetCommunityTax(ctx)) + membersMultiplier := sdk.OneDec().Sub(proposerMultiplier).Sub(k.GetCommunityTax(ctx)) membersRewards := feesCollected.MulDecTruncate(membersMultiplier) + totalPreviousPower := k.stakingKeeper.GetLastTotalPower(ctx) k.stakingKeeper.IterateBondedValidatorsByPower(ctx, func(index int64, validator stakingtypes.ValidatorI) (stop bool) { // Staking module calculates power factored by sdk.DefaultPowerReduction. hardcoded. valPower := validator.GetConsensusPower(sdk.DefaultPowerReduction) @@ -66,12 +61,45 @@ func (k Keeper) AllocateTokens(ctx sdk.Context, blockProposer sdk.ConsAddress) { reward := membersRewards.MulDecTruncate(powerFraction) k.AllocateTokensToValidator(ctx, validator, reward) - remainingFees = remainingFees.Sub(reward) - return false }) + remainingFees = feesCollected.Sub(membersRewards) /* ------------------------- fund the community pool ------------------------ */ feePool.CommunityPool = feePool.CommunityPool.Add(remainingFees...) k.SetFeePool(ctx, feePool) } + +func (k Keeper) AllocateTokensToProposer(ctx sdk.Context, proposer sdk.AccAddress, proposerRewardDec sdk.DecCoins) error { + proposerReward, _ := proposerRewardDec.TruncateDecimal() + + // handle each coin separately + // if erc20 coin, call convert coin + // if native coin, send to proposer address + for _, coin := range proposerReward { + if k.erc20k.IsDenomRegistered(ctx, coin.Denom) { + msg := erc20types.NewMsgConvertCoin(coin, common.BytesToAddress(proposer), proposer) + if _, err := k.erc20k.ConvertCoin(sdk.WrapSDKContext(ctx), msg); err != nil { + k.Logger(ctx).Error("failed to convert coin", "err", err, "proposer", proposer) + return fmt.Errorf("failed to convert proposer reward: %w", err) + } + // event emitted in convert coin handler + } else { + err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, proposer, proposerReward) + if err != nil { + k.Logger(ctx).Error("Send rewards to proposer.", "err", err, "proposer reward addr", proposer) + return fmt.Errorf("failed to send proposer reward: %w", err) + } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + disttypes.EventTypeDistSequencerRewards, + sdk.NewAttribute(sdk.AttributeKeyAmount, proposerReward.String()), + sdk.NewAttribute(disttypes.AttributeKeyRewardee, proposer.String()), + ), + ) + } + } + + return nil +} diff --git a/x/dist/keeper/allocation_test.go b/x/dist/keeper/allocation_test.go index b00186c8..3303a554 100644 --- a/x/dist/keeper/allocation_test.go +++ b/x/dist/keeper/allocation_test.go @@ -11,7 +11,6 @@ import ( abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -22,7 +21,7 @@ import ( ) var ( - PKS = simapp.CreateTestPubKeys(5) + PKS = utils.CreateTestPubKeys(5) valConsPk1 = PKS[0] valConsPk2 = PKS[1] @@ -64,7 +63,7 @@ func fundModules(t *testing.T, ctx sdk.Context, app *app.App) { func createValidators(t *testing.T, ctx sdk.Context, app *app.App) []sdk.ValAddress { addrs := utils.AddTestAddrs(app, ctx, 2, sdk.TokensFromConsensusPower(10, sdk.DefaultPowerReduction)) - valAddrs := simapp.ConvertAddrsToValAddrs(addrs) + valAddrs := utils.ConvertAddrsToValAddrs(addrs) tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper.Keeper) // create validator with 6 power and 50% commission @@ -269,7 +268,7 @@ func TestAllocateTokensTruncation(t *testing.T) { ctx := app.BaseApp.NewContext(false, tmproto.Header{}) addrs := utils.AddTestAddrs(app, ctx, 3, sdk.NewInt(1234)) - valAddrs := simapp.ConvertAddrsToValAddrs(addrs) + valAddrs := utils.ConvertAddrsToValAddrs(addrs) tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper.Keeper) // create validator with 10% commission @@ -343,7 +342,7 @@ func TestAllocateTokensToValidatorWithCommission(t *testing.T) { ctx := app.BaseApp.NewContext(false, tmproto.Header{}) addrs := utils.AddTestAddrs(app, ctx, 3, sdk.NewInt(1234)) - valAddrs := simapp.ConvertAddrsToValAddrs(addrs) + valAddrs := utils.ConvertAddrsToValAddrs(addrs) tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper.Keeper) // create validator with 50% commission diff --git a/x/dist/keeper/keeper.go b/x/dist/keeper/keeper.go index 64f8022b..0f7cb17c 100644 --- a/x/dist/keeper/keeper.go +++ b/x/dist/keeper/keeper.go @@ -18,6 +18,7 @@ type Keeper struct { bankKeeper disttypes.BankKeeper stakingKeeper types.StakingKeeper seqKeeper types.SequencerKeeper + erc20k types.ERC20Keeper feeCollectorName string } @@ -31,6 +32,7 @@ func NewKeeper( bk disttypes.BankKeeper, sk types.StakingKeeper, seqk types.SequencerKeeper, + erc20k types.ERC20Keeper, feeCollectorName string, ) Keeper { k := distkeeper.NewKeeper(cdc, key, paramSpace, ak, bk, sk, feeCollectorName) @@ -40,6 +42,7 @@ func NewKeeper( bankKeeper: bk, stakingKeeper: sk, seqKeeper: seqk, + erc20k: erc20k, feeCollectorName: feeCollectorName, } } diff --git a/x/dist/types/expected_keepers.go b/x/dist/types/expected_keepers.go index 3d71804c..91c7018f 100644 --- a/x/dist/types/expected_keepers.go +++ b/x/dist/types/expected_keepers.go @@ -1,10 +1,13 @@ package types import ( + "context" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + erc20types "github.com/evmos/evmos/v12/x/erc20/types" ) // SequencerKeeper expected sequencer keeper (noalias) @@ -35,3 +38,9 @@ type StakingKeeper interface { GetAllSDKDelegations(ctx sdk.Context) []stakingtypes.Delegation } + +// ERC20Keeper expected ERC20 keeper (noalias) +type ERC20Keeper interface { + IsDenomRegistered(ctx sdk.Context, denom string) bool + ConvertCoin(ctx context.Context, msg *erc20types.MsgConvertCoin) (*erc20types.MsgConvertCoinResponse, error) +} diff --git a/x/staking/module.go b/x/staking/module.go index 50ab4c91..98f0b826 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -38,7 +38,7 @@ func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak types.AccountKeeper, } func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - _ = staking.EndBlocker(ctx, am.keeper.Keeper) + am.keeper.BlockValidatorUpdates(ctx) return []abci.ValidatorUpdate{} } From 9bdc626af6d281811a28a23ad484abbbcf341832 Mon Sep 17 00:00:00 2001 From: Michael Tsitrin Date: Wed, 29 Jan 2025 12:37:00 +0200 Subject: [PATCH 2/8] handle undelegate erc20 tokens --- x/staking/keeper/keeper.go | 93 ++++++++++++++++++++++++++++- x/staking/types/expected_keepers.go | 14 +++++ 2 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 x/staking/types/expected_keepers.go diff --git a/x/staking/keeper/keeper.go b/x/staking/keeper/keeper.go index 66087bba..6c785302 100644 --- a/x/staking/keeper/keeper.go +++ b/x/staking/keeper/keeper.go @@ -2,6 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" abci "github.com/tendermint/tendermint/abci/types" storetypes "github.com/cosmos/cosmos-sdk/store/types" @@ -10,6 +11,8 @@ import ( paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" "github.com/cosmos/cosmos-sdk/x/staking/types" + types2 "github.com/dymensionxyz/dymension-rdk/x/staking/types" + erc20types "github.com/evmos/evmos/v12/x/erc20/types" ) // Implements ValidatorSet interface @@ -21,16 +24,18 @@ var _ types.DelegationSet = Keeper{} // keeper of the staking store type Keeper struct { stakingkeeper.Keeper + erc20k types2.ERC20Keeper } // NewKeeper creates a new staking Keeper instance func NewKeeper( cdc codec.BinaryCodec, key storetypes.StoreKey, ak types.AccountKeeper, bk types.BankKeeper, - ps paramtypes.Subspace, + erc20k types2.ERC20Keeper, ps paramtypes.Subspace, ) Keeper { k := stakingkeeper.NewKeeper(cdc, key, ak, bk, ps) return Keeper{ Keeper: k, + erc20k: erc20k, } } @@ -46,3 +51,89 @@ func (k *Keeper) SetHooks(sh types.StakingHooks) *Keeper { k.Keeper = *k.Keeper.SetHooks(sh) return k } + +func MustValAddressFromBech32(addr string) sdk.ValAddress { + valAddr, err := sdk.ValAddressFromBech32(addr) + if err != nil { + panic(err) + } + + return valAddr +} + +// BlockValidatorUpdates calculates the ValidatorUpdates for the current block +// Called in each EndBlock +// It was copied from the staking module, and modified to add erc20 conversion after unbonding +func (k Keeper) BlockValidatorUpdates(ctx sdk.Context) { + _, err := k.ApplyAndReturnValidatorSetUpdates(ctx) + if err != nil { + k.Logger(ctx).Error("Failed to apply and return validator set updates", "err", err) + return + } + + // unbond all mature validators from the unbonding queue + k.UnbondAllMatureValidators(ctx) + + // Remove all mature unbonding delegations from the ubd queue. + matureUnbonds := k.DequeueAllMatureUBDQueue(ctx, ctx.BlockHeader().Time) + for _, dvPair := range matureUnbonds { + addr := MustValAddressFromBech32(dvPair.ValidatorAddress) + delegatorAddress := sdk.MustAccAddressFromBech32(dvPair.DelegatorAddress) + + balances, err := k.CompleteUnbonding(ctx, delegatorAddress, addr) + if err != nil { + k.Logger(ctx).Error("Failed to complete unbonding", "err", err, "delegator", delegatorAddress, "validator", addr) + continue + } + + // if coin has been registered to ERC20, convert it + // we continue on error, as no harm done if conversion fails + for _, coin := range balances { + if k.erc20k.IsDenomRegistered(ctx, coin.Denom) { + msg := erc20types.NewMsgConvertCoin(coin, common.BytesToAddress(delegatorAddress), delegatorAddress) + if _, err = k.erc20k.ConvertCoin(sdk.WrapSDKContext(ctx), msg); err != nil { + k.Logger(ctx).Error("Failed to convert coin", "err", err, "delegator", delegatorAddress, "validator", addr) + continue + } + } + } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeCompleteUnbonding, + sdk.NewAttribute(sdk.AttributeKeyAmount, balances.String()), + sdk.NewAttribute(types.AttributeKeyValidator, dvPair.ValidatorAddress), + sdk.NewAttribute(types.AttributeKeyDelegator, dvPair.DelegatorAddress), + ), + ) + } + + // Remove all mature redelegations from the red queue. + matureRedelegations := k.DequeueAllMatureRedelegationQueue(ctx, ctx.BlockHeader().Time) + for _, dvvTriplet := range matureRedelegations { + valSrcAddr := MustValAddressFromBech32(dvvTriplet.ValidatorSrcAddress) + valDstAddr := MustValAddressFromBech32(dvvTriplet.ValidatorDstAddress) + delegatorAddress := sdk.MustAccAddressFromBech32(dvvTriplet.DelegatorAddress) + + balances, err := k.CompleteRedelegation( + ctx, + delegatorAddress, + valSrcAddr, + valDstAddr, + ) + if err != nil { + k.Logger(ctx).Error("Failed to complete redelegation", "err", err, "delegator", delegatorAddress, "validatorSrc", valSrcAddr, "validatorDst", valDstAddr) + continue + } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeCompleteRedelegation, + sdk.NewAttribute(sdk.AttributeKeyAmount, balances.String()), + sdk.NewAttribute(types.AttributeKeyDelegator, dvvTriplet.DelegatorAddress), + sdk.NewAttribute(types.AttributeKeySrcValidator, dvvTriplet.ValidatorSrcAddress), + sdk.NewAttribute(types.AttributeKeyDstValidator, dvvTriplet.ValidatorDstAddress), + ), + ) + } +} diff --git a/x/staking/types/expected_keepers.go b/x/staking/types/expected_keepers.go new file mode 100644 index 00000000..c5a839ac --- /dev/null +++ b/x/staking/types/expected_keepers.go @@ -0,0 +1,14 @@ +package types + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + erc20types "github.com/evmos/evmos/v12/x/erc20/types" +) + +type ERC20Keeper interface { + IsDenomRegistered(ctx sdk.Context, denom string) bool + ConvertCoin(ctx context.Context, msg *erc20types.MsgConvertCoin) (*erc20types.MsgConvertCoinResponse, error) +} From 2528f2446b09274c568c1da8035325f86d32ac74 Mon Sep 17 00:00:00 2001 From: Michael Tsitrin Date: Wed, 29 Jan 2025 15:43:05 +0200 Subject: [PATCH 3/8] added new erc20 supported txs for x/staking --- proto/staking/tx.proto | 42 ++ x/staking/keeper/msg_server.go | 67 +++ x/staking/module.go | 8 + x/staking/types/tx.pb.go | 1009 ++++++++++++++++++++++++++++++++ 4 files changed, 1126 insertions(+) create mode 100644 proto/staking/tx.proto create mode 100644 x/staking/keeper/msg_server.go create mode 100644 x/staking/types/tx.pb.go diff --git a/proto/staking/tx.proto b/proto/staking/tx.proto new file mode 100644 index 00000000..33082051 --- /dev/null +++ b/proto/staking/tx.proto @@ -0,0 +1,42 @@ +syntax = "proto3"; +package rollapp.staking; + +import "cosmos/msg/v1/msg.proto"; +import "google/protobuf/any.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/staking/v1beta1/tx.proto"; + +option go_package = "github.com/dymensionxyz/dymension-rdk/x/staking/types"; + +service Msg { + // CreateValidator defines a method for creating a new validator. + rpc CreateValidatorERC20(MsgCreateValidator) returns (MsgCreateValidatorResponse); + + // Delegate defines a method for performing a delegation of coins + // from a delegator to a validator. + rpc DelegateERC20(MsgDelegate) returns (MsgDelegateResponse); + + + +} + +// MsgCreateValidator defines a SDK message for creating a new validator. +message MsgCreateValidator { + cosmos.staking.v1beta1.MsgCreateValidator value = 1; +} + +// MsgCreateValidatorResponse defines the Msg/CreateValidator response type. +message MsgCreateValidatorResponse { + cosmos.staking.v1beta1.MsgCreateValidatorResponse value = 1; +} + +// MsgDelegate defines a SDK message for performing a delegation of coins +// from a delegator to a validator. +message MsgDelegate { + cosmos.staking.v1beta1.MsgDelegate value = 1; +} + +// MsgDelegateResponse defines the Msg/Delegate response type. +message MsgDelegateResponse { + cosmos.staking.v1beta1.MsgDelegateResponse value = 1; +} diff --git a/x/staking/keeper/msg_server.go b/x/staking/keeper/msg_server.go new file mode 100644 index 00000000..6ce4f169 --- /dev/null +++ b/x/staking/keeper/msg_server.go @@ -0,0 +1,67 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + types2 "github.com/dymensionxyz/dymension-rdk/x/staking/types" + "github.com/ethereum/go-ethereum/common" + erc20types "github.com/evmos/evmos/v12/x/erc20/types" +) + +// CreateValidatorERC20 implements types.MsgServer. +func (k Keeper) CreateValidatorERC20(goCtx context.Context, msg *types2.MsgCreateValidator) (*types2.MsgCreateValidatorResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + stakingMsgServer := stakingkeeper.NewMsgServerImpl(k.Keeper) + + // Convert + delegatorAddress, err := sdk.AccAddressFromBech32(msg.Value.DelegatorAddress) + if err != nil { + return nil, err + } + + if k.erc20k.IsDenomRegistered(ctx, msg.Value.Value.Denom) { + msg := erc20types.NewMsgConvertCoin(msg.Value.Value, common.BytesToAddress(delegatorAddress), delegatorAddress) + if _, err = k.erc20k.ConvertCoin(sdk.WrapSDKContext(ctx), msg); err != nil { + k.Logger(ctx).Error("Failed to convert coin", "err", err, "delegator", delegatorAddress) + return nil, err + } + } + + // call create validator + res, err := stakingMsgServer.CreateValidator(sdk.WrapSDKContext(ctx), msg.Value) + if err != nil { + return nil, err + } + + return &types2.MsgCreateValidatorResponse{Value: res}, nil +} + +// DelegateERC20 implements types.MsgServer. +func (k Keeper) DelegateERC20(goCtx context.Context, msg *types2.MsgDelegate) (*types2.MsgDelegateResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + stakingMsgServer := stakingkeeper.NewMsgServerImpl(k.Keeper) + + // Convert + delegatorAddress, err := sdk.AccAddressFromBech32(msg.Value.DelegatorAddress) + if err != nil { + return nil, err + } + + if k.erc20k.IsDenomRegistered(ctx, msg.Value.Amount.Denom) { + msg := erc20types.NewMsgConvertCoin(msg.Value.Amount, common.BytesToAddress(delegatorAddress), delegatorAddress) + if _, err = k.erc20k.ConvertCoin(sdk.WrapSDKContext(ctx), msg); err != nil { + k.Logger(ctx).Error("Failed to convert coin", "err", err, "delegator", delegatorAddress) + return nil, err + } + } + + // call delegate + res, err := stakingMsgServer.Delegate(sdk.WrapSDKContext(ctx), msg.Value) + if err != nil { + return nil, err + } + + return &types2.MsgDelegateResponse{Value: res}, nil +} diff --git a/x/staking/module.go b/x/staking/module.go index 98f0b826..372b7154 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -12,6 +12,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/dymensionxyz/dymension-rdk/x/staking/keeper" + types2 "github.com/dymensionxyz/dymension-rdk/x/staking/types" ) var ( @@ -48,3 +49,10 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json. _ = am.keeper.InitGenesis(ctx, &genesisState) return []abci.ValidatorUpdate{} } + +// RegisterServices registers module services. +func (am AppModule) RegisterServices(cfg module.Configurator) { + am.AppModule.RegisterServices(cfg) + + types2.RegisterMsgServer(cfg.MsgServer(), am.keeper) +} diff --git a/x/staking/types/tx.pb.go b/x/staking/types/tx.pb.go new file mode 100644 index 00000000..51fe665a --- /dev/null +++ b/x/staking/types/tx.pb.go @@ -0,0 +1,1009 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: governors/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + types "github.com/cosmos/cosmos-sdk/x/staking/types" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgCreateValidator defines a SDK message for creating a new validator. +type MsgCreateValidator struct { + Value *types.MsgCreateValidator `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *MsgCreateValidator) Reset() { *m = MsgCreateValidator{} } +func (m *MsgCreateValidator) String() string { return proto.CompactTextString(m) } +func (*MsgCreateValidator) ProtoMessage() {} +func (*MsgCreateValidator) Descriptor() ([]byte, []int) { + return fileDescriptor_a43bdaa658212415, []int{0} +} +func (m *MsgCreateValidator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateValidator.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateValidator) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateValidator.Merge(m, src) +} +func (m *MsgCreateValidator) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateValidator) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateValidator.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateValidator proto.InternalMessageInfo + +func (m *MsgCreateValidator) GetValue() *types.MsgCreateValidator { + if m != nil { + return m.Value + } + return nil +} + +// MsgCreateValidatorResponse defines the Msg/CreateValidator response type. +type MsgCreateValidatorResponse struct { + Value *types.MsgCreateValidatorResponse `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *MsgCreateValidatorResponse) Reset() { *m = MsgCreateValidatorResponse{} } +func (m *MsgCreateValidatorResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateValidatorResponse) ProtoMessage() {} +func (*MsgCreateValidatorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a43bdaa658212415, []int{1} +} +func (m *MsgCreateValidatorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateValidatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateValidatorResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateValidatorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateValidatorResponse.Merge(m, src) +} +func (m *MsgCreateValidatorResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateValidatorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateValidatorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateValidatorResponse proto.InternalMessageInfo + +func (m *MsgCreateValidatorResponse) GetValue() *types.MsgCreateValidatorResponse { + if m != nil { + return m.Value + } + return nil +} + +// MsgDelegate defines a SDK message for performing a delegation of coins +// from a delegator to a validator. +type MsgDelegate struct { + Value *types.MsgDelegate `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *MsgDelegate) Reset() { *m = MsgDelegate{} } +func (m *MsgDelegate) String() string { return proto.CompactTextString(m) } +func (*MsgDelegate) ProtoMessage() {} +func (*MsgDelegate) Descriptor() ([]byte, []int) { + return fileDescriptor_a43bdaa658212415, []int{2} +} +func (m *MsgDelegate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDelegate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDelegate.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgDelegate) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDelegate.Merge(m, src) +} +func (m *MsgDelegate) XXX_Size() int { + return m.Size() +} +func (m *MsgDelegate) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDelegate.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDelegate proto.InternalMessageInfo + +func (m *MsgDelegate) GetValue() *types.MsgDelegate { + if m != nil { + return m.Value + } + return nil +} + +// MsgDelegateResponse defines the Msg/Delegate response type. +type MsgDelegateResponse struct { + Value *types.MsgDelegateResponse `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *MsgDelegateResponse) Reset() { *m = MsgDelegateResponse{} } +func (m *MsgDelegateResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDelegateResponse) ProtoMessage() {} +func (*MsgDelegateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a43bdaa658212415, []int{3} +} +func (m *MsgDelegateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDelegateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDelegateResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgDelegateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDelegateResponse.Merge(m, src) +} +func (m *MsgDelegateResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDelegateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDelegateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDelegateResponse proto.InternalMessageInfo + +func (m *MsgDelegateResponse) GetValue() *types.MsgDelegateResponse { + if m != nil { + return m.Value + } + return nil +} + +func init() { + proto.RegisterType((*MsgCreateValidator)(nil), "rollapp.staking.MsgCreateValidator") + proto.RegisterType((*MsgCreateValidatorResponse)(nil), "rollapp.staking.MsgCreateValidatorResponse") + proto.RegisterType((*MsgDelegate)(nil), "rollapp.staking.MsgDelegate") + proto.RegisterType((*MsgDelegateResponse)(nil), "rollapp.staking.MsgDelegateResponse") +} + +func init() { proto.RegisterFile("governors/tx.proto", fileDescriptor_a43bdaa658212415) } + +var fileDescriptor_a43bdaa658212415 = []byte{ + // 367 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x41, 0x4b, 0xc3, 0x40, + 0x10, 0x85, 0x1b, 0x44, 0x0f, 0x5b, 0x44, 0x58, 0x05, 0x35, 0x48, 0x94, 0xd6, 0x83, 0x58, 0xcc, + 0xda, 0x88, 0x07, 0x6f, 0x6a, 0x15, 0x7a, 0x29, 0x42, 0x85, 0x22, 0xde, 0x36, 0xed, 0x76, 0x1b, + 0x9a, 0x64, 0x42, 0x76, 0x1b, 0x1a, 0x7f, 0x85, 0x3f, 0xca, 0x83, 0xc7, 0x1e, 0x3d, 0x4a, 0xfb, + 0x47, 0xc4, 0x66, 0xb7, 0x9a, 0x5a, 0x4a, 0x3d, 0x85, 0xcd, 0x7b, 0xef, 0x9b, 0x37, 0x30, 0x08, + 0x73, 0x48, 0x58, 0x1c, 0x42, 0x2c, 0x88, 0x1c, 0xda, 0x51, 0x0c, 0x12, 0xf0, 0x56, 0x0c, 0xbe, + 0x4f, 0xa3, 0xc8, 0x16, 0x92, 0xf6, 0xbd, 0x90, 0x9b, 0xbb, 0x6d, 0x10, 0x01, 0x08, 0x12, 0x08, + 0x4e, 0x92, 0xea, 0xf7, 0x27, 0x73, 0x9a, 0xfb, 0x1c, 0x80, 0xfb, 0x8c, 0x4c, 0x5f, 0xee, 0xa0, + 0x4b, 0x68, 0x98, 0x2a, 0xc9, 0x52, 0x19, 0x97, 0x0a, 0x46, 0x92, 0xaa, 0xcb, 0x24, 0xad, 0x92, + 0x36, 0x78, 0xa1, 0xd2, 0x0f, 0x95, 0xae, 0x66, 0xcc, 0x2c, 0xba, 0x45, 0xa9, 0x85, 0x70, 0x43, + 0xf0, 0x5a, 0xcc, 0xa8, 0x64, 0x2d, 0xea, 0x7b, 0x1d, 0x2a, 0x21, 0xc6, 0xd7, 0x68, 0x3d, 0xa1, + 0xfe, 0x80, 0xed, 0x19, 0x47, 0xc6, 0x49, 0xd1, 0x39, 0xb5, 0x33, 0x8c, 0xae, 0x6a, 0x2b, 0x8c, + 0xfd, 0x37, 0xda, 0xcc, 0x82, 0xa5, 0x2e, 0x32, 0x17, 0x88, 0x4c, 0x44, 0x10, 0x0a, 0x86, 0xeb, + 0x79, 0xbe, 0xf3, 0x0f, 0xbe, 0x42, 0xe8, 0x39, 0x75, 0x54, 0x6c, 0x08, 0x7e, 0xc7, 0x7c, 0xc6, + 0xa9, 0x64, 0xf8, 0x2a, 0x0f, 0x2e, 0x2f, 0x01, 0xeb, 0x8c, 0x26, 0x3d, 0xa1, 0xed, 0xdf, 0x7f, + 0x75, 0xd5, 0x9b, 0x3c, 0xb1, 0xb2, 0x0a, 0x31, 0xdf, 0xd1, 0x79, 0x33, 0xd0, 0x5a, 0x43, 0x70, + 0xdc, 0x43, 0x3b, 0x73, 0xdb, 0xdc, 0x37, 0x6b, 0xce, 0x39, 0x2e, 0xdb, 0x73, 0xa7, 0xb0, 0x60, + 0x6f, 0xb3, 0xb2, 0x82, 0x69, 0x56, 0xfa, 0x11, 0x6d, 0xea, 0x32, 0xd9, 0x88, 0x83, 0x45, 0x69, + 0x6d, 0x31, 0x8f, 0x97, 0xa9, 0x1a, 0x7a, 0xfb, 0xf0, 0x3e, 0xb6, 0x8c, 0xd1, 0xd8, 0x32, 0x3e, + 0xc7, 0x96, 0xf1, 0x3a, 0xb1, 0x0a, 0xa3, 0x89, 0x55, 0xf8, 0x98, 0x58, 0x85, 0xe7, 0x4b, 0xee, + 0xc9, 0xde, 0xc0, 0xb5, 0xdb, 0x10, 0x90, 0x4e, 0x1a, 0xb0, 0x50, 0x78, 0x10, 0x0e, 0xd3, 0x97, + 0x9f, 0xc7, 0x59, 0xdc, 0xe9, 0x93, 0xe1, 0xec, 0x0c, 0x65, 0x1a, 0x31, 0xe1, 0x6e, 0x4c, 0x4f, + 0xf0, 0xe2, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x5d, 0x5f, 0x54, 0x27, 0x1e, 0x03, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // CreateValidator defines a method for creating a new validator. + CreateValidatorERC20(ctx context.Context, in *MsgCreateValidator, opts ...grpc.CallOption) (*MsgCreateValidatorResponse, error) + // Delegate defines a method for performing a delegation of coins + // from a delegator to a validator. + DelegateERC20(ctx context.Context, in *MsgDelegate, opts ...grpc.CallOption) (*MsgDelegateResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateValidatorERC20(ctx context.Context, in *MsgCreateValidator, opts ...grpc.CallOption) (*MsgCreateValidatorResponse, error) { + out := new(MsgCreateValidatorResponse) + err := c.cc.Invoke(ctx, "/rollapp.staking.Msg/CreateValidatorERC20", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) DelegateERC20(ctx context.Context, in *MsgDelegate, opts ...grpc.CallOption) (*MsgDelegateResponse, error) { + out := new(MsgDelegateResponse) + err := c.cc.Invoke(ctx, "/rollapp.staking.Msg/DelegateERC20", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // CreateValidator defines a method for creating a new validator. + CreateValidatorERC20(context.Context, *MsgCreateValidator) (*MsgCreateValidatorResponse, error) + // Delegate defines a method for performing a delegation of coins + // from a delegator to a validator. + DelegateERC20(context.Context, *MsgDelegate) (*MsgDelegateResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateValidatorERC20(ctx context.Context, req *MsgCreateValidator) (*MsgCreateValidatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateValidatorERC20 not implemented") +} +func (*UnimplementedMsgServer) DelegateERC20(ctx context.Context, req *MsgDelegate) (*MsgDelegateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegateERC20 not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CreateValidatorERC20_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateValidator) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateValidatorERC20(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rollapp.staking.Msg/CreateValidatorERC20", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateValidatorERC20(ctx, req.(*MsgCreateValidator)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_DelegateERC20_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDelegate) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DelegateERC20(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rollapp.staking.Msg/DelegateERC20", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DelegateERC20(ctx, req.(*MsgDelegate)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "rollapp.staking.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateValidatorERC20", + Handler: _Msg_CreateValidatorERC20_Handler, + }, + { + MethodName: "DelegateERC20", + Handler: _Msg_DelegateERC20_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "governors/tx.proto", +} + +func (m *MsgCreateValidator) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCreateValidator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Value != nil { + { + size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateValidatorResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCreateValidatorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateValidatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Value != nil { + { + size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDelegate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgDelegate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Value != nil { + { + size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDelegateResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgDelegateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDelegateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Value != nil { + { + size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgCreateValidator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value != nil { + l = m.Value.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgCreateValidatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value != nil { + l = m.Value.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgDelegate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value != nil { + l = m.Value.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgDelegateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value != nil { + l = m.Value.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgCreateValidator) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateValidator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateValidator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Value == nil { + m.Value = &types.MsgCreateValidator{} + } + if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateValidatorResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateValidatorResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateValidatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Value == nil { + m.Value = &types.MsgCreateValidatorResponse{} + } + if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDelegate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDelegate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDelegate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Value == nil { + m.Value = &types.MsgDelegate{} + } + if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDelegateResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDelegateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDelegateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Value == nil { + m.Value = &types.MsgDelegateResponse{} + } + if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) From f9eae9d468733d6618139ced1c2581083d8ea705 Mon Sep 17 00:00:00 2001 From: Michael Tsitrin Date: Wed, 29 Jan 2025 20:50:06 +0200 Subject: [PATCH 4/8] added custom tx for x/staking --- go.mod | 2 +- go.sum | 4 +- proto/staking/tx.proto | 26 +- testutil/app/app.go | 52 +++ x/dist/keeper/allocation_test.go | 4 +- x/staking/keeper/msg_server.go | 44 +-- x/staking/module.go | 17 + x/staking/types/codec.go | 43 +++ x/staking/types/msgs.go | 95 +++++ x/staking/types/tx.pb.go | 612 ++++++------------------------- 10 files changed, 358 insertions(+), 541 deletions(-) create mode 100644 x/staking/types/codec.go create mode 100644 x/staking/types/msgs.go diff --git a/go.mod b/go.mod index 12711726..d9cbb698 100644 --- a/go.mod +++ b/go.mod @@ -354,7 +354,7 @@ replace ( github.com/cosmos/cosmos-sdk => github.com/dymensionxyz/cosmos-sdk v0.46.17-0.20241128210616-e9dfe47b8c73 // use Evmos geth fork github.com/ethereum/go-ethereum => github.com/evmos/go-ethereum v1.10.26 - github.com/evmos/evmos/v12 => github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.5.0-rc02 + github.com/evmos/evmos/v12 => github.com/dymensionxyz/evmos/v12 v12.1.7-0.20250128194013-c3f3d1fd3f02 github.com/gorilla/rpc => github.com/dymensionxyz/rpc v1.3.1 github.com/tendermint/tendermint => github.com/dymensionxyz/cometbft v0.34.29-0.20241128205759-2a9d5f015da5 diff --git a/go.sum b/go.sum index 54fc7ea7..5662b959 100644 --- a/go.sum +++ b/go.sum @@ -571,8 +571,8 @@ github.com/dymensionxyz/cosmosclient v0.4.2-beta.0.20241121093220-e0d7ad456fbd h github.com/dymensionxyz/cosmosclient v0.4.2-beta.0.20241121093220-e0d7ad456fbd/go.mod h1:3weqpVj/TqTFpC0LjEB3H+HZSpm7BrQ1QkEg1Ahy6KY= github.com/dymensionxyz/dymint v1.3.0-rc04 h1:h7mEfgyQB+a4H+FxhPSm/Ewefhk90rRNge0+NV5IcDk= github.com/dymensionxyz/dymint v1.3.0-rc04/go.mod h1:sqE+4imdASE9lm63jv+K2zmOnclLJNZLPYbL9m6vR3o= -github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.5.0-rc02 h1:G6rtzFNnzeYOHN33rkw0kMQX+xRantRLTip1AMXYmBg= -github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.5.0-rc02/go.mod h1:CI6D89pkoiIm4BjoMFNnEaCLdKBEobLuwvhS0c1zh7Y= +github.com/dymensionxyz/evmos/v12 v12.1.7-0.20250128194013-c3f3d1fd3f02 h1:lIAvQB85t5aGmmScaPTcUFddbjl4X4Oq7PnAE9tHtpM= +github.com/dymensionxyz/evmos/v12 v12.1.7-0.20250128194013-c3f3d1fd3f02/go.mod h1:CI6D89pkoiIm4BjoMFNnEaCLdKBEobLuwvhS0c1zh7Y= github.com/dymensionxyz/gerr-cosmos v1.0.0 h1:oi91rgOkpJWr41oX9JOyjvvBnhGY54tj513x8VlDAEc= github.com/dymensionxyz/gerr-cosmos v1.0.0/go.mod h1:n+0olxPogzWqFKba45mCpvrHLGmeS8W9UZjggHnWk6c= github.com/dymensionxyz/rpc v1.3.1 h1:7EXWIobaBes5zldRvTIg7TmNsEKjicrWA/OjCc0NaGs= diff --git a/proto/staking/tx.proto b/proto/staking/tx.proto index 33082051..f023d3e0 100644 --- a/proto/staking/tx.proto +++ b/proto/staking/tx.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package rollapp.staking; import "cosmos/msg/v1/msg.proto"; +import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; import "cosmos/base/v1beta1/coin.proto"; import "cosmos/staking/v1beta1/tx.proto"; @@ -10,33 +11,24 @@ option go_package = "github.com/dymensionxyz/dymension-rdk/x/staking/types"; service Msg { // CreateValidator defines a method for creating a new validator. - rpc CreateValidatorERC20(MsgCreateValidator) returns (MsgCreateValidatorResponse); + rpc CreateValidatorERC20(MsgCreateValidatorERC20) returns (cosmos.staking.v1beta1.MsgCreateValidatorResponse); // Delegate defines a method for performing a delegation of coins // from a delegator to a validator. - rpc DelegateERC20(MsgDelegate) returns (MsgDelegateResponse); + rpc DelegateERC20(MsgDelegateERC20) returns (cosmos.staking.v1beta1.MsgDelegateResponse); } -// MsgCreateValidator defines a SDK message for creating a new validator. -message MsgCreateValidator { - cosmos.staking.v1beta1.MsgCreateValidator value = 1; +// MsgCreateValidatorERC20 defines a SDK message for creating a new validator. +message MsgCreateValidatorERC20 { + cosmos.staking.v1beta1.MsgCreateValidator value = 1 [(gogoproto.nullable) = false]; } -// MsgCreateValidatorResponse defines the Msg/CreateValidator response type. -message MsgCreateValidatorResponse { - cosmos.staking.v1beta1.MsgCreateValidatorResponse value = 1; -} -// MsgDelegate defines a SDK message for performing a delegation of coins +// MsgDelegateERC20 defines a SDK message for performing a delegation of coins // from a delegator to a validator. -message MsgDelegate { - cosmos.staking.v1beta1.MsgDelegate value = 1; -} - -// MsgDelegateResponse defines the Msg/Delegate response type. -message MsgDelegateResponse { - cosmos.staking.v1beta1.MsgDelegateResponse value = 1; +message MsgDelegateERC20 { + cosmos.staking.v1beta1.MsgDelegate value = 1 [(gogoproto.nullable) = false]; } diff --git a/testutil/app/app.go b/testutil/app/app.go index 50f9fd6b..d030b119 100644 --- a/testutil/app/app.go +++ b/testutil/app/app.go @@ -135,6 +135,16 @@ import ( "github.com/dymensionxyz/dymension-rdk/x/rollappparams" rollappparamskeeper "github.com/dymensionxyz/dymension-rdk/x/rollappparams/keeper" rollappparamstypes "github.com/dymensionxyz/dymension-rdk/x/rollappparams/types" + + erc20 "github.com/evmos/evmos/v12/x/erc20" + erc20keeper "github.com/evmos/evmos/v12/x/erc20/keeper" + erc20types "github.com/evmos/evmos/v12/x/erc20/types" + evm "github.com/evmos/evmos/v12/x/evm" + evmkeeper "github.com/evmos/evmos/v12/x/evm/keeper" + evmtypes "github.com/evmos/evmos/v12/x/evm/types" + feemarket "github.com/evmos/evmos/v12/x/feemarket" + feemarketkeeper "github.com/evmos/evmos/v12/x/feemarket/keeper" + feemarkettypes "github.com/evmos/evmos/v12/x/feemarket/types" ) const ( @@ -148,6 +158,7 @@ var kvstorekeys = []string{ minttypes.StoreKey, distrtypes.StoreKey, govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, + evmtypes.StoreKey, erc20types.StoreKey, feemarkettypes.StoreKey, epochstypes.StoreKey, hubgentypes.StoreKey, hubtypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey, gaslesstypes.StoreKey, wasmtypes.StoreKey, tokenfactorytypes.StoreKey, rollappparamstypes.StoreKey, timeupgradetypes.StoreKey, @@ -198,6 +209,10 @@ var ( wasm.AppModuleBasic{}, tokenfactory.NewAppModuleBasic(), rollappparams.AppModuleBasic{}, + + feemarket.AppModuleBasic{}, + evm.AppModuleBasic{}, + erc20.AppModuleBasic{}, ) // module account permissions @@ -211,6 +226,7 @@ var ( ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, hubgentypes.ModuleName: {authtypes.Minter}, gaslesstypes.ModuleName: nil, + evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account wasmtypes.ModuleName: {authtypes.Burner}, rollappparamstypes.ModuleName: nil, tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner}, @@ -256,6 +272,11 @@ type App struct { WasmKeeper wasmkeeper.Keeper TokenFactoryKeeper tokenfactorykeeper.Keeper + // Evmos keepers + EvmKeeper *evmkeeper.Keeper + FeeMarketKeeper feemarketkeeper.Keeper + Erc20Keeper erc20keeper.Keeper + // make scoped keepers public for test purposes ScopedIBCKeeper capabilitykeeper.ScopedKeeper ScopedTransferKeeper capabilitykeeper.ScopedKeeper @@ -368,6 +389,7 @@ func NewRollapp( keys[stakingtypes.StoreKey], app.AccountKeeper, app.BankKeeper, + app.Erc20Keeper, app.GetSubspace(stakingtypes.ModuleName), ) @@ -394,6 +416,7 @@ func NewRollapp( app.BankKeeper, &stakingKeeper, &app.SequencersKeeper, + app.Erc20Keeper, authtypes.FeeCollectorName, ) @@ -463,6 +486,19 @@ func NewRollapp( ), ) + app.EvmKeeper = evmkeeper.NewKeeper( + appCodec, keys[evmtypes.StoreKey], tkeys[evmtypes.TransientKey], authtypes.NewModuleAddress(govtypes.ModuleName), + app.AccountKeeper, app.BankKeeper, + app.SequencersKeeper, + app.FeeMarketKeeper, + "", app.GetSubspace(evmtypes.ModuleName), + ) + + app.Erc20Keeper = erc20keeper.NewKeeper( + keys[erc20types.StoreKey], appCodec, authtypes.NewModuleAddress(govtypes.ModuleName), + app.AccountKeeper, app.BankKeeper, app.EvmKeeper, + ) + app.HubKeeper = hubkeeper.NewKeeper( appCodec, keys[hubtypes.StoreKey], @@ -609,6 +645,10 @@ func NewRollapp( hubgenesis.NewAppModule(appCodec, app.HubGenesisKeeper), gasless.NewAppModule(appCodec, app.GaslessKeeper), rollappparams.NewAppModule(appCodec, app.RollappParamsKeeper), + // Ethermint app modules + evm.NewAppModule(app.EvmKeeper, app.AccountKeeper, app.GetSubspace(evmtypes.ModuleName)), + feemarket.NewAppModule(app.FeeMarketKeeper, app.GetSubspace(feemarkettypes.ModuleName)), + erc20.NewAppModule(app.Erc20Keeper, app.AccountKeeper, app.GetSubspace(erc20types.ModuleName)), } app.mm = module.NewManager(modules...) @@ -639,6 +679,10 @@ func NewRollapp( tokenfactorytypes.ModuleName, gaslesstypes.ModuleName, rollappparamstypes.ModuleName, + + evmtypes.ModuleName, + erc20types.ModuleName, + feemarkettypes.ModuleName, } app.mm.SetOrderBeginBlockers(beginBlockersList...) @@ -663,6 +707,10 @@ func NewRollapp( tokenfactorytypes.ModuleName, gaslesstypes.ModuleName, rollappparamstypes.ModuleName, + + evmtypes.ModuleName, + erc20types.ModuleName, + feemarkettypes.ModuleName, } app.mm.SetOrderEndBlockers(endBlockersList...) @@ -693,6 +741,10 @@ func NewRollapp( tokenfactorytypes.ModuleName, gaslesstypes.ModuleName, rollappparamstypes.ModuleName, + + evmtypes.ModuleName, + erc20types.ModuleName, + feemarkettypes.ModuleName, } app.mm.SetOrderInitGenesis(initGenesisList...) diff --git a/x/dist/keeper/allocation_test.go b/x/dist/keeper/allocation_test.go index 3303a554..4092b02c 100644 --- a/x/dist/keeper/allocation_test.go +++ b/x/dist/keeper/allocation_test.go @@ -105,7 +105,7 @@ func TestAllocateTokensValidatorsNoProposer(t *testing.T) { fundModules(t, ctx, app) // end block to bond validator and start new block - _ = app.StakingKeeper.BlockValidatorUpdates(ctx) + app.StakingKeeper.BlockValidatorUpdates(ctx) ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) // allocate tokens as if both had voted and second was proposer @@ -203,7 +203,7 @@ func TestAllocateTokensValidatorsAndProposer(t *testing.T) { fundModules(t, ctx, app) // end block to bond validator and start new block - _ = app.StakingKeeper.BlockValidatorUpdates(ctx) + app.StakingKeeper.BlockValidatorUpdates(ctx) ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) proposerReward := 0.4 diff --git a/x/staking/keeper/msg_server.go b/x/staking/keeper/msg_server.go index 6ce4f169..a510812f 100644 --- a/x/staking/keeper/msg_server.go +++ b/x/staking/keeper/msg_server.go @@ -5,23 +5,25 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - types2 "github.com/dymensionxyz/dymension-rdk/x/staking/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/dymensionxyz/dymension-rdk/x/staking/types" "github.com/ethereum/go-ethereum/common" erc20types "github.com/evmos/evmos/v12/x/erc20/types" ) // CreateValidatorERC20 implements types.MsgServer. -func (k Keeper) CreateValidatorERC20(goCtx context.Context, msg *types2.MsgCreateValidator) (*types2.MsgCreateValidatorResponse, error) { +func (k Keeper) CreateValidatorERC20(goCtx context.Context, msg *types.MsgCreateValidatorERC20) (*stakingtypes.MsgCreateValidatorResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) stakingMsgServer := stakingkeeper.NewMsgServerImpl(k.Keeper) - // Convert - delegatorAddress, err := sdk.AccAddressFromBech32(msg.Value.DelegatorAddress) - if err != nil { - return nil, err - } + // Convert if needed if k.erc20k.IsDenomRegistered(ctx, msg.Value.Value.Denom) { + delegatorAddress, err := sdk.AccAddressFromBech32(msg.Value.DelegatorAddress) + if err != nil { + return nil, err + } + msg := erc20types.NewMsgConvertCoin(msg.Value.Value, common.BytesToAddress(delegatorAddress), delegatorAddress) if _, err = k.erc20k.ConvertCoin(sdk.WrapSDKContext(ctx), msg); err != nil { k.Logger(ctx).Error("Failed to convert coin", "err", err, "delegator", delegatorAddress) @@ -30,26 +32,21 @@ func (k Keeper) CreateValidatorERC20(goCtx context.Context, msg *types2.MsgCreat } // call create validator - res, err := stakingMsgServer.CreateValidator(sdk.WrapSDKContext(ctx), msg.Value) - if err != nil { - return nil, err - } - - return &types2.MsgCreateValidatorResponse{Value: res}, nil + return stakingMsgServer.CreateValidator(sdk.WrapSDKContext(ctx), &msg.Value) } // DelegateERC20 implements types.MsgServer. -func (k Keeper) DelegateERC20(goCtx context.Context, msg *types2.MsgDelegate) (*types2.MsgDelegateResponse, error) { +func (k Keeper) DelegateERC20(goCtx context.Context, msg *types.MsgDelegateERC20) (*stakingtypes.MsgDelegateResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) stakingMsgServer := stakingkeeper.NewMsgServerImpl(k.Keeper) - // Convert - delegatorAddress, err := sdk.AccAddressFromBech32(msg.Value.DelegatorAddress) - if err != nil { - return nil, err - } - + // Convert if needed if k.erc20k.IsDenomRegistered(ctx, msg.Value.Amount.Denom) { + delegatorAddress, err := sdk.AccAddressFromBech32(msg.Value.DelegatorAddress) + if err != nil { + return nil, err + } + msg := erc20types.NewMsgConvertCoin(msg.Value.Amount, common.BytesToAddress(delegatorAddress), delegatorAddress) if _, err = k.erc20k.ConvertCoin(sdk.WrapSDKContext(ctx), msg); err != nil { k.Logger(ctx).Error("Failed to convert coin", "err", err, "delegator", delegatorAddress) @@ -58,10 +55,5 @@ func (k Keeper) DelegateERC20(goCtx context.Context, msg *types2.MsgDelegate) (* } // call delegate - res, err := stakingMsgServer.Delegate(sdk.WrapSDKContext(ctx), msg.Value) - if err != nil { - return nil, err - } - - return &types2.MsgDelegateResponse{Value: res}, nil + return stakingMsgServer.Delegate(sdk.WrapSDKContext(ctx), &msg.Value) } diff --git a/x/staking/module.go b/x/staking/module.go index 372b7154..562f3e9b 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -8,6 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -24,6 +25,22 @@ type AppModuleBasic struct { staking.AppModuleBasic } +// RegisterLegacyAminoCodec registers the staking module's types on the given LegacyAmino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) + + types2.RegisterLegacyAminoCodec(cdc) + +} + +// RegisterInterfaces registers the module's interface types +func (b AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(registry) + + // custom register + types2.RegisterInterfaces(registry) +} + // AppModule embeds the Cosmos SDK's x/distribution AppModule where we only override specific methods. type AppModule struct { staking.AppModule diff --git a/x/staking/types/codec.go b/x/staking/types/codec.go new file mode 100644 index 00000000..223f69c8 --- /dev/null +++ b/x/staking/types/codec.go @@ -0,0 +1,43 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/legacy" + "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +// RegisterLegacyAminoCodec registers the necessary x/staking interfaces and concrete types +// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + // custom register + + legacy.RegisterAminoMsg(cdc, &MsgCreateValidatorERC20{}, "dymension/MsgCreateValidatorERC20") + legacy.RegisterAminoMsg(cdc, &MsgDelegateERC20{}, "dymension/MsgDelegateERC20") +} + +// RegisterInterfaces registers the x/staking interfaces types with the interface registry +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgCreateValidatorERC20{}, + &MsgDelegateERC20{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +// var ( +// amino = codec.NewLegacyAmino() +// ModuleCdc = codec.NewAminoCodec(amino) +// ) + +// // func init() { +// // RegisterLegacyAminoCodec(amino) +// // cryptocodec.RegisterCrypto(amino) +// // sdk.RegisterLegacyAminoCodec(amino) + +// // // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be +// // // used to properly serialize MsgGrant and MsgExec instances +// // RegisterLegacyAminoCodec(authzcodec.Amino) +// // } diff --git a/x/staking/types/msgs.go b/x/staking/types/msgs.go new file mode 100644 index 00000000..38360c84 --- /dev/null +++ b/x/staking/types/msgs.go @@ -0,0 +1,95 @@ +package types + +import ( + "cosmossdk.io/math" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" +) + +// staking message types +const ( + TypeMsgCreateValidatorERC20 = "create_validator_erc20" + TypeMsgDelegateERC20 = "delegate_erc20" +) + +var ( + _ sdk.Msg = &MsgCreateValidatorERC20{} + _ codectypes.UnpackInterfacesMessage = (*MsgCreateValidatorERC20)(nil) + _ sdk.Msg = &MsgDelegateERC20{} +) + +// NewMsgCreateValidatorERC20 creates a new MsgCreateValidator instance. +// Delegator address and validator address are the same. +func NewMsgCreateValidatorERC20( + valAddr sdk.ValAddress, pubKey cryptotypes.PubKey, //nolint:interfacer + selfDelegation sdk.Coin, description stakingtypes.Description, commission stakingtypes.CommissionRates, minSelfDelegation math.Int, +) (*MsgCreateValidatorERC20, error) { + stakingMsg, err := stakingtypes.NewMsgCreateValidator(valAddr, pubKey, selfDelegation, description, commission, minSelfDelegation) + if err != nil { + return nil, err + } + + return &MsgCreateValidatorERC20{Value: *stakingMsg}, nil +} + +// Route implements the sdk.Msg interface. +func (msg MsgCreateValidatorERC20) Route() string { return stakingtypes.RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgCreateValidatorERC20) Type() string { return TypeMsgCreateValidatorERC20 } + +// GetSigners implements the sdk.Msg interface. It returns the address(es) that +// must sign over msg.GetSignBytes(). +// If the validator address is not same as delegator's, then the validator must +// sign the msg as well. +func (msg MsgCreateValidatorERC20) GetSigners() []sdk.AccAddress { + return msg.Value.GetSigners() +} + +// GetSignBytes returns the message bytes to sign over. +func (msg MsgCreateValidatorERC20) GetSignBytes() []byte { + bz := stakingtypes.ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgCreateValidatorERC20) ValidateBasic() error { + return msg.Value.ValidateBasic() +} + +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (msg MsgCreateValidatorERC20) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { + var pubKey cryptotypes.PubKey + return unpacker.UnpackAny(msg.Value.Pubkey, &pubKey) +} + +// NewMsgDelegate creates a new MsgDelegate instance. +// +//nolint:interfacer +func NewMsgDelegateERC20(delAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) *stakingtypes.MsgDelegate { + return stakingtypes.NewMsgDelegate(delAddr, valAddr, amount) +} + +// Route implements the sdk.Msg interface. +func (msg MsgDelegateERC20) Route() string { return stakingtypes.RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgDelegateERC20) Type() string { return TypeMsgDelegateERC20 } + +// GetSigners implements the sdk.Msg interface. +func (msg MsgDelegateERC20) GetSigners() []sdk.AccAddress { + return msg.Value.GetSigners() +} + +// GetSignBytes implements the sdk.Msg interface. +func (msg MsgDelegateERC20) GetSignBytes() []byte { + bz := stakingtypes.ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgDelegateERC20) ValidateBasic() error { + return msg.Value.ValidateBasic() +} diff --git a/x/staking/types/tx.pb.go b/x/staking/types/tx.pb.go index 51fe665a..a0420d80 100644 --- a/x/staking/types/tx.pb.go +++ b/x/staking/types/tx.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: governors/tx.proto +// source: staking/tx.proto package types @@ -10,6 +10,7 @@ import ( _ "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" types "github.com/cosmos/cosmos-sdk/x/staking/types" + _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" grpc "google.golang.org/grpc" @@ -31,23 +32,23 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgCreateValidator defines a SDK message for creating a new validator. -type MsgCreateValidator struct { - Value *types.MsgCreateValidator `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` +// MsgCreateValidatorERC20 defines a SDK message for creating a new validator. +type MsgCreateValidatorERC20 struct { + Value types.MsgCreateValidator `protobuf:"bytes,1,opt,name=value,proto3" json:"value"` } -func (m *MsgCreateValidator) Reset() { *m = MsgCreateValidator{} } -func (m *MsgCreateValidator) String() string { return proto.CompactTextString(m) } -func (*MsgCreateValidator) ProtoMessage() {} -func (*MsgCreateValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_a43bdaa658212415, []int{0} +func (m *MsgCreateValidatorERC20) Reset() { *m = MsgCreateValidatorERC20{} } +func (m *MsgCreateValidatorERC20) String() string { return proto.CompactTextString(m) } +func (*MsgCreateValidatorERC20) ProtoMessage() {} +func (*MsgCreateValidatorERC20) Descriptor() ([]byte, []int) { + return fileDescriptor_5ec9a3a1971dd6a6, []int{0} } -func (m *MsgCreateValidator) XXX_Unmarshal(b []byte) error { +func (m *MsgCreateValidatorERC20) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgCreateValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgCreateValidatorERC20) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgCreateValidator.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgCreateValidatorERC20.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -57,88 +58,43 @@ func (m *MsgCreateValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *MsgCreateValidator) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateValidator.Merge(m, src) +func (m *MsgCreateValidatorERC20) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateValidatorERC20.Merge(m, src) } -func (m *MsgCreateValidator) XXX_Size() int { +func (m *MsgCreateValidatorERC20) XXX_Size() int { return m.Size() } -func (m *MsgCreateValidator) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateValidator.DiscardUnknown(m) +func (m *MsgCreateValidatorERC20) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateValidatorERC20.DiscardUnknown(m) } -var xxx_messageInfo_MsgCreateValidator proto.InternalMessageInfo +var xxx_messageInfo_MsgCreateValidatorERC20 proto.InternalMessageInfo -func (m *MsgCreateValidator) GetValue() *types.MsgCreateValidator { +func (m *MsgCreateValidatorERC20) GetValue() types.MsgCreateValidator { if m != nil { return m.Value } - return nil -} - -// MsgCreateValidatorResponse defines the Msg/CreateValidator response type. -type MsgCreateValidatorResponse struct { - Value *types.MsgCreateValidatorResponse `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *MsgCreateValidatorResponse) Reset() { *m = MsgCreateValidatorResponse{} } -func (m *MsgCreateValidatorResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCreateValidatorResponse) ProtoMessage() {} -func (*MsgCreateValidatorResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a43bdaa658212415, []int{1} -} -func (m *MsgCreateValidatorResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateValidatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateValidatorResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgCreateValidatorResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateValidatorResponse.Merge(m, src) -} -func (m *MsgCreateValidatorResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateValidatorResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateValidatorResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateValidatorResponse proto.InternalMessageInfo - -func (m *MsgCreateValidatorResponse) GetValue() *types.MsgCreateValidatorResponse { - if m != nil { - return m.Value - } - return nil + return types.MsgCreateValidator{} } -// MsgDelegate defines a SDK message for performing a delegation of coins +// MsgDelegateERC20 defines a SDK message for performing a delegation of coins // from a delegator to a validator. -type MsgDelegate struct { - Value *types.MsgDelegate `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` +type MsgDelegateERC20 struct { + Value types.MsgDelegate `protobuf:"bytes,1,opt,name=value,proto3" json:"value"` } -func (m *MsgDelegate) Reset() { *m = MsgDelegate{} } -func (m *MsgDelegate) String() string { return proto.CompactTextString(m) } -func (*MsgDelegate) ProtoMessage() {} -func (*MsgDelegate) Descriptor() ([]byte, []int) { - return fileDescriptor_a43bdaa658212415, []int{2} +func (m *MsgDelegateERC20) Reset() { *m = MsgDelegateERC20{} } +func (m *MsgDelegateERC20) String() string { return proto.CompactTextString(m) } +func (*MsgDelegateERC20) ProtoMessage() {} +func (*MsgDelegateERC20) Descriptor() ([]byte, []int) { + return fileDescriptor_5ec9a3a1971dd6a6, []int{1} } -func (m *MsgDelegate) XXX_Unmarshal(b []byte) error { +func (m *MsgDelegateERC20) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgDelegate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgDelegateERC20) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgDelegate.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgDelegateERC20.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -148,104 +104,56 @@ func (m *MsgDelegate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *MsgDelegate) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDelegate.Merge(m, src) +func (m *MsgDelegateERC20) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDelegateERC20.Merge(m, src) } -func (m *MsgDelegate) XXX_Size() int { +func (m *MsgDelegateERC20) XXX_Size() int { return m.Size() } -func (m *MsgDelegate) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDelegate.DiscardUnknown(m) +func (m *MsgDelegateERC20) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDelegateERC20.DiscardUnknown(m) } -var xxx_messageInfo_MsgDelegate proto.InternalMessageInfo +var xxx_messageInfo_MsgDelegateERC20 proto.InternalMessageInfo -func (m *MsgDelegate) GetValue() *types.MsgDelegate { +func (m *MsgDelegateERC20) GetValue() types.MsgDelegate { if m != nil { return m.Value } - return nil -} - -// MsgDelegateResponse defines the Msg/Delegate response type. -type MsgDelegateResponse struct { - Value *types.MsgDelegateResponse `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *MsgDelegateResponse) Reset() { *m = MsgDelegateResponse{} } -func (m *MsgDelegateResponse) String() string { return proto.CompactTextString(m) } -func (*MsgDelegateResponse) ProtoMessage() {} -func (*MsgDelegateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a43bdaa658212415, []int{3} -} -func (m *MsgDelegateResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDelegateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDelegateResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgDelegateResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDelegateResponse.Merge(m, src) -} -func (m *MsgDelegateResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgDelegateResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDelegateResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDelegateResponse proto.InternalMessageInfo - -func (m *MsgDelegateResponse) GetValue() *types.MsgDelegateResponse { - if m != nil { - return m.Value - } - return nil + return types.MsgDelegate{} } func init() { - proto.RegisterType((*MsgCreateValidator)(nil), "rollapp.staking.MsgCreateValidator") - proto.RegisterType((*MsgCreateValidatorResponse)(nil), "rollapp.staking.MsgCreateValidatorResponse") - proto.RegisterType((*MsgDelegate)(nil), "rollapp.staking.MsgDelegate") - proto.RegisterType((*MsgDelegateResponse)(nil), "rollapp.staking.MsgDelegateResponse") -} - -func init() { proto.RegisterFile("governors/tx.proto", fileDescriptor_a43bdaa658212415) } - -var fileDescriptor_a43bdaa658212415 = []byte{ - // 367 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x41, 0x4b, 0xc3, 0x40, - 0x10, 0x85, 0x1b, 0x44, 0x0f, 0x5b, 0x44, 0x58, 0x05, 0x35, 0x48, 0x94, 0xd6, 0x83, 0x58, 0xcc, - 0xda, 0x88, 0x07, 0x6f, 0x6a, 0x15, 0x7a, 0x29, 0x42, 0x85, 0x22, 0xde, 0x36, 0xed, 0x76, 0x1b, - 0x9a, 0x64, 0x42, 0x76, 0x1b, 0x1a, 0x7f, 0x85, 0x3f, 0xca, 0x83, 0xc7, 0x1e, 0x3d, 0x4a, 0xfb, - 0x47, 0xc4, 0x66, 0xb7, 0x9a, 0x5a, 0x4a, 0x3d, 0x85, 0xcd, 0x7b, 0xef, 0x9b, 0x37, 0x30, 0x08, - 0x73, 0x48, 0x58, 0x1c, 0x42, 0x2c, 0x88, 0x1c, 0xda, 0x51, 0x0c, 0x12, 0xf0, 0x56, 0x0c, 0xbe, - 0x4f, 0xa3, 0xc8, 0x16, 0x92, 0xf6, 0xbd, 0x90, 0x9b, 0xbb, 0x6d, 0x10, 0x01, 0x08, 0x12, 0x08, - 0x4e, 0x92, 0xea, 0xf7, 0x27, 0x73, 0x9a, 0xfb, 0x1c, 0x80, 0xfb, 0x8c, 0x4c, 0x5f, 0xee, 0xa0, - 0x4b, 0x68, 0x98, 0x2a, 0xc9, 0x52, 0x19, 0x97, 0x0a, 0x46, 0x92, 0xaa, 0xcb, 0x24, 0xad, 0x92, - 0x36, 0x78, 0xa1, 0xd2, 0x0f, 0x95, 0xae, 0x66, 0xcc, 0x2c, 0xba, 0x45, 0xa9, 0x85, 0x70, 0x43, - 0xf0, 0x5a, 0xcc, 0xa8, 0x64, 0x2d, 0xea, 0x7b, 0x1d, 0x2a, 0x21, 0xc6, 0xd7, 0x68, 0x3d, 0xa1, - 0xfe, 0x80, 0xed, 0x19, 0x47, 0xc6, 0x49, 0xd1, 0x39, 0xb5, 0x33, 0x8c, 0xae, 0x6a, 0x2b, 0x8c, - 0xfd, 0x37, 0xda, 0xcc, 0x82, 0xa5, 0x2e, 0x32, 0x17, 0x88, 0x4c, 0x44, 0x10, 0x0a, 0x86, 0xeb, - 0x79, 0xbe, 0xf3, 0x0f, 0xbe, 0x42, 0xe8, 0x39, 0x75, 0x54, 0x6c, 0x08, 0x7e, 0xc7, 0x7c, 0xc6, - 0xa9, 0x64, 0xf8, 0x2a, 0x0f, 0x2e, 0x2f, 0x01, 0xeb, 0x8c, 0x26, 0x3d, 0xa1, 0xed, 0xdf, 0x7f, - 0x75, 0xd5, 0x9b, 0x3c, 0xb1, 0xb2, 0x0a, 0x31, 0xdf, 0xd1, 0x79, 0x33, 0xd0, 0x5a, 0x43, 0x70, - 0xdc, 0x43, 0x3b, 0x73, 0xdb, 0xdc, 0x37, 0x6b, 0xce, 0x39, 0x2e, 0xdb, 0x73, 0xa7, 0xb0, 0x60, - 0x6f, 0xb3, 0xb2, 0x82, 0x69, 0x56, 0xfa, 0x11, 0x6d, 0xea, 0x32, 0xd9, 0x88, 0x83, 0x45, 0x69, - 0x6d, 0x31, 0x8f, 0x97, 0xa9, 0x1a, 0x7a, 0xfb, 0xf0, 0x3e, 0xb6, 0x8c, 0xd1, 0xd8, 0x32, 0x3e, - 0xc7, 0x96, 0xf1, 0x3a, 0xb1, 0x0a, 0xa3, 0x89, 0x55, 0xf8, 0x98, 0x58, 0x85, 0xe7, 0x4b, 0xee, - 0xc9, 0xde, 0xc0, 0xb5, 0xdb, 0x10, 0x90, 0x4e, 0x1a, 0xb0, 0x50, 0x78, 0x10, 0x0e, 0xd3, 0x97, - 0x9f, 0xc7, 0x59, 0xdc, 0xe9, 0x93, 0xe1, 0xec, 0x0c, 0x65, 0x1a, 0x31, 0xe1, 0x6e, 0x4c, 0x4f, - 0xf0, 0xe2, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x5d, 0x5f, 0x54, 0x27, 0x1e, 0x03, 0x00, 0x00, + proto.RegisterType((*MsgCreateValidatorERC20)(nil), "rollapp.staking.MsgCreateValidatorERC20") + proto.RegisterType((*MsgDelegateERC20)(nil), "rollapp.staking.MsgDelegateERC20") +} + +func init() { proto.RegisterFile("staking/tx.proto", fileDescriptor_5ec9a3a1971dd6a6) } + +var fileDescriptor_5ec9a3a1971dd6a6 = []byte{ + // 348 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xcf, 0x4a, 0xc3, 0x40, + 0x10, 0xc6, 0x13, 0xfc, 0x73, 0x88, 0x88, 0x25, 0x14, 0xaa, 0x39, 0x6c, 0xb5, 0x5e, 0x8a, 0xe2, + 0xae, 0x8d, 0x78, 0x16, 0x5a, 0xf5, 0x56, 0x84, 0x0a, 0x1e, 0xbc, 0xc8, 0xa6, 0x1d, 0xd7, 0xd0, + 0x24, 0x13, 0xb2, 0xdb, 0xd2, 0xf8, 0x14, 0x3e, 0x56, 0x8f, 0x3d, 0x7a, 0x10, 0x91, 0xf6, 0x45, + 0xa4, 0xcd, 0x46, 0x89, 0x56, 0xe9, 0x29, 0x33, 0xf9, 0x66, 0x7e, 0x33, 0xdf, 0x8e, 0x55, 0x92, + 0x8a, 0xf7, 0xfd, 0x48, 0x30, 0x35, 0xa2, 0x71, 0x82, 0x0a, 0xed, 0x9d, 0x04, 0x83, 0x80, 0xc7, + 0x31, 0xd5, 0x8a, 0x53, 0xe9, 0xa2, 0x0c, 0x51, 0xb2, 0x50, 0x0a, 0x36, 0x6c, 0xcc, 0x3f, 0x59, + 0xa5, 0x53, 0x16, 0x28, 0x70, 0x11, 0xb2, 0x79, 0xa4, 0xff, 0xee, 0x09, 0x44, 0x11, 0x00, 0x5b, + 0x64, 0xde, 0xe0, 0x91, 0xf1, 0x28, 0xd5, 0x12, 0xd1, 0x24, 0x8f, 0x4b, 0x60, 0xc3, 0x86, 0x07, + 0x8a, 0x37, 0x58, 0x17, 0xfd, 0x48, 0xeb, 0x55, 0xad, 0xe7, 0x3b, 0xe5, 0x25, 0xf9, 0x6e, 0x35, + 0x6e, 0x55, 0xda, 0x52, 0xb4, 0x12, 0xe0, 0x0a, 0xee, 0x78, 0xe0, 0xf7, 0xb8, 0xc2, 0xe4, 0xaa, + 0xd3, 0x72, 0x4f, 0xed, 0x6b, 0x6b, 0x63, 0xc8, 0x83, 0x01, 0xec, 0x9a, 0xfb, 0x66, 0x7d, 0xcb, + 0x3d, 0xa2, 0x19, 0x2b, 0x77, 0x41, 0x35, 0x8b, 0xfe, 0xee, 0x6f, 0xae, 0x8f, 0xdf, 0xab, 0x46, + 0x27, 0x6b, 0xaf, 0xdd, 0x5a, 0xa5, 0xb6, 0x14, 0x97, 0x10, 0x80, 0xe0, 0x0a, 0x32, 0xf6, 0x45, + 0x91, 0x7d, 0xf8, 0x0f, 0x3b, 0x6f, 0x2c, 0x40, 0xdd, 0x37, 0xd3, 0x5a, 0x6b, 0x4b, 0x61, 0x2b, + 0xab, 0xbc, 0x74, 0xf9, 0x3a, 0xfd, 0xf1, 0xe8, 0xf4, 0x0f, 0x9b, 0x8e, 0xbb, 0xba, 0xaf, 0x0e, + 0xc8, 0x18, 0x23, 0x09, 0xf6, 0x83, 0xb5, 0x5d, 0xf4, 0x73, 0xb0, 0x6c, 0x5c, 0xa1, 0xc4, 0x39, + 0x5e, 0xc1, 0x63, 0x3e, 0xa0, 0x79, 0x33, 0x9e, 0x12, 0x73, 0x32, 0x25, 0xe6, 0xc7, 0x94, 0x98, + 0x2f, 0x33, 0x62, 0x4c, 0x66, 0xc4, 0x78, 0x9d, 0x11, 0xe3, 0xfe, 0x5c, 0xf8, 0xea, 0x69, 0xe0, + 0xd1, 0x2e, 0x86, 0xac, 0x97, 0x86, 0x10, 0x49, 0x1f, 0xa3, 0x51, 0xfa, 0xfc, 0x9d, 0x9c, 0x24, + 0xbd, 0x3e, 0x1b, 0x7d, 0x9d, 0x5c, 0xa5, 0x31, 0x48, 0x6f, 0x73, 0x71, 0xee, 0xb3, 0xcf, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xca, 0x76, 0x44, 0x5f, 0x9e, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -261,10 +169,10 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { // CreateValidator defines a method for creating a new validator. - CreateValidatorERC20(ctx context.Context, in *MsgCreateValidator, opts ...grpc.CallOption) (*MsgCreateValidatorResponse, error) + CreateValidatorERC20(ctx context.Context, in *MsgCreateValidatorERC20, opts ...grpc.CallOption) (*types.MsgCreateValidatorResponse, error) // Delegate defines a method for performing a delegation of coins // from a delegator to a validator. - DelegateERC20(ctx context.Context, in *MsgDelegate, opts ...grpc.CallOption) (*MsgDelegateResponse, error) + DelegateERC20(ctx context.Context, in *MsgDelegateERC20, opts ...grpc.CallOption) (*types.MsgDelegateResponse, error) } type msgClient struct { @@ -275,8 +183,8 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) CreateValidatorERC20(ctx context.Context, in *MsgCreateValidator, opts ...grpc.CallOption) (*MsgCreateValidatorResponse, error) { - out := new(MsgCreateValidatorResponse) +func (c *msgClient) CreateValidatorERC20(ctx context.Context, in *MsgCreateValidatorERC20, opts ...grpc.CallOption) (*types.MsgCreateValidatorResponse, error) { + out := new(types.MsgCreateValidatorResponse) err := c.cc.Invoke(ctx, "/rollapp.staking.Msg/CreateValidatorERC20", in, out, opts...) if err != nil { return nil, err @@ -284,8 +192,8 @@ func (c *msgClient) CreateValidatorERC20(ctx context.Context, in *MsgCreateValid return out, nil } -func (c *msgClient) DelegateERC20(ctx context.Context, in *MsgDelegate, opts ...grpc.CallOption) (*MsgDelegateResponse, error) { - out := new(MsgDelegateResponse) +func (c *msgClient) DelegateERC20(ctx context.Context, in *MsgDelegateERC20, opts ...grpc.CallOption) (*types.MsgDelegateResponse, error) { + out := new(types.MsgDelegateResponse) err := c.cc.Invoke(ctx, "/rollapp.staking.Msg/DelegateERC20", in, out, opts...) if err != nil { return nil, err @@ -296,20 +204,20 @@ func (c *msgClient) DelegateERC20(ctx context.Context, in *MsgDelegate, opts ... // MsgServer is the server API for Msg service. type MsgServer interface { // CreateValidator defines a method for creating a new validator. - CreateValidatorERC20(context.Context, *MsgCreateValidator) (*MsgCreateValidatorResponse, error) + CreateValidatorERC20(context.Context, *MsgCreateValidatorERC20) (*types.MsgCreateValidatorResponse, error) // Delegate defines a method for performing a delegation of coins // from a delegator to a validator. - DelegateERC20(context.Context, *MsgDelegate) (*MsgDelegateResponse, error) + DelegateERC20(context.Context, *MsgDelegateERC20) (*types.MsgDelegateResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) CreateValidatorERC20(ctx context.Context, req *MsgCreateValidator) (*MsgCreateValidatorResponse, error) { +func (*UnimplementedMsgServer) CreateValidatorERC20(ctx context.Context, req *MsgCreateValidatorERC20) (*types.MsgCreateValidatorResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateValidatorERC20 not implemented") } -func (*UnimplementedMsgServer) DelegateERC20(ctx context.Context, req *MsgDelegate) (*MsgDelegateResponse, error) { +func (*UnimplementedMsgServer) DelegateERC20(ctx context.Context, req *MsgDelegateERC20) (*types.MsgDelegateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DelegateERC20 not implemented") } @@ -318,7 +226,7 @@ func RegisterMsgServer(s grpc1.Server, srv MsgServer) { } func _Msg_CreateValidatorERC20_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCreateValidator) + in := new(MsgCreateValidatorERC20) if err := dec(in); err != nil { return nil, err } @@ -330,13 +238,13 @@ func _Msg_CreateValidatorERC20_Handler(srv interface{}, ctx context.Context, dec FullMethod: "/rollapp.staking.Msg/CreateValidatorERC20", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CreateValidatorERC20(ctx, req.(*MsgCreateValidator)) + return srv.(MsgServer).CreateValidatorERC20(ctx, req.(*MsgCreateValidatorERC20)) } return interceptor(ctx, in, info, handler) } func _Msg_DelegateERC20_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgDelegate) + in := new(MsgDelegateERC20) if err := dec(in); err != nil { return nil, err } @@ -348,7 +256,7 @@ func _Msg_DelegateERC20_Handler(srv interface{}, ctx context.Context, dec func(i FullMethod: "/rollapp.staking.Msg/DelegateERC20", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).DelegateERC20(ctx, req.(*MsgDelegate)) + return srv.(MsgServer).DelegateERC20(ctx, req.(*MsgDelegateERC20)) } return interceptor(ctx, in, info, handler) } @@ -367,10 +275,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "governors/tx.proto", + Metadata: "staking/tx.proto", } -func (m *MsgCreateValidator) Marshal() (dAtA []byte, err error) { +func (m *MsgCreateValidatorERC20) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -380,102 +288,30 @@ func (m *MsgCreateValidator) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgCreateValidator) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgCreateValidatorERC20) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgCreateValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgCreateValidatorERC20) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Value != nil { - { - size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgCreateValidatorResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgCreateValidatorResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateValidatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Value != nil { - { - size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgDelegate) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgDelegate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Value != nil { - { - size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) + { + size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *MsgDelegateResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgDelegateERC20) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -485,28 +321,26 @@ func (m *MsgDelegateResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgDelegateResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgDelegateERC20) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgDelegateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgDelegateERC20) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Value != nil { - { - size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) + { + size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -521,55 +355,25 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgCreateValidator) Size() (n int) { +func (m *MsgCreateValidatorERC20) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Value != nil { - l = m.Value.Size() - n += 1 + l + sovTx(uint64(l)) - } + l = m.Value.Size() + n += 1 + l + sovTx(uint64(l)) return n } -func (m *MsgCreateValidatorResponse) Size() (n int) { +func (m *MsgDelegateERC20) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Value != nil { - l = m.Value.Size() - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgDelegate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Value != nil { - l = m.Value.Size() - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgDelegateResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Value != nil { - l = m.Value.Size() - n += 1 + l + sovTx(uint64(l)) - } + l = m.Value.Size() + n += 1 + l + sovTx(uint64(l)) return n } @@ -579,93 +383,7 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgCreateValidator) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgCreateValidator: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateValidator: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Value == nil { - m.Value = &types.MsgCreateValidator{} - } - if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgCreateValidatorResponse) Unmarshal(dAtA []byte) error { +func (m *MsgCreateValidatorERC20) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -688,10 +406,10 @@ func (m *MsgCreateValidatorResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreateValidatorResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCreateValidatorERC20: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateValidatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCreateValidatorERC20: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -723,9 +441,6 @@ func (m *MsgCreateValidatorResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Value == nil { - m.Value = &types.MsgCreateValidatorResponse{} - } if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -751,7 +466,7 @@ func (m *MsgCreateValidatorResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgDelegate) Unmarshal(dAtA []byte) error { +func (m *MsgDelegateERC20) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -774,10 +489,10 @@ func (m *MsgDelegate) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgDelegate: wiretype end group for non-group") + return fmt.Errorf("proto: MsgDelegateERC20: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDelegate: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgDelegateERC20: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -809,95 +524,6 @@ func (m *MsgDelegate) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Value == nil { - m.Value = &types.MsgDelegate{} - } - if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgDelegateResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgDelegateResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDelegateResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Value == nil { - m.Value = &types.MsgDelegateResponse{} - } if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } From 03336eea3c06f3100b003fb4c097fe03b592d743 Mon Sep 17 00:00:00 2001 From: Michael Tsitrin Date: Wed, 29 Jan 2025 21:50:38 +0200 Subject: [PATCH 5/8] cleanup --- testutil/app/app.go | 2 +- x/dist/keeper/allocation.go | 4 ++-- x/staking/keeper/keeper.go | 24 ++++++++++++------------ x/staking/module.go | 19 +++++++++---------- x/staking/types/codec.go | 15 --------------- 5 files changed, 24 insertions(+), 40 deletions(-) diff --git a/testutil/app/app.go b/testutil/app/app.go index d030b119..d4b762cf 100644 --- a/testutil/app/app.go +++ b/testutil/app/app.go @@ -514,7 +514,7 @@ func NewRollapp( app.IBCKeeper.ChannelKeeper, ) - // The IBC tranfer submit is wrapped with: + // The IBC transfer submit is wrapped with: var ics4Wrapper ibcporttypes.ICS4Wrapper // - denom metadata middleware ics4Wrapper = denommetadata.NewICS4Wrapper( diff --git a/x/dist/keeper/allocation.go b/x/dist/keeper/allocation.go index e76f9cdc..33f45aa3 100644 --- a/x/dist/keeper/allocation.go +++ b/x/dist/keeper/allocation.go @@ -35,11 +35,11 @@ func (k Keeper) AllocateTokens(ctx sdk.Context, blockProposer sdk.ConsAddress) { proposerMultiplier := k.GetBaseProposerReward(ctx) proposerReward := feesCollected.MulDecTruncate(k.GetBaseProposerReward(ctx)) - // FIXME: wrap in cache context addr, found := k.seqKeeper.GetRewardAddrByConsAddr(ctx, blockProposer) if !found { logger.Error("Find the validator for this block. Reward not allocated.", "addr", blockProposer) } else { + // TODO: wrap in cache context err := k.AllocateTokensToProposer(ctx, addr, proposerReward) if err == nil { remainingFees = feesCollected.Sub(proposerReward) @@ -63,7 +63,7 @@ func (k Keeper) AllocateTokens(ctx sdk.Context, blockProposer sdk.ConsAddress) { k.AllocateTokensToValidator(ctx, validator, reward) return false }) - remainingFees = feesCollected.Sub(membersRewards) + remainingFees = remainingFees.Sub(membersRewards) /* ------------------------- fund the community pool ------------------------ */ feePool.CommunityPool = feePool.CommunityPool.Add(remainingFees...) diff --git a/x/staking/keeper/keeper.go b/x/staking/keeper/keeper.go index 6c785302..c97794f2 100644 --- a/x/staking/keeper/keeper.go +++ b/x/staking/keeper/keeper.go @@ -52,15 +52,6 @@ func (k *Keeper) SetHooks(sh types.StakingHooks) *Keeper { return k } -func MustValAddressFromBech32(addr string) sdk.ValAddress { - valAddr, err := sdk.ValAddressFromBech32(addr) - if err != nil { - panic(err) - } - - return valAddr -} - // BlockValidatorUpdates calculates the ValidatorUpdates for the current block // Called in each EndBlock // It was copied from the staking module, and modified to add erc20 conversion after unbonding @@ -77,7 +68,7 @@ func (k Keeper) BlockValidatorUpdates(ctx sdk.Context) { // Remove all mature unbonding delegations from the ubd queue. matureUnbonds := k.DequeueAllMatureUBDQueue(ctx, ctx.BlockHeader().Time) for _, dvPair := range matureUnbonds { - addr := MustValAddressFromBech32(dvPair.ValidatorAddress) + addr := mustValAddressFromBech32(dvPair.ValidatorAddress) delegatorAddress := sdk.MustAccAddressFromBech32(dvPair.DelegatorAddress) balances, err := k.CompleteUnbonding(ctx, delegatorAddress, addr) @@ -111,8 +102,8 @@ func (k Keeper) BlockValidatorUpdates(ctx sdk.Context) { // Remove all mature redelegations from the red queue. matureRedelegations := k.DequeueAllMatureRedelegationQueue(ctx, ctx.BlockHeader().Time) for _, dvvTriplet := range matureRedelegations { - valSrcAddr := MustValAddressFromBech32(dvvTriplet.ValidatorSrcAddress) - valDstAddr := MustValAddressFromBech32(dvvTriplet.ValidatorDstAddress) + valSrcAddr := mustValAddressFromBech32(dvvTriplet.ValidatorSrcAddress) + valDstAddr := mustValAddressFromBech32(dvvTriplet.ValidatorDstAddress) delegatorAddress := sdk.MustAccAddressFromBech32(dvvTriplet.DelegatorAddress) balances, err := k.CompleteRedelegation( @@ -137,3 +128,12 @@ func (k Keeper) BlockValidatorUpdates(ctx sdk.Context) { ) } } + +func mustValAddressFromBech32(addr string) sdk.ValAddress { + valAddr, err := sdk.ValAddressFromBech32(addr) + if err != nil { + panic(err) + } + + return valAddr +} diff --git a/x/staking/module.go b/x/staking/module.go index 562f3e9b..2ad4ad67 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -11,9 +11,9 @@ import ( cdctypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/staking" - "github.com/cosmos/cosmos-sdk/x/staking/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/dymensionxyz/dymension-rdk/x/staking/keeper" - types2 "github.com/dymensionxyz/dymension-rdk/x/staking/types" + "github.com/dymensionxyz/dymension-rdk/x/staking/types" ) var ( @@ -27,18 +27,17 @@ type AppModuleBasic struct { // RegisterLegacyAminoCodec registers the staking module's types on the given LegacyAmino codec. func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterLegacyAminoCodec(cdc) + stakingtypes.RegisterLegacyAminoCodec(cdc) - types2.RegisterLegacyAminoCodec(cdc) + types.RegisterLegacyAminoCodec(cdc) } // RegisterInterfaces registers the module's interface types func (b AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(registry) + stakingtypes.RegisterInterfaces(registry) - // custom register - types2.RegisterInterfaces(registry) + types.RegisterInterfaces(registry) } // AppModule embeds the Cosmos SDK's x/distribution AppModule where we only override specific methods. @@ -48,7 +47,7 @@ type AppModule struct { } // NewAppModule creates a new AppModule object -func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak types.AccountKeeper, bk types.BankKeeper) AppModule { +func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak stakingtypes.AccountKeeper, bk stakingtypes.BankKeeper) AppModule { return AppModule{ AppModule: staking.NewAppModule(cdc, keeper.Keeper, ak, bk), keeper: keeper, @@ -61,7 +60,7 @@ func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Val } func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { - var genesisState types.GenesisState + var genesisState stakingtypes.GenesisState cdc.MustUnmarshalJSON(data, &genesisState) _ = am.keeper.InitGenesis(ctx, &genesisState) return []abci.ValidatorUpdate{} @@ -71,5 +70,5 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json. func (am AppModule) RegisterServices(cfg module.Configurator) { am.AppModule.RegisterServices(cfg) - types2.RegisterMsgServer(cfg.MsgServer(), am.keeper) + types.RegisterMsgServer(cfg.MsgServer(), am.keeper) } diff --git a/x/staking/types/codec.go b/x/staking/types/codec.go index 223f69c8..2d6db35a 100644 --- a/x/staking/types/codec.go +++ b/x/staking/types/codec.go @@ -26,18 +26,3 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } - -// var ( -// amino = codec.NewLegacyAmino() -// ModuleCdc = codec.NewAminoCodec(amino) -// ) - -// // func init() { -// // RegisterLegacyAminoCodec(amino) -// // cryptocodec.RegisterCrypto(amino) -// // sdk.RegisterLegacyAminoCodec(amino) - -// // // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be -// // // used to properly serialize MsgGrant and MsgExec instances -// // RegisterLegacyAminoCodec(authzcodec.Amino) -// // } From 59d51d372df47fa7295a8e2d1e754762a2324791 Mon Sep 17 00:00:00 2001 From: Michael Tsitrin Date: Wed, 29 Jan 2025 22:13:29 +0200 Subject: [PATCH 6/8] fixed app testutil --- testutil/app/app.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/testutil/app/app.go b/testutil/app/app.go index d4b762cf..af7f7e7b 100644 --- a/testutil/app/app.go +++ b/testutil/app/app.go @@ -227,6 +227,8 @@ var ( hubgentypes.ModuleName: {authtypes.Minter}, gaslesstypes.ModuleName: nil, evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account + erc20types.ModuleName: {authtypes.Minter, authtypes.Burner}, + feemarkettypes.ModuleName: nil, wasmtypes.ModuleName: {authtypes.Burner}, rollappparamstypes.ModuleName: nil, tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner}, @@ -389,7 +391,7 @@ func NewRollapp( keys[stakingtypes.StoreKey], app.AccountKeeper, app.BankKeeper, - app.Erc20Keeper, + &app.Erc20Keeper, app.GetSubspace(stakingtypes.ModuleName), ) @@ -416,7 +418,8 @@ func NewRollapp( app.BankKeeper, &stakingKeeper, &app.SequencersKeeper, - app.Erc20Keeper, + // nil, // erc20Keeper set later + &app.Erc20Keeper, authtypes.FeeCollectorName, ) @@ -486,6 +489,11 @@ func NewRollapp( ), ) + app.FeeMarketKeeper = feemarketkeeper.NewKeeper( + appCodec, authtypes.NewModuleAddress(govtypes.ModuleName), keys[feemarkettypes.StoreKey], tkeys[feemarkettypes.TransientKey], + app.GetSubspace(feemarkettypes.ModuleName), + ) + app.EvmKeeper = evmkeeper.NewKeeper( appCodec, keys[evmtypes.StoreKey], tkeys[evmtypes.TransientKey], authtypes.NewModuleAddress(govtypes.ModuleName), app.AccountKeeper, app.BankKeeper, @@ -1051,6 +1059,10 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(tokenfactorytypes.ModuleName) paramsKeeper.Subspace(rollappparamstypes.ModuleName) + paramsKeeper.Subspace(feemarkettypes.ModuleName) + paramsKeeper.Subspace(erc20types.ModuleName) + paramsKeeper.Subspace(evmtypes.ModuleName) + return paramsKeeper } From 961007a6507be90847805ac3fe20c74dc730d904 Mon Sep 17 00:00:00 2001 From: Michael Tsitrin Date: Wed, 29 Jan 2025 22:22:18 +0200 Subject: [PATCH 7/8] fixed allocation --- x/dist/keeper/allocation.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/dist/keeper/allocation.go b/x/dist/keeper/allocation.go index 33f45aa3..9e4709b8 100644 --- a/x/dist/keeper/allocation.go +++ b/x/dist/keeper/allocation.go @@ -42,7 +42,7 @@ func (k Keeper) AllocateTokens(ctx sdk.Context, blockProposer sdk.ConsAddress) { // TODO: wrap in cache context err := k.AllocateTokensToProposer(ctx, addr, proposerReward) if err == nil { - remainingFees = feesCollected.Sub(proposerReward) + remainingFees = remainingFees.Sub(proposerReward) } else { // in case of error, the fees will go to the community pool logger.Error("Failed to allocate proposer reward", "err", err) @@ -61,9 +61,9 @@ func (k Keeper) AllocateTokens(ctx sdk.Context, blockProposer sdk.ConsAddress) { reward := membersRewards.MulDecTruncate(powerFraction) k.AllocateTokensToValidator(ctx, validator, reward) + remainingFees = remainingFees.Sub(reward) return false }) - remainingFees = remainingFees.Sub(membersRewards) /* ------------------------- fund the community pool ------------------------ */ feePool.CommunityPool = feePool.CommunityPool.Add(remainingFees...) From fc6288680e7ff52812ae0744861bcfdb6d99afc4 Mon Sep 17 00:00:00 2001 From: Michael Tsitrin Date: Thu, 30 Jan 2025 17:16:02 +0200 Subject: [PATCH 8/8] reverted custom tx --- proto/staking/tx.proto | 34 -- testutil/app/app.go | 1 - x/staking/keeper/msg_server.go | 59 --- x/staking/module.go | 24 -- x/staking/types/codec.go | 28 -- x/staking/types/msgs.go | 95 ----- x/staking/types/tx.pb.go | 635 --------------------------------- 7 files changed, 876 deletions(-) delete mode 100644 proto/staking/tx.proto delete mode 100644 x/staking/keeper/msg_server.go delete mode 100644 x/staking/types/codec.go delete mode 100644 x/staking/types/msgs.go delete mode 100644 x/staking/types/tx.pb.go diff --git a/proto/staking/tx.proto b/proto/staking/tx.proto deleted file mode 100644 index f023d3e0..00000000 --- a/proto/staking/tx.proto +++ /dev/null @@ -1,34 +0,0 @@ -syntax = "proto3"; -package rollapp.staking; - -import "cosmos/msg/v1/msg.proto"; -import "gogoproto/gogo.proto"; -import "google/protobuf/any.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "cosmos/staking/v1beta1/tx.proto"; - -option go_package = "github.com/dymensionxyz/dymension-rdk/x/staking/types"; - -service Msg { - // CreateValidator defines a method for creating a new validator. - rpc CreateValidatorERC20(MsgCreateValidatorERC20) returns (cosmos.staking.v1beta1.MsgCreateValidatorResponse); - - // Delegate defines a method for performing a delegation of coins - // from a delegator to a validator. - rpc DelegateERC20(MsgDelegateERC20) returns (cosmos.staking.v1beta1.MsgDelegateResponse); - - - -} - -// MsgCreateValidatorERC20 defines a SDK message for creating a new validator. -message MsgCreateValidatorERC20 { - cosmos.staking.v1beta1.MsgCreateValidator value = 1 [(gogoproto.nullable) = false]; -} - - -// MsgDelegateERC20 defines a SDK message for performing a delegation of coins -// from a delegator to a validator. -message MsgDelegateERC20 { - cosmos.staking.v1beta1.MsgDelegate value = 1 [(gogoproto.nullable) = false]; -} diff --git a/testutil/app/app.go b/testutil/app/app.go index af7f7e7b..18c69109 100644 --- a/testutil/app/app.go +++ b/testutil/app/app.go @@ -418,7 +418,6 @@ func NewRollapp( app.BankKeeper, &stakingKeeper, &app.SequencersKeeper, - // nil, // erc20Keeper set later &app.Erc20Keeper, authtypes.FeeCollectorName, ) diff --git a/x/staking/keeper/msg_server.go b/x/staking/keeper/msg_server.go deleted file mode 100644 index a510812f..00000000 --- a/x/staking/keeper/msg_server.go +++ /dev/null @@ -1,59 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/dymensionxyz/dymension-rdk/x/staking/types" - "github.com/ethereum/go-ethereum/common" - erc20types "github.com/evmos/evmos/v12/x/erc20/types" -) - -// CreateValidatorERC20 implements types.MsgServer. -func (k Keeper) CreateValidatorERC20(goCtx context.Context, msg *types.MsgCreateValidatorERC20) (*stakingtypes.MsgCreateValidatorResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - stakingMsgServer := stakingkeeper.NewMsgServerImpl(k.Keeper) - - // Convert if needed - - if k.erc20k.IsDenomRegistered(ctx, msg.Value.Value.Denom) { - delegatorAddress, err := sdk.AccAddressFromBech32(msg.Value.DelegatorAddress) - if err != nil { - return nil, err - } - - msg := erc20types.NewMsgConvertCoin(msg.Value.Value, common.BytesToAddress(delegatorAddress), delegatorAddress) - if _, err = k.erc20k.ConvertCoin(sdk.WrapSDKContext(ctx), msg); err != nil { - k.Logger(ctx).Error("Failed to convert coin", "err", err, "delegator", delegatorAddress) - return nil, err - } - } - - // call create validator - return stakingMsgServer.CreateValidator(sdk.WrapSDKContext(ctx), &msg.Value) -} - -// DelegateERC20 implements types.MsgServer. -func (k Keeper) DelegateERC20(goCtx context.Context, msg *types.MsgDelegateERC20) (*stakingtypes.MsgDelegateResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - stakingMsgServer := stakingkeeper.NewMsgServerImpl(k.Keeper) - - // Convert if needed - if k.erc20k.IsDenomRegistered(ctx, msg.Value.Amount.Denom) { - delegatorAddress, err := sdk.AccAddressFromBech32(msg.Value.DelegatorAddress) - if err != nil { - return nil, err - } - - msg := erc20types.NewMsgConvertCoin(msg.Value.Amount, common.BytesToAddress(delegatorAddress), delegatorAddress) - if _, err = k.erc20k.ConvertCoin(sdk.WrapSDKContext(ctx), msg); err != nil { - k.Logger(ctx).Error("Failed to convert coin", "err", err, "delegator", delegatorAddress) - return nil, err - } - } - - // call delegate - return stakingMsgServer.Delegate(sdk.WrapSDKContext(ctx), &msg.Value) -} diff --git a/x/staking/module.go b/x/staking/module.go index 2ad4ad67..85969335 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -8,12 +8,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/staking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/dymensionxyz/dymension-rdk/x/staking/keeper" - "github.com/dymensionxyz/dymension-rdk/x/staking/types" ) var ( @@ -25,21 +23,6 @@ type AppModuleBasic struct { staking.AppModuleBasic } -// RegisterLegacyAminoCodec registers the staking module's types on the given LegacyAmino codec. -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - stakingtypes.RegisterLegacyAminoCodec(cdc) - - types.RegisterLegacyAminoCodec(cdc) - -} - -// RegisterInterfaces registers the module's interface types -func (b AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - stakingtypes.RegisterInterfaces(registry) - - types.RegisterInterfaces(registry) -} - // AppModule embeds the Cosmos SDK's x/distribution AppModule where we only override specific methods. type AppModule struct { staking.AppModule @@ -65,10 +48,3 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json. _ = am.keeper.InitGenesis(ctx, &genesisState) return []abci.ValidatorUpdate{} } - -// RegisterServices registers module services. -func (am AppModule) RegisterServices(cfg module.Configurator) { - am.AppModule.RegisterServices(cfg) - - types.RegisterMsgServer(cfg.MsgServer(), am.keeper) -} diff --git a/x/staking/types/codec.go b/x/staking/types/codec.go deleted file mode 100644 index 2d6db35a..00000000 --- a/x/staking/types/codec.go +++ /dev/null @@ -1,28 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/legacy" - "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" -) - -// RegisterLegacyAminoCodec registers the necessary x/staking interfaces and concrete types -// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - // custom register - - legacy.RegisterAminoMsg(cdc, &MsgCreateValidatorERC20{}, "dymension/MsgCreateValidatorERC20") - legacy.RegisterAminoMsg(cdc, &MsgDelegateERC20{}, "dymension/MsgDelegateERC20") -} - -// RegisterInterfaces registers the x/staking interfaces types with the interface registry -func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgCreateValidatorERC20{}, - &MsgDelegateERC20{}, - ) - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} diff --git a/x/staking/types/msgs.go b/x/staking/types/msgs.go deleted file mode 100644 index 38360c84..00000000 --- a/x/staking/types/msgs.go +++ /dev/null @@ -1,95 +0,0 @@ -package types - -import ( - "cosmossdk.io/math" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -// staking message types -const ( - TypeMsgCreateValidatorERC20 = "create_validator_erc20" - TypeMsgDelegateERC20 = "delegate_erc20" -) - -var ( - _ sdk.Msg = &MsgCreateValidatorERC20{} - _ codectypes.UnpackInterfacesMessage = (*MsgCreateValidatorERC20)(nil) - _ sdk.Msg = &MsgDelegateERC20{} -) - -// NewMsgCreateValidatorERC20 creates a new MsgCreateValidator instance. -// Delegator address and validator address are the same. -func NewMsgCreateValidatorERC20( - valAddr sdk.ValAddress, pubKey cryptotypes.PubKey, //nolint:interfacer - selfDelegation sdk.Coin, description stakingtypes.Description, commission stakingtypes.CommissionRates, minSelfDelegation math.Int, -) (*MsgCreateValidatorERC20, error) { - stakingMsg, err := stakingtypes.NewMsgCreateValidator(valAddr, pubKey, selfDelegation, description, commission, minSelfDelegation) - if err != nil { - return nil, err - } - - return &MsgCreateValidatorERC20{Value: *stakingMsg}, nil -} - -// Route implements the sdk.Msg interface. -func (msg MsgCreateValidatorERC20) Route() string { return stakingtypes.RouterKey } - -// Type implements the sdk.Msg interface. -func (msg MsgCreateValidatorERC20) Type() string { return TypeMsgCreateValidatorERC20 } - -// GetSigners implements the sdk.Msg interface. It returns the address(es) that -// must sign over msg.GetSignBytes(). -// If the validator address is not same as delegator's, then the validator must -// sign the msg as well. -func (msg MsgCreateValidatorERC20) GetSigners() []sdk.AccAddress { - return msg.Value.GetSigners() -} - -// GetSignBytes returns the message bytes to sign over. -func (msg MsgCreateValidatorERC20) GetSignBytes() []byte { - bz := stakingtypes.ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// ValidateBasic implements the sdk.Msg interface. -func (msg MsgCreateValidatorERC20) ValidateBasic() error { - return msg.Value.ValidateBasic() -} - -// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (msg MsgCreateValidatorERC20) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { - var pubKey cryptotypes.PubKey - return unpacker.UnpackAny(msg.Value.Pubkey, &pubKey) -} - -// NewMsgDelegate creates a new MsgDelegate instance. -// -//nolint:interfacer -func NewMsgDelegateERC20(delAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) *stakingtypes.MsgDelegate { - return stakingtypes.NewMsgDelegate(delAddr, valAddr, amount) -} - -// Route implements the sdk.Msg interface. -func (msg MsgDelegateERC20) Route() string { return stakingtypes.RouterKey } - -// Type implements the sdk.Msg interface. -func (msg MsgDelegateERC20) Type() string { return TypeMsgDelegateERC20 } - -// GetSigners implements the sdk.Msg interface. -func (msg MsgDelegateERC20) GetSigners() []sdk.AccAddress { - return msg.Value.GetSigners() -} - -// GetSignBytes implements the sdk.Msg interface. -func (msg MsgDelegateERC20) GetSignBytes() []byte { - bz := stakingtypes.ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// ValidateBasic implements the sdk.Msg interface. -func (msg MsgDelegateERC20) ValidateBasic() error { - return msg.Value.ValidateBasic() -} diff --git a/x/staking/types/tx.pb.go b/x/staking/types/tx.pb.go deleted file mode 100644 index a0420d80..00000000 --- a/x/staking/types/tx.pb.go +++ /dev/null @@ -1,635 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: staking/tx.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/codec/types" - _ "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/cosmos-sdk/types/msgservice" - types "github.com/cosmos/cosmos-sdk/x/staking/types" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// MsgCreateValidatorERC20 defines a SDK message for creating a new validator. -type MsgCreateValidatorERC20 struct { - Value types.MsgCreateValidator `protobuf:"bytes,1,opt,name=value,proto3" json:"value"` -} - -func (m *MsgCreateValidatorERC20) Reset() { *m = MsgCreateValidatorERC20{} } -func (m *MsgCreateValidatorERC20) String() string { return proto.CompactTextString(m) } -func (*MsgCreateValidatorERC20) ProtoMessage() {} -func (*MsgCreateValidatorERC20) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec9a3a1971dd6a6, []int{0} -} -func (m *MsgCreateValidatorERC20) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateValidatorERC20) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateValidatorERC20.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgCreateValidatorERC20) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateValidatorERC20.Merge(m, src) -} -func (m *MsgCreateValidatorERC20) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateValidatorERC20) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateValidatorERC20.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateValidatorERC20 proto.InternalMessageInfo - -func (m *MsgCreateValidatorERC20) GetValue() types.MsgCreateValidator { - if m != nil { - return m.Value - } - return types.MsgCreateValidator{} -} - -// MsgDelegateERC20 defines a SDK message for performing a delegation of coins -// from a delegator to a validator. -type MsgDelegateERC20 struct { - Value types.MsgDelegate `protobuf:"bytes,1,opt,name=value,proto3" json:"value"` -} - -func (m *MsgDelegateERC20) Reset() { *m = MsgDelegateERC20{} } -func (m *MsgDelegateERC20) String() string { return proto.CompactTextString(m) } -func (*MsgDelegateERC20) ProtoMessage() {} -func (*MsgDelegateERC20) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec9a3a1971dd6a6, []int{1} -} -func (m *MsgDelegateERC20) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDelegateERC20) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDelegateERC20.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgDelegateERC20) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDelegateERC20.Merge(m, src) -} -func (m *MsgDelegateERC20) XXX_Size() int { - return m.Size() -} -func (m *MsgDelegateERC20) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDelegateERC20.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDelegateERC20 proto.InternalMessageInfo - -func (m *MsgDelegateERC20) GetValue() types.MsgDelegate { - if m != nil { - return m.Value - } - return types.MsgDelegate{} -} - -func init() { - proto.RegisterType((*MsgCreateValidatorERC20)(nil), "rollapp.staking.MsgCreateValidatorERC20") - proto.RegisterType((*MsgDelegateERC20)(nil), "rollapp.staking.MsgDelegateERC20") -} - -func init() { proto.RegisterFile("staking/tx.proto", fileDescriptor_5ec9a3a1971dd6a6) } - -var fileDescriptor_5ec9a3a1971dd6a6 = []byte{ - // 348 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xcf, 0x4a, 0xc3, 0x40, - 0x10, 0xc6, 0x13, 0xfc, 0x73, 0x88, 0x88, 0x25, 0x14, 0xaa, 0x39, 0x6c, 0xb5, 0x5e, 0x8a, 0xe2, - 0xae, 0x8d, 0x78, 0x16, 0x5a, 0xf5, 0x56, 0x84, 0x0a, 0x1e, 0xbc, 0xc8, 0xa6, 0x1d, 0xd7, 0xd0, - 0x24, 0x13, 0xb2, 0xdb, 0xd2, 0xf8, 0x14, 0x3e, 0x56, 0x8f, 0x3d, 0x7a, 0x10, 0x91, 0xf6, 0x45, - 0xa4, 0xcd, 0x46, 0x89, 0x56, 0xe9, 0x29, 0x33, 0xf9, 0x66, 0x7e, 0x33, 0xdf, 0x8e, 0x55, 0x92, - 0x8a, 0xf7, 0xfd, 0x48, 0x30, 0x35, 0xa2, 0x71, 0x82, 0x0a, 0xed, 0x9d, 0x04, 0x83, 0x80, 0xc7, - 0x31, 0xd5, 0x8a, 0x53, 0xe9, 0xa2, 0x0c, 0x51, 0xb2, 0x50, 0x0a, 0x36, 0x6c, 0xcc, 0x3f, 0x59, - 0xa5, 0x53, 0x16, 0x28, 0x70, 0x11, 0xb2, 0x79, 0xa4, 0xff, 0xee, 0x09, 0x44, 0x11, 0x00, 0x5b, - 0x64, 0xde, 0xe0, 0x91, 0xf1, 0x28, 0xd5, 0x12, 0xd1, 0x24, 0x8f, 0x4b, 0x60, 0xc3, 0x86, 0x07, - 0x8a, 0x37, 0x58, 0x17, 0xfd, 0x48, 0xeb, 0x55, 0xad, 0xe7, 0x3b, 0xe5, 0x25, 0xf9, 0x6e, 0x35, - 0x6e, 0x55, 0xda, 0x52, 0xb4, 0x12, 0xe0, 0x0a, 0xee, 0x78, 0xe0, 0xf7, 0xb8, 0xc2, 0xe4, 0xaa, - 0xd3, 0x72, 0x4f, 0xed, 0x6b, 0x6b, 0x63, 0xc8, 0x83, 0x01, 0xec, 0x9a, 0xfb, 0x66, 0x7d, 0xcb, - 0x3d, 0xa2, 0x19, 0x2b, 0x77, 0x41, 0x35, 0x8b, 0xfe, 0xee, 0x6f, 0xae, 0x8f, 0xdf, 0xab, 0x46, - 0x27, 0x6b, 0xaf, 0xdd, 0x5a, 0xa5, 0xb6, 0x14, 0x97, 0x10, 0x80, 0xe0, 0x0a, 0x32, 0xf6, 0x45, - 0x91, 0x7d, 0xf8, 0x0f, 0x3b, 0x6f, 0x2c, 0x40, 0xdd, 0x37, 0xd3, 0x5a, 0x6b, 0x4b, 0x61, 0x2b, - 0xab, 0xbc, 0x74, 0xf9, 0x3a, 0xfd, 0xf1, 0xe8, 0xf4, 0x0f, 0x9b, 0x8e, 0xbb, 0xba, 0xaf, 0x0e, - 0xc8, 0x18, 0x23, 0x09, 0xf6, 0x83, 0xb5, 0x5d, 0xf4, 0x73, 0xb0, 0x6c, 0x5c, 0xa1, 0xc4, 0x39, - 0x5e, 0xc1, 0x63, 0x3e, 0xa0, 0x79, 0x33, 0x9e, 0x12, 0x73, 0x32, 0x25, 0xe6, 0xc7, 0x94, 0x98, - 0x2f, 0x33, 0x62, 0x4c, 0x66, 0xc4, 0x78, 0x9d, 0x11, 0xe3, 0xfe, 0x5c, 0xf8, 0xea, 0x69, 0xe0, - 0xd1, 0x2e, 0x86, 0xac, 0x97, 0x86, 0x10, 0x49, 0x1f, 0xa3, 0x51, 0xfa, 0xfc, 0x9d, 0x9c, 0x24, - 0xbd, 0x3e, 0x1b, 0x7d, 0x9d, 0x5c, 0xa5, 0x31, 0x48, 0x6f, 0x73, 0x71, 0xee, 0xb3, 0xcf, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xca, 0x76, 0x44, 0x5f, 0x9e, 0x02, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// MsgClient is the client API for Msg service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type MsgClient interface { - // CreateValidator defines a method for creating a new validator. - CreateValidatorERC20(ctx context.Context, in *MsgCreateValidatorERC20, opts ...grpc.CallOption) (*types.MsgCreateValidatorResponse, error) - // Delegate defines a method for performing a delegation of coins - // from a delegator to a validator. - DelegateERC20(ctx context.Context, in *MsgDelegateERC20, opts ...grpc.CallOption) (*types.MsgDelegateResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) CreateValidatorERC20(ctx context.Context, in *MsgCreateValidatorERC20, opts ...grpc.CallOption) (*types.MsgCreateValidatorResponse, error) { - out := new(types.MsgCreateValidatorResponse) - err := c.cc.Invoke(ctx, "/rollapp.staking.Msg/CreateValidatorERC20", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) DelegateERC20(ctx context.Context, in *MsgDelegateERC20, opts ...grpc.CallOption) (*types.MsgDelegateResponse, error) { - out := new(types.MsgDelegateResponse) - err := c.cc.Invoke(ctx, "/rollapp.staking.Msg/DelegateERC20", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - // CreateValidator defines a method for creating a new validator. - CreateValidatorERC20(context.Context, *MsgCreateValidatorERC20) (*types.MsgCreateValidatorResponse, error) - // Delegate defines a method for performing a delegation of coins - // from a delegator to a validator. - DelegateERC20(context.Context, *MsgDelegateERC20) (*types.MsgDelegateResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) CreateValidatorERC20(ctx context.Context, req *MsgCreateValidatorERC20) (*types.MsgCreateValidatorResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateValidatorERC20 not implemented") -} -func (*UnimplementedMsgServer) DelegateERC20(ctx context.Context, req *MsgDelegateERC20) (*types.MsgDelegateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DelegateERC20 not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_CreateValidatorERC20_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCreateValidatorERC20) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).CreateValidatorERC20(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rollapp.staking.Msg/CreateValidatorERC20", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CreateValidatorERC20(ctx, req.(*MsgCreateValidatorERC20)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_DelegateERC20_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgDelegateERC20) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).DelegateERC20(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rollapp.staking.Msg/DelegateERC20", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).DelegateERC20(ctx, req.(*MsgDelegateERC20)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "rollapp.staking.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateValidatorERC20", - Handler: _Msg_CreateValidatorERC20_Handler, - }, - { - MethodName: "DelegateERC20", - Handler: _Msg_DelegateERC20_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "staking/tx.proto", -} - -func (m *MsgCreateValidatorERC20) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgCreateValidatorERC20) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateValidatorERC20) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgDelegateERC20) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgDelegateERC20) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDelegateERC20) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgCreateValidatorERC20) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Value.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgDelegateERC20) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Value.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgCreateValidatorERC20) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgCreateValidatorERC20: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateValidatorERC20: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgDelegateERC20) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgDelegateERC20: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDelegateERC20: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTx(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTx - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTx - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTx - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") -)