Files
khadhroony-bobobot/docs/reports/RAYDIUM_CLMM_UPSTREAM_COVERAGE_REVIEW_PRE19.md
2026-06-05 14:53:16 +02:00

8.9 KiB

file: docs/reports/RAYDIUM_CLMM_UPSTREAM_COVERAGE_REVIEW_PRE19.md

Raydium CLMM upstream coverage review — 0.7.49-pre.19

Scope

Decoder under review:

raydium_clmm
program_id = CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK

External sources checked for the local coverage registry:

https://solscan.io/account/CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK#programIdl
https://github.com/sevenlabs-hq/carbon/tree/main/decoders/raydium-clmm-decoder
https://github.com/pinax-network/substreams-solana-idls/tree/main/src/raydium/clmm
https://github.com/0xfnzero/sol-parser-sdk/tree/main/idl

Notes:

  • Solscan is used as discovery / IDL cross-check, not as final business proof.
  • sol-parser-sdk/idl/raydium_clmm.json maps to raydium/amm_v3_with_swapv2.json and exposes the CLMM program address.
  • pinax-network/substreams-solana-idls exposes Raydium CLMM under src/raydium/clmm/v3.
  • sevenlabs-hq/carbon exposes a dedicated raydium-clmm-decoder crate.

Local registry status

The local registry now lists:

45 entries total:
- 33 instructions
- 11 Anchor/program-data events
- 1 program row

All 33 instruction entries have a local_event_kind mapping in dex_event_coverage.rs, instruction_observation_index.rs, dex_decode.rs, and upstream_registry_generated.rs.

The 11 event entries are listed as upstream facts and stay upstream_git_unverified until local corpus provides program-data/Anchor event proof.

Instruction coverage matrix

Entry Discriminator Family Local event kind Expected target Status
close_limit_order 4c7c800fd55725fa order_cancel raydium_clmm.close_limit_order k_sol_orderbook_events decoded/materializable
open_limit_order 9d20dab7471d1293 order_place raydium_clmm.open_limit_order k_sol_orderbook_events decoded/materializable
increase_limit_order b19059ecfaba7d63 order_place raydium_clmm.increase_limit_order k_sol_orderbook_events decoded/materializable
decrease_limit_order 759d3c674231a300 order_cancel raydium_clmm.decrease_limit_order k_sol_orderbook_events decoded/materializable
close_position 7b86510031446262 position_close raydium_clmm.close_position k_sol_liquidity_events decoded/materializable
close_protocol_position c975989055556cb2 position_close raydium_clmm.close_protocol_position k_sol_liquidity_events decoded/materializable
collect_fund_fee a78a4e95dfc2067e fee raydium_clmm.collect_fund_fee k_sol_fee_events decoded/materializable
collect_protocol_fee 8888fcddc2427e59 fee raydium_clmm.collect_protocol_fee k_sol_fee_events decoded/materializable
collect_remaining_rewards 12eda6c52210d590 reward raydium_clmm.collect_remaining_rewards k_sol_reward_events decoded/materializable
create_amm_config 8934edd4d7756c68 admin_config raydium_clmm.create_amm_config k_sol_pool_admin_events decoded/materializable
create_customizable_pool 2b44d4a7592fa401 pool_create raydium_clmm.create_customizable_pool k_sol_pool_lifecycle_events decoded/materializable
create_dynamic_fee_config bd0eb5785576e33e admin_config raydium_clmm.create_dynamic_fee_config k_sol_pool_admin_events decoded/materializable
create_operation_account 3f5794216d230868 unknown raydium_clmm.create_operation_account k_sol_dex_decoded_events_only decoded/audit-only unless admin evidence is required
create_pool e992d18ecf6840bc pool_create raydium_clmm.create_pool k_sol_pool_lifecycle_events decoded/materializable
create_support_mint_associated 11fb415c88f20ea9 account_create raydium_clmm.create_support_mint_associated k_sol_token_account_events decoded; token-account materialization remains a later cross-DEX topic
decrease_liquidity a026d06f685b2c01 liquidity_remove raydium_clmm.decrease_liquidity k_sol_liquidity_events decoded/materializable
decrease_liquidity_v2 3a7fbc3e4f52c460 liquidity_remove raydium_clmm.decrease_liquidity_v2 k_sol_liquidity_events decoded/materializable
increase_liquidity 2e9cf3760dcdfbb2 liquidity_add raydium_clmm.increase_liquidity k_sol_liquidity_events decoded/materializable
increase_liquidity_v2 851d59df45eeb00a liquidity_add raydium_clmm.increase_liquidity_v2 k_sol_liquidity_events decoded/materializable
initialize_reward 5f87c0c4f281e644 reward raydium_clmm.initialize_reward k_sol_reward_events decoded/materializable
open_position 87802f4d0f98f031 position_open raydium_clmm.open_position k_sol_liquidity_events decoded/materializable
open_position_v2 4db84ad67056f1c7 position_open raydium_clmm.open_position_v2 k_sol_liquidity_events decoded/materializable
open_position_with_token22_nft 4dffae527d1dc92e position_open raydium_clmm.open_position_with_token22_nft k_sol_liquidity_events decoded/materializable
set_reward_params 7034a74b20c9d389 reward raydium_clmm.set_reward_params k_sol_reward_events decoded/materializable
settle_limit_order cd4e74215c691a60 settle_funds raydium_clmm.settle_limit_order k_sol_orderbook_events decoded/materializable
swap f8c69e91e17587c8 swap raydium_clmm.swap k_sol_trade_events decoded/materializable as trade
swap_router_base_in 457d73daf5baf2c4 swap raydium_clmm.swap_router_base_in k_sol_trade_events decoded; observed but not promoted to trade without corpus proof
swap_v2 2b04ed0b1ac91e62 swap raydium_clmm.swap_v2 k_sol_trade_events decoded/materializable as trade
transfer_reward_owner 07160c53f22b3079 reward raydium_clmm.transfer_reward_owner k_sol_reward_events decoded/materializable
update_amm_config 313cae889a1c74c8 admin_config raydium_clmm.update_amm_config k_sol_pool_admin_events decoded/materializable
update_operation_account 7f467728bce33d07 unknown raydium_clmm.update_operation_account k_sol_dex_decoded_events_only decoded/audit-only unless admin evidence is required
update_pool_status 82576c062ee0757b admin_config raydium_clmm.update_pool_status k_sol_pool_admin_events decoded/materializable
update_reward_infos a3ace0340b9a6adf reward raydium_clmm.update_reward_infos k_sol_reward_events decoded/materializable

Anchor/program-data event entries

These entries remain listed, but no local corpus row has observed them as direct CLMM decoded events in the current replay corpus:

Event entry Discriminator Family Expected target Status
collect_personal_fee_event a6ae69c051a15369 fee k_sol_fee_events upstream listed, local corpus unobserved
collect_protocol_fee_event ce57114f2d29d53d fee k_sol_fee_events upstream listed, local corpus unobserved
config_change_event f7bd07776a705f97 admin_config k_sol_pool_admin_events upstream listed, local corpus unobserved
create_personal_position_event 641e57f9c4df9ace unknown k_sol_dex_decoded_events_only upstream listed, local corpus unobserved
decrease_liquidity_event 3ade563a44325538 liquidity_remove k_sol_liquidity_events upstream listed, local corpus unobserved
increase_liquidity_event 314f69d420221e54 liquidity_add k_sol_liquidity_events upstream listed, local corpus unobserved
liquidity_calculate_event ed7094e63954b4a2 unknown k_sol_dex_decoded_events_only upstream listed, local corpus unobserved
liquidity_change_event 7ef0afce9e58996b unknown k_sol_dex_decoded_events_only upstream listed, local corpus unobserved
pool_created_event 195e4b2f7063353f unknown k_sol_dex_decoded_events_only upstream listed, local corpus unobserved
swap_event 40c6cde8260871e2 swap k_sol_trade_events upstream listed, local corpus unobserved
update_reward_infos_event 6d7fba4e724125ec reward k_sol_reward_events upstream listed, local corpus unobserved

Patch pre.19

Patch goal:

Stop replay/backfill from leaving `upstream_git.instruction_match` rows when a local specialized decoder already covers the same upstream decoder + entry + discriminator.

New DB query:

query_dex_decoded_events_delete_locally_covered_upstream_instruction_matches(database, upstream_decoder_code)

Called from:

local_pipeline_replay.rs::refresh_event_coverage_best_effort
token_backfill.rs::refresh_event_coverage_best_effort

Expected validation after replay:

raydium_clmm.instruction_audit residual query -> empty
upstream_git.instruction_match where upstreamDecoderCode = raydium_clmm -> empty
non-swap CLMM trade_count -> empty
failed CLMM materialization query -> empty
coverage summary remains populated around 45 listed / 33 decoded / 33 observed