Skip to content

Commit

Permalink
change default block and envidence max bytes to 500000
Browse files Browse the repository at this point in the history
  • Loading branch information
trinitys7 committed May 16, 2024
1 parent 7362c6f commit 723dfb9
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion rollappd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"errors"
"fmt"
"io"
"os"

Expand All @@ -21,13 +22,15 @@ import (
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
"github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
"github.com/prometheus/client_golang/prometheus"
"github.com/spf13/cast"
"github.com/spf13/cobra"
tmcfg "github.com/tendermint/tendermint/config"
tmcli "github.com/tendermint/tendermint/libs/cli"
tmlog "github.com/tendermint/tendermint/libs/log"
tmtypes "github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tm-db"

"github.com/CosmWasm/wasmd/x/wasm"
Expand Down Expand Up @@ -155,7 +158,7 @@ func initRootCmd(
encCfg: encodingConfig,
}
rootCmd.AddCommand(
genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome),
initCommand(),
genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome),
genutilcli.MigrateGenesisCmd(),
genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome),
Expand Down Expand Up @@ -232,6 +235,37 @@ func txCommand() *cobra.Command {
return cmd
}

func initCommand() *cobra.Command {
initCmd := genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome)
initCmd.PostRunE = func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)

serverCtx := server.GetServerContextFromCmd(cmd)
config := serverCtx.Config
config.SetRoot(clientCtx.HomeDir)

genFile := config.GenesisFile()

genDoc, err := tmtypes.GenesisDocFromFile(genFile)
if err != nil {
return fmt.Errorf("Failed to read genesis doc from file: %w", err)
}
fmt.Println(genDoc.ConsensusParams)

// If block max bytes is default value, we will change it
if genDoc.ConsensusParams.Block.MaxBytes == 22020096 {
genDoc.ConsensusParams.Block.MaxBytes = 500000
genDoc.ConsensusParams.Evidence.MaxBytes = 500000
}

if err = genutil.ExportGenesisFile(genDoc, genFile); err != nil {
return fmt.Errorf("Failed to export genesis file: %w", err)
}
return nil
}
return initCmd
}

type appCreator struct {
encCfg params.EncodingConfig
}
Expand Down

0 comments on commit 723dfb9

Please sign in to comment.