Skip to content

solana compare followup#1697

Merged
sistemd merged 9 commits intomainfrom
sistemd/solana-compare-followup
Feb 6, 2026
Merged

solana compare followup#1697
sistemd merged 9 commits intomainfrom
sistemd/solana-compare-followup

Conversation

@sistemd
Copy link
Contributor

@sistemd sistemd commented Feb 5, 2026

There are a few currently known mismatches between the OF1 and JSON-RPC slot fields:

  • JSON-RPC slots have their blocktime fields populated very early on, while those same slots have None or Some(0) blocktime values in OF1 data.
  • Some OF1 transactions have an error set (always the same one, InstructionError::Custom(0)) whereas those transactions in JSON-RPC have no error set.
  • Block rewards are not populated the same way between OF1 and JSON-RPC. In the JSON-RPC response they are distributed across individual transactions' metadata fields. In the OF1 response they are stored in a top level block_rewards field.

For now, the first two will be documented and set aside. The third one has to be investigated further since it can probably be resolved through JSON-RPC call configuration.

Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review for Solana compare followup PR. I've identified several issues that warrant attention:

Logic Issues:

  1. known_ui_amount_mismatch_in - The condition appears inverted; it returns true when amounts are close (within tolerance) rather than when there's a mismatch
  2. known_block_reward_count_mismatch - Returns true when counts still don't match, but semantically should return true when the mismatch is "explained" (i.e., counts match after accounting for different storage)
  3. Transaction status skip - Skips comparison on any status difference, but the comment mentions a specific error type; consider being more precise

Data Integrity Concerns:
4. Zero ui_amount conversion - Converting 0.0 to None conflates "zero tokens" with "field not populated", which could cause data loss

Minor Items:
5. Retry configuration - Using default ExponentialBuilder settings; consider making explicit for clarity
6. Block reward comparison - When counts mismatch (even if "known"), the zip comparison will silently ignore extra rewards
7. Log level change - Channel close changed from debug! to error! - verify this is truly an error condition vs normal shutdown

The PR adds useful retry logic and handles several known OF1/RPC mismatches, but the logic in the mismatch detection functions should be verified.

@sistemd sistemd force-pushed the sistemd/solana-compare-followup branch from d376de2 to 2142b7a Compare February 5, 2026 22:30
@sistemd sistemd requested review from LNSD and leoyvens February 5, 2026 22:32
Copy link
Contributor

@LNSD LNSD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅

Fixes slight mismatches in the values of some fields between OF1 and
JSON-RPC slots (using the JSON-RPC values as the source of truth):

- If the OF1 pre/post balance or reward optionals are missing, turn them
  into empty vectors.
- If the OF1 value/owner TransactionTokenBalance fields are empty strings,
  replace them with `None`.
- If the OF1 ui_amount TokenBalance field is equal to 0.0, replace it
  with `None`.
There are a few currently known mismatches between the OF1 and JSON-RPC
slot fields:

- JSON-RPC slots have their `blocktime` fields populated very early on,
  while those same slots have `None` or `Some(0)` blocktime values in
  OF1 data.
- Some OF1 transactions have an error set (always the same one,
  `InstructionError::Custom(0)`) whereas those transactions in JSON-RPC
  have no error set.
- Block rewards are not populated the same way between OF1 and JSON-RPC.
  In the JSON-RPC response they are distributed across individual
  transactions' metadata fields. In the OF1 response they are stored in
  a top level `block_rewards field`.

For now, the first two will be documented and set aside. The third one
has to be investigated further since it can probably be resolved through
JSON-RPC call configuration.
@sistemd sistemd force-pushed the sistemd/solana-compare-followup branch from 2142b7a to 969aa6f Compare February 6, 2026 13:48
@sistemd sistemd merged commit dce8bcf into main Feb 6, 2026
7 checks passed
@sistemd sistemd deleted the sistemd/solana-compare-followup branch February 6, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants