From 80c4e9673a7136ce29bfee715bf27bf5635785b8 Mon Sep 17 00:00:00 2001 From: spilin Date: Tue, 30 Nov 2021 12:48:47 +0200 Subject: [PATCH 1/2] Validate that transaction.output is a valid address(eth_getTransactionReceipt) --- .docker/docker-entrypoint-initdb.d/init.txt | 2 +- etc/schema/functions/eth_getTransactionReceipt.sql | 2 +- src/index.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.docker/docker-entrypoint-initdb.d/init.txt b/.docker/docker-entrypoint-initdb.d/init.txt index 0520f1d3..6b6b19fd 100644 --- a/.docker/docker-entrypoint-initdb.d/init.txt +++ b/.docker/docker-entrypoint-initdb.d/init.txt @@ -474,7 +474,7 @@ BEGIN t.to AS "to", t.gas_used AS "gasUsed", 0::u256 AS "cumulativeGasUsed", -- TODO: tally? - CASE WHEN t.to IS NULL OR t.to = '\x0000000000000000000000000000000000000000' THEN t.output + CASE WHEN (t.to IS NULL OR t.to = '\x0000000000000000000000000000000000000000') AND length(t.output) = 20 THEN t.output ELSE NULL END AS "contractAddress", NULL AS "logs", -- TODO: fetch event.id[] diff --git a/etc/schema/functions/eth_getTransactionReceipt.sql b/etc/schema/functions/eth_getTransactionReceipt.sql index e174ce17..39ad1976 100644 --- a/etc/schema/functions/eth_getTransactionReceipt.sql +++ b/etc/schema/functions/eth_getTransactionReceipt.sql @@ -13,7 +13,7 @@ BEGIN t.to AS "to", t.gas_used AS "gasUsed", 0::u256 AS "cumulativeGasUsed", -- TODO: tally? - CASE WHEN t.to IS NULL OR t.to = '\x0000000000000000000000000000000000000000' THEN t.output + CASE WHEN (t.to IS NULL OR t.to = '\x0000000000000000000000000000000000000000') AND length(t.output) = 20 THEN t.output ELSE NULL END AS "contractAddress", NULL AS "logs", -- TODO: fetch event.id[] diff --git a/src/index.ts b/src/index.ts index 8d38f44e..61240dbd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -75,7 +75,7 @@ async function main(argv: string[], env: NodeJS.ProcessEnv): Promise { const sql = new pg.Client(config.database); await sql.connect(); await sql.query('SELECT 1'); // test connectivity - } catch (error) { + } catch (error: any) { console.error( `aurora-relayer: Invalid database configuration: ${error.message}` ); From 6b0e847a8a789ed2595199cc7a130ee4e7941497 Mon Sep 17 00:00:00 2001 From: spilin Date: Wed, 1 Dec 2021 16:15:04 +0200 Subject: [PATCH 2/2] Document the upgrade path. --- CHANGES.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index d97d7fce..823d948c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## 2021-12-01 + +Stored procedure needs to be reloaded [Issue #133](https://github.com/aurora-is-near/aurora-relayer/issues/133) + +- `etc/schema/functions/eth_getTransactionReceipt.sql` + + ## 2021-10-19 Some schema changes were necessary in order to be able to index