diff --git a/README.md b/README.md index 8de78e07da..bef49e0bd7 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ See for more information ### Tools -1. Install [golangci-lint](https://golangci-lint.run/usage/install/) +1. Install [golangci-lint](https://golangci-lint.run/welcome/install/) 1. Install [markdownlint](https://github.com/DavidAnson/markdownlint) 1. Install [hadolint](https://github.com/hadolint/hadolint) 1. Install [yamllint](https://yamllint.readthedocs.io/en/stable/quickstart.html) diff --git a/app/default_overrides.go b/app/default_overrides.go index 6079c3fcfc..31320a52e0 100644 --- a/app/default_overrides.go +++ b/app/default_overrides.go @@ -6,6 +6,7 @@ import ( "time" "github.com/celestiaorg/celestia-app/pkg/appconsts" + v1 "github.com/celestiaorg/celestia-app/pkg/appconsts/v1" "github.com/celestiaorg/celestia-app/x/mint" minttypes "github.com/celestiaorg/celestia-app/x/mint/types" "github.com/cosmos/cosmos-sdk/codec" @@ -208,6 +209,17 @@ func DefaultConsensusParams() *tmproto.ConsensusParams { } } +func DefaultInitialConsensusParams() *tmproto.ConsensusParams { + return &tmproto.ConsensusParams{ + Block: DefaultBlockParams(), + Evidence: DefaultEvidenceParams(), + Validator: coretypes.DefaultValidatorParams(), + Version: tmproto.VersionParams{ + AppVersion: v1.Version, + }, + } +} + // DefaultBlockParams returns a default BlockParams with a MaxBytes determined // using a goal square size. func DefaultBlockParams() tmproto.BlockParams { diff --git a/app/prepare_proposal.go b/app/prepare_proposal.go index 1e19b65543..c8d06b664e 100644 --- a/app/prepare_proposal.go +++ b/app/prepare_proposal.go @@ -71,7 +71,7 @@ func (app *App) PrepareProposal(req abci.RequestPrepareProposal) abci.ResponsePr // build the square from the set of valid and prioritised transactions. // The txs returned are the ones used in the square and block - dataSquare, txs, err := square.Build(txs, app.GetBaseApp().AppVersion(sdkCtx), app.GovSquareSizeUpperBound(sdkCtx)) + dataSquare, txs, err := square.Build(txs, app.GetBaseApp().AppVersion(), app.GovSquareSizeUpperBound(sdkCtx)) if err != nil { panic(err) } diff --git a/app/process_proposal.go b/app/process_proposal.go index 6c7c472223..0aaf791840 100644 --- a/app/process_proposal.go +++ b/app/process_proposal.go @@ -108,7 +108,7 @@ func (app *App) ProcessProposal(req abci.RequestProcessProposal) (resp abci.Resp } // Construct the data square from the block's transactions - dataSquare, err := square.Construct(req.BlockData.Txs, app.GetBaseApp().AppVersion(sdkCtx), app.GovSquareSizeUpperBound(sdkCtx)) + dataSquare, err := square.Construct(req.BlockData.Txs, app.GetBaseApp().AppVersion(), app.GovSquareSizeUpperBound(sdkCtx)) if err != nil { logInvalidPropBlockError(app.Logger(), req.Header, "failure to compute data square from transactions:", err) return reject() diff --git a/app/square_size.go b/app/square_size.go index 9af83aef55..f0c3825580 100644 --- a/app/square_size.go +++ b/app/square_size.go @@ -20,8 +20,8 @@ func (app *App) GovSquareSizeUpperBound(ctx sdk.Context) int { gmax := int(app.BlobKeeper.GovMaxSquareSize(ctx)) // perform a secondary check on the max square size. - if gmax > appconsts.SquareSizeUpperBound(app.AppVersion(ctx)) { - gmax = appconsts.SquareSizeUpperBound(app.AppVersion(ctx)) + if gmax > appconsts.SquareSizeUpperBound(app.AppVersion()) { + gmax = appconsts.SquareSizeUpperBound(app.AppVersion()) } return gmax diff --git a/app/test/max_total_blob_size_test.go b/app/test/max_total_blob_size_test.go index 2197259b6f..f497f364ae 100644 --- a/app/test/max_total_blob_size_test.go +++ b/app/test/max_total_blob_size_test.go @@ -49,7 +49,7 @@ func (s *MaxTotalBlobSizeSuite) SetupSuite() { tmConfig := testnode.DefaultTendermintConfig() tmConfig.Mempool.MaxTxBytes = 10 * mebibyte - cParams := testnode.DefaultParams() + cParams := testnode.DefaultConsensusParams() cParams.Block.MaxBytes = 10 * mebibyte cfg := testnode.DefaultConfig(). diff --git a/go.mod b/go.mod index d513fe7eb1..cfaa479e7b 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/celestiaorg/nmt v0.20.0 github.com/ethereum/go-ethereum v1.13.2 github.com/gogo/protobuf v1.3.3 - github.com/golang/protobuf v1.5.3 + github.com/golang/protobuf v1.5.4 github.com/google/uuid v1.4.0 // indirect github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 @@ -30,7 +30,7 @@ require ( github.com/celestiaorg/quantum-gravity-bridge/v2 v2.1.2 github.com/celestiaorg/rsmt2d v0.11.0 github.com/cosmos/cosmos-proto v1.0.0-alpha8 - github.com/cosmos/cosmos-sdk v0.46.16 + github.com/cosmos/cosmos-sdk v0.46.12 github.com/cosmos/gogoproto v1.4.11 github.com/cosmos/ibc-go/v6 v6.2.1 github.com/rs/zerolog v1.31.0 @@ -63,7 +63,6 @@ require ( github.com/onsi/gomega v1.27.4 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc2 // indirect - github.com/rogpeppe/go-internal v1.10.0 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/supranational/blst v0.3.11 // indirect go.opentelemetry.io/otel v1.24.0 // indirect @@ -169,7 +168,6 @@ require ( github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect github.com/mattn/go-runewidth v0.0.13 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect github.com/minio/highwayhash v1.0.2 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect @@ -179,9 +177,9 @@ require ( github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.14.0 // indirect - github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.42.0 // indirect + github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_model v0.6.0 // indirect + github.com/prometheus/common v0.53.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rakyll/statik v0.1.7 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect @@ -205,13 +203,13 @@ require ( github.com/zondax/ledger-go v0.14.3 // indirect go.etcd.io/bbolt v1.3.6 // indirect go.opencensus.io v0.24.0 // indirect - golang.org/x/oauth2 v0.15.0 // indirect + golang.org/x/oauth2 v0.18.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.152.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/protobuf v1.31.0 + google.golang.org/protobuf v1.33.0 gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect @@ -219,7 +217,7 @@ require ( ) replace ( - github.com/cosmos/cosmos-sdk => github.com/celestiaorg/cosmos-sdk v1.20.1-sdk-v0.46.16 + github.com/cosmos/cosmos-sdk => github.com/celestiaorg/cosmos-sdk v1.23.0-sdk-v0.46.16 // Pin to ledger-cosmos-go v0.12.4 to avoid a breaking change introduced in v0.13.0 // The following replace statement can be removed when we upgrade to cosmos-sdk >= v0.50.0 github.com/cosmos/ledger-cosmos-go => github.com/cosmos/ledger-cosmos-go v0.12.4 diff --git a/go.sum b/go.sum index 9a9fb4808f..3534b9afc3 100644 --- a/go.sum +++ b/go.sum @@ -316,8 +316,8 @@ github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOC github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/celestiaorg/celestia-core v1.36.0-tm-v0.34.29 h1:qLsTxyS0CHMuMO4S0ug1Zntv+gFB6OVdDNmG3pz5mHI= github.com/celestiaorg/celestia-core v1.36.0-tm-v0.34.29/go.mod h1:AL7kotb6ucKF4bpKKhGIzGhGL7dwYj2nFstiFC6PGxM= -github.com/celestiaorg/cosmos-sdk v1.20.1-sdk-v0.46.16 h1:9U9UthIJSOyVjabD5PkD6aczvqlWOyAFTOXw0duPT5k= -github.com/celestiaorg/cosmos-sdk v1.20.1-sdk-v0.46.16/go.mod h1:Tvsc3YnqvflXTYC8xIy/Q07Es95xZ1pZC/imoKogtbg= +github.com/celestiaorg/cosmos-sdk v1.23.0-sdk-v0.46.16 h1:N2uETI13szEKnGAdKhtTR0EsrpcW0AwRKYER74WLnuw= +github.com/celestiaorg/cosmos-sdk v1.23.0-sdk-v0.46.16/go.mod h1:Bpl1LSWiDpQumgOhhMTZBMopqa0j7fRasIhvTZB44P0= github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 h1:CJdIpo8n5MFP2MwK0gSRcOVlDlFdQJO1p+FqdxYzmvc= github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4/go.mod h1:fzuHnhzj1pUygGz+1ZkB3uQbEUL4htqCGJ4Qs2LwMZA= github.com/celestiaorg/nmt v0.20.0 h1:9i7ultZ8Wv5ytt8ZRaxKQ5KOOMo4A2K2T/aPGjIlSas= @@ -636,8 +636,8 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +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.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -943,8 +943,6 @@ github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 h1:QRUSJEgZn2Snx0EmT/QLXibWjSUDjKWvXIT19NBVp94= @@ -1073,16 +1071,16 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= -github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= +github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= +github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos= +github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= @@ -1091,8 +1089,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= -github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= +github.com/prometheus/common v0.53.0 h1:U2pL9w9nmJwJDa4qqLQ3ZaePJ6ZTwt7cMD3AG3+aLCE= +github.com/prometheus/common v0.53.0/go.mod h1:BrxBKv3FWBIGXw89Mg1AeBq7FSyRzXWI3l3e7W3RN5U= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -1479,8 +1477,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ= -golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= +golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI= +golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1952,8 +1950,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/test/cmd/txsim/cli_test.go b/test/cmd/txsim/cli_test.go index 40091df841..2654c5f84a 100644 --- a/test/cmd/txsim/cli_test.go +++ b/test/cmd/txsim/cli_test.go @@ -57,7 +57,7 @@ func setup(t testing.TB) (keyring.Keyring, string, string) { t.Helper() // set the consensus params to allow for the max square size - cparams := testnode.DefaultParams() + cparams := testnode.DefaultConsensusParams() cparams.Block.MaxBytes = int64(appconsts.DefaultSquareSizeUpperBound*appconsts.DefaultSquareSizeUpperBound) * appconsts.ContinuationSparseShareContentSize cfg := testnode.DefaultConfig(). diff --git a/test/util/app_options.go b/test/util/app_options.go new file mode 100644 index 0000000000..c0e3374f42 --- /dev/null +++ b/test/util/app_options.go @@ -0,0 +1,12 @@ +package util + +import "github.com/cosmos/cosmos-sdk/server/types" + +// emptyAppOptions implements the AppOptions interface. +var _ types.AppOptions = emptyAppOptions{} + +type emptyAppOptions struct{} + +func (e emptyAppOptions) Get(_ string) interface{} { + return nil +} diff --git a/test/util/malicious/out_of_order_prepare.go b/test/util/malicious/out_of_order_prepare.go index 24a6bff664..ebc23bc31b 100644 --- a/test/util/malicious/out_of_order_prepare.go +++ b/test/util/malicious/out_of_order_prepare.go @@ -36,7 +36,7 @@ func (a *App) OutOfOrderPrepareProposal(req abci.RequestPrepareProposal) abci.Re // build the square from the set of valid and prioritised transactions. // The txs returned are the ones used in the square and block - dataSquare, txs, err := Build(txs, a.GetBaseApp().AppVersion(sdkCtx), a.GovSquareSizeUpperBound(sdkCtx), OutOfOrderExport) + dataSquare, txs, err := Build(txs, a.GetBaseApp().AppVersion(), a.GovSquareSizeUpperBound(sdkCtx), OutOfOrderExport) if err != nil { panic(err) } diff --git a/test/util/test_app.go b/test/util/test_app.go index ac0b0c0d5c..efa8e478fe 100644 --- a/test/util/test_app.go +++ b/test/util/test_app.go @@ -40,35 +40,26 @@ func init() { simapp.GetSimulatorFlags() } -type emptyAppOptions struct{} - -// Get implements AppOptions -func (ao emptyAppOptions) Get(_ string) interface{} { - return nil -} - // SetupTestAppWithGenesisValSet initializes a new app with a validator set and // genesis accounts that also act as delegators. For simplicity, each validator // is bonded with a delegation of one consensus engine unit in the default token // of the app from first genesis account. A no-op logger is set in app. func SetupTestAppWithGenesisValSet(cparams *tmproto.ConsensusParams, genAccounts ...string) (*app.App, keyring.Keyring) { - // var cache sdk.MultiStorePersistentCache - // EmptyAppOptions is a stub implementing AppOptions - emptyOpts := emptyAppOptions{} - // var anteOpt = func(bapp *baseapp.BaseApp) { bapp.SetAnteHandler(nil) } - db := dbm.NewMemDB() + emptyOptions := emptyAppOptions{} skipUpgradeHeights := make(map[int64]bool) - - encCfg := encoding.MakeConfig(app.ModuleEncodingRegisters...) + encodingConfig := encoding.MakeConfig(app.ModuleEncodingRegisters...) testApp := app.New( - log.NewNopLogger(), db, nil, true, skipUpgradeHeights, - cast.ToString(emptyOpts.Get(flags.FlagHome)), - cast.ToUint(emptyOpts.Get(server.FlagInvCheckPeriod)), - encCfg, - emptyOpts, + log.NewNopLogger(), + dbm.NewMemDB(), + nil, + true, + skipUpgradeHeights, + cast.ToString(emptyOptions.Get(flags.FlagHome)), + cast.ToUint(emptyOptions.Get(server.FlagInvCheckPeriod)), + encodingConfig, + emptyOptions, ) - testApp.GetBaseApp().SetAppVersion(sdk.Context{}, appconsts.LatestVersion) genesisState, valSet, kr := GenesisStateWithSingleValidator(testApp, genAccounts...) @@ -86,6 +77,7 @@ func SetupTestAppWithGenesisValSet(cparams *tmproto.ConsensusParams, genAccounts }, Evidence: &cparams.Evidence, Validator: &cparams.Validator, + Version: &cparams.Version, } genesisTime := time.Date(2023, 1, 1, 1, 1, 1, 1, time.UTC).UTC() diff --git a/test/util/testnode/config.go b/test/util/testnode/config.go index 7cec330835..38d591a009 100644 --- a/test/util/testnode/config.go +++ b/test/util/testnode/config.go @@ -6,6 +6,7 @@ import ( "github.com/celestiaorg/celestia-app/cmd/celestia-appd/cmd" "github.com/celestiaorg/celestia-app/pkg/appconsts" + v1 "github.com/celestiaorg/celestia-app/pkg/appconsts/v1" "github.com/cosmos/cosmos-sdk/server" srvconfig "github.com/cosmos/cosmos-sdk/server/config" srvtypes "github.com/cosmos/cosmos-sdk/server/types" @@ -115,7 +116,7 @@ func DefaultConfig() *Config { WithAccounts([]string{}). WithChainID(tmrand.Str(6)). WithTendermintConfig(DefaultTendermintConfig()). - WithConsensusParams(DefaultParams()). + WithConsensusParams(DefaultConsensusParams()). WithAppOptions(DefaultAppOptions()). WithAppConfig(DefaultAppConfig()). WithGenesisOptions(). @@ -173,12 +174,25 @@ func DefaultAppOptions() *KVAppOptions { return opts } +// Deprecated: use DefaultConsensusParams instead. func DefaultParams() *tmproto.ConsensusParams { - cparams := types.DefaultConsensusParams() - cparams.Block.TimeIotaMs = 1 - cparams.Block.MaxBytes = appconsts.DefaultMaxBytes - cparams.Version.AppVersion = appconsts.LatestVersion - return cparams + return DefaultConsensusParams() +} + +func DefaultConsensusParams() *tmproto.ConsensusParams { + consensusParams := types.DefaultConsensusParams() + consensusParams.Block.TimeIotaMs = 1 + consensusParams.Block.MaxBytes = appconsts.DefaultMaxBytes + consensusParams.Version.AppVersion = appconsts.LatestVersion + return consensusParams +} + +func DefaultInitialConsensusParams() *tmproto.ConsensusParams { + consensusParams := types.DefaultConsensusParams() + consensusParams.Block.TimeIotaMs = 1 + consensusParams.Block.MaxBytes = appconsts.DefaultMaxBytes + consensusParams.Version.AppVersion = v1.Version + return consensusParams } func DefaultTendermintConfig() *tmconfig.Config { diff --git a/x/mint/test/mint_test.go b/x/mint/test/mint_test.go index f38d5514c6..fcd0eb6450 100644 --- a/x/mint/test/mint_test.go +++ b/x/mint/test/mint_test.go @@ -26,7 +26,7 @@ func (s *IntegrationTestSuite) SetupSuite() { t := s.T() t.Log("setting up mint integration test suite") - cparams := testnode.DefaultParams() + consensusParams := testnode.DefaultInitialConsensusParams() oneDay := time.Hour * 24 oneMonth := oneDay * 30 sixMonths := oneMonth * 6 @@ -37,12 +37,10 @@ func (s *IntegrationTestSuite) SetupSuite() { // // Note: if TimeIotaMs is removed from CometBFT, this technique will no // longer work. - cparams.Block.TimeIotaMs = int64(sixMonths.Milliseconds()) + consensusParams.Block.TimeIotaMs = int64(sixMonths.Milliseconds()) - cfg := testnode.DefaultConfig(). - WithConsensusParams(cparams) - - cctx, _, _ := testnode.NewNetwork(t, cfg) + config := testnode.DefaultConfig().WithConsensusParams(consensusParams) + cctx, _, _ := testnode.NewNetwork(t, config) s.cctx = cctx } diff --git a/x/upgrade/test/removal_test.go b/x/upgrade/test/removal_test.go index 8bfd0ca710..3e6dd7dfe3 100644 --- a/x/upgrade/test/removal_test.go +++ b/x/upgrade/test/removal_test.go @@ -10,9 +10,8 @@ import ( ) func TestRemoval(t *testing.T) { - app, _ := testutil.SetupTestAppWithGenesisValSet(app.DefaultConsensusParams()) - sftwrUpgrd := sdkupgradetypes.MsgSoftwareUpgrade{} - router := app.MsgServiceRouter() - handler := router.Handler(&sftwrUpgrd) + app, _ := testutil.SetupTestAppWithGenesisValSet(app.DefaultInitialConsensusParams()) + softwareUpgrade := sdkupgradetypes.MsgSoftwareUpgrade{} + handler := app.MsgServiceRouter().Handler(&softwareUpgrade) require.Nil(t, handler) }