Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Problem: memiavl setup code is not clean #994

Merged
merged 2 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 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
Loading