@@ -21,21 +21,21 @@ import (
2121
2222 "github.com/ethereum/go-ethereum/common"
2323 "github.com/ethereum/go-ethereum/params"
24- "github.com/ipfs/go-cid"
25- "github.com/ipfs/go-ipfs-blockstore"
26- "github.com/ipfs/go-ipfs-ds-help"
27-
28- ind "github.com/ethereum/go-ethereum/statediff/indexer"
24+ "github.com/ethereum/go-ethereum/statediff/indexer"
2925 "github.com/ethereum/go-ethereum/statediff/indexer/mocks"
30- eth "github.com/ethereum/go-ethereum/statediff/indexer/models"
26+ "github.com/ethereum/go-ethereum/statediff/indexer/models"
3127 "github.com/ethereum/go-ethereum/statediff/indexer/postgres"
3228 "github.com/ethereum/go-ethereum/statediff/indexer/shared"
29+
30+ "github.com/ipfs/go-cid"
31+ blockstore "github.com/ipfs/go-ipfs-blockstore"
32+ dshelp "github.com/ipfs/go-ipfs-ds-help"
3333)
3434
3535var (
3636 db * postgres.DB
3737 err error
38- indexer * ind .StateDiffIndexer
38+ ind * indexer .StateDiffIndexer
3939 ipfsPgGet = `SELECT data FROM public.blocks
4040 WHERE key = $1`
4141)
@@ -51,9 +51,9 @@ func setup(t *testing.T) {
5151 if err != nil {
5252 t .Fatal (err )
5353 }
54- indexer = ind .NewStateDiffIndexer (params .MainnetChainConfig , db )
55- var tx * ind .BlockTx
56- tx , err = indexer .PushBlock (
54+ ind = indexer .NewStateDiffIndexer (params .MainnetChainConfig , db )
55+ var tx * indexer .BlockTx
56+ tx , err = ind .PushBlock (
5757 mocks .MockBlock ,
5858 mocks .MockReceipts ,
5959 mocks .MockBlock .Difficulty ())
@@ -62,7 +62,7 @@ func setup(t *testing.T) {
6262 }
6363 defer tx .Close ()
6464 for _ , node := range mocks .StateDiffs {
65- err = indexer .PushStateNode (tx , node )
65+ err = ind .PushStateNode (tx , node )
6666 if err != nil {
6767 t .Fatal (err )
6868 }
@@ -72,7 +72,7 @@ func setup(t *testing.T) {
7272}
7373
7474func tearDown (t * testing.T ) {
75- ind .TearDownDB (t , db )
75+ indexer .TearDownDB (t , db )
7676}
7777
7878func TestPublishAndIndexer (t * testing.T ) {
@@ -195,7 +195,7 @@ func TestPublishAndIndexer(t *testing.T) {
195195 setup (t )
196196 defer tearDown (t )
197197 // check that state nodes were properly indexed and published
198- stateNodes := make ([]eth .StateNodeModel , 0 )
198+ stateNodes := make ([]models .StateNodeModel , 0 )
199199 pgStr := `SELECT state_cids.id, state_cids.cid, state_cids.state_leaf_key, state_cids.node_type, state_cids.state_path, state_cids.header_id
200200 FROM eth.state_cids INNER JOIN eth.header_cids ON (state_cids.header_id = header_cids.id)
201201 WHERE header_cids.block_number = $1`
@@ -217,7 +217,7 @@ func TestPublishAndIndexer(t *testing.T) {
217217 t .Fatal (err )
218218 }
219219 pgStr = `SELECT * from eth.state_accounts WHERE state_id = $1`
220- var account eth .StateAccountModel
220+ var account models .StateAccountModel
221221 err = db .Get (& account , pgStr , stateNode .ID )
222222 if err != nil {
223223 t .Fatal (err )
@@ -227,7 +227,7 @@ func TestPublishAndIndexer(t *testing.T) {
227227 shared .ExpectEqual (t , stateNode .StateKey , common .BytesToHash (mocks .ContractLeafKey ).Hex ())
228228 shared .ExpectEqual (t , stateNode .Path , []byte {'\x06' })
229229 shared .ExpectEqual (t , data , mocks .ContractLeafNode )
230- shared .ExpectEqual (t , account , eth .StateAccountModel {
230+ shared .ExpectEqual (t , account , models .StateAccountModel {
231231 ID : account .ID ,
232232 StateID : stateNode .ID ,
233233 Balance : "0" ,
@@ -241,7 +241,7 @@ func TestPublishAndIndexer(t *testing.T) {
241241 shared .ExpectEqual (t , stateNode .StateKey , common .BytesToHash (mocks .AccountLeafKey ).Hex ())
242242 shared .ExpectEqual (t , stateNode .Path , []byte {'\x0c' })
243243 shared .ExpectEqual (t , data , mocks .AccountLeafNode )
244- shared .ExpectEqual (t , account , eth .StateAccountModel {
244+ shared .ExpectEqual (t , account , models .StateAccountModel {
245245 ID : account .ID ,
246246 StateID : stateNode .ID ,
247247 Balance : "1000" ,
@@ -251,14 +251,13 @@ func TestPublishAndIndexer(t *testing.T) {
251251 })
252252 }
253253 }
254- pgStr = `SELECT * from eth.state_accounts WHERE state_id = $1`
255254 })
256255
257256 t .Run ("Publish and index storage IPLDs in a single tx" , func (t * testing.T ) {
258257 setup (t )
259258 defer tearDown (t )
260259 // check that storage nodes were properly indexed
261- storageNodes := make ([]eth .StorageNodeWithStateKeyModel , 0 )
260+ storageNodes := make ([]models .StorageNodeWithStateKeyModel , 0 )
262261 pgStr := `SELECT storage_cids.cid, state_cids.state_leaf_key, storage_cids.storage_leaf_key, storage_cids.node_type, storage_cids.storage_path
263262 FROM eth.storage_cids, eth.state_cids, eth.header_cids
264263 WHERE storage_cids.state_id = state_cids.id
@@ -269,7 +268,7 @@ func TestPublishAndIndexer(t *testing.T) {
269268 t .Fatal (err )
270269 }
271270 shared .ExpectEqual (t , len (storageNodes ), 1 )
272- shared .ExpectEqual (t , storageNodes [0 ], eth .StorageNodeWithStateKeyModel {
271+ shared .ExpectEqual (t , storageNodes [0 ], models .StorageNodeWithStateKeyModel {
273272 CID : mocks .StorageCID .String (),
274273 NodeType : 2 ,
275274 StorageKey : common .BytesToHash (mocks .StorageLeafKey ).Hex (),
0 commit comments