diff --git a/pkg/eth/api_test.go b/pkg/eth/api_test.go index 0cdadd7d2..7a60c0efa 100644 --- a/pkg/eth/api_test.go +++ b/pkg/eth/api_test.go @@ -151,7 +151,7 @@ var ( "contractAddress": nil, "logs": test_helpers.MockReceipts[0].Logs, "logsBloom": test_helpers.MockReceipts[0].Bloom, - "root": hexutil.Bytes(test_helpers.MockReceipts[0].PostState), + "status": hexutil.Uint(test_helpers.MockReceipts[0].Status), } expectedReceipt2 = map[string]interface{}{ "blockHash": blockHash, diff --git a/pkg/eth/cid_retriever.go b/pkg/eth/cid_retriever.go index af3ce4695..44984e41b 100644 --- a/pkg/eth/cid_retriever.go +++ b/pkg/eth/cid_retriever.go @@ -317,7 +317,7 @@ func (ecr *CIDRetriever) RetrieveFilteredGQLLogs(tx *sqlx.Tx, rctFilter ReceiptF id := 1 pgStr := `SELECT eth.log_cids.index, eth.log_cids.receipt_id, eth.log_cids.address, eth.log_cids.topic0, eth.log_cids.topic1, eth.log_cids.topic2, eth.log_cids.topic3, - eth.log_cids.log_data, eth.transaction_cids.tx_hash, data, eth.receipt_cids.cid + eth.log_cids.log_data, eth.transaction_cids.tx_hash, data, eth.receipt_cids.cid, eth.receipt_cids.post_status FROM eth.log_cids, eth.receipt_cids, eth.transaction_cids, eth.header_cids, public.blocks WHERE eth.log_cids.receipt_id = receipt_cids.id AND receipt_cids.tx_id = transaction_cids.id diff --git a/pkg/eth/ipld_fetcher.go b/pkg/eth/ipld_fetcher.go index 80df4a564..8e64e33bb 100644 --- a/pkg/eth/ipld_fetcher.go +++ b/pkg/eth/ipld_fetcher.go @@ -203,7 +203,6 @@ func (f *IPLDFetcher) FetchLogs(logCIDs []customLog) ([]*types.Log, error) { TxIndex: uint(l.TxnIndex), BlockHash: common.HexToHash(l.BlockHash), Index: uint(l.Index), - Removed: false, // TODO: check where to get this value } } @@ -211,10 +210,11 @@ func (f *IPLDFetcher) FetchLogs(logCIDs []customLog) ([]*types.Log, error) { } type logsCID struct { - Log *types.Log - CID string - RctCID string - RctData []byte + Log *types.Log + CID string + RctCID string + RctData []byte + RctStatus uint64 } // FetchGQLLogs fetches logs for graphql. @@ -245,9 +245,10 @@ func (f *IPLDFetcher) FetchGQLLogs(logCIDs []customLog) ([]logsCID, error) { Index: uint(l.Index), TxHash: common.HexToHash(l.TxHash), }, - CID: l.LeafCID, - RctCID: l.RctCID, - RctData: l.RctData, + CID: l.LeafCID, + RctCID: l.RctCID, + RctData: l.RctData, + RctStatus: l.RctStatus, } } diff --git a/pkg/eth/test_helpers/test_data.go b/pkg/eth/test_helpers/test_data.go index a199f2f20..7d17d7462 100644 --- a/pkg/eth/test_helpers/test_data.go +++ b/pkg/eth/test_helpers/test_data.go @@ -608,7 +608,7 @@ func createLegacyTransactionsAndReceipts() (types.Transactions, types.Receipts, log.Fatal(err) } // make receipts - mockReceipt1 := types.NewReceipt(common.HexToHash("0x0").Bytes(), false, 50) + mockReceipt1 := types.NewReceipt(nil, false, 50) hash1 := signedTrx1.Hash() MockLog1.TxHash = hash1 diff --git a/pkg/eth/types.go b/pkg/eth/types.go index 0f0b2bae6..526a9b407 100644 --- a/pkg/eth/types.go +++ b/pkg/eth/types.go @@ -183,6 +183,7 @@ type customLog struct { Topic3 string `db:"topic3"` RctData []byte `db:"data"` RctCID string `db:"cid"` + RctStatus uint64 `db:"post_status"` BlockNumber string `db:"block_number"` BlockHash string `db:"block_hash"` TxnIndex int64 `db:"txn_index"` diff --git a/pkg/graphql/client.go b/pkg/graphql/client.go index 83fd820ae..9c903c408 100644 --- a/pkg/graphql/client.go +++ b/pkg/graphql/client.go @@ -24,6 +24,7 @@ type LogResponse struct { Topics []common.Hash `json:"topics"` Data hexutil.Bytes `json:"data"` Transaction TransactionResp `json:"transaction"` + Status int32 `json:"status"` } type TransactionResp struct { @@ -52,6 +53,7 @@ func (c *Client) GetLogs(ctx context.Context, hash common.Hash, address common.A transaction { hash } + status } } `, hash.String(), address.String()) diff --git a/pkg/graphql/graphql.go b/pkg/graphql/graphql.go index cf315e33b..6fe9edd47 100644 --- a/pkg/graphql/graphql.go +++ b/pkg/graphql/graphql.go @@ -95,6 +95,7 @@ type Log struct { cid string receiptCID string ipldBlock []byte + status uint64 } func (l *Log) Transaction(ctx context.Context) *Transaction { @@ -129,6 +130,10 @@ func (l *Log) IpldBlock(ctx context.Context) hexutil.Bytes { return hexutil.Bytes(l.ipldBlock) } +func (l *Log) Status(ctx context.Context) int32 { + return int32(l.status) +} + // Transaction represents an Ethereum transaction. // backend and hash are mandatory; all others will be fetched when required. type Transaction struct { @@ -1039,6 +1044,7 @@ func (r *Resolver) GetLogs(ctx context.Context, args struct { transaction: &Transaction{ hash: l.Log.TxHash, }, + status: l.RctStatus, }) } diff --git a/pkg/graphql/graphql_test.go b/pkg/graphql/graphql_test.go index 846a8549a..af73b94f3 100644 --- a/pkg/graphql/graphql_test.go +++ b/pkg/graphql/graphql_test.go @@ -191,6 +191,7 @@ var _ = Describe("GraphQL", func() { Topics: test_helpers.MockLog1.Topics, Data: hexutil.Bytes(test_helpers.MockLog1.Data), Transaction: graphql.TransactionResp{Hash: test_helpers.MockTransactions[0].Hash()}, + Status: int32(test_helpers.MockReceipts[0].Status), }, } Expect(logs).To(Equal(expectedLogs)) diff --git a/pkg/graphql/schema.go b/pkg/graphql/schema.go index 4da17186e..9b219e088 100644 --- a/pkg/graphql/schema.go +++ b/pkg/graphql/schema.go @@ -72,6 +72,9 @@ const schema string = ` # IPLD block data for the Receipt this Log exists in. ipldBlock: Bytes! + + # Status of the Receipt IPLD block this Log exists in. + status: Int! } # Transaction is an Ethereum transaction.