test(extractors/solana): OF1 vs JSON-RPC comparison example#1690
test(extractors/solana): OF1 vs JSON-RPC comparison example#1690
Conversation
sistemd
commented
Feb 4, 2026
- An example program that compares the output of OF1 and JSON-RPC clients to make sure that the data is consistent between the two.
- This will also serve as a test to make sure that the data we are reading from the Old Faithful archive is correct. Here we'll consider JSON-RPC as the source of truth.
There was a problem hiding this comment.
Thanks for adding this comparison utility - it's a useful tool for validating data consistency between OF1 and JSON-RPC sources.
Summary of review comments:
-
Missing
block_rewardscomparison - Theslots_matchfunction compares transactions and messages but notblock_rewards, even though the struct now derivesPartialEq. -
Error handling - The car manager task result is silently discarded; consider logging failures.
-
Code structure - The
elseblocks after early-returnifstatements are unnecessary and add nesting. -
Counter overflow - Using
u8formismatched_slotscould overflow in edge cases; considersaturating_addor a larger type. -
Derive removals -
Clonewas removed from several structs. Since these are now public, this could affect downstream flexibility. -
Visibility inconsistencies -
ui_token_amountfield andTokenAmountstruct weren't made public while similar fields/structs were. -
Comparison semantics - Slots missing in RPC but present in OF1 are skipped without incrementing
mismatched_slots. The reverse case (missing in OF1) isn't explicitly handled.
| } | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
The slots_match function does not compare block_rewards. The NonEmptySlot struct has a block_rewards: block_rewards::BlockRewards field that is not being compared here, but BlockRewards now derives PartialEq.
Consider adding:
if of1_slot.block_rewards != rpc_slot.block_rewards {
tracing::warn!(
%slot_num,
of1_rewards_count = %of1_slot.block_rewards.rewards.len(),
rpc_rewards_count = %rpc_slot.block_rewards.rewards.len(),
"block rewards mismatch"
);
return false;
}There was a problem hiding this comment.
Block rewards will be handled in a follow up PR that addresses known (discovered through solana_compare) mismatches.
10abddb to
bdc615a
Compare
- An example program that compares the output of OF1 and JSON-RPC clients to make sure that the data is consistent between the two. - This will also serve as a test to make sure that the data we are reading from the Old Faithful archive is correct. Here we'll consider JSON-RPC as the source of truth.
745beb1 to
b798cef
Compare