feat(solana-indexer) PR 13: index on-chain-created orders - #4740
Open
squadgazzz wants to merge 115 commits into
Open
feat(solana-indexer) PR 13: index on-chain-created orders#4740squadgazzz wants to merge 115 commits into
squadgazzz wants to merge 115 commits into
Conversation
…dead-letter reason argument
…on id to the wire
The parsing-generic branch is merged and its ref deleted, so the branch pin would break the next cargo update. Main's interface types the push amount as u64, dropping the byte-array decode on our side.
…arser' into solana-indexer/PR8-persist
Drops the pending-adapter and later-PR breadcrumbs, the spec anchor, and the leftover cast comment resolved by the i64 pass-through.
… solana-indexer/PR9-pipeline-test # Conflicts: # crates/solana-indexer/src/persistence.rs
…runcating The order/push zip silently truncated to the shorter side and the pull sum saturated. Both are layout violations, so the pair is skipped with a warning. Also merges the no-event instruction arms, drops the intermediate push collect, and inlines the test instruction helper.
The CreateOrder and BeginSettle/FinalizeSettle fixtures go through the client crate's builders as a dev-dependency, so the tests round-trip the real encoder into our parser instead of hand-rolling bytes. The invalid-instruction fixtures stay hand-rolled: they craft data no builder would produce, and they double as the wire-layout pin.
…arser' into solana-indexer/PR8-persist # Conflicts: # crates/solana-indexer/src/indexer/decoder/tests.rs
…eline-test # Conflicts: # crates/solana-indexer/src/persistence.rs
…xer/PR8-persist # Conflicts: # crates/solana-indexer/src/indexer/decoder/tests.rs
Contributor
|
Claude finished @squadgazzz's task in 2m 35s —— View job PR Review: index on-chain-created ordersReviewed the diff against Two points posted as inline comments (both worth a look, neither blocking):
Nice touches: distinct mints in the tests so a swapped binding fails, and the unresolved-mints test asserting
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Orders placed directly on chain (the demo flow has no orderbook) now get their
solana.ordersrow, which is what makes them visible to the autopilot's open-orders cut. The missing piece was the token mints. The intent only names token accounts, so at flush time the decoder resolves the batch's token accounts throughgetMultipleAccountsand reads each account's mint out of the SPL layout.The lookup only trusts accounts owned by a token program with the token-account size, so an intent naming a garbage account cannot smuggle a fake mint into the orders table. When a mint cannot be resolved (not a token account, closed), the order keeps its
order_pdarow, the intent row is skipped, and the transaction is dead-lettered with reasonunresolved_mints, so the replay machinery re-delivers it later. An RPC failure is handled differently: the slot's database write never starts and the last indexed slot does not advance, so a restart re-delivers the whole slot and transient outages lose nothing.Changes
fn token_account_mintreads the SPL account layout and rejects non-token accountsCreatedOrdercarries its transaction signature, the dead-letter key for unresolved ordersapply_order_createdwrites thesolana.ordersrow (zerofee_amount, the on-chain intent has no fee, andcreation_timestampis indexing time, the stream carries no block time)Rpc::new_mockfor tests over a canned transportHow to test
New and updated DB tests: the pipeline test now runs through a mocked
getMultipleAccountsand asserts the orders row, plus an unresolved-mints case.cargo nextest run -p solana-indexer solana_db --run-ignored ignored-only --test-threads 1, and they run in CI.Related issues
Resolves BE-207.