feat(rpc): implement getTransaction#1250
Open
ajw221 wants to merge 40 commits intoadamw/implement-getBlock-in-rpcfrom
Open
feat(rpc): implement getTransaction#1250ajw221 wants to merge 40 commits intoadamw/implement-getBlock-in-rpcfrom
ajw221 wants to merge 40 commits intoadamw/implement-getBlock-in-rpcfrom
Conversation
- Created TransactionStatusMetaBuilder type for writing transaction metadata to the ledger - Created BlockReward type for block-level reward tracking - Added unix_timestamp (block_time) and rewards fields to SlotState - Updated unit tests to cover new fields and types
- Write TransactionStatusMeta for RPC getBlock/getTransaction - Store block rewards and unix timestamp when rooting slots - Add SPL token parsing and transaction cost model
…lumbing - Thread slot_block_time through clock sysvar updates so replay/rooting can access unix timestamps directly - Adjust getBlock handling to use stored block_time and tighten version checks - Add ExecutedTransaction.total_cost() and use it for CU accounting - Relax u8 index panics in transaction status inner-instruction/token balance builders - Minor cleanups/refactors across replay, cost model, and SPL token parsing
Specify std.atomic.Value(i64) type on slot_block_time declarations to fix type inference.
…acks - Add confirmed commitment path matching Agave's two-phase lookup flow - Fall back to blockstore for block_time, block_height, and rewards when SlotTracker has pruned the slot - Fix Reward.fromLedgerReward to dupe pubkey string instead of parsing
Use unix_timestamp.load(.monotonic) for live slot data accuracy.
- Add AccountKeys and ReservedAccountKeys for key segment iteration - Create parse_instruction module with parsers for known programs - Refactor transaction encoding with encodeWithOptions helper - Rename types to use Ui prefix for RPC wire format consistency - Fix transaction version handling in encodeTransactionWithMeta
- Update transaction version to use a labeled block - Rename SPL_ASSOCIATED_TOKEN_ACCOUNT_ID to SPL_ASSOCIATED_TOKEN_ACC_ID - Remove commented-out ParsedInstruction union code - Add doc comment for ParsedInstruction struct - Apply consistent formatting to pubkeyToValue calls
…on metadata - Replace string pubkeys/hashes with typed Pubkey/Hash/Signature throughout - Add FallbackAccountReader to check both writes and account store for mints - Add custom jsonStringify methods for proper Agave-compatible serialization - Remove unnecessary manual memory freeing for typed fields - Fix inner instructions to use UiInstruction union type - Support all transaction encoding formats (binary/base58/base64/json)
- Change UiInstruction.parsed to store a pointer instead of value - Add allocParsed helper to heap-allocate parsed instructions - Reduces union size by avoiding large inline struct
…zation - Add BlockRewards init, push, reserve, and toLedgerRewards tests - Add KeyedRewardInfo.toLedgerReward conversion test - Add AccountKeys tests for static/dynamic key handling - Add ParsableProgram.fromID tests for known and unknown programs - Add parseMemoInstruction and parseInstruction tests - Add initial GetBlock response serialization tests - Add spl_token realNumberString formatting tests
…on methods - Add tests for convertReturnData with base64 encoding - Add tests for convertLoadedAddresses with empty and populated data - Add tests for convertTokenBalances with single/multiple balances - Add tests for convertInnerInstructions with various scenarios - Add tests for convertRewards and convertBlockRewards - Add tests for encodeTransaction with different encodings - Add tests for encodeTransactionWithMeta version handling - Add tests for encodeWithOptionsV2 transaction details modes - Add tests for UiTransactionStatusMeta.from with all field types
…ost model, system program, and SPL token - Add tests for TransactionError JSON serialization (AccountInUse, AccountNotFound, etc.) - Add tests for TransactionStatusMetaBuilder helper methods - Add tests for cost model constants and TransactionCost methods - Add tests for system program allocate/assign instructions - Add extensive SPL token parsing and balance tests
- Rename encodeWithOptionsV2 to encodeWithOptions - Extract validateVersion for cleaner version handling - Refactor encodeTransactionWithMeta/encodeTransaction for clarity - Add jsonEncodeTransaction and jsonEncodeTransactionMessage - Add parseUiTransactionStatusMeta for jsonParsed encoding - Allow finalized slots to be served even if pruned from SlotTracker
- Add show_rewards parameter to UiTransactionStatusMeta.from() - Return null for rewards when show_rewards is false
- Remove unix_timestamp and rewards from SlotState, write directly to ledger - Simplify setRoots by removing per-slot metadata (block_time, height, rewards) - Write block_time/block_height to ledger when tracking new slots - Fix JSON serialization for u8 slices to match Agave's serde format - Remove unused BlockRewards, KeyedRewardInfo and associated tests
- Add UiMessage union type for parsed and raw message representations - Implement parseLegacyMessageAccounts and parseV0MessageAccounts - Create LoadedMessage struct for v0 transaction account resolution - Add isMaybeWritable and related helper methods to Message - Fix inner instruction index tracking in TransactionStatusMetaBuilder - Use realNumberStringTrimmed for token UI amount formatting
- Remove unnecessary i64 casts, use u64 directly for lamports - Change commission from optional u8 to plain u8 - Remove redundant doc comments
- Implement accounts for transactionDetails returning signatures and parsed account keys - Add JsonSkippable wrapper type for conditional field serialization - Refactor UiTransactionStatusMeta to use JsonSkippable for optional fields - Remove unnecessary deploy logging in bpf_loader
- Add TransactionStatusMetaBuilder tests for null sub-fields and loaded addresses - Add JsonSkippable serialization tests for value/skip/none states - Add ParsedAccount and AddressTableLookup serialization tests - Add UiRawMessage and UiParsedMessage serialization tests - Add UiTransactionStatusMeta.from tests for version and rewards handling - Add BlockHookContext helper function tests
- Move TransactionEncoding and TransactionDetails to common module - Separate legacy and v0 transaction message encoding paths - Add support for transactions without metadata (missing_metadata variant) - Simplify encodeBlockWithOptions to return Response directly - Always include loadedAddresses in UiTransactionStatusMeta
Extract ReservedAccountKeys alias to struct level and fix memory cleanup to use defer for consistent resource release
Prevents potential memory issues by using constSlice instead of slice
- Add getTransaction handler with commitment, encoding, and version support - Define Response type with custom JSON serialization to flatten fields - Add jsonParseFromValue to Signature for request param parsing - Add deinit methods to ConfirmedTransactionWithStatusMeta and TransactionWithStatusMeta
Codecov Report❌ Patch coverage is
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
Eliminate duplicated parsing logic by delegating to jsonParseFromValue.
…saction - Route confirmed requests through getCompleteTransaction - Route finalized requests through getRootedTransaction - Move processed commitment check into switch for clarity
90fdd5e to
47b0463
Compare
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.
Intent
getTransactionRPC methodImplementation
jsonParseFromValuetosig.core.Signaturerpc.methods.GetTransactiontypesgetTransactionto the rpc hook context defininggetBlockRamifications
N/A
Tests
test_serialize.rs