From b8bfdf2458b92d23c6c47c5fbacc9fadf673bc20 Mon Sep 17 00:00:00 2001 From: ptrus Date: Mon, 12 Jan 2026 09:54:27 +0000 Subject: [PATCH] Fix charged fee for oasis encoded eth txs --- .changelog/1234.bugfix.1.md | 1 + .changelog/1234.bugfix.2.md | 4 ++++ storage/client/queries/queries.go | 6 ++++-- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 .changelog/1234.bugfix.1.md create mode 100644 .changelog/1234.bugfix.2.md diff --git a/.changelog/1234.bugfix.1.md b/.changelog/1234.bugfix.1.md new file mode 100644 index 000000000..24e263e5b --- /dev/null +++ b/.changelog/1234.bugfix.1.md @@ -0,0 +1 @@ +api: Fix charged fee for oasis encoded eth txs diff --git a/.changelog/1234.bugfix.2.md b/.changelog/1234.bugfix.2.md new file mode 100644 index 000000000..d8d391662 --- /dev/null +++ b/.changelog/1234.bugfix.2.md @@ -0,0 +1,4 @@ +Fix consensus related events edgecase + +The query did not include the event type in the join, which could result +in wrong events showing up as related events. diff --git a/storage/client/queries/queries.go b/storage/client/queries/queries.go index 50da612cd..34bd7fe83 100644 --- a/storage/client/queries/queries.go +++ b/storage/client/queries/queries.go @@ -211,6 +211,7 @@ const ( LEFT JOIN chain.blocks b ON tx_block = b.height LEFT JOIN chain.events_related_accounts rel ON chain.events.tx_block = rel.tx_block AND + chain.events.type = rel.type AND chain.events.event_index = rel.event_index AND -- When related_address ($5) is NULL and hence we do no filtering on it, avoid the join altogether. ($5::text IS NOT NULL) @@ -601,8 +602,9 @@ const ( txs.gas_limit, txs.gas_used, CASE - WHEN txs.tx_eth_hash IS NULL THEN txs.fee - ELSE COALESCE(FLOOR(txs.fee / NULLIF(txs.gas_limit, 0)) * txs.gas_used, 0) + WHEN txs.method IN ('evm.Call', 'evm.Create') OR txs.tx_eth_hash IS NOT NULL + THEN COALESCE(FLOOR(txs.fee / NULLIF(txs.gas_limit, 0)) * txs.gas_used, 0) + ELSE txs.fee END AS charged_fee, txs.size, txs.raw_result,