From 91b40ae6df93140bef1be25f2fdbbcf3ca37ae8a Mon Sep 17 00:00:00 2001 From: sweexordious Date: Wed, 25 Sep 2024 10:22:02 +0400 Subject: [PATCH 01/33] chore: add benchmarks for msg send in 8mb --- app/benchmark_test.go | 178 ++++++++++++++++++++++++++++++++ pkg/appconsts/initial_consts.go | 2 +- test/util/test_app.go | 2 +- 3 files changed, 180 insertions(+), 2 deletions(-) create mode 100644 app/benchmark_test.go diff --git a/app/benchmark_test.go b/app/benchmark_test.go new file mode 100644 index 0000000000..0266ac0e35 --- /dev/null +++ b/app/benchmark_test.go @@ -0,0 +1,178 @@ +package app_test + +import ( + "fmt" + "github.com/celestiaorg/celestia-app/v3/app" + "github.com/celestiaorg/celestia-app/v3/app/encoding" + "github.com/celestiaorg/celestia-app/v3/pkg/appconsts" + "github.com/celestiaorg/celestia-app/v3/pkg/user" + testutil "github.com/celestiaorg/celestia-app/v3/test/util" + "github.com/celestiaorg/celestia-app/v3/test/util/testfactory" + "github.com/celestiaorg/celestia-app/v3/test/util/testnode" + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/abci/types" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + "github.com/tendermint/tendermint/proto/tendermint/version" + "testing" +) + +func BenchmarkCheckTx_MsgSend(b *testing.B) { + testApp, rawTxs := generateMsgSendTransactions(b, 1) + + checkTxRequest := types.RequestCheckTx{ + Tx: rawTxs[0], + Type: types.CheckTxType_New, + } + + b.ResetTimer() + testApp.CheckTx(checkTxRequest) +} + +func BenchmarkDeliverTx_MsgSend(b *testing.B) { + testApp, rawTxs := generateMsgSendTransactions(b, 1) + + deliverTxRequest := types.RequestDeliverTx{ + Tx: rawTxs[0], + } + + b.ResetTimer() + testApp.DeliverTx(deliverTxRequest) +} + +func BenchmarkPrepareProposal_MsgSend_1(b *testing.B) { + testApp, rawTxs := generateMsgSendTransactions(b, 1) + + prepareProposalRequest := types.RequestPrepareProposal{ + BlockData: &tmproto.Data{ + Txs: rawTxs, + }, + ChainId: testApp.GetChainID(), + Height: 10, + } + + b.ResetTimer() + testApp.PrepareProposal(prepareProposalRequest) +} + +func BenchmarkPrepareProposal_MsgSend_8MB(b *testing.B) { + // a full 8mb block equals to around 39200 msg send transactions. + // using 39300 to let prepare proposal choose the maximum + testApp, rawTxs := generateMsgSendTransactions(b, 39300) + + blockData := &tmproto.Data{ + Txs: rawTxs, + } + prepareProposalRequest := types.RequestPrepareProposal{ + BlockData: blockData, + ChainId: testApp.GetChainID(), + Height: 10, + } + + b.ResetTimer() + prepareProposalResponse := testApp.PrepareProposal(prepareProposalRequest) + b.StopTimer() + testApp.Logger().Info("block prepared", "number of transactions", len(prepareProposalResponse.BlockData.Txs), "block size (mb)~", calculateBlockSizeInMb(prepareProposalResponse.BlockData.Txs)) +} + +func BenchmarkProcessProposal_MsgSend_1(b *testing.B) { + testApp, rawTxs := generateMsgSendTransactions(b, 1) + + blockData := &tmproto.Data{ + Txs: rawTxs, + } + prepareProposalRequest := types.RequestPrepareProposal{ + BlockData: blockData, + ChainId: testApp.GetChainID(), + Height: 10, + } + prepareProposalResponse := testApp.PrepareProposal(prepareProposalRequest) + + processProposalRequest := types.RequestProcessProposal{ + BlockData: prepareProposalResponse.BlockData, + Header: tmproto.Header{ + Height: 1, + DataHash: prepareProposalResponse.BlockData.Hash, + ChainID: testutil.ChainID, + Version: version.Consensus{ + App: testApp.AppVersion(), + }, + }, + } + + b.ResetTimer() + testApp.ProcessProposal(processProposalRequest) +} + +func BenchmarkProcessProposal_MsgSend_8MB(b *testing.B) { + // a full 8mb block equals to around 39200 msg send transactions. + // using 39300 to let prepare proposal choose the maximum + testApp, rawTxs := generateMsgSendTransactions(b, 39300) + + blockData := &tmproto.Data{ + Txs: rawTxs, + } + prepareProposalRequest := types.RequestPrepareProposal{ + BlockData: blockData, + ChainId: testApp.GetChainID(), + Height: 10, + } + prepareProposalResponse := testApp.PrepareProposal(prepareProposalRequest) + + testApp.Logger().Info("block prepared", "number of transactions", len(prepareProposalResponse.BlockData.Txs), "block size (mb)~", calculateBlockSizeInMb(prepareProposalResponse.BlockData.Txs)) + + processProposalRequest := types.RequestProcessProposal{ + BlockData: prepareProposalResponse.BlockData, + Header: tmproto.Header{ + Height: 1, + DataHash: prepareProposalResponse.BlockData.Hash, + ChainID: testutil.ChainID, + Version: version.Consensus{ + App: testApp.AppVersion(), + }, + }, + } + + b.ResetTimer() + testApp.ProcessProposal(processProposalRequest) +} + +// generateMsgSendTransactions creates a test app then generates a number +// of valid msg send transactions. +func generateMsgSendTransactions(b *testing.B, count int) (*app.App, [][]byte) { + account := "test" + testApp, kr := testutil.SetupTestAppWithGenesisValSet(app.DefaultConsensusParams(), account) + addr := testfactory.GetAddress(kr, account) + enc := encoding.MakeConfig(app.ModuleEncodingRegisters...) + acc := testutil.DirectQueryAccount(testApp, addr) + accountSequence := acc.GetSequence() + signer, err := user.NewSigner(kr, enc.TxConfig, testutil.ChainID, appconsts.LatestVersion, user.NewAccount(account, acc.GetAccountNumber(), acc.GetSequence())) + require.NoError(b, err) + rawTxs := make([][]byte, 0, count) + for i := 0; i < count; i++ { + msg := banktypes.NewMsgSend( + addr, + testnode.RandomAddress().(sdk.AccAddress), + sdk.NewCoins(sdk.NewInt64Coin(appconsts.BondDenom, 10)), + ) + rawTx, err := signer.CreateTx([]sdk.Msg{msg}, user.SetGasLimit(1000000), user.SetFee(10)) + require.NoError(b, err) + rawTxs = append(rawTxs, rawTx) + accountSequence++ + err = signer.SetSequence(account, accountSequence) + require.NoError(b, err) + } + return testApp, rawTxs +} + +// calculateBlockSizeInMb returns the block size in mb given a set +// of raw transactions. +func calculateBlockSizeInMb(txs [][]byte) string { + numberOfBytes := 0 + for _, tx := range txs { + numberOfBytes += len(tx) + } + mb := float64(numberOfBytes) / 1048576 + return fmt.Sprintf("%.3f", mb) +} diff --git a/pkg/appconsts/initial_consts.go b/pkg/appconsts/initial_consts.go index 18cafc969d..5bc8a73270 100644 --- a/pkg/appconsts/initial_consts.go +++ b/pkg/appconsts/initial_consts.go @@ -11,7 +11,7 @@ import ( const ( // DefaultGovMaxSquareSize is the default value for the governance modifiable // max square size. - DefaultGovMaxSquareSize = 64 + DefaultGovMaxSquareSize = 128 // DefaultMaxBytes is the default value for the governance modifiable // maximum number of bytes allowed in a valid block. diff --git a/test/util/test_app.go b/test/util/test_app.go index 8b4a433e9c..b1148d6fa4 100644 --- a/test/util/test_app.go +++ b/test/util/test_app.go @@ -188,7 +188,7 @@ func NewTestAppWithGenesisSet(cparams *tmproto.ConsensusParams, genAccounts ...s Block: &abci.BlockParams{ // choose some value large enough to not bottleneck the max square // size - MaxBytes: int64(appconsts.DefaultUpperBoundMaxBytes), + MaxBytes: cparams.Block.MaxBytes, MaxGas: cparams.Block.MaxGas, }, Evidence: &cparams.Evidence, From 5092439b95048bc856755e9027d2eee31df325e6 Mon Sep 17 00:00:00 2001 From: sweexordious Date: Wed, 25 Sep 2024 10:42:35 +0400 Subject: [PATCH 02/33] chore: run benchmarks multiple times --- app/benchmark_test.go | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/app/benchmark_test.go b/app/benchmark_test.go index 0266ac0e35..4e55df6755 100644 --- a/app/benchmark_test.go +++ b/app/benchmark_test.go @@ -27,7 +27,9 @@ func BenchmarkCheckTx_MsgSend(b *testing.B) { } b.ResetTimer() - testApp.CheckTx(checkTxRequest) + for i := 0; i < b.N; i++ { + testApp.CheckTx(checkTxRequest) + } } func BenchmarkDeliverTx_MsgSend(b *testing.B) { @@ -38,7 +40,9 @@ func BenchmarkDeliverTx_MsgSend(b *testing.B) { } b.ResetTimer() - testApp.DeliverTx(deliverTxRequest) + for i := 0; i < b.N; i++ { + testApp.DeliverTx(deliverTxRequest) + } } func BenchmarkPrepareProposal_MsgSend_1(b *testing.B) { @@ -53,7 +57,9 @@ func BenchmarkPrepareProposal_MsgSend_1(b *testing.B) { } b.ResetTimer() - testApp.PrepareProposal(prepareProposalRequest) + for i := 0; i < b.N; i++ { + testApp.PrepareProposal(prepareProposalRequest) + } } func BenchmarkPrepareProposal_MsgSend_8MB(b *testing.B) { @@ -71,7 +77,10 @@ func BenchmarkPrepareProposal_MsgSend_8MB(b *testing.B) { } b.ResetTimer() - prepareProposalResponse := testApp.PrepareProposal(prepareProposalRequest) + var prepareProposalResponse types.ResponsePrepareProposal + for i := 0; i < b.N; i++ { + prepareProposalResponse = testApp.PrepareProposal(prepareProposalRequest) + } b.StopTimer() testApp.Logger().Info("block prepared", "number of transactions", len(prepareProposalResponse.BlockData.Txs), "block size (mb)~", calculateBlockSizeInMb(prepareProposalResponse.BlockData.Txs)) } @@ -102,7 +111,9 @@ func BenchmarkProcessProposal_MsgSend_1(b *testing.B) { } b.ResetTimer() - testApp.ProcessProposal(processProposalRequest) + for i := 0; i < b.N; i++ { + testApp.ProcessProposal(processProposalRequest) + } } func BenchmarkProcessProposal_MsgSend_8MB(b *testing.B) { @@ -135,7 +146,9 @@ func BenchmarkProcessProposal_MsgSend_8MB(b *testing.B) { } b.ResetTimer() - testApp.ProcessProposal(processProposalRequest) + for i := 0; i < b.N; i++ { + testApp.ProcessProposal(processProposalRequest) + } } // generateMsgSendTransactions creates a test app then generates a number From 73356439816295a8f402f315a00ab6cab911b498 Mon Sep 17 00:00:00 2001 From: sweexordious Date: Wed, 25 Sep 2024 13:31:09 +0400 Subject: [PATCH 03/33] chore: two decimals after comma in block size --- app/benchmark_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/benchmark_test.go b/app/benchmark_test.go index 4e55df6755..3b7993cbe0 100644 --- a/app/benchmark_test.go +++ b/app/benchmark_test.go @@ -187,5 +187,5 @@ func calculateBlockSizeInMb(txs [][]byte) string { numberOfBytes += len(tx) } mb := float64(numberOfBytes) / 1048576 - return fmt.Sprintf("%.3f", mb) + return fmt.Sprintf("%.2f", mb) } From 9c0742e0a074ba4adb6aacee4f810c9c982bb866 Mon Sep 17 00:00:00 2001 From: sweexordious Date: Thu, 26 Sep 2024 09:06:13 +0400 Subject: [PATCH 04/33] chore: add 8b check tx and deliver tx --- app/benchmark_test.go | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/app/benchmark_test.go b/app/benchmark_test.go index 3b7993cbe0..fc07fcabf8 100644 --- a/app/benchmark_test.go +++ b/app/benchmark_test.go @@ -18,7 +18,7 @@ import ( "testing" ) -func BenchmarkCheckTx_MsgSend(b *testing.B) { +func BenchmarkCheckTx_MsgSend_1(b *testing.B) { testApp, rawTxs := generateMsgSendTransactions(b, 1) checkTxRequest := types.RequestCheckTx{ @@ -32,7 +32,23 @@ func BenchmarkCheckTx_MsgSend(b *testing.B) { } } -func BenchmarkDeliverTx_MsgSend(b *testing.B) { +func BenchmarkCheckTx_MsgSend_8MB(b *testing.B) { + testApp, rawTxs := generateMsgSendTransactions(b, 1) + + checkTxRequest := types.RequestCheckTx{ + Tx: rawTxs[0], + Type: types.CheckTxType_New, + } + + b.ResetTimer() + for i := 0; i < b.N; i++ { + for j := 0; j < 39200; j++ { + testApp.CheckTx(checkTxRequest) + } + } +} + +func BenchmarkDeliverTx_MsgSend_1(b *testing.B) { testApp, rawTxs := generateMsgSendTransactions(b, 1) deliverTxRequest := types.RequestDeliverTx{ @@ -45,6 +61,21 @@ func BenchmarkDeliverTx_MsgSend(b *testing.B) { } } +func BenchmarkDeliverTx_MsgSend_8MB(b *testing.B) { + testApp, rawTxs := generateMsgSendTransactions(b, 1) + + deliverTxRequest := types.RequestDeliverTx{ + Tx: rawTxs[0], + } + + b.ResetTimer() + for i := 0; i < b.N; i++ { + for j := 0; j < 39200; j++ { + testApp.DeliverTx(deliverTxRequest) + } + } +} + func BenchmarkPrepareProposal_MsgSend_1(b *testing.B) { testApp, rawTxs := generateMsgSendTransactions(b, 1) From ff28c12bee6530fa558742d7c91cc858fd95e1e0 Mon Sep 17 00:00:00 2001 From: sweexordious Date: Fri, 27 Sep 2024 15:43:51 +0400 Subject: [PATCH 05/33] chore: add PFB benchmarks --- ...ark_test.go => benchmark_msg_send_test.go} | 54 +++- app/benchmark_pfb_test.go | 264 ++++++++++++++++++ 2 files changed, 309 insertions(+), 9 deletions(-) rename app/{benchmark_test.go => benchmark_msg_send_test.go} (76%) create mode 100644 app/benchmark_pfb_test.go diff --git a/app/benchmark_test.go b/app/benchmark_msg_send_test.go similarity index 76% rename from app/benchmark_test.go rename to app/benchmark_msg_send_test.go index fc07fcabf8..62583ca999 100644 --- a/app/benchmark_test.go +++ b/app/benchmark_msg_send_test.go @@ -1,7 +1,6 @@ package app_test import ( - "fmt" "github.com/celestiaorg/celestia-app/v3/app" "github.com/celestiaorg/celestia-app/v3/app/encoding" "github.com/celestiaorg/celestia-app/v3/pkg/appconsts" @@ -26,10 +25,13 @@ func BenchmarkCheckTx_MsgSend_1(b *testing.B) { Type: types.CheckTxType_New, } + var resp types.ResponseCheckTx b.ResetTimer() for i := 0; i < b.N; i++ { - testApp.CheckTx(checkTxRequest) + resp = testApp.CheckTx(checkTxRequest) } + b.StopTimer() + b.ReportMetric(float64(resp.GasUsed), "gas_used") } func BenchmarkCheckTx_MsgSend_8MB(b *testing.B) { @@ -40,12 +42,18 @@ func BenchmarkCheckTx_MsgSend_8MB(b *testing.B) { Type: types.CheckTxType_New, } + var totalGas int64 b.ResetTimer() for i := 0; i < b.N; i++ { for j := 0; j < 39200; j++ { - testApp.CheckTx(checkTxRequest) + resp := testApp.CheckTx(checkTxRequest) + b.StopTimer() + totalGas += resp.GasUsed + b.StartTimer() } } + b.StopTimer() + b.ReportMetric(float64(totalGas), "total_gas_used") } func BenchmarkDeliverTx_MsgSend_1(b *testing.B) { @@ -55,10 +63,13 @@ func BenchmarkDeliverTx_MsgSend_1(b *testing.B) { Tx: rawTxs[0], } + var resp types.ResponseDeliverTx b.ResetTimer() for i := 0; i < b.N; i++ { testApp.DeliverTx(deliverTxRequest) } + b.StopTimer() + b.ReportMetric(float64(resp.GasUsed), "gas_used") } func BenchmarkDeliverTx_MsgSend_8MB(b *testing.B) { @@ -68,12 +79,18 @@ func BenchmarkDeliverTx_MsgSend_8MB(b *testing.B) { Tx: rawTxs[0], } + var totalGas int64 b.ResetTimer() for i := 0; i < b.N; i++ { for j := 0; j < 39200; j++ { - testApp.DeliverTx(deliverTxRequest) + resp := testApp.DeliverTx(deliverTxRequest) + b.StopTimer() + totalGas += resp.GasUsed + b.StartTimer() } } + b.StopTimer() + b.ReportMetric(float64(totalGas), "total_gas_used") } func BenchmarkPrepareProposal_MsgSend_1(b *testing.B) { @@ -91,6 +108,8 @@ func BenchmarkPrepareProposal_MsgSend_1(b *testing.B) { for i := 0; i < b.N; i++ { testApp.PrepareProposal(prepareProposalRequest) } + b.StopTimer() + b.ReportMetric(float64(calculateTotalGasUsed(testApp, rawTxs)), "total_gas_used") } func BenchmarkPrepareProposal_MsgSend_8MB(b *testing.B) { @@ -113,7 +132,9 @@ func BenchmarkPrepareProposal_MsgSend_8MB(b *testing.B) { prepareProposalResponse = testApp.PrepareProposal(prepareProposalRequest) } b.StopTimer() - testApp.Logger().Info("block prepared", "number of transactions", len(prepareProposalResponse.BlockData.Txs), "block size (mb)~", calculateBlockSizeInMb(prepareProposalResponse.BlockData.Txs)) + b.ReportMetric(float64(len(prepareProposalResponse.BlockData.Txs)), "number_of_transactions") + b.ReportMetric(calculateBlockSizeInMb(prepareProposalResponse.BlockData.Txs), "block_size(mb)") + b.ReportMetric(float64(calculateTotalGasUsed(testApp, rawTxs)), "total_gas_used") } func BenchmarkProcessProposal_MsgSend_1(b *testing.B) { @@ -145,6 +166,8 @@ func BenchmarkProcessProposal_MsgSend_1(b *testing.B) { for i := 0; i < b.N; i++ { testApp.ProcessProposal(processProposalRequest) } + b.StopTimer() + b.ReportMetric(float64(calculateTotalGasUsed(testApp, rawTxs)), "total_gas_used") } func BenchmarkProcessProposal_MsgSend_8MB(b *testing.B) { @@ -162,12 +185,14 @@ func BenchmarkProcessProposal_MsgSend_8MB(b *testing.B) { } prepareProposalResponse := testApp.PrepareProposal(prepareProposalRequest) - testApp.Logger().Info("block prepared", "number of transactions", len(prepareProposalResponse.BlockData.Txs), "block size (mb)~", calculateBlockSizeInMb(prepareProposalResponse.BlockData.Txs)) + b.ReportMetric(float64(len(prepareProposalResponse.BlockData.Txs)), "number of transactions") + b.ReportMetric(calculateBlockSizeInMb(prepareProposalResponse.BlockData.Txs), "block size (mb)") + b.ReportMetric(float64(calculateTotalGasUsed(testApp, rawTxs)), "total_gas_used") processProposalRequest := types.RequestProcessProposal{ BlockData: prepareProposalResponse.BlockData, Header: tmproto.Header{ - Height: 1, + Height: 10, DataHash: prepareProposalResponse.BlockData.Hash, ChainID: testutil.ChainID, Version: version.Consensus{ @@ -212,11 +237,22 @@ func generateMsgSendTransactions(b *testing.B, count int) (*app.App, [][]byte) { // calculateBlockSizeInMb returns the block size in mb given a set // of raw transactions. -func calculateBlockSizeInMb(txs [][]byte) string { +func calculateBlockSizeInMb(txs [][]byte) float64 { numberOfBytes := 0 for _, tx := range txs { numberOfBytes += len(tx) } mb := float64(numberOfBytes) / 1048576 - return fmt.Sprintf("%.2f", mb) + return mb +} + +// calculateTotalGasUsed simulates the provided transactions and returns the +// total gas used by all of them +func calculateTotalGasUsed(testApp *app.App, txs [][]byte) uint64 { + var totalGas uint64 + for _, tx := range txs { + gasInfo, _, _ := testApp.Simulate(tx) + totalGas += gasInfo.GasUsed + } + return totalGas } diff --git a/app/benchmark_pfb_test.go b/app/benchmark_pfb_test.go new file mode 100644 index 0000000000..dea0456fdc --- /dev/null +++ b/app/benchmark_pfb_test.go @@ -0,0 +1,264 @@ +package app_test + +import ( + "fmt" + "github.com/celestiaorg/celestia-app/v3/app" + "github.com/celestiaorg/celestia-app/v3/app/encoding" + "github.com/celestiaorg/celestia-app/v3/pkg/appconsts" + "github.com/celestiaorg/celestia-app/v3/pkg/user" + testutil "github.com/celestiaorg/celestia-app/v3/test/util" + "github.com/celestiaorg/celestia-app/v3/test/util/testfactory" + types2 "github.com/celestiaorg/celestia-app/v3/x/blob/types" + "github.com/celestiaorg/go-square/v2/share" + "github.com/celestiaorg/go-square/v2/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/abci/types" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + "github.com/tendermint/tendermint/proto/tendermint/version" + "math/rand" + "testing" +) + +func BenchmarkCheckTx_PFB_Multi(b *testing.B) { + testCases := []struct { + size int + }{ + {size: 300}, + {size: 500}, + {size: 1000}, + {size: 5000}, + {size: 10_000}, + {size: 50_000}, + {size: 100_000}, + {size: 200_000}, + {size: 300_000}, + {size: 400_000}, + {size: 500_000}, + {size: 1_000_000}, + {size: 2_000_000}, + {size: 3_000_000}, + {size: 4_000_000}, + {size: 5_000_000}, + {size: 6_000_000}, + } + for _, testCase := range testCases { + b.Run(fmt.Sprintf("%d bytes", testCase.size), func(b *testing.B) { + benchmarkCheckTx_PFB(b, testCase.size) + }) + } +} + +func benchmarkCheckTx_PFB(b *testing.B, size int) { + testApp, rawTxs := generatePayForBlobTransactions(b, 1, size) + + checkTxRequest := types.RequestCheckTx{ + Tx: rawTxs[0], + Type: types.CheckTxType_New, + } + + var resp types.ResponseCheckTx + b.ResetTimer() + for i := 0; i < b.N; i++ { + resp = testApp.CheckTx(checkTxRequest) + } + b.StopTimer() + b.ReportMetric(float64(resp.GasUsed), "gas_used") + b.ReportMetric(float64(len(rawTxs[0])), "transaction_size(byte)") +} + +func BenchmarkDeliverTx_PFB_Multi(b *testing.B) { + testCases := []struct { + size int + }{ + {size: 300}, + {size: 500}, + {size: 1000}, + {size: 5000}, + {size: 10_000}, + {size: 50_000}, + {size: 100_000}, + {size: 200_000}, + {size: 300_000}, + {size: 400_000}, + {size: 500_000}, + {size: 1_000_000}, + {size: 2_000_000}, + {size: 3_000_000}, + {size: 4_000_000}, + {size: 5_000_000}, + {size: 6_000_000}, + } + for _, testCase := range testCases { + b.Run(fmt.Sprintf("%d bytes", testCase.size), func(b *testing.B) { + benchmarkDeliverTx_PFB(b, testCase.size) + }) + } +} + +func benchmarkDeliverTx_PFB(b *testing.B, size int) { + testApp, rawTxs := generatePayForBlobTransactions(b, 1, size) + + deliverTxRequest := types.RequestDeliverTx{ + Tx: rawTxs[0], + } + + var resp types.ResponseDeliverTx + b.ResetTimer() + for i := 0; i < b.N; i++ { + resp = testApp.DeliverTx(deliverTxRequest) + } + b.StopTimer() + b.ReportMetric(float64(resp.GasUsed), "gas_used") + b.ReportMetric(float64(len(rawTxs[0])), "transaction_size(byte)") +} + +func BenchmarkPrepareProposal_PFB_Multi(b *testing.B) { + testCases := []struct { + count, size int + }{ + {count: 15_000, size: 300}, + {count: 10_000, size: 500}, + {count: 6_000, size: 1000}, + {count: 3_000, size: 5000}, + {count: 1_000, size: 10_000}, + {count: 500, size: 50_000}, + {count: 100, size: 100_000}, + {count: 100, size: 200_000}, + {count: 50, size: 300_000}, + {count: 50, size: 400_000}, + {count: 30, size: 500_000}, + {count: 10, size: 1_000_000}, + {count: 5, size: 2_000_000}, + {count: 3, size: 3_000_000}, + {count: 3, size: 4_000_000}, + {count: 2, size: 5_000_000}, + {count: 2, size: 6_000_000}, + } + for _, testCase := range testCases { + b.Run(fmt.Sprintf("%d transactions of %d bytes", testCase.count, testCase.size), func(b *testing.B) { + benchmarkPrepareProposal_PFB(b, testCase.count, testCase.size) + }) + } +} + +func benchmarkPrepareProposal_PFB(b *testing.B, count, size int) { + testApp, rawTxs := generatePayForBlobTransactions(b, count, size) + + blockData := &tmproto.Data{ + Txs: rawTxs, + } + prepareProposalRequest := types.RequestPrepareProposal{ + BlockData: blockData, + ChainId: testApp.GetChainID(), + Height: 10, + } + + b.ResetTimer() + prepareProposalResponse := testApp.PrepareProposal(prepareProposalRequest) + b.StopTimer() + b.ReportMetric(float64(b.Elapsed().Nanoseconds()), "prepare_proposal_time(ns)") + b.ReportMetric(float64(len(prepareProposalResponse.BlockData.Txs)), "number_of_transactions") + b.ReportMetric(float64(len(rawTxs[0])), "transactions_size(byte)") + b.ReportMetric(calculateBlockSizeInMb(prepareProposalResponse.BlockData.Txs), "block_size(mb)") + b.ReportMetric(float64(calculateTotalGasUsed(testApp, rawTxs)), "total_gas_used") +} + +func BenchmarkProcessProposal_PFB_Multi(b *testing.B) { + testCases := []struct { + count, size int + }{ + {count: 15_000, size: 300}, + {count: 10_000, size: 500}, + {count: 6_000, size: 1000}, + {count: 3_000, size: 5000}, + {count: 1_000, size: 10_000}, + {count: 500, size: 50_000}, + {count: 100, size: 100_000}, + {count: 100, size: 200_000}, + {count: 50, size: 300_000}, + {count: 50, size: 400_000}, + {count: 30, size: 500_000}, + {count: 10, size: 1_000_000}, + {count: 5, size: 2_000_000}, + {count: 3, size: 3_000_000}, + {count: 3, size: 4_000_000}, + {count: 2, size: 5_000_000}, + {count: 2, size: 6_000_000}, + } + for _, testCase := range testCases { + b.Run(fmt.Sprintf("%d transactions of %d bytes", testCase.count, testCase.size), func(b *testing.B) { + benchmarkProcessProposal_PFB(b, testCase.count, testCase.size) + }) + } +} + +func benchmarkProcessProposal_PFB(b *testing.B, count, size int) { + testApp, rawTxs := generatePayForBlobTransactions(b, count, size) + + blockData := &tmproto.Data{ + Txs: rawTxs, + } + prepareProposalRequest := types.RequestPrepareProposal{ + BlockData: blockData, + ChainId: testApp.GetChainID(), + Height: 10, + } + + prepareProposalResponse := testApp.PrepareProposal(prepareProposalRequest) + + processProposalRequest := types.RequestProcessProposal{ + BlockData: prepareProposalResponse.BlockData, + Header: tmproto.Header{ + Height: 10, + DataHash: prepareProposalResponse.BlockData.Hash, + ChainID: testutil.ChainID, + Version: version.Consensus{ + App: testApp.AppVersion(), + }, + }, + } + + b.ResetTimer() + resp := testApp.ProcessProposal(processProposalRequest) + b.StopTimer() + require.Equal(b, types.ResponseProcessProposal_ACCEPT, resp.Result) + + b.ReportMetric(float64(b.Elapsed().Nanoseconds()), "process_proposal_time(ns)") + b.ReportMetric(float64(len(prepareProposalResponse.BlockData.Txs)), "number_of_transactions") + b.ReportMetric(float64(len(rawTxs[0])), "transactions_size(byte)") + b.ReportMetric(calculateBlockSizeInMb(prepareProposalResponse.BlockData.Txs), "block_size(mb)") + b.ReportMetric(float64(calculateTotalGasUsed(testApp, rawTxs)), "total_gas_used") +} + +// generatePayForBlobTransactions creates a test app then generates a number +// of valid PFB transactions. +func generatePayForBlobTransactions(b *testing.B, count int, size int) (*app.App, [][]byte) { + account := "test" + testApp, kr := testutil.SetupTestAppWithGenesisValSet(app.DefaultConsensusParams(), account) + addr := testfactory.GetAddress(kr, account) + enc := encoding.MakeConfig(app.ModuleEncodingRegisters...) + acc := testutil.DirectQueryAccount(testApp, addr) + accountSequence := acc.GetSequence() + signer, err := user.NewSigner(kr, enc.TxConfig, testutil.ChainID, appconsts.LatestVersion, user.NewAccount(account, acc.GetAccountNumber(), acc.GetSequence())) + require.NoError(b, err) + + rawTxs := make([][]byte, 0, count) + randomBytes := make([]byte, size) + _, err = rand.Read(randomBytes) + require.NoError(b, err) + blob, err := share.NewBlob(share.RandomNamespace(), randomBytes, 1, acc.GetAddress().Bytes()) + require.NoError(b, err) + for i := 0; i < count; i++ { + msg, err := types2.NewMsgPayForBlobs(acc.GetAddress().String(), 1, blob) + rawTx, err := signer.CreateTx([]sdk.Msg{msg}, user.SetGasLimit(2549760000), user.SetFee(10000)) + require.NoError(b, err) + blobTxBytes, err := tx.MarshalBlobTx(rawTx, blob) + require.NoError(b, err) + rawTxs = append(rawTxs, blobTxBytes) + accountSequence++ + err = signer.SetSequence(account, accountSequence) + require.NoError(b, err) + } + return testApp, rawTxs +} From 53177d8313c9696908ad5767a91f95a17ded3133 Mon Sep 17 00:00:00 2001 From: sweexordious Date: Sun, 29 Sep 2024 00:25:34 +0400 Subject: [PATCH 06/33] chore: initial ibc client update benchmarks --- app/benchmark_ibc_update_client_test.go | 369 ++++++++++++++++++++++++ go.mod | 1 + test/util/test_app.go | 1 + 3 files changed, 371 insertions(+) create mode 100644 app/benchmark_ibc_update_client_test.go diff --git a/app/benchmark_ibc_update_client_test.go b/app/benchmark_ibc_update_client_test.go new file mode 100644 index 0000000000..166ba369ad --- /dev/null +++ b/app/benchmark_ibc_update_client_test.go @@ -0,0 +1,369 @@ +package app_test + +import ( + "fmt" + "github.com/celestiaorg/celestia-app/v3/app" + "github.com/celestiaorg/celestia-app/v3/app/encoding" + "github.com/celestiaorg/celestia-app/v3/pkg/appconsts" + "github.com/celestiaorg/celestia-app/v3/pkg/user" + testutil "github.com/celestiaorg/celestia-app/v3/test/util" + "github.com/celestiaorg/celestia-app/v3/test/util/testfactory" + dbm "github.com/cometbft/cometbft-db" + sdk "github.com/cosmos/cosmos-sdk/types" + types3 "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" + types2 "github.com/cosmos/ibc-go/v6/modules/core/23-commitment/types" + types4 "github.com/cosmos/ibc-go/v6/modules/light-clients/07-tendermint/types" + "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/crypto" + "github.com/tendermint/tendermint/crypto/tmhash" + crypto2 "github.com/tendermint/tendermint/proto/tendermint/crypto" + types5 "github.com/tendermint/tendermint/proto/tendermint/types" + "github.com/tendermint/tendermint/version" + "math" + "testing" + "time" + + "github.com/tendermint/tendermint/crypto/ed25519" + cmtversion "github.com/tendermint/tendermint/proto/tendermint/version" + sm "github.com/tendermint/tendermint/state" + types0 "github.com/tendermint/tendermint/types" +) + +func BenchmarkIBC_Update_Client_Multi(b *testing.B) { + testCases := []struct { + size int + }{ + {size: 300}, + //{size: 500}, + //{size: 1000}, + //{size: 5000}, + //{size: 10_000}, + //{size: 50_000}, + //{size: 100_000}, + //{size: 200_000}, + //{size: 300_000}, + //{size: 400_000}, + //{size: 500_000}, + //{size: 1_000_000}, + //{size: 2_000_000}, + //{size: 3_000_000}, + //{size: 4_000_000}, + //{size: 5_000_000}, + //{size: 6_000_000}, + } + for _, testCase := range testCases { + b.Run(fmt.Sprintf("%d bytes", testCase.size), func(b *testing.B) { + benchmarkIBC_Update_Client(b, testCase.size) + }) + } +} + +func benchmarkIBC_Update_Client(b *testing.B, size int) { + testApp, rawTx := generateIBCUpdateClientTransaction(b, 1) + + deliverTxRequest := types.RequestDeliverTx{ + Tx: rawTx, + } + + var resp types.ResponseDeliverTx + b.ResetTimer() + for i := 0; i < b.N; i++ { + resp = testApp.DeliverTx(deliverTxRequest) + } + b.StopTimer() + b.ReportMetric(float64(resp.GasUsed), "gas_used") + b.ReportMetric(float64(len(rawTx)), "transaction_size(byte)") +} + +// generatePayForBlobTransactions creates a test app then generates an IBC +// update client transaction with the specified number of signatures +func generateIBCUpdateClientTransaction(b *testing.B, numberOfSignatures int) (*app.App, []byte) { + account := "test" + testApp, kr := testutil.SetupTestAppWithGenesisValSet(app.DefaultConsensusParams(), account) + addr := testfactory.GetAddress(kr, account) + enc := encoding.MakeConfig(app.ModuleEncodingRegisters...) + acc := testutil.DirectQueryAccount(testApp, addr) + signer, err := user.NewSigner(kr, enc.TxConfig, testutil.ChainID, appconsts.LatestVersion, user.NewAccount(account, acc.GetAccountNumber(), acc.GetSequence())) + require.NoError(b, err) + + msg, msg2 := generateUpdateClientTransaction(b, acc.GetAddress().String()) + rawTx, err := signer.CreateTx([]sdk.Msg{msg2, msg}, user.SetGasLimit(2549760000), user.SetFee(10000)) + require.NoError(b, err) + return testApp, rawTx +} + +func generateUpdateClientTransaction(b *testing.B, signer string) (*types3.MsgUpdateClient, *types3.MsgCreateClient) { + numberOfValidators := 100 + state, _, privVals := makeState(numberOfValidators, 5) + wBefore := time.Now() + time.Sleep(time.Second) + w := time.Now() + lastResultHash := crypto.CRandBytes(tmhash.Size) + lastCommitHash := crypto.CRandBytes(tmhash.Size) + lastBlockHash := crypto.CRandBytes(tmhash.Size) + lastBlockID := makeBlockID(lastBlockHash, 1000, []byte("hash")) + header := types5.Header{ + Version: cmtversion.Consensus{Block: version.BlockProtocol, App: 1}, + ChainID: state.ChainID, + Height: 5, + Time: w, + LastCommitHash: lastCommitHash, + DataHash: crypto.CRandBytes(tmhash.Size), + ValidatorsHash: state.Validators.Hash(), + NextValidatorsHash: state.Validators.Hash(), + ConsensusHash: crypto.CRandBytes(tmhash.Size), + AppHash: crypto.CRandBytes(tmhash.Size), + LastResultsHash: lastResultHash, + EvidenceHash: crypto.CRandBytes(tmhash.Size), + ProposerAddress: crypto.CRandBytes(crypto.AddressSize), + LastBlockId: lastBlockID.ToProto(), + } + t := types0.Header{ + Version: cmtversion.Consensus{Block: version.BlockProtocol, App: 1}, + ChainID: state.ChainID, + Height: 5, + Time: w, + LastCommitHash: header.LastCommitHash, + DataHash: header.DataHash, + ValidatorsHash: header.ValidatorsHash, + NextValidatorsHash: header.NextValidatorsHash, + ConsensusHash: header.ConsensusHash, + AppHash: header.AppHash, + LastResultsHash: header.LastResultsHash, + EvidenceHash: header.EvidenceHash, + ProposerAddress: header.ProposerAddress, + LastBlockID: lastBlockID, + } + header0Hash := t.Hash() + fmt.Println(header0Hash.Bytes()) + blockID := makeBlockID(header0Hash, 1000, []byte("partshash")) + commit, err := makeValidCommit(5, blockID, state.Validators, privVals) + require.NoError(b, err) + signatures := make([]types5.CommitSig, numberOfValidators) + validators := make([]*types5.Validator, numberOfValidators) + for i := 0; i < numberOfValidators; i++ { + signatures[i] = types5.CommitSig{ + BlockIdFlag: types5.BlockIDFlag(commit.Signatures[i].BlockIDFlag), + ValidatorAddress: commit.Signatures[i].ValidatorAddress, + Timestamp: commit.Signatures[i].Timestamp, + Signature: commit.Signatures[i].Signature, + } + validators[i] = &types5.Validator{ + Address: state.Validators.Validators[i].Address, + PubKey: crypto2.PublicKey{Sum: &crypto2.PublicKey_Ed25519{Ed25519: state.Validators.Validators[i].PubKey.Bytes()}}, + VotingPower: state.Validators.Validators[i].VotingPower, + ProposerPriority: state.Validators.Validators[i].ProposerPriority, + } + } + sh := types5.SignedHeader{ + Header: &header, + Commit: &types5.Commit{ + Height: commit.Height, + Round: commit.Round, + BlockID: types5.BlockID{ + Hash: header0Hash, + PartSetHeader: types5.PartSetHeader{ + Total: commit.BlockID.PartSetHeader.Total, + Hash: commit.BlockID.PartSetHeader.Hash, + }, + }, + Signatures: signatures, + }, + } + clientState := types4.ClientState{ + ChainId: chainID, + TrustLevel: types4.Fraction{Numerator: 1, Denominator: 1}, // we want all signatures to be verified + TrustingPeriod: time.Hour * 24 * 21 * 100, // we want to always accept the upgrade + UnbondingPeriod: time.Hour * 24 * 21 * 101, + MaxClockDrift: math.MaxInt64 - 1, + FrozenHeight: types3.Height{ + RevisionNumber: 0, + RevisionHeight: 0, + }, + LatestHeight: types3.Height{ + RevisionNumber: 0, + RevisionHeight: 4, + }, + ProofSpecs: types2.GetSDKSpecs(), + UpgradePath: nil, + AllowUpdateAfterExpiry: true, + AllowUpdateAfterMisbehaviour: true, + } + consensusState := types4.ConsensusState{ + Timestamp: wBefore, + Root: types2.MerkleRoot{Hash: lastBlockHash}, + NextValidatorsHash: state.Validators.Hash(), + } + createClientMsg, err := types3.NewMsgCreateClient(&clientState, &consensusState, signer) + require.NoError(b, err) + msg, err := types3.NewMsgUpdateClient( + "test_client", + &types4.Header{ + SignedHeader: &sh, + ValidatorSet: &types5.ValidatorSet{ + Validators: validators, + Proposer: &types5.Validator{ + Address: state.Validators.Proposer.Address, + PubKey: crypto2.PublicKey{Sum: &crypto2.PublicKey_Ed25519{Ed25519: state.Validators.Proposer.PubKey.Bytes()}}, + VotingPower: state.Validators.Proposer.VotingPower, + ProposerPriority: state.Validators.Proposer.ProposerPriority, + }, + TotalVotingPower: state.Validators.TotalVotingPower(), + }, + TrustedHeight: types3.Height{ + RevisionNumber: 0, + RevisionHeight: 4, + }, + TrustedValidators: &types5.ValidatorSet{ + Validators: validators, + Proposer: &types5.Validator{ + Address: state.Validators.Proposer.Address, + PubKey: crypto2.PublicKey{Sum: &crypto2.PublicKey_Ed25519{Ed25519: state.Validators.Proposer.PubKey.Bytes()}}, + VotingPower: state.Validators.Proposer.VotingPower, + ProposerPriority: state.Validators.Proposer.ProposerPriority, + }, + TotalVotingPower: state.Validators.TotalVotingPower(), + }, + }, + signer, + ) + require.NoError(b, err) + + return msg, createClientMsg +} + +func dummy() { + //state, stateDB, privVals := makeState(100, 5) + //stateStore := sm.NewStore(stateDB, sm.StoreOptions{ + // DiscardABCIResponses: false, + //}) + // + //defaultEvidenceTime := time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC) + //privVal := privVals[state.Validators.Validators[0].Address.String()] + //blockID := makeBlockID([]byte("headerhash"), 1000, []byte("partshash")) + //header := &types0.Header{ + // Version: cmtversion.Consensus{Block: version.BlockProtocol, App: 1}, + // ChainID: state.ChainID, + // Height: 10, + // Time: defaultEvidenceTime, + // LastBlockID: blockID, + // LastCommitHash: crypto.CRandBytes(tmhash.Size), + // DataHash: crypto.CRandBytes(tmhash.Size), + // ValidatorsHash: state.Validators.Hash(), + // NextValidatorsHash: state.Validators.Hash(), + // ConsensusHash: crypto.CRandBytes(tmhash.Size), + // AppHash: crypto.CRandBytes(tmhash.Size), + // LastResultsHash: crypto.CRandBytes(tmhash.Size), + // EvidenceHash: crypto.CRandBytes(tmhash.Size), + // ProposerAddress: crypto.CRandBytes(crypto.AddressSize), + //} + + //// we don't need to worry about validating the evidence as long as they pass validate basic + //dve := types0.NewMockDuplicateVoteEvidenceWithValidator(3, defaultEvidenceTime, privVal, state.ChainID) + //dve.ValidatorPower = 1000 + //lcae := &types0.LightClientAttackEvidence{ + // ConflictingBlock: &types0.LightBlock{ + // SignedHeader: &types0.SignedHeader{ + // Header: header, + // Commit: types0.NewCommit(10, 0, makeBlockID(header.Hash(), 100, []byte("partshash")), []types0.CommitSig{{ + // BlockIDFlag: types0.BlockIDFlagNil, + // ValidatorAddress: crypto.AddressHash([]byte("validator_address")), + // Timestamp: defaultEvidenceTime, + // Signature: crypto.CRandBytes(types0.MaxSignatureSize), + // }}), + // }, + // ValidatorSet: state.Validators, + // }, + // CommonHeight: 8, + // ByzantineValidators: []*types0.Validator{state.Validators.Validators[0]}, + // TotalVotingPower: 12, + // Timestamp: defaultEvidenceTime, + //} +} + +var chainID string = "test" + +func genValSet(size int) (*types0.ValidatorSet, []ed25519.PrivKey) { + vals := make([]*types0.Validator, size) + privateKeys := make([]ed25519.PrivKey, size) + for i := 0; i < size; i++ { + privateKey := ed25519.GenPrivKey() + vals[i] = types0.NewValidator(privateKey.PubKey(), 10) + privateKeys[i] = privateKey + } + return types0.NewValidatorSet(vals), privateKeys +} + +func makeState(nVals, height int) (sm.State, dbm.DB, map[string]types0.PrivValidator) { + vals := make([]types0.GenesisValidator, nVals) + privVals := make(map[string]types0.PrivValidator, nVals) + for i := 0; i < nVals; i++ { + secret := []byte(fmt.Sprintf("test%d", i)) + pk := ed25519.GenPrivKeyFromSecret(secret) + valAddr := pk.PubKey().Address() + vals[i] = types0.GenesisValidator{ + Address: valAddr, + PubKey: pk.PubKey(), + Power: 1000, + Name: fmt.Sprintf("test%d", i), + } + privVals[valAddr.String()] = types0.NewMockPVWithParams(pk, false, false) + } + s, _ := sm.MakeGenesisState(&types0.GenesisDoc{ + ChainID: chainID, + Validators: vals, + AppHash: nil, + }) + + stateDB := dbm.NewMemDB() + stateStore := sm.NewStore(stateDB, sm.StoreOptions{ + DiscardABCIResponses: false, + }) + if err := stateStore.Save(s); err != nil { + panic(err) + } + + for i := 1; i < height; i++ { + s.LastBlockHeight++ + s.LastValidators = s.Validators.Copy() + if err := stateStore.Save(s); err != nil { + panic(err) + } + } + + return s, stateDB, privVals +} +func makeValidCommit( + height int64, + blockID types0.BlockID, + vals *types0.ValidatorSet, + privVals map[string]types0.PrivValidator, +) (*types0.Commit, error) { + sigs := make([]types0.CommitSig, 0) + for i := 0; i < vals.Size(); i++ { + _, val := vals.GetByIndex(int32(i)) + vote, err := types0.MakeVote(height, blockID, vals, privVals[val.Address.String()], chainID, time.Now()) + if err != nil { + return nil, err + } + sigs = append(sigs, vote.CommitSig()) + } + return types0.NewCommit(height, 0, blockID, sigs), nil +} + +func makeBlockID(hash []byte, partSetSize uint32, partSetHash []byte) types0.BlockID { + var ( + h = make([]byte, tmhash.Size) + psH = make([]byte, tmhash.Size) + ) + copy(h, hash) + copy(psH, partSetHash) + return types0.BlockID{ + Hash: h, + PartSetHeader: types0.PartSetHeader{ + Total: partSetSize, + Hash: psH, + }, + } +} diff --git a/go.mod b/go.mod index 91a2cb0eb5..2d1b0e10c7 100644 --- a/go.mod +++ b/go.mod @@ -248,4 +248,5 @@ replace ( github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.41.0-tm-v0.34.29 + github.com/cosmos/ibc-go/v6 => ../ibc-go ) diff --git a/test/util/test_app.go b/test/util/test_app.go index b1148d6fa4..878c4d50a9 100644 --- a/test/util/test_app.go +++ b/test/util/test_app.go @@ -67,6 +67,7 @@ func SetupTestAppWithGenesisValSet(cparams *tmproto.ConsensusParams, genAccounts // commit genesis changes testApp.Commit() testApp.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{ + Time: time.Now(), ChainID: ChainID, Height: testApp.LastBlockHeight() + 1, AppHash: testApp.LastCommitID().Hash, From a260476098adb6fe0914f7e116dec6967da440a0 Mon Sep 17 00:00:00 2001 From: sweexordious Date: Mon, 30 Sep 2024 21:48:40 +0400 Subject: [PATCH 07/33] chore: create the ibc client before updating it --- app/benchmark_ibc_update_client_test.go | 294 +++++++++++++----------- go.mod | 1 - 2 files changed, 166 insertions(+), 129 deletions(-) diff --git a/app/benchmark_ibc_update_client_test.go b/app/benchmark_ibc_update_client_test.go index 166ba369ad..e1e550cf4b 100644 --- a/app/benchmark_ibc_update_client_test.go +++ b/app/benchmark_ibc_update_client_test.go @@ -30,40 +30,85 @@ import ( types0 "github.com/tendermint/tendermint/types" ) -func BenchmarkIBC_Update_Client_Multi(b *testing.B) { +func BenchmarkIBC_CheckTx_Update_Client_Multi(b *testing.B) { testCases := []struct { - size int + numberOfValidators int }{ - {size: 300}, - //{size: 500}, - //{size: 1000}, - //{size: 5000}, - //{size: 10_000}, - //{size: 50_000}, - //{size: 100_000}, - //{size: 200_000}, - //{size: 300_000}, - //{size: 400_000}, - //{size: 500_000}, - //{size: 1_000_000}, - //{size: 2_000_000}, - //{size: 3_000_000}, - //{size: 4_000_000}, - //{size: 5_000_000}, - //{size: 6_000_000}, + //{numberOfValidators: 2}, + //{numberOfValidators: 10}, + //{numberOfValidators: 25}, + //{numberOfValidators: 50}, + //{numberOfValidators: 75}, + //{numberOfValidators: 100}, + //{numberOfValidators: 125}, + {numberOfValidators: 150}, + //{numberOfValidators: 175}, + //{numberOfValidators: 200}, + //{numberOfValidators: 225}, + //{numberOfValidators: 250}, + //{numberOfValidators: 300}, + //{numberOfValidators: 400}, + //{numberOfValidators: 500}, } for _, testCase := range testCases { - b.Run(fmt.Sprintf("%d bytes", testCase.size), func(b *testing.B) { - benchmarkIBC_Update_Client(b, testCase.size) + b.Run(fmt.Sprintf("number of validators: %d", testCase.numberOfValidators), func(b *testing.B) { + benchmarkIBC_CheckTx_Update_Client(b, testCase.numberOfValidators) }) } } -func benchmarkIBC_Update_Client(b *testing.B, size int) { - testApp, rawTx := generateIBCUpdateClientTransaction(b, 1) +func benchmarkIBC_CheckTx_Update_Client(b *testing.B, numberOfValidators int) { + testApp, rawTxs := generateIBCUpdateClientTransaction(b, numberOfValidators, 1) + + checkTxRequest := types.RequestCheckTx{ + Type: types.CheckTxType_New, + Tx: rawTxs[0], + } + + var resp types.ResponseCheckTx + b.ResetTimer() + for i := 0; i < b.N; i++ { + resp = testApp.CheckTx(checkTxRequest) + } + b.StopTimer() + b.ReportMetric(float64(resp.GasUsed), "gas_used") + b.ReportMetric(float64(len(rawTxs[0])), "transaction_size(byte)") + b.ReportMetric(float64(numberOfValidators), "number_of_validators") + b.ReportMetric(float64(2*numberOfValidators/3), "number_of_verified_signatures") +} + +func BenchmarkIBC_DeliverTx_Update_Client_Multi(b *testing.B) { + testCases := []struct { + numberOfValidators int + }{ + {numberOfValidators: 1}, + {numberOfValidators: 10}, + {numberOfValidators: 25}, + {numberOfValidators: 50}, + {numberOfValidators: 75}, + {numberOfValidators: 100}, + {numberOfValidators: 125}, + {numberOfValidators: 150}, + {numberOfValidators: 175}, + {numberOfValidators: 200}, + {numberOfValidators: 225}, + {numberOfValidators: 250}, + {numberOfValidators: 300}, + {numberOfValidators: 400}, + {numberOfValidators: 500}, + } + for _, testCase := range testCases { + b.Run(fmt.Sprintf("number of validators: %d", testCase.numberOfValidators), func(b *testing.B) { + benchmarkIBC_DeliverTx_Update_Client(b, testCase.numberOfValidators) + }) + } +} + +func benchmarkIBC_DeliverTx_Update_Client(b *testing.B, numberOfValidators int) { + testApp, rawTxs := generateIBCUpdateClientTransaction(b, numberOfValidators, 1) deliverTxRequest := types.RequestDeliverTx{ - Tx: rawTx, + Tx: rawTxs[0], } var resp types.ResponseDeliverTx @@ -73,12 +118,15 @@ func benchmarkIBC_Update_Client(b *testing.B, size int) { } b.StopTimer() b.ReportMetric(float64(resp.GasUsed), "gas_used") - b.ReportMetric(float64(len(rawTx)), "transaction_size(byte)") + b.ReportMetric(float64(len(rawTxs[0])), "transaction_size(byte)") + b.ReportMetric(float64(numberOfValidators), "number_of_validators") + b.ReportMetric(float64(2*numberOfValidators/3), "number_of_verified_signatures") } // generatePayForBlobTransactions creates a test app then generates an IBC -// update client transaction with the specified number of signatures -func generateIBCUpdateClientTransaction(b *testing.B, numberOfSignatures int) (*app.App, []byte) { +// update client transaction with the specified number of validators. +// Note: the number of the verified signatures is: 2 * numberOfValidators / 3 +func generateIBCUpdateClientTransaction(b *testing.B, numberOfValidators int, numberOfMessages int) (*app.App, [][]byte) { account := "test" testApp, kr := testutil.SetupTestAppWithGenesisValSet(app.DefaultConsensusParams(), account) addr := testfactory.GetAddress(kr, account) @@ -87,14 +135,44 @@ func generateIBCUpdateClientTransaction(b *testing.B, numberOfSignatures int) (* signer, err := user.NewSigner(kr, enc.TxConfig, testutil.ChainID, appconsts.LatestVersion, user.NewAccount(account, acc.GetAccountNumber(), acc.GetSequence())) require.NoError(b, err) - msg, msg2 := generateUpdateClientTransaction(b, acc.GetAddress().String()) - rawTx, err := signer.CreateTx([]sdk.Msg{msg2, msg}, user.SetGasLimit(2549760000), user.SetFee(10000)) - require.NoError(b, err) - return testApp, rawTx + //ctx := testApp.NewContext(true, types5.Header{}) + //acc4 := testApp.AccountKeeper.GetAccount(ctx, acc.GetAddress()) + //fmt.Println(acc4) + //err = acc2.SetPubKey(signer.Accounts()[0].PubKey()) + //require.NoError(b, err) + //testApp.AccountKeeper.SetAccount(ctx, acc2) + //pubKey := acc.GetPubKey() + //acc3 := testApp.AccountKeeper.GetAccount(ctx, acc2.GetAddress()) + //fmt.Println(acc3) + //fmt.Println(pubKey) + //acc = testutil.DirectQueryAccount(testApp, addr) + + msgs := generateUpdateClientTransaction( + b, + testApp, + signer, + acc.GetAddress().String(), + numberOfValidators, + numberOfMessages, + ) + + accountSequence := uint64(numberOfMessages) + //err = signer.SetSequence(account, accountSequence) + //accountSequence := uint64(0) + rawTxs := make([][]byte, 0, numberOfMessages) + for i := 0; i < numberOfMessages; i++ { + rawTx, err := signer.CreateTx([]sdk.Msg{msgs[i]}, user.SetGasLimit(2549760000), user.SetFee(10000)) + require.NoError(b, err) + rawTxs = append(rawTxs, rawTx) + accountSequence++ + err = signer.SetSequence(account, accountSequence) + require.NoError(b, err) + } + + return testApp, rawTxs } -func generateUpdateClientTransaction(b *testing.B, signer string) (*types3.MsgUpdateClient, *types3.MsgCreateClient) { - numberOfValidators := 100 +func generateUpdateClientTransaction(b *testing.B, app *app.App, signer *user.Signer, signerAddr string, numberOfValidators int, numberOfMsgs int) []*types3.MsgUpdateClient { state, _, privVals := makeState(numberOfValidators, 5) wBefore := time.Now() time.Sleep(time.Second) @@ -173,8 +251,8 @@ func generateUpdateClientTransaction(b *testing.B, signer string) (*types3.MsgUp } clientState := types4.ClientState{ ChainId: chainID, - TrustLevel: types4.Fraction{Numerator: 1, Denominator: 1}, // we want all signatures to be verified - TrustingPeriod: time.Hour * 24 * 21 * 100, // we want to always accept the upgrade + TrustLevel: types4.Fraction{Numerator: 1, Denominator: 3}, + TrustingPeriod: time.Hour * 24 * 21 * 100, // we want to always accept the upgrade UnbondingPeriod: time.Hour * 24 * 21 * 101, MaxClockDrift: math.MaxInt64 - 1, FrozenHeight: types3.Height{ @@ -195,105 +273,65 @@ func generateUpdateClientTransaction(b *testing.B, signer string) (*types3.MsgUp Root: types2.MerkleRoot{Hash: lastBlockHash}, NextValidatorsHash: state.Validators.Hash(), } - createClientMsg, err := types3.NewMsgCreateClient(&clientState, &consensusState, signer) - require.NoError(b, err) - msg, err := types3.NewMsgUpdateClient( - "test_client", - &types4.Header{ - SignedHeader: &sh, - ValidatorSet: &types5.ValidatorSet{ - Validators: validators, - Proposer: &types5.Validator{ - Address: state.Validators.Proposer.Address, - PubKey: crypto2.PublicKey{Sum: &crypto2.PublicKey_Ed25519{Ed25519: state.Validators.Proposer.PubKey.Bytes()}}, - VotingPower: state.Validators.Proposer.VotingPower, - ProposerPriority: state.Validators.Proposer.ProposerPriority, + + msgs := make([]*types3.MsgUpdateClient, numberOfMsgs) + for index := 0; index < numberOfMsgs; index++ { + createClientMsg, err := types3.NewMsgCreateClient(&clientState, &consensusState, signerAddr) + require.NoError(b, err) + rawTx, err := signer.CreateTx([]sdk.Msg{createClientMsg}, user.SetGasLimit(2549760000), user.SetFee(10000)) + require.NoError(b, err) + resp := app.DeliverTx(types.RequestDeliverTx{Tx: rawTx}) + var clientName string + for _, event := range resp.Events { + if event.Type == types3.EventTypeCreateClient { + for _, attribute := range event.Attributes { + if string(attribute.Key) == types3.AttributeKeyClientID { + clientName = string(attribute.Value) + } + } + } + } + require.NotEmpty(b, clientName) + + msg, err := types3.NewMsgUpdateClient( + clientName, + &types4.Header{ + SignedHeader: &sh, + ValidatorSet: &types5.ValidatorSet{ + Validators: validators, + Proposer: &types5.Validator{ + Address: state.Validators.Proposer.Address, + PubKey: crypto2.PublicKey{Sum: &crypto2.PublicKey_Ed25519{Ed25519: state.Validators.Proposer.PubKey.Bytes()}}, + VotingPower: state.Validators.Proposer.VotingPower, + ProposerPriority: state.Validators.Proposer.ProposerPriority, + }, + TotalVotingPower: state.Validators.TotalVotingPower(), }, - TotalVotingPower: state.Validators.TotalVotingPower(), - }, - TrustedHeight: types3.Height{ - RevisionNumber: 0, - RevisionHeight: 4, - }, - TrustedValidators: &types5.ValidatorSet{ - Validators: validators, - Proposer: &types5.Validator{ - Address: state.Validators.Proposer.Address, - PubKey: crypto2.PublicKey{Sum: &crypto2.PublicKey_Ed25519{Ed25519: state.Validators.Proposer.PubKey.Bytes()}}, - VotingPower: state.Validators.Proposer.VotingPower, - ProposerPriority: state.Validators.Proposer.ProposerPriority, + TrustedHeight: types3.Height{ + RevisionNumber: 0, + RevisionHeight: 4, + }, + TrustedValidators: &types5.ValidatorSet{ + Validators: validators, + Proposer: &types5.Validator{ + Address: state.Validators.Proposer.Address, + PubKey: crypto2.PublicKey{Sum: &crypto2.PublicKey_Ed25519{Ed25519: state.Validators.Proposer.PubKey.Bytes()}}, + VotingPower: state.Validators.Proposer.VotingPower, + ProposerPriority: state.Validators.Proposer.ProposerPriority, + }, + TotalVotingPower: state.Validators.TotalVotingPower(), }, - TotalVotingPower: state.Validators.TotalVotingPower(), }, - }, - signer, - ) - require.NoError(b, err) - - return msg, createClientMsg -} - -func dummy() { - //state, stateDB, privVals := makeState(100, 5) - //stateStore := sm.NewStore(stateDB, sm.StoreOptions{ - // DiscardABCIResponses: false, - //}) - // - //defaultEvidenceTime := time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC) - //privVal := privVals[state.Validators.Validators[0].Address.String()] - //blockID := makeBlockID([]byte("headerhash"), 1000, []byte("partshash")) - //header := &types0.Header{ - // Version: cmtversion.Consensus{Block: version.BlockProtocol, App: 1}, - // ChainID: state.ChainID, - // Height: 10, - // Time: defaultEvidenceTime, - // LastBlockID: blockID, - // LastCommitHash: crypto.CRandBytes(tmhash.Size), - // DataHash: crypto.CRandBytes(tmhash.Size), - // ValidatorsHash: state.Validators.Hash(), - // NextValidatorsHash: state.Validators.Hash(), - // ConsensusHash: crypto.CRandBytes(tmhash.Size), - // AppHash: crypto.CRandBytes(tmhash.Size), - // LastResultsHash: crypto.CRandBytes(tmhash.Size), - // EvidenceHash: crypto.CRandBytes(tmhash.Size), - // ProposerAddress: crypto.CRandBytes(crypto.AddressSize), - //} + signerAddr, + ) + require.NoError(b, err) + msgs[index] = msg + } - //// we don't need to worry about validating the evidence as long as they pass validate basic - //dve := types0.NewMockDuplicateVoteEvidenceWithValidator(3, defaultEvidenceTime, privVal, state.ChainID) - //dve.ValidatorPower = 1000 - //lcae := &types0.LightClientAttackEvidence{ - // ConflictingBlock: &types0.LightBlock{ - // SignedHeader: &types0.SignedHeader{ - // Header: header, - // Commit: types0.NewCommit(10, 0, makeBlockID(header.Hash(), 100, []byte("partshash")), []types0.CommitSig{{ - // BlockIDFlag: types0.BlockIDFlagNil, - // ValidatorAddress: crypto.AddressHash([]byte("validator_address")), - // Timestamp: defaultEvidenceTime, - // Signature: crypto.CRandBytes(types0.MaxSignatureSize), - // }}), - // }, - // ValidatorSet: state.Validators, - // }, - // CommonHeight: 8, - // ByzantineValidators: []*types0.Validator{state.Validators.Validators[0]}, - // TotalVotingPower: 12, - // Timestamp: defaultEvidenceTime, - //} + return msgs } -var chainID string = "test" - -func genValSet(size int) (*types0.ValidatorSet, []ed25519.PrivKey) { - vals := make([]*types0.Validator, size) - privateKeys := make([]ed25519.PrivKey, size) - for i := 0; i < size; i++ { - privateKey := ed25519.GenPrivKey() - vals[i] = types0.NewValidator(privateKey.PubKey(), 10) - privateKeys[i] = privateKey - } - return types0.NewValidatorSet(vals), privateKeys -} +var chainID = "test" func makeState(nVals, height int) (sm.State, dbm.DB, map[string]types0.PrivValidator) { vals := make([]types0.GenesisValidator, nVals) diff --git a/go.mod b/go.mod index 2d1b0e10c7..91a2cb0eb5 100644 --- a/go.mod +++ b/go.mod @@ -248,5 +248,4 @@ replace ( github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.41.0-tm-v0.34.29 - github.com/cosmos/ibc-go/v6 => ../ibc-go ) From 3511b4b255dc3b909f53f246cb6c954b4ae09ac2 Mon Sep 17 00:00:00 2001 From: sweexordious Date: Mon, 30 Sep 2024 22:54:59 +0400 Subject: [PATCH 08/33] chore: working update client transaction --- app/benchmark_ibc_update_client_test.go | 47 ++++++++++--------------- app/benchmark_pfb_test.go | 1 + 2 files changed, 19 insertions(+), 29 deletions(-) diff --git a/app/benchmark_ibc_update_client_test.go b/app/benchmark_ibc_update_client_test.go index e1e550cf4b..bea09e49a5 100644 --- a/app/benchmark_ibc_update_client_test.go +++ b/app/benchmark_ibc_update_client_test.go @@ -34,21 +34,21 @@ func BenchmarkIBC_CheckTx_Update_Client_Multi(b *testing.B) { testCases := []struct { numberOfValidators int }{ - //{numberOfValidators: 2}, - //{numberOfValidators: 10}, - //{numberOfValidators: 25}, - //{numberOfValidators: 50}, - //{numberOfValidators: 75}, - //{numberOfValidators: 100}, - //{numberOfValidators: 125}, + {numberOfValidators: 2}, + {numberOfValidators: 10}, + {numberOfValidators: 25}, + {numberOfValidators: 50}, + {numberOfValidators: 75}, + {numberOfValidators: 100}, + {numberOfValidators: 125}, {numberOfValidators: 150}, - //{numberOfValidators: 175}, - //{numberOfValidators: 200}, - //{numberOfValidators: 225}, - //{numberOfValidators: 250}, - //{numberOfValidators: 300}, - //{numberOfValidators: 400}, - //{numberOfValidators: 500}, + {numberOfValidators: 175}, + {numberOfValidators: 200}, + {numberOfValidators: 225}, + {numberOfValidators: 250}, + {numberOfValidators: 300}, + {numberOfValidators: 400}, + {numberOfValidators: 500}, } for _, testCase := range testCases { b.Run(fmt.Sprintf("number of validators: %d", testCase.numberOfValidators), func(b *testing.B) { @@ -135,18 +135,6 @@ func generateIBCUpdateClientTransaction(b *testing.B, numberOfValidators int, nu signer, err := user.NewSigner(kr, enc.TxConfig, testutil.ChainID, appconsts.LatestVersion, user.NewAccount(account, acc.GetAccountNumber(), acc.GetSequence())) require.NoError(b, err) - //ctx := testApp.NewContext(true, types5.Header{}) - //acc4 := testApp.AccountKeeper.GetAccount(ctx, acc.GetAddress()) - //fmt.Println(acc4) - //err = acc2.SetPubKey(signer.Accounts()[0].PubKey()) - //require.NoError(b, err) - //testApp.AccountKeeper.SetAccount(ctx, acc2) - //pubKey := acc.GetPubKey() - //acc3 := testApp.AccountKeeper.GetAccount(ctx, acc2.GetAddress()) - //fmt.Println(acc3) - //fmt.Println(pubKey) - //acc = testutil.DirectQueryAccount(testApp, addr) - msgs := generateUpdateClientTransaction( b, testApp, @@ -156,12 +144,12 @@ func generateIBCUpdateClientTransaction(b *testing.B, numberOfValidators int, nu numberOfMessages, ) - accountSequence := uint64(numberOfMessages) - //err = signer.SetSequence(account, accountSequence) + accountSequence := testutil.DirectQueryAccount(testApp, addr).GetSequence() + err = signer.SetSequence(account, accountSequence) //accountSequence := uint64(0) rawTxs := make([][]byte, 0, numberOfMessages) for i := 0; i < numberOfMessages; i++ { - rawTx, err := signer.CreateTx([]sdk.Msg{msgs[i]}, user.SetGasLimit(2549760000), user.SetFee(10000)) + rawTx, err := signer.CreateTx([]sdk.Msg{msgs[i]}, user.SetGasLimit(25497600000), user.SetFee(100000)) require.NoError(b, err) rawTxs = append(rawTxs, rawTx) accountSequence++ @@ -292,6 +280,7 @@ func generateUpdateClientTransaction(b *testing.B, app *app.App, signer *user.Si } } require.NotEmpty(b, clientName) + app.Commit() msg, err := types3.NewMsgUpdateClient( clientName, diff --git a/app/benchmark_pfb_test.go b/app/benchmark_pfb_test.go index dea0456fdc..2a486ad3b9 100644 --- a/app/benchmark_pfb_test.go +++ b/app/benchmark_pfb_test.go @@ -236,6 +236,7 @@ func benchmarkProcessProposal_PFB(b *testing.B, count, size int) { func generatePayForBlobTransactions(b *testing.B, count int, size int) (*app.App, [][]byte) { account := "test" testApp, kr := testutil.SetupTestAppWithGenesisValSet(app.DefaultConsensusParams(), account) + testApp.Commit() addr := testfactory.GetAddress(kr, account) enc := encoding.MakeConfig(app.ModuleEncodingRegisters...) acc := testutil.DirectQueryAccount(testApp, addr) From 9345a2aa16c90dd72aaae1c420ec7e85729c8b79 Mon Sep 17 00:00:00 2001 From: sweexordious Date: Tue, 1 Oct 2024 01:14:05 +0400 Subject: [PATCH 09/33] chore: working ibc update client benchmarks --- app/benchmark_ibc_update_client_test.go | 136 ++++++++++++++++++++++-- 1 file changed, 128 insertions(+), 8 deletions(-) diff --git a/app/benchmark_ibc_update_client_test.go b/app/benchmark_ibc_update_client_test.go index bea09e49a5..43f420af27 100644 --- a/app/benchmark_ibc_update_client_test.go +++ b/app/benchmark_ibc_update_client_test.go @@ -18,7 +18,9 @@ import ( "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/tmhash" crypto2 "github.com/tendermint/tendermint/proto/tendermint/crypto" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" types5 "github.com/tendermint/tendermint/proto/tendermint/types" + tmprotoversion "github.com/tendermint/tendermint/proto/tendermint/version" "github.com/tendermint/tendermint/version" "math" "testing" @@ -81,7 +83,7 @@ func BenchmarkIBC_DeliverTx_Update_Client_Multi(b *testing.B) { testCases := []struct { numberOfValidators int }{ - {numberOfValidators: 1}, + {numberOfValidators: 2}, {numberOfValidators: 10}, {numberOfValidators: 25}, {numberOfValidators: 50}, @@ -111,18 +113,134 @@ func benchmarkIBC_DeliverTx_Update_Client(b *testing.B, numberOfValidators int) Tx: rawTxs[0], } - var resp types.ResponseDeliverTx b.ResetTimer() - for i := 0; i < b.N; i++ { - resp = testApp.DeliverTx(deliverTxRequest) - } + resp := testApp.DeliverTx(deliverTxRequest) b.StopTimer() + b.ReportMetric(float64(resp.GasUsed), "gas_used") b.ReportMetric(float64(len(rawTxs[0])), "transaction_size(byte)") b.ReportMetric(float64(numberOfValidators), "number_of_validators") b.ReportMetric(float64(2*numberOfValidators/3), "number_of_verified_signatures") } +func BenchmarkIBC_PrepareProposal_Update_Client_Multi(b *testing.B) { + testCases := []struct { + count, numberOfValidators int + }{ + {count: 6_000, numberOfValidators: 2}, + {count: 3_000, numberOfValidators: 10}, + {count: 2_000, numberOfValidators: 25}, + {count: 1_000, numberOfValidators: 50}, + {count: 500, numberOfValidators: 75}, + {count: 500, numberOfValidators: 100}, + {count: 500, numberOfValidators: 125}, + {count: 500, numberOfValidators: 150}, + {count: 500, numberOfValidators: 175}, + {count: 500, numberOfValidators: 200}, + {count: 500, numberOfValidators: 225}, + {count: 500, numberOfValidators: 250}, + {count: 500, numberOfValidators: 300}, + {count: 500, numberOfValidators: 400}, + {count: 500, numberOfValidators: 500}, + } + for _, testCase := range testCases { + b.Run(fmt.Sprintf("number of validators: %d", testCase.numberOfValidators), func(b *testing.B) { + benchmarkIBC_PrepareProposal_Update_Client(b, testCase.numberOfValidators, testCase.count) + }) + } +} + +func benchmarkIBC_PrepareProposal_Update_Client(b *testing.B, numberOfValidators, count int) { + testApp, rawTxs := generateIBCUpdateClientTransaction(b, numberOfValidators, count) + + blockData := &tmproto.Data{ + Txs: rawTxs, + } + prepareProposalRequest := types.RequestPrepareProposal{ + BlockData: blockData, + ChainId: testApp.GetChainID(), + Height: 10, + } + + b.ResetTimer() + prepareProposalResponse := testApp.PrepareProposal(prepareProposalRequest) + b.StopTimer() + b.ReportMetric(float64(b.Elapsed().Nanoseconds()), "prepare_proposal_time(ns)") + b.ReportMetric(float64(len(prepareProposalResponse.BlockData.Txs)), "number_of_transactions") + b.ReportMetric(float64(len(rawTxs[0])), "transactions_size(byte)") + b.ReportMetric(calculateBlockSizeInMb(prepareProposalResponse.BlockData.Txs), "block_size(mb)") + b.ReportMetric(float64(calculateTotalGasUsed(testApp, rawTxs)), "total_gas_used") + b.ReportMetric(float64(numberOfValidators), "number_of_validators") + b.ReportMetric(float64(2*numberOfValidators/3), "number_of_verified_signatures") +} + +func BenchmarkIBC_ProcessProposal_Update_Client_Multi(b *testing.B) { + testCases := []struct { + count, numberOfValidators int + }{ + {count: 6_000, numberOfValidators: 2}, + {count: 3_000, numberOfValidators: 10}, + {count: 2_000, numberOfValidators: 25}, + {count: 1_000, numberOfValidators: 50}, + {count: 500, numberOfValidators: 75}, + {count: 500, numberOfValidators: 100}, + {count: 500, numberOfValidators: 125}, + {count: 500, numberOfValidators: 150}, + {count: 500, numberOfValidators: 175}, + {count: 500, numberOfValidators: 200}, + {count: 500, numberOfValidators: 225}, + {count: 500, numberOfValidators: 250}, + {count: 500, numberOfValidators: 300}, + {count: 500, numberOfValidators: 400}, + {count: 500, numberOfValidators: 500}, + } + for _, testCase := range testCases { + b.Run(fmt.Sprintf("number of validators: %d", testCase.numberOfValidators), func(b *testing.B) { + benchmarkIBC_ProcessProposal_Update_Client(b, testCase.numberOfValidators, testCase.count) + }) + } +} + +func benchmarkIBC_ProcessProposal_Update_Client(b *testing.B, numberOfValidators, count int) { + testApp, rawTxs := generateIBCUpdateClientTransaction(b, numberOfValidators, count) + + blockData := &tmproto.Data{ + Txs: rawTxs, + } + prepareProposalRequest := types.RequestPrepareProposal{ + BlockData: blockData, + ChainId: testApp.GetChainID(), + Height: 10, + } + + prepareProposalResponse := testApp.PrepareProposal(prepareProposalRequest) + + processProposalRequest := types.RequestProcessProposal{ + BlockData: prepareProposalResponse.BlockData, + Header: tmproto.Header{ + Height: 10, + DataHash: prepareProposalResponse.BlockData.Hash, + ChainID: testutil.ChainID, + Version: tmprotoversion.Consensus{ + App: testApp.AppVersion(), + }, + }, + } + + b.ResetTimer() + resp := testApp.ProcessProposal(processProposalRequest) + b.StopTimer() + require.Equal(b, types.ResponseProcessProposal_ACCEPT, resp.Result) + + b.ReportMetric(float64(b.Elapsed().Nanoseconds()), "process_proposal_time(ns)") + b.ReportMetric(float64(len(prepareProposalResponse.BlockData.Txs)), "number_of_transactions") + b.ReportMetric(float64(len(rawTxs[0])), "transactions_size(byte)") + b.ReportMetric(calculateBlockSizeInMb(prepareProposalResponse.BlockData.Txs), "block_size(mb)") + b.ReportMetric(float64(calculateTotalGasUsed(testApp, rawTxs)), "total_gas_used") + b.ReportMetric(float64(numberOfValidators), "number_of_validators") + b.ReportMetric(float64(2*numberOfValidators/3), "number_of_verified_signatures") +} + // generatePayForBlobTransactions creates a test app then generates an IBC // update client transaction with the specified number of validators. // Note: the number of the verified signatures is: 2 * numberOfValidators / 3 @@ -138,8 +256,9 @@ func generateIBCUpdateClientTransaction(b *testing.B, numberOfValidators int, nu msgs := generateUpdateClientTransaction( b, testApp, - signer, + *signer, acc.GetAddress().String(), + account, numberOfValidators, numberOfMessages, ) @@ -160,7 +279,7 @@ func generateIBCUpdateClientTransaction(b *testing.B, numberOfValidators int, nu return testApp, rawTxs } -func generateUpdateClientTransaction(b *testing.B, app *app.App, signer *user.Signer, signerAddr string, numberOfValidators int, numberOfMsgs int) []*types3.MsgUpdateClient { +func generateUpdateClientTransaction(b *testing.B, app *app.App, signer user.Signer, signerAddr string, signerName string, numberOfValidators int, numberOfMsgs int) []*types3.MsgUpdateClient { state, _, privVals := makeState(numberOfValidators, 5) wBefore := time.Now() time.Sleep(time.Second) @@ -280,7 +399,6 @@ func generateUpdateClientTransaction(b *testing.B, app *app.App, signer *user.Si } } require.NotEmpty(b, clientName) - app.Commit() msg, err := types3.NewMsgUpdateClient( clientName, @@ -315,6 +433,8 @@ func generateUpdateClientTransaction(b *testing.B, app *app.App, signer *user.Si ) require.NoError(b, err) msgs[index] = msg + err = signer.IncrementSequence(signerName) + require.NoError(b, err) } return msgs From 62729cad2b475155657cf047ed0afaebe7b78e7f Mon Sep 17 00:00:00 2001 From: sweexordious Date: Tue, 1 Oct 2024 13:39:07 +0400 Subject: [PATCH 10/33] chore: checks on validity of benchmark + not working comment --- app/benchmark_ibc_update_client_test.go | 12 ++-- app/benchmark_msg_send_test.go | 86 ++++++++++++------------- app/benchmark_pfb_test.go | 17 +++-- test/util/test_app.go | 8 +++ 4 files changed, 66 insertions(+), 57 deletions(-) diff --git a/app/benchmark_ibc_update_client_test.go b/app/benchmark_ibc_update_client_test.go index 43f420af27..8b7c7c5eea 100644 --- a/app/benchmark_ibc_update_client_test.go +++ b/app/benchmark_ibc_update_client_test.go @@ -33,6 +33,7 @@ import ( ) func BenchmarkIBC_CheckTx_Update_Client_Multi(b *testing.B) { + // not working testCases := []struct { numberOfValidators int }{ @@ -67,12 +68,11 @@ func benchmarkIBC_CheckTx_Update_Client(b *testing.B, numberOfValidators int) { Tx: rawTxs[0], } - var resp types.ResponseCheckTx b.ResetTimer() - for i := 0; i < b.N; i++ { - resp = testApp.CheckTx(checkTxRequest) - } + resp := testApp.CheckTx(checkTxRequest) b.StopTimer() + require.Equal(b, uint32(0), resp.Code) + require.Equal(b, "", resp.Codespace) b.ReportMetric(float64(resp.GasUsed), "gas_used") b.ReportMetric(float64(len(rawTxs[0])), "transaction_size(byte)") b.ReportMetric(float64(numberOfValidators), "number_of_validators") @@ -80,6 +80,7 @@ func benchmarkIBC_CheckTx_Update_Client(b *testing.B, numberOfValidators int) { } func BenchmarkIBC_DeliverTx_Update_Client_Multi(b *testing.B) { + // not working testCases := []struct { numberOfValidators int }{ @@ -116,7 +117,8 @@ func benchmarkIBC_DeliverTx_Update_Client(b *testing.B, numberOfValidators int) b.ResetTimer() resp := testApp.DeliverTx(deliverTxRequest) b.StopTimer() - + require.Equal(b, uint32(0), resp.Code) + require.Equal(b, "", resp.Codespace) b.ReportMetric(float64(resp.GasUsed), "gas_used") b.ReportMetric(float64(len(rawTxs[0])), "transaction_size(byte)") b.ReportMetric(float64(numberOfValidators), "number_of_validators") diff --git a/app/benchmark_msg_send_test.go b/app/benchmark_msg_send_test.go index 62583ca999..20307fb549 100644 --- a/app/benchmark_msg_send_test.go +++ b/app/benchmark_msg_send_test.go @@ -19,23 +19,25 @@ import ( func BenchmarkCheckTx_MsgSend_1(b *testing.B) { testApp, rawTxs := generateMsgSendTransactions(b, 1) + testApp.Commit() checkTxRequest := types.RequestCheckTx{ Tx: rawTxs[0], Type: types.CheckTxType_New, } - var resp types.ResponseCheckTx b.ResetTimer() - for i := 0; i < b.N; i++ { - resp = testApp.CheckTx(checkTxRequest) - } + resp := testApp.CheckTx(checkTxRequest) b.StopTimer() + require.Equal(b, uint32(0), resp.Code) + require.Equal(b, "", resp.Codespace) b.ReportMetric(float64(resp.GasUsed), "gas_used") } func BenchmarkCheckTx_MsgSend_8MB(b *testing.B) { + // not working testApp, rawTxs := generateMsgSendTransactions(b, 1) + testApp.Commit() checkTxRequest := types.RequestCheckTx{ Tx: rawTxs[0], @@ -44,14 +46,15 @@ func BenchmarkCheckTx_MsgSend_8MB(b *testing.B) { var totalGas int64 b.ResetTimer() - for i := 0; i < b.N; i++ { - for j := 0; j < 39200; j++ { - resp := testApp.CheckTx(checkTxRequest) - b.StopTimer() - totalGas += resp.GasUsed - b.StartTimer() - } + for j := 0; j < 39200; j++ { + b.StartTimer() + resp := testApp.CheckTx(checkTxRequest) + b.StopTimer() + require.Equal(b, uint32(0), resp.Code) + require.Equal(b, "", resp.Codespace) + totalGas += resp.GasUsed } + b.StopTimer() b.ReportMetric(float64(totalGas), "total_gas_used") } @@ -63,16 +66,16 @@ func BenchmarkDeliverTx_MsgSend_1(b *testing.B) { Tx: rawTxs[0], } - var resp types.ResponseDeliverTx b.ResetTimer() - for i := 0; i < b.N; i++ { - testApp.DeliverTx(deliverTxRequest) - } + resp := testApp.DeliverTx(deliverTxRequest) b.StopTimer() + require.Equal(b, uint32(0), resp.Code) + require.Equal(b, "", resp.Codespace) b.ReportMetric(float64(resp.GasUsed), "gas_used") } func BenchmarkDeliverTx_MsgSend_8MB(b *testing.B) { + // not working testApp, rawTxs := generateMsgSendTransactions(b, 1) deliverTxRequest := types.RequestDeliverTx{ @@ -81,13 +84,13 @@ func BenchmarkDeliverTx_MsgSend_8MB(b *testing.B) { var totalGas int64 b.ResetTimer() - for i := 0; i < b.N; i++ { - for j := 0; j < 39200; j++ { - resp := testApp.DeliverTx(deliverTxRequest) - b.StopTimer() - totalGas += resp.GasUsed - b.StartTimer() - } + for j := 0; j < 39200; j++ { + b.StartTimer() + resp := testApp.DeliverTx(deliverTxRequest) + b.StopTimer() + require.Equal(b, uint32(0), resp.Code) + require.Equal(b, "", resp.Codespace) + totalGas += resp.GasUsed } b.StopTimer() b.ReportMetric(float64(totalGas), "total_gas_used") @@ -105,11 +108,9 @@ func BenchmarkPrepareProposal_MsgSend_1(b *testing.B) { } b.ResetTimer() - for i := 0; i < b.N; i++ { - testApp.PrepareProposal(prepareProposalRequest) - } + resp := testApp.PrepareProposal(prepareProposalRequest) b.StopTimer() - b.ReportMetric(float64(calculateTotalGasUsed(testApp, rawTxs)), "total_gas_used") + b.ReportMetric(float64(calculateTotalGasUsed(testApp, resp.BlockData.Txs)), "total_gas_used") } func BenchmarkPrepareProposal_MsgSend_8MB(b *testing.B) { @@ -127,14 +128,11 @@ func BenchmarkPrepareProposal_MsgSend_8MB(b *testing.B) { } b.ResetTimer() - var prepareProposalResponse types.ResponsePrepareProposal - for i := 0; i < b.N; i++ { - prepareProposalResponse = testApp.PrepareProposal(prepareProposalRequest) - } + resp := testApp.PrepareProposal(prepareProposalRequest) b.StopTimer() - b.ReportMetric(float64(len(prepareProposalResponse.BlockData.Txs)), "number_of_transactions") - b.ReportMetric(calculateBlockSizeInMb(prepareProposalResponse.BlockData.Txs), "block_size(mb)") - b.ReportMetric(float64(calculateTotalGasUsed(testApp, rawTxs)), "total_gas_used") + b.ReportMetric(float64(len(resp.BlockData.Txs)), "number_of_transactions") + b.ReportMetric(calculateBlockSizeInMb(resp.BlockData.Txs), "block_size(mb)") + b.ReportMetric(float64(calculateTotalGasUsed(testApp, prepareProposalRequest.BlockData.Txs)), "total_gas_used") } func BenchmarkProcessProposal_MsgSend_1(b *testing.B) { @@ -163,11 +161,11 @@ func BenchmarkProcessProposal_MsgSend_1(b *testing.B) { } b.ResetTimer() - for i := 0; i < b.N; i++ { - testApp.ProcessProposal(processProposalRequest) - } + resp := testApp.ProcessProposal(processProposalRequest) b.StopTimer() - b.ReportMetric(float64(calculateTotalGasUsed(testApp, rawTxs)), "total_gas_used") + require.Equal(b, types.ResponseProcessProposal_ACCEPT, resp.Result) + + b.ReportMetric(float64(calculateTotalGasUsed(testApp, prepareProposalResponse.BlockData.Txs)), "total_gas_used") } func BenchmarkProcessProposal_MsgSend_8MB(b *testing.B) { @@ -185,9 +183,9 @@ func BenchmarkProcessProposal_MsgSend_8MB(b *testing.B) { } prepareProposalResponse := testApp.PrepareProposal(prepareProposalRequest) - b.ReportMetric(float64(len(prepareProposalResponse.BlockData.Txs)), "number of transactions") - b.ReportMetric(calculateBlockSizeInMb(prepareProposalResponse.BlockData.Txs), "block size (mb)") - b.ReportMetric(float64(calculateTotalGasUsed(testApp, rawTxs)), "total_gas_used") + b.ReportMetric(float64(len(prepareProposalResponse.BlockData.Txs)), "number_of_transactions") + b.ReportMetric(calculateBlockSizeInMb(prepareProposalResponse.BlockData.Txs), "block_size_(mb)") + b.ReportMetric(float64(calculateTotalGasUsed(testApp, prepareProposalResponse.BlockData.Txs)), "total_gas_used") processProposalRequest := types.RequestProcessProposal{ BlockData: prepareProposalResponse.BlockData, @@ -202,9 +200,11 @@ func BenchmarkProcessProposal_MsgSend_8MB(b *testing.B) { } b.ResetTimer() - for i := 0; i < b.N; i++ { - testApp.ProcessProposal(processProposalRequest) - } + resp := testApp.ProcessProposal(processProposalRequest) + b.StopTimer() + require.Equal(b, types.ResponseProcessProposal_ACCEPT, resp.Result) + + b.ReportMetric(float64(calculateTotalGasUsed(testApp, prepareProposalResponse.BlockData.Txs)), "total_gas_used") } // generateMsgSendTransactions creates a test app then generates a number diff --git a/app/benchmark_pfb_test.go b/app/benchmark_pfb_test.go index 2a486ad3b9..ae2de0a8a9 100644 --- a/app/benchmark_pfb_test.go +++ b/app/benchmark_pfb_test.go @@ -51,23 +51,24 @@ func BenchmarkCheckTx_PFB_Multi(b *testing.B) { func benchmarkCheckTx_PFB(b *testing.B, size int) { testApp, rawTxs := generatePayForBlobTransactions(b, 1, size) + testApp.Commit() checkTxRequest := types.RequestCheckTx{ Tx: rawTxs[0], Type: types.CheckTxType_New, } - var resp types.ResponseCheckTx b.ResetTimer() - for i := 0; i < b.N; i++ { - resp = testApp.CheckTx(checkTxRequest) - } + resp := testApp.CheckTx(checkTxRequest) b.StopTimer() + require.Equal(b, uint32(0), resp.Code) + require.Equal(b, "", resp.Codespace) b.ReportMetric(float64(resp.GasUsed), "gas_used") b.ReportMetric(float64(len(rawTxs[0])), "transaction_size(byte)") } func BenchmarkDeliverTx_PFB_Multi(b *testing.B) { + // not working testCases := []struct { size int }{ @@ -103,12 +104,11 @@ func benchmarkDeliverTx_PFB(b *testing.B, size int) { Tx: rawTxs[0], } - var resp types.ResponseDeliverTx b.ResetTimer() - for i := 0; i < b.N; i++ { - resp = testApp.DeliverTx(deliverTxRequest) - } + resp := testApp.DeliverTx(deliverTxRequest) b.StopTimer() + require.Equal(b, uint32(0), resp.Code) + require.Equal(b, "", resp.Codespace) b.ReportMetric(float64(resp.GasUsed), "gas_used") b.ReportMetric(float64(len(rawTxs[0])), "transaction_size(byte)") } @@ -236,7 +236,6 @@ func benchmarkProcessProposal_PFB(b *testing.B, count, size int) { func generatePayForBlobTransactions(b *testing.B, count int, size int) (*app.App, [][]byte) { account := "test" testApp, kr := testutil.SetupTestAppWithGenesisValSet(app.DefaultConsensusParams(), account) - testApp.Commit() addr := testfactory.GetAddress(kr, account) enc := encoding.MakeConfig(app.ModuleEncodingRegisters...) acc := testutil.DirectQueryAccount(testApp, addr) diff --git a/test/util/test_app.go b/test/util/test_app.go index 878c4d50a9..5b17220961 100644 --- a/test/util/test_app.go +++ b/test/util/test_app.go @@ -87,6 +87,14 @@ func NewTestApp() *app.App { emptyOpts := EmptyAppOptions{} // var anteOpt = func(bapp *baseapp.BaseApp) { bapp.SetAnteHandler(nil) } db := dbm.NewMemDB() + //path, err := os.MkdirTemp("/tmp", "test-app-db") + //if err != nil { + // panic(err) + //} + //db, err := dbm.NewGoLevelDB("db", path) + //if err != nil { + // panic(err) + //} encCfg := encoding.MakeConfig(app.ModuleEncodingRegisters...) From 95250f7592a1e8efdfd26a6c8c305760b79e3d37 Mon Sep 17 00:00:00 2001 From: sweexordious Date: Tue, 1 Oct 2024 20:48:15 +0400 Subject: [PATCH 11/33] chore: ibc update client benchmarks working --- app/benchmark_ibc_update_client_test.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/benchmark_ibc_update_client_test.go b/app/benchmark_ibc_update_client_test.go index 8b7c7c5eea..4161f846a3 100644 --- a/app/benchmark_ibc_update_client_test.go +++ b/app/benchmark_ibc_update_client_test.go @@ -33,7 +33,6 @@ import ( ) func BenchmarkIBC_CheckTx_Update_Client_Multi(b *testing.B) { - // not working testCases := []struct { numberOfValidators int }{ @@ -61,7 +60,8 @@ func BenchmarkIBC_CheckTx_Update_Client_Multi(b *testing.B) { } func benchmarkIBC_CheckTx_Update_Client(b *testing.B, numberOfValidators int) { - testApp, rawTxs := generateIBCUpdateClientTransaction(b, numberOfValidators, 1) + testApp, rawTxs := generateIBCUpdateClientTransaction(b, numberOfValidators, 1, 1) + testApp.Commit() checkTxRequest := types.RequestCheckTx{ Type: types.CheckTxType_New, @@ -108,7 +108,7 @@ func BenchmarkIBC_DeliverTx_Update_Client_Multi(b *testing.B) { } func benchmarkIBC_DeliverTx_Update_Client(b *testing.B, numberOfValidators int) { - testApp, rawTxs := generateIBCUpdateClientTransaction(b, numberOfValidators, 1) + testApp, rawTxs := generateIBCUpdateClientTransaction(b, numberOfValidators, 1, 1) deliverTxRequest := types.RequestDeliverTx{ Tx: rawTxs[0], @@ -153,7 +153,7 @@ func BenchmarkIBC_PrepareProposal_Update_Client_Multi(b *testing.B) { } func benchmarkIBC_PrepareProposal_Update_Client(b *testing.B, numberOfValidators, count int) { - testApp, rawTxs := generateIBCUpdateClientTransaction(b, numberOfValidators, count) + testApp, rawTxs := generateIBCUpdateClientTransaction(b, numberOfValidators, count, 0) blockData := &tmproto.Data{ Txs: rawTxs, @@ -167,6 +167,7 @@ func benchmarkIBC_PrepareProposal_Update_Client(b *testing.B, numberOfValidators b.ResetTimer() prepareProposalResponse := testApp.PrepareProposal(prepareProposalRequest) b.StopTimer() + require.GreaterOrEqual(b, len(prepareProposalResponse.BlockData.Txs), 1) b.ReportMetric(float64(b.Elapsed().Nanoseconds()), "prepare_proposal_time(ns)") b.ReportMetric(float64(len(prepareProposalResponse.BlockData.Txs)), "number_of_transactions") b.ReportMetric(float64(len(rawTxs[0])), "transactions_size(byte)") @@ -204,7 +205,7 @@ func BenchmarkIBC_ProcessProposal_Update_Client_Multi(b *testing.B) { } func benchmarkIBC_ProcessProposal_Update_Client(b *testing.B, numberOfValidators, count int) { - testApp, rawTxs := generateIBCUpdateClientTransaction(b, numberOfValidators, count) + testApp, rawTxs := generateIBCUpdateClientTransaction(b, numberOfValidators, count, 0) blockData := &tmproto.Data{ Txs: rawTxs, @@ -216,6 +217,7 @@ func benchmarkIBC_ProcessProposal_Update_Client(b *testing.B, numberOfValidators } prepareProposalResponse := testApp.PrepareProposal(prepareProposalRequest) + require.GreaterOrEqual(b, len(prepareProposalResponse.BlockData.Txs), 1) processProposalRequest := types.RequestProcessProposal{ BlockData: prepareProposalResponse.BlockData, @@ -246,7 +248,9 @@ func benchmarkIBC_ProcessProposal_Update_Client(b *testing.B, numberOfValidators // generatePayForBlobTransactions creates a test app then generates an IBC // update client transaction with the specified number of validators. // Note: the number of the verified signatures is: 2 * numberOfValidators / 3 -func generateIBCUpdateClientTransaction(b *testing.B, numberOfValidators int, numberOfMessages int) (*app.App, [][]byte) { +// the offset is just a hack for transactions to be processed by the needed +// ABCI method. +func generateIBCUpdateClientTransaction(b *testing.B, numberOfValidators int, numberOfMessages int, offsetAccountSequence int) (*app.App, [][]byte) { account := "test" testApp, kr := testutil.SetupTestAppWithGenesisValSet(app.DefaultConsensusParams(), account) addr := testfactory.GetAddress(kr, account) @@ -266,7 +270,7 @@ func generateIBCUpdateClientTransaction(b *testing.B, numberOfValidators int, nu ) accountSequence := testutil.DirectQueryAccount(testApp, addr).GetSequence() - err = signer.SetSequence(account, accountSequence) + err = signer.SetSequence(account, accountSequence+uint64(offsetAccountSequence)) //accountSequence := uint64(0) rawTxs := make([][]byte, 0, numberOfMessages) for i := 0; i < numberOfMessages; i++ { From 8b083fa474caffe154c567c3a985d260afd299dd Mon Sep 17 00:00:00 2001 From: sweexordious Date: Tue, 1 Oct 2024 21:28:18 +0400 Subject: [PATCH 12/33] chore: pfb benchmarks working --- app/benchmark_pfb_test.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/benchmark_pfb_test.go b/app/benchmark_pfb_test.go index ae2de0a8a9..9e39913e0a 100644 --- a/app/benchmark_pfb_test.go +++ b/app/benchmark_pfb_test.go @@ -8,10 +8,8 @@ import ( "github.com/celestiaorg/celestia-app/v3/pkg/user" testutil "github.com/celestiaorg/celestia-app/v3/test/util" "github.com/celestiaorg/celestia-app/v3/test/util/testfactory" - types2 "github.com/celestiaorg/celestia-app/v3/x/blob/types" "github.com/celestiaorg/go-square/v2/share" - "github.com/celestiaorg/go-square/v2/tx" - sdk "github.com/cosmos/cosmos-sdk/types" + blobtx "github.com/celestiaorg/go-square/v2/tx" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" @@ -68,7 +66,6 @@ func benchmarkCheckTx_PFB(b *testing.B, size int) { } func BenchmarkDeliverTx_PFB_Multi(b *testing.B) { - // not working testCases := []struct { size int }{ @@ -100,8 +97,12 @@ func BenchmarkDeliverTx_PFB_Multi(b *testing.B) { func benchmarkDeliverTx_PFB(b *testing.B, size int) { testApp, rawTxs := generatePayForBlobTransactions(b, 1, size) + blobTx, ok, err := blobtx.UnmarshalBlobTx(rawTxs[0]) + require.NoError(b, err) + require.True(b, ok) + deliverTxRequest := types.RequestDeliverTx{ - Tx: rawTxs[0], + Tx: blobTx.Tx, } b.ResetTimer() @@ -157,6 +158,7 @@ func benchmarkPrepareProposal_PFB(b *testing.B, count, size int) { b.ResetTimer() prepareProposalResponse := testApp.PrepareProposal(prepareProposalRequest) b.StopTimer() + require.GreaterOrEqual(b, len(prepareProposalResponse.BlockData.Txs), 1) b.ReportMetric(float64(b.Elapsed().Nanoseconds()), "prepare_proposal_time(ns)") b.ReportMetric(float64(len(prepareProposalResponse.BlockData.Txs)), "number_of_transactions") b.ReportMetric(float64(len(rawTxs[0])), "transactions_size(byte)") @@ -206,6 +208,7 @@ func benchmarkProcessProposal_PFB(b *testing.B, count, size int) { } prepareProposalResponse := testApp.PrepareProposal(prepareProposalRequest) + require.GreaterOrEqual(b, len(prepareProposalResponse.BlockData.Txs), 1) processProposalRequest := types.RequestProcessProposal{ BlockData: prepareProposalResponse.BlockData, @@ -250,12 +253,9 @@ func generatePayForBlobTransactions(b *testing.B, count int, size int) (*app.App blob, err := share.NewBlob(share.RandomNamespace(), randomBytes, 1, acc.GetAddress().Bytes()) require.NoError(b, err) for i := 0; i < count; i++ { - msg, err := types2.NewMsgPayForBlobs(acc.GetAddress().String(), 1, blob) - rawTx, err := signer.CreateTx([]sdk.Msg{msg}, user.SetGasLimit(2549760000), user.SetFee(10000)) - require.NoError(b, err) - blobTxBytes, err := tx.MarshalBlobTx(rawTx, blob) + tx, _, err := signer.CreatePayForBlobs(account, []*share.Blob{blob}, user.SetGasLimit(2549760000), user.SetFee(10000)) require.NoError(b, err) - rawTxs = append(rawTxs, blobTxBytes) + rawTxs = append(rawTxs, tx) accountSequence++ err = signer.SetSequence(account, accountSequence) require.NoError(b, err) From 5a556b7e35075f608a208498cce242888bd8f99f Mon Sep 17 00:00:00 2001 From: sweexordious Date: Tue, 1 Oct 2024 21:40:30 +0400 Subject: [PATCH 13/33] chore: msg send benchmarks working --- app/benchmark_msg_send_test.go | 46 ++++++++++++++++------------------ 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/app/benchmark_msg_send_test.go b/app/benchmark_msg_send_test.go index 20307fb549..b6e01303b8 100644 --- a/app/benchmark_msg_send_test.go +++ b/app/benchmark_msg_send_test.go @@ -35,18 +35,16 @@ func BenchmarkCheckTx_MsgSend_1(b *testing.B) { } func BenchmarkCheckTx_MsgSend_8MB(b *testing.B) { - // not working - testApp, rawTxs := generateMsgSendTransactions(b, 1) + testApp, rawTxs := generateMsgSendTransactions(b, 31645) testApp.Commit() - checkTxRequest := types.RequestCheckTx{ - Tx: rawTxs[0], - Type: types.CheckTxType_New, - } - var totalGas int64 b.ResetTimer() - for j := 0; j < 39200; j++ { + for _, tx := range rawTxs { + checkTxRequest := types.RequestCheckTx{ + Tx: tx, + Type: types.CheckTxType_New, + } b.StartTimer() resp := testApp.CheckTx(checkTxRequest) b.StopTimer() @@ -75,16 +73,14 @@ func BenchmarkDeliverTx_MsgSend_1(b *testing.B) { } func BenchmarkDeliverTx_MsgSend_8MB(b *testing.B) { - // not working - testApp, rawTxs := generateMsgSendTransactions(b, 1) - - deliverTxRequest := types.RequestDeliverTx{ - Tx: rawTxs[0], - } + testApp, rawTxs := generateMsgSendTransactions(b, 31645) var totalGas int64 b.ResetTimer() - for j := 0; j < 39200; j++ { + for _, tx := range rawTxs { + deliverTxRequest := types.RequestDeliverTx{ + Tx: tx, + } b.StartTimer() resp := testApp.DeliverTx(deliverTxRequest) b.StopTimer() @@ -110,13 +106,14 @@ func BenchmarkPrepareProposal_MsgSend_1(b *testing.B) { b.ResetTimer() resp := testApp.PrepareProposal(prepareProposalRequest) b.StopTimer() + require.GreaterOrEqual(b, len(resp.BlockData.Txs), 1) b.ReportMetric(float64(calculateTotalGasUsed(testApp, resp.BlockData.Txs)), "total_gas_used") } func BenchmarkPrepareProposal_MsgSend_8MB(b *testing.B) { - // a full 8mb block equals to around 39200 msg send transactions. - // using 39300 to let prepare proposal choose the maximum - testApp, rawTxs := generateMsgSendTransactions(b, 39300) + // a full 8mb block equals to around 31645 msg send transactions. + // using 31645 to let prepare proposal choose the maximum + testApp, rawTxs := generateMsgSendTransactions(b, 31645) blockData := &tmproto.Data{ Txs: rawTxs, @@ -130,6 +127,7 @@ func BenchmarkPrepareProposal_MsgSend_8MB(b *testing.B) { b.ResetTimer() resp := testApp.PrepareProposal(prepareProposalRequest) b.StopTimer() + require.GreaterOrEqual(b, len(resp.BlockData.Txs), 1) b.ReportMetric(float64(len(resp.BlockData.Txs)), "number_of_transactions") b.ReportMetric(calculateBlockSizeInMb(resp.BlockData.Txs), "block_size(mb)") b.ReportMetric(float64(calculateTotalGasUsed(testApp, prepareProposalRequest.BlockData.Txs)), "total_gas_used") @@ -147,6 +145,7 @@ func BenchmarkProcessProposal_MsgSend_1(b *testing.B) { Height: 10, } prepareProposalResponse := testApp.PrepareProposal(prepareProposalRequest) + require.GreaterOrEqual(b, len(prepareProposalResponse.BlockData.Txs), 1) processProposalRequest := types.RequestProcessProposal{ BlockData: prepareProposalResponse.BlockData, @@ -169,9 +168,9 @@ func BenchmarkProcessProposal_MsgSend_1(b *testing.B) { } func BenchmarkProcessProposal_MsgSend_8MB(b *testing.B) { - // a full 8mb block equals to around 39200 msg send transactions. - // using 39300 to let prepare proposal choose the maximum - testApp, rawTxs := generateMsgSendTransactions(b, 39300) + // a full 8mb block equals to around 31645 msg send transactions. + // using 31645 to let prepare proposal choose the maximum + testApp, rawTxs := generateMsgSendTransactions(b, 31645) blockData := &tmproto.Data{ Txs: rawTxs, @@ -182,6 +181,7 @@ func BenchmarkProcessProposal_MsgSend_8MB(b *testing.B) { Height: 10, } prepareProposalResponse := testApp.PrepareProposal(prepareProposalRequest) + require.GreaterOrEqual(b, len(prepareProposalResponse.BlockData.Txs), 1) b.ReportMetric(float64(len(prepareProposalResponse.BlockData.Txs)), "number_of_transactions") b.ReportMetric(calculateBlockSizeInMb(prepareProposalResponse.BlockData.Txs), "block_size_(mb)") @@ -215,7 +215,6 @@ func generateMsgSendTransactions(b *testing.B, count int) (*app.App, [][]byte) { addr := testfactory.GetAddress(kr, account) enc := encoding.MakeConfig(app.ModuleEncodingRegisters...) acc := testutil.DirectQueryAccount(testApp, addr) - accountSequence := acc.GetSequence() signer, err := user.NewSigner(kr, enc.TxConfig, testutil.ChainID, appconsts.LatestVersion, user.NewAccount(account, acc.GetAccountNumber(), acc.GetSequence())) require.NoError(b, err) rawTxs := make([][]byte, 0, count) @@ -228,8 +227,7 @@ func generateMsgSendTransactions(b *testing.B, count int) (*app.App, [][]byte) { rawTx, err := signer.CreateTx([]sdk.Msg{msg}, user.SetGasLimit(1000000), user.SetFee(10)) require.NoError(b, err) rawTxs = append(rawTxs, rawTx) - accountSequence++ - err = signer.SetSequence(account, accountSequence) + err = signer.IncrementSequence(account) require.NoError(b, err) } return testApp, rawTxs From 68002b7ede37a3726b64d8b44a42df21602c249c Mon Sep 17 00:00:00 2001 From: sweexordious Date: Fri, 4 Oct 2024 02:36:00 +0400 Subject: [PATCH 14/33] chore: fix ibc update client comment and reports --- app/benchmark_ibc_update_client_test.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/benchmark_ibc_update_client_test.go b/app/benchmark_ibc_update_client_test.go index 4161f846a3..3b66641ed1 100644 --- a/app/benchmark_ibc_update_client_test.go +++ b/app/benchmark_ibc_update_client_test.go @@ -80,7 +80,6 @@ func benchmarkIBC_CheckTx_Update_Client(b *testing.B, numberOfValidators int) { } func BenchmarkIBC_DeliverTx_Update_Client_Multi(b *testing.B) { - // not working testCases := []struct { numberOfValidators int }{ @@ -172,7 +171,7 @@ func benchmarkIBC_PrepareProposal_Update_Client(b *testing.B, numberOfValidators b.ReportMetric(float64(len(prepareProposalResponse.BlockData.Txs)), "number_of_transactions") b.ReportMetric(float64(len(rawTxs[0])), "transactions_size(byte)") b.ReportMetric(calculateBlockSizeInMb(prepareProposalResponse.BlockData.Txs), "block_size(mb)") - b.ReportMetric(float64(calculateTotalGasUsed(testApp, rawTxs)), "total_gas_used") + b.ReportMetric(float64(calculateTotalGasUsed(testApp, prepareProposalResponse.BlockData.Txs)), "total_gas_used") b.ReportMetric(float64(numberOfValidators), "number_of_validators") b.ReportMetric(float64(2*numberOfValidators/3), "number_of_verified_signatures") } @@ -240,7 +239,7 @@ func benchmarkIBC_ProcessProposal_Update_Client(b *testing.B, numberOfValidators b.ReportMetric(float64(len(prepareProposalResponse.BlockData.Txs)), "number_of_transactions") b.ReportMetric(float64(len(rawTxs[0])), "transactions_size(byte)") b.ReportMetric(calculateBlockSizeInMb(prepareProposalResponse.BlockData.Txs), "block_size(mb)") - b.ReportMetric(float64(calculateTotalGasUsed(testApp, rawTxs)), "total_gas_used") + b.ReportMetric(float64(calculateTotalGasUsed(testApp, prepareProposalResponse.BlockData.Txs)), "total_gas_used") b.ReportMetric(float64(numberOfValidators), "number_of_validators") b.ReportMetric(float64(2*numberOfValidators/3), "number_of_verified_signatures") } From dab12d3a812469af7193609fee4c19af4deb4f9a Mon Sep 17 00:00:00 2001 From: sweexordious Date: Fri, 4 Oct 2024 02:36:27 +0400 Subject: [PATCH 15/33] chore: add half second benchmarks --- app/benchmark_msg_send_test.go | 58 ++++++++++++++++++++++++ app/benchmark_pfb_test.go | 82 ++++++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) diff --git a/app/benchmark_msg_send_test.go b/app/benchmark_msg_send_test.go index b6e01303b8..b2f493c8a1 100644 --- a/app/benchmark_msg_send_test.go +++ b/app/benchmark_msg_send_test.go @@ -1,6 +1,7 @@ package app_test import ( + "fmt" "github.com/celestiaorg/celestia-app/v3/app" "github.com/celestiaorg/celestia-app/v3/app/encoding" "github.com/celestiaorg/celestia-app/v3/pkg/appconsts" @@ -15,6 +16,7 @@ import ( tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/tendermint/tendermint/proto/tendermint/version" "testing" + "time" ) func BenchmarkCheckTx_MsgSend_1(b *testing.B) { @@ -207,6 +209,62 @@ func BenchmarkProcessProposal_MsgSend_8MB(b *testing.B) { b.ReportMetric(float64(calculateTotalGasUsed(testApp, prepareProposalResponse.BlockData.Txs)), "total_gas_used") } +func BenchmarkProcessProposal_MsgSend_8MB_Find_Half_Sec(b *testing.B) { + targetTimeLowerBound := 0.499 + targetTimeUpperBound := 0.511 + numberOfTransaction := 5500 + testApp, rawTxs := generateMsgSendTransactions(b, numberOfTransaction) + start := 0 + end := numberOfTransaction + segment := end - start + for { + if segment == 1 { + break + } + + prepareProposalRequest := types.RequestPrepareProposal{ + BlockData: &tmproto.Data{ + Txs: rawTxs[start:end], + }, + ChainId: testApp.GetChainID(), + Height: 10, + } + prepareProposalResponse := testApp.PrepareProposal(prepareProposalRequest) + require.GreaterOrEqual(b, len(prepareProposalResponse.BlockData.Txs), 1) + + processProposalRequest := types.RequestProcessProposal{ + BlockData: prepareProposalResponse.BlockData, + Header: tmproto.Header{ + Height: 10, + DataHash: prepareProposalResponse.BlockData.Hash, + ChainID: testutil.ChainID, + Version: version.Consensus{ + App: testApp.AppVersion(), + }, + }, + } + + startTime := time.Now() + resp := testApp.ProcessProposal(processProposalRequest) + endTime := time.Now() + require.Equal(b, types.ResponseProcessProposal_ACCEPT, resp.Result) + + timeElapsed := float64(endTime.Sub(startTime).Nanoseconds()) / 1e9 + + b.ReportMetric(timeElapsed, fmt.Sprintf("elapsedTime(s)_%d", end-start)) + + if timeElapsed < targetTimeLowerBound { + end = end + segment/2 + segment = end - start + } else if timeElapsed > targetTimeUpperBound { + end = end / 2 + segment = end - start + } else { + break + } + } +} + // generateMsgSendTransactions creates a test app then generates a number // of valid msg send transactions. func generateMsgSendTransactions(b *testing.B, count int) (*app.App, [][]byte) { diff --git a/app/benchmark_pfb_test.go b/app/benchmark_pfb_test.go index 9e39913e0a..26cbe39782 100644 --- a/app/benchmark_pfb_test.go +++ b/app/benchmark_pfb_test.go @@ -16,6 +16,7 @@ import ( "github.com/tendermint/tendermint/proto/tendermint/version" "math/rand" "testing" + "time" ) func BenchmarkCheckTx_PFB_Multi(b *testing.B) { @@ -234,6 +235,87 @@ func benchmarkProcessProposal_PFB(b *testing.B, count, size int) { b.ReportMetric(float64(calculateTotalGasUsed(testApp, rawTxs)), "total_gas_used") } +func BenchmarkProcessProposal_PFB_Half_Second(b *testing.B) { + testCases := []struct { + count, size int + }{ + {count: 11_000, size: 50}, + {count: 11_000, size: 100}, + {count: 11_000, size: 200}, + {count: 11_000, size: 300}, + {count: 11_000, size: 400}, + {count: 7000, size: 500}, + {count: 7000, size: 600}, + {count: 5000, size: 1_000}, + {count: 5000, size: 1200}, + {count: 5000, size: 1500}, + {count: 5000, size: 1800}, + {count: 5000, size: 2000}, + } + for _, testCase := range testCases { + b.Run(fmt.Sprintf("%d transactions of %d bytes", testCase.count, testCase.size), func(b *testing.B) { + benchmarkProcessProposal_PFB_Half_Second(b, testCase.count, testCase.size) + }) + } +} + +func benchmarkProcessProposal_PFB_Half_Second(b *testing.B, count, size int) { + testApp, rawTxs := generatePayForBlobTransactions(b, count, size) + + targetTimeLowerBound := 0.499 + targetTimeUpperBound := 0.511 + + start := 0 + end := count + segment := end - start + for { + if segment == 1 { + break + } + + prepareProposalRequest := types.RequestPrepareProposal{ + BlockData: &tmproto.Data{ + Txs: rawTxs[start:end], + }, + ChainId: testApp.GetChainID(), + Height: 10, + } + prepareProposalResponse := testApp.PrepareProposal(prepareProposalRequest) + require.GreaterOrEqual(b, len(prepareProposalResponse.BlockData.Txs), 1) + + processProposalRequest := types.RequestProcessProposal{ + BlockData: prepareProposalResponse.BlockData, + Header: tmproto.Header{ + Height: 10, + DataHash: prepareProposalResponse.BlockData.Hash, + ChainID: testutil.ChainID, + Version: version.Consensus{ + App: testApp.AppVersion(), + }, + }, + } + + startTime := time.Now() + resp := testApp.ProcessProposal(processProposalRequest) + endTime := time.Now() + require.Equal(b, types.ResponseProcessProposal_ACCEPT, resp.Result) + + timeElapsed := float64(endTime.Sub(startTime).Nanoseconds()) / 1e9 + + b.ReportMetric(timeElapsed, fmt.Sprintf("processProposalTime(s)_%d_%d_%f", end-start, size, calculateBlockSizeInMb(prepareProposalResponse.BlockData.Txs[start:end]))) + + if timeElapsed < targetTimeLowerBound { + end = end + segment/2 + segment = end - start + } else if timeElapsed > targetTimeUpperBound { + end = end / 2 + segment = end - start + } else { + break + } + } +} + // generatePayForBlobTransactions creates a test app then generates a number // of valid PFB transactions. func generatePayForBlobTransactions(b *testing.B, count int, size int) (*app.App, [][]byte) { From a18707dae19c18ba178f37aba8b6ecdf4f19107c Mon Sep 17 00:00:00 2001 From: sweexordious Date: Thu, 10 Oct 2024 23:55:25 +0400 Subject: [PATCH 16/33] chore: only report the result --- app/benchmark_msg_send_test.go | 3 +-- app/benchmark_pfb_test.go | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/benchmark_msg_send_test.go b/app/benchmark_msg_send_test.go index b2f493c8a1..8357073632 100644 --- a/app/benchmark_msg_send_test.go +++ b/app/benchmark_msg_send_test.go @@ -251,8 +251,6 @@ func BenchmarkProcessProposal_MsgSend_8MB_Find_Half_Sec(b *testing.B) { timeElapsed := float64(endTime.Sub(startTime).Nanoseconds()) / 1e9 - b.ReportMetric(timeElapsed, fmt.Sprintf("elapsedTime(s)_%d", end-start)) - if timeElapsed < targetTimeLowerBound { end = end + segment/2 segment = end - start @@ -260,6 +258,7 @@ func BenchmarkProcessProposal_MsgSend_8MB_Find_Half_Sec(b *testing.B) { end = end / 2 segment = end - start } else { + b.ReportMetric(timeElapsed, fmt.Sprintf("elapsedTime(s)_%d", end-start)) break } } diff --git a/app/benchmark_pfb_test.go b/app/benchmark_pfb_test.go index 26cbe39782..cc3d17331b 100644 --- a/app/benchmark_pfb_test.go +++ b/app/benchmark_pfb_test.go @@ -302,8 +302,6 @@ func benchmarkProcessProposal_PFB_Half_Second(b *testing.B, count, size int) { timeElapsed := float64(endTime.Sub(startTime).Nanoseconds()) / 1e9 - b.ReportMetric(timeElapsed, fmt.Sprintf("processProposalTime(s)_%d_%d_%f", end-start, size, calculateBlockSizeInMb(prepareProposalResponse.BlockData.Txs[start:end]))) - if timeElapsed < targetTimeLowerBound { end = end + segment/2 segment = end - start @@ -311,6 +309,8 @@ func benchmarkProcessProposal_PFB_Half_Second(b *testing.B, count, size int) { end = end / 2 segment = end - start } else { + b.ReportMetric(timeElapsed, fmt.Sprintf("processProposalTime(s)_%d_%d_%f", end-start, size, calculateBlockSizeInMb(prepareProposalResponse.BlockData.Txs[start:end]))) + break } } From ae7fb1967525094e0b6be3d39c291d0e6b30411b Mon Sep 17 00:00:00 2001 From: sweexordious Date: Thu, 17 Oct 2024 17:29:24 +0400 Subject: [PATCH 17/33] docs: add result docs --- app/benchmarks/results.md | 839 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 839 insertions(+) create mode 100644 app/benchmarks/results.md diff --git a/app/benchmarks/results.md b/app/benchmarks/results.md new file mode 100644 index 0000000000..5ac4b13247 --- /dev/null +++ b/app/benchmarks/results.md @@ -0,0 +1,839 @@ + +# Benchmark results + +This document contains the results of the benchmarks defined under `app/benchmarks`. + +The benchmarks were run on a Macbook Pro M3 MAX with 48GB RAM. + +The benchmarks will be run using an in memory DB, then a local db, goleveldb. + +## In memory DB benchmarks + +### `sendMsg` benchmarks + +#### CheckTx + +A single `checkTx` of a `sendMsg` message takes 0.0003585 **ns** to execute. And it uses 74374 gas. + +The transactions in an `8mb` block containing 31645 `sendMsg` messages take 6,29 s (6293858682 ns) to run `checkTx` on all of them. The total gas used is 1884371034 gas. + +#### DeliverTx + +A single `deliverTx` of a `sendMsg` message takes 0.0002890 **ns** to execute. And it uses 103251 gas. + +The transactions in an `8mb` block containing 31645 `sendMsg` messages take 7,56 s (7564111078 ns) to run `deliverTx` on all of them. The total gas used is 2801272121 gas. + +#### PrepareProposal + +A single `prepareProposal` of a `sendMsg` message takes 0.0002801 **ns** to execute. And it uses 101110 gas. + +An `8mb` block containing 31645 `sendMsg` messages takes 5,04 s (5049140917 ns) to execute. The total gas used 1843040790 gas. + +#### ProcessProposal + +A single `processProposal` of a `sendMsg` message takes 0.0002313 **ns** to execute. And it uses 101110 gas. + +An `8mb` block containing 31645 `sendMsg` messages takes 5,17 s (5179850250 ns) to execute. The total gas used 1,843,040,790 gas. + +For the processing time of a block full of `sendMsg`, we benchmarked how much time they take depending on the number of transactions, and we have the following results: + +| Number of Transactions | ElapsedTime(s) | Number of Transactions | ElapsedTime(s) | +|------------------------|----------------|------------------------|----------------| +| 1650 | 0.2494 | 1670 | 0.2594 | +| 1690 | 0.2628 | 1739 | 0.2723 | +| 1761 | 0.2732 | 1782 | 0.2770 | +| 1856 | 0.2878 | 1878 | 0.2976 | +| 1901 | 0.2990 | 1956 | 0.3023 | +| 1980 | 0.3076 | 2004 | 0.3232 | +| 2062 | 0.3252 | 2088 | 0.3257 | +| 2112 | 0.3326 | 2138 | 0.3417 | +| 2200 | 0.3398 | 2227 | 0.3495 | +| 2254 | 0.3545 | 2319 | 0.3688 | +| 2349 | 0.3684 | 2376 | 0.3771 | +| 2475 | 0.3972 | 2505 | 0.3928 | +| 2535 | 0.4080 | 2608 | 0.4098 | +| 2641 | 0.4123 | 2673 | 0.4135 | +| 2750 | 0.4614 | 2784 | 0.4333 | +| 2817 | 0.4537 | 2851 | 0.4530 | +| 2934 | 0.4633 | 2970 | 0.4623 | +| 3006 | 0.4863 | 3093 | 0.4821 | +| 3132 | 0.4888 | 3168 | 0.4962 | +| 3207 | 0.5058 | 3300 | 0.5119 | +| 3340 | 0.5275 | 3381 | 0.5280 | +| 3478 | 0.5441 | 3523 | 0.5473 | +| 3564 | 0.5546 | 3712 | 0.5743 | +| 3757 | 0.6081 | 3802 | 0.5970 | +| 3912 | 0.6093 | 3961 | 0.6125 | +| 4009 | 0.6329 | 4125 | 0.6663 | +| 4176 | 0.6395 | 4225 | 0.6615 | +| 4276 | 0.6844 | 4401 | 0.7190 | +| 4455 | 0.6943 | 4509 | 0.7006 | +| 4639 | 0.7219 | 4698 | 0.7365 | +| 4752 | 0.7340 | 5500 | 0.8489 | + +### `PFB` benchmarks + +#### CheckTx: `BenchmarkCheckTx_PFB_Multi` + +Benchmarks of `CheckTx` for a single PFB with different sizes: + +| Benchmark Name | Time (ns/op) | Gas Used | Transaction Size (Bytes) | Transaction Size (MB) | +|---------------------------------------------|--------------|----------|--------------------------|-----------------------| +| BenchmarkCheckTx_PFB_Multi/300_bytes-16 | 0.0003121 ns | 74,664 | 703 | 0.000703 MB | +| BenchmarkCheckTx_PFB_Multi/500_bytes-16 | 0.0003392 ns | 74,664 | 903 | 0.000903 MB | +| BenchmarkCheckTx_PFB_Multi/1000_bytes-16 | 0.0002797 ns | 74,664 | 1,403 | 0.001403 MB | +| BenchmarkCheckTx_PFB_Multi/5000_bytes-16 | 0.0002818 ns | 74,664 | 5,403 | 0.005403 MB | +| BenchmarkCheckTx_PFB_Multi/10000_bytes-16 | 0.0003094 ns | 74,664 | 10,403 | 0.010403 MB | +| BenchmarkCheckTx_PFB_Multi/50000_bytes-16 | 0.0004127 ns | 74,674 | 50,406 | 0.050406 MB | +| BenchmarkCheckTx_PFB_Multi/100000_bytes-16 | 0.0004789 ns | 74,674 | 100,406 | 0.100406 MB | +| BenchmarkCheckTx_PFB_Multi/200000_bytes-16 | 0.0006958 ns | 74,674 | 200,406 | 0.200406 MB | +| BenchmarkCheckTx_PFB_Multi/300000_bytes-16 | 0.0008678 ns | 74,674 | 300,406 | 0.300406 MB | +| BenchmarkCheckTx_PFB_Multi/400000_bytes-16 | 0.001076 ns | 74,674 | 400,406 | 0.400406 MB | +| BenchmarkCheckTx_PFB_Multi/500000_bytes-16 | 0.001307 ns | 74,674 | 500,406 | 0.500406 MB | +| BenchmarkCheckTx_PFB_Multi/1000000_bytes-16 | 0.002291 ns | 74,674 | 1,000,406 | 1.000406 MB | +| BenchmarkCheckTx_PFB_Multi/2000000_bytes-16 | 0.005049 ns | 74,674 | 2,000,406 | 2.000406 MB | +| BenchmarkCheckTx_PFB_Multi/3000000_bytes-16 | 0.006911 ns | 74,684 | 3,000,409 | 3.000409 MB | +| BenchmarkCheckTx_PFB_Multi/4000000_bytes-16 | 0.008246 ns | 74,684 | 4,000,409 | 4.000409 MB | +| BenchmarkCheckTx_PFB_Multi/5000000_bytes-16 | 0.01127 ns | 74,684 | 5,000,409 | 5.000409 MB | +| BenchmarkCheckTx_PFB_Multi/6000000_bytes-16 | 0.01316 ns | 74,684 | 6,000,409 | 6.000409 MB | + +#### DeliverTx: `BenchmarkDeliverTx_PFB_Multi` + +Benchmarks of `DeliverTx` for a single PFB with different sizes: + +| Benchmark Name | Time (ns/op) | Gas Used | Transaction Size (Bytes) | Transaction Size (MB) | +|-----------------------------------------------|--------------|------------|--------------------------|-----------------------| +| BenchmarkDeliverTx_PFB_Multi/300_bytes-16 | 0.0002718 ns | 77,682 | 703 | 0.000703 MB | +| BenchmarkDeliverTx_PFB_Multi/500_bytes-16 | 0.0002574 ns | 81,778 | 903 | 0.000903 MB | +| BenchmarkDeliverTx_PFB_Multi/1000_bytes-16 | 0.0002509 ns | 85,874 | 1,403 | 0.001403 MB | +| BenchmarkDeliverTx_PFB_Multi/5000_bytes-16 | 0.0002755 ns | 118,642 | 5,403 | 0.005403 MB | +| BenchmarkDeliverTx_PFB_Multi/10000_bytes-16 | 0.0002726 ns | 159,602 | 10,403 | 0.010403 MB | +| BenchmarkDeliverTx_PFB_Multi/50000_bytes-16 | 0.0002795 ns | 499,580 | 50,406 | 0.050406 MB | +| BenchmarkDeliverTx_PFB_Multi/100000_bytes-16 | 0.0002488 ns | 925,564 | 100,406 | 0.100406 MB | +| BenchmarkDeliverTx_PFB_Multi/200000_bytes-16 | 0.0002487 ns | 1,773,436 | 200,406 | 0.200406 MB | +| BenchmarkDeliverTx_PFB_Multi/300000_bytes-16 | 0.0002887 ns | 2,625,404 | 300,406 | 0.300406 MB | +| BenchmarkDeliverTx_PFB_Multi/400000_bytes-16 | 0.0002810 ns | 3,473,276 | 400,406 | 0.400406 MB | +| BenchmarkDeliverTx_PFB_Multi/500000_bytes-16 | 0.0002616 ns | 4,325,244 | 500,406 | 0.500406 MB | +| BenchmarkDeliverTx_PFB_Multi/1000000_bytes-16 | 0.0003983 ns | 8,572,796 | 1,000,406 | 1.000406 MB | +| BenchmarkDeliverTx_PFB_Multi/2000000_bytes-16 | 0.0003368 ns | 17,071,996 | 2,000,406 | 2.000406 MB | +| BenchmarkDeliverTx_PFB_Multi/3000000_bytes-16 | 0.0005770 ns | 25,571,206 | 3,000,409 | 3.000409 MB | +| BenchmarkDeliverTx_PFB_Multi/4000000_bytes-16 | 0.0003752 ns | 34,066,310 | 4,000,409 | 4.000409 MB | +| BenchmarkDeliverTx_PFB_Multi/5000000_bytes-16 | 0.0003788 ns | 42,565,510 | 5,000,409 | 5.000409 MB | +| BenchmarkDeliverTx_PFB_Multi/6000000_bytes-16 | 0.0003975 ns | 51,064,710 | 6,000,409 | 6.000409 MB | + +#### PrepareProposal: `BenchmarkPrepareProposal_PFB_Multi` + +The benchmarks for `PrepareProposal` for 8mb blocks containing PFBs of different sizes: + +| Benchmark Name | Block Size (MB) | Number of Transactions | Prepare Proposal Time (s) | Total Gas Used | Transaction Size (Bytes) | Transaction Size (MB) | +|------------------------------------------------------------------------|-----------------|------------------------|---------------------------|-----------------|--------------------------|-----------------------| +| BenchmarkPrepareProposal_PFB_Multi/15000_transactions_of_300_bytes-16 | 6.239 | 10,318 | 2.411 s | 988,490,895,000 | 703 | 0.000703 MB | +| BenchmarkPrepareProposal_PFB_Multi/10000_transactions_of_500_bytes-16 | 5.035 | 6,331 | 1.710 s | 439,343,930,000 | 903 | 0.000903 MB | +| BenchmarkPrepareProposal_PFB_Multi/6000_transactions_of_1000_bytes-16 | 5.809 | 4,566 | 1.033 s | 158,174,358,000 | 1,403 | 0.001403 MB | +| BenchmarkPrepareProposal_PFB_Multi/3000_transactions_of_5000_bytes-16 | 7.188 | 1,413 | 0.547 s | 39,550,179,000 | 5,403 | 0.005403 MB | +| BenchmarkPrepareProposal_PFB_Multi/1000_transactions_of_10000_bytes-16 | 7.470 | 758 | 0.210 s | 4,397,393,000 | 10,403 | 0.010403 MB | +| BenchmarkPrepareProposal_PFB_Multi/500_transactions_of_50000_bytes-16 | 7.441 | 155 | 0.127 s | 1,100,446,500 | 50,406 | 0.050406 MB | +| BenchmarkPrepareProposal_PFB_Multi/100_transactions_of_100000_bytes-16 | 7.368 | 77 | 0.045 s | 44,369,300 | 100,406 | 0.100406 MB | +| BenchmarkPrepareProposal_PFB_Multi/100_transactions_of_200000_bytes-16 | 7.260 | 38 | 0.059 s | 44,369,300 | 200,406 | 0.200406 MB | +| BenchmarkPrepareProposal_PFB_Multi/50_transactions_of_300000_bytes-16 | 7.161 | 25 | 0.056 s | 11,202,150 | 300,406 | 0.300406 MB | +| BenchmarkPrepareProposal_PFB_Multi/50_transactions_of_400000_bytes-16 | 7.254 | 19 | 0.054 s | 11,202,150 | 400,406 | 0.400406 MB | +| BenchmarkPrepareProposal_PFB_Multi/30_transactions_of_500000_bytes-16 | 7.157 | 15 | 0.041 s | 4,085,490 | 500,406 | 0.500406 MB | +| BenchmarkPrepareProposal_PFB_Multi/10_transactions_of_1000000_bytes-16 | 6.678 | 7 | 0.031 s | 483,230 | 1,000,406 | 1.000406 MB | +| BenchmarkPrepareProposal_PFB_Multi/5_transactions_of_2000000_bytes-16 | 5.723 | 3 | 0.032 s | 131,790 | 2,000,406 | 2.000406 MB | +| BenchmarkPrepareProposal_PFB_Multi/3_transactions_of_3000000_bytes-16 | 5.723 | 2 | 0.042 s | 52,716 | 3,000,409 | 3.000409 MB | +| BenchmarkPrepareProposal_PFB_Multi/3_transactions_of_4000000_bytes-16 | 3.815 | 1 | 0.040 s | 52,716 | 4,000,409 | 4.000409 MB | +| BenchmarkPrepareProposal_PFB_Multi/2_transactions_of_5000000_bytes-16 | 4.769 | 1 | 0.039 s | 26,358 | 5,000,409 | 5.000409 MB | +| BenchmarkPrepareProposal_PFB_Multi/2_transactions_of_6000000_bytes-16 | 5.722 | 1 | 0.032 s | 26,358 | 6,000,409 | 6.000409 MB | + +#### ProcessProposal: `BenchmarkProcessProposal_PFB_Multi` + +The benchmarks for `ProcessProposal` for 8mb blocks containing PFBs of different sizes: + +| Benchmark Name | Block Size (MB) | Number of Transactions | Process Proposal Time (s) | Total Gas Used | Transaction Size (Bytes) | Transaction Size (MB) | +|------------------------------------------------------------------------|-----------------|------------------------|---------------------------|-----------------|--------------------------|-----------------------| +| BenchmarkProcessProposal_PFB_Multi/15000_transactions_of_300_bytes-16 | 6.239 | 10,318 | 1.767 s | 988,490,895,000 | 703 | 0.000703 MB | +| BenchmarkProcessProposal_PFB_Multi/10000_transactions_of_500_bytes-16 | 5.035 | 6,331 | 1.101 s | 439,343,930,000 | 903 | 0.000903 MB | +| BenchmarkProcessProposal_PFB_Multi/6000_transactions_of_1000_bytes-16 | 5.809 | 4,566 | 0.820 s | 158,174,358,000 | 1,403 | 0.001403 MB | +| BenchmarkProcessProposal_PFB_Multi/3000_transactions_of_5000_bytes-16 | 7.188 | 1,413 | 0.300 s | 39,550,179,000 | 5,403 | 0.005403 MB | +| BenchmarkProcessProposal_PFB_Multi/1000_transactions_of_10000_bytes-16 | 7.470 | 758 | 0.185 s | 4,397,393,000 | 10,403 | 0.010403 MB | +| BenchmarkProcessProposal_PFB_Multi/500_transactions_of_50000_bytes-16 | 7.441 | 155 | 0.092 s | 1,100,446,500 | 50,406 | 0.050406 MB | +| BenchmarkProcessProposal_PFB_Multi/100_transactions_of_100000_bytes-16 | 7.368 | 77 | 0.089 s | 44,369,300 | 100,406 | 0.100406 MB | +| BenchmarkProcessProposal_PFB_Multi/100_transactions_of_200000_bytes-16 | 7.260 | 38 | 0.060 s | 44,369,300 | 200,406 | 0.200406 MB | +| BenchmarkProcessProposal_PFB_Multi/50_transactions_of_300000_bytes-16 | 7.161 | 25 | 0.048 s | 11,202,150 | 300,406 | 0.300406 MB | +| BenchmarkProcessProposal_PFB_Multi/50_transactions_of_400000_bytes-16 | 7.254 | 19 | 0.051 s | 11,202,150 | 400,406 | 0.400406 MB | +| BenchmarkProcessProposal_PFB_Multi/30_transactions_of_500000_bytes-16 | 7.157 | 15 | 0.062 s | 4,085,490 | 500,406 | 0.500406 MB | +| BenchmarkProcessProposal_PFB_Multi/10_transactions_of_1000000_bytes-16 | 6.678 | 7 | 0.047 s | 483,230 | 1,000,406 | 1.000406 MB | +| BenchmarkProcessProposal_PFB_Multi/5_transactions_of_2000000_bytes-16 | 5.723 | 3 | 0.043 s | 131,790 | 2,000,406 | 2.000406 MB | +| BenchmarkProcessProposal_PFB_Multi/3_transactions_of_3000000_bytes-16 | 5.723 | 2 | 0.053 s | 52,716 | 3,000,409 | 3.000409 MB | +| BenchmarkProcessProposal_PFB_Multi/3_transactions_of_4000000_bytes-16 | 3.815 | 1 | 0.047 s | 52,716 | 4,000,409 | 4.000409 MB | +| BenchmarkProcessProposal_PFB_Multi/2_transactions_of_5000000_bytes-16 | 4.769 | 1 | 0.068 s | 26,358 | 5,000,409 | 5.000409 MB | +| BenchmarkProcessProposal_PFB_Multi/2_transactions_of_6000000_bytes-16 | 5.722 | 1 | 0.047 s | 26,358 | 6,000,409 | 6.000409 MB | + +### IBC `UpdateClient` benchmarks + +#### CheckTx: `BenchmarkIBC_CheckTx_Update_Client_Multi` + +The benchmarks of executing `checkTx` on a single transaction containing an IBC `updateClient` with different numbers of required signatures: + +| Benchmark Name | Time (ns/op) | Gas Used | Number of Validators | Number of Verified Signatures | Transaction Size (Bytes) | Transaction Size (MB) | +|-----------------------------------------------------------------------|--------------|-----------|----------------------|-------------------------------|--------------------------|-----------------------| +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_2-16 | 0.0007940 ns | 108,598 | 2.0 | 1.0 | 1,396 | 0.001396 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_10-16 | 0.002127 ns | 127,710 | 10.0 | 6.0 | 3,303 | 0.003303 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_25-16 | 0.003694 ns | 163,430 | 25.0 | 16.0 | 6,875 | 0.006875 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_50-16 | 0.004701 ns | 222,930 | 50.0 | 33.0 | 12,825 | 0.012825 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_75-16 | 0.004095 ns | 282,480 | 75.0 | 50.0 | 18,780 | 0.018780 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_100-16 | 0.004112 ns | 340,928 | 100.0 | 66.0 | 24,629 | 0.024629 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_125-16 | 0.007009 ns | 400,178 | 125.0 | 83.0 | 30,554 | 0.030554 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_150-16 | 0.004906 ns | 460,980 | 150.0 | 100.0 | 36,630 | 0.036630 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_175-16 | 0.01056 ns | 520,500 | 175.0 | 116.0 | 42,582 | 0.042582 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_200-16 | 0.01181 ns | 580,000 | 200.0 | 133.0 | 48,532 | 0.048532 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_225-16 | 0.01339 ns | 637,198 | 225.0 | 150.0 | 54,256 | 0.054256 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_250-16 | 0.01411 ns | 699,020 | 250.0 | 166.0 | 60,434 | 0.060434 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_300-16 | 0.01931 ns | 818,020 | 300.0 | 200.0 | 72,334 | 0.072334 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_400-16 | 0.02312 ns | 1,056,020 | 400.0 | 266.0 | 96,134 | 0.096134 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_500-16 | 0.01675 ns | 1,288,968 | 500.0 | 333.0 | 119,433 | 0.119433 MB | + +#### DeliverTx: `BenchmarkIBC_DeliverTx_Update_Client_Multi` + +The benchmarks of executing `deliverTx` on a single transaction containing an IBC `updateClient` with different numbers of required signatures: + +| Benchmark Name | Time (ns/op) | Gas Used | Number of Validators | Number of Verified Signatures | Transaction Size (Bytes) | Transaction Size (MB) | +|-------------------------------------------------------------------------|--------------|-----------|----------------------|-------------------------------|--------------------------|-----------------------| +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_2-16 | 0.0006931 ns | 107,520 | 2.0 | 1.0 | 1,396 | 0.001396 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_10-16 | 0.004647 ns | 126,480 | 10.0 | 6.0 | 3,292 | 0.003292 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_25-16 | 0.005861 ns | 162,352 | 25.0 | 16.0 | 6,875 | 0.006875 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_50-16 | 0.009248 ns | 221,852 | 50.0 | 33.0 | 12,825 | 0.012825 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_75-16 | 0.01252 ns | 281,402 | 75.0 | 50.0 | 18,780 | 0.018780 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_100-16 | 0.01239 ns | 339,850 | 100.0 | 66.0 | 24,629 | 0.024629 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_125-16 | 0.01300 ns | 400,402 | 125.0 | 83.0 | 30,680 | 0.030680 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_150-16 | 0.01691 ns | 459,902 | 150.0 | 100.0 | 36,630 | 0.036630 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_175-16 | 0.01560 ns | 517,620 | 175.0 | 116.0 | 42,406 | 0.042406 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_200-16 | 0.01894 ns | 578,922 | 200.0 | 133.0 | 48,532 | 0.048532 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_225-16 | 0.01714 ns | 638,422 | 225.0 | 150.0 | 54,482 | 0.054482 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_250-16 | 0.01736 ns | 697,942 | 250.0 | 166.0 | 60,434 | 0.060434 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_300-16 | 0.02008 ns | 816,942 | 300.0 | 200.0 | 72,334 | 0.072334 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_400-16 | 0.02320 ns | 1,054,942 | 400.0 | 266.0 | 96,134 | 0.096134 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_500-16 | 0.02724 ns | 1,288,522 | 500.0 | 333.0 | 119,492 | 0.119492 MB | + +#### PrepareProposal: `BenchmarkIBC_PrepareProposal_Update_Client_Multi` + +Benchmarks of an `8mb` containing the maximum number of IBC `UpdateClient` with different number of signatures: + +| Benchmark Name | Block Size (MB) | Number of Transactions | Number of Validators | Number of Verified Signatures | Prepare Proposal Time (s) | Total Gas Used | Transaction Size (Bytes) | Transaction Size (MB) | +|-------------------------------------------------------------------------------|------------------|-------------------------|----------------------|-------------------------------|-----------------------------|------------------|----------------------------|------------------------| +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_10-16 | 7.464 | 2,367 | 10.0 | 6.0 | 0.571 s | 266,926,655 | 3,373 | 0.003373 MB | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_25-16 | 7.465 | 1,138 | 25.0 | 16.0 | 0.436 s | 249,391,655 | 6,945 | 0.006945 MB | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_50-16 | 7.462 | 610.0 | 50.0 | 33.0 | 0.271 s | 184,196,655 | 12,895 | 0.012895 MB | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_75-16 | 7.452 | 416.0 | 75.0 | 50.0 | 0.181 s | 121,879,155 | 18,850 | 0.018850 MB | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_100-16 | 7.453 | 316.0 | 100.0 | 66.0 | 0.180 s | 151,629,155 | 24,800 | 0.024800 MB | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_125-16 | 7.462 | 255.0 | 125.0 | 83.0 | 0.197 s | 181,379,155 | 30,750 | 0.030750 MB | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_150-16 | 7.441 | 213.0 | 150.0 | 100.0 | 0.207 s | 211,129,155 | 36,700 | 0.036700 MB | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_175-16 | 7.432 | 183.0 | 175.0 | 116.0 | 0.215 s | 240,889,155 | 42,652 | 0.042652 MB | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_200-16 | 7.467 | 162.0 | 200.0 | 133.0 | 0.227 s | 269,634,155 | 48,401 | 0.048401 MB | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_225-16 | 7.451 | 144.0 | 225.0 | 150.0 | 0.235 s | 299,259,155 | 54,326 | 0.054326 MB | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_250-16 | 7.462 | 130.0 | 250.0 | 166.0 | 0.242 s | 328,894,155 | 60,253 | 0.060253 MB | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_300-16 | 7.450 | 108.0 | 300.0 | 200.0 | 0.270 s | 389,649,155 | 72,404 | 0.072404 MB | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_400-16 | 7.426 | 81.0 | 400.0 | 266.0 | 0.304 s | 508,649,155 | 96,204 | 0.096204 MB | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_500-16 | 7.404 | 65.0 | 500.0 | 333.0 | 0.361 s | 625,144,155 | 119,503 | 0.119503 MB | + +#### ProcessProposal: `BenchmarkIBC_ProcessProposal_Update_Client_Multi` + +Benchmarks of an `8mb` containing the maximum number of IBC `UpdateClient` with different number of signatures: + +| Benchmark Name | Block Size (MB) | Number of Transactions | Number of Validators | Number of Verified Signatures | Process Proposal Time (s) | Total Gas Used | Transaction Size (Bytes) | Transaction Size (MB) | +|-------------------------------------------------------------------------------|-----------------|------------------------|----------------------|-------------------------------|---------------------------|----------------|--------------------------|-----------------------| +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_2-16 | 7.457 | 5,574 | 2.0 | 1.0 | 1.022 s | 419,611,655 | 1,469 | 0.001469 MB | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_10-16 | 7.464 | 2,367 | 10.0 | 6.0 | 0.455 s | 266,926,655 | 3,373 | 0.003373 MB | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_25-16 | 7.465 | 1,138 | 25.0 | 16.0 | 0.270 s | 249,391,655 | 6,945 | 0.006945 MB | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_50-16 | 7.462 | 610.0 | 50.0 | 33.0 | 0.181 s | 184,196,655 | 12,895 | 0.012895 MB | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_75-16 | 7.452 | 416.0 | 75.0 | 50.0 | 0.150 s | 121,879,155 | 18,850 | 0.018850 MB | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_100-16 | 7.453 | 316.0 | 100.0 | 66.0 | 0.132 s | 151,629,155 | 24,800 | 0.024800 MB | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_125-16 | 7.462 | 255.0 | 125.0 | 83.0 | 0.122 s | 181,379,155 | 30,750 | 0.030750 MB | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_150-16 | 7.441 | 213.0 | 150.0 | 100.0 | 0.107 s | 211,129,155 | 36,700 | 0.036700 MB | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_175-16 | 7.442 | 184.0 | 175.0 | 116.0 | 0.092 s | 240,009,155 | 42,476 | 0.042476 MB | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_200-16 | 7.452 | 161.0 | 200.0 | 133.0 | 0.098 s | 270,639,155 | 48,602 | 0.048602 MB | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_225-16 | 7.430 | 143.0 | 225.0 | 150.0 | 0.089 s | 300,389,155 | 54,552 | 0.054552 MB | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_250-16 | 7.435 | 129.0 | 250.0 | 166.0 | 0.081 s | 330,149,155 | 60,504 | 0.060504 MB | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_300-16 | 7.450 | 108.0 | 300.0 | 200.0 | 0.078 s | 389,649,155 | 72,404 | 0.072404 MB | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_400-16 | 7.426 | 81.0 | 400.0 | 266.0 | 0.077 s | 508,649,155 | 96,204 | 0.096204 MB | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_500-16 | 7.435 | 65.0 | 500.0 | 333.0 | 0.092 s | 627,649,155 | 120,004 | 0.120004 MB | + +#### Process proposal time with different number of transactions per block + +**50 bytes blobs**: + +| Number of Transactions | Block Size (bytes) | Elapsed Time (s) | +|------------------------|--------------------|------------------| +| 1467 | 0.532979 | 0.2508 | +| 1546 | 0.561684 | 0.2766 | +| 1566 | 0.568951 | 0.2511 | +| 1650 | 0.599472 | 0.2711 | +| 1739 | 0.631810 | 0.3007 | +| 1761 | 0.639804 | 0.2832 | +| 1856 | 0.674322 | 0.3017 | +| 1956 | 0.710657 | 0.3203 | +| 1980 | 0.719378 | 0.3291 | +| 2062 | 0.749172 | 0.3670 | +| 2088 | 0.758619 | 0.3426 | +| 2200 | 0.799314 | 0.3610 | +| 2319 | 0.842553 | 0.3980 | +| 2349 | 0.853454 | 0.3794 | +| 2475 | 0.899236 | 0.4086 | +| 2608 | 0.947561 | 0.4555 | +| 2641 | 0.959552 | 0.4561 | +| 2750 | 0.999157 | 0.4920 | +| 2784 | 1.011511 | 0.4782 | +| 2934 | 1.066013 | 0.5209 | +| 2970 | 1.079094 | 0.5069 | +| 3093 | 1.123786 | 0.5816 | +| 3132 | 1.137957 | 0.5360 | +| 3300 | 1.198999 | 0.5766 | +| 3478 | 1.263676 | 0.6072 | +| 3523 | 1.280026 | 0.6028 | +| 3712 | 1.348700 | 0.6394 | +| 3912 | 1.421370 | 0.6928 | +| 3961 | 1.439174 | 0.6559 | +| 4125 | 1.498763 | 0.7463 | +| 4176 | 1.517294 | 0.6967 | +| 5500 | 1.998369 | 0.9183 | +| 11000 | 3.753713 | 1.732 | + +**100 bytes blobs**: + +| Number of Transactions | Block Size (bytes) | Elapsed Time (s) | +|------------------------|--------------------|------------------| +| 1546 | 0.636877 | 0.2726 | +| 1739 | 0.716391 | 0.2762 | +| 1956 | 0.805792 | 0.3207 | +| 2062 | 0.849463 | 0.3361 | +| 2319 | 0.955343 | 0.3774 | +| 2608 | 1.074408 | 0.4387 | +| 2750 | 1.132910 | 0.4873 | +| 2934 | 1.208715 | 0.5015 | +| 3093 | 1.274221 | 0.5202 | +| 3478 | 1.432837 | 0.5797 | +| 3912 | 1.611639 | 0.6520 | +| 4125 | 1.699392 | 0.6758 | +| 5500 | 2.265875 | 0.9318 | +| 11000 | 4.256186 | 1.685 | + +**200 bytes blobs**: + +| Number of Transactions | Block Size (bytes) | Elapsed Time (s) | +|------------------------|--------------------|------------------| +| 1546 | 0.787264 | 0.2472 | +| 1739 | 0.885551 | 0.3009 | +| 1956 | 0.996061 | 0.3188 | +| 2062 | 1.050043 | 0.3400 | +| 2319 | 1.180923 | 0.3781 | +| 2608 | 1.328100 | 0.4439 | +| 2750 | 1.400415 | 0.4720 | +| 2934 | 1.494120 | 0.5049 | +| 3093 | 1.575092 | 0.5384 | +| 3478 | 1.771158 | 0.5913 | +| 3912 | 1.992178 | 0.6459 | +| 4125 | 2.100651 | 0.6927 | +| 5500 | 2.800886 | 0.8970 | +| 11000 | 5.254511 | 1.691 | + +**300 bytes blobs**: + +| Number of Transactions | Block Size (bytes) | Elapsed Time (s) | +|------------------------|--------------------|------------------| +| 1546 | 0.934702 | 0.2506 | +| 1739 | 1.051395 | 0.2910 | +| 1956 | 1.182600 | 0.3316 | +| 2062 | 1.246691 | 0.3439 | +| 2319 | 1.402081 | 0.3830 | +| 2608 | 1.576818 | 0.4674 | +| 2750 | 1.662676 | 0.4803 | +| 2934 | 1.773928 | 0.5110 | +| 3093 | 1.870064 | 0.5431 | +| 3478 | 2.102846 | 0.6002 | +| 3912 | 2.365255 | 0.6659 | +| 4125 | 2.494041 | 0.7052 | +| 5500 | 3.325407 | 0.9117 | +| 11000 | 6.238512 | 1.688 | + +**400 bytes blobs**: + +| Number of Transactions | Block Size (bytes) | Elapsed Time (s) | +|------------------------|--------------------|------------------| +| 1375 | 0.962440 | 0.2425 | +| 1467 | 1.026840 | 0.2564 | +| 1546 | 1.082140 | 0.2583 | +| 1650 | 1.154940 | 0.2713 | +| 1739 | 1.217239 | 0.2854 | +| 1856 | 1.299139 | 0.3204 | +| 1956 | 1.369139 | 0.3205 | +| 2062 | 1.443338 | 0.3535 | +| 2200 | 1.539938 | 0.3674 | +| 2319 | 1.623238 | 0.3873 | +| 2475 | 1.732437 | 0.4184 | +| 2608 | 1.825537 | 0.4635 | +| 2750 | 1.924936 | 0.5227 | +| 2784 | 1.948736 | 0.5029 | +| 2934 | 2.053736 | 0.5193 | +| 3093 | 2.165035 | 0.5505 | +| 3300 | 2.309935 | 0.6121 | +| 3478 | 2.434534 | 0.6077 | +| 3712 | 2.598333 | 0.6534 | +| 3912 | 2.738333 | 0.6625 | +| 5500 | 3.849928 | 0.9410 | +| 11000 | 7.222513 | 1.782 | + +**500 bytes blobs**: + +| Number of Transactions | Block Size (bytes) | Elapsed Time (s) | +|------------------------|--------------------|------------------| +| 1476 | 1.173903 | 0.2640 | +| 1660 | 1.320250 | 0.3192 | +| 1750 | 1.391832 | 0.3249 | +| 1867 | 1.484890 | 0.3494 | +| 1968 | 1.565222 | 0.3664 | +| 2214 | 1.760881 | 0.4322 | +| 2490 | 1.980402 | 0.4667 | +| 2625 | 2.087776 | 0.4795 | +| 2800 | 2.226965 | 0.5033 | +| 2952 | 2.347860 | 0.5529 | +| 3321 | 2.641350 | 0.6263 | +| 3500 | 2.783720 | 0.6101 | +| 3735 | 2.970631 | 0.6629 | +| 3937 | 3.131294 | 0.7341 | +| 7000 | 5.035397 | 1.127 | + +**600 bytes blobs**: + +| Number of Transactions | Block Size (bytes) | Elapsed Time (s) | +|------------------------|--------------------|------------------| +| 1400 | 1.246969 | 0.2492 | +| 1417 | 1.262112 | 0.2554 | +| 1432 | 1.275473 | 0.2465 | +| 1476 | 1.314665 | 0.2575 | +| 1494 | 1.330698 | 0.2716 | +| 1510 | 1.344950 | 0.2729 | +| 1575 | 1.402847 | 0.2777 | +| 1593 | 1.418880 | 0.3210 | +| 1611 | 1.434914 | 0.3269 | +| 1660 | 1.478559 | 0.3331 | +| 1680 | 1.496374 | 0.3202 | +| 1698 | 1.512407 | 0.3387 | +| 1750 | 1.558725 | 0.3430 | +| 1771 | 1.577431 | 0.3476 | +| 1791 | 1.595245 | 0.3550 | +| 1812 | 1.613951 | 0.3526 | +| 1867 | 1.662941 | 0.3702 | +| 1890 | 1.683428 | 0.3592 | +| 1910 | 1.701242 | 0.3728 | +| 1968 | 1.752905 | 0.3790 | +| 1992 | 1.774282 | 0.3636 | +| 2014 | 1.793879 | 0.3740 | +| 2100 | 1.870481 | 0.4125 | +| 2125 | 1.892750 | 0.3915 | +| 2148 | 1.913237 | 0.4158 | +| 2214 | 1.972025 | 0.4057 | +| 2241 | 1.996075 | 0.4231 | +| 2265 | 2.017452 | 0.4210 | +| 2362 | 2.103853 | 0.4392 | +| 2389 | 2.127903 | 0.4406 | +| 2416 | 2.151953 | 0.4700 | +| 2490 | 2.217867 | 0.4615 | +| 2520 | 2.244589 | 0.4727 | +| 2547 | 2.268639 | 0.4743 | +| 2625 | 2.338116 | 0.4812 | +| 2656 | 2.365728 | 0.4923 | +| 2686 | 2.392450 | 0.4905 | +| 2718 | 2.420954 | 0.5042 | +| 2800 | 2.493994 | 0.5309 | +| 2835 | 2.525169 | 0.5166 | +| 2865 | 2.551891 | 0.5340 | +| 2952 | 2.629385 | 0.5378 | +| 2988 | 2.661451 | 0.5504 | +| 3021 | 2.690845 | 0.5532 | +| 3150 | 2.805750 | 0.5948 | +| 3187 | 2.838707 | 0.5747 | +| 3222 | 2.869883 | 0.5986 | +| 3321 | 2.958065 | 0.6170 | +| 3361 | 2.993694 | 0.6092 | +| 3397 | 3.025761 | 0.6193 | +| 3500 | 3.117506 | 0.6357 | +| 3543 | 3.155807 | 0.6425 | +| 3583 | 3.191437 | 0.6764 | +| 3624 | 3.227957 | 0.6628 | +| 3735 | 3.326828 | 0.6819 | +| 3780 | 3.366911 | 0.6935 | +| 3820 | 3.402540 | 0.7127 | +| 3937 | 3.506756 | 0.7093 | +| 3984 | 3.548620 | 0.7404 | +| 4029 | 3.588703 | 0.7535 | +| 7000 | 5.639168 | 1.133 | + +**1000 bytes blobs**: + +| Number of Transactions | Block Size (bytes) | Elapsed Time (s) | +|------------------------|--------------------|------------------| +| 1333 | 1.695789 | 0.2682 | +| 1348 | 1.714872 | 0.2605 | +| 1406 | 1.788660 | 0.2858 | +| 1422 | 1.809015 | 0.2827 | +| 1437 | 1.828098 | 0.2881 | +| 1499 | 1.906975 | 0.2945 | +| 1516 | 1.928602 | 0.2985 | +| 1581 | 2.011295 | 0.3039 | +| 1599 | 2.034195 | 0.3111 | +| 1616 | 2.055822 | 0.3185 | +| 1686 | 2.144876 | 0.3450 | +| 1705 | 2.169048 | 0.3501 | +| 1778 | 2.261919 | 0.3496 | +| 1798 | 2.287363 | 0.3554 | +| 1818 | 2.312807 | 0.3507 | +| 1875 | 2.385323 | 0.3849 | +| 1896 | 2.412039 | 0.3877 | +| 1917 | 2.438755 | 0.3746 | +| 1999 | 2.543076 | 0.3815 | +| 2022 | 2.572336 | 0.4042 | +| 2109 | 2.683018 | 0.4223 | +| 2133 | 2.713551 | 0.4126 | +| 2155 | 2.741539 | 0.4115 | +| 2248 | 2.859854 | 0.4183 | +| 2274 | 2.892931 | 0.4343 | +| 2371 | 3.016335 | 0.4642 | +| 2398 | 3.050684 | 0.4631 | +| 2424 | 3.083761 | 0.4575 | +| 2500 | 3.180449 | 0.4825 | +| 2529 | 3.217342 | 0.4757 | +| 2557 | 3.252964 | 0.4812 | +| 2667 | 3.392906 | 0.5144 | +| 2697 | 3.431072 | 0.5141 | +| 2727 | 3.469238 | 0.5071 | +| 2812 | 3.577375 | 0.5250 | +| 2844 | 3.618086 | 0.5359 | +| 2875 | 3.657524 | 0.5506 | +| 2998 | 3.814005 | 0.5659 | +| 3033 | 3.858532 | 0.5797 | +| 3163 | 4.023918 | 0.5964 | +| 3199 | 4.069717 | 0.6023 | +| 3232 | 4.111700 | 0.6142 | +| 3372 | 4.289808 | 0.6249 | +| 3411 | 4.339424 | 0.6465 | +| 3556 | 4.523893 | 0.6488 | +| 3597 | 4.576054 | 0.6829 | +| 3636 | 4.625669 | 0.6699 | +| 3750 | 4.770700 | 0.6820 | +| 3793 | 4.825405 | 0.6983 | +| 3835 | 4.878838 | 0.6991 | +| 5000 | 5.808817 | 0.8490 | + +**1200 bytes blobs**: + +| Number of Transactions | Block Size (bytes) | Elapsed Time (s) | +|------------------------|--------------------|------------------| +| 1406 | 2.056833 | 0.2758 | +| 1500 | 2.194349 | 0.3071 | +| 1581 | 2.312847 | 0.3054 | +| 1687 | 2.467918 | 0.3332 | +| 1778 | 2.601046 | 0.3569 | +| 1875 | 2.742950 | 0.3688 | +| 2000 | 2.925817 | 0.3793 | +| 2109 | 3.085278 | 0.4087 | +| 2250 | 3.291552 | 0.4359 | +| 2371 | 3.468567 | 0.4462 | +| 2500 | 3.657286 | 0.4789 | +| 2530 | 3.701174 | 0.4999 | +| 2667 | 3.901596 | 0.4836 | +| 2812 | 4.113722 | 0.5371 | +| 3000 | 4.388754 | 0.5768 | +| 3163 | 4.627213 | 0.5897 | +| 3375 | 4.937355 | 0.6156 | +| 3556 | 5.202147 | 0.6549 | +| 3750 | 5.485956 | 0.6933 | +| 4000 | 5.851690 | 0.7415 | +| 5000 | 6.679712 | 0.8498 | + +**1500 bytes blobs**: + +| Number of Transactions | Block Size (bytes) | Elapsed Time (s) | +|------------------------|--------------------|------------------| +| 1406 | 2.459093 | 0.2941 | +| 1581 | 2.765175 | 0.3109 | +| 1778 | 3.109735 | 0.3373 | +| 1875 | 3.279392 | 0.3706 | +| 2109 | 3.688667 | 0.4100 | +| 2371 | 4.146915 | 0.4601 | +| 2500 | 4.372541 | 0.4735 | +| 2667 | 4.664631 | 0.5013 | +| 2812 | 4.918242 | 0.5260 | +| 3163 | 5.532154 | 0.5946 | +| 3556 | 6.219526 | 0.6634 | +| 3750 | 6.245762 | 0.6879 | +| 5000 | 6.245762 | 0.6781 | + +**1800 bytes blobs**: + +| Number of Transactions | Block Size (bytes) | Elapsed Time (s) | +|------------------------|--------------------|------------------| +| 1333 | 2.712788 | 0.2643 | +| 1406 | 2.861353 | 0.2840 | +| 1422 | 2.893915 | 0.2843 | +| 1499 | 3.050621 | 0.2956 | +| 1581 | 3.217503 | 0.3094 | +| 1599 | 3.254135 | 0.3302 | +| 1686 | 3.431192 | 0.3396 | +| 1778 | 3.618425 | 0.3407 | +| 1798 | 3.659128 | 0.3397 | +| 1875 | 3.815834 | 0.3777 | +| 1896 | 3.858572 | 0.3813 | +| 1999 | 4.068192 | 0.3647 | +| 2109 | 4.292057 | 0.4191 | +| 2133 | 4.340900 | 0.4057 | +| 2248 | 4.574942 | 0.4349 | +| 2371 | 4.825264 | 0.4446 | +| 2398 | 4.880213 | 0.4481 | +| 2500 | 5.087797 | 0.4676 | +| 2529 | 5.146816 | 0.4740 | +| 2667 | 5.427666 | 0.5127 | +| 2697 | 5.488720 | 0.5039 | +| 2812 | 5.722761 | 0.5547 | +| 2844 | 5.787886 | 0.5411 | +| 2998 | 6.101297 | 0.5710 | +| 3163 | 6.437096 | 0.5896 | +| 3199 | 6.510361 | 0.5965 | +| 3372 | 6.862440 | 0.6149 | +| 3556 | 7.236906 | 0.6572 | +| 3597 | 7.267433 | 0.6716 | +| 5000 | 7.267433 | 0.6742 | + +**2000 bytes blobs**: + +| Number of Transactions | Block Size (bytes) | Elapsed Time (s) | +|------------------------|--------------------|------------------| +| 1406 | 3.129526 | 0.2732 | +| 1581 | 3.519054 | 0.3078 | +| 1778 | 3.957552 | 0.3477 | +| 1875 | 4.173462 | 0.3764 | +| 2109 | 4.694317 | 0.4059 | +| 2371 | 5.277496 | 0.4412 | +| 2500 | 5.564634 | 0.4664 | +| 2667 | 5.936356 | 0.5006 | +| 2812 | 6.259108 | 0.5262 | +| 3163 | 6.526213 | 0.5574 | +| 3556 | 6.526213 | 0.5667 | +| 3750 | 6.526213 | 0.5509 | +| 5000 | 6.526213 | 0.5556 | + +## GoLevelDB benchmarks + +### `sendMsg` benchmarks + +#### CheckTx + +A single `checkTx` of a `sendMsg` message takes 0.0003071 **ns** to execute. And it uses 74374 gas. + +The transactions in an `8mb` block containing 31645 `sendMsg` messages take 6,45 s (6455816060 ns) to run `checkTx` on all of them. The total gas used is 1884371034 gas. + +#### DeliverTx + +A single `deliverTx` of a `sendMsg` message takes 0.0003948 **ns** to execute. And it uses 103251 gas. + +The transactions in an `8mb` block containing 31645 `sendMsg` messages take 7,50 s (7506830940 ns) to run `deliverTx` on all of them. The total gas used is 2801272121 gas. + +#### PrepareProposal + +A single `prepareProposal` of a `sendMsg` message takes 0.0003943 **ns** to execute. And it uses 101110 gas. + +An `8mb` block containing 31645 `sendMsg` messages takes 5,2 s (5242159792 ns) to execute. The total gas used 1843040790 gas. + +#### ProcessProposal + +A single `processProposal` of a `sendMsg` message takes 0.0003010 **ns** to execute. And it uses 101110 gas. + +An `8mb` block containing 31645 `sendMsg` messages takes 5,21 s (5214205041 ns) to execute. The total gas used 1843040790 gas. + +### `PFB` benchmarks + +#### CheckTx: `BenchmarkCheckTx_PFB_Multi` + +Benchmarks of `CheckTx` for a single PFB with different sizes: + +| Benchmark Name | Time (ns/op) | Gas Used | Transaction Size (Bytes) | Transaction Size (MB) | +|---------------------------------------------|--------------|----------|--------------------------|-----------------------| +| BenchmarkCheckTx_PFB_Multi/300_bytes-16 | 0.0005847 ns | 74,664 | 703 | 0.000703 MB | +| BenchmarkCheckTx_PFB_Multi/500_bytes-16 | 0.0005136 ns | 74,664 | 903 | 0.000903 MB | +| BenchmarkCheckTx_PFB_Multi/1000_bytes-16 | 0.0005754 ns | 74,664 | 1,403 | 0.001403 MB | +| BenchmarkCheckTx_PFB_Multi/5000_bytes-16 | 0.0005706 ns | 74,664 | 5,403 | 0.005403 MB | +| BenchmarkCheckTx_PFB_Multi/10000_bytes-16 | 0.0006885 ns | 74,664 | 10,403 | 0.010403 MB | +| BenchmarkCheckTx_PFB_Multi/50000_bytes-16 | 0.0006683 ns | 74,674 | 50,406 | 0.050406 MB | +| BenchmarkCheckTx_PFB_Multi/100000_bytes-16 | 0.0008378 ns | 74,674 | 100,406 | 0.100406 MB | +| BenchmarkCheckTx_PFB_Multi/200000_bytes-16 | 0.001130 ns | 74,674 | 200,406 | 0.200406 MB | +| BenchmarkCheckTx_PFB_Multi/300000_bytes-16 | 0.001164 ns | 74,674 | 300,406 | 0.300406 MB | +| BenchmarkCheckTx_PFB_Multi/400000_bytes-16 | 0.001550 ns | 74,674 | 400,406 | 0.400406 MB | +| BenchmarkCheckTx_PFB_Multi/500000_bytes-16 | 0.001829 ns | 74,674 | 500,406 | 0.500406 MB | +| BenchmarkCheckTx_PFB_Multi/1000000_bytes-16 | 0.002452 ns | 74,674 | 1,000,406 | 1.000406 MB | +| BenchmarkCheckTx_PFB_Multi/2000000_bytes-16 | 0.004647 ns | 74,674 | 2,000,406 | 2.000406 MB | +| BenchmarkCheckTx_PFB_Multi/3000000_bytes-16 | 0.006415 ns | 74,684 | 3,000,409 | 3.000409 MB | +| BenchmarkCheckTx_PFB_Multi/4000000_bytes-16 | 0.007709 ns | 74,684 | 4,000,409 | 4.000409 MB | +| BenchmarkCheckTx_PFB_Multi/5000000_bytes-16 | 0.01014 ns | 74,684 | 5,000,409 | 5.000409 MB | +| BenchmarkCheckTx_PFB_Multi/6000000_bytes-16 | 0.01153 ns | 74,684 | 6,000,409 | 6.000409 MB | + +#### DeliverTx: `BenchmarkDeliverTx_PFB_Multi` + +Benchmarks of `DeliverTx` for a single PFB with different sizes: + +| Benchmark Name | Time (ns/op) | Gas Used | Transaction Size (Bytes) | Transaction Size (MB) | +|-----------------------------------------------|--------------|------------|--------------------------|-----------------------| +| BenchmarkDeliverTx_PFB_Multi/300_bytes-16 | 0.0005010 ns | 77,682 | 703 | 0.000703 MB | +| BenchmarkDeliverTx_PFB_Multi/500_bytes-16 | 0.0004297 ns | 81,778 | 903 | 0.000903 MB | +| BenchmarkDeliverTx_PFB_Multi/1000_bytes-16 | 0.0005227 ns | 85,874 | 1,403 | 0.001403 MB | +| BenchmarkDeliverTx_PFB_Multi/5000_bytes-16 | 0.0005552 ns | 118,642 | 5,403 | 0.005403 MB | +| BenchmarkDeliverTx_PFB_Multi/10000_bytes-16 | 0.0004537 ns | 159,602 | 10,403 | 0.010403 MB | +| BenchmarkDeliverTx_PFB_Multi/50000_bytes-16 | 0.0004896 ns | 499,580 | 50,406 | 0.050406 MB | +| BenchmarkDeliverTx_PFB_Multi/100000_bytes-16 | 0.0005505 ns | 925,564 | 100,406 | 0.100406 MB | +| BenchmarkDeliverTx_PFB_Multi/200000_bytes-16 | 0.0003661 ns | 1,773,436 | 200,406 | 0.200406 MB | +| BenchmarkDeliverTx_PFB_Multi/300000_bytes-16 | 0.0004681 ns | 2,625,404 | 300,406 | 0.300406 MB | +| BenchmarkDeliverTx_PFB_Multi/400000_bytes-16 | 0.0003012 ns | 3,473,276 | 400,406 | 0.400406 MB | +| BenchmarkDeliverTx_PFB_Multi/500000_bytes-16 | 0.0003164 ns | 4,325,244 | 500,406 | 0.500406 MB | +| BenchmarkDeliverTx_PFB_Multi/1000000_bytes-16 | 0.0004873 ns | 8,572,796 | 1,000,406 | 1.000406 MB | +| BenchmarkDeliverTx_PFB_Multi/2000000_bytes-16 | 0.0004004 ns | 17,071,996 | 2,000,406 | 2.000406 MB | +| BenchmarkDeliverTx_PFB_Multi/3000000_bytes-16 | 0.0003486 ns | 25,571,206 | 3,000,409 | 3.000409 MB | +| BenchmarkDeliverTx_PFB_Multi/4000000_bytes-16 | 0.0004354 ns | 34,066,310 | 4,000,409 | 4.000409 MB | +| BenchmarkDeliverTx_PFB_Multi/5000000_bytes-16 | 0.0003734 ns | 42,565,510 | 5,000,409 | 5.000409 MB | +| BenchmarkDeliverTx_PFB_Multi/6000000_bytes-16 | 0.0003595 ns | 51,064,710 | 6,000,409 | 6.000409 MB | + +#### PrepareProposal: `BenchmarkPrepareProposal_PFB_Multi` + +The benchmarks for `PrepareProposal` for 8mb blocks containing PFBs of different sizes: + +| Benchmark Name | Block Size (MB) | Number of Transactions | Prepare Proposal Time (s) | Total Gas Used | Transaction Size (Bytes) | Transaction Size (MB) | +|------------------------------------------------------------------------|-----------------|------------------------|---------------------------|-----------------|--------------------------|-----------------------| +| BenchmarkPrepareProposal_PFB_Multi/15000_transactions_of_300_bytes-16 | 6.239 | 10,318 | 2.452 s | 988,490,895,000 | 703 | 0.000703 MB | +| BenchmarkPrepareProposal_PFB_Multi/10000_transactions_of_500_bytes-16 | 5.035 | 6,331 | 1.721 s | 439,343,930,000 | 903 | 0.000903 MB | +| BenchmarkPrepareProposal_PFB_Multi/6000_transactions_of_1000_bytes-16 | 5.809 | 4,566 | 1.063 s | 158,174,358,000 | 1,403 | 0.001403 MB | +| BenchmarkPrepareProposal_PFB_Multi/3000_transactions_of_5000_bytes-16 | 7.188 | 1,413 | 0.527 s | 39,550,179,000 | 5,403 | 0.005403 MB | +| BenchmarkPrepareProposal_PFB_Multi/1000_transactions_of_10000_bytes-16 | 7.470 | 758 | 0.210 s | 4,397,393,000 | 10,403 | 0.010403 MB | +| BenchmarkPrepareProposal_PFB_Multi/500_transactions_of_50000_bytes-16 | 7.441 | 155 | 0.125 s | 1,100,446,500 | 50,406 | 0.050406 MB | +| BenchmarkPrepareProposal_PFB_Multi/100_transactions_of_100000_bytes-16 | 7.368 | 77 | 0.061 s | 44,369,300 | 100,406 | 0.100406 MB | +| BenchmarkPrepareProposal_PFB_Multi/100_transactions_of_200000_bytes-16 | 7.260 | 38 | 0.058 s | 44,369,300 | 200,406 | 0.200406 MB | +| BenchmarkPrepareProposal_PFB_Multi/50_transactions_of_300000_bytes-16 | 7.161 | 25 | 0.042 s | 11,202,150 | 300,406 | 0.300406 MB | +| BenchmarkPrepareProposal_PFB_Multi/50_transactions_of_400000_bytes-16 | 7.254 | 19 | 0.038 s | 11,202,150 | 400,406 | 0.400406 MB | +| BenchmarkPrepareProposal_PFB_Multi/30_transactions_of_500000_bytes-16 | 7.157 | 15 | 0.031 s | 4,085,490 | 500,406 | 0.500406 MB | +| BenchmarkPrepareProposal_PFB_Multi/10_transactions_of_1000000_bytes-16 | 6.678 | 7 | 0.026 s | 483,230 | 1,000,406 | 1.000406 MB | +| BenchmarkPrepareProposal_PFB_Multi/5_transactions_of_2000000_bytes-16 | 5.723 | 3 | 0.027 s | 131,790 | 2,000,406 | 2.000406 MB | +| BenchmarkPrepareProposal_PFB_Multi/3_transactions_of_3000000_bytes-16 | 5.723 | 2 | 0.030 s | 52,716 | 3,000,409 | 3.000409 MB | +| BenchmarkPrepareProposal_PFB_Multi/3_transactions_of_4000000_bytes-16 | 3.815 | 1 | 0.026 s | 52,716 | 4,000,409 | 4.000409 MB | +| BenchmarkPrepareProposal_PFB_Multi/2_transactions_of_5000000_bytes-16 | 4.769 | 1 | 0.031 s | 26,358 | 5,000,409 | 5.000409 MB | +| BenchmarkPrepareProposal_PFB_Multi/2_transactions_of_6000000_bytes-16 | 5.722 | 1 | 0.028 s | 26,358 | 6,000,409 | 6.000409 MB | + +#### ProcessProposal: `BenchmarkProcessProposal_PFB_Multi` + +The benchmarks for `ProcessProposal` for 8mb blocks containing PFBs of different sizes: + +| Benchmark Name | Block Size (MB) | Number of Transactions | Process Proposal Time (s) | Total Gas Used | Transaction Size (Bytes) | Transaction Size (MB) | +|------------------------------------------------------------------------|-----------------|------------------------|---------------------------|-----------------|--------------------------|-----------------------| +| BenchmarkProcessProposal_PFB_Multi/15000_transactions_of_300_bytes-16 | 6.239 | 10,318 | 1.813 s | 988,490,895,000 | 703 | 0.000703 MB | +| BenchmarkProcessProposal_PFB_Multi/10000_transactions_of_500_bytes-16 | 5.035 | 6,331 | 1.120 s | 439,343,930,000 | 903 | 0.000903 MB | +| BenchmarkProcessProposal_PFB_Multi/6000_transactions_of_1000_bytes-16 | 5.809 | 4,566 | 0.829 s | 158,174,358,000 | 1,403 | 0.001403 MB | +| BenchmarkProcessProposal_PFB_Multi/3000_transactions_of_5000_bytes-16 | 7.188 | 1,413 | 0.290 s | 39,550,179,000 | 5,403 | 0.005403 MB | +| BenchmarkProcessProposal_PFB_Multi/1000_transactions_of_10000_bytes-16 | 7.470 | 758 | 0.188 s | 4,397,393,000 | 10,403 | 0.010403 MB | +| BenchmarkProcessProposal_PFB_Multi/500_transactions_of_50000_bytes-16 | 7.441 | 155 | 0.076 s | 1,100,446,500 | 50,406 | 0.050406 MB | +| BenchmarkProcessProposal_PFB_Multi/100_transactions_of_100000_bytes-16 | 7.368 | 77 | 0.056 s | 44,369,300 | 100,406 | 0.100406 MB | +| BenchmarkProcessProposal_PFB_Multi/100_transactions_of_200000_bytes-16 | 7.260 | 38 | 0.050 s | 44,369,300 | 200,406 | 0.200406 MB | +| BenchmarkProcessProposal_PFB_Multi/50_transactions_of_300000_bytes-16 | 7.161 | 25 | 0.048 s | 11,202,150 | 300,406 | 0.300406 MB | +| BenchmarkProcessProposal_PFB_Multi/50_transactions_of_400000_bytes-16 | 7.254 | 19 | 0.048 s | 11,202,150 | 400,406 | 0.400406 MB | +| BenchmarkProcessProposal_PFB_Multi/30_transactions_of_500000_bytes-16 | 7.157 | 15 | 0.043 s | 4,085,490 | 500,406 | 0.500406 MB | +| BenchmarkProcessProposal_PFB_Multi/10_transactions_of_1000000_bytes-16 | 6.678 | 7 | 0.041 s | 483,230 | 1,000,406 | 1.000406 MB | +| BenchmarkProcessProposal_PFB_Multi/5_transactions_of_2000000_bytes-16 | 5.723 | 3 | 0.053 s | 131,790 | 2,000,406 | 2.000406 MB | +| BenchmarkProcessProposal_PFB_Multi/3_transactions_of_3000000_bytes-16 | 5.723 | 2 | 0.037 s | 52,716 | 3,000,409 | 3.000409 MB | +| BenchmarkProcessProposal_PFB_Multi/3_transactions_of_4000000_bytes-16 | 3.815 | 1 | 0.071 s | 52,716 | 4,000,409 | 4.000409 MB | +| BenchmarkProcessProposal_PFB_Multi/2_transactions_of_5000000_bytes-16 | 4.769 | 1 | 0.034 s | 26,358 | 5,000,409 | 5.000409 MB | +| BenchmarkProcessProposal_PFB_Multi/2_transactions_of_6000000_bytes-16 | 5.722 | 1 | 0.062 s | 26,358 | 6,000,409 | 6.000409 MB | + +### IBC `UpdateClient` benchmarks + +#### CheckTx: `BenchmarkIBC_CheckTx_Update_Client_Multi` + +The benchmarks of executing `checkTx` on a single transaction containing an IBC `updateClient` with different numbers of required signatures: + +| Benchmark Name | Time (ns/op) | Total Gas Used | Number of Validators | Number of Verified Signatures | Transaction Size (Bytes) | Transaction Size (MB) | +|-----------------------------------------------------------------------|--------------|----------------|----------------------|-------------------------------|--------------------------|-----------------------| +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_2-16 | 1,370 | 108,670 | 2 | 1 | 1,399 | 0.001399 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_10-16 | 3,577 | 127,710 | 10 | 6 | 3,303 | 0.003303 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_25-16 | 7,432 | 163,430 | 25 | 16 | 6,875 | 0.006875 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_50-16 | 9,879 | 222,930 | 50 | 33 | 12,825 | 0.012825 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_75-16 | 12,060 | 282,480 | 75 | 50 | 18,780 | 0.018780 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_100-16 | 13,080 | 341,980 | 100 | 66 | 24,730 | 0.024730 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_125-16 | 14,390 | 401,480 | 125 | 83 | 30,680 | 0.030680 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_150-16 | 16,440 | 459,428 | 150 | 100 | 36,479 | 0.036479 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_175-16 | 17,370 | 520,500 | 175 | 116 | 42,582 | 0.042582 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_200-16 | 18,840 | 580,000 | 200 | 133 | 48,532 | 0.048532 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_225-16 | 21,760 | 637,198 | 225 | 150 | 54,256 | 0.054256 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_250-16 | 19,680 | 699,020 | 250 | 166 | 60,434 | 0.060434 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_300-16 | 22,580 | 818,020 | 300 | 200 | 72,334 | 0.072334 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_400-16 | 25,990 | 1,056,020 | 400 | 266 | 96,134 | 0.096134 MB | +| BenchmarkIBC_CheckTx_Update_Client_Multi/number_of_validators:_500-16 | 27,100 | 1,288,968 | 500 | 333 | 119,433 | 0.119433 MB | + +#### DeliverTx: `BenchmarkIBC_DeliverTx_Update_Client_Multi` + +The benchmarks of executing `deliverTx` on a single transaction containing an IBC `updateClient` with different numbers of required signatures: + +| Benchmark Name | Time (ns/op) | Gas Used | Number of Validators | Number of Verified Signatures | Transaction Size (Bytes) | Transaction Size (MB) | +|-------------------------------------------------------------------------|--------------|-----------|----------------------|-------------------------------|--------------------------|-----------------------| +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_2-16 | 1,575 | 107,592 | 2 | 1 | 1,399 | 0.001399 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_10-16 | 1,240 | 126,632 | 10 | 6 | 3,303 | 0.003303 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_25-16 | 1,142 | 162,352 | 25 | 16 | 6,875 | 0.006875 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_50-16 | 16,260 | 221,852 | 50 | 33 | 12,825 | 0.012825 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_75-16 | 13,120 | 281,402 | 75 | 50 | 18,780 | 0.018780 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_100-16 | 7,336 | 340,902 | 100 | 66 | 24,730 | 0.024730 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_125-16 | 7,668 | 399,100 | 125 | 83 | 30,554 | 0.030554 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_150-16 | 5,603 | 459,902 | 150 | 100 | 36,630 | 0.036630 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_175-16 | 11,050 | 519,422 | 175 | 116 | 42,582 | 0.042582 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_200-16 | 9,553 | 578,922 | 200 | 133 | 48,532 | 0.048532 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_225-16 | 13,170 | 638,422 | 225 | 150 | 54,482 | 0.054482 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_250-16 | 8,286 | 695,390 | 250 | 166 | 60,183 | 0.060183 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_300-16 | 15,820 | 816,942 | 300 | 200 | 72,334 | 0.072334 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_400-16 | 19,650 | 1,050,890 | 400 | 266 | 95,733 | 0.095733 MB | +| BenchmarkIBC_DeliverTx_Update_Client_Multi/number_of_validators:_500-16 | 22,900 | 1,292,942 | 500 | 333 | 119,934 | 0.119934 MB | + +#### PrepareProposal: `BenchmarkIBC_PrepareProposal_Update_Client_Multi` + +Benchmarks of an `8mb` containing the maximum number of IBC `UpdateClient` with different number of signatures: + +| Benchmark Name | Block Size (MB) | Number of Transactions | Number of Validators | Number of Verified Signatures | Prepare Proposal Time (s) | Total Gas Used | Transaction Size (Bytes) | Transaction Size (MB) | +|-------------------------------------------------------------------------------|-----------------|------------------------|----------------------|-------------------------------|---------------------------|----------------|--------------------------|-----------------------| +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_2-16 | 7.457 | 5,574 | 2 | 1 | 1.0729 | 389,819,345 | 1,469 | 0.001469 | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_10-16 | 7.464 | 2,367 | 10 | 6 | 0.5564 | 210,605,480 | 3,373 | 0.003373 | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_25-16 | 7.462 | 1,142 | 25 | 16 | 0.4047 | 142,106,425 | 6,919 | 0.006919 | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_50-16 | 7.462 | 610 | 50 | 33 | 0.2432 | 112,364,505 | 12,895 | 0.012895 | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_75-16 | 7.452 | 416 | 75 | 50 | 0.1357 | 101,405,415 | 18,850 | 0.018850 | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_100-16 | 7.453 | 316 | 100 | 66 | 0.1573 | 95,833,915 | 24,800 | 0.024800 | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_125-16 | 7.460 | 256 | 125 | 83 | 0.1653 | 92,549,255 | 30,624 | 0.030624 | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_150-16 | 7.445 | 214 | 150 | 100 | 0.1804 | 90,046,805 | 36,549 | 0.036549 | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_175-16 | 7.432 | 183 | 175 | 116 | 0.1916 | 88,172,820 | 42,652 | 0.042652 | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_200-16 | 7.452 | 161 | 200 | 133 | 0.2167 | 87,153,710 | 48,602 | 0.048602 | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_225-16 | 7.430 | 143 | 225 | 150 | 0.2065 | 85,919,620 | 54,552 | 0.054552 | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_250-16 | 7.435 | 129 | 250 | 166 | 0.2292 | 85,187,130 | 60,504 | 0.060504 | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_300-16 | 7.450 | 108 | 300 | 200 | 0.2440 | 84,173,555 | 72,404 | 0.072404 | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_400-16 | 7.426 | 81 | 400 | 266 | 0.2959 | 82,411,590 | 96,204 | 0.096204 | +| BenchmarkIBC_PrepareProposal_Update_Client_Multi/number_of_validators:_500-16 | 7.435 | 65 | 500 | 333 | 0.3309 | 81,605,510 | 120,004 | 0.120004 | + +#### ProcessProposal: `BenchmarkIBC_ProcessProposal_Update_Client_Multi` + +Benchmarks of an `8mb` containing the maximum number of IBC `UpdateClient` with different number of signatures: + +| Benchmark Name | Block Size (MB) | Number of Transactions | Number of Validators | Number of Verified Signatures | Process Proposal Time (s) | Total Gas Used | Transaction Size (Bytes) | Transaction Size (MB) | +|-------------------------------------------------------------------------------|-----------------|------------------------|----------------------|-------------------------------|---------------------------|----------------|--------------------------|-----------------------| +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_2-16 | 7.457 | 5,586 | 2 | 1 | 1.0388 | 390,490,985 | 1,466 | 0.001466 | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_10-16 | 7.464 | 2,367 | 10 | 6 | 0.4714 | 210,605,480 | 3,373 | 0.003373 | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_25-16 | 7.465 | 1,138 | 25 | 16 | 0.2771 | 141,904,565 | 6,945 | 0.006945 | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_50-16 | 7.462 | 610 | 50 | 33 | 0.1598 | 112,364,505 | 12,895 | 0.012895 | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_75-16 | 7.452 | 416 | 75 | 50 | 0.1227 | 101,405,415 | 18,850 | 0.018850 | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_100-16 | 7.453 | 316 | 100 | 66 | 0.1112 | 95,833,915 | 24,800 | 0.024800 | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_125-16 | 7.462 | 255 | 125 | 83 | 0.1012 | 92,509,080 | 30,750 | 0.030750 | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_150-16 | 7.441 | 213 | 150 | 100 | 0.1035 | 89,947,710 | 36,700 | 0.036700 | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_175-16 | 7.432 | 183 | 175 | 116 | 0.0878 | 88,172,820 | 42,652 | 0.042652 | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_200-16 | 7.467 | 162 | 200 | 133 | 0.0974 | 87,369,345 | 48,401 | 0.048401 | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_225-16 | 7.451 | 144 | 225 | 150 | 0.0789 | 86,194,935 | 54,326 | 0.054326 | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_250-16 | 7.428 | 129 | 250 | 166 | 0.0775 | 85,109,730 | 60,444 | 0.060444 | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_300-16 | 7.450 | 108 | 300 | 200 | 0.0879 | 84,173,555 | 72,404 | 0.072404 | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_400-16 | 7.426 | 81 | 400 | 266 | 0.0616 | 82,411,590 | 96,204 | 0.096204 | +| BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_500-16 | 7.435 | 65 | 500 | 333 | 0.0596 | 81,605,510 | 120,004 | 0.120004 | + \ No newline at end of file From 87c28e29cfc5f0da0e358539b09c3a52aeb16543 Mon Sep 17 00:00:00 2001 From: sweexordious Date: Thu, 17 Oct 2024 17:29:39 +0400 Subject: [PATCH 18/33] chore: move to benchmark folder --- .../benchmark_ibc_update_client_test.go | 70 +++++++++---------- .../benchmark_msg_send_test.go | 24 ++++--- app/{ => benchmarks}/benchmark_pfb_test.go | 62 +++++++++------- 3 files changed, 83 insertions(+), 73 deletions(-) rename app/{ => benchmarks}/benchmark_ibc_update_client_test.go (90%) rename app/{ => benchmarks}/benchmark_msg_send_test.go (96%) rename app/{ => benchmarks}/benchmark_pfb_test.go (88%) diff --git a/app/benchmark_ibc_update_client_test.go b/app/benchmarks/benchmark_ibc_update_client_test.go similarity index 90% rename from app/benchmark_ibc_update_client_test.go rename to app/benchmarks/benchmark_ibc_update_client_test.go index 3b66641ed1..aa20a4e07a 100644 --- a/app/benchmark_ibc_update_client_test.go +++ b/app/benchmarks/benchmark_ibc_update_client_test.go @@ -1,7 +1,11 @@ -package app_test +package benchmarks_test import ( "fmt" + "math" + "testing" + "time" + "github.com/celestiaorg/celestia-app/v3/app" "github.com/celestiaorg/celestia-app/v3/app/encoding" "github.com/celestiaorg/celestia-app/v3/pkg/appconsts" @@ -19,15 +23,10 @@ import ( "github.com/tendermint/tendermint/crypto/tmhash" crypto2 "github.com/tendermint/tendermint/proto/tendermint/crypto" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - types5 "github.com/tendermint/tendermint/proto/tendermint/types" tmprotoversion "github.com/tendermint/tendermint/proto/tendermint/version" "github.com/tendermint/tendermint/version" - "math" - "testing" - "time" "github.com/tendermint/tendermint/crypto/ed25519" - cmtversion "github.com/tendermint/tendermint/proto/tendermint/version" sm "github.com/tendermint/tendermint/state" types0 "github.com/tendermint/tendermint/types" ) @@ -54,12 +53,12 @@ func BenchmarkIBC_CheckTx_Update_Client_Multi(b *testing.B) { } for _, testCase := range testCases { b.Run(fmt.Sprintf("number of validators: %d", testCase.numberOfValidators), func(b *testing.B) { - benchmarkIBC_CheckTx_Update_Client(b, testCase.numberOfValidators) + benchmarkIBCCheckTxUpdateClient(b, testCase.numberOfValidators) }) } } -func benchmarkIBC_CheckTx_Update_Client(b *testing.B, numberOfValidators int) { +func benchmarkIBCCheckTxUpdateClient(b *testing.B, numberOfValidators int) { testApp, rawTxs := generateIBCUpdateClientTransaction(b, numberOfValidators, 1, 1) testApp.Commit() @@ -101,12 +100,12 @@ func BenchmarkIBC_DeliverTx_Update_Client_Multi(b *testing.B) { } for _, testCase := range testCases { b.Run(fmt.Sprintf("number of validators: %d", testCase.numberOfValidators), func(b *testing.B) { - benchmarkIBC_DeliverTx_Update_Client(b, testCase.numberOfValidators) + benchmarkIBCDeliverTxUpdateClient(b, testCase.numberOfValidators) }) } } -func benchmarkIBC_DeliverTx_Update_Client(b *testing.B, numberOfValidators int) { +func benchmarkIBCDeliverTxUpdateClient(b *testing.B, numberOfValidators int) { testApp, rawTxs := generateIBCUpdateClientTransaction(b, numberOfValidators, 1, 1) deliverTxRequest := types.RequestDeliverTx{ @@ -146,12 +145,12 @@ func BenchmarkIBC_PrepareProposal_Update_Client_Multi(b *testing.B) { } for _, testCase := range testCases { b.Run(fmt.Sprintf("number of validators: %d", testCase.numberOfValidators), func(b *testing.B) { - benchmarkIBC_PrepareProposal_Update_Client(b, testCase.numberOfValidators, testCase.count) + benchmarkIBCPrepareProposalUpdateClient(b, testCase.numberOfValidators, testCase.count) }) } } -func benchmarkIBC_PrepareProposal_Update_Client(b *testing.B, numberOfValidators, count int) { +func benchmarkIBCPrepareProposalUpdateClient(b *testing.B, numberOfValidators, count int) { testApp, rawTxs := generateIBCUpdateClientTransaction(b, numberOfValidators, count, 0) blockData := &tmproto.Data{ @@ -198,12 +197,12 @@ func BenchmarkIBC_ProcessProposal_Update_Client_Multi(b *testing.B) { } for _, testCase := range testCases { b.Run(fmt.Sprintf("number of validators: %d", testCase.numberOfValidators), func(b *testing.B) { - benchmarkIBC_ProcessProposal_Update_Client(b, testCase.numberOfValidators, testCase.count) + benchmarkIBCProcessProposalUpdateClient(b, testCase.numberOfValidators, testCase.count) }) } } -func benchmarkIBC_ProcessProposal_Update_Client(b *testing.B, numberOfValidators, count int) { +func benchmarkIBCProcessProposalUpdateClient(b *testing.B, numberOfValidators, count int) { testApp, rawTxs := generateIBCUpdateClientTransaction(b, numberOfValidators, count, 0) blockData := &tmproto.Data{ @@ -251,7 +250,7 @@ func benchmarkIBC_ProcessProposal_Update_Client(b *testing.B, numberOfValidators // ABCI method. func generateIBCUpdateClientTransaction(b *testing.B, numberOfValidators int, numberOfMessages int, offsetAccountSequence int) (*app.App, [][]byte) { account := "test" - testApp, kr := testutil.SetupTestAppWithGenesisValSet(app.DefaultConsensusParams(), account) + testApp, kr := testutil.SetupTestAppWithGenesisValSetAndMaxSquareSize(app.DefaultConsensusParams(), 128, account) addr := testfactory.GetAddress(kr, account) enc := encoding.MakeConfig(app.ModuleEncodingRegisters...) acc := testutil.DirectQueryAccount(testApp, addr) @@ -270,7 +269,7 @@ func generateIBCUpdateClientTransaction(b *testing.B, numberOfValidators int, nu accountSequence := testutil.DirectQueryAccount(testApp, addr).GetSequence() err = signer.SetSequence(account, accountSequence+uint64(offsetAccountSequence)) - //accountSequence := uint64(0) + require.NoError(b, err) rawTxs := make([][]byte, 0, numberOfMessages) for i := 0; i < numberOfMessages; i++ { rawTx, err := signer.CreateTx([]sdk.Msg{msgs[i]}, user.SetGasLimit(25497600000), user.SetFee(100000)) @@ -293,8 +292,8 @@ func generateUpdateClientTransaction(b *testing.B, app *app.App, signer user.Sig lastCommitHash := crypto.CRandBytes(tmhash.Size) lastBlockHash := crypto.CRandBytes(tmhash.Size) lastBlockID := makeBlockID(lastBlockHash, 1000, []byte("hash")) - header := types5.Header{ - Version: cmtversion.Consensus{Block: version.BlockProtocol, App: 1}, + header := tmproto.Header{ + Version: tmprotoversion.Consensus{Block: version.BlockProtocol, App: 1}, ChainID: state.ChainID, Height: 5, Time: w, @@ -310,7 +309,7 @@ func generateUpdateClientTransaction(b *testing.B, app *app.App, signer user.Sig LastBlockId: lastBlockID.ToProto(), } t := types0.Header{ - Version: cmtversion.Consensus{Block: version.BlockProtocol, App: 1}, + Version: tmprotoversion.Consensus{Block: version.BlockProtocol, App: 1}, ChainID: state.ChainID, Height: 5, Time: w, @@ -330,30 +329,30 @@ func generateUpdateClientTransaction(b *testing.B, app *app.App, signer user.Sig blockID := makeBlockID(header0Hash, 1000, []byte("partshash")) commit, err := makeValidCommit(5, blockID, state.Validators, privVals) require.NoError(b, err) - signatures := make([]types5.CommitSig, numberOfValidators) - validators := make([]*types5.Validator, numberOfValidators) + signatures := make([]tmproto.CommitSig, numberOfValidators) + validators := make([]*tmproto.Validator, numberOfValidators) for i := 0; i < numberOfValidators; i++ { - signatures[i] = types5.CommitSig{ - BlockIdFlag: types5.BlockIDFlag(commit.Signatures[i].BlockIDFlag), + signatures[i] = tmproto.CommitSig{ + BlockIdFlag: tmproto.BlockIDFlag(commit.Signatures[i].BlockIDFlag), ValidatorAddress: commit.Signatures[i].ValidatorAddress, Timestamp: commit.Signatures[i].Timestamp, Signature: commit.Signatures[i].Signature, } - validators[i] = &types5.Validator{ + validators[i] = &tmproto.Validator{ Address: state.Validators.Validators[i].Address, PubKey: crypto2.PublicKey{Sum: &crypto2.PublicKey_Ed25519{Ed25519: state.Validators.Validators[i].PubKey.Bytes()}}, VotingPower: state.Validators.Validators[i].VotingPower, ProposerPriority: state.Validators.Validators[i].ProposerPriority, } } - sh := types5.SignedHeader{ + sh := tmproto.SignedHeader{ Header: &header, - Commit: &types5.Commit{ + Commit: &tmproto.Commit{ Height: commit.Height, Round: commit.Round, - BlockID: types5.BlockID{ + BlockID: tmproto.BlockID{ Hash: header0Hash, - PartSetHeader: types5.PartSetHeader{ + PartSetHeader: tmproto.PartSetHeader{ Total: commit.BlockID.PartSetHeader.Total, Hash: commit.BlockID.PartSetHeader.Hash, }, @@ -367,16 +366,12 @@ func generateUpdateClientTransaction(b *testing.B, app *app.App, signer user.Sig TrustingPeriod: time.Hour * 24 * 21 * 100, // we want to always accept the upgrade UnbondingPeriod: time.Hour * 24 * 21 * 101, MaxClockDrift: math.MaxInt64 - 1, - FrozenHeight: types3.Height{ - RevisionNumber: 0, - RevisionHeight: 0, - }, + FrozenHeight: types3.Height{}, LatestHeight: types3.Height{ RevisionNumber: 0, RevisionHeight: 4, }, ProofSpecs: types2.GetSDKSpecs(), - UpgradePath: nil, AllowUpdateAfterExpiry: true, AllowUpdateAfterMisbehaviour: true, } @@ -409,9 +404,9 @@ func generateUpdateClientTransaction(b *testing.B, app *app.App, signer user.Sig clientName, &types4.Header{ SignedHeader: &sh, - ValidatorSet: &types5.ValidatorSet{ + ValidatorSet: &tmproto.ValidatorSet{ Validators: validators, - Proposer: &types5.Validator{ + Proposer: &tmproto.Validator{ Address: state.Validators.Proposer.Address, PubKey: crypto2.PublicKey{Sum: &crypto2.PublicKey_Ed25519{Ed25519: state.Validators.Proposer.PubKey.Bytes()}}, VotingPower: state.Validators.Proposer.VotingPower, @@ -423,9 +418,9 @@ func generateUpdateClientTransaction(b *testing.B, app *app.App, signer user.Sig RevisionNumber: 0, RevisionHeight: 4, }, - TrustedValidators: &types5.ValidatorSet{ + TrustedValidators: &tmproto.ValidatorSet{ Validators: validators, - Proposer: &types5.Validator{ + Proposer: &tmproto.Validator{ Address: state.Validators.Proposer.Address, PubKey: crypto2.PublicKey{Sum: &crypto2.PublicKey_Ed25519{Ed25519: state.Validators.Proposer.PubKey.Bytes()}}, VotingPower: state.Validators.Proposer.VotingPower, @@ -486,6 +481,7 @@ func makeState(nVals, height int) (sm.State, dbm.DB, map[string]types0.PrivValid return s, stateDB, privVals } + func makeValidCommit( height int64, blockID types0.BlockID, diff --git a/app/benchmark_msg_send_test.go b/app/benchmarks/benchmark_msg_send_test.go similarity index 96% rename from app/benchmark_msg_send_test.go rename to app/benchmarks/benchmark_msg_send_test.go index 8357073632..9cf6229313 100644 --- a/app/benchmark_msg_send_test.go +++ b/app/benchmarks/benchmark_msg_send_test.go @@ -1,7 +1,10 @@ -package app_test +package benchmarks_test import ( "fmt" + "testing" + "time" + "github.com/celestiaorg/celestia-app/v3/app" "github.com/celestiaorg/celestia-app/v3/app/encoding" "github.com/celestiaorg/celestia-app/v3/pkg/appconsts" @@ -15,8 +18,6 @@ import ( "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/tendermint/tendermint/proto/tendermint/version" - "testing" - "time" ) func BenchmarkCheckTx_MsgSend_1(b *testing.B) { @@ -251,16 +252,19 @@ func BenchmarkProcessProposal_MsgSend_8MB_Find_Half_Sec(b *testing.B) { timeElapsed := float64(endTime.Sub(startTime).Nanoseconds()) / 1e9 - if timeElapsed < targetTimeLowerBound { - end = end + segment/2 + switch { + case timeElapsed < targetTimeLowerBound: + end += segment / 2 segment = end - start - } else if timeElapsed > targetTimeUpperBound { - end = end / 2 + continue + case timeElapsed > targetTimeUpperBound: + end /= 2 segment = end - start - } else { + continue + default: b.ReportMetric(timeElapsed, fmt.Sprintf("elapsedTime(s)_%d", end-start)) - break } + break } } @@ -268,7 +272,7 @@ func BenchmarkProcessProposal_MsgSend_8MB_Find_Half_Sec(b *testing.B) { // of valid msg send transactions. func generateMsgSendTransactions(b *testing.B, count int) (*app.App, [][]byte) { account := "test" - testApp, kr := testutil.SetupTestAppWithGenesisValSet(app.DefaultConsensusParams(), account) + testApp, kr := testutil.SetupTestAppWithGenesisValSetAndMaxSquareSize(app.DefaultConsensusParams(), 128, account) addr := testfactory.GetAddress(kr, account) enc := encoding.MakeConfig(app.ModuleEncodingRegisters...) acc := testutil.DirectQueryAccount(testApp, addr) diff --git a/app/benchmark_pfb_test.go b/app/benchmarks/benchmark_pfb_test.go similarity index 88% rename from app/benchmark_pfb_test.go rename to app/benchmarks/benchmark_pfb_test.go index cc3d17331b..249d65c2b2 100644 --- a/app/benchmark_pfb_test.go +++ b/app/benchmarks/benchmark_pfb_test.go @@ -1,7 +1,12 @@ -package app_test +package benchmarks_test import ( "fmt" + "testing" + "time" + + "github.com/tendermint/tendermint/crypto" + "github.com/celestiaorg/celestia-app/v3/app" "github.com/celestiaorg/celestia-app/v3/app/encoding" "github.com/celestiaorg/celestia-app/v3/pkg/appconsts" @@ -14,9 +19,6 @@ import ( "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/tendermint/tendermint/proto/tendermint/version" - "math/rand" - "testing" - "time" ) func BenchmarkCheckTx_PFB_Multi(b *testing.B) { @@ -43,12 +45,12 @@ func BenchmarkCheckTx_PFB_Multi(b *testing.B) { } for _, testCase := range testCases { b.Run(fmt.Sprintf("%d bytes", testCase.size), func(b *testing.B) { - benchmarkCheckTx_PFB(b, testCase.size) + benchmarkCheckTxPFB(b, testCase.size) }) } } -func benchmarkCheckTx_PFB(b *testing.B, size int) { +func benchmarkCheckTxPFB(b *testing.B, size int) { testApp, rawTxs := generatePayForBlobTransactions(b, 1, size) testApp.Commit() @@ -90,12 +92,12 @@ func BenchmarkDeliverTx_PFB_Multi(b *testing.B) { } for _, testCase := range testCases { b.Run(fmt.Sprintf("%d bytes", testCase.size), func(b *testing.B) { - benchmarkDeliverTx_PFB(b, testCase.size) + benchmarkDeliverTxPFB(b, testCase.size) }) } } -func benchmarkDeliverTx_PFB(b *testing.B, size int) { +func benchmarkDeliverTxPFB(b *testing.B, size int) { testApp, rawTxs := generatePayForBlobTransactions(b, 1, size) blobTx, ok, err := blobtx.UnmarshalBlobTx(rawTxs[0]) @@ -139,12 +141,12 @@ func BenchmarkPrepareProposal_PFB_Multi(b *testing.B) { } for _, testCase := range testCases { b.Run(fmt.Sprintf("%d transactions of %d bytes", testCase.count, testCase.size), func(b *testing.B) { - benchmarkPrepareProposal_PFB(b, testCase.count, testCase.size) + benchmarkPrepareProposalPFB(b, testCase.count, testCase.size) }) } } -func benchmarkPrepareProposal_PFB(b *testing.B, count, size int) { +func benchmarkPrepareProposalPFB(b *testing.B, count, size int) { testApp, rawTxs := generatePayForBlobTransactions(b, count, size) blockData := &tmproto.Data{ @@ -191,12 +193,12 @@ func BenchmarkProcessProposal_PFB_Multi(b *testing.B) { } for _, testCase := range testCases { b.Run(fmt.Sprintf("%d transactions of %d bytes", testCase.count, testCase.size), func(b *testing.B) { - benchmarkProcessProposal_PFB(b, testCase.count, testCase.size) + benchmarkProcessProposalPFB(b, testCase.count, testCase.size) }) } } -func benchmarkProcessProposal_PFB(b *testing.B, count, size int) { +func benchmarkProcessProposalPFB(b *testing.B, count, size int) { testApp, rawTxs := generatePayForBlobTransactions(b, count, size) blockData := &tmproto.Data{ @@ -254,12 +256,12 @@ func BenchmarkProcessProposal_PFB_Half_Second(b *testing.B) { } for _, testCase := range testCases { b.Run(fmt.Sprintf("%d transactions of %d bytes", testCase.count, testCase.size), func(b *testing.B) { - benchmarkProcessProposal_PFB_Half_Second(b, testCase.count, testCase.size) + benchmarkProcessProposalPFBHalfSecond(b, testCase.count, testCase.size) }) } } -func benchmarkProcessProposal_PFB_Half_Second(b *testing.B, count, size int) { +func benchmarkProcessProposalPFBHalfSecond(b *testing.B, count, size int) { testApp, rawTxs := generatePayForBlobTransactions(b, count, size) targetTimeLowerBound := 0.499 @@ -302,17 +304,27 @@ func benchmarkProcessProposal_PFB_Half_Second(b *testing.B, count, size int) { timeElapsed := float64(endTime.Sub(startTime).Nanoseconds()) / 1e9 - if timeElapsed < targetTimeLowerBound { - end = end + segment/2 + switch { + case timeElapsed < targetTimeLowerBound: + end += segment / 2 segment = end - start - } else if timeElapsed > targetTimeUpperBound { - end = end / 2 + continue + case timeElapsed > targetTimeUpperBound: + end /= 2 segment = end - start - } else { - b.ReportMetric(timeElapsed, fmt.Sprintf("processProposalTime(s)_%d_%d_%f", end-start, size, calculateBlockSizeInMb(prepareProposalResponse.BlockData.Txs[start:end]))) - - break + continue + default: + b.ReportMetric( + timeElapsed, + fmt.Sprintf( + "processProposalTime(s)_%d_%d_%f", + end-start, + size, + calculateBlockSizeInMb(prepareProposalResponse.BlockData.Txs[start:end]), + ), + ) } + break } } @@ -320,7 +332,7 @@ func benchmarkProcessProposal_PFB_Half_Second(b *testing.B, count, size int) { // of valid PFB transactions. func generatePayForBlobTransactions(b *testing.B, count int, size int) (*app.App, [][]byte) { account := "test" - testApp, kr := testutil.SetupTestAppWithGenesisValSet(app.DefaultConsensusParams(), account) + testApp, kr := testutil.SetupTestAppWithGenesisValSetAndMaxSquareSize(app.DefaultConsensusParams(), 128, account) addr := testfactory.GetAddress(kr, account) enc := encoding.MakeConfig(app.ModuleEncodingRegisters...) acc := testutil.DirectQueryAccount(testApp, addr) @@ -329,9 +341,7 @@ func generatePayForBlobTransactions(b *testing.B, count int, size int) (*app.App require.NoError(b, err) rawTxs := make([][]byte, 0, count) - randomBytes := make([]byte, size) - _, err = rand.Read(randomBytes) - require.NoError(b, err) + randomBytes := crypto.CRandBytes(size) blob, err := share.NewBlob(share.RandomNamespace(), randomBytes, 1, acc.GetAddress().Bytes()) require.NoError(b, err) for i := 0; i < count; i++ { From dd3dd6b233b3ef15e512d37a6d6d2d0662490153 Mon Sep 17 00:00:00 2001 From: sweexordious Date: Thu, 17 Oct 2024 17:30:54 +0400 Subject: [PATCH 19/33] chore: revert unnecessary changes --- pkg/appconsts/initial_consts.go | 2 +- test/util/test_app.go | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/pkg/appconsts/initial_consts.go b/pkg/appconsts/initial_consts.go index 5bc8a73270..18cafc969d 100644 --- a/pkg/appconsts/initial_consts.go +++ b/pkg/appconsts/initial_consts.go @@ -11,7 +11,7 @@ import ( const ( // DefaultGovMaxSquareSize is the default value for the governance modifiable // max square size. - DefaultGovMaxSquareSize = 128 + DefaultGovMaxSquareSize = 64 // DefaultMaxBytes is the default value for the governance modifiable // maximum number of bytes allowed in a valid block. diff --git a/test/util/test_app.go b/test/util/test_app.go index f5532ebfb4..1d8db7390b 100644 --- a/test/util/test_app.go +++ b/test/util/test_app.go @@ -96,14 +96,6 @@ func NewTestApp() *app.App { emptyOpts := EmptyAppOptions{} // var anteOpt = func(bapp *baseapp.BaseApp) { bapp.SetAnteHandler(nil) } db := dbm.NewMemDB() - //path, err := os.MkdirTemp("/tmp", "test-app-db") - //if err != nil { - // panic(err) - //} - //db, err := dbm.NewGoLevelDB("db", path) - //if err != nil { - // panic(err) - //} encCfg := encoding.MakeConfig(app.ModuleEncodingRegisters...) @@ -226,7 +218,7 @@ func InitialiseTestAppWithGenesis(testApp *app.App, cparams *tmproto.ConsensusPa Block: &abci.BlockParams{ // choose some value large enough to not bottleneck the max square // size - MaxBytes: cparams.Block.MaxBytes, + MaxBytes: int64(appconsts.DefaultUpperBoundMaxBytes), MaxGas: cparams.Block.MaxGas, }, Evidence: &cparams.Evidence, From 3a5e979cb83b8836ebbb05504b6d937c984bc158 Mon Sep 17 00:00:00 2001 From: sweexordious Date: Thu, 17 Oct 2024 19:01:37 +0400 Subject: [PATCH 20/33] chore: build tags --- pkg/appconsts/global_consts.go | 9 --------- pkg/appconsts/prepare_proposal_consts.go | 12 ++++++++++++ pkg/appconsts/prepare_proposal_consts_bench.go | 15 +++++++++++++++ 3 files changed, 27 insertions(+), 9 deletions(-) create mode 100644 pkg/appconsts/prepare_proposal_consts.go create mode 100644 pkg/appconsts/prepare_proposal_consts_bench.go diff --git a/pkg/appconsts/global_consts.go b/pkg/appconsts/global_consts.go index ce6f7d71ee..1bcdb7ac6c 100644 --- a/pkg/appconsts/global_consts.go +++ b/pkg/appconsts/global_consts.go @@ -48,12 +48,3 @@ var ( func HashLength() int { return hashLength } - -// The following consts are not consensus breaking and will be applied straight after this binary is started. -const ( - // NonPFBTransactionCap is the maximum number of SDK messages, aside from PFBs, that a block can contain. - NonPFBTransactionCap = 200 - - // PFBTransactionCap is the maximum number of PFB messages a block can contain. - PFBTransactionCap = 600 -) diff --git a/pkg/appconsts/prepare_proposal_consts.go b/pkg/appconsts/prepare_proposal_consts.go new file mode 100644 index 0000000000..08e87cb9f5 --- /dev/null +++ b/pkg/appconsts/prepare_proposal_consts.go @@ -0,0 +1,12 @@ +//go:build !bench_prepare_proposal + +package appconsts + +// The following consts are not consensus breaking and will be applied straight after this binary is started. +const ( + // NonPFBTransactionCap is the maximum number of SDK messages, aside from PFBs, that a block can contain. + NonPFBTransactionCap = 200 + + // PFBTransactionCap is the maximum number of PFB messages a block can contain. + PFBTransactionCap = 600 +) diff --git a/pkg/appconsts/prepare_proposal_consts_bench.go b/pkg/appconsts/prepare_proposal_consts_bench.go new file mode 100644 index 0000000000..3caa99a80e --- /dev/null +++ b/pkg/appconsts/prepare_proposal_consts_bench.go @@ -0,0 +1,15 @@ +//go:build bench_prepare_proposal + +package appconsts + +// Note: these constants are set to these values only when running benchmarks. +// For the production values, check prepare_proposal_consts.go file. + +// The following consts are not consensus breaking and will be applied straight after this binary is started. +const ( + // NonPFBTransactionCap arbitrary high numbers for running benchmarks. + NonPFBTransactionCap = 9999999999 + + // PFBTransactionCap arbitrary high numbers for running benchmarks. + PFBTransactionCap = 9999999999 +) From ce565016e23a731f539a59a97383d9c4e32c0991 Mon Sep 17 00:00:00 2001 From: sweexordious Date: Thu, 17 Oct 2024 19:46:39 +0400 Subject: [PATCH 21/33] chore: add readme and cosmetics --- app/benchmarks/README.md | 27 +++++++++++++++++++ .../benchmark_ibc_update_client_test.go | 7 +++++ app/benchmarks/benchmark_msg_send_test.go | 12 +++++++++ app/benchmarks/benchmark_pfb_test.go | 10 +++++++ app/benchmarks/results.md | 4 +-- pkg/appconsts/prepare_proposal_consts.go | 2 ++ .../prepare_proposal_consts_bench.go | 7 +++-- test/util/test_app.go | 7 +++-- 8 files changed, 68 insertions(+), 8 deletions(-) create mode 100644 app/benchmarks/README.md diff --git a/app/benchmarks/README.md b/app/benchmarks/README.md new file mode 100644 index 0000000000..1492e070d5 --- /dev/null +++ b/app/benchmarks/README.md @@ -0,0 +1,27 @@ +# Benchmarks + +This package contains benchmarks for the ABCI methods with the following transaction types: + +- Message send +- IBC update client +- PayForBlobs + +## How to run + +To run the benchmarks, run the following in the root directory: + +```shell +go test -tags=bench_prepare_proposal -bench= app/benchmarks/benchmark_* +``` + +## Results + +The results are outlined in the [results](results.md) document. + +## Key takeaways + +We decided to softly limit the number of messages contained in a block, via introducing the `NonPFBTransactionCap` and `PFBTransactionCap`, and checking against them in prepare proposal. + +This way, the default block construction mechanism will only propose blocks that respect these limitations. And if a block that doesn't respect them reached consensus, it will still be accepted since this rule is not consensus breaking. + +As specified in [results](results.md) documents, those results were generated on 16 core 48GM RAM machine, and gave us certain thresholds. However, when we run the same experiments on the recommended validator setup, 4 cores 16GB RAM, the numbers were lower. These low numbers are what we used in the limits. diff --git a/app/benchmarks/benchmark_ibc_update_client_test.go b/app/benchmarks/benchmark_ibc_update_client_test.go index aa20a4e07a..e872e5ae29 100644 --- a/app/benchmarks/benchmark_ibc_update_client_test.go +++ b/app/benchmarks/benchmark_ibc_update_client_test.go @@ -1,7 +1,10 @@ +//go:build bench_prepare_proposal + package benchmarks_test import ( "fmt" + "github.com/tendermint/tendermint/libs/log" "math" "testing" "time" @@ -32,6 +35,7 @@ import ( ) func BenchmarkIBC_CheckTx_Update_Client_Multi(b *testing.B) { + testutil.TestAppLogger = log.NewNopLogger() testCases := []struct { numberOfValidators int }{ @@ -79,6 +83,7 @@ func benchmarkIBCCheckTxUpdateClient(b *testing.B, numberOfValidators int) { } func BenchmarkIBC_DeliverTx_Update_Client_Multi(b *testing.B) { + testutil.TestAppLogger = log.NewNopLogger() testCases := []struct { numberOfValidators int }{ @@ -124,6 +129,7 @@ func benchmarkIBCDeliverTxUpdateClient(b *testing.B, numberOfValidators int) { } func BenchmarkIBC_PrepareProposal_Update_Client_Multi(b *testing.B) { + testutil.TestAppLogger = log.NewNopLogger() testCases := []struct { count, numberOfValidators int }{ @@ -176,6 +182,7 @@ func benchmarkIBCPrepareProposalUpdateClient(b *testing.B, numberOfValidators, c } func BenchmarkIBC_ProcessProposal_Update_Client_Multi(b *testing.B) { + testutil.TestAppLogger = log.NewNopLogger() testCases := []struct { count, numberOfValidators int }{ diff --git a/app/benchmarks/benchmark_msg_send_test.go b/app/benchmarks/benchmark_msg_send_test.go index 9cf6229313..73df57f510 100644 --- a/app/benchmarks/benchmark_msg_send_test.go +++ b/app/benchmarks/benchmark_msg_send_test.go @@ -1,7 +1,10 @@ +//go:build bench_prepare_proposal + package benchmarks_test import ( "fmt" + "github.com/tendermint/tendermint/libs/log" "testing" "time" @@ -21,6 +24,7 @@ import ( ) func BenchmarkCheckTx_MsgSend_1(b *testing.B) { + testutil.TestAppLogger = log.NewNopLogger() testApp, rawTxs := generateMsgSendTransactions(b, 1) testApp.Commit() @@ -38,6 +42,7 @@ func BenchmarkCheckTx_MsgSend_1(b *testing.B) { } func BenchmarkCheckTx_MsgSend_8MB(b *testing.B) { + testutil.TestAppLogger = log.NewNopLogger() testApp, rawTxs := generateMsgSendTransactions(b, 31645) testApp.Commit() @@ -61,6 +66,7 @@ func BenchmarkCheckTx_MsgSend_8MB(b *testing.B) { } func BenchmarkDeliverTx_MsgSend_1(b *testing.B) { + testutil.TestAppLogger = log.NewNopLogger() testApp, rawTxs := generateMsgSendTransactions(b, 1) deliverTxRequest := types.RequestDeliverTx{ @@ -76,6 +82,7 @@ func BenchmarkDeliverTx_MsgSend_1(b *testing.B) { } func BenchmarkDeliverTx_MsgSend_8MB(b *testing.B) { + testutil.TestAppLogger = log.NewNopLogger() testApp, rawTxs := generateMsgSendTransactions(b, 31645) var totalGas int64 @@ -96,6 +103,7 @@ func BenchmarkDeliverTx_MsgSend_8MB(b *testing.B) { } func BenchmarkPrepareProposal_MsgSend_1(b *testing.B) { + testutil.TestAppLogger = log.NewNopLogger() testApp, rawTxs := generateMsgSendTransactions(b, 1) prepareProposalRequest := types.RequestPrepareProposal{ @@ -114,6 +122,7 @@ func BenchmarkPrepareProposal_MsgSend_1(b *testing.B) { } func BenchmarkPrepareProposal_MsgSend_8MB(b *testing.B) { + testutil.TestAppLogger = log.NewNopLogger() // a full 8mb block equals to around 31645 msg send transactions. // using 31645 to let prepare proposal choose the maximum testApp, rawTxs := generateMsgSendTransactions(b, 31645) @@ -137,6 +146,7 @@ func BenchmarkPrepareProposal_MsgSend_8MB(b *testing.B) { } func BenchmarkProcessProposal_MsgSend_1(b *testing.B) { + testutil.TestAppLogger = log.NewNopLogger() testApp, rawTxs := generateMsgSendTransactions(b, 1) blockData := &tmproto.Data{ @@ -171,6 +181,7 @@ func BenchmarkProcessProposal_MsgSend_1(b *testing.B) { } func BenchmarkProcessProposal_MsgSend_8MB(b *testing.B) { + testutil.TestAppLogger = log.NewNopLogger() // a full 8mb block equals to around 31645 msg send transactions. // using 31645 to let prepare proposal choose the maximum testApp, rawTxs := generateMsgSendTransactions(b, 31645) @@ -211,6 +222,7 @@ func BenchmarkProcessProposal_MsgSend_8MB(b *testing.B) { } func BenchmarkProcessProposal_MsgSend_8MB_Find_Half_Sec(b *testing.B) { + testutil.TestAppLogger = log.NewNopLogger() targetTimeLowerBound := 0.499 targetTimeUpperBound := 0.511 numberOfTransaction := 5500 diff --git a/app/benchmarks/benchmark_pfb_test.go b/app/benchmarks/benchmark_pfb_test.go index 249d65c2b2..beba221280 100644 --- a/app/benchmarks/benchmark_pfb_test.go +++ b/app/benchmarks/benchmark_pfb_test.go @@ -1,3 +1,5 @@ +//go:build bench_prepare_proposal + package benchmarks_test import ( @@ -6,6 +8,7 @@ import ( "time" "github.com/tendermint/tendermint/crypto" + "github.com/tendermint/tendermint/libs/log" "github.com/celestiaorg/celestia-app/v3/app" "github.com/celestiaorg/celestia-app/v3/app/encoding" @@ -22,6 +25,7 @@ import ( ) func BenchmarkCheckTx_PFB_Multi(b *testing.B) { + testutil.TestAppLogger = log.NewNopLogger() testCases := []struct { size int }{ @@ -51,6 +55,7 @@ func BenchmarkCheckTx_PFB_Multi(b *testing.B) { } func benchmarkCheckTxPFB(b *testing.B, size int) { + testutil.TestAppLogger = log.NewNopLogger() testApp, rawTxs := generatePayForBlobTransactions(b, 1, size) testApp.Commit() @@ -69,6 +74,7 @@ func benchmarkCheckTxPFB(b *testing.B, size int) { } func BenchmarkDeliverTx_PFB_Multi(b *testing.B) { + testutil.TestAppLogger = log.NewNopLogger() testCases := []struct { size int }{ @@ -98,6 +104,7 @@ func BenchmarkDeliverTx_PFB_Multi(b *testing.B) { } func benchmarkDeliverTxPFB(b *testing.B, size int) { + testutil.TestAppLogger = log.NewNopLogger() testApp, rawTxs := generatePayForBlobTransactions(b, 1, size) blobTx, ok, err := blobtx.UnmarshalBlobTx(rawTxs[0]) @@ -118,6 +125,7 @@ func benchmarkDeliverTxPFB(b *testing.B, size int) { } func BenchmarkPrepareProposal_PFB_Multi(b *testing.B) { + testutil.TestAppLogger = log.NewNopLogger() testCases := []struct { count, size int }{ @@ -170,6 +178,7 @@ func benchmarkPrepareProposalPFB(b *testing.B, count, size int) { } func BenchmarkProcessProposal_PFB_Multi(b *testing.B) { + testutil.TestAppLogger = log.NewNopLogger() testCases := []struct { count, size int }{ @@ -238,6 +247,7 @@ func benchmarkProcessProposalPFB(b *testing.B, count, size int) { } func BenchmarkProcessProposal_PFB_Half_Second(b *testing.B) { + testutil.TestAppLogger = log.NewNopLogger() testCases := []struct { count, size int }{ diff --git a/app/benchmarks/results.md b/app/benchmarks/results.md index 5ac4b13247..9562a6a340 100644 --- a/app/benchmarks/results.md +++ b/app/benchmarks/results.md @@ -3,7 +3,7 @@ This document contains the results of the benchmarks defined under `app/benchmarks`. -The benchmarks were run on a Macbook Pro M3 MAX with 48GB RAM. +The benchmarks were run on a Macbook Pro M3 MAX with 16 cores 48GB RAM. The benchmarks will be run using an in memory DB, then a local db, goleveldb. @@ -836,4 +836,4 @@ Benchmarks of an `8mb` containing the maximum number of IBC `UpdateClient` with | BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_300-16 | 7.450 | 108 | 300 | 200 | 0.0879 | 84,173,555 | 72,404 | 0.072404 | | BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_400-16 | 7.426 | 81 | 400 | 266 | 0.0616 | 82,411,590 | 96,204 | 0.096204 | | BenchmarkIBC_ProcessProposal_Update_Client_Multi/number_of_validators:_500-16 | 7.435 | 65 | 500 | 333 | 0.0596 | 81,605,510 | 120,004 | 0.120004 | - \ No newline at end of file + diff --git a/pkg/appconsts/prepare_proposal_consts.go b/pkg/appconsts/prepare_proposal_consts.go index 08e87cb9f5..877c32825e 100644 --- a/pkg/appconsts/prepare_proposal_consts.go +++ b/pkg/appconsts/prepare_proposal_consts.go @@ -3,6 +3,8 @@ package appconsts // The following consts are not consensus breaking and will be applied straight after this binary is started. +// These numbers softly constrain the processing time of blocks to 0.25sec. +// The benchmarks used to find these limits can be found in `app/benchmarks`. const ( // NonPFBTransactionCap is the maximum number of SDK messages, aside from PFBs, that a block can contain. NonPFBTransactionCap = 200 diff --git a/pkg/appconsts/prepare_proposal_consts_bench.go b/pkg/appconsts/prepare_proposal_consts_bench.go index 3caa99a80e..2ebc5e6ae1 100644 --- a/pkg/appconsts/prepare_proposal_consts_bench.go +++ b/pkg/appconsts/prepare_proposal_consts_bench.go @@ -2,14 +2,13 @@ package appconsts -// Note: these constants are set to these values only when running benchmarks. +// Note: these constants are set to these values only when running `bench_prepare_proposal` benchmarks. // For the production values, check prepare_proposal_consts.go file. -// The following consts are not consensus breaking and will be applied straight after this binary is started. const ( // NonPFBTransactionCap arbitrary high numbers for running benchmarks. - NonPFBTransactionCap = 9999999999 + NonPFBTransactionCap = 999999999999 // PFBTransactionCap arbitrary high numbers for running benchmarks. - PFBTransactionCap = 9999999999 + PFBTransactionCap = 999999999999 ) diff --git a/test/util/test_app.go b/test/util/test_app.go index 1d8db7390b..f9f40ef91c 100644 --- a/test/util/test_app.go +++ b/test/util/test_app.go @@ -44,7 +44,10 @@ import ( const ChainID = testfactory.ChainID -var GenesisTime = time.Date(2023, 1, 1, 1, 1, 1, 1, time.UTC).UTC() +var ( + GenesisTime = time.Date(2023, 1, 1, 1, 1, 1, 1, time.UTC).UTC() + TestAppLogger = log.NewTMLogger(os.Stdout) +) // Get flags every time the simulator is run func init() { @@ -100,7 +103,7 @@ func NewTestApp() *app.App { encCfg := encoding.MakeConfig(app.ModuleEncodingRegisters...) return app.New( - log.NewTMLogger(os.Stdout), db, nil, + TestAppLogger, db, nil, cast.ToUint(emptyOpts.Get(server.FlagInvCheckPeriod)), encCfg, 0, From ecaaeb6f5631d35b18fb7c81a6c294c8a4eb0349 Mon Sep 17 00:00:00 2001 From: sweexordious Date: Thu, 17 Oct 2024 20:18:51 +0400 Subject: [PATCH 22/33] chore: index out of range fix --- app/benchmarks/benchmark_msg_send_test.go | 15 +++++++++++++-- app/benchmarks/benchmark_pfb_test.go | 15 +++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/app/benchmarks/benchmark_msg_send_test.go b/app/benchmarks/benchmark_msg_send_test.go index 73df57f510..9d3db210d8 100644 --- a/app/benchmarks/benchmark_msg_send_test.go +++ b/app/benchmarks/benchmark_msg_send_test.go @@ -266,11 +266,22 @@ func BenchmarkProcessProposal_MsgSend_8MB_Find_Half_Sec(b *testing.B) { switch { case timeElapsed < targetTimeLowerBound: - end += segment / 2 + newEnd := end + segment/2 + if newEnd > len(rawTxs) { + newEnd = len(rawTxs) + } + end = newEnd segment = end - start + if segment <= 1 { + break + } continue case timeElapsed > targetTimeUpperBound: - end /= 2 + newEnd := end / 2 + if newEnd <= start { + break + } + end = newEnd segment = end - start continue default: diff --git a/app/benchmarks/benchmark_pfb_test.go b/app/benchmarks/benchmark_pfb_test.go index beba221280..13f42a570a 100644 --- a/app/benchmarks/benchmark_pfb_test.go +++ b/app/benchmarks/benchmark_pfb_test.go @@ -316,11 +316,22 @@ func benchmarkProcessProposalPFBHalfSecond(b *testing.B, count, size int) { switch { case timeElapsed < targetTimeLowerBound: - end += segment / 2 + newEnd := end + segment/2 + if newEnd > len(rawTxs) { + newEnd = len(rawTxs) + } + end = newEnd segment = end - start + if segment <= 1 { + break + } continue case timeElapsed > targetTimeUpperBound: - end /= 2 + newEnd := end / 2 + if newEnd <= start { + break + } + end = newEnd segment = end - start continue default: From af526463bb067e673810dee5f1e50bd7016c58f0 Mon Sep 17 00:00:00 2001 From: CHAMI Rachid Date: Thu, 17 Oct 2024 18:19:38 +0200 Subject: [PATCH 23/33] Update app/benchmarks/benchmark_msg_send_test.go Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- app/benchmarks/benchmark_msg_send_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/benchmarks/benchmark_msg_send_test.go b/app/benchmarks/benchmark_msg_send_test.go index 73df57f510..0e40fd4fb7 100644 --- a/app/benchmarks/benchmark_msg_send_test.go +++ b/app/benchmarks/benchmark_msg_send_test.go @@ -142,7 +142,7 @@ func BenchmarkPrepareProposal_MsgSend_8MB(b *testing.B) { require.GreaterOrEqual(b, len(resp.BlockData.Txs), 1) b.ReportMetric(float64(len(resp.BlockData.Txs)), "number_of_transactions") b.ReportMetric(calculateBlockSizeInMb(resp.BlockData.Txs), "block_size(mb)") - b.ReportMetric(float64(calculateTotalGasUsed(testApp, prepareProposalRequest.BlockData.Txs)), "total_gas_used") + b.ReportMetric(float64(calculateTotalGasUsed(testApp, resp.BlockData.Txs)), "total_gas_used") } func BenchmarkProcessProposal_MsgSend_1(b *testing.B) { From 0fb7b39a3bf6ec05e0a3e73bfef035addf232413 Mon Sep 17 00:00:00 2001 From: sweexordious Date: Thu, 17 Oct 2024 20:20:53 +0400 Subject: [PATCH 24/33] chore: check error when simulating transaction --- app/benchmarks/benchmark_msg_send_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/benchmarks/benchmark_msg_send_test.go b/app/benchmarks/benchmark_msg_send_test.go index 7204f63fe6..35dfd30785 100644 --- a/app/benchmarks/benchmark_msg_send_test.go +++ b/app/benchmarks/benchmark_msg_send_test.go @@ -333,7 +333,8 @@ func calculateBlockSizeInMb(txs [][]byte) float64 { func calculateTotalGasUsed(testApp *app.App, txs [][]byte) uint64 { var totalGas uint64 for _, tx := range txs { - gasInfo, _, _ := testApp.Simulate(tx) + gasInfo, _, err := testApp.Simulate(tx) + require.NoError(b, err) totalGas += gasInfo.GasUsed } return totalGas From 12fea1c64fe41cbc45f9b36efe143fb77367e211 Mon Sep 17 00:00:00 2001 From: sweexordious Date: Thu, 17 Oct 2024 20:22:37 +0400 Subject: [PATCH 25/33] chore: set number of iterations --- app/benchmarks/benchmark_pfb_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/benchmarks/benchmark_pfb_test.go b/app/benchmarks/benchmark_pfb_test.go index 13f42a570a..68df6efad8 100644 --- a/app/benchmarks/benchmark_pfb_test.go +++ b/app/benchmarks/benchmark_pfb_test.go @@ -280,7 +280,14 @@ func benchmarkProcessProposalPFBHalfSecond(b *testing.B, count, size int) { start := 0 end := count segment := end - start + maxIterations := 100000 + iterations := 0 for { + iterations++ + if iterations >= maxIterations { + b.Errorf("Maximum iterations reached without achieving target processing time") + break + } if segment == 1 { break } From 2bd31ca562458528d836c9a4dc6b3d3497cbc347 Mon Sep 17 00:00:00 2001 From: sweexordious Date: Thu, 17 Oct 2024 20:24:10 +0400 Subject: [PATCH 26/33] chore: use bench_abci_methods instead --- app/benchmarks/README.md | 2 +- app/benchmarks/benchmark_ibc_update_client_test.go | 2 +- app/benchmarks/benchmark_msg_send_test.go | 2 +- app/benchmarks/benchmark_pfb_test.go | 2 +- pkg/appconsts/prepare_proposal_consts.go | 2 +- pkg/appconsts/prepare_proposal_consts_bench.go | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/benchmarks/README.md b/app/benchmarks/README.md index 1492e070d5..9ee513f9f7 100644 --- a/app/benchmarks/README.md +++ b/app/benchmarks/README.md @@ -11,7 +11,7 @@ This package contains benchmarks for the ABCI methods with the following transac To run the benchmarks, run the following in the root directory: ```shell -go test -tags=bench_prepare_proposal -bench= app/benchmarks/benchmark_* +go test -tags=bench_abci_methods -bench= app/benchmarks/benchmark_* ``` ## Results diff --git a/app/benchmarks/benchmark_ibc_update_client_test.go b/app/benchmarks/benchmark_ibc_update_client_test.go index e872e5ae29..0719b530d8 100644 --- a/app/benchmarks/benchmark_ibc_update_client_test.go +++ b/app/benchmarks/benchmark_ibc_update_client_test.go @@ -1,4 +1,4 @@ -//go:build bench_prepare_proposal +//go:build bench_abci_methods package benchmarks_test diff --git a/app/benchmarks/benchmark_msg_send_test.go b/app/benchmarks/benchmark_msg_send_test.go index 35dfd30785..b72e7f2a1d 100644 --- a/app/benchmarks/benchmark_msg_send_test.go +++ b/app/benchmarks/benchmark_msg_send_test.go @@ -1,4 +1,4 @@ -//go:build bench_prepare_proposal +//go:build bench_abci_methods package benchmarks_test diff --git a/app/benchmarks/benchmark_pfb_test.go b/app/benchmarks/benchmark_pfb_test.go index 68df6efad8..b100c04b17 100644 --- a/app/benchmarks/benchmark_pfb_test.go +++ b/app/benchmarks/benchmark_pfb_test.go @@ -1,4 +1,4 @@ -//go:build bench_prepare_proposal +//go:build bench_abci_methods package benchmarks_test diff --git a/pkg/appconsts/prepare_proposal_consts.go b/pkg/appconsts/prepare_proposal_consts.go index 877c32825e..dbffb4c1dd 100644 --- a/pkg/appconsts/prepare_proposal_consts.go +++ b/pkg/appconsts/prepare_proposal_consts.go @@ -1,4 +1,4 @@ -//go:build !bench_prepare_proposal +//go:build !bench_abci_methods package appconsts diff --git a/pkg/appconsts/prepare_proposal_consts_bench.go b/pkg/appconsts/prepare_proposal_consts_bench.go index 2ebc5e6ae1..886406fe65 100644 --- a/pkg/appconsts/prepare_proposal_consts_bench.go +++ b/pkg/appconsts/prepare_proposal_consts_bench.go @@ -1,8 +1,8 @@ -//go:build bench_prepare_proposal +//go:build bench_abci_methods package appconsts -// Note: these constants are set to these values only when running `bench_prepare_proposal` benchmarks. +// Note: these constants are set to these values only when running `bench_abci_methods` benchmarks. // For the production values, check prepare_proposal_consts.go file. const ( From ad76ff2fb96efa744a10fb223f7d265adc06128a Mon Sep 17 00:00:00 2001 From: sweexordious Date: Thu, 17 Oct 2024 20:35:12 +0400 Subject: [PATCH 27/33] chore: remove unnecessarily duplicate no op logger set --- app/benchmarks/benchmark_ibc_update_client_test.go | 5 ----- app/benchmarks/benchmark_msg_send_test.go | 13 +------------ app/benchmarks/benchmark_pfb_test.go | 11 ++++------- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/app/benchmarks/benchmark_ibc_update_client_test.go b/app/benchmarks/benchmark_ibc_update_client_test.go index 0719b530d8..1b7afbe8cd 100644 --- a/app/benchmarks/benchmark_ibc_update_client_test.go +++ b/app/benchmarks/benchmark_ibc_update_client_test.go @@ -4,7 +4,6 @@ package benchmarks_test import ( "fmt" - "github.com/tendermint/tendermint/libs/log" "math" "testing" "time" @@ -35,7 +34,6 @@ import ( ) func BenchmarkIBC_CheckTx_Update_Client_Multi(b *testing.B) { - testutil.TestAppLogger = log.NewNopLogger() testCases := []struct { numberOfValidators int }{ @@ -83,7 +81,6 @@ func benchmarkIBCCheckTxUpdateClient(b *testing.B, numberOfValidators int) { } func BenchmarkIBC_DeliverTx_Update_Client_Multi(b *testing.B) { - testutil.TestAppLogger = log.NewNopLogger() testCases := []struct { numberOfValidators int }{ @@ -129,7 +126,6 @@ func benchmarkIBCDeliverTxUpdateClient(b *testing.B, numberOfValidators int) { } func BenchmarkIBC_PrepareProposal_Update_Client_Multi(b *testing.B) { - testutil.TestAppLogger = log.NewNopLogger() testCases := []struct { count, numberOfValidators int }{ @@ -182,7 +178,6 @@ func benchmarkIBCPrepareProposalUpdateClient(b *testing.B, numberOfValidators, c } func BenchmarkIBC_ProcessProposal_Update_Client_Multi(b *testing.B) { - testutil.TestAppLogger = log.NewNopLogger() testCases := []struct { count, numberOfValidators int }{ diff --git a/app/benchmarks/benchmark_msg_send_test.go b/app/benchmarks/benchmark_msg_send_test.go index b72e7f2a1d..6cbc30d6d2 100644 --- a/app/benchmarks/benchmark_msg_send_test.go +++ b/app/benchmarks/benchmark_msg_send_test.go @@ -4,7 +4,6 @@ package benchmarks_test import ( "fmt" - "github.com/tendermint/tendermint/libs/log" "testing" "time" @@ -24,7 +23,6 @@ import ( ) func BenchmarkCheckTx_MsgSend_1(b *testing.B) { - testutil.TestAppLogger = log.NewNopLogger() testApp, rawTxs := generateMsgSendTransactions(b, 1) testApp.Commit() @@ -42,7 +40,6 @@ func BenchmarkCheckTx_MsgSend_1(b *testing.B) { } func BenchmarkCheckTx_MsgSend_8MB(b *testing.B) { - testutil.TestAppLogger = log.NewNopLogger() testApp, rawTxs := generateMsgSendTransactions(b, 31645) testApp.Commit() @@ -66,7 +63,6 @@ func BenchmarkCheckTx_MsgSend_8MB(b *testing.B) { } func BenchmarkDeliverTx_MsgSend_1(b *testing.B) { - testutil.TestAppLogger = log.NewNopLogger() testApp, rawTxs := generateMsgSendTransactions(b, 1) deliverTxRequest := types.RequestDeliverTx{ @@ -82,7 +78,6 @@ func BenchmarkDeliverTx_MsgSend_1(b *testing.B) { } func BenchmarkDeliverTx_MsgSend_8MB(b *testing.B) { - testutil.TestAppLogger = log.NewNopLogger() testApp, rawTxs := generateMsgSendTransactions(b, 31645) var totalGas int64 @@ -103,7 +98,6 @@ func BenchmarkDeliverTx_MsgSend_8MB(b *testing.B) { } func BenchmarkPrepareProposal_MsgSend_1(b *testing.B) { - testutil.TestAppLogger = log.NewNopLogger() testApp, rawTxs := generateMsgSendTransactions(b, 1) prepareProposalRequest := types.RequestPrepareProposal{ @@ -122,7 +116,6 @@ func BenchmarkPrepareProposal_MsgSend_1(b *testing.B) { } func BenchmarkPrepareProposal_MsgSend_8MB(b *testing.B) { - testutil.TestAppLogger = log.NewNopLogger() // a full 8mb block equals to around 31645 msg send transactions. // using 31645 to let prepare proposal choose the maximum testApp, rawTxs := generateMsgSendTransactions(b, 31645) @@ -146,7 +139,6 @@ func BenchmarkPrepareProposal_MsgSend_8MB(b *testing.B) { } func BenchmarkProcessProposal_MsgSend_1(b *testing.B) { - testutil.TestAppLogger = log.NewNopLogger() testApp, rawTxs := generateMsgSendTransactions(b, 1) blockData := &tmproto.Data{ @@ -181,7 +173,6 @@ func BenchmarkProcessProposal_MsgSend_1(b *testing.B) { } func BenchmarkProcessProposal_MsgSend_8MB(b *testing.B) { - testutil.TestAppLogger = log.NewNopLogger() // a full 8mb block equals to around 31645 msg send transactions. // using 31645 to let prepare proposal choose the maximum testApp, rawTxs := generateMsgSendTransactions(b, 31645) @@ -222,7 +213,6 @@ func BenchmarkProcessProposal_MsgSend_8MB(b *testing.B) { } func BenchmarkProcessProposal_MsgSend_8MB_Find_Half_Sec(b *testing.B) { - testutil.TestAppLogger = log.NewNopLogger() targetTimeLowerBound := 0.499 targetTimeUpperBound := 0.511 numberOfTransaction := 5500 @@ -333,8 +323,7 @@ func calculateBlockSizeInMb(txs [][]byte) float64 { func calculateTotalGasUsed(testApp *app.App, txs [][]byte) uint64 { var totalGas uint64 for _, tx := range txs { - gasInfo, _, err := testApp.Simulate(tx) - require.NoError(b, err) + gasInfo, _, _ := testApp.Simulate(tx) totalGas += gasInfo.GasUsed } return totalGas diff --git a/app/benchmarks/benchmark_pfb_test.go b/app/benchmarks/benchmark_pfb_test.go index b100c04b17..02137d884a 100644 --- a/app/benchmarks/benchmark_pfb_test.go +++ b/app/benchmarks/benchmark_pfb_test.go @@ -24,8 +24,11 @@ import ( "github.com/tendermint/tendermint/proto/tendermint/version" ) -func BenchmarkCheckTx_PFB_Multi(b *testing.B) { +func init() { testutil.TestAppLogger = log.NewNopLogger() +} + +func BenchmarkCheckTx_PFB_Multi(b *testing.B) { testCases := []struct { size int }{ @@ -55,7 +58,6 @@ func BenchmarkCheckTx_PFB_Multi(b *testing.B) { } func benchmarkCheckTxPFB(b *testing.B, size int) { - testutil.TestAppLogger = log.NewNopLogger() testApp, rawTxs := generatePayForBlobTransactions(b, 1, size) testApp.Commit() @@ -74,7 +76,6 @@ func benchmarkCheckTxPFB(b *testing.B, size int) { } func BenchmarkDeliverTx_PFB_Multi(b *testing.B) { - testutil.TestAppLogger = log.NewNopLogger() testCases := []struct { size int }{ @@ -104,7 +105,6 @@ func BenchmarkDeliverTx_PFB_Multi(b *testing.B) { } func benchmarkDeliverTxPFB(b *testing.B, size int) { - testutil.TestAppLogger = log.NewNopLogger() testApp, rawTxs := generatePayForBlobTransactions(b, 1, size) blobTx, ok, err := blobtx.UnmarshalBlobTx(rawTxs[0]) @@ -125,7 +125,6 @@ func benchmarkDeliverTxPFB(b *testing.B, size int) { } func BenchmarkPrepareProposal_PFB_Multi(b *testing.B) { - testutil.TestAppLogger = log.NewNopLogger() testCases := []struct { count, size int }{ @@ -178,7 +177,6 @@ func benchmarkPrepareProposalPFB(b *testing.B, count, size int) { } func BenchmarkProcessProposal_PFB_Multi(b *testing.B) { - testutil.TestAppLogger = log.NewNopLogger() testCases := []struct { count, size int }{ @@ -247,7 +245,6 @@ func benchmarkProcessProposalPFB(b *testing.B, count, size int) { } func BenchmarkProcessProposal_PFB_Half_Second(b *testing.B) { - testutil.TestAppLogger = log.NewNopLogger() testCases := []struct { count, size int }{ From 3a4e835feaa54616d08c84c6b0d46ccdbe497d7b Mon Sep 17 00:00:00 2001 From: sweexordious Date: Thu, 17 Oct 2024 20:35:35 +0400 Subject: [PATCH 28/33] chore: remove print statement --- app/benchmarks/benchmark_ibc_update_client_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/app/benchmarks/benchmark_ibc_update_client_test.go b/app/benchmarks/benchmark_ibc_update_client_test.go index 1b7afbe8cd..6f8790b872 100644 --- a/app/benchmarks/benchmark_ibc_update_client_test.go +++ b/app/benchmarks/benchmark_ibc_update_client_test.go @@ -327,7 +327,6 @@ func generateUpdateClientTransaction(b *testing.B, app *app.App, signer user.Sig LastBlockID: lastBlockID, } header0Hash := t.Hash() - fmt.Println(header0Hash.Bytes()) blockID := makeBlockID(header0Hash, 1000, []byte("partshash")) commit, err := makeValidCommit(5, blockID, state.Validators, privVals) require.NoError(b, err) From a76ffccdff60b4dfd707e894482bed87e448a6a4 Mon Sep 17 00:00:00 2001 From: CHAMI Rachid Date: Fri, 18 Oct 2024 08:11:36 +0200 Subject: [PATCH 29/33] Update app/benchmarks/README.md Co-authored-by: Rootul P --- app/benchmarks/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/benchmarks/README.md b/app/benchmarks/README.md index 9ee513f9f7..b53fba34c0 100644 --- a/app/benchmarks/README.md +++ b/app/benchmarks/README.md @@ -24,4 +24,4 @@ We decided to softly limit the number of messages contained in a block, via intr This way, the default block construction mechanism will only propose blocks that respect these limitations. And if a block that doesn't respect them reached consensus, it will still be accepted since this rule is not consensus breaking. -As specified in [results](results.md) documents, those results were generated on 16 core 48GM RAM machine, and gave us certain thresholds. However, when we run the same experiments on the recommended validator setup, 4 cores 16GB RAM, the numbers were lower. These low numbers are what we used in the limits. +As specified in [results](results.md) document, those results were generated on 16 core 48GB RAM machine, and gave us certain thresholds. However, when we run the same experiments on the recommended validator setup, 4 cores 16GB RAM, the numbers were lower. These low numbers are what we used in the limits. From 9a45f4c962f541bd4ac5e3b5ea376644bd2766a8 Mon Sep 17 00:00:00 2001 From: sweexordious Date: Fri, 18 Oct 2024 10:20:39 +0400 Subject: [PATCH 30/33] chore: rename to numberOfTransactions and blobSize --- .../benchmark_ibc_update_client_test.go | 68 +++---- app/benchmarks/benchmark_pfb_test.go | 190 +++++++++--------- 2 files changed, 129 insertions(+), 129 deletions(-) diff --git a/app/benchmarks/benchmark_ibc_update_client_test.go b/app/benchmarks/benchmark_ibc_update_client_test.go index 6f8790b872..126ed04628 100644 --- a/app/benchmarks/benchmark_ibc_update_client_test.go +++ b/app/benchmarks/benchmark_ibc_update_client_test.go @@ -127,27 +127,27 @@ func benchmarkIBCDeliverTxUpdateClient(b *testing.B, numberOfValidators int) { func BenchmarkIBC_PrepareProposal_Update_Client_Multi(b *testing.B) { testCases := []struct { - count, numberOfValidators int + numberOfTransactions, numberOfValidators int }{ - {count: 6_000, numberOfValidators: 2}, - {count: 3_000, numberOfValidators: 10}, - {count: 2_000, numberOfValidators: 25}, - {count: 1_000, numberOfValidators: 50}, - {count: 500, numberOfValidators: 75}, - {count: 500, numberOfValidators: 100}, - {count: 500, numberOfValidators: 125}, - {count: 500, numberOfValidators: 150}, - {count: 500, numberOfValidators: 175}, - {count: 500, numberOfValidators: 200}, - {count: 500, numberOfValidators: 225}, - {count: 500, numberOfValidators: 250}, - {count: 500, numberOfValidators: 300}, - {count: 500, numberOfValidators: 400}, - {count: 500, numberOfValidators: 500}, + {numberOfTransactions: 6_000, numberOfValidators: 2}, + {numberOfTransactions: 3_000, numberOfValidators: 10}, + {numberOfTransactions: 2_000, numberOfValidators: 25}, + {numberOfTransactions: 1_000, numberOfValidators: 50}, + {numberOfTransactions: 500, numberOfValidators: 75}, + {numberOfTransactions: 500, numberOfValidators: 100}, + {numberOfTransactions: 500, numberOfValidators: 125}, + {numberOfTransactions: 500, numberOfValidators: 150}, + {numberOfTransactions: 500, numberOfValidators: 175}, + {numberOfTransactions: 500, numberOfValidators: 200}, + {numberOfTransactions: 500, numberOfValidators: 225}, + {numberOfTransactions: 500, numberOfValidators: 250}, + {numberOfTransactions: 500, numberOfValidators: 300}, + {numberOfTransactions: 500, numberOfValidators: 400}, + {numberOfTransactions: 500, numberOfValidators: 500}, } for _, testCase := range testCases { b.Run(fmt.Sprintf("number of validators: %d", testCase.numberOfValidators), func(b *testing.B) { - benchmarkIBCPrepareProposalUpdateClient(b, testCase.numberOfValidators, testCase.count) + benchmarkIBCPrepareProposalUpdateClient(b, testCase.numberOfValidators, testCase.numberOfTransactions) }) } } @@ -179,27 +179,27 @@ func benchmarkIBCPrepareProposalUpdateClient(b *testing.B, numberOfValidators, c func BenchmarkIBC_ProcessProposal_Update_Client_Multi(b *testing.B) { testCases := []struct { - count, numberOfValidators int + numberOfTransactions, numberOfValidators int }{ - {count: 6_000, numberOfValidators: 2}, - {count: 3_000, numberOfValidators: 10}, - {count: 2_000, numberOfValidators: 25}, - {count: 1_000, numberOfValidators: 50}, - {count: 500, numberOfValidators: 75}, - {count: 500, numberOfValidators: 100}, - {count: 500, numberOfValidators: 125}, - {count: 500, numberOfValidators: 150}, - {count: 500, numberOfValidators: 175}, - {count: 500, numberOfValidators: 200}, - {count: 500, numberOfValidators: 225}, - {count: 500, numberOfValidators: 250}, - {count: 500, numberOfValidators: 300}, - {count: 500, numberOfValidators: 400}, - {count: 500, numberOfValidators: 500}, + {numberOfTransactions: 6_000, numberOfValidators: 2}, + {numberOfTransactions: 3_000, numberOfValidators: 10}, + {numberOfTransactions: 2_000, numberOfValidators: 25}, + {numberOfTransactions: 1_000, numberOfValidators: 50}, + {numberOfTransactions: 500, numberOfValidators: 75}, + {numberOfTransactions: 500, numberOfValidators: 100}, + {numberOfTransactions: 500, numberOfValidators: 125}, + {numberOfTransactions: 500, numberOfValidators: 150}, + {numberOfTransactions: 500, numberOfValidators: 175}, + {numberOfTransactions: 500, numberOfValidators: 200}, + {numberOfTransactions: 500, numberOfValidators: 225}, + {numberOfTransactions: 500, numberOfValidators: 250}, + {numberOfTransactions: 500, numberOfValidators: 300}, + {numberOfTransactions: 500, numberOfValidators: 400}, + {numberOfTransactions: 500, numberOfValidators: 500}, } for _, testCase := range testCases { b.Run(fmt.Sprintf("number of validators: %d", testCase.numberOfValidators), func(b *testing.B) { - benchmarkIBCProcessProposalUpdateClient(b, testCase.numberOfValidators, testCase.count) + benchmarkIBCProcessProposalUpdateClient(b, testCase.numberOfValidators, testCase.numberOfTransactions) }) } } diff --git a/app/benchmarks/benchmark_pfb_test.go b/app/benchmarks/benchmark_pfb_test.go index 02137d884a..274dbf8353 100644 --- a/app/benchmarks/benchmark_pfb_test.go +++ b/app/benchmarks/benchmark_pfb_test.go @@ -30,29 +30,29 @@ func init() { func BenchmarkCheckTx_PFB_Multi(b *testing.B) { testCases := []struct { - size int + blobSize int }{ - {size: 300}, - {size: 500}, - {size: 1000}, - {size: 5000}, - {size: 10_000}, - {size: 50_000}, - {size: 100_000}, - {size: 200_000}, - {size: 300_000}, - {size: 400_000}, - {size: 500_000}, - {size: 1_000_000}, - {size: 2_000_000}, - {size: 3_000_000}, - {size: 4_000_000}, - {size: 5_000_000}, - {size: 6_000_000}, + {blobSize: 300}, + {blobSize: 500}, + {blobSize: 1000}, + {blobSize: 5000}, + {blobSize: 10_000}, + {blobSize: 50_000}, + {blobSize: 100_000}, + {blobSize: 200_000}, + {blobSize: 300_000}, + {blobSize: 400_000}, + {blobSize: 500_000}, + {blobSize: 1_000_000}, + {blobSize: 2_000_000}, + {blobSize: 3_000_000}, + {blobSize: 4_000_000}, + {blobSize: 5_000_000}, + {blobSize: 6_000_000}, } for _, testCase := range testCases { - b.Run(fmt.Sprintf("%d bytes", testCase.size), func(b *testing.B) { - benchmarkCheckTxPFB(b, testCase.size) + b.Run(fmt.Sprintf("%d bytes", testCase.blobSize), func(b *testing.B) { + benchmarkCheckTxPFB(b, testCase.blobSize) }) } } @@ -77,29 +77,29 @@ func benchmarkCheckTxPFB(b *testing.B, size int) { func BenchmarkDeliverTx_PFB_Multi(b *testing.B) { testCases := []struct { - size int + blobSize int }{ - {size: 300}, - {size: 500}, - {size: 1000}, - {size: 5000}, - {size: 10_000}, - {size: 50_000}, - {size: 100_000}, - {size: 200_000}, - {size: 300_000}, - {size: 400_000}, - {size: 500_000}, - {size: 1_000_000}, - {size: 2_000_000}, - {size: 3_000_000}, - {size: 4_000_000}, - {size: 5_000_000}, - {size: 6_000_000}, + {blobSize: 300}, + {blobSize: 500}, + {blobSize: 1000}, + {blobSize: 5000}, + {blobSize: 10_000}, + {blobSize: 50_000}, + {blobSize: 100_000}, + {blobSize: 200_000}, + {blobSize: 300_000}, + {blobSize: 400_000}, + {blobSize: 500_000}, + {blobSize: 1_000_000}, + {blobSize: 2_000_000}, + {blobSize: 3_000_000}, + {blobSize: 4_000_000}, + {blobSize: 5_000_000}, + {blobSize: 6_000_000}, } for _, testCase := range testCases { - b.Run(fmt.Sprintf("%d bytes", testCase.size), func(b *testing.B) { - benchmarkDeliverTxPFB(b, testCase.size) + b.Run(fmt.Sprintf("%d bytes", testCase.blobSize), func(b *testing.B) { + benchmarkDeliverTxPFB(b, testCase.blobSize) }) } } @@ -126,29 +126,29 @@ func benchmarkDeliverTxPFB(b *testing.B, size int) { func BenchmarkPrepareProposal_PFB_Multi(b *testing.B) { testCases := []struct { - count, size int + numberOfTransactions, blobSize int }{ - {count: 15_000, size: 300}, - {count: 10_000, size: 500}, - {count: 6_000, size: 1000}, - {count: 3_000, size: 5000}, - {count: 1_000, size: 10_000}, - {count: 500, size: 50_000}, - {count: 100, size: 100_000}, - {count: 100, size: 200_000}, - {count: 50, size: 300_000}, - {count: 50, size: 400_000}, - {count: 30, size: 500_000}, - {count: 10, size: 1_000_000}, - {count: 5, size: 2_000_000}, - {count: 3, size: 3_000_000}, - {count: 3, size: 4_000_000}, - {count: 2, size: 5_000_000}, - {count: 2, size: 6_000_000}, + {numberOfTransactions: 15_000, blobSize: 300}, + {numberOfTransactions: 10_000, blobSize: 500}, + {numberOfTransactions: 6_000, blobSize: 1000}, + {numberOfTransactions: 3_000, blobSize: 5000}, + {numberOfTransactions: 1_000, blobSize: 10_000}, + {numberOfTransactions: 500, blobSize: 50_000}, + {numberOfTransactions: 100, blobSize: 100_000}, + {numberOfTransactions: 100, blobSize: 200_000}, + {numberOfTransactions: 50, blobSize: 300_000}, + {numberOfTransactions: 50, blobSize: 400_000}, + {numberOfTransactions: 30, blobSize: 500_000}, + {numberOfTransactions: 10, blobSize: 1_000_000}, + {numberOfTransactions: 5, blobSize: 2_000_000}, + {numberOfTransactions: 3, blobSize: 3_000_000}, + {numberOfTransactions: 3, blobSize: 4_000_000}, + {numberOfTransactions: 2, blobSize: 5_000_000}, + {numberOfTransactions: 2, blobSize: 6_000_000}, } for _, testCase := range testCases { - b.Run(fmt.Sprintf("%d transactions of %d bytes", testCase.count, testCase.size), func(b *testing.B) { - benchmarkPrepareProposalPFB(b, testCase.count, testCase.size) + b.Run(fmt.Sprintf("%d transactions of %d bytes", testCase.numberOfTransactions, testCase.blobSize), func(b *testing.B) { + benchmarkPrepareProposalPFB(b, testCase.numberOfTransactions, testCase.blobSize) }) } } @@ -178,29 +178,29 @@ func benchmarkPrepareProposalPFB(b *testing.B, count, size int) { func BenchmarkProcessProposal_PFB_Multi(b *testing.B) { testCases := []struct { - count, size int + numberOfTransactions, blobSize int }{ - {count: 15_000, size: 300}, - {count: 10_000, size: 500}, - {count: 6_000, size: 1000}, - {count: 3_000, size: 5000}, - {count: 1_000, size: 10_000}, - {count: 500, size: 50_000}, - {count: 100, size: 100_000}, - {count: 100, size: 200_000}, - {count: 50, size: 300_000}, - {count: 50, size: 400_000}, - {count: 30, size: 500_000}, - {count: 10, size: 1_000_000}, - {count: 5, size: 2_000_000}, - {count: 3, size: 3_000_000}, - {count: 3, size: 4_000_000}, - {count: 2, size: 5_000_000}, - {count: 2, size: 6_000_000}, + {numberOfTransactions: 15_000, blobSize: 300}, + {numberOfTransactions: 10_000, blobSize: 500}, + {numberOfTransactions: 6_000, blobSize: 1000}, + {numberOfTransactions: 3_000, blobSize: 5000}, + {numberOfTransactions: 1_000, blobSize: 10_000}, + {numberOfTransactions: 500, blobSize: 50_000}, + {numberOfTransactions: 100, blobSize: 100_000}, + {numberOfTransactions: 100, blobSize: 200_000}, + {numberOfTransactions: 50, blobSize: 300_000}, + {numberOfTransactions: 50, blobSize: 400_000}, + {numberOfTransactions: 30, blobSize: 500_000}, + {numberOfTransactions: 10, blobSize: 1_000_000}, + {numberOfTransactions: 5, blobSize: 2_000_000}, + {numberOfTransactions: 3, blobSize: 3_000_000}, + {numberOfTransactions: 3, blobSize: 4_000_000}, + {numberOfTransactions: 2, blobSize: 5_000_000}, + {numberOfTransactions: 2, blobSize: 6_000_000}, } for _, testCase := range testCases { - b.Run(fmt.Sprintf("%d transactions of %d bytes", testCase.count, testCase.size), func(b *testing.B) { - benchmarkProcessProposalPFB(b, testCase.count, testCase.size) + b.Run(fmt.Sprintf("%d transactions of %d bytes", testCase.numberOfTransactions, testCase.blobSize), func(b *testing.B) { + benchmarkProcessProposalPFB(b, testCase.numberOfTransactions, testCase.blobSize) }) } } @@ -246,24 +246,24 @@ func benchmarkProcessProposalPFB(b *testing.B, count, size int) { func BenchmarkProcessProposal_PFB_Half_Second(b *testing.B) { testCases := []struct { - count, size int + numberOfTransactions, blobSize int }{ - {count: 11_000, size: 50}, - {count: 11_000, size: 100}, - {count: 11_000, size: 200}, - {count: 11_000, size: 300}, - {count: 11_000, size: 400}, - {count: 7000, size: 500}, - {count: 7000, size: 600}, - {count: 5000, size: 1_000}, - {count: 5000, size: 1200}, - {count: 5000, size: 1500}, - {count: 5000, size: 1800}, - {count: 5000, size: 2000}, + {numberOfTransactions: 11_000, blobSize: 50}, + {numberOfTransactions: 11_000, blobSize: 100}, + {numberOfTransactions: 11_000, blobSize: 200}, + {numberOfTransactions: 11_000, blobSize: 300}, + {numberOfTransactions: 11_000, blobSize: 400}, + {numberOfTransactions: 7000, blobSize: 500}, + {numberOfTransactions: 7000, blobSize: 600}, + {numberOfTransactions: 5000, blobSize: 1_000}, + {numberOfTransactions: 5000, blobSize: 1200}, + {numberOfTransactions: 5000, blobSize: 1500}, + {numberOfTransactions: 5000, blobSize: 1800}, + {numberOfTransactions: 5000, blobSize: 2000}, } for _, testCase := range testCases { - b.Run(fmt.Sprintf("%d transactions of %d bytes", testCase.count, testCase.size), func(b *testing.B) { - benchmarkProcessProposalPFBHalfSecond(b, testCase.count, testCase.size) + b.Run(fmt.Sprintf("%d transactions of %d bytes", testCase.numberOfTransactions, testCase.blobSize), func(b *testing.B) { + benchmarkProcessProposalPFBHalfSecond(b, testCase.numberOfTransactions, testCase.blobSize) }) } } From 16080734e0f24595b418b9e07d53d1bb391fcfc3 Mon Sep 17 00:00:00 2001 From: CHAMI Rachid Date: Fri, 18 Oct 2024 08:22:30 +0200 Subject: [PATCH 31/33] Update app/benchmarks/benchmark_ibc_update_client_test.go Co-authored-by: Rootul P --- app/benchmarks/benchmark_ibc_update_client_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/benchmarks/benchmark_ibc_update_client_test.go b/app/benchmarks/benchmark_ibc_update_client_test.go index 126ed04628..873c560a95 100644 --- a/app/benchmarks/benchmark_ibc_update_client_test.go +++ b/app/benchmarks/benchmark_ibc_update_client_test.go @@ -245,7 +245,7 @@ func benchmarkIBCProcessProposalUpdateClient(b *testing.B, numberOfValidators, c b.ReportMetric(float64(2*numberOfValidators/3), "number_of_verified_signatures") } -// generatePayForBlobTransactions creates a test app then generates an IBC +// generateIBCUpdateClientTransaction creates a test app then generates an IBC // update client transaction with the specified number of validators. // Note: the number of the verified signatures is: 2 * numberOfValidators / 3 // the offset is just a hack for transactions to be processed by the needed From 1ed45b1a9e5afa361bba9988306f5dfe674b7738 Mon Sep 17 00:00:00 2001 From: sweexordious Date: Fri, 18 Oct 2024 10:25:09 +0400 Subject: [PATCH 32/33] chore: use megabyte const --- app/benchmarks/benchmark_msg_send_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/benchmarks/benchmark_msg_send_test.go b/app/benchmarks/benchmark_msg_send_test.go index 6cbc30d6d2..91557e39f9 100644 --- a/app/benchmarks/benchmark_msg_send_test.go +++ b/app/benchmarks/benchmark_msg_send_test.go @@ -307,6 +307,9 @@ func generateMsgSendTransactions(b *testing.B, count int) (*app.App, [][]byte) { return testApp, rawTxs } +// megabyte the number of bytes in a megabyte +const megabyte = 1048576 + // calculateBlockSizeInMb returns the block size in mb given a set // of raw transactions. func calculateBlockSizeInMb(txs [][]byte) float64 { @@ -314,7 +317,7 @@ func calculateBlockSizeInMb(txs [][]byte) float64 { for _, tx := range txs { numberOfBytes += len(tx) } - mb := float64(numberOfBytes) / 1048576 + mb := float64(numberOfBytes) / megabyte return mb } From c6c6c8164dbbf66a600785a2255d00ecc3fd66b8 Mon Sep 17 00:00:00 2001 From: sweexordious Date: Sat, 19 Oct 2024 00:30:01 +0400 Subject: [PATCH 33/33] chore: rename --- app/benchmarks/README.md | 2 +- pkg/appconsts/prepare_proposal_consts.go | 11 ++++++----- pkg/appconsts/prepare_proposal_consts_bench.go | 8 ++++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/benchmarks/README.md b/app/benchmarks/README.md index b53fba34c0..f7f720741b 100644 --- a/app/benchmarks/README.md +++ b/app/benchmarks/README.md @@ -20,7 +20,7 @@ The results are outlined in the [results](results.md) document. ## Key takeaways -We decided to softly limit the number of messages contained in a block, via introducing the `NonPFBTransactionCap` and `PFBTransactionCap`, and checking against them in prepare proposal. +We decided to softly limit the number of messages contained in a block, via introducing the `MaxPFBMessages` and `MaxNonPFBMessages`, and checking against them in prepare proposal. This way, the default block construction mechanism will only propose blocks that respect these limitations. And if a block that doesn't respect them reached consensus, it will still be accepted since this rule is not consensus breaking. diff --git a/pkg/appconsts/prepare_proposal_consts.go b/pkg/appconsts/prepare_proposal_consts.go index dbffb4c1dd..c933aabd68 100644 --- a/pkg/appconsts/prepare_proposal_consts.go +++ b/pkg/appconsts/prepare_proposal_consts.go @@ -2,13 +2,14 @@ package appconsts -// The following consts are not consensus breaking and will be applied straight after this binary is started. +// The following consts are not consensus breaking and will be applied straight +// after this binary is started. // These numbers softly constrain the processing time of blocks to 0.25sec. // The benchmarks used to find these limits can be found in `app/benchmarks`. const ( - // NonPFBTransactionCap is the maximum number of SDK messages, aside from PFBs, that a block can contain. - NonPFBTransactionCap = 200 + // MaxPFBMessages is the maximum number of SDK messages, aside from PFBs, that a block can contain. + MaxPFBMessages = 200 - // PFBTransactionCap is the maximum number of PFB messages a block can contain. - PFBTransactionCap = 600 + // MaxNonPFBMessages is the maximum number of PFB messages a block can contain. + MaxNonPFBMessages = 600 ) diff --git a/pkg/appconsts/prepare_proposal_consts_bench.go b/pkg/appconsts/prepare_proposal_consts_bench.go index 886406fe65..cc8141f791 100644 --- a/pkg/appconsts/prepare_proposal_consts_bench.go +++ b/pkg/appconsts/prepare_proposal_consts_bench.go @@ -6,9 +6,9 @@ package appconsts // For the production values, check prepare_proposal_consts.go file. const ( - // NonPFBTransactionCap arbitrary high numbers for running benchmarks. - NonPFBTransactionCap = 999999999999 + // MaxPFBMessages arbitrary high numbers for running benchmarks. + MaxPFBMessages = 999999999999 - // PFBTransactionCap arbitrary high numbers for running benchmarks. - PFBTransactionCap = 999999999999 + // MaxNonPFBMessages arbitrary high numbers for running benchmarks. + MaxNonPFBMessages = 999999999999 )