From 3497b0a1e71147947f512979d8b0ce1f7cf96ee1 Mon Sep 17 00:00:00 2001 From: Arthur Abeilice Date: Mon, 25 Nov 2024 13:43:15 +0700 Subject: [PATCH] chore: chunked logs update to check better the function --- zk/l1infotree/updater_internal_test.go | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/zk/l1infotree/updater_internal_test.go b/zk/l1infotree/updater_internal_test.go index ec1e358b533..290319c9949 100644 --- a/zk/l1infotree/updater_internal_test.go +++ b/zk/l1infotree/updater_internal_test.go @@ -37,17 +37,33 @@ func GetDbTx() (tx kv.RwTx, cleanup func()) { } func TestUpdater_chunkLogs(t *testing.T) { - logs := []types.Log{ { Address: common.Address{}, - Topics: []common.Hash{}, - Data: []byte{}, + Topics: []common.Hash{common.HexToHash("0x01")}, + Data: []byte{0x01}, + }, + { + Address: common.Address{}, + Topics: []common.Hash{common.HexToHash("0x02")}, + Data: []byte{0x02}, + }, + { + Address: common.Address{}, + Topics: []common.Hash{common.HexToHash("0x03")}, + Data: []byte{0x03}, + }, + { + Address: common.Address{}, + Topics: []common.Hash{common.HexToHash("0x04")}, + Data: []byte{0x04}, }, } - chunkedLogs := chunkLogs(logs, 1) - assert.Len(t, chunkedLogs, 1) + chunkedLogs := chunkLogs(logs, 2) + assert.Len(t, chunkedLogs, 2) + assert.Len(t, chunkedLogs[0], 2) + assert.Len(t, chunkedLogs[1], 2) } func TestUpdater_initialiseL1InfoTree(t *testing.T) {