Skip to content

Commit

Permalink
Problem: memiavl setup code is not clean (#994)
Browse files Browse the repository at this point in the history
* Problem: memiavl setup code is not optimal

* use v0.0.3
  • Loading branch information
yihuang authored Jun 27, 2023
1 parent 836309b commit 8dbdee7
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 129 deletions.
3 changes: 2 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ import (
// unnamed import of statik for swagger UI support
_ "github.com/crypto-org-chain/chain-main/v4/app/docs/statik"

memiavlstore "github.com/crypto-org-chain/cronos/store"
memiavlrootmulti "github.com/crypto-org-chain/cronos/store/rootmulti"
)

Expand Down Expand Up @@ -300,7 +301,7 @@ func New(
legacyAmino := encodingConfig.Amino
interfaceRegistry := encodingConfig.InterfaceRegistry

baseAppOptions = SetupMemIAVL(logger, homePath, appOpts, baseAppOptions)
baseAppOptions = memiavlstore.SetupMemIAVL(logger, homePath, appOpts, baseAppOptions)
bApp := baseapp.NewBaseApp(appName, logger, db, encodingConfig.TxConfig.TxDecoder(), baseAppOptions...)
bApp.SetCommitMultiStoreTracer(traceStore)
bApp.SetVersion(version.Version)
Expand Down
31 changes: 0 additions & 31 deletions app/config/config.go

This file was deleted.

30 changes: 0 additions & 30 deletions app/config/toml.go

This file was deleted.

52 changes: 0 additions & 52 deletions app/memiavl.go

This file was deleted.

9 changes: 5 additions & 4 deletions cmd/chain-maind/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ import (
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"

"github.com/crypto-org-chain/chain-main/v4/app"
appcfg "github.com/crypto-org-chain/chain-main/v4/app/config"
"github.com/crypto-org-chain/chain-main/v4/app/params"
"github.com/crypto-org-chain/chain-main/v4/config"
chainmaincli "github.com/crypto-org-chain/chain-main/v4/x/chainmain/client/cli"

memiavlcfg "github.com/crypto-org-chain/cronos/store/config"
)

const EnvPrefix = "CRO"
Expand Down Expand Up @@ -101,7 +102,7 @@ func initAppConfig() (string, interface{}) {
type CustomAppConfig struct {
serverconfig.Config

MemIAVL appcfg.MemIAVLConfig `mapstructure:"memiavl"`
MemIAVL memiavlcfg.MemIAVLConfig `mapstructure:"memiavl"`
}

// Optionally allow the chain developer to overwrite the SDK's default
Expand All @@ -112,10 +113,10 @@ func initAppConfig() (string, interface{}) {

customAppConfig := CustomAppConfig{
Config: *srvCfg,
MemIAVL: appcfg.DefaultMemIAVLConfig(),
MemIAVL: memiavlcfg.DefaultMemIAVLConfig(),
}

return serverconfig.DefaultConfigTemplate + appcfg.DefaultConfigTemplate, customAppConfig
return serverconfig.DefaultConfigTemplate + memiavlcfg.DefaultConfigTemplate, customAppConfig
}

func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {
Expand Down
4 changes: 3 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
, rev ? "dirty"
, ledger_zemu ? false
, static ? stdenv.hostPlatform.isStatic
, nativeByteOrder ? true # nativeByteOrder mode will panic on big endian machines
}:
let
inherit (lib) concatStringsSep;
Expand Down Expand Up @@ -59,7 +60,8 @@ buildGoApplication rec {
"!ledger_mock"
(if ledger_zemu then "ledger_zemu" else "!ledger_zemu")
network
] ++ lib.lists.optionals (rocksdb != null) [ "rocksdb" "grocksdb_no_link" ];
] ++ lib.optionals (rocksdb != null) [ "rocksdb" "grocksdb_no_link" ]
++ lib.optionals nativeByteOrder [ "nativebyteorder" ];
ldflags = ''
-X github.com/cosmos/cosmos-sdk/version.Name=crypto-org-chain
-X github.com/cosmos/cosmos-sdk/version.AppName=${pname}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ require (
github.com/cosmos/cosmos-proto v1.0.0-alpha8
github.com/cosmos/cosmos-sdk v0.46.13
github.com/cosmos/ibc-go/v5 v5.2.1
github.com/crypto-org-chain/cronos/memiavl v0.0.3-0.20230621152914-f83c74b904cd
github.com/crypto-org-chain/cronos/store v0.0.3-0.20230621152914-f83c74b904cd
github.com/crypto-org-chain/cronos/store v0.0.3
// release/v1.0.x
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20230623043455-e162787ed0b9
github.com/gogo/protobuf v1.3.3
Expand Down Expand Up @@ -74,6 +73,7 @@ require (
github.com/cosmos/iavl v0.19.6 // indirect
github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect
github.com/creachadair/taskgroup v0.3.2 // indirect
github.com/crypto-org-chain/cronos/memiavl v0.0.3 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,10 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/crypto-org-chain/cometbft-db v0.0.0-20230412133340-ac70df4b45f6 h1:d4h4Ki1UE/LF6CKwYEm3OZ+HIBCrzSmOokG1vce0O98=
github.com/crypto-org-chain/cometbft-db v0.0.0-20230412133340-ac70df4b45f6/go.mod h1:hF5aclS++7WrW8USOA3zPeKI0CuzwUD2TPYug25ANlQ=
github.com/crypto-org-chain/cronos/memiavl v0.0.3-0.20230621152914-f83c74b904cd h1:ONnKixvnZU/tgQwcFXdMVpDyADUBXnjKaAFTk4yY/Jw=
github.com/crypto-org-chain/cronos/memiavl v0.0.3-0.20230621152914-f83c74b904cd/go.mod h1:cGIAa6KfrvtjPc9ETOcvG/lKa97kU3GWFYVN37UFQ0w=
github.com/crypto-org-chain/cronos/store v0.0.3-0.20230621152914-f83c74b904cd h1:03L84ozFAcO8K6cJk1Oy00yruiFE8AIs7AFK+z7YAsc=
github.com/crypto-org-chain/cronos/store v0.0.3-0.20230621152914-f83c74b904cd/go.mod h1:6O69W4LrmEuBM8oAKqiXIp/mrxYiGyZO+ekQiiKxdR8=
github.com/crypto-org-chain/cronos/memiavl v0.0.3 h1:oNKmV2Vp14eeW4zN/Wvr6H4iYJ5j2YTYZqQwzKNeblM=
github.com/crypto-org-chain/cronos/memiavl v0.0.3/go.mod h1:k3+p+k+HzXx+NoqULMKzai1WHm5z+9CYGO/T9EVbb4w=
github.com/crypto-org-chain/cronos/store v0.0.3 h1:sOn2lCHPIbbC+bVXg/d38M8wrlmSjJcHifeExQVPvdc=
github.com/crypto-org-chain/cronos/store v0.0.3/go.mod h1:jpkj59pegLuibS3LRb1ieD+tZG1qc78f4623fTyBa/4=
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20230623043455-e162787ed0b9 h1:kgdqW/ZIn1DmYh6795XqwNJfTSFVfFIts7XTsw09NlQ=
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20230623043455-e162787ed0b9/go.mod h1:nJHTLUNSMpAGenR70PTAv7bZu0jCU+iIuQCe4O+r3co=
github.com/crypto-org-chain/tm-db v0.6.8-0.20230424032152-87c7e7f4fb61 h1:Y5OuzOkZtjCfO53Jgzl+H8re6pOU4X205a1VMkDcUdk=
Expand Down
8 changes: 4 additions & 4 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ schema = 3
version = "v0.3.2"
hash = "sha256-Y261IO/d9xjV0UScqHvo31broxvnKn4IQQC9Mu6jNkE="
[mod."github.com/crypto-org-chain/cronos/memiavl"]
version = "v0.0.3-0.20230621152914-f83c74b904cd"
hash = "sha256-cKUm7IniQ682rFL1mXI2wr/Q15MSb3nMyUxx+6aAMz8="
version = "v0.0.3"
hash = "sha256-sWn4b1C+UDc94ccT1YZPshyx6DWxqH/jCGrw5AishFU="
[mod."github.com/crypto-org-chain/cronos/store"]
version = "v0.0.3-0.20230621152914-f83c74b904cd"
hash = "sha256-wZG6K7CmWzKPD0MQ/3ThXD50Miy+aysa9wCDWc3ONCc="
version = "v0.0.3"
hash = "sha256-oDbvuSVeK2nPcmWaLfMIHBztuDl3Mm1K2sYNlC9j27U="
[mod."github.com/crypto-org-chain/cronos/versiondb"]
version = "v0.0.0-20230623043455-e162787ed0b9"
hash = "sha256-Z+uXkJk9zUrR5uf7MHsaDX27suu3DJO4CBgcA8TG20I="
Expand Down

0 comments on commit 8dbdee7

Please sign in to comment.