From 750d1e70ad052daf7b2942bcecaf0dddfbc17d90 Mon Sep 17 00:00:00 2001 From: Omri Date: Sun, 21 Apr 2024 18:11:43 +0200 Subject: [PATCH 1/5] fix(app): fixed bech32 on account keeper to not be hardcoded (#165) --- app/app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index 3ac12870..4ce108a4 100644 --- a/app/app.go +++ b/app/app.go @@ -393,7 +393,7 @@ func NewRollapp( app.GetSubspace(authtypes.ModuleName), ethermint.ProtoAccount, maccPerms, - sdk.Bech32PrefixAccAddr, //Bech32MainPrefix + sdk.GetConfig().GetBech32AccountAddrPrefix(), ) app.BankKeeper = bankkeeper.NewBaseKeeper( From 8d37db874902eb483293894333416d54bd051e72 Mon Sep 17 00:00:00 2001 From: Daniel T <30197399+danwt@users.noreply.github.com> Date: Mon, 22 Apr 2024 15:31:24 +0100 Subject: [PATCH 2/5] fix(scripts): fix hubgenesis tokens in update genesis (#172) --- scripts/update_genesis_file.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/update_genesis_file.sh b/scripts/update_genesis_file.sh index 5275b8df..3a98d2ef 100755 --- a/scripts/update_genesis_file.sh +++ b/scripts/update_genesis_file.sh @@ -51,6 +51,18 @@ module_account_balance=$( }]' ) +hubgenesis_tokens=$( +jq -n \ + --arg denom "$BASE_DENOM" \ + --arg amount "60000000000000000000000" \ + '[{ + "denom": $denom, + "amount": $amount + }]' +) + +jq --argjson hubgenesis_tokens "$hubgenesis_tokens" '.app_state.hubgenesis.state.genesis_tokens = $hubgenesis_tokens' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE" + jq '.app_state.bank.balances[0].coins[0].amount = "2000000000000000000000000000"' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE" jq --argjson module_account_balance "$module_account_balance" '.app_state.bank.balances += $module_account_balance' "$GENESIS_FILE" >"$tmp" && mv "$tmp" "$GENESIS_FILE" From 3dff5632ad59e11ddc9f192513f31ca2dc6e432a Mon Sep 17 00:00:00 2001 From: zale144 Date: Tue, 23 Apr 2024 19:08:54 +0200 Subject: [PATCH 3/5] chore(app): Add modules authz and feegrant (#175) --- app/app.go | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/app/app.go b/app/app.go index 4ce108a4..0a2c4f6a 100644 --- a/app/app.go +++ b/app/app.go @@ -7,6 +7,9 @@ import ( "path/filepath" "sort" + "github.com/cosmos/cosmos-sdk/x/authz" + authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" + authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" "github.com/gorilla/mux" "github.com/rakyll/statik/fs" "github.com/spf13/cast" @@ -25,7 +28,7 @@ import ( "github.com/cosmos/cosmos-sdk/server/api" "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" - simapp "github.com/cosmos/cosmos-sdk/simapp" + "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/store/streaming" storetypes "github.com/cosmos/cosmos-sdk/store/types" "github.com/cosmos/cosmos-sdk/testutil/testdata" @@ -48,6 +51,9 @@ import ( capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + "github.com/cosmos/cosmos-sdk/x/feegrant" + feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper" + feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" "github.com/cosmos/cosmos-sdk/x/gov" @@ -92,13 +98,14 @@ import ( ibckeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper" ibctestingtypes "github.com/cosmos/ibc-go/v6/testing/types" - rollappparams "github.com/dymensionxyz/rollapp-evm/app/params" srvflags "github.com/evmos/evmos/v12/server/flags" + rollappparams "github.com/dymensionxyz/rollapp-evm/app/params" + // unnamed import of statik for swagger UI support _ "github.com/cosmos/cosmos-sdk/client/docs/statik" - staking "github.com/dymensionxyz/dymension-rdk/x/staking" + "github.com/dymensionxyz/dymension-rdk/x/staking" stakingkeeper "github.com/dymensionxyz/dymension-rdk/x/staking/keeper" "github.com/dymensionxyz/dymension-rdk/x/sequencers" @@ -143,7 +150,8 @@ const ( var ( kvstorekeys = []string{ - authtypes.StoreKey, banktypes.StoreKey, + authtypes.StoreKey, authzkeeper.StoreKey, + feegrant.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, seqtypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, govtypes.StoreKey, paramstypes.StoreKey, @@ -186,6 +194,7 @@ var ( // and genesis verification. ModuleBasics = module.NewBasicManager( auth.AppModuleBasic{}, + authzmodule.AppModuleBasic{}, genutil.AppModuleBasic{}, bank.AppModuleBasic{}, capability.AppModuleBasic{}, @@ -196,6 +205,7 @@ var ( distr.AppModuleBasic{}, gov.NewAppModuleBasic(getGovProposalHandlers()), params.AppModuleBasic{}, + feegrantmodule.AppModuleBasic{}, upgrade.AppModuleBasic{}, ibc.AppModuleBasic{}, vesting.AppModuleBasic{}, @@ -214,6 +224,7 @@ var ( // module account permissions maccPerms = map[string][]string{ authtypes.FeeCollectorName: nil, + authz.ModuleName: nil, distrtypes.ModuleName: nil, minttypes.ModuleName: {authtypes.Minter}, stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, @@ -272,6 +283,7 @@ type App struct { // keepers AccountKeeper authkeeper.AccountKeeper + AuthzKeeper authzkeeper.Keeper BankKeeper bankkeeper.Keeper CapabilityKeeper *capabilitykeeper.Keeper StakingKeeper stakingkeeper.Keeper @@ -285,6 +297,7 @@ type App struct { ParamsKeeper paramskeeper.Keeper IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly TransferKeeper transferkeeper.Keeper + FeeGrantKeeper feegrantkeeper.Keeper // make scoped keepers public for test purposes ScopedIBCKeeper capabilitykeeper.ScopedKeeper @@ -396,6 +409,13 @@ func NewRollapp( sdk.GetConfig().GetBech32AccountAddrPrefix(), ) + app.AuthzKeeper = authzkeeper.NewKeeper( + keys[authzkeeper.StoreKey], + appCodec, + app.MsgServiceRouter(), + app.AccountKeeper, + ) + app.BankKeeper = bankkeeper.NewBaseKeeper( appCodec, keys[banktypes.StoreKey], @@ -432,6 +452,7 @@ func NewRollapp( &stakingKeeper, &app.SequencersKeeper, authtypes.FeeCollectorName, app.ModuleAccountAddrs(), ) + app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, keys[feegrant.StoreKey], app.AccountKeeper) app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) // register the staking hooks @@ -576,9 +597,11 @@ func NewRollapp( encodingConfig.TxConfig, ), auth.NewAppModule(appCodec, app.AccountKeeper, nil), + authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper), capability.NewAppModule(appCodec, *app.CapabilityKeeper), + feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper), mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, app.BankKeeper), distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), @@ -620,11 +643,13 @@ func NewRollapp( ibchost.ModuleName, ibctransfertypes.ModuleName, authtypes.ModuleName, + authz.ModuleName, banktypes.ModuleName, govtypes.ModuleName, erc20types.ModuleName, claimstypes.ModuleName, genutiltypes.ModuleName, + feegrant.ModuleName, epochstypes.ModuleName, paramstypes.ModuleName, hubgentypes.ModuleName, @@ -640,6 +665,7 @@ func NewRollapp( feemarkettypes.ModuleName, capabilitytypes.ModuleName, authtypes.ModuleName, + authz.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, vestingtypes.ModuleName, @@ -647,6 +673,7 @@ func NewRollapp( erc20types.ModuleName, claimstypes.ModuleName, genutiltypes.ModuleName, + feegrant.ModuleName, epochstypes.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName, @@ -666,6 +693,7 @@ func NewRollapp( initGenesisList := []string{ capabilitytypes.ModuleName, authtypes.ModuleName, + authz.ModuleName, banktypes.ModuleName, evmtypes.ModuleName, feemarkettypes.ModuleName, @@ -684,6 +712,7 @@ func NewRollapp( paramstypes.ModuleName, upgradetypes.ModuleName, ibctransfertypes.ModuleName, + feegrant.ModuleName, hubgentypes.ModuleName, denommetadatamoduletypes.ModuleName, } @@ -745,7 +774,7 @@ func (app *App) setAnteHandler(txConfig client.TxConfig, maxGasWanted uint64) { ExtensionOptionChecker: ethermint.HasDynamicFeeExtensionOption, EvmKeeper: app.EvmKeeper, StakingKeeper: app.StakingKeeper, - FeegrantKeeper: nil, + FeegrantKeeper: app.FeeGrantKeeper, DistributionKeeper: app.DistrKeeper, IBCKeeper: app.IBCKeeper, FeeMarketKeeper: app.FeeMarketKeeper, @@ -793,7 +822,7 @@ func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.Res panic(err) } - //Passing the dymint sequencers to the sequencer module from RequestInitChain + // Passing the dymint sequencers to the sequencer module from RequestInitChain if len(req.Validators) == 0 { panic("Dymint have no sequencers defined on InitChain") } From f58feaaea83b17d2258d1025a72c9b832922b7a9 Mon Sep 17 00:00:00 2001 From: Hoang Do Date: Thu, 25 Apr 2024 16:02:26 +0700 Subject: [PATCH 4/5] feat(ci): Add changelog log auto update workflow (#176) Co-authored-by: github-actions --- .github/workflows/changelog.yml | 44 +++++++++++++++++ CHANGELOG.md | 88 ++++++++++++++++----------------- 2 files changed, 88 insertions(+), 44 deletions(-) create mode 100644 .github/workflows/changelog.yml diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml new file mode 100644 index 00000000..5a9a002b --- /dev/null +++ b/.github/workflows/changelog.yml @@ -0,0 +1,44 @@ +# This workflow will add a changelog to the repository when a new commit is pushed to the main branch. +# E.g., manually edit the commit message to align with conventional commit messages, such as: +# feat(database): add new indexing capabilities +# This update introduces advanced indexing options for handling complex queries more efficiently. + +name: Changelog Update + +on: + pull_request: + branches: + - main + types: [opened, synchronize, reopened] + +permissions: write-all + +jobs: + update_changelog: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: "18" + + - name: Install conventional-changelog-cli + run: npm install -g conventional-changelog-cli + + - name: Generate changelog diff + run: | + git fetch origin main:main + conventional-changelog -p angular -i CHANGELOG.md -s -r 0 > changelog_diff.md + echo "::set-output name=changelog::$(cat changelog_diff.md)" + - name: Commit and push changelog update + run: | + git config user.name 'github-actions' + git config user.email 'github-actions@github.com' + git add CHANGELOG.md + git commit -m "Update CHANGELOG.md" + git push origin HEAD:refs/heads/${{ github.head_ref }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 82513f38..b167b063 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,71 +1,71 @@ - - +### Bug Fixes + +* cleaning file descriptors ([#69](https://github.com/dymensionxyz/rollapp-evm/issues/69)) ([18f7558](https://github.com/dymensionxyz/rollapp-evm/commit/18f7558455b74ee097c525fc418375456b90bb00)) +* hotfix for ibc-go due to val-set hotfix done on hub for froopyland. ([#73](https://github.com/dymensionxyz/rollapp-evm/issues/73)) ([40c6ec4](https://github.com/dymensionxyz/rollapp-evm/commit/40c6ec4c3f899268bd93cf95dee98aa00410fe18)) -# Changelog -## Unreleased -### Improvements +# [1.0.0-beta](https://github.com/dymensionxyz/rollapp-evm/compare/v0.1.0-rc3...v1.0.0-beta) (2023-10-19) -- (deps) [#138](https://github.com/dymensionxyz/rollapp-evm/issues/138) Bumps `block-explorer-rpc-cosmos v1.0.2` & `evm-block-explorer-rpc-cosmos v1.0.2` -- (deps) [#151](https://github.com/dymensionxyz/rollapp-evm/issues/151) Bumps `block-explorer-rpc-cosmos v1.0.2` & `evm-block-explorer-rpc-cosmos v1.1.0` ### Bug Fixes -- (deps) [#142](https://github.com/dymensionxyz/rollapp-evm/issues/142) Bumps `block-explorer-rpc-cosmos v1.0.3` & `evm-block-explorer-rpc-cosmos v1.0.3` +* reverted bad deps ([#38](https://github.com/dymensionxyz/rollapp-evm/issues/38)) ([545a367](https://github.com/dymensionxyz/rollapp-evm/commit/545a367643d7b1f6e2dbdce1cdb436fdb56000fe)) + + + +# [0.1.0-rc2](https://github.com/dymensionxyz/rollapp-evm/compare/v0.1.0-rc1...v0.1.0-rc2) (2023-07-31) + + + +# 0.1.0-rc1 (2023-07-27) + + + From 7855699fb8cc400f8d8c0cf216c0b75c4bcc3dbf Mon Sep 17 00:00:00 2001 From: ducnt131 <62016666+anhductn2001@users.noreply.github.com> Date: Thu, 25 Apr 2024 18:04:52 +0700 Subject: [PATCH 5/5] feat!: configure bech32prefix in genesis (#170) Co-authored-by: Trinity Co-authored-by: Omri --- README.md | 1 + app/app.go | 4 +- cmd/rollappd/cmd/genaccounts.go | 14 ++--- cmd/rollappd/cmd/root.go | 100 +++++++++++++++++++++++++++++--- cmd/rollappd/cmd/start.go | 1 + go.mod | 2 +- go.sum | 4 +- scripts/init.sh | 2 +- 8 files changed, 106 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 2480d16c..84ce03a4 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ export EXECUTABLE="rollapp-evm" export ROLLAPP_CHAIN_ID="rollappevm_1234-1" export KEY_NAME_ROLLAPP="rol-user" export BASE_DENOM="arax" +export BECH32="rol" export DENOM=$(echo "$BASE_DENOM" | sed 's/^.//') export MONIKER="$ROLLAPP_CHAIN_ID-sequencer" diff --git a/app/app.go b/app/app.go index 0a2c4f6a..6f64df99 100644 --- a/app/app.go +++ b/app/app.go @@ -144,8 +144,7 @@ import ( ) const ( - AccountAddressPrefix = "ethm" - Name = "rollapp_evm" + Name = "rollapp_evm" ) var ( @@ -546,6 +545,7 @@ func NewRollapp( appCodec, keys[denommetadatamoduletypes.StoreKey], app.BankKeeper, + app.TransferKeeper, denomMetadataHooks, app.GetSubspace(denommetadatamoduletypes.ModuleName), ) diff --git a/cmd/rollappd/cmd/genaccounts.go b/cmd/rollappd/cmd/genaccounts.go index 4c121ee1..c57308eb 100644 --- a/cmd/rollappd/cmd/genaccounts.go +++ b/cmd/rollappd/cmd/genaccounts.go @@ -7,6 +7,7 @@ import ( "fmt" "github.com/spf13/cobra" + tmos "github.com/tendermint/tendermint/libs/os" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" @@ -16,8 +17,6 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" 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" ethtutil "github.com/ethereum/go-ethereum/common" "github.com/evmos/evmos/v12/crypto/hd" @@ -136,7 +135,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa } genFile := config.GenesisFile() - appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile) + appState, genDoc, err := GenesisStateFromGenFile(genFile) if err != nil { return fmt.Errorf("failed to unmarshal genesis state: %w", err) } @@ -194,13 +193,12 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa } appState[banktypes.ModuleName] = bankGenStateBz - appStateJSON, err := json.Marshal(appState) + genDoc["app_state"] = appState + genDocBytes, err := json.MarshalIndent(genDoc, "", " ") if err != nil { - return fmt.Errorf("failed to marshal application genesis state: %w", err) + return err } - - genDoc.AppState = appStateJSON - return genutil.ExportGenesisFile(genDoc, genFile) + return tmos.WriteFile(genFile, genDocBytes, 0o644) }, } diff --git a/cmd/rollappd/cmd/root.go b/cmd/rollappd/cmd/root.go index 5f93f5a7..5667bc6c 100644 --- a/cmd/rollappd/cmd/root.go +++ b/cmd/rollappd/cmd/root.go @@ -1,6 +1,7 @@ package cmd import ( + "encoding/json" "errors" "fmt" "io" @@ -28,6 +29,7 @@ import ( tmcfg "github.com/tendermint/tendermint/config" tmcli "github.com/tendermint/tendermint/libs/cli" tmlog "github.com/tendermint/tendermint/libs/log" + tmos "github.com/tendermint/tendermint/libs/os" dbm "github.com/tendermint/tm-db" rdkserver "github.com/dymensionxyz/dymension-rdk/server" @@ -39,6 +41,7 @@ import ( ethermintclient "github.com/evmos/evmos/v12/client" + rdk_genutilcli "github.com/dymensionxyz/dymension-rdk/x/genutil/client/cli" evmserver "github.com/evmos/evmos/v12/server" evmconfig "github.com/evmos/evmos/v12/server/config" ) @@ -109,6 +112,18 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { //create Block Explorer Json-RPC toml config file berpcconfig.EnsureRoot(home, berpcconfig.DefaultBeJsonRpcConfig()) + // Set config + sdkconfig := sdk.GetConfig() + utils.SetBip44CoinType(sdkconfig) + cfg := serverCtx.Config + genFile := cfg.GenesisFile() + if tmos.FileExists(genFile) { + genDoc, _ := GenesisDocFromFile(genFile) + rdk_utils.SetPrefixes(sdkconfig, genDoc["bech32_prefix"].(string)) + } else { + rdk_utils.SetPrefixes(sdkconfig, "ethm") + } + sdkconfig.Seal() return nil }, } @@ -155,18 +170,38 @@ func initRootCmd( rootCmd *cobra.Command, encodingConfig params.EncodingConfig, ) { - // Set config - sdkconfig := sdk.GetConfig() - rdk_utils.SetPrefixes(sdkconfig, app.AccountAddressPrefix) - utils.SetBip44CoinType(sdkconfig) - sdkconfig.Seal() - ac := appCreator{ encCfg: encodingConfig, } + + initCmd := genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome) + initCmd.Flags().String(FlagBech32Prefix, "ethm", "set bech32 prefix for rollapp, if left blank default value is 'ethm'") + + initCmd.PostRunE = func(cmd *cobra.Command, args []string) error { + prefix, _ := initCmd.Flags().GetString(FlagBech32Prefix) + + serverCtx := server.GetServerContextFromCmd(cmd) + config := serverCtx.Config + path := config.GenesisFile() + + genDoc, err := GenesisDocFromFile(path) + if err != nil { + fmt.Println("Failed to read genesis doc from file", err) + } + + genDoc["bech32_prefix"] = prefix + + genDocBytes, err := json.MarshalIndent(genDoc, "", " ") + if err != nil { + return err + } + return tmos.WriteFile(path, genDocBytes, 0o644) + + } + rootCmd.AddCommand( - genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome), - genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), + initCmd, + rdk_genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), genutilcli.MigrateGenesisCmd(), genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), @@ -310,3 +345,52 @@ func (ac appCreator) appExport( return rollapp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs) } + +// GenesisStateFromGenFile creates the core parameters for genesis initialization +// for the application. +// +// NOTE: The pubkey input is this machines pubkey. +func GenesisStateFromGenFile(genFile string) (genesisState map[string]json.RawMessage, genDoc map[string]interface{}, err error) { + if !tmos.FileExists(genFile) { + return genesisState, genDoc, + fmt.Errorf("%s does not exist, run `init` first", genFile) + } + + genDoc, err = GenesisDocFromFile(genFile) + if err != nil { + return genesisState, genDoc, err + } + + bz, err := json.Marshal(genDoc["app_state"]) + if err != nil { + return genesisState, genDoc, err + } + + err = json.Unmarshal(bz, &genesisState) + return genesisState, genDoc, err +} + +// GenesisDocFromFile reads JSON data from a file and unmarshalls it into a GenesisDoc. +func GenesisDocFromFile(genDocFile string) (map[string]interface{}, error) { + jsonBlob, err := os.ReadFile(genDocFile) + if err != nil { + return nil, fmt.Errorf("couldn't read GenesisDoc file: %w", err) + } + + genDoc, err := GenesisDocFromJSON(jsonBlob) + if err != nil { + return nil, fmt.Errorf("error reading GenesisDoc at %s: %w", genDocFile, err) + } + return genDoc, nil +} + +// GenesisDocFromJSON unmarshalls JSON data into a GenesisDoc. +func GenesisDocFromJSON(jsonBlob []byte) (map[string]interface{}, error) { + genDoc := make(map[string]interface{}) + err := json.Unmarshal(jsonBlob, &genDoc) + if err != nil { + return nil, err + } + + return genDoc, err +} diff --git a/cmd/rollappd/cmd/start.go b/cmd/rollappd/cmd/start.go index fa426666..5e4b42a6 100644 --- a/cmd/rollappd/cmd/start.go +++ b/cmd/rollappd/cmd/start.go @@ -70,6 +70,7 @@ const ( FlagUnsafeSkipUpgrades = "unsafe-skip-upgrades" FlagTrace = "trace" FlagInvCheckPeriod = "inv-check-period" + FlagBech32Prefix = "bech32-prefix" FlagPruning = "pruning" FlagPruningKeepRecent = "pruning-keep-recent" diff --git a/go.mod b/go.mod index a245e9bf..00a8adc0 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/bcdevtools/evm-block-explorer-rpc-cosmos v1.1.0 github.com/cosmos/cosmos-sdk v0.46.16 github.com/cosmos/ibc-go/v6 v6.2.1 - github.com/dymensionxyz/dymension-rdk v1.5.0-beta + github.com/dymensionxyz/dymension-rdk v1.5.0-beta.0.20240423161402-f6997e0d1a5c github.com/dymensionxyz/dymint v1.0.1-alpha.0.20240414124654-eb08e30da2c5 github.com/ethereum/go-ethereum v1.12.0 github.com/evmos/evmos/v12 v12.1.6 diff --git a/go.sum b/go.sum index c4c904d8..3bc43eae 100644 --- a/go.sum +++ b/go.sum @@ -551,8 +551,8 @@ github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQx github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= github.com/dymensionxyz/cosmosclient v0.4.2-beta h1:sokBefcN1tIOlUKmB8Q2E9XMJ93LueqtFThiM/kA4DI= github.com/dymensionxyz/cosmosclient v0.4.2-beta/go.mod h1:GQQu3ITEjWfi5ULR2B6X2i2YZNennY1yzcT5qdL4MGI= -github.com/dymensionxyz/dymension-rdk v1.5.0-beta h1:whKxcgcXB3l7rK7F0Vnq0EF0Ri9475CSZTseaUQN6o0= -github.com/dymensionxyz/dymension-rdk v1.5.0-beta/go.mod h1:kzNFKt3yfFzZ2u3+47Nlpobub3/UXsICOg1WmGud3DE= +github.com/dymensionxyz/dymension-rdk v1.5.0-beta.0.20240423161402-f6997e0d1a5c h1:ee4pw3mkuYLQzwhTbiwD5msPvwoDvuCHrEMSBrZMcPc= +github.com/dymensionxyz/dymension-rdk v1.5.0-beta.0.20240423161402-f6997e0d1a5c/go.mod h1:kzNFKt3yfFzZ2u3+47Nlpobub3/UXsICOg1WmGud3DE= github.com/dymensionxyz/dymension/v3 v3.1.0-rc03.0.20240411195658-f7cd96f53b56 h1:cmpJYdRviuUfmlJdHrcAND8Jd6JIY4rp63bWAQzPr54= github.com/dymensionxyz/dymension/v3 v3.1.0-rc03.0.20240411195658-f7cd96f53b56/go.mod h1:3Pfrr8j/BR9ztNKztGfC5PqDiO6CcrzMLCJtFtPEVW4= github.com/dymensionxyz/dymint v1.0.1-alpha.0.20240414124654-eb08e30da2c5 h1:7UEyfIyW54zJXUL4hSAJdLol7CkJtD0eL865vLTf9Lg= diff --git a/scripts/init.sh b/scripts/init.sh index f823c304..38df36bb 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -80,7 +80,7 @@ if [ -z "$KEY_NAME_ROLLAPP" ]; then fi # ------------------------------- init rollapp ------------------------------- # -"$EXECUTABLE" init "$MONIKER" --chain-id "$ROLLAPP_CHAIN_ID" +"$EXECUTABLE" init "$MONIKER" --chain-id "$ROLLAPP_CHAIN_ID" --bech32-prefix "$BECH32" # ------------------------------- client config ------------------------------ # "$EXECUTABLE" config chain-id "$ROLLAPP_CHAIN_ID"