feat(shred): tx_index, Migrate without CPI, merge fix, doc limits

- Add tx_index to TransactionWithSlot (entry index), pass to parser
- Emit PumpFun Migrate even when no CPI (shred gets instruction-only)
- Merge: only overwrite Create/CreateV2 with CPI when value non-default
- Rename transaction_index -> tx_index across codebase
- Add docs/SHREDSTREAM_LIMITATIONS.md (ALT/CPI limits, field completeness)
- Comment shred path: static_account_keys only, no inner_instructions

Made-with: Cursor
This commit is contained in:
Wood
2026-03-07 12:35:57 +08:00
parent 04df6db0b0
commit 7270372604
14 changed files with 219 additions and 77 deletions
+7 -4
View File
@@ -66,7 +66,7 @@ pub async fn process_grpc_transaction(
let signature = transaction_pretty.signature;
let block_time = transaction_pretty.block_time;
let recv_us = transaction_pretty.recv_us;
let transaction_index = transaction_pretty.transaction_index;
let tx_index = transaction_pretty.tx_index;
let grpc_tx = transaction_pretty.grpc_tx;
let adapter_callback = create_metrics_callback(callback.clone());
@@ -80,7 +80,7 @@ pub async fn process_grpc_transaction(
block_time,
recv_us,
bot_wallet,
transaction_index,
tx_index,
adapter_callback,
)
.await?;
@@ -121,6 +121,7 @@ pub async fn process_shred_transaction(
let tx = transaction_with_slot.transaction;
let slot = transaction_with_slot.slot;
let tx_index = transaction_with_slot.tx_index;
if tx.signatures.is_empty() {
return Ok(());
@@ -130,6 +131,8 @@ pub async fn process_shred_transaction(
let recv_us = transaction_with_slot.recv_us;
let adapter_callback = create_metrics_callback(callback);
// Shred 路径仅能拿到 static_account_keys,且无 inner_instructions,解析限制见 docs/SHREDSTREAM_LIMITATIONS.md
// 若交易使用 ALT,账户可能为 default/错误;无 CPI 合并,timestamp/reserves 等多为 0。
let accounts = tx.message.static_account_keys();
EventParser::parse_instruction_events_from_versioned_transaction(
@@ -138,12 +141,12 @@ pub async fn process_shred_transaction(
&tx,
signature,
Some(slot),
None,
None, // shred 无 block_time
recv_us,
accounts,
&[],
bot_wallet,
None,
tx_index,
adapter_callback,
)
.await?;