From d068a1a057d382ab43809d4f8fa13154df2c887c Mon Sep 17 00:00:00 2001 From: beer-1 Date: Mon, 7 Oct 2024 14:31:48 +0900 Subject: [PATCH 1/2] add launch config to enable configuration of block params --- contrib/launchtools/config.go | 12 ++++++++++++ contrib/launchtools/steps/genesis.go | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/contrib/launchtools/config.go b/contrib/launchtools/config.go index e2d8847d..c8c7063d 100644 --- a/contrib/launchtools/config.go +++ b/contrib/launchtools/config.go @@ -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"` } @@ -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 } diff --git a/contrib/launchtools/steps/genesis.go b/contrib/launchtools/steps/genesis.go index 2008538e..ab547361 100644 --- a/contrib/launchtools/steps/genesis.go +++ b/contrib/launchtools/steps/genesis.go @@ -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" @@ -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 From 163992d9c6f338a0ae3b4a5b5e28aa0f985ce95c Mon Sep 17 00:00:00 2001 From: beer-1 Date: Mon, 7 Oct 2024 14:39:50 +0900 Subject: [PATCH 2/2] fix to use default params for the rest params --- contrib/launchtools/steps/genesis.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/contrib/launchtools/steps/genesis.go b/contrib/launchtools/steps/genesis.go index ab547361..a7d1f4b7 100644 --- a/contrib/launchtools/steps/genesis.go +++ b/contrib/launchtools/steps/genesis.go @@ -220,14 +220,12 @@ func initializeGenesis( // finalize app genesis appGenesis := &genutiltypes.AppGenesis{} + consensusParams := cmttypes.DefaultConsensusParams() + consensusParams.Block.MaxBytes = config.L2Config.BlockMaxBytes + consensusParams.Block.MaxGas = config.L2Config.BlockMaxGas appGenesis.Consensus = &genutiltypes.ConsensusGenesis{ Validators: nil, - Params: &cmttypes.ConsensusParams{ - Block: cmttypes.BlockParams{ - MaxBytes: config.L2Config.BlockMaxBytes, - MaxGas: config.L2Config.BlockMaxGas, - }, - }, + Params: consensusParams, } appGenesis.AppName = version.AppName appGenesis.AppVersion = version.Version