Skip to content

Commit

Permalink
Integrate with MinTxsInBlock (#558)
Browse files Browse the repository at this point in the history
## Describe your changes and provide context
Pass through MinTxsInBlock between app side and tendermint side

## Testing performed to validate your change
integrated with sei-chain and tested on local sei
  • Loading branch information
codchen authored Jan 6, 2025
1 parent beceb85 commit 7160581
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
4 changes: 4 additions & 0 deletions baseapp/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 non-negative: %d", v.MinTxsInBlock)
}

return nil
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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 => github.com/sei-protocol/sei-tendermint v0.4.5
// 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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -971,8 +971,8 @@ 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-tendermint v0.4.5 h1:vdibojcaBb+OCNeoGmU8daL41U+Sc7AHCBkDqSS7knQ=
github.com/sei-protocol/sei-tendermint v0.4.5/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=
Expand Down
10 changes: 6 additions & 4 deletions server/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions types/legacytm/consensusparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 7160581

Please sign in to comment.