feat!: connect app version with consensus params in end block (#16244)
Co-authored-by: Marko <marko@baricevic.me> Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: marbar3778 <marbar3778@yahoo.com>
This commit is contained in:
parent
6601713eb6
commit
79cc75b1db
@ -113,6 +113,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
* (x/slashing) [#16441](https://github.com/cosmos/cosmos-sdk/pull/16441) Params state is migrated to collections. `GetParams` has been removed.
|
||||
* (types) [#16918](https://github.com/cosmos/cosmos-sdk/pull/16918) Remove `IntProto` and `DecProto`. Instead, `math.Int` and `math.LegacyDec` should be used respectively. Both types support `Marshal` and `Unmarshal` which should be used for binary marshaling.
|
||||
* (client) [#17215](https://github.com/cosmos/cosmos-sdk/pull/17215) `server.StartCmd`,`server.ExportCmd`,`server.NewRollbackCmd`,`pruning.Cmd`,`genutilcli.InitCmd`,`genutilcli.GenTxCmd`,`genutilcli.CollectGenTxsCmd`,`genutilcli.AddGenesisAccountCmd`, do not take a home directory anymore. It is inferred from the root command.
|
||||
* (baseapp) [#16244](https://github.com/cosmos/cosmos-sdk/pull/16244) `SetProtocolVersion` has been renamed to `SetAppVersion`. It now updates the consensus params in baseapp's `ParamStore`.
|
||||
* (types) [#17348](https://github.com/cosmos/cosmos-sdk/pull/17348) Remove the `WrapServiceResult` function.
|
||||
* The `*sdk.Result` returned by the msg server router will not contain the `.Data` field.
|
||||
* (x/staking) [#17335](https://github.com/cosmos/cosmos-sdk/pull/17335) Remove usage of `"github.com/cosmos/cosmos-sdk/x/staking/types".Infraction_*` in favour of `"cosmossdk.io/api/cosmos/staking/v1beta1".Infraction_` in order to remove dependency between modules on staking
|
||||
@ -125,6 +126,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
### State Machine Breaking
|
||||
|
||||
* (x/distribution) [#17115](https://github.com/cosmos/cosmos-sdk/pull/17115) Migrate `PreviousProposer` to collections.
|
||||
* (x/upgrade) [#16244](https://github.com/cosmos/cosmos-sdk/pull/16244) upgrade module no longer stores the app version but gets and sets the app version stored in the `ParamStore` of baseapp.
|
||||
|
||||
## [v0.50.0-rc.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.0-rc.0) - 2023-08-18
|
||||
|
||||
|
||||
@ -149,11 +149,22 @@ func (app *BaseApp) InitChain(req *abci.RequestInitChain) (*abci.ResponseInitCha
|
||||
|
||||
func (app *BaseApp) Info(req *abci.RequestInfo) (*abci.ResponseInfo, error) {
|
||||
lastCommitID := app.cms.LastCommitID()
|
||||
appVersion := InitialAppVersion
|
||||
if lastCommitID.Version > 0 {
|
||||
ctx, err := app.CreateQueryContext(lastCommitID.Version, false)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed creating query context: %w", err)
|
||||
}
|
||||
appVersion, err = app.AppVersion(ctx)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed getting app version: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
return &abci.ResponseInfo{
|
||||
Data: app.name,
|
||||
Version: app.version,
|
||||
AppVersion: app.appVersion,
|
||||
AppVersion: appVersion,
|
||||
LastBlockHeight: lastCommitID.Version,
|
||||
LastBlockAppHash: lastCommitID.Hash,
|
||||
}, nil
|
||||
|
||||
@ -17,6 +17,7 @@ import (
|
||||
"github.com/cometbft/cometbft/crypto/secp256k1"
|
||||
cmtprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto"
|
||||
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
|
||||
cmttypes "github.com/cometbft/cometbft/types"
|
||||
dbm "github.com/cosmos/cosmos-db"
|
||||
protoio "github.com/cosmos/gogoproto/io"
|
||||
"github.com/cosmos/gogoproto/jsonpb"
|
||||
@ -44,6 +45,9 @@ import (
|
||||
|
||||
func TestABCI_Info(t *testing.T) {
|
||||
suite := NewBaseAppSuite(t)
|
||||
ctx := suite.baseApp.NewContext(true)
|
||||
err := suite.baseApp.StoreConsensusParams(ctx, cmttypes.DefaultConsensusParams().ToProto())
|
||||
require.NoError(t, err)
|
||||
|
||||
reqInfo := abci.RequestInfo{}
|
||||
res, err := suite.baseApp.Info(&reqInfo)
|
||||
@ -53,7 +57,18 @@ func TestABCI_Info(t *testing.T) {
|
||||
require.Equal(t, t.Name(), res.GetData())
|
||||
require.Equal(t, int64(0), res.LastBlockHeight)
|
||||
require.Equal(t, []uint8(nil), res.LastBlockAppHash)
|
||||
require.Equal(t, suite.baseApp.AppVersion(), res.AppVersion)
|
||||
appVersion, err := suite.baseApp.AppVersion(ctx)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, appVersion, res.AppVersion)
|
||||
|
||||
_, err = suite.baseApp.FinalizeBlock(&abci.RequestFinalizeBlock{Height: 1})
|
||||
require.NoError(t, err)
|
||||
_, err = suite.baseApp.Commit()
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, suite.baseApp.SetAppVersion(ctx, 1))
|
||||
res, err = suite.baseApp.Info(&reqInfo)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, uint64(1), res.AppVersion)
|
||||
}
|
||||
|
||||
func TestABCI_First_block_Height(t *testing.T) {
|
||||
|
||||
@ -167,10 +167,6 @@ type BaseApp struct {
|
||||
// application's version string
|
||||
version string
|
||||
|
||||
// application's protocol version that increments on every upgrade
|
||||
// if BaseApp is passed to the upgrade keeper's NewKeeper method.
|
||||
appVersion uint64
|
||||
|
||||
// recovery handler for app.runTx method
|
||||
runTxRecoveryMiddleware recoveryMiddleware
|
||||
|
||||
@ -249,8 +245,19 @@ func (app *BaseApp) Name() string {
|
||||
}
|
||||
|
||||
// AppVersion returns the application's protocol version.
|
||||
func (app *BaseApp) AppVersion() uint64 {
|
||||
return app.appVersion
|
||||
func (app *BaseApp) AppVersion(ctx context.Context) (uint64, error) {
|
||||
if app.paramStore == nil {
|
||||
return 0, errors.New("app.paramStore is nil")
|
||||
}
|
||||
|
||||
cp, err := app.paramStore.Get(ctx)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("failed to get consensus params: %w", err)
|
||||
}
|
||||
if cp.Version == nil {
|
||||
return 0, nil
|
||||
}
|
||||
return cp.Version.App, nil
|
||||
}
|
||||
|
||||
// Version returns the application's version string.
|
||||
@ -522,9 +529,6 @@ func (app *BaseApp) GetConsensusParams(ctx sdk.Context) cmtproto.ConsensusParams
|
||||
|
||||
// StoreConsensusParams sets the consensus parameters to the BaseApp's param
|
||||
// store.
|
||||
//
|
||||
// NOTE: We're explicitly not storing the CometBFT app_version in the param store.
|
||||
// It's stored instead in the x/upgrade store, with its own bump logic.
|
||||
func (app *BaseApp) StoreConsensusParams(ctx sdk.Context, cp cmtproto.ConsensusParams) error {
|
||||
if app.paramStore == nil {
|
||||
return errors.New("cannot store consensus params with no params store set")
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package baseapp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
@ -129,9 +131,25 @@ func (app *BaseApp) SetVersion(v string) {
|
||||
app.version = v
|
||||
}
|
||||
|
||||
// SetProtocolVersion sets the application's protocol version
|
||||
func (app *BaseApp) SetProtocolVersion(v uint64) {
|
||||
app.appVersion = v
|
||||
// SetAppVersion sets the application's version this is used as part of the
|
||||
// header in blocks and is returned to the consensus engine in EndBlock.
|
||||
func (app *BaseApp) SetAppVersion(ctx context.Context, v uint64) error {
|
||||
if app.paramStore == nil {
|
||||
return errors.New("param store must be set to set app version")
|
||||
}
|
||||
|
||||
cp, err := app.paramStore.Get(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get consensus params: %w", err)
|
||||
}
|
||||
if cp.Version == nil {
|
||||
return errors.New("version is not set in param store")
|
||||
}
|
||||
cp.Version.App = v
|
||||
if err := app.paramStore.Set(ctx, cp); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (app *BaseApp) SetDB(db dbm.DB) {
|
||||
|
||||
@ -6,6 +6,8 @@ import (
|
||||
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
|
||||
)
|
||||
|
||||
const InitialAppVersion uint64 = 0
|
||||
|
||||
// ParamStore defines the interface the parameter store used by the BaseApp must
|
||||
// fulfill.
|
||||
type ParamStore interface {
|
||||
@ -13,3 +15,12 @@ type ParamStore interface {
|
||||
Has(ctx context.Context) (bool, error)
|
||||
Set(ctx context.Context, cp cmtproto.ConsensusParams) error
|
||||
}
|
||||
|
||||
// AppVersionModifier defines the interface fulfilled by BaseApp
|
||||
// which allows getting and setting it's appVersion field. This
|
||||
// in turn updates the consensus params that are sent to the
|
||||
// consensus engine in EndBlock
|
||||
type AppVersionModifier interface {
|
||||
SetAppVersion(context.Context, uint64) error
|
||||
AppVersion(context.Context) (uint64, error)
|
||||
}
|
||||
|
||||
@ -75,6 +75,7 @@ func init() {
|
||||
ProvideHeaderInfoService,
|
||||
ProvideCometInfoService,
|
||||
ProvideBasicManager,
|
||||
ProvideAppVersionModifier,
|
||||
ProvideAddressCodec,
|
||||
),
|
||||
appmodule.Invoke(SetupAppBuilder),
|
||||
@ -258,6 +259,10 @@ func ProvideBasicManager(app *AppBuilder) module.BasicManager {
|
||||
return app.app.basicManager
|
||||
}
|
||||
|
||||
func ProvideAppVersionModifier(app *AppBuilder) baseapp.AppVersionModifier {
|
||||
return app.app
|
||||
}
|
||||
|
||||
type (
|
||||
// ValidatorAddressCodec is an alias for address.Codec for validator addresses.
|
||||
ValidatorAddressCodec address.Codec
|
||||
|
||||
@ -284,8 +284,6 @@ func TestUpgradeStateOnGenesis(t *testing.T) {
|
||||
require.Equal(t, vm[v], i.ConsensusVersion())
|
||||
}
|
||||
}
|
||||
|
||||
require.NotNil(t, app.UpgradeKeeper.GetVersionSetter())
|
||||
}
|
||||
|
||||
// TestMergedRegistry tests that fetching the gogo/protov2 merged registry
|
||||
|
||||
@ -10,6 +10,7 @@ require (
|
||||
cosmossdk.io/depinject v1.0.0-alpha.4
|
||||
cosmossdk.io/log v1.2.1
|
||||
cosmossdk.io/math v1.1.2
|
||||
cosmossdk.io/collections v0.4.0
|
||||
cosmossdk.io/store v1.0.0-rc.0
|
||||
cosmossdk.io/tools/confix v0.0.0-20230613133644-0a778132a60f
|
||||
cosmossdk.io/x/circuit v0.0.0-20230613133644-0a778132a60f
|
||||
|
||||
@ -7,6 +7,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"cosmossdk.io/core/appmodule"
|
||||
@ -121,8 +122,9 @@ func setupTest(t *testing.T, height int64, skip map[int64]bool) *TestSuite {
|
||||
s.encCfg.TxConfig.TxDecoder(),
|
||||
)
|
||||
|
||||
s.keeper = keeper.NewKeeper(skip, storeService, s.encCfg.Codec, t.TempDir(), nil, authtypes.NewModuleAddress(govtypes.ModuleName).String())
|
||||
s.keeper.SetVersionSetter(s.baseApp)
|
||||
s.baseApp.SetParamStore(¶mStore{params: cmtproto.ConsensusParams{Version: &cmtproto.VersionParams{App: 1}}})
|
||||
|
||||
s.keeper = keeper.NewKeeper(skip, storeService, s.encCfg.Codec, t.TempDir(), s.baseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String())
|
||||
|
||||
s.ctx = testCtx.Ctx.WithHeaderInfo(header.Info{Time: time.Now(), Height: height})
|
||||
|
||||
@ -527,3 +529,22 @@ func TestDowngradeVerification(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type paramStore struct {
|
||||
params cmtproto.ConsensusParams
|
||||
}
|
||||
|
||||
var _ baseapp.ParamStore = (*paramStore)(nil)
|
||||
|
||||
func (ps *paramStore) Set(_ context.Context, value cmtproto.ConsensusParams) error {
|
||||
ps.params = value
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ps paramStore) Has(_ context.Context) (bool, error) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (ps paramStore) Get(_ context.Context) (cmtproto.ConsensusParams, error) {
|
||||
return ps.params, nil
|
||||
}
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
package exported
|
||||
|
||||
// ProtocolVersionSetter defines the interface fulfilled by BaseApp
|
||||
// which allows setting it's appVersion field.
|
||||
type ProtocolVersionSetter interface {
|
||||
SetProtocolVersion(uint64)
|
||||
}
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/baseapp"
|
||||
)
|
||||
|
||||
// AppVersionModifier defines the interface fulfilled by BaseApp
|
||||
// which allows getting and setting it's appVersion field. This
|
||||
// in turn updates the consensus params that are sent to the
|
||||
// consensus engine in EndBlock
|
||||
type AppVersionModifier baseapp.AppVersionModifier
|
||||
|
||||
@ -178,6 +178,4 @@ require (
|
||||
sigs.k8s.io/yaml v1.3.0 // indirect
|
||||
)
|
||||
|
||||
// Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities.
|
||||
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
|
||||
replace github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1
|
||||
replace github.com/cosmos/cosmos-sdk => ../../.
|
||||
|
||||
@ -270,11 +270,8 @@ github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipus
|
||||
github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
|
||||
github.com/bufbuild/protocompile v0.5.1 h1:mixz5lJX4Hiz4FpqFREJHIXLfaLBntfaJv1h+/jS+Qg=
|
||||
github.com/bufbuild/protocompile v0.5.1/go.mod h1:G5iLmavmF4NsYtpZFvE3B/zFch2GIY8+wjsYLR/lc40=
|
||||
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
|
||||
github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s=
|
||||
github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U=
|
||||
github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY=
|
||||
github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE=
|
||||
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
|
||||
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
|
||||
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
|
||||
@ -288,9 +285,6 @@ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL
|
||||
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
|
||||
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
|
||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||
github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM=
|
||||
github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ=
|
||||
@ -347,8 +341,6 @@ github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0
|
||||
github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U=
|
||||
github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o=
|
||||
github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I=
|
||||
github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230713093628-90d9a75d4125 h1:2aGCqfxWf2AAvLOUHaRiByle6n0FPRdeOF/62JTldh0=
|
||||
github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230713093628-90d9a75d4125/go.mod h1:LME6v5XztqVK7/1uTQj/G6ZJdosJEz24rKaPYk+WbqI=
|
||||
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
|
||||
github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
|
||||
github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE=
|
||||
@ -432,15 +424,14 @@ github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4
|
||||
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
|
||||
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
|
||||
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
|
||||
github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
|
||||
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
|
||||
github.com/getsentry/sentry-go v0.23.0 h1:dn+QRCeJv4pPt9OjVXiMcGIBIefaTJPw/h0bZWO05nE=
|
||||
github.com/getsentry/sentry-go v0.23.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
|
||||
github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU=
|
||||
github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
|
||||
github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8=
|
||||
github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk=
|
||||
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
|
||||
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
@ -459,13 +450,16 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V
|
||||
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
|
||||
github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4=
|
||||
github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
|
||||
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js=
|
||||
github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
|
||||
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
||||
github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU=
|
||||
github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
|
||||
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
||||
github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho=
|
||||
github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=
|
||||
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
|
||||
github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ=
|
||||
github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU=
|
||||
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
|
||||
@ -475,8 +469,8 @@ github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8=
|
||||
github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
|
||||
github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo=
|
||||
github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM=
|
||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk=
|
||||
github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0=
|
||||
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4=
|
||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
@ -725,9 +719,6 @@ github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8
|
||||
github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM=
|
||||
github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I=
|
||||
github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk=
|
||||
github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
|
||||
@ -739,8 +730,9 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
|
||||
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
|
||||
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
|
||||
github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w=
|
||||
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
|
||||
github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw=
|
||||
github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||
github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8=
|
||||
@ -856,7 +848,6 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw
|
||||
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
|
||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||
github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4=
|
||||
github.com/pelletier/go-toml/v2 v2.0.9 h1:uH2qQXheeefCCkuBBSLi7jCiSmj3VRh2+Goq2N7Xxu0=
|
||||
github.com/pelletier/go-toml/v2 v2.0.9/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
|
||||
github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac=
|
||||
@ -984,8 +975,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
||||
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8=
|
||||
@ -998,11 +987,12 @@ github.com/tidwall/btree v1.6.0 h1:LDZfKfQIBHGHWSwckhXI0RPSXzlo+KYdjK7FWSqOzzg=
|
||||
github.com/tidwall/btree v1.6.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY=
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
|
||||
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
|
||||
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
|
||||
github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
|
||||
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
||||
github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0=
|
||||
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
|
||||
github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
|
||||
github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8=
|
||||
github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
|
||||
@ -1048,9 +1038,6 @@ go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9E
|
||||
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
|
||||
go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI=
|
||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k=
|
||||
golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
@ -1065,8 +1052,6 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
||||
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
|
||||
golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
|
||||
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
@ -1108,7 +1093,6 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
|
||||
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@ -1172,9 +1156,6 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
|
||||
golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
|
||||
golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
|
||||
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
|
||||
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
@ -1218,7 +1199,6 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
|
||||
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@ -1312,24 +1292,18 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
|
||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
||||
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||
golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0=
|
||||
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
@ -1343,9 +1317,6 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
||||
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
|
||||
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
@ -1416,7 +1387,6 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 h1:Vve/L0v7CXXuxUmaMGIEK/dEeq7uiqb5qBgQrZzIE7E=
|
||||
golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
@ -1661,7 +1631,6 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ
|
||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
|
||||
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
@ -1711,7 +1680,6 @@ nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0
|
||||
pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw=
|
||||
pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04=
|
||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
||||
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
|
||||
@ -37,7 +37,7 @@ type Keeper struct {
|
||||
storeService corestore.KVStoreService // key to access x/upgrade store
|
||||
cdc codec.BinaryCodec // App-wide binary codec
|
||||
upgradeHandlers map[string]types.UpgradeHandler // map of plan name to upgrade handler
|
||||
versionSetter xp.ProtocolVersionSetter // implements setting the protocol version field on BaseApp
|
||||
versionModifier xp.AppVersionModifier // implements setting the protocol version field on BaseApp
|
||||
downgradeVerified bool // tells if we've already sanity checked that this binary version isn't being used against an old state.
|
||||
authority string // the address capable of executing and canceling an upgrade. Usually the gov module account
|
||||
initVersionMap module.VersionMap // the module version map at init genesis
|
||||
@ -49,14 +49,14 @@ type Keeper struct {
|
||||
// cdc - the app-wide binary codec
|
||||
// homePath - root directory of the application's config
|
||||
// vs - the interface implemented by baseapp which allows setting baseapp's protocol version field
|
||||
func NewKeeper(skipUpgradeHeights map[int64]bool, storeService corestore.KVStoreService, cdc codec.BinaryCodec, homePath string, vs xp.ProtocolVersionSetter, authority string) *Keeper {
|
||||
func NewKeeper(skipUpgradeHeights map[int64]bool, storeService corestore.KVStoreService, cdc codec.BinaryCodec, homePath string, vs xp.AppVersionModifier, authority string) *Keeper {
|
||||
k := &Keeper{
|
||||
homePath: homePath,
|
||||
skipUpgradeHeights: skipUpgradeHeights,
|
||||
storeService: storeService,
|
||||
cdc: cdc,
|
||||
upgradeHandlers: map[string]types.UpgradeHandler{},
|
||||
versionSetter: vs,
|
||||
versionModifier: vs,
|
||||
authority: authority,
|
||||
}
|
||||
|
||||
@ -67,16 +67,6 @@ func NewKeeper(skipUpgradeHeights map[int64]bool, storeService corestore.KVStore
|
||||
return k
|
||||
}
|
||||
|
||||
// SetVersionSetter sets the interface implemented by baseapp which allows setting baseapp's protocol version field
|
||||
func (k *Keeper) SetVersionSetter(vs xp.ProtocolVersionSetter) {
|
||||
k.versionSetter = vs
|
||||
}
|
||||
|
||||
// GetVersionSetter gets the protocol version field of baseapp
|
||||
func (k *Keeper) GetVersionSetter() xp.ProtocolVersionSetter {
|
||||
return k.versionSetter
|
||||
}
|
||||
|
||||
// SetInitVersionMap sets the initial version map.
|
||||
// This is only used in app wiring and should not be used in any other context.
|
||||
func (k *Keeper) SetInitVersionMap(vm module.VersionMap) {
|
||||
@ -96,35 +86,6 @@ func (k Keeper) SetUpgradeHandler(name string, upgradeHandler types.UpgradeHandl
|
||||
k.upgradeHandlers[name] = upgradeHandler
|
||||
}
|
||||
|
||||
// setProtocolVersion sets the protocol version to state
|
||||
func (k Keeper) setProtocolVersion(ctx context.Context, v uint64) error {
|
||||
store := k.storeService.OpenKVStore(ctx)
|
||||
versionBytes := make([]byte, 8)
|
||||
binary.BigEndian.PutUint64(versionBytes, v)
|
||||
return store.Set([]byte{types.ProtocolVersionByte}, versionBytes)
|
||||
}
|
||||
|
||||
// getProtocolVersion gets the protocol version from state
|
||||
func (k Keeper) getProtocolVersion(ctx context.Context) (uint64, error) {
|
||||
store := k.storeService.OpenKVStore(ctx)
|
||||
ok, err := store.Has([]byte{types.ProtocolVersionByte})
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
if ok {
|
||||
pvBytes, err := store.Get([]byte{types.ProtocolVersionByte})
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
protocolVersion := binary.BigEndian.Uint64(pvBytes)
|
||||
return protocolVersion, nil
|
||||
}
|
||||
// default value
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
// SetModuleVersionMap saves a given version map to state
|
||||
func (k Keeper) SetModuleVersionMap(ctx context.Context, vm module.VersionMap) error {
|
||||
if len(vm) > 0 {
|
||||
@ -441,6 +402,7 @@ func (k Keeper) GetUpgradePlan(ctx context.Context) (plan types.Plan, err error)
|
||||
func (k Keeper) setDone(ctx context.Context, name string) error {
|
||||
store := k.storeService.OpenKVStore(ctx)
|
||||
sdkCtx := sdk.UnwrapSDKContext(ctx)
|
||||
fmt.Println("setting done", "height", sdkCtx.HeaderInfo().Height, "name", name)
|
||||
return store.Set(encodeDoneKey(name, sdkCtx.HeaderInfo().Height), []byte{1})
|
||||
}
|
||||
|
||||
@ -451,6 +413,7 @@ func (k Keeper) HasHandler(name string) bool {
|
||||
}
|
||||
|
||||
// ApplyUpgrade will execute the handler associated with the Plan and mark the plan as done.
|
||||
// If successful, it will increment the app version and clear the IBC state
|
||||
func (k Keeper) ApplyUpgrade(ctx context.Context, plan types.Plan) error {
|
||||
handler := k.upgradeHandlers[plan.Name]
|
||||
if handler == nil {
|
||||
@ -472,20 +435,16 @@ func (k Keeper) ApplyUpgrade(ctx context.Context, plan types.Plan) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// incremement the protocol version and set it in state and baseapp
|
||||
nextProtocolVersion, err := k.getProtocolVersion(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
nextProtocolVersion++
|
||||
err = k.setProtocolVersion(ctx, nextProtocolVersion)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// incremement the app version and set it in state and baseapp
|
||||
if k.versionModifier != nil {
|
||||
currentAppVersion, err := k.versionModifier.AppVersion(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if k.versionSetter != nil {
|
||||
// set protocol version on BaseApp
|
||||
k.versionSetter.SetProtocolVersion(nextProtocolVersion)
|
||||
if err := k.versionModifier.SetAppVersion(ctx, currentAppVersion+1); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Must clear IBC state after upgrade is applied as it is stored separately from the upgrade plan.
|
||||
|
||||
@ -4,8 +4,9 @@ import (
|
||||
"context"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
|
||||
cmttypes "github.com/cometbft/cometbft/types"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"cosmossdk.io/core/header"
|
||||
@ -45,6 +46,7 @@ func (s *KeeperTestSuite) SetupTest() {
|
||||
storeService := runtime.NewKVStoreService(key)
|
||||
s.key = key
|
||||
testCtx := testutil.DefaultContextWithDB(s.T(), key, storetypes.NewTransientStoreKey("transient_test"))
|
||||
s.ctx = testCtx.Ctx.WithHeaderInfo(header.Info{Height: 10})
|
||||
|
||||
s.baseApp = baseapp.NewBaseApp(
|
||||
"upgrade",
|
||||
@ -52,20 +54,19 @@ func (s *KeeperTestSuite) SetupTest() {
|
||||
testCtx.DB,
|
||||
s.encCfg.TxConfig.TxDecoder(),
|
||||
)
|
||||
s.baseApp.SetParamStore(¶mStore{params: cmttypes.DefaultConsensusParams().ToProto()})
|
||||
appVersion, err := s.baseApp.AppVersion(context.Background())
|
||||
s.Require().NoError(err)
|
||||
s.Require().Equal(uint64(0), appVersion)
|
||||
|
||||
skipUpgradeHeights := make(map[int64]bool)
|
||||
|
||||
homeDir := filepath.Join(s.T().TempDir(), "x_upgrade_keeper_test")
|
||||
s.upgradeKeeper = keeper.NewKeeper(skipUpgradeHeights, storeService, s.encCfg.Codec, homeDir, nil, authtypes.NewModuleAddress(govtypes.ModuleName).String())
|
||||
s.upgradeKeeper.SetVersionSetter(s.baseApp)
|
||||
|
||||
vs := s.upgradeKeeper.GetVersionSetter()
|
||||
s.Require().Equal(vs, s.baseApp)
|
||||
s.upgradeKeeper = keeper.NewKeeper(skipUpgradeHeights, storeService, s.encCfg.Codec, homeDir, s.baseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String())
|
||||
|
||||
s.Require().Equal(testCtx.Ctx.Logger().With("module", "x/"+types.ModuleName), s.upgradeKeeper.Logger(testCtx.Ctx))
|
||||
s.T().Log("home dir:", homeDir)
|
||||
s.homeDir = homeDir
|
||||
s.ctx = testCtx.Ctx.WithHeaderInfo(header.Info{Time: time.Now(), Height: 10})
|
||||
|
||||
s.msgSrvr = keeper.NewMsgServerImpl(s.upgradeKeeper)
|
||||
s.addrs = simtestutil.CreateIncrementalAccounts(1)
|
||||
@ -236,8 +237,7 @@ func (s *KeeperTestSuite) TestIsSkipHeight() {
|
||||
s.Require().False(ok)
|
||||
skip := map[int64]bool{skipOne: true}
|
||||
storeService := runtime.NewKVStoreService(s.key)
|
||||
upgradeKeeper := keeper.NewKeeper(skip, storeService, s.encCfg.Codec, s.T().TempDir(), nil, authtypes.NewModuleAddress(govtypes.ModuleName).String())
|
||||
upgradeKeeper.SetVersionSetter(s.baseApp)
|
||||
upgradeKeeper := keeper.NewKeeper(skip, storeService, s.encCfg.Codec, s.T().TempDir(), s.baseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String())
|
||||
s.Require().True(upgradeKeeper.IsSkipHeight(9))
|
||||
s.Require().False(upgradeKeeper.IsSkipHeight(10))
|
||||
}
|
||||
@ -259,7 +259,8 @@ func (s *KeeperTestSuite) TestDowngradeVerified() {
|
||||
// Test that the protocol version successfully increments after an
|
||||
// upgrade and is successfully set on BaseApp's appVersion.
|
||||
func (s *KeeperTestSuite) TestIncrementProtocolVersion() {
|
||||
oldProtocolVersion := s.baseApp.AppVersion()
|
||||
oldProtocolVersion, err := s.baseApp.AppVersion(context.Background())
|
||||
s.Require().NoError(err)
|
||||
res := s.upgradeKeeper.HasHandler("dummy")
|
||||
s.Require().False(res)
|
||||
dummyPlan := types.Plan{
|
||||
@ -268,13 +269,14 @@ func (s *KeeperTestSuite) TestIncrementProtocolVersion() {
|
||||
Height: 100,
|
||||
}
|
||||
|
||||
err := s.upgradeKeeper.ApplyUpgrade(s.ctx, dummyPlan)
|
||||
err = s.upgradeKeeper.ApplyUpgrade(s.ctx, dummyPlan)
|
||||
s.Require().EqualError(err, "ApplyUpgrade should never be called without first checking HasHandler")
|
||||
|
||||
s.upgradeKeeper.SetUpgradeHandler("dummy", func(_ context.Context, _ types.Plan, vm module.VersionMap) (module.VersionMap, error) { return vm, nil })
|
||||
err = s.upgradeKeeper.ApplyUpgrade(s.ctx, dummyPlan)
|
||||
s.Require().NoError(err)
|
||||
upgradedProtocolVersion := s.baseApp.AppVersion()
|
||||
upgradedProtocolVersion, err := s.baseApp.AppVersion(s.ctx)
|
||||
s.Require().NoError(err)
|
||||
|
||||
s.Require().Equal(oldProtocolVersion+1, upgradedProtocolVersion)
|
||||
}
|
||||
@ -299,8 +301,7 @@ func (s *KeeperTestSuite) TestMigrations() {
|
||||
Height: 123450000,
|
||||
}
|
||||
|
||||
err = s.upgradeKeeper.ApplyUpgrade(s.ctx, dummyPlan)
|
||||
s.Require().NoError(err)
|
||||
s.Require().NoError(s.upgradeKeeper.ApplyUpgrade(s.ctx, dummyPlan))
|
||||
vm, err := s.upgradeKeeper.GetModuleVersionMap(s.ctx)
|
||||
s.Require().Equal(vmBefore["bank"]+1, vm["bank"])
|
||||
s.Require().NoError(err)
|
||||
@ -320,11 +321,13 @@ func (s *KeeperTestSuite) TestLastCompletedUpgrade() {
|
||||
return vm, nil
|
||||
})
|
||||
|
||||
require.True(keeper.HasHandler("test0"))
|
||||
err = keeper.ApplyUpgrade(s.ctx, types.Plan{
|
||||
Name: "test0",
|
||||
Height: 10,
|
||||
})
|
||||
require.NoError(err)
|
||||
|
||||
s.T().Log("verify valid upgrade name and height")
|
||||
name, height, err = keeper.GetLastCompletedUpgrade(s.ctx)
|
||||
require.Equal("test0", name)
|
||||
@ -341,6 +344,7 @@ func (s *KeeperTestSuite) TestLastCompletedUpgrade() {
|
||||
Height: 15,
|
||||
})
|
||||
require.NoError(err)
|
||||
|
||||
s.T().Log("verify valid upgrade name and height with multiple upgrades")
|
||||
name, height, err = keeper.GetLastCompletedUpgrade(newCtx)
|
||||
require.Equal("test1", name)
|
||||
@ -364,6 +368,7 @@ func (s *KeeperTestSuite) TestLastCompletedUpgradeOrdering() {
|
||||
Height: 10,
|
||||
})
|
||||
require.NoError(err)
|
||||
|
||||
name, height, err := keeper.GetLastCompletedUpgrade(s.ctx)
|
||||
require.Equal("test-v0.9", name)
|
||||
require.Equal(int64(10), height)
|
||||
@ -390,3 +395,22 @@ func (s *KeeperTestSuite) TestLastCompletedUpgradeOrdering() {
|
||||
func TestKeeperTestSuite(t *testing.T) {
|
||||
suite.Run(t, new(KeeperTestSuite))
|
||||
}
|
||||
|
||||
type paramStore struct {
|
||||
params cmtproto.ConsensusParams
|
||||
}
|
||||
|
||||
var _ baseapp.ParamStore = (*paramStore)(nil)
|
||||
|
||||
func (ps *paramStore) Set(_ context.Context, value cmtproto.ConsensusParams) error {
|
||||
ps.params = value
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ps paramStore) Has(_ context.Context) (bool, error) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (ps paramStore) Get(_ context.Context) (cmtproto.ConsensusParams, error) {
|
||||
return ps.params, nil
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package keeper
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
storetypes "cosmossdk.io/core/store"
|
||||
"cosmossdk.io/store/prefix"
|
||||
@ -11,6 +12,11 @@ import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
const (
|
||||
// LegacyProtocolVersionByte was the prefix to look up Protocol Version (AppVersion)
|
||||
LegacyProtocolVersionByte = 0x3
|
||||
)
|
||||
|
||||
// Migrator is a struct for handling in-place store migrations.
|
||||
type Migrator struct {
|
||||
keeper *Keeper
|
||||
@ -47,3 +53,38 @@ func migrateDoneUpgradeKeys(ctx sdk.Context, storeService storetypes.KVStoreServ
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Migrate2to3 migrates from version 2 to 3.
|
||||
// It takes the legacy protocol version and if it exists, uses it to set
|
||||
// the app version (of the baseapp)
|
||||
func (m Migrator) Migrate2to3(ctx sdk.Context) error {
|
||||
return migrateAppVersion(ctx, m.keeper)
|
||||
}
|
||||
|
||||
func migrateAppVersion(ctx sdk.Context, keeper *Keeper) error {
|
||||
if keeper.versionModifier == nil {
|
||||
return fmt.Errorf("version modifier is not set")
|
||||
}
|
||||
|
||||
store := keeper.storeService.OpenKVStore(ctx)
|
||||
// if the key was never set then we don't need to migrate anything
|
||||
exists, err := store.Has([]byte{LegacyProtocolVersionByte})
|
||||
if err != nil {
|
||||
return fmt.Errorf("error checking if legacy protocol version key exists: %w", err)
|
||||
}
|
||||
if !exists {
|
||||
return nil
|
||||
}
|
||||
|
||||
versionBytes, err := store.Get([]byte{LegacyProtocolVersionByte})
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting legacy protocol version: %w", err)
|
||||
}
|
||||
appVersion := binary.BigEndian.Uint64(versionBytes)
|
||||
|
||||
if err := keeper.versionModifier.SetAppVersion(ctx, appVersion); err != nil {
|
||||
return fmt.Errorf("error migration app version: %w", err)
|
||||
}
|
||||
|
||||
return store.Delete([]byte{LegacyProtocolVersionByte})
|
||||
}
|
||||
|
||||
@ -24,7 +24,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
servertypes "github.com/cosmos/cosmos-sdk/server/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
@ -38,7 +37,7 @@ func init() {
|
||||
}
|
||||
|
||||
// ConsensusVersion defines the current x/upgrade module consensus version.
|
||||
const ConsensusVersion uint64 = 2
|
||||
const ConsensusVersion uint64 = 3
|
||||
|
||||
var _ module.AppModuleBasic = AppModuleBasic{}
|
||||
|
||||
@ -109,6 +108,10 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("failed to migrate x/%s from version 1 to 2: %v", types.ModuleName, err))
|
||||
}
|
||||
err = cfg.RegisterMigration(types.ModuleName, 2, m.Migrate2to3)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("failed to migrate x/%s from version 2 to 3: %v", types.ModuleName, err))
|
||||
}
|
||||
}
|
||||
|
||||
// InitGenesis is ignored, no sense in serializing future upgrades
|
||||
@ -143,7 +146,7 @@ func (AppModuleBasic) DefaultGenesis(_ codec.JSONCodec) json.RawMessage {
|
||||
}
|
||||
|
||||
// ValidateGenesis is always successful, as we ignore the value
|
||||
func (AppModuleBasic) ValidateGenesis(_ codec.JSONCodec, config client.TxEncodingConfig, _ json.RawMessage) error {
|
||||
func (AppModuleBasic) ValidateGenesis(_ codec.JSONCodec, _ client.TxEncodingConfig, _ json.RawMessage) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -179,10 +182,11 @@ func init() {
|
||||
type ModuleInputs struct {
|
||||
depinject.In
|
||||
|
||||
Config *modulev1.Module
|
||||
StoreService store.KVStoreService
|
||||
Cdc codec.Codec
|
||||
AddressCodec address.Codec
|
||||
Config *modulev1.Module
|
||||
StoreService store.KVStoreService
|
||||
Cdc codec.Codec
|
||||
AddressCodec address.Codec
|
||||
AppVersionModifier baseapp.AppVersionModifier
|
||||
|
||||
AppOpts servertypes.AppOptions `optional:"true"`
|
||||
}
|
||||
@ -192,7 +196,6 @@ type ModuleOutputs struct {
|
||||
|
||||
UpgradeKeeper *keeper.Keeper
|
||||
Module appmodule.AppModule
|
||||
BaseAppOption runtime.BaseAppOption
|
||||
}
|
||||
|
||||
func ProvideModule(in ModuleInputs) ModuleOutputs {
|
||||
@ -216,13 +219,10 @@ func ProvideModule(in ModuleInputs) ModuleOutputs {
|
||||
}
|
||||
|
||||
// set the governance module account as the authority for conducting upgrades
|
||||
k := keeper.NewKeeper(skipUpgradeHeights, in.StoreService, in.Cdc, homePath, nil, authority.String())
|
||||
baseappOpt := func(app *baseapp.BaseApp) {
|
||||
k.SetVersionSetter(app)
|
||||
}
|
||||
k := keeper.NewKeeper(skipUpgradeHeights, in.StoreService, in.Cdc, homePath, in.AppVersionModifier, authority.String())
|
||||
m := NewAppModule(k, in.AddressCodec)
|
||||
|
||||
return ModuleOutputs{UpgradeKeeper: k, Module: m, BaseAppOption: baseappOpt}
|
||||
return ModuleOutputs{UpgradeKeeper: k, Module: m}
|
||||
}
|
||||
|
||||
func PopulateVersionMap(upgradeKeeper *keeper.Keeper, modules map[string]appmodule.AppModule) {
|
||||
|
||||
@ -23,9 +23,6 @@ const (
|
||||
// VersionMapByte is a prefix to look up module names (key) and versions (value)
|
||||
VersionMapByte = 0x2
|
||||
|
||||
// ProtocolVersionByte is a prefix to look up Protocol Version
|
||||
ProtocolVersionByte = 0x3
|
||||
|
||||
// KeyUpgradedIBCState is the key under which upgraded ibc state is stored in the upgrade store
|
||||
KeyUpgradedIBCState = "upgradedIBCState"
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user