From 88b58cf0bd44362698af04a84db6a5dcf961d22d Mon Sep 17 00:00:00 2001 From: Rootul P Date: Mon, 29 Jan 2024 10:04:48 -0500 Subject: [PATCH] test: increase test coverage for governance params (#3007) Closes https://github.com/celestiaorg/celestia-app/issues/2916 with heavy inspiration from PRs by @fahimahmedx Opens https://github.com/celestiaorg/celestia-app/issues/2972 --------- Co-authored-by: fahimahmedx --- go.work.sum | 72 ---- x/paramfilter/test/gov_params_test.go | 596 ++++++++++++++++++++++++++ 2 files changed, 596 insertions(+), 72 deletions(-) create mode 100644 x/paramfilter/test/gov_params_test.go diff --git a/go.work.sum b/go.work.sum index 0f1f87f9f1..4cf0be8d93 100644 --- a/go.work.sum +++ b/go.work.sum @@ -624,13 +624,9 @@ github.com/cockroachdb/datadriven v1.0.0/go.mod h1:5Ib8Meh+jk1RlHIXej6Pzevx/NLlN github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= github.com/cockroachdb/errors v1.6.1/go.mod h1:tm6FTP5G81vwJ5lC0SizQo374JNCOPrHyXGitRJoDqM= github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= -github.com/containerd/containerd v1.6.8/go.mod h1:By6p5KqPK0/7/CgO/A6t/Gz+CUYUu2zf1hUaaymVXB0= -github.com/containerd/typeurl v1.0.2/go.mod h1:9trJWW2sRlGub4wZJRTW83VtbOLS6hwcDZXTn6oPz9s= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cosmos/cosmos-sdk/db v1.0.0-beta.1/go.mod h1:JUMM2MxF9wuwzRWZJjb8BjXsn1BmPmdBd3a75pIct4I= github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT84hqJfKoO8Tt/Roc= -github.com/daixiang0/gci v0.8.1/go.mod h1:EpVfrztufwVgQRXjnX4zuNinEpLj5OmMjtu/+MB0V0c= github.com/daixiang0/gci v0.10.1/go.mod h1:xtHP9N7AHdNvtRNfcx9gwTDfw7FRJx4bZUsiEfiNNAI= github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= github.com/denis-tingaikin/go-header v0.4.3/go.mod h1:0wOCWuN71D5qIgE2nz9KrKmuYBAC2Mra5RassOIQ2/c= @@ -678,25 +674,16 @@ github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= -github.com/go-toolsmith/astcast v1.0.0/go.mod h1:mt2OdQTeAQcY4DQgPSArJjHCcOwlX+Wl/kwN+LbLGQ4= github.com/go-toolsmith/astcast v1.1.0/go.mod h1:qdcuFWeGGS2xX5bLM/c3U9lewg7+Zu4mr+xPwZIB4ZU= -github.com/go-toolsmith/astcopy v1.0.2/go.mod h1:4TcEdbElGc9twQEYpVo/aieIXfHhiuLh4aLAck6dO7Y= github.com/go-toolsmith/astcopy v1.1.0/go.mod h1:hXM6gan18VA1T/daUEHCFcYiW8Ai1tIwIzHY6srfEAw= -github.com/go-toolsmith/astequal v1.0.3/go.mod h1:9Ai4UglvtR+4up+bAD4+hCj7iTo4m/OXVTSLnCyTAx4= github.com/go-toolsmith/astequal v1.1.0/go.mod h1:sedf7VIdCL22LD8qIvv7Nn9MuWJruQA/ysswh64lffQ= -github.com/go-toolsmith/astfmt v1.0.0/go.mod h1:cnWmsOAuq4jJY6Ct5YWlVLmcmLMn1JUPuQIHCY7CJDw= github.com/go-toolsmith/astfmt v1.1.0/go.mod h1:OrcLlRwu0CuiIBp/8b5PYF9ktGVZUjlNMV634mhwuQ4= -github.com/go-toolsmith/astp v1.0.0/go.mod h1:RSyrtpVlfTFGDYRbrjyWP1pYu//tSFcvdYrA8meBmLI= github.com/go-toolsmith/astp v1.1.0/go.mod h1:0T1xFGz9hicKs8Z5MfAqSUitoUYS30pDMsRVIDHs8CA= -github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= github.com/go-toolsmith/strparse v1.1.0/go.mod h1:7ksGy58fsaQkGQlY8WVoBFNyEPMGuJin1rfoPS4lBSQ= -github.com/go-toolsmith/typep v1.0.2/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= github.com/go-toolsmith/typep v1.1.0/go.mod h1:fVIw+7zjdsMxDA3ITWnH1yOiw1rnTQKCsF/sk2H/qig= -github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= github.com/go-xmlfmt/xmlfmt v1.1.2/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= github.com/go-zookeeper/zk v1.0.2/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/gofrs/uuid v4.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid/v5 v5.0.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= @@ -719,13 +706,6 @@ github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg= -github.com/googleapis/enterprise-certificate-proxy v0.2.1/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= -github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= -github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8= -github.com/googleapis/gax-go/v2 v2.7.1/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= -github.com/googleapis/gax-go/v2 v2.10.0/go.mod h1:4UOEnMCrxsSqQ940WnTiD6qJ63le2ev3xfyagutxiPw= -github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= -github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gostaticanalysis/analysisutil v0.7.1/go.mod h1:v21E3hY37WKMGSnbsw2S/ojApNWb6C1//mXO48CXbVc= @@ -786,22 +766,12 @@ github.com/kunwardeep/paralleltest v1.0.6/go.mod h1:Y0Y0XISdZM5IKm3TREQMZ6iteqn1 github.com/kyoh86/exportloopref v0.1.11/go.mod h1:qkV4UF1zGl6EkF1ox8L5t9SwyeBAZ3qLMd6up458uqA= github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g= github.com/ldez/gomoddirectives v0.2.3/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdBr6g8G04uz6d0= -github.com/ldez/tagliatelle v0.3.1/go.mod h1:8s6WJQwEYHbKZDsp/LjArytKOG8qaMrKQQ3mFukHs88= github.com/ldez/tagliatelle v0.4.0/go.mod h1:mNtTfrHy2haaBAw+VT7IBV6VXBThS7TCreYWbBcJ87I= -github.com/leonklingele/grouper v1.1.0/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= github.com/leonklingele/grouper v1.1.1/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= -github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/maratori/testableexamples v1.0.0/go.mod h1:4rhjL1n20TUTT4vdh3RDqSizKLyXp7K2u6HgraZCGzE= -github.com/maratori/testpackage v1.1.0/go.mod h1:PeAhzU8qkCwdGEMTEupsHJNlQu2gZopMC6RjbhmHeDc= github.com/maratori/testpackage v1.1.1/go.mod h1:s4gRK/ym6AMrqpOa/kEbQTV4Q4jb7WeLZzVhVVVOQMc= -github.com/matoous/godox v0.0.0-20210227103229-6504466cf951/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= -github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= @@ -809,12 +779,7 @@ github.com/mediocregopher/mediocre-go-lib v0.0.0-20181029021733-cb65787f37ed/go. github.com/mediocregopher/radix/v3 v3.3.0/go.mod h1:EmfVyvspXz1uZEyPBMyGK+kjWiKQGvsUt6O3Pj+LDCQ= github.com/mgechev/revive v1.3.1/go.mod h1:YlD6TTWl2B8A103R9KWJSPVI9DrEf+oqr15q21Ld+5I= github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc= -github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= -github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= -github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= -github.com/moby/buildkit v0.10.4/go.mod h1:Yajz9vt1Zw5q9Pp4pdb3TCSUXJBIroIQGQ3TTs/sLug= -github.com/moricho/tparallel v0.2.1/go.mod h1:fXEIZxG2vdfl0ZF8b42f5a78EhjjD5mX8qUplsoSU4k= github.com/moricho/tparallel v0.3.0/go.mod h1:leENX2cUv7Sv2qDgdi0D0fCftN8fRC67Bcn8pqzeYNI= github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= github.com/nakabonne/nestif v0.3.1/go.mod h1:9EtoZochLn5iUprVDmDjqGKPofoUEBL8U4Ngq6aY7OE= @@ -915,19 +880,10 @@ go.etcd.io/etcd/client/v2 v2.305.6/go.mod h1:BHha8XJGe8vCIBfWBpbBLVZ4QjOIlfoouvO go.etcd.io/etcd/client/v3 v3.5.6/go.mod h1:f6GRinRMCsFVv9Ht42EyY7nfsVGwrNO0WEoS2pRKzQk= go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.uber.org/automaxprocs v1.5.2/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= -go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= -go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= -golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= -golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/exp/typeparams v0.0.0-20220827204233-334a2380cb91/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= @@ -941,8 +897,6 @@ golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= -golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= -golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -966,50 +920,24 @@ golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= -gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= gonum.org/v1/gonum v0.12.0/go.mod h1:73TDxJfAAHeA8Mk9mf8NlIppyhQNo5GLTcYeqgo2lvY= -google.golang.org/api v0.107.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY= -google.golang.org/api v0.114.0/go.mod h1:ifYI2ZsFK6/uGddGfAD5BMxlnkBqCmqHSDUVi45N5Yg= -google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230320184635-7606e756e683/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= -google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:xZnkP7mREFX5MORlOPEzLMr+90PPZQ2QWzrVTWfAq64= google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= -google.golang.org/genproto v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:CCviP9RmpZ1mxVr8MUjCnSiY09IbAXZxhLE6EhHIdPU= google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:CgAqfJo+Xmu0GwA0411Ht3OU3OntXwsGmrmjI8ioGXI= google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:J7XzRzVy1+IPwWHZUzoD0IccYZIrXILAQpc+Qy9CMhY= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/api v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:RdyHbowztCGQySiCvQPgWQWgWhGnouTdCflKoDBt32U= google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:IBQ646DjkDkvUIsVq/cc03FUFQ9wbZu7yE396YcL870= google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:0xJLfVdJqpAPl8tDg1ujOCGzx6LFLttXT5NhllGOXY4= -google.golang.org/genproto/googleapis/bytestream v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:ylj+BE99M198VPbBh6A8d9n3w8fChvyLK3wwBOjXBFA= google.golang.org/genproto/googleapis/bytestream v0.0.0-20231030173426-d783a09b4405/go.mod h1:GRUCuLdzVqZte8+Dl/D4N25yLzcGqqWaYkeVOwulFqw= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:KSqppvjFjtoCI+KGd4PELB0qLNxdJHRGqRI09mB6pQA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:swOH3j0KzcDDgGUWr+SNpyTen5YrXjS3eyPzFYKc6lc= google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:oQ5rr10WTTMvP4A36n8JpR1OrO1BEiV4f78CneXZxkA= google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f/go.mod h1:L9KNLi232K1/xB6f7AlSX692koaRnKaWSR0stBki0Yc= google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= -google.golang.org/protobuf v1.28.2-0.20230222093303-bc1253ad3743/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= -honnef.co/go/tools v0.3.3/go.mod h1:jzwdWgg7Jdq75wlfblQxO4neNaFFSvgc1tD5Wv8U0Yw= -honnef.co/go/tools v0.4.3/go.mod h1:36ZgoUOrqOk1GxwHhyryEkq8FQWkUO2xGuSMhUCcdvA= -k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= -mvdan.cc/gofumpt v0.4.0/go.mod h1:PljLOHDeZqgS8opHRKLzp2It2VBuSdteAgqUfzMTxlQ= -mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= -mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= -mvdan.cc/unparam v0.0.0-20220706161116-678bad134442/go.mod h1:F/Cxw/6mVrNKqrR2YjFf5CaW0Bw4RL8RfbEf4GRggJk= -mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d/go.mod h1:IeHQjmn6TOD+e4Z3RFiZMMsLVL+A96Nvptar8Fj71is= sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e h1:4Z09Hglb792X0kfOBBJUPFEyvVfQWrYT/l8h5EKA6JQ= -sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= diff --git a/x/paramfilter/test/gov_params_test.go b/x/paramfilter/test/gov_params_test.go new file mode 100644 index 0000000000..3261509db7 --- /dev/null +++ b/x/paramfilter/test/gov_params_test.go @@ -0,0 +1,596 @@ +package test + +import ( + "testing" + "time" + + "github.com/celestiaorg/celestia-app/app" + "github.com/celestiaorg/celestia-app/x/paramfilter" + "github.com/stretchr/testify/suite" + + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + + testutil "github.com/celestiaorg/celestia-app/test/util" + blobtypes "github.com/celestiaorg/celestia-app/x/blob/types" + bsmoduletypes "github.com/celestiaorg/celestia-app/x/blobstream/types" + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + "github.com/cosmos/cosmos-sdk/x/params/types/proposal" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + ibctransfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" + ibcclienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" + ibcconnectiontypes "github.com/cosmos/ibc-go/v6/modules/core/03-connection/types" +) + +type GovParamsTestSuite struct { + suite.Suite + + app *app.App + ctx sdk.Context + govHandler v1beta1.Handler +} + +func (suite *GovParamsTestSuite) SetupTest() { + suite.app, _ = testutil.SetupTestAppWithGenesisValSet(app.DefaultConsensusParams()) + suite.ctx = suite.app.BaseApp.NewContext(false, tmproto.Header{}) + suite.govHandler = paramfilter.NewParamBlockList(suite.app.BlockedParams()...).GovHandler(suite.app.ParamsKeeper) +} + +func TestGovParamsTestSuite(t *testing.T) { + if testing.Short() { + t.Skip("skipping gov params test suite in short mode.") + } + suite.Run(t, new(GovParamsTestSuite)) +} + +// TestModifiableParams verifies that the params listed as governance modifiable +// in the specs params.md file are modifiable via governance. +func (suite *GovParamsTestSuite) TestModifiableParams() { + assert := suite.Assert() + + testCases := []struct { + name string + proposal *proposal.ParameterChangeProposal + postProposal func() + }{ + { + "auth.MaxMemoCharacters", + testProposal(proposal.ParamChange{ + Subspace: authtypes.ModuleName, + Key: string(authtypes.KeyMaxMemoCharacters), + Value: `"2"`, + }), + func() { + got := suite.app.AccountKeeper.GetParams(suite.ctx).MaxMemoCharacters + want := uint64(2) + assert.Equal(want, got) + }, + }, + { + "auth.SigVerifyCostED25519", + testProposal(proposal.ParamChange{ + Subspace: authtypes.ModuleName, + Key: string(authtypes.KeySigVerifyCostED25519), + Value: `"2"`, + }), + func() { + got := suite.app.AccountKeeper.GetParams(suite.ctx).SigVerifyCostED25519 + want := uint64(2) + assert.Equal(want, got) + }, + }, + { + "auth.SigVerifyCostSecp256k1", + testProposal(proposal.ParamChange{ + Subspace: authtypes.ModuleName, + Key: string(authtypes.KeySigVerifyCostSecp256k1), + Value: `"2"`, + }), + func() { + got := suite.app.AccountKeeper.GetParams(suite.ctx).SigVerifyCostSecp256k1 + want := uint64(2) + assert.Equal(want, got) + }, + }, + { + "auth.TxSigLimit", + testProposal(proposal.ParamChange{ + Subspace: authtypes.ModuleName, + Key: string(authtypes.KeyTxSigLimit), + Value: `"2"`, + }), + func() { + got := suite.app.AccountKeeper.GetParams(suite.ctx).TxSigLimit + want := uint64(2) + assert.Equal(want, got) + }, + }, + { + "auth.TxSizeCostPerByte", + testProposal(proposal.ParamChange{ + Subspace: authtypes.ModuleName, + Key: string(authtypes.KeyTxSizeCostPerByte), + Value: `"2"`, + }), + func() { + got := suite.app.AccountKeeper.GetParams(suite.ctx).TxSizeCostPerByte + want := uint64(2) + assert.Equal(want, got) + }, + }, + { + "blob.GasPerBlobByte", + testProposal(proposal.ParamChange{ + Subspace: blobtypes.ModuleName, + Key: string(blobtypes.KeyGasPerBlobByte), + Value: `2`, + }), + func() { + got := suite.app.BlobKeeper.GetParams(suite.ctx).GasPerBlobByte + want := uint32(2) + assert.Equal(want, got) + }, + }, + { + "blob.GovMaxSquareSize", + testProposal(proposal.ParamChange{ + Subspace: blobtypes.ModuleName, + Key: string(blobtypes.KeyGovMaxSquareSize), + Value: `"2"`, + }), + func() { + got := suite.app.BlobKeeper.GetParams(suite.ctx).GovMaxSquareSize + want := uint64(2) + assert.Equal(want, got) + }, + }, + { + "blobstream.DataCommitmentWindow", + testProposal(proposal.ParamChange{ + Subspace: bsmoduletypes.ModuleName, + Key: string(bsmoduletypes.ParamsStoreKeyDataCommitmentWindow), + Value: `"100"`, + }), + func() { + got := suite.app.BlobstreamKeeper.GetParams(suite.ctx).DataCommitmentWindow + want := uint64(100) + assert.Equal(want, got) + }, + }, + { + "consensus.block", + testProposal(proposal.ParamChange{ + Subspace: baseapp.Paramspace, + Key: string(baseapp.ParamStoreKeyBlockParams), + Value: `{"max_bytes": "1", "max_gas": "2"}`, + }), + func() { + gotMaxBytes := suite.app.BaseApp.GetConsensusParams(suite.ctx).Block.MaxBytes + wantMaxBytes := int64(1) + assert.Equal(wantMaxBytes, gotMaxBytes) + + gotMaxGas := suite.app.BaseApp.GetConsensusParams(suite.ctx).Block.MaxGas + wantMaxGas := int64(2) + assert.Equal(wantMaxGas, gotMaxGas) + }, + }, + { + "consensus.evidence", + testProposal(proposal.ParamChange{ + Subspace: baseapp.Paramspace, + Key: string(baseapp.ParamStoreKeyEvidenceParams), + Value: `{"max_age_duration": "1", "max_age_num_blocks": "2", "max_bytes": "3"}`, + }), + func() { + gotMaxAgeDuration := suite.app.BaseApp.GetConsensusParams(suite.ctx).Evidence.MaxAgeDuration + wantMaxAgeDuration := time.Duration(1) + assert.Equal(wantMaxAgeDuration, gotMaxAgeDuration) + + gotMaxAgeNumBlocks := suite.app.BaseApp.GetConsensusParams(suite.ctx).Evidence.MaxAgeNumBlocks + wantMaxAgeNumBlocks := int64(2) + assert.Equal(wantMaxAgeNumBlocks, gotMaxAgeNumBlocks) + + gotMaxBytes := suite.app.BaseApp.GetConsensusParams(suite.ctx).Evidence.MaxBytes + wantMaxBytes := int64(3) + assert.Equal(wantMaxBytes, gotMaxBytes) + }, + }, + { + "consensus.Version.AppVersion", + testProposal(proposal.ParamChange{ + Subspace: baseapp.Paramspace, + Key: string(baseapp.ParamStoreKeyVersionParams), + Value: `{"app_version": "3"}`, + }), + func() { + got := *suite.app.BaseApp.GetConsensusParams(suite.ctx).Version + want := tmproto.VersionParams{AppVersion: 3} + assert.Equal(want, got) + }, + }, + { + "distribution.BaseProposerReward", + testProposal(proposal.ParamChange{ + Subspace: distributiontypes.ModuleName, + Key: string(distributiontypes.ParamStoreKeyBaseProposerReward), + Value: `"1"`, + }), + func() { + got := suite.app.DistrKeeper.GetParams(suite.ctx).BaseProposerReward + want := sdk.NewDec(1) + assert.Equal(want, got) + }, + }, + { + "distribution.BonusProposerReward", + testProposal(proposal.ParamChange{ + Subspace: distributiontypes.ModuleName, + Key: string(distributiontypes.ParamStoreKeyBonusProposerReward), + Value: `"1"`, + }), + func() { + got := suite.app.DistrKeeper.GetParams(suite.ctx).BonusProposerReward + want := sdk.NewDec(1) + assert.Equal(want, got) + }, + }, + { + "distribution.CommunityTax", + testProposal(proposal.ParamChange{ + Subspace: distributiontypes.ModuleName, + Key: string(distributiontypes.ParamStoreKeyCommunityTax), + Value: `"1"`, + }), + func() { + want := suite.app.DistrKeeper.GetParams(suite.ctx).CommunityTax + got := sdk.NewDec(1) + assert.Equal(got, want) + }, + }, + { + "distribution.WithdrawAddrEnabled", + testProposal(proposal.ParamChange{ + Subspace: distributiontypes.ModuleName, + Key: string(distributiontypes.ParamStoreKeyWithdrawAddrEnabled), + Value: `false`, + }), + func() { + got := suite.app.DistrKeeper.GetParams(suite.ctx).WithdrawAddrEnabled + want := false + assert.Equal(want, got) + }, + }, + { + "gov.DepositParams", + testProposal(proposal.ParamChange{ + Subspace: "gov", + Key: string(govtypes.ParamStoreKeyDepositParams), + Value: `{"max_deposit_period": "1", "min_deposit": [{"denom": "test", "amount": "2"}]}`, + }), + func() { + gotMaxDepositPeriod := *suite.app.GovKeeper.GetDepositParams(suite.ctx).MaxDepositPeriod + wantMaxDepositPeriod := time.Duration(1) + assert.Equal(wantMaxDepositPeriod, gotMaxDepositPeriod) + + gotMinDeposit := suite.app.GovKeeper.GetDepositParams(suite.ctx).MinDeposit + wantMinDeposit := []sdk.Coin{{Denom: "test", Amount: sdk.NewInt(2)}} + assert.Equal(wantMinDeposit, gotMinDeposit) + }, + }, + { + "gov.TallyParams", + testProposal(proposal.ParamChange{ + Subspace: "gov", + Key: string(govtypes.ParamStoreKeyTallyParams), + Value: `{"quorum": "0.1", "threshold": "0.2", "veto_threshold": "0.3"}`, + }), + func() { + gotQuroum := suite.app.GovKeeper.GetTallyParams(suite.ctx).Quorum + wantQuorum := "0.1" + assert.Equal(wantQuorum, gotQuroum) + + gotThreshold := suite.app.GovKeeper.GetTallyParams(suite.ctx).Threshold + wantThreshold := "0.2" + assert.Equal(wantThreshold, gotThreshold) + + gotVetoThreshold := suite.app.GovKeeper.GetTallyParams(suite.ctx).VetoThreshold + wantVetoThreshold := "0.3" + assert.Equal(wantVetoThreshold, gotVetoThreshold) + }, + }, + { + "gov.VotingParams.VotingPeriod", + testProposal(proposal.ParamChange{ + Subspace: "gov", + Key: string(govtypes.ParamStoreKeyVotingParams), + Value: `{"voting_period": "2"}`, + }), + func() { + got := *suite.app.GovKeeper.GetVotingParams(suite.ctx).VotingPeriod + want := time.Duration(2) + assert.Equal(want, got) + }, + }, + { + "ibc.ClientGenesis.AllowedClients", + testProposal(proposal.ParamChange{ + Subspace: "ibc", + Key: string(ibcclienttypes.KeyAllowedClients), + Value: `["01-test"]`, + }), + func() { + got := suite.app.IBCKeeper.ClientKeeper.GetParams(suite.ctx).AllowedClients + want := []string{"01-test"} + assert.Equal(want, got) + }, + }, + { + "ibc.ConnectionGenesis.MaxExpectedTimePerBlock", + testProposal(proposal.ParamChange{ + Subspace: "ibc", + Key: string(ibcconnectiontypes.KeyMaxExpectedTimePerBlock), + Value: `"2"`, + }), + func() { + got := suite.app.IBCKeeper.ConnectionKeeper.GetParams(suite.ctx).MaxExpectedTimePerBlock + want := uint64(2) + assert.Equal(want, got) + }, + }, + { + "ibc.Transfer.ReceiveEnabled", + testProposal(proposal.ParamChange{ + Subspace: ibctransfertypes.ModuleName, + Key: string(ibctransfertypes.KeyReceiveEnabled), + Value: `false`, + }), + func() { + got := suite.app.TransferKeeper.GetParams(suite.ctx).ReceiveEnabled + want := false + assert.Equal(want, got) + }, + }, + { + "ibc.Transfer.SendEnabled", + testProposal(proposal.ParamChange{ + Subspace: ibctransfertypes.ModuleName, + Key: string(ibctransfertypes.KeySendEnabled), + Value: `false`, + }), + func() { + got := suite.app.TransferKeeper.GetParams(suite.ctx).SendEnabled + want := false + assert.Equal(want, got) + }, + }, + { + "slashing.DowntimeJailDuration", + testProposal(proposal.ParamChange{ + Subspace: slashingtypes.ModuleName, + Key: string(slashingtypes.KeyDowntimeJailDuration), + Value: `"2"`, + }), + func() { + got := suite.app.SlashingKeeper.GetParams(suite.ctx).DowntimeJailDuration + want := time.Duration(2) + assert.Equal(want, got) + }, + }, + { + "slashing.MinSignedPerWindow", + testProposal(proposal.ParamChange{ + Subspace: slashingtypes.ModuleName, + Key: string(slashingtypes.KeyMinSignedPerWindow), + Value: `"1"`, + }), + func() { + got := suite.app.SlashingKeeper.GetParams(suite.ctx).MinSignedPerWindow + want := sdk.NewDec(1) + assert.Equal(want, got) + }, + }, + { + "slashing.SignedBlocksWindow", + testProposal(proposal.ParamChange{ + Subspace: slashingtypes.ModuleName, + Key: string(slashingtypes.KeySignedBlocksWindow), + Value: `"1"`, + }), + func() { + got := suite.app.SlashingKeeper.GetParams(suite.ctx).SignedBlocksWindow + want := int64(1) + assert.Equal(want, got) + }, + }, + { + "slashing.SlashFractionDoubleSign", + testProposal(proposal.ParamChange{ + Subspace: slashingtypes.ModuleName, + Key: string(slashingtypes.KeySlashFractionDoubleSign), + Value: `"1"`, + }), + func() { + got := suite.app.SlashingKeeper.GetParams(suite.ctx).SlashFractionDoubleSign + want := sdk.NewDec(1) + assert.Equal(want, got) + }, + }, + { + "slashing.SlashFractionDowntime", + testProposal(proposal.ParamChange{ + Subspace: slashingtypes.ModuleName, + Key: string(slashingtypes.KeySlashFractionDowntime), + Value: `"1"`, + }), + func() { + got := suite.app.SlashingKeeper.GetParams(suite.ctx).SlashFractionDowntime + want := sdk.NewDec(1) + assert.Equal(want, got) + }, + }, + { + "staking.HistoricalEntries", + testProposal(proposal.ParamChange{ + Subspace: stakingtypes.ModuleName, + Key: string(stakingtypes.KeyHistoricalEntries), + Value: `1`, + }), + func() { + got := suite.app.StakingKeeper.GetParams(suite.ctx).HistoricalEntries + want := uint32(1) + assert.Equal(want, got) + }, + }, + { + "staking.MaxEntries", + testProposal(proposal.ParamChange{ + Subspace: stakingtypes.ModuleName, + Key: string(stakingtypes.KeyMaxEntries), + Value: `1`, + }), + func() { + got := suite.app.StakingKeeper.GetParams(suite.ctx).MaxEntries + want := uint32(1) + assert.Equal(want, got) + }, + }, + { + "staking.MaxValidators", + testProposal(proposal.ParamChange{ + Subspace: stakingtypes.ModuleName, + Key: string(stakingtypes.KeyMaxValidators), + Value: `1`, + }), + func() { + got := suite.app.StakingKeeper.GetParams(suite.ctx).MaxValidators + want := uint32(1) + assert.Equal(want, got) + }, + }, + { + "staking.MinCommissionRate", + testProposal(proposal.ParamChange{ + Subspace: stakingtypes.ModuleName, + Key: string(stakingtypes.KeyMinCommissionRate), + Value: `"1"`, + }), + func() { + got := suite.app.StakingKeeper.GetParams(suite.ctx).MinCommissionRate + want := sdk.NewDec(1) + assert.Equal(want, got) + }, + }, + } + + for _, tc := range testCases { + suite.Run(tc.name, func() { + err := suite.govHandler(suite.ctx, tc.proposal) + suite.Require().NoError(err) + tc.postProposal() + }) + } +} + +// TestUnmodifiableParams verifies that the params listed as non governance +// modifiable in the specs params.md file cannot be modified via governance. It +// does not include a test case for consensus.block.TimeIotaMs because +// TimeIotaMs is not exposed to the application. +func (suite *GovParamsTestSuite) TestUnmodifiableParams() { + assert := suite.Assert() + + // Record the initial values of all these parameters before any governance + // proposals are submitted. + wantSendEnabled := suite.app.BankKeeper.GetParams(suite.ctx).SendEnabled + wantPubKeyTypes := *suite.app.BaseApp.GetConsensusParams(suite.ctx).Validator + wantBondDenom := suite.app.StakingKeeper.GetParams(suite.ctx).BondDenom + wantUnbondingTime := suite.app.StakingKeeper.GetParams(suite.ctx).UnbondingTime + + testCases := []struct { + name string + proposal *proposal.ParameterChangeProposal + wantErr error + postProposal func() + }{ + { + "bank.SendEnabled", + testProposal(proposal.ParamChange{ + Subspace: banktypes.ModuleName, + Key: string(banktypes.KeySendEnabled), + Value: `[{"denom": "test", "enabled": false}]`, + }), + paramfilter.ErrBlockedParameter, + func() { + got := suite.app.BankKeeper.GetParams(suite.ctx).SendEnabled + + proposed := []*banktypes.SendEnabled{banktypes.NewSendEnabled("test", false)} + assert.NotEqual(proposed, got) + assert.Equal(wantSendEnabled, got) + }, + }, + { + "consensus.validator.PubKeyTypes", + testProposal(proposal.ParamChange{ + Subspace: baseapp.Paramspace, + Key: string(baseapp.ParamStoreKeyValidatorParams), + Value: `{"pub_key_types": ["secp256k1"]}`, + }), + paramfilter.ErrBlockedParameter, + func() { + got := *suite.app.BaseApp.GetConsensusParams(suite.ctx).Validator + proposed := tmproto.ValidatorParams{ + PubKeyTypes: []string{"secp256k1"}, + } + assert.NotEqual(proposed, got) + assert.Equal(wantPubKeyTypes, got) + }, + }, + { + "staking.BondDenom", + testProposal(proposal.ParamChange{ + Subspace: stakingtypes.ModuleName, + Key: string(stakingtypes.KeyBondDenom), + Value: `"test"`, + }), + paramfilter.ErrBlockedParameter, + func() { + got := suite.app.StakingKeeper.GetParams(suite.ctx).BondDenom + proposed := "test" + assert.NotEqual(proposed, got) + assert.Equal(wantBondDenom, got) + }, + }, + { + "staking.UnbondingTime", + testProposal(proposal.ParamChange{ + Subspace: stakingtypes.ModuleName, + Key: string(stakingtypes.KeyUnbondingTime), + Value: `"1"`, + }), + paramfilter.ErrBlockedParameter, + func() { + got := suite.app.StakingKeeper.GetParams(suite.ctx).UnbondingTime + proposed := time.Duration(1) + assert.NotEqual(proposed, got) + assert.Equal(wantUnbondingTime, got) + }, + }, + } + + for _, tc := range testCases { + suite.Run(tc.name, func() { + err := suite.govHandler(suite.ctx, tc.proposal) + if tc.wantErr != nil { + suite.Require().ErrorIs(err, tc.wantErr) + } else { + suite.Require().NoError(err) + } + tc.postProposal() + }) + } +}