Skip to content

Commit

Permalink
chore!: set default consensus params and prep for restricted block si…
Browse files Browse the repository at this point in the history
…ze (#1761)

## Overview

The base implementation for all ADR021 #1759 options

part of #1592 
blocked by #1754

## Checklist

- [x] New and updated code has appropriate documentation
- [x] New and updated code has new and/or updated testing
- [x] Required CI checks are passing
- [x] Visual proof for any user facing features like CLI or
documentation updates
- [ ] Linked issues closed with keywords
  • Loading branch information
evan-forbes committed May 17, 2023
1 parent 1e60076 commit f335904
Show file tree
Hide file tree
Showing 33 changed files with 215 additions and 183 deletions.
24 changes: 24 additions & 0 deletions app/module.go → app/default_overrides.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package app
import (
"encoding/json"

"github.com/celestiaorg/celestia-app/pkg/appconsts"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/bank"
Expand All @@ -20,6 +21,8 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
ibcclientclient "github.com/cosmos/ibc-go/v6/modules/core/02-client/client"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
coretypes "github.com/tendermint/tendermint/types"
)

// bankModule defines a custom wrapper around the x/bank module's AppModuleBasic
Expand Down Expand Up @@ -127,3 +130,24 @@ func getLegacyProposalHandlers() (result []govclient.ProposalHandler) {

return result
}

// DefaultConsensusParams returns a ConsensusParams with a MaxBytes
// determined using a goal square size.
func DefaultConsensusParams() *tmproto.ConsensusParams {
return &tmproto.ConsensusParams{
Block: DefaultBlockParams(),
Evidence: coretypes.DefaultEvidenceParams(),
Validator: coretypes.DefaultValidatorParams(),
Version: coretypes.DefaultVersionParams(), // TODO: set the default version to 1
}
}

// DefaultBlockParams returns a default BlockParams with a MaxBytes determined
// using a goal square size.
func DefaultBlockParams() tmproto.BlockParams {
return tmproto.BlockParams{
MaxBytes: appconsts.DefaultMaxBytes,
MaxGas: -1,
TimeIotaMs: 1, // 1ms
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion app/prepare_proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (app *App) PrepareProposal(req abci.RequestPrepareProposal) abci.ResponsePr

// build the square from the set of valid and prioritised transactions.
// The txs returned are the ones used in the square and block
dataSquare, txs, err := square.Build(txs, appconsts.DefaultMaxSquareSize)
dataSquare, txs, err := square.Build(txs, appconsts.MaxSquareSize)
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion app/process_proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (app *App) ProcessProposal(req abci.RequestProcessProposal) abci.ResponsePr
}

// Construct the data square from the block's transactions
dataSquare, err := square.Construct(req.BlockData.Txs, appconsts.DefaultMaxSquareSize)
dataSquare, err := square.Construct(req.BlockData.Txs, appconsts.MaxSquareSize)
if err != nil {
logInvalidPropBlockError(app.Logger(), req.Header, "failure to compute data square from transactions:", err)
return reject()
Expand Down
8 changes: 4 additions & 4 deletions app/test/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestIntegrationTestSuite(t *testing.T) {
cfg.EnableTMLogging = false
cfg.MinGasPrices = "0utia"
cfg.NumValidators = 1
cfg.TimeoutCommit = time.Millisecond * 400
cfg.TargetHeightDuration = time.Millisecond * 400
suite.Run(t, NewIntegrationTestSuite(cfg))
}

Expand Down Expand Up @@ -208,12 +208,12 @@ func (s *IntegrationTestSuite) TestMaxBlockSize() {
size := blockRes.Block.Data.SquareSize

// perform basic checks on the size of the square
require.LessOrEqual(size, uint64(appconsts.DefaultMaxSquareSize))
require.GreaterOrEqual(size, uint64(appconsts.DefaultMinSquareSize))
require.LessOrEqual(size, uint64(appconsts.MaxSquareSize))
require.GreaterOrEqual(size, uint64(appconsts.MinSquareSize))
sizes = append(sizes, size)
}
// ensure that at least one of the blocks used the max square size
assert.Contains(sizes, uint64(appconsts.DefaultMaxSquareSize))
assert.Contains(sizes, uint64(appconsts.MaxSquareSize))
})
require.NoError(s.network.WaitForNextBlock())
}
Expand Down
4 changes: 2 additions & 2 deletions app/test/process_proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func TestProcessProposal(t *testing.T) {
d.Txs = [][]byte{blobTx}

// Erasure code the data to update the data root so this doesn't doesn't fail on an incorrect data root.
dataSquare, err := square.Construct(d.Txs, appconsts.DefaultMaxSquareSize)
dataSquare, err := square.Construct(d.Txs, appconsts.MaxSquareSize)
require.NoError(t, err)
eds, err := da.ExtendShares(shares.ToBytes(dataSquare))
require.NoError(t, err)
Expand Down Expand Up @@ -280,7 +280,7 @@ func TestProcessProposal(t *testing.T) {
Txs: coretypes.Txs(sendTxs).ToSliceOfBytes(),
},
mutator: func(d *core.Data) {
dataSquare, err := square.Construct(d.Txs, appconsts.DefaultMaxSquareSize)
dataSquare, err := square.Construct(d.Txs, appconsts.MaxSquareSize)
require.NoError(t, err)

b := shares.NewEmptyBuilder().ImportRawShare(dataSquare[1].ToBytes())
Expand Down
5 changes: 4 additions & 1 deletion app/test/qgb_rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ func TestQGBRPCQueries(t *testing.T) {
if testing.Short() {
t.Skip("skipping QGB integration test in short mode.")
}
_, cctx := testnode.DefaultNetwork(t, time.Millisecond)
tmCfg := testnode.DefaultTendermintConfig()
tmCfg.Consensus.TargetHeightDuration = time.Millisecond

cctx, _, _ := testnode.NewNetwork(t, testnode.DefaultParams(), tmCfg, testnode.DefaultAppConfig())
h, err := cctx.WaitForHeightWithTimeout(105, 2*time.Minute)
require.NoError(t, err, h)
require.Greater(t, h, int64(101))
Expand Down
3 changes: 1 addition & 2 deletions app/test/std_sdk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"math/big"
"sync"
"testing"
"time"

"github.com/celestiaorg/celestia-app/app"
"github.com/celestiaorg/celestia-app/app/encoding"
Expand Down Expand Up @@ -48,7 +47,7 @@ type StandardSDKIntegrationTestSuite struct {
func (s *StandardSDKIntegrationTestSuite) SetupSuite() {
t := s.T()
t.Log("setting up integration test suite")
accounts, cctx := testnode.DefaultNetwork(t, time.Millisecond*400)
accounts, cctx := testnode.DefaultNetwork(t)
s.accounts = accounts
s.ecfg = encoding.MakeConfig(app.ModuleEncodingRegisters...)
s.cctx = cctx
Expand Down
9 changes: 9 additions & 0 deletions cmd/celestia-appd/cmd/overrides.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"github.com/celestiaorg/celestia-app/app"
"github.com/celestiaorg/celestia-app/pkg/appconsts"
"github.com/cosmos/cosmos-sdk/server"
"github.com/spf13/cobra"
Expand All @@ -15,3 +16,11 @@ func overrideServerConfig(command *cobra.Command) error {
ctx.Config.Consensus.SkipTimeoutCommit = false
return server.SetCmdServerContext(command, ctx)
}

// setDefaultConsensusParams sets the default consensus parameters for the
// embedded server context.
func setDefaultConsensusParams(command *cobra.Command) error {
ctx := server.GetServerContextFromCmd(command)
ctx.DefaultConsensusParams = app.DefaultConsensusParams()
return server.SetCmdServerContext(command, ctx)
}
5 changes: 5 additions & 0 deletions cmd/celestia-appd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ func NewRootCmd() *cobra.Command {
return err
}

err = setDefaultConsensusParams(cmd)
if err != nil {
return err
}

return overrideServerConfig(cmd)
},
SilenceUsage: true,
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/adr-015-namespace-id-size.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Another tradeoff to consider is the size of the namespace in the share. Since a

### Maximum blob size

If the namespace size is increased, the maximum possible blob will decrease. Given the maximum possible blob is bounded by the number of bytes available for blob space in a data square, if a 32 byte namespace size is adopted, the maxmimum blob size will decrease by an upper bound of `appconsts.DefaultMaxSquareSize * appconsts.DefaultMaxSquareSize * (32-8)`. Note this is an upper bound because not all shares in the data square can be used for blob data (i.e. at least one share must contain the associated PayForBlob transaction).
If the namespace size is increased, the maximum possible blob will decrease. Given the maximum possible blob is bounded by the number of bytes available for blob space in a data square, if a 32 byte namespace size is adopted, the maxmimum blob size will decrease by an upper bound of `appconsts.MaxSquareSize * appconsts.MaxSquareSize * (32-8)`. Note this is an upper bound because not all shares in the data square can be used for blob data (i.e. at least one share must contain the associated PayForBlob transaction).

### SHA256 performance

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ require (
)

replace (
github.com/cosmos/cosmos-sdk => github.com/celestiaorg/cosmos-sdk v1.12.0-sdk-v0.46.11
github.com/cosmos/cosmos-sdk => github.com/celestiaorg/cosmos-sdk v1.13.0-sdk-v0.46.11
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.19.0-tm-v0.34.27
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOC
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
github.com/celestiaorg/celestia-core v1.19.0-tm-v0.34.27 h1:GLdDJRu1fRSMft4IqQz4/x/H1U3eN2TFlYbAycbSiN4=
github.com/celestiaorg/celestia-core v1.19.0-tm-v0.34.27/go.mod h1:8PbX2OIPehldawXWAzNWPxBPnfFtcYtjHecE45b2Beg=
github.com/celestiaorg/cosmos-sdk v1.12.0-sdk-v0.46.11 h1:Y+/dAyu7t0F8+EZz+jU3tyZqG10W8LTCQpnHe8Ejuec=
github.com/celestiaorg/cosmos-sdk v1.12.0-sdk-v0.46.11/go.mod h1:uKEyhG8H8hbjebOEEgtyqghJWpuMyF+u61MK5cis+pk=
github.com/celestiaorg/cosmos-sdk v1.13.0-sdk-v0.46.11 h1:Rd5EvJx1nG3KurBspVN51RVmvif0Lp2UVURbG2ad3Cs=
github.com/celestiaorg/cosmos-sdk v1.13.0-sdk-v0.46.11/go.mod h1:xCG6OUkJy5KUMEg20Zk010lra9XjkmKS3+bk0wp7bd8=
github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 h1:CJdIpo8n5MFP2MwK0gSRcOVlDlFdQJO1p+FqdxYzmvc=
github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4/go.mod h1:fzuHnhzj1pUygGz+1ZkB3uQbEUL4htqCGJ4Qs2LwMZA=
github.com/celestiaorg/nmt v0.15.0 h1:ID9QlMIeP6WK/iiGcfnYLu2qqVIq0UYe/dc3TVPt6EA=
Expand Down
20 changes: 14 additions & 6 deletions pkg/appconsts/appconsts.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,30 @@ const (
// in a continuation sparse share of a sequence.
ContinuationSparseShareContentSize = ShareSize - NamespaceSize - ShareInfoBytes

// DefaultMaxSquareSize is the maximum original square width.
// MaxSquareSize is the maximum original square width.
//
// Note: 128 shares in a row * 128 shares in a column * 512 bytes in a share
// = 8 MiB
DefaultMaxSquareSize = 128
MaxSquareSize = 128

// DefaultGovMaxSquareSize is the default value for the governance modifiable
// max square size.
DefaultGovMaxSquareSize = 64

// DefaultMaxBytes is the default value for the maximum number of bytes
// allowed in a valid block.
DefaultMaxBytes = DefaultGovMaxSquareSize * DefaultGovMaxSquareSize * ContinuationSparseShareContentSize

// MaxShareCount is the maximum number of shares allowed in the original
// data square.
MaxShareCount = DefaultMaxSquareSize * DefaultMaxSquareSize
MaxShareCount = MaxSquareSize * MaxSquareSize

// DefaultMinSquareSize is the smallest original square width.
DefaultMinSquareSize = 1
// MinSquareSize is the smallest original square width.
MinSquareSize = 1

// MinshareCount is the minimum number of shares allowed in the original
// data square.
MinShareCount = DefaultMinSquareSize * DefaultMinSquareSize
MinShareCount = MinSquareSize * MinSquareSize

// SubtreeRootThreshold works as a target value for the number of subtree roots in the
// share commitment. If a blob contains more shares than this number, than the height
Expand Down
10 changes: 5 additions & 5 deletions pkg/da/data_availability_header.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
)

const (
maxExtendedSquareWidth = appconsts.DefaultMaxSquareSize * 2
minExtendedSquareWidth = appconsts.DefaultMinSquareSize * 2
maxExtendedSquareWidth = appconsts.MaxSquareSize * 2
minExtendedSquareWidth = appconsts.MinSquareSize * 2
)

// DataAvailabilityHeader (DAHeader) contains the row and column roots of the
Expand Down Expand Up @@ -60,11 +60,11 @@ func ExtendShares(s [][]byte) (*rsmt2d.ExtendedDataSquare, error) {

squareSize := square.Size(len(s))

if squareSize < appconsts.DefaultMinSquareSize || squareSize > appconsts.DefaultMaxSquareSize {
if squareSize < appconsts.MinSquareSize || squareSize > appconsts.MaxSquareSize {
return nil, fmt.Errorf(
"invalid square size: min %d max %d provided %d",
appconsts.DefaultMinSquareSize,
appconsts.DefaultMaxSquareSize,
appconsts.MinSquareSize,
appconsts.MaxSquareSize,
squareSize,
)
}
Expand Down
14 changes: 7 additions & 7 deletions pkg/da/data_availability_header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ func TestNewDataAvailabilityHeader(t *testing.T) {
{
name: "max square size",
expectedHash: []byte{0xce, 0x5c, 0xf3, 0xc9, 0x15, 0xeb, 0xbf, 0xb0, 0x67, 0xe1, 0xa5, 0x97, 0x35, 0xf3, 0x25, 0x7b, 0x1c, 0x47, 0x74, 0x1f, 0xec, 0x6a, 0x33, 0x19, 0x7f, 0x8f, 0xc2, 0x4a, 0xe, 0xe2, 0xbe, 0x73},
squareSize: appconsts.DefaultMaxSquareSize,
shares: generateShares(appconsts.DefaultMaxSquareSize * appconsts.DefaultMaxSquareSize),
squareSize: appconsts.MaxSquareSize,
shares: generateShares(appconsts.MaxSquareSize * appconsts.MaxSquareSize),
},
}

Expand All @@ -77,7 +77,7 @@ func TestExtendShares(t *testing.T) {
{
name: "too large square size",
expectedErr: true,
shares: generateShares((appconsts.DefaultMaxSquareSize + 1) * (appconsts.DefaultMaxSquareSize + 1)),
shares: generateShares((appconsts.MaxSquareSize + 1) * (appconsts.MaxSquareSize + 1)),
},
{
name: "invalid number of shares",
Expand All @@ -103,7 +103,7 @@ func TestDataAvailabilityHeaderProtoConversion(t *testing.T) {
dah DataAvailabilityHeader
}

shares := generateShares(appconsts.DefaultMaxSquareSize * appconsts.DefaultMaxSquareSize)
shares := generateShares(appconsts.MaxSquareSize * appconsts.MaxSquareSize)
eds, err := ExtendShares(shares)
require.NoError(t, err)
bigdah := NewDataAvailabilityHeader(eds)
Expand Down Expand Up @@ -138,15 +138,15 @@ func Test_DAHValidateBasic(t *testing.T) {
errStr string
}

shares := generateShares(appconsts.DefaultMaxSquareSize * appconsts.DefaultMaxSquareSize)
shares := generateShares(appconsts.MaxSquareSize * appconsts.MaxSquareSize)
eds, err := ExtendShares(shares)
require.NoError(t, err)
bigdah := NewDataAvailabilityHeader(eds)

// make a mutant dah that has too many roots
var tooBigDah DataAvailabilityHeader
tooBigDah.ColumnRoots = make([][]byte, appconsts.DefaultMaxSquareSize*appconsts.DefaultMaxSquareSize)
tooBigDah.RowRoots = make([][]byte, appconsts.DefaultMaxSquareSize*appconsts.DefaultMaxSquareSize)
tooBigDah.ColumnRoots = make([][]byte, appconsts.MaxSquareSize*appconsts.MaxSquareSize)
tooBigDah.RowRoots = make([][]byte, appconsts.MaxSquareSize*appconsts.MaxSquareSize)
copy(tooBigDah.ColumnRoots, bigdah.ColumnRoots)
copy(tooBigDah.RowRoots, bigdah.RowRoots)
tooBigDah.ColumnRoots = append(tooBigDah.ColumnRoots, bytes.Repeat([]byte{1}, 32))
Expand Down
2 changes: 1 addition & 1 deletion pkg/proof/proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func NewTxInclusionProof(txs [][]byte, txIndex uint64) (types.ShareProof, error)
return types.ShareProof{}, fmt.Errorf("txIndex %d out of bounds", txIndex)
}

builder, err := square.NewBuilder(appconsts.DefaultMaxSquareSize, txs...)
builder, err := square.NewBuilder(appconsts.MaxSquareSize, txs...)
if err != nil {
return types.ShareProof{}, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/proof/proof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func TestNewShareInclusionProof(t *testing.T) {
txs := testfactory.GenerateRandomTxs(50, 500)
txs = append(txs, blobTxs...)

dataSquare, err := square.Construct(txs.ToSliceOfBytes(), appconsts.DefaultMaxSquareSize)
dataSquare, err := square.Construct(txs.ToSliceOfBytes(), appconsts.MaxSquareSize)
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/proof/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func QueryShareInclusionProof(_ sdk.Context, path []string, req abci.RequestQuer
return nil, fmt.Errorf("error reading block: %w", err)
}

dataSquare, err := square.Construct(pbb.Data.Txs, appconsts.DefaultMaxSquareSize)
dataSquare, err := square.Construct(pbb.Data.Txs, appconsts.MaxSquareSize)
if err != nil {
return nil, err
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/shares/non_interactive_defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ func TestBlobSharesUsedNonInteractiveDefaults(t *testing.T) {
{0, 8, 20, []int{5, 5, 5, 5}, []uint32{0, 5, 10, 15}},
{0, 8, 10, []int{10}, []uint32{0}},
{1, 8, 20, []int{10, 10}, []uint32{1, 11}},
{0, appconsts.DefaultMaxSquareSize, 1000, []int{1000}, []uint32{0}},
{0, appconsts.DefaultMaxSquareSize, appconsts.DefaultMaxSquareSize + 1, []int{appconsts.DefaultMaxSquareSize + 1}, []uint32{0}},
{0, appconsts.MaxSquareSize, 1000, []int{1000}, []uint32{0}},
{0, appconsts.MaxSquareSize, appconsts.MaxSquareSize + 1, []int{appconsts.MaxSquareSize + 1}, []uint32{0}},
{1, 128, 385, []int{128, 128, 128}, []uint32{2, 130, 258}},
{1024, appconsts.DefaultMaxSquareSize, 32, []int{32}, []uint32{1024}},
{1024, appconsts.MaxSquareSize, 32, []int{32}, []uint32{1024}},
}
for i, tt := range tests {
res, indexes := BlobSharesUsedNonInteractiveDefaults(tt.cursor, tt.squareSize, tt.blobLens...)
Expand Down Expand Up @@ -475,7 +475,7 @@ func TestSubTreeWidth(t *testing.T) {
want: 8,
},
{
shareCount: (appconsts.SubtreeRootThreshold * appconsts.DefaultMaxSquareSize) - 1,
shareCount: (appconsts.SubtreeRootThreshold * appconsts.MaxSquareSize) - 1,
want: 128,
},
}
Expand Down
18 changes: 9 additions & 9 deletions pkg/square/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,24 @@ func TestBuilderSquareSizeEstimation(t *testing.T) {
expectedSquareSize uint64
}
tests := []test{
{"empty block", 0, 0, 0, appconsts.DefaultMinSquareSize},
{"empty block", 0, 0, 0, appconsts.MinSquareSize},
{"one normal tx", 1, 0, 0, 1},
{"one small pfb small block", 0, 1, 100, 2},
{"mixed small block", 10, 12, 500, 8},
{"small block 2", 0, 12, 1000, 8},
{"mixed medium block 2", 10, 20, 10000, 32},
{"one large pfb large block", 0, 1, 1000000, 64},
{"one hundred large pfb large block", 0, 100, 100000, appconsts.DefaultMaxSquareSize},
{"one hundred large pfb medium block", 100, 100, 100000, appconsts.DefaultMaxSquareSize},
{"mixed transactions large block", 100, 100, 100000, appconsts.DefaultMaxSquareSize},
{"mixed transactions large block 2", 1000, 1000, 10000, appconsts.DefaultMaxSquareSize},
{"mostly transactions large block", 10000, 1000, 100, appconsts.DefaultMaxSquareSize},
{"only small pfb large block", 0, 10000, 1, appconsts.DefaultMaxSquareSize},
{"one hundred large pfb large block", 0, 100, 100000, appconsts.MaxSquareSize},
{"one hundred large pfb medium block", 100, 100, 100000, appconsts.MaxSquareSize},
{"mixed transactions large block", 100, 100, 100000, appconsts.MaxSquareSize},
{"mixed transactions large block 2", 1000, 1000, 10000, appconsts.MaxSquareSize},
{"mostly transactions large block", 10000, 1000, 100, appconsts.MaxSquareSize},
{"only small pfb large block", 0, 10000, 1, appconsts.MaxSquareSize},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
txs := generateMixedTxs(tt.normalTxs, tt.pfbCount, 1, tt.pfbSize)
square, _, err := square.Build(txs, appconsts.DefaultMaxSquareSize)
square, _, err := square.Build(txs, appconsts.MaxSquareSize)
require.NoError(t, err)
require.EqualValues(t, tt.expectedSquareSize, square.Size())
})
Expand Down Expand Up @@ -148,7 +148,7 @@ func TestBuilderFindTxShareRange(t *testing.T) {
blockTxs = append(blockTxs, blobfactory.RandBlobTxsRandomlySized(encCfg.TxConfig.TxEncoder(), 5, 1000, 10).ToSliceOfBytes()...)
require.Len(t, blockTxs, 10)

builder, err := square.NewBuilder(appconsts.DefaultMaxSquareSize, blockTxs...)
builder, err := square.NewBuilder(appconsts.MaxSquareSize, blockTxs...)
require.NoError(t, err)

dataSquare, err := builder.Export()
Expand Down
Loading

0 comments on commit f335904

Please sign in to comment.