From 5836038af69a5e74bfe86a66da33ca625f2febd8 Mon Sep 17 00:00:00 2001 From: AnkushinDaniil Date: Fri, 20 Sep 2024 16:11:31 +0300 Subject: [PATCH] Remove benchmark --- core/block.go | 2 +- core/receipt.go | 2 +- core/receipt_pkg_test.go | 32 -------------------------------- 3 files changed, 2 insertions(+), 34 deletions(-) delete mode 100644 core/receipt_pkg_test.go diff --git a/core/block.go b/core/block.go index c3cdd6f9b3..b11fa2a36e 100644 --- a/core/block.go +++ b/core/block.go @@ -185,7 +185,7 @@ func Post0132Hash(b *Block, stateDiff *StateDiff) (*felt.Felt, *BlockCommitments eCommitment, eErr = eventCommitmentPoseidon(b.Receipts) }) wg.Go(func() { - rCommitment, rErr = ReceiptCommitment(b.Receipts) + rCommitment, rErr = receiptCommitment(b.Receipts) }) wg.Go(func() { diff --git a/core/receipt.go b/core/receipt.go index fb70e51231..9de2ad9104 100644 --- a/core/receipt.go +++ b/core/receipt.go @@ -63,7 +63,7 @@ func messagesSentHash(messages []*L2ToL1Message) *felt.Felt { return crypto.PoseidonArray(chain...) } -func ReceiptCommitment(receipts []*TransactionReceipt) (*felt.Felt, error) { +func receiptCommitment(receipts []*TransactionReceipt) (*felt.Felt, error) { var commitment *felt.Felt return commitment, trie.RunOnTempTriePoseidon(commitmentTrieHeight, func(trie *trie.Trie) error { numWorkers := min(runtime.GOMAXPROCS(0), len(receipts)) diff --git a/core/receipt_pkg_test.go b/core/receipt_pkg_test.go deleted file mode 100644 index 77b54fb9c3..0000000000 --- a/core/receipt_pkg_test.go +++ /dev/null @@ -1,32 +0,0 @@ -package core_test - -import ( - "context" - "slices" - "testing" - - "github.com/NethermindEth/juno/clients/feeder" - "github.com/NethermindEth/juno/core" - adaptfeeder "github.com/NethermindEth/juno/starknetdata/feeder" - "github.com/NethermindEth/juno/utils" - "github.com/stretchr/testify/require" -) - -func getReceipts(b *testing.B, blockNum uint64) []*core.TransactionReceipt { - b.Helper() - client := feeder.NewClient(utils.Sepolia.FeederURL) - gw := adaptfeeder.New(client) - block, err := gw.BlockByNumber(context.Background(), blockNum) - require.NoError(b, err) - - return slices.Repeat(block.Receipts, 100) -} - -func BenchmarkReceiptCommitment(b *testing.B) { - receipts := getReceipts(b, 35748) - b.ResetTimer() - for i := 0; i < b.N; i++ { - _, err := core.ReceiptCommitment(receipts) - require.NoError(b, err) - } -}