From cb38999298fd99fd0c26e0744c522a2f1cdac15a Mon Sep 17 00:00:00 2001 From: vuong Date: Tue, 21 Nov 2023 13:08:30 +0700 Subject: [PATCH 1/2] minor --- app/upgrades/prefix/constants.go | 17 ----------------- app/upgrades/prefix/upgrade.go | 24 ------------------------ 2 files changed, 41 deletions(-) delete mode 100644 app/upgrades/prefix/constants.go delete mode 100644 app/upgrades/prefix/upgrade.go diff --git a/app/upgrades/prefix/constants.go b/app/upgrades/prefix/constants.go deleted file mode 100644 index 4a48be069..000000000 --- a/app/upgrades/prefix/constants.go +++ /dev/null @@ -1,17 +0,0 @@ -package v7 - -import ( - store "github.com/cosmos/cosmos-sdk/store/types" - "github.com/notional-labs/composable/v6/app/upgrades" -) - -const ( - // UpgradeName defines the on-chain upgrade name for the composable upgrade. - UpgradeName = "prefix-change" -) - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{}, -} diff --git a/app/upgrades/prefix/upgrade.go b/app/upgrades/prefix/upgrade.go deleted file mode 100644 index 64bb6df4f..000000000 --- a/app/upgrades/prefix/upgrade.go +++ /dev/null @@ -1,24 +0,0 @@ -package v7 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - "github.com/notional-labs/composable/v6/app/keepers" - "github.com/notional-labs/composable/v6/app/upgrades" -) - -func CreateUpgradeHandler( - mm *module.Manager, - configurator module.Configurator, - _ upgrades.BaseAppParamManager, - cdc codec.Codec, - keepers *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - return mm.RunMigrations(ctx, configurator, vm) - } -} From 2686feec865cbd1c10001e7357c3bda9648e97f5 Mon Sep 17 00:00:00 2001 From: vuong Date: Tue, 21 Nov 2023 15:51:21 +0700 Subject: [PATCH 2/2] minor --- x/tx-boundary/keeper/keeper.go | 59 ---------------------------------- x/tx-boundary/types/keys.go | 6 ---- 2 files changed, 65 deletions(-) diff --git a/x/tx-boundary/keeper/keeper.go b/x/tx-boundary/keeper/keeper.go index 160a2cc9d..145c62807 100644 --- a/x/tx-boundary/keeper/keeper.go +++ b/x/tx-boundary/keeper/keeper.go @@ -1,7 +1,6 @@ package keeper import ( - "encoding/binary" "fmt" "github.com/cometbft/cometbft/libs/log" @@ -181,61 +180,3 @@ func (k Keeper) UpdateLimitPerAddr(ctx sdk.Context, addr sdk.AccAddress) { return } } - -func (k Keeper) PushChangeValSetTxs(ctx sdk.Context, txs [][]byte) { - store := ctx.KVStore(k.storeKey) - for _, tx := range txs { - byteCount := k.IncrementTxCount(ctx) - txKey := append(types.TxKey, byteCount...) - - store.Set(txKey, tx) - } - -} - -func (k Keeper) GetChangeValSetTxs(ctx sdk.Context) (txs [][]byte) { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.TxKey) - - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - txs = append(txs, iterator.Value()) - } - return txs -} - -func (k Keeper) ResetChangeValSetTxs(ctx sdk.Context) { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.TxKey) - - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - store.Delete(iterator.Key()) - } - -} - -func (k Keeper) IncrementTxCount(ctx sdk.Context) []byte { - count := uint64(0) - - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.TxCountKey) - - if bz != nil { - count = binary.LittleEndian.Uint64(bz) + 1 - } - - b := make([]byte, 8) - binary.LittleEndian.PutUint64(b, count) - - store.Set(types.TxCountKey, b) - - return b -} - -func (k Keeper) ResetTxCount(ctx sdk.Context) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.TxCountKey) -} diff --git a/x/tx-boundary/types/keys.go b/x/tx-boundary/types/keys.go index edd9febbb..4d2cff8e8 100644 --- a/x/tx-boundary/types/keys.go +++ b/x/tx-boundary/types/keys.go @@ -14,10 +14,4 @@ var ( // RedelegateBoundaryKey is the key to use for the keeper store. RedelegateBoundaryKey = []byte{0x01} - - // TxKey is the key to use for the keeper store. - TxKey = []byte{0x02} - - // TxCountKey is the key to use for the keeper store. - TxCountKey = []byte{0x03} )