diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 40c64da4a2..116722ee89 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -27,14 +27,5 @@ jobs: - name: Run e2e tests run: make test-e2e - test-fuzz: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-go@v4 - with: - go-version: ${{ env.GO_VERSION }} - - - name: Run fuzz tests - run: make test-fuzz + test: + uses: ./.github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 252af1b999..27f3164d1c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -59,3 +59,15 @@ jobs: - name: Run tests in race mode run: make test-race + + test-fuzz: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Run fuzz tests + run: make test-fuzz diff --git a/Dockerfile b/Dockerfile index 1c3640e375..c9759df126 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # stage 1 Generate celestia-appd Binary -FROM --platform=$BUILDPLATFORM docker.io/golang:1.21.3-alpine3.18 as builder +FROM --platform=$BUILDPLATFORM docker.io/golang:1.21.4-alpine3.18 as builder ARG TARGETOS ARG TARGETARCH diff --git a/Makefile b/Makefile index 27dbcec62d..918a1e639e 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ VERSION := $(shell echo $(shell git describe --tags 2>/dev/null || git log -1 --format='%h') | sed 's/^v//') COMMIT := $(shell git log -1 --format='%H') DOCKER := $(shell which docker) +ALL_VERSIONS := $(shell git tag -l) DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf IMAGE := ghcr.io/tendermint/docker-build-proto:latest DOCKER_PROTO_BUILDER := docker run -v $(shell pwd):/workspace --workdir /workspace $(IMAGE) @@ -115,10 +116,10 @@ test-short: @go test ./... -short -timeout 1m .PHONY: test-short -## test-e2e: Run end to end tests via knuu. +## test-e2e: Run end to end tests via knuu. This command requires a kube/config file to configure kubernetes. test-e2e: - @echo "--> Running e2e tests on version: $(shell git rev-parse --short HEAD)" - @KNUU_NAMESPACE=test E2E_VERSION=$(shell git rev-parse --short HEAD) E2E=true go test ./test/e2e/... -timeout 10m -v + @echo "--> Running end to end tests" + @KNUU_NAMESPACE=test KNUU_TIMEOUT=20m E2E_VERSIONS="$(ALL_VERSIONS)" E2E=true go test ./test/e2e/... -timeout 20m -v .PHONY: test-e2e ## test-race: Run tests in race mode. diff --git a/app/app.go b/app/app.go index 8803240b5b..1e6d312d2a 100644 --- a/app/app.go +++ b/app/app.go @@ -85,6 +85,7 @@ import ( "github.com/celestiaorg/celestia-app/app/ante" "github.com/celestiaorg/celestia-app/app/encoding" "github.com/celestiaorg/celestia-app/pkg/appconsts" + v2 "github.com/celestiaorg/celestia-app/pkg/appconsts/v2" "github.com/celestiaorg/celestia-app/pkg/proof" blobmodule "github.com/celestiaorg/celestia-app/x/blob" blobmodulekeeper "github.com/celestiaorg/celestia-app/x/blob/keeper" @@ -239,6 +240,10 @@ type App struct { } // New returns a reference to an initialized celestia app. +// +// NOTE: upgradeHeight refers specifically to the height that +// a node will upgrade from v1 to v2. It will be deprecated in v3 +// in place for a dynamically signalling scheme func New( logger log.Logger, db dbm.DB, @@ -246,16 +251,10 @@ func New( loadLatest bool, invCheckPeriod uint, encodingConfig encoding.Config, - upgradeSchedule map[string]upgrade.Schedule, + upgradeHeight int64, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), ) *App { - for _, schedule := range upgradeSchedule { - if err := schedule.ValidateVersions(supportedVersions); err != nil { - panic(err) - } - } - appCodec := encodingConfig.Codec cdc := encodingConfig.Amino interfaceRegistry := encodingConfig.InterfaceRegistry @@ -334,7 +333,7 @@ func New( ) app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, keys[feegrant.StoreKey], app.AccountKeeper) - app.UpgradeKeeper = upgrade.NewKeeper(keys[upgrade.StoreKey], upgradeSchedule) + app.UpgradeKeeper = upgrade.NewKeeper(keys[upgrade.StoreKey], upgradeHeight) app.BlobstreamKeeper = *bsmodulekeeper.NewKeeper( appCodec, @@ -574,14 +573,10 @@ func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.R // EndBlocker application updates every end block func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { res := app.mm.EndBlock(ctx, req) - if app.UpgradeKeeper.ShouldUpgrade() { - newAppVersion := app.UpgradeKeeper.GetNextAppVersion() - app.SetProtocolVersion(newAppVersion) - _, err := app.mm.RunMigrations(ctx, app.configurator, GetModuleVersion(newAppVersion)) - if err != nil { - panic(err) - } - app.UpgradeKeeper.MarkUpgradeComplete() + // NOTE: this is a specific feature for upgrading to v2 as v3 and onward is expected + // to be coordinated through the signalling protocol + if app.UpgradeKeeper.ShouldUpgrade(req.Height) { + app.SetProtocolVersion(v2.Version) } return res } diff --git a/app/default_overrides_test.go b/app/default_overrides_test.go index 944343f70e..159a4eed8f 100644 --- a/app/default_overrides_test.go +++ b/app/default_overrides_test.go @@ -9,6 +9,7 @@ import ( distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1" "github.com/stretchr/testify/assert" + tmcfg "github.com/tendermint/tendermint/config" ) // Test_newGovModule verifies that the gov module's genesis state has defaults @@ -63,3 +64,28 @@ func TestDefaultAppConfig(t *testing.T) { assert.Equal(t, uint32(2), cfg.StateSync.SnapshotKeepRecent) assert.Equal(t, "0.1utia", cfg.MinGasPrices) } + +func TestDefaultConsensusConfig(t *testing.T) { + got := DefaultConsensusConfig() + + t.Run("mempool overrides", func(t *testing.T) { + want := tmcfg.MempoolConfig{ + // defaults + Broadcast: tmcfg.DefaultMempoolConfig().Broadcast, + CacheSize: tmcfg.DefaultMempoolConfig().CacheSize, + KeepInvalidTxsInCache: tmcfg.DefaultMempoolConfig().KeepInvalidTxsInCache, + Recheck: tmcfg.DefaultMempoolConfig().Recheck, + RootDir: tmcfg.DefaultMempoolConfig().RootDir, + Size: tmcfg.DefaultMempoolConfig().Size, + WalPath: tmcfg.DefaultMempoolConfig().WalPath, + + // overrides + MaxTxBytes: 7_897_088, + MaxTxsBytes: 39_485_440, + TTLDuration: 75 * time.Second, + TTLNumBlocks: 5, + Version: "v1", + } + assert.Equal(t, want, *got.Mempool) + }) +} diff --git a/app/deliver_tx.go b/app/deliver_tx.go deleted file mode 100644 index 1b3dbc3d6f..0000000000 --- a/app/deliver_tx.go +++ /dev/null @@ -1,23 +0,0 @@ -package app - -import ( - "fmt" - - "github.com/celestiaorg/celestia-app/x/upgrade" - abci "github.com/tendermint/tendermint/abci/types" -) - -func (app *App) DeliverTx(req abci.RequestDeliverTx) abci.ResponseDeliverTx { - sdkTx, err := app.txConfig.TxDecoder()(req.Tx) - if err == nil { - if appVersion, ok := upgrade.IsUpgradeMsg(sdkTx.GetMsgs()); ok { - if !IsSupported(appVersion) { - panic(fmt.Sprintf("network has upgraded to version %d which is not supported by this node. Please upgrade and restart", appVersion)) - } - app.UpgradeKeeper.PrepareUpgradeAtEndBlock(appVersion) - // TODO: we may want to emit an event for this - return abci.ResponseDeliverTx{Code: abci.CodeTypeOK} - } - } - return app.BaseApp.DeliverTx(req) -} diff --git a/app/prepare_proposal.go b/app/prepare_proposal.go index 8929c31cd5..2240f79371 100644 --- a/app/prepare_proposal.go +++ b/app/prepare_proposal.go @@ -7,7 +7,6 @@ import ( "github.com/celestiaorg/celestia-app/pkg/da" "github.com/celestiaorg/celestia-app/pkg/shares" "github.com/celestiaorg/celestia-app/pkg/square" - "github.com/celestiaorg/celestia-app/x/upgrade" "github.com/cosmos/cosmos-sdk/telemetry" abci "github.com/tendermint/tendermint/abci/types" core "github.com/tendermint/tendermint/proto/tendermint/types" @@ -59,27 +58,6 @@ func (app *App) PrepareProposal(req abci.RequestPrepareProposal) abci.ResponsePr txs = make([][]byte, 0) } else { txs = FilterTxs(app.Logger(), sdkCtx, handler, app.txConfig, req.BlockData.Txs) - - // TODO: this would be improved if we only attempted the upgrade in the first round of the - // height to still allow transactions to pass through without being delayed from trying - // to coordinate the upgrade height - if newVersion, ok := app.UpgradeKeeper.ShouldProposeUpgrade(req.ChainId, req.Height); ok && newVersion > app.GetBaseApp().AppVersion() { - upgradeTx, err := upgrade.NewMsgVersionChange(app.txConfig, newVersion) - if err != nil { - panic(err) - } - // the upgrade transaction must be the first transaction in the block - txs = append([][]byte{upgradeTx}, txs...) - - // because we are adding bytes, we need to check that we are not going over the limit - // if we are, we continually prune the last tx (the lowest paying blobTx). - size := sizeOf(txs) - for size > int(req.BlockDataSize) { - lastTx := txs[len(txs)-1] - txs = txs[:len(txs)-1] - size -= len(lastTx) - } - } } // build the square from the set of valid and prioritised transactions. @@ -124,11 +102,3 @@ func (app *App) PrepareProposal(req abci.RequestPrepareProposal) abci.ResponsePr }, } } - -func sizeOf(txs [][]byte) int { - size := 0 - for _, tx := range txs { - size += len(tx) - } - return size -} diff --git a/app/process_proposal.go b/app/process_proposal.go index 9a09731871..ebbbc85345 100644 --- a/app/process_proposal.go +++ b/app/process_proposal.go @@ -11,7 +11,6 @@ import ( "github.com/celestiaorg/celestia-app/pkg/shares" "github.com/celestiaorg/celestia-app/pkg/square" blobtypes "github.com/celestiaorg/celestia-app/x/blob/types" - "github.com/celestiaorg/celestia-app/x/upgrade" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" abci "github.com/tendermint/tendermint/abci/types" @@ -76,27 +75,6 @@ func (app *App) ProcessProposal(req abci.RequestProcessProposal) (resp abci.Resp return reject() } - if appVersion, ok := upgrade.IsUpgradeMsg(msgs); ok { - if idx != 0 { - logInvalidPropBlock(app.Logger(), req.Header, fmt.Sprintf("upgrade message %d is not the first transaction", idx)) - return reject() - } - - if !IsSupported(appVersion) { - logInvalidPropBlock(app.Logger(), req.Header, fmt.Sprintf("block proposes an unsupported app version %d", appVersion)) - return reject() - } - - // app version must always increase - if appVersion <= app.GetBaseApp().AppVersion() { - logInvalidPropBlock(app.Logger(), req.Header, fmt.Sprintf("block proposes an app version %d that is not greater than the current app version %d", appVersion, app.GetBaseApp().AppVersion())) - return reject() - } - - // we don't need to pass this message through the ante handler - continue - } - // we need to increment the sequence for every transaction so that // the signature check below is accurate. this error only gets hit // if the account in question doens't exist. @@ -159,7 +137,7 @@ func (app *App) ProcessProposal(req abci.RequestProcessProposal) (resp abci.Resp // are identical and that square layout is consistent. This also means that the share commitment rules // have been followed and thus each blobs share commitment should be valid if !bytes.Equal(dah.Hash(), req.Header.DataHash) { - logInvalidPropBlock(app.Logger(), req.Header, "proposed data root differs from calculated data root") + logInvalidPropBlock(app.Logger(), req.Header, fmt.Sprintf("proposed data root %X differs from calculated data root %X", req.Header.DataHash, dah.Hash())) return reject() } diff --git a/cmd/celestia-appd/cmd/download-genesis.go b/cmd/celestia-appd/cmd/download_genesis.go similarity index 89% rename from cmd/celestia-appd/cmd/download-genesis.go rename to cmd/celestia-appd/cmd/download_genesis.go index cc90da8824..138f631468 100644 --- a/cmd/celestia-appd/cmd/download-genesis.go +++ b/cmd/celestia-appd/cmd/download_genesis.go @@ -12,6 +12,9 @@ import ( "github.com/spf13/cobra" ) +// chainIDToSha256 is a map of chainID to the SHA-256 hash of the genesis file for that chain ID. +// To add a new chain-id, download the genesis file from the networks repo and compute the SHA-256 hash. +// Add the chain-id and hash to this map. var chainIDToSha256 = map[string]string{ "celestia": "9727aac9bbfb021ce7fc695a92f901986421283a891b89e0af97bc9fad187793", "mocha-4": "0846b99099271b240b638a94e17a6301423b5e4047f6558df543d6e91db7e575", @@ -75,11 +78,7 @@ func getChainIDOrDefault(args []string) string { // isKnownChainID returns true if the chainID is known. func isKnownChainID(chainID string) bool { - knownChainIDs := []string{ - "arabica-10", // testnet - "mocha-4", // testnet - "celestia", // mainnet - } + knownChainIDs := getKeys(chainIDToSha256) return contains(knownChainIDs, chainID) } @@ -127,3 +126,10 @@ func computeSha256(filepath string) (string, error) { return hex.EncodeToString(hasher.Sum(nil)), nil } + +func getKeys(m map[string]string) (result []string) { + for key := range m { + result = append(result, key) + } + return result +} diff --git a/cmd/celestia-appd/cmd/download_genesis_test.go b/cmd/celestia-appd/cmd/download_genesis_test.go new file mode 100644 index 0000000000..0a2ad493d2 --- /dev/null +++ b/cmd/celestia-appd/cmd/download_genesis_test.go @@ -0,0 +1,27 @@ +package cmd + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func Test_isKnownChainID(t *testing.T) { + type testCase struct { + chainID string + want bool + } + testCases := []testCase{ + {"celestia", true}, + {"mocha-4", true}, + {"arabica-10", true}, + {"foo", false}, + } + + for _, tc := range testCases { + t.Run(tc.chainID, func(t *testing.T) { + got := isKnownChainID(tc.chainID) + assert.Equal(t, tc.want, got) + }) + } +} diff --git a/cmd/celestia-appd/cmd/root.go b/cmd/celestia-appd/cmd/root.go index 12fea2ed71..b0d8c9ab6b 100644 --- a/cmd/celestia-appd/cmd/root.go +++ b/cmd/celestia-appd/cmd/root.go @@ -4,6 +4,7 @@ import ( "io" "os" "path/filepath" + "strconv" bscmd "github.com/celestiaorg/celestia-app/x/blobstream/client" @@ -21,6 +22,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/keys" "github.com/cosmos/cosmos-sdk/client/rpc" + "github.com/cosmos/cosmos-sdk/client/snapshot" "github.com/cosmos/cosmos-sdk/server" serverconfig "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" @@ -44,6 +46,8 @@ const ( // FlagLogToFile specifies whether to log to file or not. FlagLogToFile = "log-to-file" + + UpgradeHeightFlag = "v2-upgrade-height" ) // NewRootCmd creates a new root command for celestia-appd. It is called once in the @@ -149,10 +153,14 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig encoding.Config) { keys.Commands(app.DefaultNodeHome), bscmd.VerifyCmd(), ) + rootCmd.AddCommand( + snapshot.Cmd(NewAppServer), + ) } func addModuleInitFlags(startCmd *cobra.Command) { crisis.AddModuleInitFlags(startCmd) + startCmd.Flags().Int64(UpgradeHeightFlag, 0, "Upgrade height to switch from v1 to v2. Must be coordinated amongst all validators") } func queryCommand() *cobra.Command { @@ -229,11 +237,20 @@ func NewAppServer(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts se panic(err) } + var upgradeHeight int64 + upgradeHeightStr, ok := appOpts.Get(UpgradeHeightFlag).(string) + if ok { + upgradeHeight, err = strconv.ParseInt(upgradeHeightStr, 10, 64) + if err != nil { + panic(err) + } + } + return app.New( logger, db, traceStore, true, cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)), encoding.MakeConfig(app.ModuleEncodingRegisters...), // Ideally, we would reuse the one created by NewRootCmd. - nil, + upgradeHeight, appOpts, baseapp.SetPruning(pruningOpts), baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))), @@ -256,13 +273,13 @@ func createAppAndExport( encCfg.Codec = codec.NewProtoCodec(encCfg.InterfaceRegistry) var capp *app.App if height != -1 { - capp = app.New(logger, db, traceStore, false, uint(1), encCfg, nil, appOpts) + capp = app.New(logger, db, traceStore, false, uint(1), encCfg, 0, appOpts) if err := capp.LoadHeight(height); err != nil { return servertypes.ExportedApp{}, err } } else { - capp = app.New(logger, db, traceStore, true, uint(1), encCfg, nil, appOpts) + capp = app.New(logger, db, traceStore, true, uint(1), encCfg, 0, appOpts) } return capp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList) diff --git a/docker/Dockerfile_txsim b/docker/Dockerfile_txsim index 9126f9d37d..d306eb2341 100644 --- a/docker/Dockerfile_txsim +++ b/docker/Dockerfile_txsim @@ -1,5 +1,5 @@ # Stage 1: generate celestia-appd binary -FROM --platform=$BUILDPLATFORM docker.io/golang:1.21.3-alpine3.18 as builder +FROM --platform=$BUILDPLATFORM docker.io/golang:1.21.4-alpine3.18 as builder ARG TARGETOS ARG TARGETARCH diff --git a/go.mod b/go.mod index a25eceb74e..81c1a340b5 100644 --- a/go.mod +++ b/go.mod @@ -4,11 +4,11 @@ go 1.21.1 require ( github.com/celestiaorg/nmt v0.20.0 - github.com/ethereum/go-ethereum v1.13.4 + github.com/ethereum/go-ethereum v1.13.5 github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.3 github.com/google/uuid v1.3.1 // indirect - github.com/gorilla/mux v1.8.0 + github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/pkg/errors v0.9.1 // indirect github.com/spf13/cast v1.5.0 @@ -25,13 +25,13 @@ require ( require ( cosmossdk.io/errors v1.0.0-beta.7 - cosmossdk.io/math v1.1.2 + cosmossdk.io/math v1.2.0 github.com/celestiaorg/blobstream-contracts/v3 v3.1.0 github.com/celestiaorg/rsmt2d v0.11.0 github.com/cosmos/cosmos-proto v1.0.0-alpha8 github.com/cosmos/cosmos-sdk v0.46.14 github.com/cosmos/gogoproto v1.4.11 - github.com/cosmos/ibc-go/v6 v6.2.0 + github.com/cosmos/ibc-go/v6 v6.2.1 github.com/rs/zerolog v1.31.0 github.com/tendermint/tendermint v0.34.28 golang.org/x/exp v0.0.0-20230905200255-921286631fa9 @@ -45,18 +45,18 @@ require ( github.com/consensys/bavard v0.1.13 // indirect github.com/consensys/gnark-crypto v0.12.1 // indirect github.com/cosmos/ledger-cosmos-go v0.13.2 // indirect - github.com/crate-crypto/go-kzg-4844 v0.3.0 // indirect + github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/emicklei/go-restful/v3 v3.9.0 // indirect - github.com/ethereum/c-kzg-4844 v0.3.1 // indirect + github.com/ethereum/c-kzg-4844 v0.4.0 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect - github.com/go-openapi/jsonreference v0.20.1 // indirect + github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/swag v0.22.3 // indirect - github.com/google/gnostic v0.5.7-v3refs // indirect + github.com/google/gnostic-models v0.6.8 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/s2a-go v0.1.4 // indirect github.com/imdario/mergo v0.3.13 // indirect @@ -84,12 +84,12 @@ require ( golang.org/x/tools v0.13.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231009173412-8bfb1ae86b6c // indirect gopkg.in/inf.v0 v0.9.1 // indirect - k8s.io/api v0.27.3 // indirect - k8s.io/apimachinery v0.27.3 // indirect - k8s.io/client-go v0.27.3 // indirect - k8s.io/klog/v2 v2.90.1 // indirect - k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect - k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect + k8s.io/api v0.28.3 // indirect + k8s.io/apimachinery v0.28.3 // indirect + k8s.io/client-go v0.28.3 // indirect + k8s.io/klog/v2 v2.100.1 // indirect + k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect + k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect rsc.io/tmplfunc v0.0.3 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect @@ -113,7 +113,7 @@ require ( github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.1.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect - github.com/celestiaorg/knuu v0.8.2 + github.com/celestiaorg/knuu v0.10.0 github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash v1.1.0 // indirect @@ -137,7 +137,7 @@ require ( github.com/dgraph-io/badger/v2 v2.2007.4 // indirect github.com/dgraph-io/ristretto v0.1.0 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect - github.com/docker/docker v24.0.5+incompatible // indirect + github.com/docker/docker v24.0.7+incompatible // indirect github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac // indirect github.com/dvsekhvalnov/jose2go v1.5.0 // indirect github.com/felixge/httpsnoop v1.0.1 // indirect diff --git a/go.sum b/go.sum index eb708da896..74b2baa708 100644 --- a/go.sum +++ b/go.sum @@ -193,8 +193,8 @@ cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoIS collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= cosmossdk.io/errors v1.0.0-beta.7/go.mod h1:mz6FQMJRku4bY7aqS/Gwfcmr/ue91roMEKAmDUDpBfE= -cosmossdk.io/math v1.1.2 h1:ORZetZCTyWkI5GlZ6CZS28fMHi83ZYf+A2vVnHNzZBM= -cosmossdk.io/math v1.1.2/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= +cosmossdk.io/math v1.2.0 h1:8gudhTkkD3NxOP2YyyJIYYmt6dQ55ZfJkDOaxXpy7Ig= +cosmossdk.io/math v1.2.0/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU= filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= @@ -324,8 +324,8 @@ github.com/celestiaorg/celestia-core v1.29.0-tm-v0.34.29 h1:Fd7ymPUzExPGNl2gZw4i github.com/celestiaorg/celestia-core v1.29.0-tm-v0.34.29/go.mod h1:xrICN0PBhp3AdTaZ8q4wS5Jvi32V02HNjaC2EsWiEKk= github.com/celestiaorg/cosmos-sdk v1.18.3-sdk-v0.46.14 h1:+Te28r5Zp4Vp69f82kcON9/BIF8f1BNXb0go2+achuc= github.com/celestiaorg/cosmos-sdk v1.18.3-sdk-v0.46.14/go.mod h1:Og5KKgoBEiQlI6u56lDLG191pfknIdXctFn3COWLQP8= -github.com/celestiaorg/knuu v0.8.2 h1:x63nYTO46j293VkNP7VcRHtYHSize6dM/h7xME2Vgi0= -github.com/celestiaorg/knuu v0.8.2/go.mod h1:zBrMXhFl7irCPOVJyHS8sBg7K9Hux5dLy9VChA40LTo= +github.com/celestiaorg/knuu v0.10.0 h1:uYO6hVsoCAJ/Q4eV0Pn8CLbbupGAjD56xQc4y2t4lf0= +github.com/celestiaorg/knuu v0.10.0/go.mod h1:2NjDX29x09hRpaaWaKvi7pw9VjI/SHo+/4HldyEW50g= 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= @@ -418,8 +418,8 @@ github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4 github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= github.com/cosmos/iavl v0.19.6 h1:XY78yEeNPrEYyNCKlqr9chrwoeSDJ0bV2VjocTk//OU= github.com/cosmos/iavl v0.19.6/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= -github.com/cosmos/ibc-go/v6 v6.2.0 h1:HKS5WNxQrlmjowHb73J9LqlNJfvTnvkbhXZ9QzNTU7Q= -github.com/cosmos/ibc-go/v6 v6.2.0/go.mod h1:+S3sxcNwOhgraYDJAhIFDg5ipXHaUnJrg7tOQqGyWlc= +github.com/cosmos/ibc-go/v6 v6.2.1 h1:NiaDXTRhKwf3n9kELD4VRIe5zby1yk1jBvaz9tXTQ6k= +github.com/cosmos/ibc-go/v6 v6.2.1/go.mod h1:XLsARy4Y7+GtAqzMcxNdlQf6lx+ti1e8KcMGv5NIK7A= github.com/cosmos/ledger-cosmos-go v0.13.2 h1:aY0KZSmUwNKbBm9OvbIjvf7Ozz2YzzpAbgvN2C8x2T0= github.com/cosmos/ledger-cosmos-go v0.13.2/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= @@ -427,8 +427,8 @@ github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwc 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.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/crate-crypto/go-kzg-4844 v0.3.0 h1:UBlWE0CgyFqqzTI+IFyCzA7A3Zw4iip6uzRv5NIXG0A= -github.com/crate-crypto/go-kzg-4844 v0.3.0/go.mod h1:SBP7ikXEgDnUPONgm33HtuDZEDtWa3L4QtN1ocJSEQ4= +github.com/crate-crypto/go-kzg-4844 v0.7.0 h1:C0vgZRk4q4EZ/JgPfzuSoxdCq3C3mOZMBShovmncxvA= +github.com/crate-crypto/go-kzg-4844 v0.7.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= github.com/creachadair/taskgroup v0.3.2 h1:zlfutDS+5XG40AOxcHDSThxKzns8Tnr9jnr6VqkYlkM= github.com/creachadair/taskgroup v0.3.2/go.mod h1:wieWwecHVzsidg2CsUnFinW1faVN4+kq+TDlRJQ0Wbk= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= @@ -473,13 +473,12 @@ github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5O 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 v24.0.5+incompatible h1:WmgcE4fxyI6EEXxBRxsHnZXrO1pQ3smi0k/jho4HLeY= -github.com/docker/docker v24.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= +github.com/docker/docker v24.0.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= 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/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/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= @@ -506,11 +505,11 @@ 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/c-kzg-4844 v0.3.1 h1:sR65+68+WdnMKxseNWxSJuAv2tsUrihTpVBTfM/U5Zg= -github.com/ethereum/c-kzg-4844 v0.3.1/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= +github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY= +github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= github.com/ethereum/go-ethereum v1.10.17/go.mod h1:Lt5WzjM07XlXc95YzrhosmR4J9Ahd6X2wyEV2SvGhk0= -github.com/ethereum/go-ethereum v1.13.4 h1:25HJnaWVg3q1O7Z62LaaI6S9wVq8QCw3K88g8wEzrcM= -github.com/ethereum/go-ethereum v1.13.4/go.mod h1:I0U5VewuuTzvBtVzKo7b3hJzDhXOUtn9mJW7SsIPB0Q= +github.com/ethereum/go-ethereum v1.13.5 h1:U6TCRciCqZRe4FPXmy1sMGxTfuk8P7u2UoinF3VbaFk= +github.com/ethereum/go-ethereum v1.13.5/go.mod h1:yMTu38GSuyxaYzQMViqNmQ1s3cE84abZexQmTgenWk0= 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= @@ -575,8 +574,8 @@ github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiU github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= -github.com/go-openapi/jsonreference v0.20.1 h1:FBLnyygC4/IZZr893oiomc9XaghoveYTrLC1F86HID8= -github.com/go-openapi/jsonreference v0.20.1/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= +github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= +github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= @@ -594,8 +593,8 @@ github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= @@ -666,8 +665,8 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= -github.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54= -github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ= +github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= +github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -750,8 +749,9 @@ github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= @@ -909,7 +909,6 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxv github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -1044,14 +1043,14 @@ github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/ginkgo/v2 v2.9.1 h1:zie5Ly042PD3bsCvsSOPvRnFwyo3rKe64TJlD6nu0mk= -github.com/onsi/ginkgo/v2 v2.9.1/go.mod h1:FEcmzVcCHl+4o9bQZVab+4dC9+j+91t2FHSzmGAPfuo= +github.com/onsi/ginkgo/v2 v2.9.4 h1:xR7vG4IXt5RWx6FfIjyAtsoMAtnc3C/rFXBBd2AjZwE= +github.com/onsi/ginkgo/v2 v2.9.4/go.mod h1:gCQYp2Q+kSoIj7ykSVb9nskRSsR6PUj4AiLywzIhbKM= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.27.4 h1:Z2AnStgsdSayCMDiCU42qIz+HLqEPcgiOCXjAU/w+8E= -github.com/onsi/gomega v1.27.4/go.mod h1:riYq/GJKh8hhoM01HN6Vmuy93AarCXCBGpvFDK3q3fQ= +github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE= +github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= @@ -1220,7 +1219,6 @@ github.com/spf13/viper v1.14.0/go.mod h1:WT//axPky3FdvXHzGw33dNdXXXfFQqmEalje+eg 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/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= 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= @@ -1856,7 +1854,6 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -2034,15 +2031,14 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 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.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= -gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= +gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= +gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -2052,18 +2048,18 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= -k8s.io/api v0.27.3 h1:yR6oQXXnUEBWEWcvPWS0jQL575KoAboQPfJAuKNrw5Y= -k8s.io/api v0.27.3/go.mod h1:C4BNvZnQOF7JA/0Xed2S+aUyJSfTGkGFxLXz9MnpIpg= -k8s.io/apimachinery v0.27.3 h1:Ubye8oBufD04l9QnNtW05idcOe9Z3GQN8+7PqmuVcUM= -k8s.io/apimachinery v0.27.3/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= -k8s.io/client-go v0.27.3 h1:7dnEGHZEJld3lYwxvLl7WoehK6lAq7GvgjxpA3nv1E8= -k8s.io/client-go v0.27.3/go.mod h1:2MBEKuTo6V1lbKy3z1euEGnhPfGZLKTS9tiJ2xodM48= -k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw= -k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= -k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f h1:2kWPakN3i/k81b0gvD5C5FJ2kxm1WrQFanWchyKuqGg= -k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f/go.mod h1:byini6yhqGC14c3ebc/QwanvYwhuMWF6yz2F8uwW8eg= -k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY= -k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/api v0.28.3 h1:Gj1HtbSdB4P08C8rs9AR94MfSGpRhJgsS+GF9V26xMM= +k8s.io/api v0.28.3/go.mod h1:MRCV/jr1dW87/qJnZ57U5Pak65LGmQVkKTzf3AtKFHc= +k8s.io/apimachinery v0.28.3 h1:B1wYx8txOaCQG0HmYF6nbpU8dg6HvA06x5tEffvOe7A= +k8s.io/apimachinery v0.28.3/go.mod h1:uQTKmIqs+rAYaq+DFaoD2X7pcjLOqbQX2AOiO0nIpb8= +k8s.io/client-go v0.28.3 h1:2OqNb72ZuTZPKCl+4gTKvqao0AMOl9f3o2ijbAj3LI4= +k8s.io/client-go v0.28.3/go.mod h1:LTykbBp9gsA7SwqirlCXBWtK0guzfhpoW4qSm7i9dxo= +k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg= +k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 h1:LyMgNKD2P8Wn1iAwQU5OhxCKlKJy0sHc+PcDwFB24dQ= +k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9/go.mod h1:wZK2AVp1uHCp4VamDVgBP2COHZjqD1T68Rf0CM3YjSM= +k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 h1:qY1Ad8PODbnymg2pRbkyMT/ylpTrCM8P2RJ0yroCyIk= +k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= pgregory.net/rapid v0.5.3 h1:163N50IHFqr1phZens4FQOdPgfJscR7a562mjQqeo4M= diff --git a/scripts/protocgen.sh b/scripts/protocgen.sh index 670da62783..c2fc4e0253 100755 --- a/scripts/protocgen.sh +++ b/scripts/protocgen.sh @@ -23,11 +23,6 @@ done cd .. -# temporary import hack to use cosmos-sdk implementation of Any type. -# check https://github.com/celestiaorg/celestia-app/issues/507 for more information. -sed -i 's/types "github.com\/celestiaorg\/celestia-app\/codec\/types"/types "github.com\/cosmos\/cosmos-sdk\/codec\/types"/g' \ - github.com/celestiaorg/celestia-app/x/blobstream/types/query.pb.go - # move proto files to the right places cp -r github.com/celestiaorg/celestia-app/* ./ rm -rf github.com diff --git a/specs/src/specs/params.md b/specs/src/specs/params.md index c1d9e27c34..2b992e4eff 100644 --- a/specs/src/specs/params.md +++ b/specs/src/specs/params.md @@ -7,53 +7,60 @@ are blocked by the `x/paramfilter` module. ## Parameters -| Module.Parameter | Default | Summary | Changeable via Governance | -| --- | --- | --- | --- | -| auth.MaxMemoCharacters | 256 | Largest allowed size for a memo in bytes. | True | -| auth.TxSigLimit | 7 | Max number of signatures allowed in a multisig transaction. | True | -| auth.TxSizeCostPerByte | 10 | Gas used per transaction byte. | True | -| auth.SigVerifyCostED25519 | 590 | Gas used to verify Ed25519 signature. | True | -| auth.SigVerifyCostSecp256k1 | 1000 | Gas used to verify secp256k1 signature. | True | -| bank.SendEnabled | true | Allow transfers. | False | -| blob.GasPerBlobByte | 8 | Gas used per blob byte. | True | -| MaxBlockBytes | 100MiB | Hardcoded value in CometBFT for the protobuf encoded block. | False | -| MaxSquareSize | 128 | Hardcoded maximum square size determined per shares per row or column for the original data square (not yet extended). | False | -| blob.GovMaxSquareSize | 64 | Governance parameter for the maximum square size determined per shares per row or column for the original data square (not yet extended)s. If larger than MaxSquareSize, MaxSquareSize is used. | True | -| consensus.block.MaxBytes | 1.88MiB | Governance parameter for the maximum size of the protobuf encoded block. | True | -| consensus.block.MaxGas | -1 | Maximum gas allowed per block (-1 is infinite). | True | -| consensus.block.TimeIotaMs | 1000 | Minimum time added to the time in the header each block. | False | -| consensus.evidence.MaxAgeNumBlocks | 120960 | The maximum number of blocks before evidence is considered invalid. This value will stop CometBFT from pruning block data. | True | -| consensus.evidence.MaxAgeDuration | 1814400000000000 (21 days) | The maximum age of evidence before it is considered invalid in nanoseconds. This value should be identical to the unbonding period. | True | -| consensus.evidence.MaxBytes | 1MiB | Maximum size in bytes used by evidence in a given block. | True | -| consensus.validator.PubKeyTypes | Ed25519 | The type of public key used by validators. | False | -| consensus.Version.AppVersion | 1 | Determines protocol rules used for a given height. Incremented by the application upon an upgrade. | False | -| distribution.CommunityTax | 0.02 (2%) | Percentage of the inflation sent to the community pool. | True | -| distribution.WithdrawAddrEnabled | true | Enables delegators to withdraw funds to a different address. | True | -| distribution.BaseProposerReward | 0 | Reward in the mint denomination for proposing a block. | True | -| distribution.BonusProposerReward | 0 | Extra reward in the mint denomination for proposers based on the voting power included in the commit. | True | -| gov.DepositParams.MinDeposit | 10_000_000_000 utia (10,000 TIA) | Minimum deposit for a proposal to enter voting period. | True | -| gov.DepositParams.MaxDepositPeriod | 604800000000000 (1 week) | Maximum period for token holders to deposit on a proposal in nanoseconds. | True | -| gov.VotingParams.VotingPeriod | 604800000000000 (1 week) | Duration of the voting period in nanoseconds. | True | -| gov.TallyParams.Quorum | 0.334 (33.4%) | Minimum percentage of total stake needed to vote for a result to be considered valid. | True | -| gov.TallyParams.Threshold | 0.50 (50%) | Minimum proportion of Yes votes for proposal to pass. | True | -| gov.TallyParams.VetoThreshold | 0.334 (33.4%) | Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. | True | -| ibc.ClientGenesis.AllowedClients | []string{"06-solomachine", "07-tendermint"} | List of allowed IBC light clients. | True | -| ibc.ConnectionGenesis.MaxExpectedTimePerBlock | 7500000000000 (75 seconds) | Maximum expected time per block in nanoseconds under normal operation. | True | -| ibc.Transfer.SendEnabled | true | Enable sending tokens via IBC. | True | -| ibc.Transfer.ReceiveEnabled | true | Enable receiving tokens via IBC. | True | -| slashing.SignedBlocksWindow | 5000 | The range of blocks used to count for downtime. | True | -| slashing.MinSignedPerWindow | 0.75 (75%) | The percentage of SignedBlocksWindow that must be signed not to get jailed. | True | -| slashing.DowntimeJailDuration | 1 min | Duration of time a validator must stay jailed. | True | -| slashing.SlashFractionDoubleSign | 0.02 (2%) | Percentage slashed after a validator is jailed for double signing. | True | -| slashing.SlashFractionDowntime | 0.00 (0%) | Percentage slashed after a validator is jailed for downtime. | True | -| staking.UnbondingTime | 1814400 (21 days) | Duration of time for unbonding in seconds. | False | -| staking.MaxValidators | 100 | Maximum number of validators. | False | -| staking.MaxEntries | 7 | Maximum number of entries in the redelegation queue. | True | -| staking.HistoricalEntries | 10000 | Number of historical entries to persist in store. | True | -| staking.BondDenom | utia | Bondable coin denomination. | False | -| staking.MinCommissionRate | 0.05 (5%) | Minimum commission rate used by all validators. | True | -| mint.BondDenom | utia | Denomination that is inflated and sent to the distribution module account. | False | -| mint.InitialInflationRate | 0.08 (8%) | The inflation rate the network starts at. | False | -| mint.DisinflationRate | 0.10 (10%) | The rate at which the inflation rate decreases each year. | False | -| mint.TargetInflationRate | 0.015 (1.5%) | The inflation rate that the network aims to stabalize at. | False | -| blobstream.DataCommitmentWindow | 400 | Number of blocks that are included in a signed batch (DataCommitment). | True | +### Global parameters + +| Parameter | Default | Summary | Changeable via Governance | +|---------------|---------|------------------------------------------------------------------------------------------------------------------------|---------------------------| +| MaxBlockBytes | 100MiB | Hardcoded value in CometBFT for the protobuf encoded block. | False | +| MaxSquareSize | 128 | Hardcoded maximum square size determined per shares per row or column for the original data square (not yet extended). | False | + +### Module parameters + +| Module.Parameter | Default | Summary | Changeable via Governance | +|-----------------------------------------------|---------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------| +| auth.MaxMemoCharacters | 256 | Largest allowed size for a memo in bytes. | True | +| auth.SigVerifyCostED25519 | 590 | Gas used to verify Ed25519 signature. | True | +| auth.SigVerifyCostSecp256k1 | 1000 | Gas used to verify secp256k1 signature. | True | +| auth.TxSigLimit | 7 | Max number of signatures allowed in a multisig transaction. | True | +| auth.TxSizeCostPerByte | 10 | Gas used per transaction byte. | True | +| bank.SendEnabled | true | Allow transfers. | False | +| blob.GasPerBlobByte | 8 | Gas used per blob byte. | True | +| blob.GovMaxSquareSize | 64 | Governance parameter for the maximum square size determined per shares per row or column for the original data square (not yet extended)s. If larger than MaxSquareSize, MaxSquareSize is used. | True | +| blobstream.DataCommitmentWindow | 400 | Number of blocks that are included in a signed batch (DataCommitment). | True | +| consensus.block.MaxBytes | 1.88MiB | Governance parameter for the maximum size of the protobuf encoded block. | True | +| consensus.block.MaxGas | -1 | Maximum gas allowed per block (-1 is infinite). | True | +| consensus.block.TimeIotaMs | 1000 | Minimum time added to the time in the header each block. | False | +| consensus.evidence.MaxAgeDuration | 1814400000000000 (21 days) | The maximum age of evidence before it is considered invalid in nanoseconds. This value should be identical to the unbonding period. | True | +| consensus.evidence.MaxAgeNumBlocks | 120960 | The maximum number of blocks before evidence is considered invalid. This value will stop CometBFT from pruning block data. | True | +| consensus.evidence.MaxBytes | 1MiB | Maximum size in bytes used by evidence in a given block. | True | +| consensus.validator.PubKeyTypes | Ed25519 | The type of public key used by validators. | False | +| consensus.Version.AppVersion | 1 | Determines protocol rules used for a given height. Incremented by the application upon an upgrade. | False | +| distribution.BaseProposerReward | 0 | Reward in the mint denomination for proposing a block. | True | +| distribution.BonusProposerReward | 0 | Extra reward in the mint denomination for proposers based on the voting power included in the commit. | True | +| distribution.CommunityTax | 0.02 (2%) | Percentage of the inflation sent to the community pool. | True | +| distribution.WithdrawAddrEnabled | true | Enables delegators to withdraw funds to a different address. | True | +| gov.DepositParams.MaxDepositPeriod | 604800000000000 (1 week) | Maximum period for token holders to deposit on a proposal in nanoseconds. | True | +| gov.DepositParams.MinDeposit | 10_000_000_000 utia (10,000 TIA) | Minimum deposit for a proposal to enter voting period. | True | +| gov.TallyParams.Quorum | 0.334 (33.4%) | Minimum percentage of total stake needed to vote for a result to be considered valid. | True | +| gov.TallyParams.Threshold | 0.50 (50%) | Minimum proportion of Yes votes for proposal to pass. | True | +| gov.TallyParams.VetoThreshold | 0.334 (33.4%) | Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. | True | +| gov.VotingParams.VotingPeriod | 604800000000000 (1 week) | Duration of the voting period in nanoseconds. | True | +| ibc.ClientGenesis.AllowedClients | []string{"06-solomachine", "07-tendermint"} | List of allowed IBC light clients. | True | +| ibc.ConnectionGenesis.MaxExpectedTimePerBlock | 7500000000000 (75 seconds) | Maximum expected time per block in nanoseconds under normal operation. | True | +| ibc.Transfer.ReceiveEnabled | true | Enable receiving tokens via IBC. | True | +| ibc.Transfer.SendEnabled | true | Enable sending tokens via IBC. | True | +| mint.BondDenom | utia | Denomination that is inflated and sent to the distribution module account. | False | +| mint.DisinflationRate | 0.10 (10%) | The rate at which the inflation rate decreases each year. | False | +| mint.InitialInflationRate | 0.08 (8%) | The inflation rate the network starts at. | False | +| mint.TargetInflationRate | 0.015 (1.5%) | The inflation rate that the network aims to stabalize at. | False | +| slashing.DowntimeJailDuration | 1 min | Duration of time a validator must stay jailed. | True | +| slashing.MinSignedPerWindow | 0.75 (75%) | The percentage of SignedBlocksWindow that must be signed not to get jailed. | True | +| slashing.SignedBlocksWindow | 5000 | The range of blocks used to count for downtime. | True | +| slashing.SlashFractionDoubleSign | 0.02 (2%) | Percentage slashed after a validator is jailed for double signing. | True | +| slashing.SlashFractionDowntime | 0.00 (0%) | Percentage slashed after a validator is jailed for downtime. | True | +| staking.BondDenom | utia | Bondable coin denomination. | False | +| staking.HistoricalEntries | 10000 | Number of historical entries to persist in store. | True | +| staking.MaxEntries | 7 | Maximum number of entries in the redelegation queue. | True | +| staking.MaxValidators | 100 | Maximum number of validators. | False | +| staking.MinCommissionRate | 0.05 (5%) | Minimum commission rate used by all validators. | True | +| staking.UnbondingTime | 1814400 (21 days) | Duration of time for unbonding in seconds. | False | diff --git a/test/e2e/node.go b/test/e2e/node.go index 57bd165d6e..c73c45dcb7 100644 --- a/test/e2e/node.go +++ b/test/e2e/node.go @@ -50,7 +50,7 @@ func NewNode( if err != nil { return nil, err } - err = instance.SetImage(fmt.Sprintf("%s:%s", dockerSrcURL, version)) + err = instance.SetImage(DockerImageName(version)) if err != nil { return nil, err } @@ -260,3 +260,11 @@ func (n *Node) Start() error { n.grpcProxyPort = grpcProxyPort return nil } + +func (n *Node) Upgrade(version string) error { + return n.Instance.SetImageInstant(DockerImageName(version)) +} + +func DockerImageName(version string) string { + return fmt.Sprintf("%s:%s", dockerSrcURL, version) +} diff --git a/test/e2e/simple_test.go b/test/e2e/simple_test.go index dc668ad3b9..0843e1e1ba 100644 --- a/test/e2e/simple_test.go +++ b/test/e2e/simple_test.go @@ -22,13 +22,18 @@ var latestVersion = "latest" // and MsgSends over 30 seconds and then asserts that at least 10 transactions were // committed. func TestE2ESimple(t *testing.T) { - if os.Getenv("E2E") == "" { + if os.Getenv("E2E") != "true" { t.Skip("skipping e2e test") } - if os.Getenv("E2E_VERSION") != "" { - latestVersion = os.Getenv("E2E_VERSION") + if os.Getenv("E2E_VERSIONS") != "" { + versionsStr := os.Getenv("E2E_VERSIONS") + versions := ParseVersions(versionsStr) + if len(versions) > 0 { + latestVersion = versions.GetLatest().String() + } } + t.Log("Running simple e2e test", "version", latestVersion) testnet, err := New(t.Name(), seed) require.NoError(t, err) @@ -47,7 +52,7 @@ func TestE2ESimple(t *testing.T) { encCfg := encoding.MakeConfig(app.ModuleEncodingRegisters...) ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() - opts := txsim.DefaultOptions().WithSeed(seed) + opts := txsim.DefaultOptions().WithSeed(seed).SuppressLogs() err = txsim.Run(ctx, testnet.GRPCEndpoints()[0], kr, encCfg, opts, sequences...) require.True(t, errors.Is(err, context.DeadlineExceeded), err.Error()) diff --git a/test/e2e/upgrade_test.go b/test/e2e/upgrade_test.go new file mode 100644 index 0000000000..ebbc7d3c1f --- /dev/null +++ b/test/e2e/upgrade_test.go @@ -0,0 +1,160 @@ +package e2e + +import ( + "context" + "errors" + "fmt" + "math/rand" + "os" + "testing" + "time" + + "github.com/celestiaorg/celestia-app/app" + "github.com/celestiaorg/celestia-app/app/encoding" + "github.com/celestiaorg/celestia-app/test/txsim" + "github.com/celestiaorg/knuu/pkg/knuu" + "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/rpc/client/http" +) + +// This will only run tests within the v1 major release cycle +const MajorVersion = 1 + +func TestMinorVersionCompatibility(t *testing.T) { + if os.Getenv("E2E") != "true" { + t.Skip("skipping e2e test") + } + + if os.Getenv("E2E_VERSIONS") == "" { + t.Skip("skipping e2e test: E2E_VERSIONS not set") + } + + versionStr := os.Getenv("E2E_VERSIONS") + versions := ParseVersions(versionStr).FilterMajor(MajorVersion).FilterOutReleaseCandidates() + if len(versions) == 0 { + t.Skip("skipping e2e test: no versions to test") + } + numNodes := 4 + r := rand.New(rand.NewSource(seed)) + t.Log("Running minor version compatibility test", "versions", versions) + + testnet, err := New(t.Name(), seed) + require.NoError(t, err) + t.Cleanup(testnet.Cleanup) + + // preload all docker images + preloader, err := knuu.NewPreloader() + require.NoError(t, err) + t.Cleanup(func() { _ = preloader.EmptyImages() }) + for _, v := range versions { + err := preloader.AddImage(DockerImageName(v.String())) + require.NoError(t, err) + } + + for i := 0; i < numNodes; i++ { + // each node begins with a random version within the same major version set + v := versions.Random(r).String() + t.Log("Starting node", "node", i, "version", v) + require.NoError(t, testnet.CreateGenesisNode(v, 10000000)) + } + + kr, err := testnet.CreateAccount("alice", 1e12) + require.NoError(t, err) + + require.NoError(t, testnet.Setup()) + require.NoError(t, testnet.Start()) + + sequences := txsim.NewBlobSequence(txsim.NewRange(200, 4000), txsim.NewRange(1, 3)).Clone(5) + sequences = append(sequences, txsim.NewSendSequence(4, 1000, 100).Clone(5)...) + + errCh := make(chan error) + encCfg := encoding.MakeConfig(app.ModuleEncodingRegisters...) + opts := txsim.DefaultOptions().WithSeed(seed).SuppressLogs() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + go func() { + errCh <- txsim.Run(ctx, testnet.GRPCEndpoints()[0], kr, encCfg, opts, sequences...) + }() + + for i := 0; i < len(versions)*2; i++ { + // FIXME: skip the first node because we need them available to + // submit txs + if i%numNodes == 0 { + continue + } + client, err := testnet.Node(i % numNodes).Client() + require.NoError(t, err) + heightBefore, err := getHeight(ctx, client, time.Second) + require.NoError(t, err) + newVersion := versions.Random(r).String() + t.Log("Upgrading node", "node", i%numNodes, "version", newVersion) + err = testnet.Node(i % numNodes).Upgrade(newVersion) + require.NoError(t, err) + // wait for the node to reach two more heights + err = waitForHeight(ctx, client, heightBefore+2, 30*time.Second) + require.NoError(t, err) + } + + heights := make([]int64, 4) + for i := 0; i < numNodes; i++ { + client, err := testnet.Node(i).Client() + require.NoError(t, err) + heights[i], err = getHeight(ctx, client, time.Second) + require.NoError(t, err) + } + + t.Log("checking that all nodes are at the same height") + const maxPermissableDiff = 2 + for i := 0; i < len(heights); i++ { + for j := i + 1; j < len(heights); j++ { + diff := heights[i] - heights[j] + if diff > maxPermissableDiff { + t.Fatalf("node %d is behind node %d by %d blocks", j, i, diff) + } + } + } + + // end the tx sim + cancel() + + err = <-errCh + require.True(t, errors.Is(err, context.Canceled), err.Error()) +} + +func getHeight(ctx context.Context, client *http.HTTP, period time.Duration) (int64, error) { + timer := time.NewTimer(period) + ticker := time.NewTicker(100 * time.Millisecond) + for { + select { + case <-timer.C: + return 0, fmt.Errorf("failed to get height after %.2f seconds", period.Seconds()) + case <-ticker.C: + status, err := client.Status(ctx) + if err == nil { + return status.SyncInfo.LatestBlockHeight, nil + } + if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) { + return 0, err + } + } + } +} + +func waitForHeight(ctx context.Context, client *http.HTTP, height int64, period time.Duration) error { + timer := time.NewTimer(period) + ticker := time.NewTicker(100 * time.Millisecond) + for { + select { + case <-timer.C: + return fmt.Errorf("failed to reach height %d in %.2f seconds", height, period.Seconds()) + case <-ticker.C: + status, err := client.Status(ctx) + if err != nil { + return err + } + if status.SyncInfo.LatestBlockHeight >= height { + return nil + } + } + } +} diff --git a/test/e2e/versions.go b/test/e2e/versions.go new file mode 100644 index 0000000000..4d3329a2c8 --- /dev/null +++ b/test/e2e/versions.go @@ -0,0 +1,116 @@ +package e2e + +import ( + "fmt" + "math/rand" + "sort" + "strings" +) + +type Version struct { + Major uint64 + Minor uint64 + Patch uint64 + IsRC bool + RC uint64 +} + +func (v Version) String() string { + if v.IsRC { + return fmt.Sprintf("v%d.%d.%d-rc%d", v.Major, v.Minor, v.Patch, v.RC) + } + return fmt.Sprintf("v%d.%d.%d", v.Major, v.Minor, v.Patch) +} + +func (v Version) IsGreater(v2 Version) bool { + if v.Major != v2.Major { + return v.Major > v2.Major + } + if v.Minor != v2.Minor { + return v.Minor > v2.Minor + } + if v.Patch != v2.Patch { + return v.Patch > v2.Patch + } + if v.IsRC != v2.IsRC { + return !v.IsRC + } + return v.RC > v2.RC +} + +type VersionSet []Version + +func ParseVersions(versionStr string) VersionSet { + versions := strings.Split(versionStr, " ") + output := make(VersionSet, 0, len(versions)) + for _, v := range versions { + var major, minor, patch, rc uint64 + isRC := false + if strings.Contains(v, "rc") { + _, err := fmt.Sscanf(v, "v%d.%d.%d-rc%d", &major, &minor, &patch, &rc) + isRC = true + if err != nil { + continue + } + } else { + _, err := fmt.Sscanf(v, "v%d.%d.%d", &major, &minor, &patch) + if err != nil { + continue + } + } + output = append(output, Version{major, minor, patch, isRC, rc}) + } + return output +} + +func (v VersionSet) FilterMajor(majorVersion uint64) VersionSet { + output := make(VersionSet, 0, len(v)) + for _, version := range v { + if version.Major == majorVersion { + output = append(output, version) + } + } + return output +} + +func (v VersionSet) FilterOutReleaseCandidates() VersionSet { + output := make(VersionSet, 0, len(v)) + for _, version := range v { + if version.IsRC { + continue + } + output = append(output, version) + } + return output +} + +func (v VersionSet) GetLatest() Version { + latest := Version{} + for _, version := range v { + if version.IsGreater(latest) { + latest = version + } + } + return latest +} + +func (v VersionSet) Order() { + sort.Slice(v, func(i, j int) bool { + return v[j].IsGreater(v[i]) + }) +} + +func (v VersionSet) Random(r *rand.Rand) Version { + if len(v) == 0 { + panic("there are no versions to pick from") + } + return v[r.Intn(len(v))] +} + +func (v VersionSet) String() string { + output := make([]string, len(v)) + for i, version := range v { + output[i] = version.String() + } + return strings.Join(output, "\t") +} diff --git a/test/e2e/versions_test.go b/test/e2e/versions_test.go new file mode 100644 index 0000000000..41d87efe77 --- /dev/null +++ b/test/e2e/versions_test.go @@ -0,0 +1,49 @@ +package e2e_test + +import ( + "testing" + + "github.com/celestiaorg/celestia-app/test/e2e" + "github.com/stretchr/testify/require" +) + +func TestVersionParsing(t *testing.T) { + versionStr := "v1.3.0 v1.1.0 v1.2.0-rc0" + versions := e2e.ParseVersions(versionStr) + require.Len(t, versions, 3) + require.Len(t, versions.FilterOutReleaseCandidates(), 2) + require.Equal(t, versions.GetLatest(), e2e.Version{1, 3, 0, false, 0}) +} + +// Test case with multiple major versions and filtering out a single major version +func TestFilterMajorVersions(t *testing.T) { + versionStr := "v2.0.0 v1.1.0 v2.1.0-rc0 v1.2.0 v2.2.0 v1.3.0" + versions := e2e.ParseVersions(versionStr) + require.Len(t, versions, 6) + require.Len(t, versions.FilterMajor(1), 3) +} + +// Test case to check the Order function +func TestOrder(t *testing.T) { + versionStr := "v1.3.0 v1.1.0 v1.2.0-rc0 v1.4.0 v1.2.1 v2.0.0" + versions := e2e.ParseVersions(versionStr) + versions.Order() + require.Equal(t, versions[0], e2e.Version{1, 1, 0, false, 0}) + require.Equal(t, versions[1], e2e.Version{1, 2, 0, true, 0}) + require.Equal(t, versions[2], e2e.Version{1, 2, 1, false, 0}) + require.Equal(t, versions[3], e2e.Version{1, 3, 0, false, 0}) + require.Equal(t, versions[4], e2e.Version{1, 4, 0, false, 0}) + require.Equal(t, versions[5], e2e.Version{2, 0, 0, false, 0}) + for i := len(versions) - 1; i > 0; i-- { + require.True(t, versions[i].IsGreater(versions[i-1])) + } +} + +func TestOrderOfReleaseCandidates(t *testing.T) { + versionsStr := "v1.0.0 v1.0.0-rc0 v1.0.0-rc1" + versions := e2e.ParseVersions(versionsStr) + versions.Order() + require.Equal(t, versions[0], e2e.Version{1, 0, 0, true, 0}) + require.Equal(t, versions[1], e2e.Version{1, 0, 0, true, 1}) + require.Equal(t, versions[2], e2e.Version{1, 0, 0, false, 0}) +} diff --git a/test/tokenfilter/setup.go b/test/tokenfilter/setup.go index 454ea97e93..54e6706cef 100644 --- a/test/tokenfilter/setup.go +++ b/test/tokenfilter/setup.go @@ -140,7 +140,7 @@ func SetupWithGenesisValSet(t testing.TB, valSet *tmtypes.ValidatorSet, genAccs encCdc := encoding.MakeConfig(app.ModuleEncodingRegisters...) genesisState := app.NewDefaultGenesisState(encCdc.Codec) app := app.New( - log.NewNopLogger(), db, nil, true, 5, encCdc, nil, simapp.EmptyAppOptions{}, + log.NewNopLogger(), db, nil, true, 5, encCdc, 0, simapp.EmptyAppOptions{}, ) // set genesis accounts diff --git a/test/txsim/run.go b/test/txsim/run.go index d25f471f0d..c20bad99f0 100644 --- a/test/txsim/run.go +++ b/test/txsim/run.go @@ -101,10 +101,17 @@ func Run( log.Info().Err(err).Msg("sequence terminated") continue } + if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) { + continue + } log.Error().Err(err).Msg("sequence failed") finalErr = err } + if ctx.Err() != nil { + return ctx.Err() + } + return finalErr } diff --git a/test/util/malicious/app.go b/test/util/malicious/app.go index 20e813748c..09d610dcca 100644 --- a/test/util/malicious/app.go +++ b/test/util/malicious/app.go @@ -57,7 +57,7 @@ func New( appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), ) *App { - goodApp := app.New(logger, db, traceStore, loadLatest, invCheckPeriod, encodingConfig, nil, appOpts, baseAppOptions...) + goodApp := app.New(logger, db, traceStore, loadLatest, invCheckPeriod, encodingConfig, 0, appOpts, baseAppOptions...) badApp := &App{App: goodApp} // set the malicious prepare proposal handler if it is set in the app options diff --git a/test/util/network/network.go b/test/util/network/network.go index fc130e7d23..8149c55141 100644 --- a/test/util/network/network.go +++ b/test/util/network/network.go @@ -77,7 +77,7 @@ func DefaultConfig() network.Config { AppConstructor: func(val network.Validator) servertypes.Application { return app.New( val.Ctx.Logger, tmdb.NewMemDB(), nil, true, 0, - encCfg, nil, + encCfg, 0, simapp.EmptyAppOptions{}, baseapp.SetPruning(pruningtypes.NewPruningOptionsFromString(val.AppConfig.Pruning)), baseapp.SetMinGasPrices(val.AppConfig.MinGasPrices), diff --git a/test/util/test_app.go b/test/util/test_app.go index f13ace9243..56e805fd67 100644 --- a/test/util/test_app.go +++ b/test/util/test_app.go @@ -62,7 +62,7 @@ func SetupTestAppWithGenesisValSet(cparams *tmproto.ConsensusParams, genAccounts log.NewNopLogger(), db, nil, true, cast.ToUint(emptyOpts.Get(server.FlagInvCheckPeriod)), encCfg, - nil, + 0, emptyOpts, ) diff --git a/x/blob/keeper/keeper.go b/x/blob/keeper/keeper.go index 34ad7f5e01..5111bd70ae 100644 --- a/x/blob/keeper/keeper.go +++ b/x/blob/keeper/keeper.go @@ -54,7 +54,7 @@ func (k Keeper) PayForBlobs(goCtx context.Context, msg *types.MsgPayForBlobs) (* ctx.GasMeter().ConsumeGas(gasToConsume, payForBlobGasDescriptor) err := ctx.EventManager().EmitTypedEvent( - types.NewPayForBlobsEvent(sdk.AccAddress(msg.Signer).String(), msg.BlobSizes, msg.Namespaces), + types.NewPayForBlobsEvent(msg.Signer, msg.BlobSizes, msg.Namespaces), ) if err != nil { return &types.MsgPayForBlobsResponse{}, err diff --git a/x/blob/keeper/keeper_test.go b/x/blob/keeper/keeper_test.go new file mode 100644 index 0000000000..44dcc4a0cb --- /dev/null +++ b/x/blob/keeper/keeper_test.go @@ -0,0 +1,64 @@ +package keeper + +import ( + "bytes" + "fmt" + "testing" + + "github.com/celestiaorg/celestia-app/pkg/appconsts" + "github.com/celestiaorg/celestia-app/pkg/blob" + appns "github.com/celestiaorg/celestia-app/pkg/namespace" + "github.com/celestiaorg/celestia-app/x/blob/types" + sdk "github.com/cosmos/cosmos-sdk/types" + proto "github.com/gogo/protobuf/proto" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" +) + +// TestPayForBlobs verifies the attributes on the emitted event. +func TestPayForBlobs(t *testing.T) { + k, stateStore := keeper(t) + ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, nil) + signer := "celestia15drmhzw5kwgenvemy30rqqqgq52axf5wwrruf7" + namespace := appns.MustNewV0(bytes.Repeat([]byte{1}, appns.NamespaceVersionZeroIDSize)) + namespaces := [][]byte{namespace.Bytes()} + blobData := []byte("blob") + blobSizes := []uint32{uint32(len(blobData))} + + // verify no events exist yet + events := ctx.EventManager().Events().ToABCIEvents() + assert.Len(t, events, 0) + + // emit an event by submitting a PayForBlob + msg := createMsgPayForBlob(t, signer, namespace, blobData) + _, err := k.PayForBlobs(ctx, msg) + require.NoError(t, err) + + // verify that an event was emitted + events = ctx.EventManager().Events().ToABCIEvents() + assert.Len(t, events, 1) + protoEvent, err := sdk.ParseTypedEvent(events[0]) + require.NoError(t, err) + event, err := convertToEventPayForBlobs(protoEvent) + require.NoError(t, err) + + // verify the attributes of the event + assert.Equal(t, signer, event.Signer) + assert.Equal(t, namespaces, event.Namespaces) + assert.Equal(t, blobSizes, event.BlobSizes) +} + +func convertToEventPayForBlobs(message proto.Message) (*types.EventPayForBlobs, error) { + if event, ok := message.(*types.EventPayForBlobs); ok { + return event, nil + } + return nil, fmt.Errorf("message is not of type EventPayForBlobs") +} + +func createMsgPayForBlob(t *testing.T, signer string, namespace appns.Namespace, blobData []byte) *types.MsgPayForBlobs { + blob := blob.New(namespace, blobData, appconsts.ShareVersionZero) + msg, err := types.NewMsgPayForBlobs(signer, blob) + require.NoError(t, err) + return msg +} diff --git a/x/blob/module.go b/x/blob/module.go index 74f1c06bf0..eaa8612894 100644 --- a/x/blob/module.go +++ b/x/blob/module.go @@ -1,6 +1,7 @@ package blob import ( + "context" "encoding/json" "fmt" @@ -75,7 +76,10 @@ func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) { } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *runtime.ServeMux) { +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } } // GetTxCmd returns the capability module's root tx command. diff --git a/x/blobstream/abci.go b/x/blobstream/abci.go index d6007de586..c69d130f55 100644 --- a/x/blobstream/abci.go +++ b/x/blobstream/abci.go @@ -143,23 +143,16 @@ func pruneAttestations(ctx sdk.Context, k keeper.Keeper) { if !k.CheckLatestAttestationNonce(ctx) { return } - earliestAttestation, found, err := k.GetAttestationByNonce(ctx, k.GetEarliestAvailableAttestationNonce(ctx)) - if err != nil { - ctx.Logger().Error("error getting earliest attestation for pruning", "err", err.Error()) - return - } - if !found { + if !k.CheckEarliestAvailableAttestationNonce(ctx) { ctx.Logger().Error("couldn't find earliest attestation for pruning") return } - if earliestAttestation == nil { - ctx.Logger().Error("nil earliest attestation") - return - } + currentBlockTime := ctx.BlockTime() latestAttestationNonce := k.GetLatestAttestationNonce(ctx) + earliestNonce := k.GetEarliestAvailableAttestationNonce(ctx) var newEarliestAvailableNonce uint64 - for newEarliestAvailableNonce = earliestAttestation.GetNonce(); newEarliestAvailableNonce < latestAttestationNonce; newEarliestAvailableNonce++ { + for newEarliestAvailableNonce = earliestNonce; newEarliestAvailableNonce < latestAttestationNonce; newEarliestAvailableNonce++ { newEarliestAttestation, found, err := k.GetAttestationByNonce(ctx, newEarliestAvailableNonce) if err != nil { ctx.Logger().Error("error getting attestation for pruning", "nonce", newEarliestAvailableNonce, "err", err.Error()) @@ -181,13 +174,13 @@ func pruneAttestations(ctx sdk.Context, k keeper.Keeper) { } k.DeleteAttestation(ctx, newEarliestAvailableNonce) } - if newEarliestAvailableNonce > earliestAttestation.GetNonce() { + if newEarliestAvailableNonce > earliestNonce { // some attestations were pruned and we need to update the state for it k.SetEarliestAvailableAttestationNonce(ctx, newEarliestAvailableNonce) ctx.Logger().Debug( "pruned attestations from Blobstream store", "count", - newEarliestAvailableNonce-earliestAttestation.GetNonce(), + newEarliestAvailableNonce-earliestNonce, "new_earliest_available_nonce", newEarliestAvailableNonce, "latest_attestation_nonce", diff --git a/x/blobstream/module.go b/x/blobstream/module.go index 0a18fc8ede..481697b4fd 100644 --- a/x/blobstream/module.go +++ b/x/blobstream/module.go @@ -1,6 +1,7 @@ package blobstream import ( + "context" "encoding/json" "fmt" @@ -76,7 +77,10 @@ func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) { } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *runtime.ServeMux) { +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } } // GetTxCmd returns the capability module's root tx command. diff --git a/x/blobstream/types/validator.go b/x/blobstream/types/validator.go index 729fe0f824..e0498ce88d 100644 --- a/x/blobstream/types/validator.go +++ b/x/blobstream/types/validator.go @@ -143,7 +143,7 @@ func (ibv InternalBridgeValidators) PowerDiff(c InternalBridgeValidators) sdk.De decMaxUint32 := sdk.NewDec(math.MaxUint32) q := delta.Quo(decMaxUint32) - return q.Abs() + return q } // TotalPower returns the total power in the bridge validator set. diff --git a/x/upgrade/keeper.go b/x/upgrade/keeper.go index 2b8b15c81f..54b03dd7d9 100644 --- a/x/upgrade/keeper.go +++ b/x/upgrade/keeper.go @@ -1,8 +1,6 @@ package upgrade import ( - fmt "fmt" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/upgrade/types" @@ -16,26 +14,18 @@ type Keeper struct { // safely be ported over without any migration storeKey storetypes.StoreKey - // in memory copy of the upgrade schedule if any. This is local per node + // in memory copy of the upgrade height if any. This is local per node // and configured from the config. - upgradeSchedule map[string]Schedule - - // the app version that should be set in end blocker - pendingAppVersion uint64 + upgradeHeight int64 } type VersionSetter func(version uint64) // NewKeeper constructs an upgrade keeper -func NewKeeper(storeKey storetypes.StoreKey, upgradeSchedule map[string]Schedule) Keeper { - for chainID, schedule := range upgradeSchedule { - if err := schedule.ValidateBasic(); err != nil { - panic(fmt.Sprintf("invalid schedule %s: %v", chainID, err)) - } - } +func NewKeeper(storeKey storetypes.StoreKey, upgradeHeight int64) Keeper { return Keeper{ - storeKey: storeKey, - upgradeSchedule: upgradeSchedule, + storeKey: storeKey, + upgradeHeight: upgradeHeight, } } @@ -99,3 +89,9 @@ func (k Keeper) ClearIBCState(ctx sdk.Context, lastHeight int64) { store.Delete(types.UpgradedClientKey(lastHeight)) store.Delete(types.UpgradedConsStateKey(lastHeight)) } + +// ShouldUpgrade returns true if the current height is one before +// the locally provided upgrade height that is passed as a flag +func (k Keeper) ShouldUpgrade(height int64) bool { + return k.upgradeHeight == height+1 +} diff --git a/x/upgrade/types.go b/x/upgrade/types.go index 79fe78cfdb..ba3270a9c0 100644 --- a/x/upgrade/types.go +++ b/x/upgrade/types.go @@ -1,8 +1,6 @@ package upgrade import ( - fmt "fmt" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -65,74 +63,3 @@ func IsUpgradeMsg(msg []sdk.Msg) (uint64, bool) { } return msgVersionChange.Version, true } - -func (s Schedule) ValidateBasic() error { - lastHeight := 0 - lastVersion := uint64(0) - for idx, plan := range s { - if err := plan.ValidateBasic(); err != nil { - return fmt.Errorf("plan %d: %w", idx, err) - } - if plan.Start <= int64(lastHeight) { - return fmt.Errorf("plan %d: start height must be greater than %d, got %d", idx, lastHeight, plan.Start) - } - if plan.Version <= lastVersion { - return fmt.Errorf("plan %d: version must be greater than %d, got %d", idx, lastVersion, plan.Version) - } - lastHeight = int(plan.End) - lastVersion = plan.Version - } - return nil -} - -// ValidateVersions checks if all plan versions are covered by all the app versions -// that the state machine supports. -func (s Schedule) ValidateVersions(appVersions []uint64) error { - versionMap := make(map[uint64]struct{}) - for _, version := range appVersions { - versionMap[version] = struct{}{} - } - for _, plan := range s { - if _, ok := versionMap[plan.Version]; !ok { - return fmt.Errorf("plan version %d not found in app versions %v", plan.Version, appVersions) - } - } - return nil -} - -func (s Schedule) ShouldProposeUpgrade(height int64) (uint64, bool) { - for _, plan := range s { - if height >= plan.Start-1 && height < plan.End { - return plan.Version, true - } - } - return 0, false -} - -func (p Plan) ValidateBasic() error { - if p.Start < 1 { - return fmt.Errorf("plan start height cannot be negative or zero: %d", p.Start) - } - if p.End < 1 { - return fmt.Errorf("plan end height cannot be negative or zero: %d", p.End) - } - if p.Start > p.End { - return fmt.Errorf("plan end height must be greater or equal than start height: %d >= %d", p.Start, p.End) - } - if p.Version == 0 { - return fmt.Errorf("plan version cannot be zero") - } - return nil -} - -func NewSchedule(plans ...Plan) Schedule { - return plans -} - -func NewPlan(startHeight, endHeight int64, version uint64) Plan { - return Plan{ - Start: startHeight, - End: endHeight, - Version: version, - } -} diff --git a/x/upgrade/types_test.go b/x/upgrade/types_test.go deleted file mode 100644 index aef2e8bb5e..0000000000 --- a/x/upgrade/types_test.go +++ /dev/null @@ -1,69 +0,0 @@ -package upgrade_test - -import ( - fmt "fmt" - "testing" - - "github.com/celestiaorg/celestia-app/x/upgrade" - "github.com/stretchr/testify/require" -) - -func TestScheduleValidity(t *testing.T) { - testCases := []struct { - schedule upgrade.Schedule - valid bool - }{ - // can be empty - {upgrade.Schedule{}, true}, - // plan can not start at height 0 - {upgrade.Schedule{upgrade.Plan{Start: 0, End: 2, Version: 1}}, false}, - // end height can not be 0 - {upgrade.Schedule{upgrade.Plan{Version: 1}}, false}, - {upgrade.Schedule{upgrade.Plan{Start: 1, End: 2, Version: 1}}, true}, - // version can't be 0 - {upgrade.Schedule{upgrade.Plan{Start: 1, End: 2, Version: 0}}, false}, - // start and end height can be the same - {upgrade.Schedule{upgrade.Plan{Start: 2, End: 2, Version: 1}}, true}, - // end height must be greater than start height - {upgrade.Schedule{upgrade.Plan{Start: 2, End: 1, Version: 1}}, false}, - // plans can not overlap - {upgrade.Schedule{upgrade.Plan{Start: 1, End: 2, Version: 1}, upgrade.Plan{Start: 2, End: 3, Version: 2}}, false}, - // plans must be in order. They can skip versions - {upgrade.Schedule{upgrade.Plan{Start: 1, End: 2, Version: 1}, upgrade.Plan{Start: 3, End: 4, Version: 2}, upgrade.Plan{Start: 5, End: 6, Version: 4}}, true}, - {upgrade.Schedule{upgrade.Plan{Start: 1, End: 2, Version: 1}, upgrade.Plan{Start: 3, End: 4, Version: 2}, upgrade.Plan{Start: 5, End: 10, Version: 1}}, false}, - } - - for idx, tc := range testCases { - t.Run(fmt.Sprintf("case%d", idx), func(t *testing.T) { - if tc.valid { - require.NoError(t, tc.schedule.ValidateBasic()) - } else { - require.Error(t, tc.schedule.ValidateBasic()) - } - }) - } -} - -func TestScheduleValidateVersions(t *testing.T) { - testCases := []struct { - schedule upgrade.Schedule - appVersions []uint64 - valid bool - }{ - // can be empty - {upgrade.Schedule{}, []uint64{1, 2, 3}, true}, - {upgrade.Schedule{upgrade.Plan{Version: 3}}, []uint64{1, 2, 3}, true}, - {upgrade.Schedule{upgrade.Plan{Version: 4}}, []uint64{1, 2, 3}, false}, - {upgrade.Schedule{upgrade.Plan{Version: 2}, upgrade.Plan{Version: 5}}, []uint64{1, 2, 3}, false}, - } - - for idx, tc := range testCases { - t.Run(fmt.Sprintf("case%d", idx), func(t *testing.T) { - if tc.valid { - require.NoError(t, tc.schedule.ValidateVersions(tc.appVersions)) - } else { - require.Error(t, tc.schedule.ValidateVersions(tc.appVersions)) - } - }) - } -} diff --git a/x/upgrade/upgrade.go b/x/upgrade/upgrade.go deleted file mode 100644 index aedf46aa91..0000000000 --- a/x/upgrade/upgrade.go +++ /dev/null @@ -1,40 +0,0 @@ -package upgrade - -type Schedule []Plan - -type Plan struct { - Start int64 - End int64 - Version uint64 -} - -// ShouldUpgradeNextHeight returns true if the network of the given chainID should -// modify the app version in the following block. This can be used for both upgrading -// and downgrading. This relies on social consensus to work. At least 2/3+ of the -// validators must have the same app version and height in their schedule for the -// upgrade to happen successfully. -func (k Keeper) ShouldProposeUpgrade(chainID string, height int64) (uint64, bool) { - if k.upgradeSchedule == nil { - return 0, false - } - if schedule, ok := k.upgradeSchedule[chainID]; ok { - return schedule.ShouldProposeUpgrade(height) - } - return 0, false -} - -func (k *Keeper) PrepareUpgradeAtEndBlock(version uint64) { - k.pendingAppVersion = version -} - -func (k *Keeper) ShouldUpgrade() bool { - return k.pendingAppVersion != 0 -} - -func (k Keeper) GetNextAppVersion() uint64 { - return k.pendingAppVersion -} - -func (k *Keeper) MarkUpgradeComplete() { - k.pendingAppVersion = 0 -} diff --git a/x/upgrade/upgrade_test.go b/x/upgrade/upgrade_test.go index 2921d472e5..5cf6b9fe78 100644 --- a/x/upgrade/upgrade_test.go +++ b/x/upgrade/upgrade_test.go @@ -7,17 +7,8 @@ import ( "github.com/celestiaorg/celestia-app/app" "github.com/celestiaorg/celestia-app/app/encoding" - "github.com/celestiaorg/celestia-app/pkg/appconsts" - "github.com/celestiaorg/celestia-app/pkg/da" - "github.com/celestiaorg/celestia-app/pkg/shares" - "github.com/celestiaorg/celestia-app/pkg/square" - "github.com/celestiaorg/celestia-app/pkg/user" "github.com/celestiaorg/celestia-app/test/util" - "github.com/celestiaorg/celestia-app/test/util/testfactory" - "github.com/celestiaorg/celestia-app/x/upgrade" "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/types" - bank "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/log" @@ -26,174 +17,24 @@ import ( ) func TestUpgradeAppVersion(t *testing.T) { - testApp, kr := setupTestApp(t, upgrade.NewSchedule(upgrade.NewPlan(3, 5, 2))) - addr := testfactory.GetAddress(kr, "account") - encCfg := encoding.MakeConfig(app.ModuleEncodingRegisters...) - signer, err := user.NewSigner(kr, nil, addr, encCfg.TxConfig, testApp.GetChainID(), 1, 0) - require.NoError(t, err) - coins := types.NewCoins(types.NewCoin("utia", types.NewInt(10))) - sendMsg := bank.NewMsgSend(addr, addr, coins) - sendTx, err := signer.CreateTx([]types.Msg{sendMsg}, user.SetGasLimitAndFee(1e6, 1)) - require.NoError(t, err) - - upgradeTx, err := upgrade.NewMsgVersionChange(testApp.GetTxConfig(), 3) - require.NoError(t, err) - respCheckTx := testApp.CheckTx(abci.RequestCheckTx{Tx: upgradeTx}) - // we expect that a new msg version change should always be rejected - // by checkTx - require.EqualValues(t, 15, respCheckTx.Code, respCheckTx.Log) - - resp := testApp.PrepareProposal(abci.RequestPrepareProposal{ - Height: 2, - ChainId: testApp.GetChainID(), - BlockData: &tmproto.Data{}, - BlockDataSize: 1e6, - }) - - // At the height before the first height in the upgrade plan, the - // node should prepend a signal upgrade message. - require.Len(t, resp.BlockData.Txs, 1) - tx, err := testApp.GetTxConfig().TxDecoder()(resp.BlockData.Txs[0]) - require.NoError(t, err) - require.Len(t, tx.GetMsgs(), 1) - msg, ok := tx.GetMsgs()[0].(*upgrade.MsgVersionChange) - require.True(t, ok) - require.EqualValues(t, 2, msg.Version) - - { - // the same thing should happen if we run prepare proposal - // at height 4 as it is within the range - resp := testApp.PrepareProposal(abci.RequestPrepareProposal{ - Height: 4, - ChainId: testApp.GetChainID(), - BlockData: &tmproto.Data{}, - BlockDataSize: 1e6, - }) - - require.Len(t, resp.BlockData.Txs, 1) - tx, err := testApp.GetTxConfig().TxDecoder()(resp.BlockData.Txs[0]) - require.NoError(t, err) - require.Len(t, tx.GetMsgs(), 1) - msg, ok := tx.GetMsgs()[0].(*upgrade.MsgVersionChange) - require.True(t, ok) - require.EqualValues(t, 2, msg.Version) - } - - { - // we send the same proposal but now with an existing message and a - // smaller BlockDataSize. It should kick out the tx in place of the - // upgrade tx - resp := testApp.PrepareProposal(abci.RequestPrepareProposal{ - Height: 2, - ChainId: testApp.GetChainID(), - BlockData: &tmproto.Data{Txs: [][]byte{sendTx}}, - BlockDataSize: 1e2, - }) - require.Len(t, resp.BlockData.Txs, 1) - tx, err := testApp.GetTxConfig().TxDecoder()(resp.BlockData.Txs[0]) - require.NoError(t, err) - require.Len(t, tx.GetMsgs(), 1) - msg, ok := tx.GetMsgs()[0].(*upgrade.MsgVersionChange) - require.True(t, ok) - require.EqualValues(t, 2, msg.Version) - } - - { - // Height 5 however is outside the range and thus the upgrade - // message should not be prepended - resp := testApp.PrepareProposal(abci.RequestPrepareProposal{ - Height: 5, - ChainId: testApp.GetChainID(), - BlockData: &tmproto.Data{}, - BlockDataSize: 1e6, - }) - require.Len(t, resp.BlockData.Txs, 0) - } - - // We should accept this proposal as valid - processProposalResp := testApp.ProcessProposal(abci.RequestProcessProposal{ - Header: tmproto.Header{ - Height: 2, - DataHash: resp.BlockData.Hash, - }, - BlockData: resp.BlockData, - }) - require.True(t, processProposalResp.IsOK()) - - { - // to assert that the upgrade tx must be the first tx - // we insert a tx before the upgrade tx. To get the hash - // we need to build the square and data availability header - txs := [][]byte{[]byte("hello world"), upgradeTx} - dataSquare, txs, err := square.Build(txs, appconsts.LatestVersion, appconsts.DefaultGovMaxSquareSize) - require.NoError(t, err) - eds, err := da.ExtendShares(shares.ToBytes(dataSquare)) - require.NoError(t, err) - dah, err := da.NewDataAvailabilityHeader(eds) - require.NoError(t, err) - blockData := &tmproto.Data{ - Txs: txs, - SquareSize: uint64(dataSquare.Size()), - Hash: dah.Hash(), - } - - processProposalResp := testApp.ProcessProposal(abci.RequestProcessProposal{ - Header: tmproto.Header{ - Height: 2, - DataHash: blockData.Hash, - }, - BlockData: blockData, - }) - require.True(t, processProposalResp.IsRejected()) - } + testApp, _ := setupTestApp(t, 3) testApp.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: 2}}) - respDeliverTx := testApp.DeliverTx(abci.RequestDeliverTx{Tx: resp.BlockData.Txs[0]}) - require.EqualValues(t, 0, respDeliverTx.Code, respDeliverTx.Log) // app version should not have changed yet require.EqualValues(t, 1, testApp.AppVersion()) respEndBlock := testApp.EndBlock(abci.RequestEndBlock{Height: 2}) // now the app version changes require.EqualValues(t, 2, respEndBlock.ConsensusParamUpdates.Version.AppVersion) require.EqualValues(t, 2, testApp.AppVersion()) - - _ = testApp.Commit() - - // If another node proposes a block with a version change that is - // not supported by the nodes own state machine then the node - // rejects the proposed block - respProcessProposal := testApp.ProcessProposal(abci.RequestProcessProposal{ - Header: tmproto.Header{ - Height: 3, - }, - BlockData: &tmproto.Data{ - Txs: [][]byte{upgradeTx}, - }, - }) - require.True(t, respProcessProposal.IsRejected()) - - // if we ask the application to prepare another proposal - // it will not add the upgrade signal message even though - // its within the range of the plan because the application - // has already upgraded to that height - respPrepareProposal := testApp.PrepareProposal(abci.RequestPrepareProposal{ - Height: 3, - ChainId: testApp.GetChainID(), - BlockData: &tmproto.Data{}, - BlockDataSize: 1e6, - }) - require.Len(t, respPrepareProposal.BlockData.Txs, 0) } -func setupTestApp(t *testing.T, schedule upgrade.Schedule) (*app.App, keyring.Keyring) { +func setupTestApp(t *testing.T, upgradeHeight int64) (*app.App, keyring.Keyring) { t.Helper() db := dbm.NewMemDB() chainID := "test_chain" encCfg := encoding.MakeConfig(app.ModuleEncodingRegisters...) - upgradeSchedule := make(map[string]upgrade.Schedule) - upgradeSchedule[chainID] = schedule - testApp := app.New(log.NewNopLogger(), db, nil, true, 0, encCfg, upgradeSchedule, util.EmptyAppOptions{}) + testApp := app.New(log.NewNopLogger(), db, nil, true, 0, encCfg, upgradeHeight, util.EmptyAppOptions{}) genesisState, _, kr := util.GenesisStateWithSingleValidator(testApp, "account")