From ca7f7d7f88ac53b1bb6ef877a4e9f5e72d6f92da Mon Sep 17 00:00:00 2001 From: Arijit Das Date: Thu, 26 Aug 2021 22:42:46 +0530 Subject: [PATCH] Self review --- statediff/indexer/indexer.go | 2 +- statediff/indexer/ipfs/ipld/eth_header_test.go | 3 +-- statediff/indexer/ipfs/ipld/eth_log_trie.go | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/statediff/indexer/indexer.go b/statediff/indexer/indexer.go index fd116183e221..eaf3a92d15f9 100644 --- a/statediff/indexer/indexer.go +++ b/statediff/indexer/indexer.go @@ -319,10 +319,10 @@ func (sdi *StateDiffIndexer) processReceiptsAndTxs(tx *sqlx.Tx, args processArgs // Indexing // extract topic and contract data from the receipt for indexing - topicSet := make([]string, 4) mappedContracts := make(map[string]bool) // use map to avoid duplicate addresses logDataSet := make([]*models.LogsModel, len(receipt.Logs)) for idx, l := range receipt.Logs { + topicSet := make([]string, 4) for ti, topic := range l.Topics { topicSet[ti] = topic.Hex() } diff --git a/statediff/indexer/ipfs/ipld/eth_header_test.go b/statediff/indexer/ipfs/ipld/eth_header_test.go index ebbab21297b1..d1ed13d37572 100644 --- a/statediff/indexer/ipfs/ipld/eth_header_test.go +++ b/statediff/indexer/ipfs/ipld/eth_header_test.go @@ -9,11 +9,10 @@ import ( "strconv" "testing" + "github.com/ethereum/go-ethereum/core/types" block "github.com/ipfs/go-block-format" node "github.com/ipfs/go-ipld-format" "github.com/multiformats/go-multihash" - - "github.com/ethereum/go-ethereum/core/types" ) func TestBlockBodyRlpParsing(t *testing.T) { diff --git a/statediff/indexer/ipfs/ipld/eth_log_trie.go b/statediff/indexer/ipfs/ipld/eth_log_trie.go index c6910a0e55e9..2e36f0a68cd7 100644 --- a/statediff/indexer/ipfs/ipld/eth_log_trie.go +++ b/statediff/indexer/ipfs/ipld/eth_log_trie.go @@ -19,7 +19,7 @@ type EthLogTrie struct { OUTPUT */ -// DecodeEthLogTrie returns an EthRctTrie object from its cid and rawdata. +// DecodeEthLogTrie returns an EthLogTrie object from its cid and rawdata. func DecodeEthLogTrie(c cid.Cid, b []byte) (*EthLogTrie, error) { tn, err := decodeTrieNode(c, b, decodeEthLogTrieLeaf) if err != nil { @@ -28,7 +28,7 @@ func DecodeEthLogTrie(c cid.Cid, b []byte) (*EthLogTrie, error) { return &EthLogTrie{TrieNode: tn}, nil } -// decodeEthLogTrieLeaf parses a eth-rct-trie leaf +// decodeEthLogTrieLeaf parses a eth-log-trie leaf // from decoded RLP elements func decodeEthLogTrieLeaf(i []interface{}) ([]interface{}, error) { l := new(types.Log) @@ -76,12 +76,12 @@ func (t *EthLogTrie) Loggable() map[string]interface{} { } } -// rctTrie wraps a localTrie for use on the receipt trie. +// logTrie wraps a localTrie for use on the receipt trie. type logTrie struct { *localTrie } -// newRctTrie initializes and returns a rctTrie. +// newLogTrie initializes and returns a logTrie. func newLogTrie() *logTrie { return &logTrie{ localTrie: newLocalTrie(),