Skip to content

Commit 5553967

Browse files
committed
Address review comments
Signed-off-by: Senthilnathan <cendhu@gmail.com>
1 parent bbff75e commit 5553967

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

service/sidecar/mapping_test.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"github.com/hyperledger/fabric-x-committer/utils"
2121
)
2222

23-
func BenchmarkMapBlock(b *testing.B) {
23+
func BenchmarkMapOneBlock(b *testing.B) {
2424
flogging.ActivateSpec("fatal")
2525
txs := workload.GenerateTransactions(b, nil, b.N)
2626
block := workload.MapToOrdererBlock(1, txs)
@@ -31,9 +31,12 @@ func BenchmarkMapBlock(b *testing.B) {
3131
b.StopTimer()
3232
require.NoError(b, err, "This can never occur unless there is a bug in the relay.")
3333
require.NotNil(b, mappedBlock)
34-
flogging.Init(flogging.Config{LogSpec: "fatal"})
34+
}
35+
36+
func BenchmarkMapBlockSize(b *testing.B) {
37+
flogging.ActivateSpec("fatal")
3538
for _, blockSize := range []int{100, 1000, 5000, 10000} {
36-
b.Run(fmt.Sprintf("txs=%d", blockSize), func(b *testing.B) {
39+
b.Run(fmt.Sprintf("blockSize=%d", blockSize), func(b *testing.B) {
3740
// Generate b.N total TXs so each iteration processes a unique block,
3841
// avoiding cache/locality effects from reusing the same block.
3942
// Pad to ensure at least one full block.
@@ -62,7 +65,7 @@ func BenchmarkMapBlock(b *testing.B) {
6265
}
6366
blockIdx++
6467
}
65-
b.ReportMetric(float64(b.N*blockSize)/b.Elapsed().Seconds(), "tx/s")
68+
b.ReportMetric(float64(b.N)/b.Elapsed().Seconds(), "tx/s")
6669
})
6770
}
6871
}

utils/serialization/envelope_wrapper_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ func FuzzUnwrapEnvelopeLiteNoPanic(f *testing.F) {
163163
f.Add([]byte("not a protobuf"))
164164
f.Add([]byte{0x0a, 0x00})
165165

166-
f.Fuzz(func(_ *testing.T, data []byte) {
167-
_, _ = serialization.UnwrapEnvelopeLite(data) // checking for panics only
166+
f.Fuzz(func(t *testing.T, data []byte) {
167+
assertLiteMatchesOriginal(t, data)
168168
})
169169
}
170170

@@ -198,6 +198,7 @@ func BenchmarkUnwrapEnvelope(b *testing.B) {
198198
b.Fatal(err)
199199
}
200200
}
201+
b.ReportMetric(float64(b.N)/b.Elapsed().Seconds(), "tx/s")
201202
}
202203

203204
func BenchmarkUnwrapEnvelopeLite(b *testing.B) {
@@ -209,6 +210,7 @@ func BenchmarkUnwrapEnvelopeLite(b *testing.B) {
209210
b.Fatal(err)
210211
}
211212
}
213+
b.ReportMetric(float64(b.N)/b.Elapsed().Seconds(), "tx/s")
212214
}
213215

214216
// loadgenEnvelopes generates realistic serialized envelopes using the load

0 commit comments

Comments
 (0)