From 236340ba8bb7025875bd494c9722f0ed92242e63 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Wed, 10 Jul 2024 17:40:28 +0800 Subject: [PATCH] update deps use exported ipld encoder use plugeth-statediff cleardb --- go.mod | 11 +++++++++-- go.sum | 16 ++++++++-------- pkg/eth/test_helpers/test_data.go | 2 +- pkg/shared/test_helpers.go | 26 ++------------------------ 4 files changed, 20 insertions(+), 35 deletions(-) diff --git a/go.mod b/go.mod index dbdca838..65e86173 100644 --- a/go.mod +++ b/go.mod @@ -4,10 +4,10 @@ go 1.21 require ( github.com/cerc-io/eth-ipfs-state-validator/v5 v5.2.0-alpha - github.com/cerc-io/eth-iterator-utils v0.2.0 + github.com/cerc-io/eth-iterator-utils v0.3.1 github.com/cerc-io/ipfs-ethdb/v5 v5.1.0-alpha github.com/cerc-io/ipld-eth-statedb v0.1.0 - github.com/cerc-io/plugeth-statediff v0.2.1 + github.com/cerc-io/plugeth-statediff v0.3.1 github.com/ethereum/go-ethereum v1.13.14 github.com/google/uuid v1.6.0 github.com/graph-gophers/graphql-go v1.3.0 @@ -294,3 +294,10 @@ require ( lukechampine.com/blake3 v1.2.2 // indirect rsc.io/tmplfunc v0.0.3 // indirect ) + +replace ( + github.com/cerc-io/ipld-eth-statedb => github.com/cerc-io/ipld-eth-statedb v0.1.1-0.20240711085948-7bb5bbc6aa38 + github.com/cerc-io/plugeth-statediff => github.com/cerc-io/plugeth-statediff v0.3.2-0.20240711085659-6fe622e4bf33 +) + +// replace github.com/cerc-io/plugeth-statediff => git.vdb.to/cerc-io/plugeth-statediff v0.3.2-0.20240710110326-c8ce26de6de5 diff --git a/go.sum b/go.sum index 3920e897..c7e7cbc8 100644 --- a/go.sum +++ b/go.sum @@ -81,16 +81,16 @@ github.com/ceramicnetwork/go-dag-jose v0.1.0 h1:yJ/HVlfKpnD3LdYP03AHyTvbm3BpPiz2 github.com/ceramicnetwork/go-dag-jose v0.1.0/go.mod h1:qYA1nYt0X8u4XoMAVoOV3upUVKtrxy/I670Dg5F0wjI= github.com/cerc-io/eth-ipfs-state-validator/v5 v5.2.0-alpha h1:gpEk3BQQhnkilXxP12q77LSiIAvXfTdQ+4xxIv/JWiI= github.com/cerc-io/eth-ipfs-state-validator/v5 v5.2.0-alpha/go.mod h1:xmazdaZ/CUaXt52Mvd0KU7dcbJM3glvJzA2mEpVMgbM= -github.com/cerc-io/eth-iterator-utils v0.2.0 h1:wikAfWZ0fAqLqUy/Ud/a1n9p/arVeKG8P8tRjZE7oBg= -github.com/cerc-io/eth-iterator-utils v0.2.0/go.mod h1:wDUJvwKDSOdqTIyeG+yXJ2ckzc9f2Fem614fV61DBcg= -github.com/cerc-io/eth-testing v0.4.0 h1:ivGbXnEqlXMt/3m3jbsPJaVT7ZDTenFQWCryt1Rd/Jk= -github.com/cerc-io/eth-testing v0.4.0/go.mod h1:CVsmHjFldX9gwaQSQwGmKbmh0g6Dq+bsqB2CxBf9zbk= +github.com/cerc-io/eth-iterator-utils v0.3.1 h1:h4Bp0+fUiwkyug1uCEO2LZr2qxoW1yKszV2EO/2CDB0= +github.com/cerc-io/eth-iterator-utils v0.3.1/go.mod h1:UNrjsP5bApZkqqqfU7nmnPN/dIIo9GOUUD79tmoX/s4= +github.com/cerc-io/eth-testing v0.5.1 h1:xxcQf9ymJS0911yWIrUiGvCvqfvEjYmHvhBJkCD/whs= +github.com/cerc-io/eth-testing v0.5.1/go.mod h1:p86je2PjSM7u8Qd7rMIG/Zw+tQlBoS5Emkh1ECnC5t0= github.com/cerc-io/ipfs-ethdb/v5 v5.1.0-alpha h1:+XhYHvzC3zFIvcWEb466SNDfeLrvcW3xe/d0cbVVVRA= github.com/cerc-io/ipfs-ethdb/v5 v5.1.0-alpha/go.mod h1:w5g07b6Uz+c6r/ySml58TEOJdUYAibYYF05H5ULVv2I= -github.com/cerc-io/ipld-eth-statedb v0.1.0 h1:K2Xy8hgmkSRmHaqmw0CZf9hWX0r8/r0563O7osmyVBE= -github.com/cerc-io/ipld-eth-statedb v0.1.0/go.mod h1:Lo4TKVs7bTGr2b7L9ccmo/EMV96/nGE7T/GYliuOHlM= -github.com/cerc-io/plugeth-statediff v0.2.1 h1:zUbkazJW0omFGg7z/9MJnttox4VRurLW1pFytDlRQjM= -github.com/cerc-io/plugeth-statediff v0.2.1/go.mod h1:n85L2n8Q3bQVlAVFnyk2soCLJW+YFKGe3DVRauEaS2s= +github.com/cerc-io/ipld-eth-statedb v0.1.1-0.20240711085948-7bb5bbc6aa38 h1:8KzqJObmtnwGE8uXWfoUPG3HT86RTUCIXsipviEwPfA= +github.com/cerc-io/ipld-eth-statedb v0.1.1-0.20240711085948-7bb5bbc6aa38/go.mod h1:Vb8Ko2Nq0dUnJPZplPQp7kIClMBU0zHdH/p8n6rWUqA= +github.com/cerc-io/plugeth-statediff v0.3.2-0.20240711085659-6fe622e4bf33 h1:t0hSbThg5uX4r34eIFI0Pj2WbTIquDc+lKChLqieaMc= +github.com/cerc-io/plugeth-statediff v0.3.2-0.20240711085659-6fe622e4bf33/go.mod h1:r6Mzc6k4V9KD+iN9AXa/LmmRISDsQnnIwKzZMFjJ+eE= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= diff --git a/pkg/eth/test_helpers/test_data.go b/pkg/eth/test_helpers/test_data.go index c66c033e..52d9c49d 100644 --- a/pkg/eth/test_helpers/test_data.go +++ b/pkg/eth/test_helpers/test_data.go @@ -459,7 +459,7 @@ func createLegacyTransactionsAndReceipts() (types.Transactions, types.Receipts, func getReceiptCIDs(rcts []*types.Receipt) ([]cid.Cid, error) { cids := make([]cid.Cid, len(rcts)) for i, rct := range rcts { - ethRct, err := ipld.NewReceipt(rct) + ethRct, err := ipld.EncodeReceipt(rct) if err != nil { return nil, err } diff --git a/pkg/shared/test_helpers.go b/pkg/shared/test_helpers.go index 31b11707..94c3fcd4 100644 --- a/pkg/shared/test_helpers.go +++ b/pkg/shared/test_helpers.go @@ -27,6 +27,7 @@ import ( "github.com/cerc-io/plugeth-statediff/indexer/interfaces" "github.com/cerc-io/plugeth-statediff/indexer/models" "github.com/cerc-io/plugeth-statediff/indexer/node" + "github.com/cerc-io/plugeth-statediff/indexer/test_helpers" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/params" "github.com/jmoiron/sqlx" @@ -55,30 +56,7 @@ func SetupDB() *sqlx.DB { // TearDownDB is used to tear down the watcher dbs after tests func TearDownDB(db *sqlx.DB) { - tx, err := db.Beginx() - Expect(err).NotTo(HaveOccurred()) - _, err = tx.Exec(`DELETE FROM nodes`) - Expect(err).NotTo(HaveOccurred()) - _, err = tx.Exec(`DELETE FROM ipld.blocks`) - Expect(err).NotTo(HaveOccurred()) - _, err = tx.Exec(`DELETE FROM eth.header_cids`) - Expect(err).NotTo(HaveOccurred()) - _, err = tx.Exec(`DELETE FROM eth.uncle_cids`) - Expect(err).NotTo(HaveOccurred()) - _, err = tx.Exec(`DELETE FROM eth.transaction_cids`) - Expect(err).NotTo(HaveOccurred()) - _, err = tx.Exec(`DELETE FROM eth.receipt_cids`) - Expect(err).NotTo(HaveOccurred()) - _, err = tx.Exec(`DELETE FROM eth.state_cids`) - Expect(err).NotTo(HaveOccurred()) - _, err = tx.Exec(`DELETE FROM eth.storage_cids`) - Expect(err).NotTo(HaveOccurred()) - _, err = tx.Exec(`DELETE FROM eth.log_cids`) - Expect(err).NotTo(HaveOccurred()) - _, err = tx.Exec(`DELETE FROM eth_meta.watched_addresses`) - Expect(err).NotTo(HaveOccurred()) - - err = tx.Commit() + err := test_helpers.ClearSqlxDB(db) Expect(err).NotTo(HaveOccurred()) }