Skip to content

Conversation

haritkapadia
Copy link
Contributor

@haritkapadia haritkapadia commented Aug 15, 2025

Description

This PR corrects the instruction index keys used to parse a raw staking activate transaction for Jito.

This PR fixes missing array bounds check in matchTransactionTypeByInstructionsOrder. microsoft/TypeScript#13778

Issue Number

SC-2760

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

I updated the Jito staking activate test to include parsing of the raw transaction and comparing it to the original. The equivalent staking deactivate test already performs this comparison.

The array bounds check bug was caught by existing tests.

@haritkapadia haritkapadia changed the title Harit/jito raw parse fix fix(sdk-coin-sol): set correct jito activate instruction indexes Aug 15, 2025
@haritkapadia haritkapadia force-pushed the harit/jito-raw-parse-fix branch from 86e4db3 to e869f0a Compare August 15, 2025 15:18
@haritkapadia haritkapadia marked this pull request as ready for review August 15, 2025 16:21
@haritkapadia haritkapadia requested a review from a team as a code owner August 15, 2025 16:21
evanzbitgo
evanzbitgo previously approved these changes Aug 15, 2025
const coin = coins.get('tsol');
const tx2 = new Transaction(coin);
tx2.fromRawTransaction(rawTx);
const tx2Builder = factory.from(rawTx);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: give a more meaningful name for readability, e.g. rebuiltTxBuilder

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

      const builderFromRawTx = factory.from(rawTx);
      const rebuiltTx = await builderFromRawTx.build();
      rebuiltTx.toJson().instructionsData.should.deepEqual(txJson.instructionsData);

@haritkapadia haritkapadia merged commit c437137 into master Aug 15, 2025
11 of 12 checks passed
@haritkapadia haritkapadia deleted the harit/jito-raw-parse-fix branch August 15, 2025 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants