From b13e3de8d242c4eb09d90be60740e49c47ddc0d8 Mon Sep 17 00:00:00 2001 From: Valters Jansons Date: Fri, 27 Sep 2024 20:41:14 +0300 Subject: [PATCH] Automatically detect prunable application stores This removes various dependencies, making the project slimmer, while at the same time allowing it to be more portable across chains (without having to hard-code them). This furthermore eliminates human effort needed at chain upgrades, which may add or remove specific application.db stores. --- README.md | 43 +--- cmd/pruner.go | 499 ++---------------------------------- cmd/root.go | 7 - go.mod | 27 -- go.sum | 16 -- internal/rootmulti/store.go | 8 + 6 files changed, 27 insertions(+), 573 deletions(-) diff --git a/README.md b/README.md index 0baa7ef..6fdb1ff 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ The goal of this project is to be able to prune a tendermint data base of blocks and an Cosmos-sdk application DB of all but the last X versions. This will allow people to not have to state sync every x days. -This tool works with a subset of modules. While an application may have modules outside the scope of this tool , this tool will prune the default sdk module, and osmosis added module. +This tool works with a subset of modules (store keys). They are automatically detected based on the stored data. ## WARNING @@ -35,51 +35,10 @@ Flags: - `data-dir`: path to data directory if not default - `blocks`: amount of blocks to keep on the node (Default 10) - `versions`: amount of app state versions to keep on the node (Default 10) -- `app`: the application you want to prune, outside the sdk default modules. See `Supported Apps` - `cosmos-sdk`: If pruning a non cosmos-sdk chain, like Nomic, you only want to use tendermint pruning or if you want to only prune tendermint block & state as this is generally large on machines(Default true) - `tendermint`: If the user wants to only prune application data they can disable pruning of tendermint data. (Default true) -#### Supported Apps: -- osmosis: Osmosis -- starname: Starname -- regen: Regen -- akash: Akash -- cosmoshub: Gaia -- sentinel: Sentinel -- emoney: E-Money -- ixo: Ixo -- juno: Juno -- sifchain: Sifchain -- likecoin: Likecoin -- kichain: Ki -- cyber: Cyber -- cheqd: Cheqd -- stargaze: Stargaze -- bandchain: Band -- chihuahua: Chihuahua -- kava: Kava -- bitcanna: BitCanna -- konstellation: Konstellation -- omniflixhub: Omniflix -- terra: Terra -- vidulum: Vidulum -- provenance: Provenance -- dig: Dig -- gravitybridge: Gravity-Bridge -- comdex: Comdex -- cerberus: Cerberus -- bitsong: BitSong -- assetmantle: AssetMantle -- fetchhub: FetchAI -- evmos: Evmos -- persistent: Persistence -- cryptoorgchain: Crypto.org -- irisnet: IRISnet -- axelar: Axelar -- umee: Umee - - ### Note To use this with RocksDB you must: diff --git a/cmd/pruner.go b/cmd/pruner.go index c40bda7..1dff53f 100644 --- a/cmd/pruner.go +++ b/cmd/pruner.go @@ -7,23 +7,6 @@ import ( "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" - consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" - authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" - feegrant "github.com/cosmos/cosmos-sdk/x/feegrant" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - ibctransfertypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types" - ibchost "github.com/cosmos/ibc-go/v2/modules/core/24-host" "github.com/neilotoole/errgroup" "github.com/spf13/cobra" "github.com/syndtr/goleveldb/leveldb/opt" @@ -92,476 +75,30 @@ func pruneAppState(home string) error { //TODO: need to get all versions in the store, setting randomly is too slow fmt.Println("pruning application state") - // only mount keys from core sdk - // todo allow for other keys to be mounted - keys := types.NewKVStoreKeys( - authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey, - minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, - govtypes.StoreKey, paramstypes.StoreKey, consensusparamtypes.StoreKey, - ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, - evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey, - authzkeeper.StoreKey, - ) - - if app == "osmosis" { - osmoKeys := types.NewKVStoreKeys( - "icahost", //icahosttypes.StoreKey, - "gamm", // gammtypes.StoreKey, - "lockup", //lockuptypes.StoreKey, - "incentives", // incentivestypes.StoreKey, - "epochs", // epochstypes.StoreKey, - "poolincentives", //poolincentivestypes.StoreKey, - "txfees", // txfeestypes.StoreKey, - "superfluid", // superfluidtypes.StoreKey, - "bech32ibc", // bech32ibctypes.StoreKey, - "wasm", // wasm.StoreKey, - "tokenfactory", //tokenfactorytypes.StoreKey, - ) - for key, value := range osmoKeys { - keys[key] = value - } - } else if app == "cosmoshub" { - cosmoshubKeys := types.NewKVStoreKeys( - "liquidity", - "icahost", // icahosttypes.StoreKey - ) - for key, value := range cosmoshubKeys { - keys[key] = value - } - } else if app == "terra" { // terra classic - terraKeys := types.NewKVStoreKeys( - "oracle", // oracletypes.StoreKey, - "market", // markettypes.StoreKey, - "treasury", //treasurytypes.StoreKey, - "wasm", // wasmtypes.StoreKey, - ) - for key, value := range terraKeys { - keys[key] = value - } - } else if app == "kava" { - kavaKeys := types.NewKVStoreKeys( - "feemarket", //feemarkettypes.StoreKey, - "kavadist", //kavadisttypes.StoreKey, - "auction", //auctiontypes.StoreKey, - "issuance", //issuancetypes.StoreKey, - "bep3", //bep3types.StoreKey, - //"pricefeed", //pricefeedtypes.StoreKey, - //"swap", //swaptypes.StoreKey, - "cdp", //cdptypes.StoreKey, - "hard", //hardtypes.StoreKey, - "committee", //committeetypes.StoreKey, - "incentive", //incentivetypes.StoreKey, - "evmutil", //evmutiltypes.StoreKey, - "savings", //savingstypes.StoreKey, - "bridge", //bridgetypes.StoreKey, - ) - for key, value := range kavaKeys { - keys[key] = value - } - - delete(keys, "mint") // minttypes.StoreKey - } else if app == "evmos" { - evmosKeys := types.NewKVStoreKeys( - "evm", // evmtypes.StoreKey, - "feemarket", // feemarkettypes.StoreKey, - "inflation", // inflationtypes.StoreKey, - "erc20", // erc20types.StoreKey, - "incentives", // incentivestypes.StoreKey, - "epochs", // epochstypes.StoreKey, - "claims", // claimstypes.StoreKey, - "vesting", // vestingtypes.StoreKey, - ) - for key, value := range evmosKeys { - keys[key] = value - } - } else if app == "gravitybridge" { - gravitybridgeKeys := types.NewKVStoreKeys( - "gravity", // gravitytypes.StoreKey, - "bech32ibc", // bech32ibctypes.StoreKey, - ) - for key, value := range gravitybridgeKeys { - keys[key] = value - } - } else if app == "sifchain" { - sifchainKeys := types.NewKVStoreKeys( - "dispensation", // disptypes.StoreKey, - "ethbridge", // ethbridgetypes.StoreKey, - "clp", // clptypes.StoreKey, - "oracle", // oracletypes.StoreKey, - "tokenregistry", // tokenregistrytypes.StoreKey, - "admin", // admintypes.StoreKey, - ) - for key, value := range sifchainKeys { - keys[key] = value - } - } else if app == "starname" { - starnameKeys := types.NewKVStoreKeys( - "wasm", // wasm.StoreKey, - "configuration", // configuration.StoreKey, - "starname", // starname.DomainStoreKey, - ) - for key, value := range starnameKeys { - keys[key] = value - } - } else if app == "regen" { - regenKeys := types.NewKVStoreKeys( - ) - for key, value := range regenKeys { - keys[key] = value - } - } else if app == "akash" { - akashKeys := types.NewKVStoreKeys( - "escrow", // escrow.StoreKey, - "deployment", // deployment.StoreKey, - "market", // market.StoreKey, - "provider", // provider.StoreKey, - "audit", // audit.StoreKey, - "cert", // cert.StoreKey, - "inflation", // inflation.StoreKey, - ) - for key, value := range akashKeys { - keys[key] = value - } - } else if app == "sentinel" { - sentinelKeys := types.NewKVStoreKeys( - "distribution", // distributiontypes.StoreKey, - "custommint", // customminttypes.StoreKey, - "swap", // swaptypes.StoreKey, - "vpn", // vpntypes.StoreKey, - ) - for key, value := range sentinelKeys { - keys[key] = value - } - } else if app == "emoney" { - emoneyKeys := types.NewKVStoreKeys( - "liquidityprovider", // lptypes.StoreKey, - "issuer", // issuer.StoreKey, - "authority", // authority.StoreKey, - "market", // market.StoreKey, - //"market_indices", // market.StoreKeyIdx, - "buyback", // buyback.StoreKey, - "inflation", // inflation.StoreKey, - ) - - for key, value := range emoneyKeys { - keys[key] = value - } - } else if app == "ixo" { - ixoKeys := types.NewKVStoreKeys( - "did", // didtypes.StoreKey, - "bonds", // bondstypes.StoreKey, - "payments", // paymentstypes.StoreKey, - "project", // projecttypes.StoreKey, - ) - - for key, value := range ixoKeys { - keys[key] = value - } - } else if app == "juno" { - junoKeys := types.NewKVStoreKeys( - "icahost", // icahosttypes.StoreKey, - "wasm", // wasm.StoreKey, - ) - - for key, value := range junoKeys { - keys[key] = value - } - } else if app == "likecoin" { - likecoinKeys := types.NewKVStoreKeys( - // custom modules - "iscn", // iscntypes.StoreKey, - "nft", // nftkeeper.StoreKey, - "likenft", // likenfttypes.StoreKey, - ) - - for key, value := range likecoinKeys { - keys[key] = value - } - } else if app == "teritori" { - // https://github.com/TERITORI/teritori-chain/blob/main/app/app.go#L323 - teritoriKeys := types.NewKVStoreKeys( - // common modules - "packetfowardmiddleware", // routertypes.StoreKey, - "icahost", // icahosttypes.StoreKey, - "wasm", // wasm.StoreKey, - // custom modules - "airdrop", // airdroptypes.StoreKey, - ) - - for key, value := range teritoriKeys { - keys[key] = value - } - } else if app == "jackal" { - // https://github.com/JackalLabs/canine-chain/blob/master/app/app.go#L347 - jackalKeys := types.NewKVStoreKeys( - // common modules - "wasm", // wasm.StoreKey, - "icahost", // icahosttypes.StoreKey, - // custom modules - "icacontroller", // icacontrollertypes.StoreKey, https://github.com/cosmos/ibc-go/blob/main/modules/apps/27-interchain-accounts/controller/types/keys.go#L5 - // intertx is a demo and not an officially supported IBC team implementation - "intertx", // intertxtypes.StoreKey, https://github.com/cosmos/interchain-accounts-demo/blob/8d4683081df0e1945be40be8ac18aa182106a660/x/inter-tx/types/keys.go#L4 - "rns", // rnsmoduletypes.StoreKey, https://github.com/JackalLabs/canine-chain/blob/master/x/rns/types/keys.go#L5 - "storage", // storagemoduletypes.StoreKey, https://github.com/JackalLabs/canine-chain/blob/master/x/storage/types/keys.go#L5 - "dsig", // dsigmoduletypes.StoreKey, https://github.com/JackalLabs/canine-chain/blob/master/x/dsig/types/keys.go#L5 - "filetree", // filetreemoduletypes.StoreKey, https://github.com/JackalLabs/canine-chain/blob/master/x/filetree/types/keys.go#L5 - "notifications", // notificationsmoduletypes.StoreKey, https://github.com/JackalLabs/canine-chain/blob/master/x/notifications/types/keys.go#L5 - "jklmint", // jklmintmoduletypes.StoreKey, https://github.com/JackalLabs/canine-chain/blob/master/x/jklmint/types/keys.go#L7 - "lp", // lpmoduletypes.StoreKey, https://github.com/JackalLabs/canine-chain/blob/master/x/lp/types/keys.go#L5 - "oracle", // https://github.com/JackalLabs/canine-chain/blob/master/x/oracle/types/keys.go#L5 - ) - - for key, value := range jackalKeys { - keys[key] = value - } - } else if app == "kichain" { - kichainKeys := types.NewKVStoreKeys( - "wasm", // wasm.StoreKey, - ) - - for key, value := range kichainKeys { - keys[key] = value - } - } else if app == "cyber" { - cyberKeys := types.NewKVStoreKeys( - "liquidity", // liquiditytypes.StoreKey, - "bandwidth", // bandwidthtypes.StoreKey, - "graph", // graphtypes.StoreKey, - "rank", // ranktypes.StoreKey, - "grid", // gridtypes.StoreKey, - "dmn", // dmntypes.StoreKey, - "wasm", // wasm.StoreKey, - ) - - for key, value := range cyberKeys { - keys[key] = value - } - } else if app == "cheqd" { - cheqdKeys := types.NewKVStoreKeys( - "cheqd", // cheqdtypes.StoreKey, - ) - - for key, value := range cheqdKeys { - keys[key] = value - } - } else if app == "stargaze" { - stargazeKeys := types.NewKVStoreKeys( - "claim", // claimmoduletypes.StoreKey, - "alloc", // allocmoduletypes.StoreKey, - "wasm", // wasm.StoreKey, - ) - - for key, value := range stargazeKeys { - keys[key] = value - } - } else if app == "bandchain" { - bandchainKeys := types.NewKVStoreKeys( - "oracle", // oracletypes.StoreKey, - ) - - for key, value := range bandchainKeys { - keys[key] = value - } - } else if app == "chihuahua" { - chihuahuaKeys := types.NewKVStoreKeys( - "wasm", // wasm.StoreKey, - ) - - for key, value := range chihuahuaKeys { - keys[key] = value - } - } else if app == "bitcanna" { - bitcannaKeys := types.NewKVStoreKeys( - "bcna", // bcnamoduletypes.StoreKey, - ) - - for key, value := range bitcannaKeys { - keys[key] = value - } - } else if app == "konstellation" { - konstellationKeys := types.NewKVStoreKeys( - "oracle", // racletypes.StoreKey, - "wasm", // wasm.StoreKey, - ) - - for key, value := range konstellationKeys { - keys[key] = value - } - } else if app == "omniflixhub" { - omniflixhubKeys := types.NewKVStoreKeys( - "alloc", // alloctypes.StoreKey, - "onft", // onfttypes.StoreKey, - "marketplace", // marketplacetypes.StoreKey, - ) - - for key, value := range omniflixhubKeys { - keys[key] = value - } - } else if app == "vidulum" { - vidulumKeys := types.NewKVStoreKeys( - "vidulum", // vidulummoduletypes.StoreKey, - ) - - for key, value := range vidulumKeys { - keys[key] = value - } - } else if app == "beezee" { - beezeeKeys := types.NewKVStoreKeys( - "scavenge", //scavengemodule.Storekey, - ) - - for key, value := range beezeeKeys { - keys[key] = value - } - } else if app == "provenance" { - provenanceKeys := types.NewKVStoreKeys( - "metadata", // metadatatypes.StoreKey, - "marker", // markertypes.StoreKey, - "attribute", // attributetypes.StoreKey, - "name", // nametypes.StoreKey, - "msgfees", // msgfeestypes.StoreKey, - "wasm", // wasm.StoreKey, - ) - - for key, value := range provenanceKeys { - keys[key] = value - } - } else if app == "dig" { - digKeys := types.NewKVStoreKeys( - "wasm", // wasm.StoreKey, - ) - - for key, value := range digKeys { - keys[key] = value - } - } else if app == "comdex" { - comdexKeys := types.NewKVStoreKeys( - "wasm", // wasm.StoreKey, - ) - - for key, value := range comdexKeys { - keys[key] = value - } - } else if app == "bitsong" { - bitsongKeys := types.NewKVStoreKeys( - "packetfowardmiddleware", // routertypes.StoreKey, - "fantoken", // fantokentypes.StoreKey, - "merkledrop", // merkledroptypes.StoreKey, - ) - - for key, value := range bitsongKeys { - keys[key] = value - } - } else if app == "assetmantle" { - assetmantleKeys := types.NewKVStoreKeys( - "packetfowardmiddleware", // routerTypes.StoreKey, - "icahost", // icaHostTypes.StoreKey, - ) - - for key, value := range assetmantleKeys { - keys[key] = value - } - } else if app == "fetchhub" { - fetchhubKeys := types.NewKVStoreKeys( - "wasm", // wasm.StoreKey, - ) - - for key, value := range fetchhubKeys { - keys[key] = value - } - } else if app == "persistent" { - persistentKeys := types.NewKVStoreKeys( - "halving", // halving.StoreKey, - ) + appStore := rootmulti.NewStore(appDB) + ver := rootmulti.GetLatestVersion(appDB) - for key, value := range persistentKeys { - keys[key] = value - } - } else if app == "cryptoorgchain" { - cryptoorgchainKeys := types.NewKVStoreKeys( - "chainmain", // chainmaintypes.StoreKey, - "supply", // supplytypes.StoreKey, - "nft", // nfttypes.StoreKey, - ) - - for key, value := range cryptoorgchainKeys { - keys[key] = value - } - } else if app == "irisnet" { - irisnetKeys := types.NewKVStoreKeys( - "guardian", // guardiantypes.StoreKey, - "token", // tokentypes.StoreKey, - "nft", // nfttypes.StoreKey, - "htlc", // htlctypes.StoreKey, - "record", // recordtypes.StoreKey, - "coinswap", // coinswaptypes.StoreKey, - "service", // servicetypes.StoreKey, - "oracle", // oracletypes.StoreKey, - "random", // randomtypes.StoreKey, - "farm", // farmtypes.StoreKey, - "tibc", // tibchost.StoreKey, - "NFT", // tibcnfttypes.StoreKey, - "MT", // tibcmttypes.StoreKey, - "mt", // mttypes.StoreKey, - ) - - for key, value := range irisnetKeys { - keys[key] = value - } - } else if app == "axelar" { - axelarKeys := types.NewKVStoreKeys( - "vote", // voteTypes.StoreKey, - "evm", // evmTypes.StoreKey, - "snapshot", // snapTypes.StoreKey, - "multisig", // multisigTypes.StoreKey, - "tss", // tssTypes.StoreKey, - "nexus", // nexusTypes.StoreKey, - "axelarnet", // axelarnetTypes.StoreKey, - "reward", // rewardTypes.StoreKey, - "permission", // permissionTypes.StoreKey, - "wasm", // wasm.StoreKey, - ) - - for key, value := range axelarKeys { - keys[key] = value + // find all available keys in database + storeNames := []string{} + if ver != 0 { + cInfo, err := appStore.GetCommitInfo(ver) + if err != nil { + return err } - } else if app == "umee" { - umeeKeys := types.NewKVStoreKeys( - "gravity", // gravitytypes.StoreKey, - ) - for key, value := range umeeKeys { - keys[key] = value - } - } else if app == "desmos" { - // https://github.com/desmos-labs/desmos/blob/master/app/app.go#L255 - desmosKeys := types.NewKVStoreKeys( - // common modules - "wasm", // wasm.StoreKey, - // IBC modules - "icacontroller", // icacontrollertypes.StoreKey, https://github.com/cosmos/ibc-go/blob/main/modules/apps/27-interchain-accounts/controller/types/keys.go#L5 - "icahost", // icahosttypes.StoreKey, - // mainnet since v4.7.0 - "profiles", // profilestypes.StoreKey, - "relationships", // relationshipstypes.StoreKey, - "subspaces", // subspacestypes.StoreKey, - "posts", // poststypes.StoreKey, - "reports", // reports.StoreKey, - "reactions", // reactions.StoreKey, - "fees", // fees.StoreKey, - // mainnet since v6.0 - "supply", - "tokenfactory", - ) - - for key, value := range desmosKeys { - keys[key] = value + for _, storeInfo := range cInfo.StoreInfos { + // we only want to prune the stores with actual data. + // sometimes in-memory stores get leaked to disk without data. + // if that happens, the store's computed hash is empty as well. + if len(storeInfo.CommitId.Hash) > 0 { + storeNames = append(storeNames, storeInfo.Name) + } else { + fmt.Println("skipping", storeInfo.Name, "store due to empty hash") + } } } - // TODO: cleanup app state - appStore := rootmulti.NewStore(appDB) - + keys := types.NewKVStoreKeys(storeNames...) for _, value := range keys { appStore.MountStoreWithDB(value, sdk.StoreTypeIAVL, nil) } diff --git a/cmd/root.go b/cmd/root.go index 29adcb8..9aeb0c3 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -11,7 +11,6 @@ var ( homePath string dataDir string backend string - app string cosmosSdk bool tendermint bool blocks uint64 @@ -54,12 +53,6 @@ func NewRootCmd() *cobra.Command { panic(err) } - // --app flag - rootCmd.PersistentFlags().StringVar(&app, "app", "", "set the app you are pruning (supported apps: osmosis)") - if err := viper.BindPFlag("app", rootCmd.PersistentFlags().Lookup("app")); err != nil { - panic(err) - } - // --cosmos-sdk flag rootCmd.PersistentFlags().BoolVar(&cosmosSdk, "cosmos-sdk", true, "set to false if using only with tendermint (default true)") if err := viper.BindPFlag("cosmos-sdk", rootCmd.PersistentFlags().Lookup("cosmos-sdk")); err != nil { diff --git a/go.mod b/go.mod index a4488e4..01d1928 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,6 @@ go 1.17 require ( github.com/cosmos/cosmos-sdk v0.45.2-0.20220209090836-4161d2b6022a github.com/cosmos/iavl v0.17.3 - github.com/cosmos/ibc-go/v2 v2.0.2 github.com/gogo/protobuf v1.3.3 github.com/neilotoole/errgroup v0.1.5 github.com/pkg/errors v0.9.1 @@ -18,60 +17,40 @@ require ( ) require ( - filippo.io/edwards25519 v1.0.0-beta.2 // indirect - github.com/99designs/keyring v1.1.6 // indirect - github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect github.com/DataDog/zstd v1.4.5 // indirect github.com/armon/go-metrics v0.3.10 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/bgentry/speakeasy v0.1.0 // indirect github.com/btcsuite/btcd v0.22.0-beta // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/confio/ics23/go v0.6.6 // indirect github.com/cosmos/btcutil v1.0.4 // indirect - github.com/cosmos/go-bip39 v1.0.0 // indirect - github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect - github.com/cosmos/ledger-go v0.9.2 // indirect - github.com/danieljoos/wincred v1.0.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dgraph-io/badger/v2 v2.2007.3 // indirect github.com/dgraph-io/ristretto v0.0.3 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/dustin/go-humanize v1.0.0 // indirect - github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b // indirect github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c // indirect github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 // indirect github.com/fsnotify/fsnotify v1.5.1 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.0 // indirect github.com/go-logfmt/logfmt v0.5.1 // indirect - github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.3 // indirect github.com/google/btree v1.0.0 // indirect - github.com/gorilla/mux v1.8.0 // indirect - github.com/gorilla/websocket v1.4.2 // indirect - github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect - github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/gtank/merlin v0.1.1 // indirect - github.com/gtank/ristretto255 v0.1.2 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d // indirect github.com/libp2p/go-buffer-pool v0.0.2 // indirect github.com/magiconair/properties v1.8.5 // indirect - github.com/mattn/go-isatty v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 // indirect - github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.4.3 // indirect - github.com/mtibben/percent v0.2.1 // indirect github.com/pelletier/go-toml v1.9.4 // indirect github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect @@ -79,8 +58,6 @@ require ( github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.30.0 // indirect github.com/prometheus/procfs v0.7.3 // indirect - github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect - github.com/regen-network/cosmos-proto v0.3.1 // indirect github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect github.com/spf13/afero v1.6.0 // indirect github.com/spf13/cast v1.4.1 // indirect @@ -89,15 +66,11 @@ require ( github.com/stretchr/objx v0.3.0 // indirect github.com/subosito/gotenv v1.2.0 // indirect github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect - github.com/tendermint/btcd v0.1.1 // indirect - github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect github.com/tendermint/go-amino v0.16.0 // indirect - github.com/zondax/hid v0.9.0 // indirect go.etcd.io/bbolt v1.3.6 // indirect golang.org/x/crypto v0.0.0-20210915214749-c084706c2272 // indirect golang.org/x/net v0.0.0-20211005001312-d4b1ae081e3b // indirect golang.org/x/sys v0.0.0-20211205182925-97ca703d548d // indirect - golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect golang.org/x/text v0.3.7 // indirect google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect google.golang.org/grpc v1.42.0 // indirect diff --git a/go.sum b/go.sum index 3c5e068..3636f29 100644 --- a/go.sum +++ b/go.sum @@ -92,7 +92,6 @@ github.com/VictoriaMetrics/fastcache v1.5.7/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6Ro github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= -github.com/Workiva/go-datastructures v1.0.53 h1:J6Y/52yX10Xc5JjXmGtWoSSxs3mZnGSaq37xZZh7Yig= github.com/Workiva/go-datastructures v1.0.53/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t5BnDuE2Ya2MMGhzP6A= github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6/go.mod h1:eSYp2T6f0apnuW8TzhV3f6Aff2SE8Dwio++U4ha4yEM= github.com/adlio/schema v1.1.13/go.mod h1:L5Z7tw+7lRK1Fnpi/LT/ooCP1elkXn0krMWBQHUhEDE= @@ -193,8 +192,6 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/coinbase/rosetta-sdk-go v0.6.10/go.mod h1:J/JFMsfcePrjJZkwQFLh+hJErkAmdm9Iyy3D5Y0LfXo= -github.com/coinbase/rosetta-sdk-go v0.7.0 h1:lmTO/JEpCvZgpbkOITL95rA80CPKb5CtMzLaqF2mCNg= github.com/coinbase/rosetta-sdk-go v0.7.0/go.mod h1:7nD3oBPIiHqhRprqvMgPoGxe/nyq3yftRmpsy29coWE= github.com/confio/ics23/go v0.6.6 h1:pkOy18YxxJ/r0XFDCnrl4Bjv6h4LkBSpLS6F38mrKL8= github.com/confio/ics23/go v0.6.6/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= @@ -214,7 +211,6 @@ github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfc github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44= github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU= -github.com/cosmos/cosmos-sdk v0.44.5/go.mod h1:maUA6m2TBxOJZkbwl0eRtEBgTX37kcaiOWU5t1HEGaY= github.com/cosmos/cosmos-sdk v0.45.2-0.20220209090836-4161d2b6022a h1:VyCw2TF4lUBe7oQ8MCv9QX+JsAO40SmlAp/F08tix3I= github.com/cosmos/cosmos-sdk v0.45.2-0.20220209090836-4161d2b6022a/go.mod h1:XXS/asyCqWNWkx2rW6pSuen+EVcpAFxq6khrhnZgHaQ= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= @@ -222,8 +218,6 @@ 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/iavl v0.17.3 h1:s2N819a2olOmiauVa0WAhoIJq9EhSXE9HDBAoR9k+8Y= github.com/cosmos/iavl v0.17.3/go.mod h1:prJoErZFABYZGDHka1R6Oay4z9PrNeFFiMKHDAMOi4w= -github.com/cosmos/ibc-go/v2 v2.0.2 h1:y7eUgggMEVe43wHLw9XrGbeaTWtfkJYMoL3m6YW4fIY= -github.com/cosmos/ibc-go/v2 v2.0.2/go.mod h1:XUmW7wmubCRhIEAGtMGS+5IjiSSmcAwihoN/yPGd6Kk= github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI= @@ -243,7 +237,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= -github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= github.com/dgraph-io/badger/v2 v2.2007.3 h1:Sl9tQWz92WCbVSe8pj04Tkqlm2boW+KAxd+XSs58SQI= @@ -422,7 +415,6 @@ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXi github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= -github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -538,7 +530,6 @@ github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3 github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/improbable-eng/grpc-web v0.14.1 h1:NrN4PY71A6tAz2sKDvC5JCauENWp0ykG8Oq1H3cpFvw= github.com/improbable-eng/grpc-web v0.14.1/go.mod h1:zEjGHa8DAlkoOXmswrNvhUGEYQA9UI7DhrGeHR1DMGU= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= @@ -581,7 +572,6 @@ github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6 github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= 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= @@ -601,7 +591,6 @@ github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgx github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.3/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.4 h1:SO9z7FRPzA03QhHKJrH5BXA6HU1rS4V2nIVrrNC1iYk= github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= @@ -645,7 +634,6 @@ github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0 github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= -github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= @@ -734,7 +722,6 @@ github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnh github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/openzipkin/zipkin-go v0.2.5/go.mod h1:KpXfKdgRDnnhsxw4pNIH9Md5lyFqKUa4YDFlwRYAMyE= github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= -github.com/otiai10/copy v1.6.0 h1:IinKAryFFuPONZ7cm6T6E2QX/vcJwSnlaA5lfoaXIiQ= github.com/otiai10/copy v1.6.0/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= @@ -826,11 +813,9 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.8.0 h1:P2KMzcFwrPoSjkF1WLRPsp3UMLyql8L4v9hQpVeK5so= github.com/rs/cors v1.8.0/go.mod h1:EBwu+T5AvHOcXwvZIkQFjUN6s8Czyqw12GL/Y0tUyRM= github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= -github.com/rs/zerolog v1.23.0 h1:UskrK+saS9P9Y789yNNulYKdARjPZuS35B8gJF2x60g= github.com/rs/zerolog v1.23.0/go.mod h1:6c7hFfxPOy7TacJc4Fcdi24/J0NKYGzjG8FWRI916Qo= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -1565,7 +1550,6 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= 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= -nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/internal/rootmulti/store.go b/internal/rootmulti/store.go index ec9888b..034e248 100644 --- a/internal/rootmulti/store.go +++ b/internal/rootmulti/store.go @@ -1039,6 +1039,14 @@ func commitStores(version int64, storeMap map[types.StoreKey]types.CommitKVStore } } +func (rs *Store) GetCommitInfo(ver int64) (*types.CommitInfo, error) { + cInfo, err := getCommitInfo(rs.db, ver) + if err != nil { + return nil, err + } + return cInfo, nil +} + // Gets commitInfo from disk. func getCommitInfo(db dbm.DB, ver int64) (*types.CommitInfo, error) { cInfoKey := fmt.Sprintf(commitInfoKeyFmt, ver)