This commit is contained in:
2026-06-19 10:29:17 +02:00
parent 319be14aa6
commit 58f9b36969
24 changed files with 6432 additions and 741 deletions

View File

@@ -196,7 +196,9 @@ WHERE de.protocol_name = 'meteora_dlmm'
'meteora_dlmm.swap_exact_out',
'meteora_dlmm.swap_exact_out2',
'meteora_dlmm.swap_with_price_impact',
'meteora_dlmm.swap_with_price_impact2'
'meteora_dlmm.swap_with_price_impact2',
'meteora_dlmm.swap_event',
'meteora_dlmm.swap2_evt'
)
GROUP BY de.event_kind
HAVING trade_count > 0 OR candle_count > 0
@@ -268,7 +270,32 @@ GROUP BY de.event_kind
HAVING fee_count > 0 OR reward_count > 0
ORDER BY de.event_kind;
-- 13. Global watchlist after replay.
-- 13. Limit/orderbook no trade/candle double-count. Target: empty.
SELECT
de.event_kind,
COUNT(DISTINCT te.id) AS trade_count,
COUNT(DISTINCT pc.id) AS candle_count,
COUNT(DISTINCT obe.id) AS orderbook_count,
MIN(tx.signature) AS sample_signature
FROM k_sol_dex_decoded_events de
JOIN k_sol_chain_transactions tx ON tx.id = de.transaction_id
LEFT JOIN k_sol_trade_events te ON te.decoded_event_id = de.id
LEFT JOIN k_sol_pair_candles pc ON pc.pair_id = te.pair_id
LEFT JOIN k_sol_orderbook_events obe ON obe.decoded_event_id = de.id
WHERE de.protocol_name = 'meteora_dlmm'
AND (
de.event_kind LIKE '%limit_order%'
OR de.event_kind IN (
'meteora_dlmm.place_limit_order_evt',
'meteora_dlmm.cancel_limit_order_evt',
'meteora_dlmm.close_limit_order_evt'
)
)
GROUP BY de.event_kind
HAVING trade_count > 0 OR candle_count > 0
ORDER BY trade_count DESC, candle_count DESC, de.event_kind;
-- 14. Global watchlist after replay.
SELECT
COALESCE(json_extract(de.payload_json, '$.upstreamDecoderCode'), de.protocol_name) AS backlog_decoder,
de.event_kind,
@@ -283,3 +310,63 @@ WHERE de.protocol_name IN ('upstream_git', 'meteora_dlmm')
GROUP BY backlog_decoder, de.event_kind, upstream_entry_name, upstream_discriminator_hex
ORDER BY decoded_count DESC, backlog_decoder, de.event_kind
LIMIT 100;
-- 15. Coverage observed > materialized explained by failed transactions.
-- The final accepted residual is close_bin_array: 16 observed / 14 materialized,
-- with 2 failed transactions Custom 6015 and 0 business materialization on failed tx.
SELECT
ce.entry_name,
ce.entry_kind,
ce.event_family,
ce.expected_db_target,
ce.local_event_kind,
ce.discriminator_hex,
ce.observed_count,
ce.materialized_count,
ce.observed_count - ce.materialized_count AS missing_count
FROM k_sol_dex_event_coverage_entries ce
WHERE ce.decoder_code = 'meteora_dlmm'
AND ce.observed_count > ce.materialized_count
AND ce.observed_count > 0
ORDER BY missing_count DESC, ce.entry_kind, ce.entry_name, ce.discriminator_hex;
-- 16. close_bin_array success/failed split.
-- Final acceptable result:
-- success rows -> decoded_count = lifecycle_count = 14
-- failed rows -> decoded_count = 2, lifecycle_count = 0
SELECT
de.event_kind,
tx.err_json,
COUNT(*) AS decoded_count,
COUNT(DISTINCT ple.id) AS lifecycle_count,
MIN(tx.signature) AS sample_signature
FROM k_sol_dex_decoded_events de
JOIN k_sol_chain_transactions tx
ON tx.id = de.transaction_id
LEFT JOIN k_sol_pool_lifecycle_events ple
ON ple.decoded_event_id = de.id
WHERE de.protocol_name = 'meteora_dlmm'
AND de.event_kind = 'meteora_dlmm.close_bin_array'
GROUP BY de.event_kind, tx.err_json
ORDER BY decoded_count DESC;
-- 17. Logical duplicate coverage rows. Target: empty.
SELECT
decoder_code,
COALESCE(program_id, '') AS program_id,
entry_kind,
entry_name,
COALESCE(discriminator_hex, '') AS discriminator_hex,
COALESCE(local_event_kind, '') AS local_event_kind,
COUNT(*) AS duplicate_count
FROM k_sol_dex_event_coverage_entries
WHERE decoder_code = 'meteora_dlmm'
GROUP BY
decoder_code,
COALESCE(program_id, ''),
entry_kind,
entry_name,
COALESCE(discriminator_hex, ''),
COALESCE(local_event_kind, '')
HAVING COUNT(*) > 1
ORDER BY duplicate_count DESC, entry_kind, entry_name, discriminator_hex;