From 3aa5cb36ef489ce0a6e584a4fee1b2cbebb13228 Mon Sep 17 00:00:00 2001 From: prathamesh0 Date: Mon, 14 Mar 2022 15:27:58 +0530 Subject: [PATCH] Fixes for unit tests --- docker-compose.yml | 2 +- pkg/eth/backend.go | 6 +++--- pkg/eth/ipld_retriever.go | 4 ++-- pkg/eth/test_helpers/test_data.go | 1 + pkg/eth/types.go | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 39888905..7a227b4e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,7 @@ services: ipld-eth-db: restart: always - image: vulcanize/ipld-eth-db:v3.0.6 + image: vulcanize/ipld-eth-db:v0.3.1 environment: POSTGRES_USER: "vdbm" POSTGRES_DB: "vulcanize_testing" diff --git a/pkg/eth/backend.go b/pkg/eth/backend.go index db693bcd..424c600f 100644 --- a/pkg/eth/backend.go +++ b/pkg/eth/backend.go @@ -65,10 +65,10 @@ var ( const ( RetrieveCanonicalBlockHashByNumber = `SELECT block_hash FROM eth.header_cids INNER JOIN public.blocks ON (header_cids.mh_key = blocks.key) - WHERE block_hash = (SELECT canonical_header_id($1))` + WHERE block_hash = (SELECT canonical_header_hash($1))` RetrieveCanonicalHeaderByNumber = `SELECT cid, data FROM eth.header_cids INNER JOIN public.blocks ON (header_cids.mh_key = blocks.key) - WHERE block_hash = (SELECT canonical_header_id($1))` + WHERE block_hash = (SELECT canonical_header_hash($1))` RetrieveTD = `SELECT CAST(td as Text) FROM eth.header_cids WHERE header_cids.block_hash = $1` RetrieveRPCTransaction = `SELECT blocks.data, block_hash, block_number, index FROM public.blocks, eth.transaction_cids, eth.header_cids @@ -82,7 +82,7 @@ const ( AND block_number <= (SELECT block_number FROM eth.header_cids WHERE block_hash = $2) - AND header_cids.block_hash = (SELECT canonical_header_id(block_number)) + AND header_cids.block_hash = (SELECT canonical_header_hash(block_number)) ORDER BY block_number DESC LIMIT 1` RetrieveCodeByMhKey = `SELECT data FROM public.blocks WHERE key = $1` diff --git a/pkg/eth/ipld_retriever.go b/pkg/eth/ipld_retriever.go index 6a0443f2..9710cadc 100644 --- a/pkg/eth/ipld_retriever.go +++ b/pkg/eth/ipld_retriever.go @@ -116,7 +116,7 @@ const ( AND block_number <= (SELECT block_number FROM eth.header_cids WHERE block_hash = $2) - AND header_cids.block_hash = (SELECT canonical_header_id(block_number)) + AND header_cids.block_hash = (SELECT canonical_header_hash(block_number)) ORDER BY block_number DESC LIMIT 1` RetrieveAccountByLeafKeyAndBlockNumberPgStr = `SELECT state_cids.cid, data, state_cids.node_type @@ -147,7 +147,7 @@ const ( AND block_number <= (SELECT block_number FROM eth.header_cids WHERE block_hash = $3) - AND header_cids.block_hash = (SELECT canonical_header_id(block_number)) + AND header_cids.block_hash = (SELECT canonical_header_hash(block_number)) ORDER BY block_number DESC LIMIT 1` ) diff --git a/pkg/eth/test_helpers/test_data.go b/pkg/eth/test_helpers/test_data.go index eae6e7d6..0c7e46dd 100644 --- a/pkg/eth/test_helpers/test_data.go +++ b/pkg/eth/test_helpers/test_data.go @@ -453,6 +453,7 @@ var ( Bloom: MockBlock.Bloom().Bytes(), Timestamp: MockBlock.Time(), TimesValidated: 1, + Coinbase: "0x0000000000000000000000000000000000000000", }, Transactions: MockTrxMetaPostPublsh, Receipts: MockRctMetaPostPublish, diff --git a/pkg/eth/types.go b/pkg/eth/types.go index 9b6b6ca7..5118eda2 100644 --- a/pkg/eth/types.go +++ b/pkg/eth/types.go @@ -248,7 +248,7 @@ type ConvertedPayload struct { // LogResult represent a log. type LogResult struct { LeafCID string `db:"leaf_cid"` - ReceiptID int64 `db:"rct_id"` + ReceiptID string `db:"rct_id"` Address string `db:"address"` Index int64 `db:"index"` Data []byte `db:"log_data"`