Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Commit

Permalink
account init
Browse files Browse the repository at this point in the history
  • Loading branch information
taryune committed Feb 20, 2024
1 parent 0521f19 commit 110f2a2
Show file tree
Hide file tree
Showing 43 changed files with 94,690 additions and 14,098 deletions.
2 changes: 1 addition & 1 deletion app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante"
"github.com/cosmos/ibc-go/v8/modules/core/keeper"

corestoretypes "cosmossdk.io/core/store"
errorsmod "cosmossdk.io/errors"

corestoretypes "cosmossdk.io/core/store"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
Expand Down
42 changes: 20 additions & 22 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ import (
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/spf13/cast"

"cosmossdk.io/client/v2/autocli"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/log"
abci "github.com/cometbft/cometbft/abci/types"
tmos "github.com/cometbft/cometbft/libs/os"
dbm "github.com/cosmos/cosmos-db"

addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
"github.com/cosmos/cosmos-sdk/std"
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/ibc-go/modules/capability"
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
ica "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts"
icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper"
icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"
Expand All @@ -40,8 +38,9 @@ import (

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec"

"cosmossdk.io/client/v2/autocli"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"
"cosmossdk.io/x/evidence"
evidencekeeper "cosmossdk.io/x/evidence/keeper"
Expand All @@ -52,22 +51,26 @@ import (
"cosmossdk.io/x/upgrade"
upgradekeeper "cosmossdk.io/x/upgrade/keeper"
upgradetypes "cosmossdk.io/x/upgrade/types"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/grpc/cmtservice"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
"github.com/cosmos/cosmos-sdk/codec"
addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/runtime"
runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services"
"github.com/cosmos/cosmos-sdk/server/api"
"github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/std"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
Expand Down Expand Up @@ -114,21 +117,16 @@ import (
"github.com/cosmos/cosmos-sdk/x/staking"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/ibc-go/modules/capability"
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"

appparams "github.com/mycel-domain/mycel/app/params"
"github.com/mycel-domain/mycel/docs"

// Epochs
epochsmodule "github.com/mycel-domain/mycel/x/epochs"
epochsmodulekeeper "github.com/mycel-domain/mycel/x/epochs/keeper"
epochsmoduletypes "github.com/mycel-domain/mycel/x/epochs/types"
furnacemodule "github.com/mycel-domain/mycel/x/furnace"
furnacemodulekeeper "github.com/mycel-domain/mycel/x/furnace/keeper"
furnacemoduletypes "github.com/mycel-domain/mycel/x/furnace/types"

// Registry
registrymodule "github.com/mycel-domain/mycel/x/registry"
registrymodulekeeper "github.com/mycel-domain/mycel/x/registry/keeper"
Expand All @@ -139,7 +137,9 @@ import (
)

const (
Name = "myceld"
Name = "mycel"
DefaultGasLimit int64 = 50000000
DefaultVoteExtensionsEnableHeight = 1
)

// this line is used by starport scaffolding # stargate/wasm/app/enabledProposals
Expand Down Expand Up @@ -300,10 +300,10 @@ func NewApp(
baseAppOptions ...func(*baseapp.BaseApp),
) *App {
encCfg := appparams.DefaultEncodingConfig()
interfaceRegistry := encCfg.InterfaceRegistry
appCodec := encCfg.Marshaler
legacyAmino := encCfg.Amino
txConfig := encCfg.TxConfig
interfaceRegistry := encCfg.InterfaceRegistry
appCodec := encCfg.Marshaler
legacyAmino := encCfg.Amino
txConfig := encCfg.TxConfig
std.RegisterLegacyAminoCodec(legacyAmino)
std.RegisterInterfaces(interfaceRegistry)

Expand Down Expand Up @@ -390,11 +390,10 @@ func NewApp(
runtime.NewKVStoreService(keys[authtypes.StoreKey]),
authtypes.ProtoBaseAccount,
maccPerms,
addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()),
sdk.GetConfig().GetBech32AccountAddrPrefix(),
authcodec.NewBech32Codec(appparams.Bech32PrefixAccAddr),
appparams.Bech32PrefixAccAddr,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

app.AuthzKeeper = authzkeeper.NewKeeper(
runtime.NewKVStoreService(keys[authzkeeper.StoreKey]),
appCodec,
Expand Down Expand Up @@ -740,7 +739,6 @@ func NewApp(
// NOTE: staking module is required if HistoricalEntries param > 0
app.mm.SetOrderBeginBlockers(
// upgrades should be run first
upgradetypes.ModuleName,
capabilitytypes.ModuleName,
minttypes.ModuleName,
distrtypes.ModuleName,
Expand Down
2 changes: 1 addition & 1 deletion app/params/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func DefaultEncodingConfig() *EncodingConfig {

return &EncodingConfig{
InterfaceRegistry: interfaceRegistry,
Marshaler: marshaler,
Marshaler: marshaler,
TxConfig: txCfg,
Amino: amino,
}
Expand Down
3 changes: 2 additions & 1 deletion app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
"github.com/stretchr/testify/require"

"cosmossdk.io/log"
abci "github.com/cometbft/cometbft/abci/types"
tmtypes "github.com/cometbft/cometbft/types"

dbm "github.com/cosmos/cosmos-db"

"cosmossdk.io/log"
"cosmossdk.io/math"

"github.com/cosmos/cosmos-sdk/client/flags"
Expand Down
65 changes: 65 additions & 0 deletions cmd/myceld/cmd/config.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
package cmd

import (
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"

cmtcfg "github.com/cometbft/cometbft/config"

"cosmossdk.io/math"

serverconfig "github.com/cosmos/cosmos-sdk/server/config"
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/mycel-domain/mycel/app/params"
Expand Down Expand Up @@ -37,3 +43,62 @@ func initSDKConfig() {
config.SetBech32PrefixForConsensusNode(consNodeAddressPrefix, consNodePubKeyPrefix)
config.Seal()
}

// initCometBFTConfig helps to override default CometBFT Config values.
// return cmtcfg.DefaultConfig if no custom configuration is required for the application.
func initCometBFTConfig() *cmtcfg.Config {
cfg := cmtcfg.DefaultConfig()

// these values put a higher strain on node memory
// cfg.P2P.MaxNumInboundPeers = 100
// cfg.P2P.MaxNumOutboundPeers = 40

return cfg
}

// initAppConfig helps to override default appConfig template and configs.
// return "", nil if no custom configuration is required for the application.
func initAppConfig() (string, interface{}) {
// The following code snippet is just for reference.
type CustomAppConfig struct {
serverconfig.Config `mapstructure:",squash"`
Wasm wasmtypes.WasmConfig `mapstructure:"wasm"`
}

// Optionally allow the chain developer to overwrite the SDK's default
// server config.
srvCfg := serverconfig.DefaultConfig()
// The SDK's default minimum gas price is set to "" (empty value) inside
// app.toml. If left empty by validators, the node will halt on startup.
// However, the chain developer can set a default app.toml value for their
// validators here.
//
// In summary:
// - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their
// own app.toml config,
// - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their
// own app.toml to override, or use this default value.
//
// In tests, we set the min gas prices to 0.
// srvCfg.MinGasPrices = "0stake"
// srvCfg.BaseConfig.IAVLDisableFastNode = true // disable fastnode by default

customAppConfig := CustomAppConfig{
Config: *srvCfg,
}

customAppConfig.MinGasPrices = "0umycel"

customAppTemplate := serverconfig.DefaultConfigTemplate
// Edit the default template file
//
// customAppTemplate := serverconfig.DefaultConfigTemplate + `
// [wasm]
// # This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries
// query_gas_limit = 300000
// # This is the number of wasm vm instances we keep cached in memory for speed-up
// # Warning: this is currently unstable and may lead to crashes, best to keep for 0 unless testing locally
// lru_size = 0`

return customAppTemplate, customAppConfig
}
10 changes: 7 additions & 3 deletions cmd/myceld/cmd/genaccounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"

"github.com/mycel-domain/mycel/app"
)

const (
flagVestingStart = "vesting-start-time"
flagVestingEnd = "vesting-end-time"
flagVestingAmt = "vesting-amount"
flagVestingStart = "vesting-start-time"
flagVestingEnd = "vesting-end-time"
flagVestingAmt = "vesting-amount"
flagBlockGasLimit = "block-gas-limit"
)

// AddGenesisAccountCmd returns add-genesis-account cobra Command.
Expand Down Expand Up @@ -187,6 +190,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa

cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|kwallet|pass|test)")
cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory")
cmd.Flags().Int64(flagBlockGasLimit, app.DefaultGasLimit, "Block gas limit")
cmd.Flags().String(flagVestingAmt, "", "amount of coins for vesting accounts")
cmd.Flags().Int64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts")
cmd.Flags().Int64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts")
Expand Down
Loading

0 comments on commit 110f2a2

Please sign in to comment.