Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: remove blobstream param subspace when upgrading to v2 #3401

Merged
merged 8 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
&app.IBCKeeper.PortKeeper,
app.AccountKeeper,
app.ScopedICAHostKeeper,
app.MsgServiceRouter(),

Check failure on line 297 in app/app.go

View workflow job for this annotation

GitHub Actions / lint / golangci-lint

app.MsgServiceRouter undefined (type *App has no field or method MsgServiceRouter) (typecheck)
)

paramBlockList := paramfilter.NewParamBlockList(app.BlockedParams()...)
Expand Down Expand Up @@ -383,21 +383,21 @@
// order begin block, end block and init genesis
app.setModuleOrder()

app.QueryRouter().AddRoute(proof.TxInclusionQueryPath, proof.QueryTxInclusionProof)

Check failure on line 386 in app/app.go

View workflow job for this annotation

GitHub Actions / lint / golangci-lint

app.QueryRouter undefined (type *App has no field or method QueryRouter) (typecheck)
app.QueryRouter().AddRoute(proof.ShareInclusionQueryPath, proof.QueryShareInclusionProof)

Check failure on line 387 in app/app.go

View workflow job for this annotation

GitHub Actions / lint / golangci-lint

app.QueryRouter undefined (type *App has no field or method QueryRouter) (typecheck)

app.mm.RegisterInvariants(&app.CrisisKeeper)
app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter())

Check failure on line 390 in app/app.go

View workflow job for this annotation

GitHub Actions / lint / golangci-lint

app.MsgServiceRouter undefined (type *App has no field or method MsgServiceRouter) (typecheck)
app.mm.RegisterServices(app.configurator)

// extract the accepted message list from the configurator and create a gatekeeper
// which will be used both as the antehandler and as part of the circuit breaker in
// the msg service router
app.MsgGateKeeper = ante.NewMsgVersioningGateKeeper(app.configurator.GetAcceptedMessages())
app.MsgServiceRouter().SetCircuit(app.MsgGateKeeper)

Check failure on line 397 in app/app.go

View workflow job for this annotation

GitHub Actions / lint / golangci-lint

app.MsgServiceRouter undefined (type *App has no field or method MsgServiceRouter) (typecheck)

// Initialize the KV stores for the base modules (e.g. params). The base modules will be included in every app version.
app.MountKVStores(app.baseKeys())

Check failure on line 400 in app/app.go

View workflow job for this annotation

GitHub Actions / lint / golangci-lint

app.MountKVStores undefined (type *App has no field or method MountKVStores) (typecheck)
app.MountTransientStores(tkeys)
app.MountMemoryStores(memKeys)

Expand Down Expand Up @@ -450,6 +450,9 @@
if req.Height == app.upgradeHeightV2-1 {
app.SetInitialAppVersionInConsensusParams(ctx, v2)
app.SetAppVersion(ctx, v2)
if err := app.ParamsKeeper.DeleteSubspace(blobstreamtypes.ModuleName); err != nil {
panic(err)
}
rootulp marked this conversation as resolved.
Show resolved Hide resolved
}
// from v2 to v3 and onwards we use a signalling mechanism
} else if shouldUpgrade, newVersion := app.SignalKeeper.ShouldUpgrade(); shouldUpgrade {
Expand Down
43 changes: 39 additions & 4 deletions app/test/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,19 @@ import (
v1 "github.com/celestiaorg/celestia-app/v2/pkg/appconsts/v1"
v2 "github.com/celestiaorg/celestia-app/v2/pkg/appconsts/v2"
"github.com/celestiaorg/celestia-app/v2/test/util"
blobstreamtypes "github.com/celestiaorg/celestia-app/v2/x/blobstream/types"
"github.com/celestiaorg/celestia-app/v2/x/minfee"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/params/types/proposal"
packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v6/packetforward/types"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate import statement.

- packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v6/packetforward/types"

This import statement is duplicated and should be removed to clean up the code.


Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v6/packetforward/types"

icahosttypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/host/types"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmversion "github.com/tendermint/tendermint/proto/tendermint/version"
dbm "github.com/tendermint/tm-db"

packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v6/packetforward/types"

"github.com/tendermint/tendermint/libs/log"
)

// TestAppUpgrades verifies that the all module's params are overridden during an
Expand Down Expand Up @@ -102,6 +101,42 @@ func TestAppUpgrades(t *testing.T) {
}
}

func TestBlobstreamDisabledInV2(t *testing.T) {
testApp, _ := SetupTestAppWithUpgradeHeight(t, 3)
supportedVersions := []uint64{v1.Version, v2.Version}
require.Equal(t, supportedVersions, testApp.SupportedVersions())

ctx := testApp.NewContext(true, tmproto.Header{
Version: tmversion.Consensus{
App: 1,
},
})
testApp.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{
Height: 2,
Version: tmversion.Consensus{App: 1},
}})
require.EqualValues(t, 1, testApp.AppVersion())

got, err := testApp.ParamsKeeper.Params(ctx, &proposal.QueryParamsRequest{
Subspace: blobstreamtypes.ModuleName,
Key: string(blobstreamtypes.ParamsStoreKeyDataCommitmentWindow),
})
require.NoError(t, err)
require.Equal(t, "\"400\"", got.Param.Value)

// Upgrade from v1 -> v2
testApp.EndBlock(abci.RequestEndBlock{Height: 2})
testApp.Commit()
require.EqualValues(t, 2, testApp.AppVersion())

ctx = testApp.NewContext(true, tmproto.Header{Version: tmversion.Consensus{App: 2}})
_, err = testApp.ParamsKeeper.Params(ctx, &proposal.QueryParamsRequest{
Subspace: blobstreamtypes.ModuleName,
Key: string(blobstreamtypes.ParamsStoreKeyDataCommitmentWindow),
})
require.Error(t, err)
}

func SetupTestAppWithUpgradeHeight(t *testing.T, upgradeHeight int64) (*app.App, keyring.Keyring) {
t.Helper()

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ require (
)

replace (
github.com/cosmos/cosmos-sdk => github.com/celestiaorg/cosmos-sdk v1.21.0-sdk-v0.46.16
github.com/cosmos/cosmos-sdk => /Users/rootulp/git/rootulp/celestiaorg/cosmos-sdk
// 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
Expand Down
Loading