From a574cd516a600a2165816b1e998c366b87423a73 Mon Sep 17 00:00:00 2001 From: Tony Chen Date: Fri, 27 Dec 2024 09:39:34 +0800 Subject: [PATCH] Integrate with MinTxsInBlock --- baseapp/params.go | 4 ++++ go.mod | 2 +- go.sum | 2 -- server/export.go | 10 ++++++---- types/legacytm/consensusparams.go | 1 + 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/baseapp/params.go b/baseapp/params.go index 8d094fc9a..caaa51fd7 100644 --- a/baseapp/params.go +++ b/baseapp/params.go @@ -48,6 +48,10 @@ func ValidateBlockParams(i interface{}) error { return fmt.Errorf("block maximum gas must be greater than or equal to -1: %d", v.MaxGas) } + if v.MinTxsInBlock < 0 { + return fmt.Errorf("block min txs in block must be positive: %d", v.MinTxsInBlock) + } + return nil } diff --git a/go.mod b/go.mod index 2fd04b55c..f8410839c 100644 --- a/go.mod +++ b/go.mod @@ -198,7 +198,7 @@ replace ( github.com/sei-protocol/sei-db => github.com/sei-protocol/sei-db v0.0.46 // Latest goleveldb is broken, we have to stick to this version github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 - github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.3.8 + github.com/tendermint/tendermint => ../sei-tendermint // github.com/sei-protocol/sei-tendermint v0.3.8 // latest grpc doesn't work with with our modified proto compiler, so we need to enforce // the following version across all dependencies. google.golang.org/grpc => google.golang.org/grpc v1.33.2 diff --git a/go.sum b/go.sum index 847ab210f..d43f53360 100644 --- a/go.sum +++ b/go.sum @@ -971,8 +971,6 @@ github.com/sei-protocol/sei-db v0.0.46 h1:naXfSp1I3UgJJm/iSvXpdFzr9nofEOxp/EekcA github.com/sei-protocol/sei-db v0.0.46/go.mod h1:m5g7p0QeAS3dNJHIl28zQpzOgxQmvYqPb7t4hwgIOCA= github.com/sei-protocol/sei-iavl v0.1.9 h1:y4mVYftxLNRs6533zl7N0/Ch+CzRQc04JDfHolIxgBE= github.com/sei-protocol/sei-iavl v0.1.9/go.mod h1:7PfkEVT5dcoQE+s/9KWdoXJ8VVVP1QpYYPLdxlkSXFk= -github.com/sei-protocol/sei-tendermint v0.3.8 h1:9o+A3tL6q1ki++dLng/J8MHHiT6y3l7D4Ir2UIQSkAQ= -github.com/sei-protocol/sei-tendermint v0.3.8/go.mod h1:4LSlJdhl3nf3OmohliwRNUFLOB1XWlrmSodrIP7fLh4= github.com/sei-protocol/sei-tm-db v0.0.5 h1:3WONKdSXEqdZZeLuWYfK5hP37TJpfaUa13vAyAlvaQY= github.com/sei-protocol/sei-tm-db v0.0.5/go.mod h1:Cpa6rGyczgthq7/0pI31jys2Fw0Nfrc+/jKdP1prVqY= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= diff --git a/server/export.go b/server/export.go index cf25eea42..cc3a07c23 100644 --- a/server/export.go +++ b/server/export.go @@ -116,8 +116,9 @@ func ExportCmd(appExporter types.AppExporter, defaultNodeHome string) *cobra.Com InitialHeight: exported.Height, ConsensusParams: &tmtypes.ConsensusParams{ Block: tmtypes.BlockParams{ - MaxBytes: exported.ConsensusParams.Block.MaxBytes, - MaxGas: exported.ConsensusParams.Block.MaxGas, + MaxBytes: exported.ConsensusParams.Block.MaxBytes, + MaxGas: exported.ConsensusParams.Block.MaxGas, + MinTxsInBlock: exported.ConsensusParams.Block.MinTxsInBlock, }, Evidence: tmtypes.EvidenceParams{ MaxAgeNumBlocks: exported.ConsensusParams.Evidence.MaxAgeNumBlocks, @@ -158,8 +159,9 @@ func ExportCmd(appExporter types.AppExporter, defaultNodeHome string) *cobra.Com doc.InitialHeight = exported.Height doc.ConsensusParams = &tmtypes.ConsensusParams{ Block: tmtypes.BlockParams{ - MaxBytes: exported.ConsensusParams.Block.MaxBytes, - MaxGas: exported.ConsensusParams.Block.MaxGas, + MaxBytes: exported.ConsensusParams.Block.MaxBytes, + MaxGas: exported.ConsensusParams.Block.MaxGas, + MinTxsInBlock: exported.ConsensusParams.Block.MinTxsInBlock, }, Evidence: tmtypes.EvidenceParams{ MaxAgeNumBlocks: exported.ConsensusParams.Evidence.MaxAgeNumBlocks, diff --git a/types/legacytm/consensusparams.go b/types/legacytm/consensusparams.go index d06aa5909..3c4c926cc 100644 --- a/types/legacytm/consensusparams.go +++ b/types/legacytm/consensusparams.go @@ -10,6 +10,7 @@ func ABCIToLegacyConsensusParams(params *tmproto.ConsensusParams) *abci.Consensu if params.Block != nil { block.MaxBytes = params.Block.MaxBytes block.MaxGas = params.Block.MaxGas + block.MinTxsInBlock = params.Block.MinTxsInBlock } return &abci.ConsensusParams{ Block: &block,