Skip to content

Commit d3e9aa3

Browse files
sync: coreth PR #1371: remove customlogs package (#1887)
Signed-off-by: Jonathan Oppenheimer <[email protected]>
1 parent d0c3738 commit d3e9aa3

File tree

3 files changed

+17
-25
lines changed

3 files changed

+17
-25
lines changed

core/blockchain.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ import (
5959
"github.com/ava-labs/subnet-evm/core/state/snapshot"
6060
"github.com/ava-labs/subnet-evm/internal/version"
6161
"github.com/ava-labs/subnet-evm/params"
62-
"github.com/ava-labs/subnet-evm/plugin/evm/customlogs"
6362
"github.com/ava-labs/subnet-evm/plugin/evm/customrawdb"
6463
"github.com/ava-labs/subnet-evm/plugin/evm/customtypes"
6564
"github.com/ava-labs/subnet-evm/triedb/firewood"
@@ -640,7 +639,10 @@ func (bc *BlockChain) startAcceptor() {
640639
bc.acceptorTipLock.Unlock()
641640

642641
// Update accepted feeds
643-
flattenedLogs := customlogs.FlattenLogs(logs)
642+
var flattenedLogs []*types.Log
643+
for _, txLogs := range logs {
644+
flattenedLogs = append(flattenedLogs, txLogs...)
645+
}
644646
bc.chainAcceptedFeed.Send(ChainEvent{Block: next, Hash: next.Hash(), Logs: flattenedLogs})
645647
if len(flattenedLogs) > 0 {
646648
bc.logsAcceptedFeed.Send(flattenedLogs)
@@ -1516,7 +1518,11 @@ func (bc *BlockChain) collectUnflattenedLogs(b *types.Block, removed bool) [][]*
15161518
// the processing of a block. These logs are later announced as deleted or reborn.
15171519
func (bc *BlockChain) collectLogs(b *types.Block, removed bool) []*types.Log {
15181520
unflattenedLogs := bc.collectUnflattenedLogs(b, removed)
1519-
return customlogs.FlattenLogs(unflattenedLogs)
1521+
var logs []*types.Log
1522+
for _, txLogs := range unflattenedLogs {
1523+
logs = append(logs, txLogs...)
1524+
}
1525+
return logs
15201526
}
15211527

15221528
// reorg takes two blocks, an old chain and a new chain and will reconstruct the

eth/filters/filter.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import (
3636
"github.com/ava-labs/libevm/common"
3737
"github.com/ava-labs/libevm/core/bloombits"
3838
"github.com/ava-labs/libevm/core/types"
39-
"github.com/ava-labs/subnet-evm/plugin/evm/customlogs"
4039
"github.com/ava-labs/subnet-evm/rpc"
4140
)
4241

@@ -343,8 +342,10 @@ func (f *Filter) checkMatches(ctx context.Context, header *types.Header) ([]*typ
343342
return nil, err
344343
}
345344

346-
unfiltered := customlogs.FlattenLogs(logsList)
347-
logs := filterLogs(unfiltered, nil, nil, f.addresses, f.topics)
345+
var logs []*types.Log
346+
for _, txLogs := range logsList {
347+
logs = append(logs, filterLogs(txLogs, nil, nil, f.addresses, f.topics)...)
348+
}
348349
if len(logs) == 0 {
349350
return nil, nil
350351
}
@@ -357,11 +358,11 @@ func (f *Filter) checkMatches(ctx context.Context, header *types.Header) ([]*typ
357358
if err != nil {
358359
return nil, err
359360
}
360-
unfiltered = unfiltered[:0]
361-
for _, receipt := range receipts {
362-
unfiltered = append(unfiltered, receipt.Logs...)
361+
// Logs don't have TxHash, so get the full logs from receipts instead
362+
logs = logs[:0]
363+
for _, r := range receipts {
364+
logs = append(logs, filterLogs(r.Logs, nil, nil, f.addresses, f.topics)...)
363365
}
364-
logs = filterLogs(unfiltered, nil, nil, f.addresses, f.topics)
365366

366367
return logs, nil
367368
}

plugin/evm/customlogs/log_ext.go

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)