Skip to content

Commit

Permalink
add launch config to enable configuration of block params
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Oct 7, 2024
1 parent 77b18cb commit d068a1a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions contrib/launchtools/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ type L2Config struct {
Denom string `json:"denom,omitempty"`
Moniker string `json:"moniker,omitempty"`

// block parameters
BlockMaxBytes int64 `json:"block_max_bytes,omitempty"`
BlockMaxGas int64 `json:"block_max_gas,omitempty"`

// BridgeID will be generated after the launch.
BridgeID uint64 `json:"bridge_id,omitempty"`
}
Expand All @@ -106,6 +110,14 @@ func (l2config *L2Config) Finalize() error {
l2config.Moniker = "operator"
}

if l2config.BlockMaxBytes == 0 {
l2config.BlockMaxBytes = 5242880 // 5MB
}

if l2config.BlockMaxGas == 0 {
l2config.BlockMaxGas = 100_000_000 // 100M
}

return nil
}

Expand Down
8 changes: 8 additions & 0 deletions contrib/launchtools/steps/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"cosmossdk.io/log"
conmetconfig "github.com/cometbft/cometbft/config"
cometos "github.com/cometbft/cometbft/libs/os"
cmttypes "github.com/cometbft/cometbft/types"

"github.com/cosmos/cosmos-sdk/codec"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -220,6 +222,12 @@ func initializeGenesis(
appGenesis := &genutiltypes.AppGenesis{}
appGenesis.Consensus = &genutiltypes.ConsensusGenesis{
Validators: nil,
Params: &cmttypes.ConsensusParams{
Block: cmttypes.BlockParams{
MaxBytes: config.L2Config.BlockMaxBytes,
MaxGas: config.L2Config.BlockMaxGas,
},
},
}
appGenesis.AppName = version.AppName
appGenesis.AppVersion = version.Version
Expand Down

0 comments on commit d068a1a

Please sign in to comment.