Skip to content

feat(rpc): implement getTransaction#1250

Open
ajw221 wants to merge 40 commits intoadamw/implement-getBlock-in-rpcfrom
adamw/implement-getTransaction-in-rpc
Open

feat(rpc): implement getTransaction#1250
ajw221 wants to merge 40 commits intoadamw/implement-getBlock-in-rpcfrom
adamw/implement-getTransaction-in-rpc

Conversation

@ajw221
Copy link
Contributor

@ajw221 ajw221 commented Feb 23, 2026

Intent

  • Implement getTransaction RPC method

Implementation

  • Added jsonParseFromValue to sig.core.Signature
  • Corrected rpc.methods.GetTransaction types
  • Added getTransaction to the rpc hook context defining getBlock

Ramifications

N/A

Tests

  • Added GetTransaction test to test_serialize.rs

- 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
@github-project-automation github-project-automation bot moved this to 🏗 In progress in Sig Feb 23, 2026
@ajw221 ajw221 changed the base branch from main to adamw/implement-getBlock-in-rpc February 23, 2026 23:34
@ajw221 ajw221 self-assigned this Feb 24, 2026
@codecov
Copy link

codecov bot commented Feb 24, 2026

Codecov Report

❌ Patch coverage is 89.65517% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/core/signature.zig 0.00% 3 Missing ⚠️
Files with missing lines Coverage Δ
src/ledger/Reader.zig 89.67% <ø> (ø)
src/rpc/methods.zig 83.13% <100.00%> (+0.58%) ⬆️
src/rpc/test_serialize.zig 100.00% <100.00%> (ø)
src/core/signature.zig 54.83% <0.00%> (-30.17%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Eliminate duplicated parsing logic by delegating to jsonParseFromValue.
@ajw221 ajw221 marked this pull request as ready for review February 24, 2026 19:05
@ajw221 ajw221 requested review from dnut, ultd and yewman as code owners February 24, 2026 19:05
…saction

- Route confirmed requests through getCompleteTransaction
- Route finalized requests through getRootedTransaction
- Move processed commitment check into switch for clarity
@ajw221 ajw221 force-pushed the adamw/implement-getBlock-in-rpc branch 2 times, most recently from 90fdd5e to 47b0463 Compare February 26, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🏗 In progress

Development

Successfully merging this pull request may close these issues.

1 participant