Skip to content

Create TransactionFrame for ABIv2#9800

Merged
LucasSte merged 14 commits intoanza-xyz:masterfrom
LucasSte:tx-frame
Jan 13, 2026
Merged

Create TransactionFrame for ABIv2#9800
LucasSte merged 14 commits intoanza-xyz:masterfrom
LucasSte:tx-frame

Conversation

@LucasSte
Copy link
Copy Markdown

@LucasSte LucasSte commented Jan 5, 2026

Problem

In order for ABIv2 to work, we need a TransactionFrame that is going to share transaction information with programs. The frame follows the design for transaction metadata described in SIMD-0177.

Summary of Changes

  1. Create the new data structure and populate its fields accordingly.
  2. Create a new function configure_cpi_instruction to facilitate the management of some inner fields.

@mergify
Copy link
Copy Markdown

mergify bot commented Jan 5, 2026

The Firedancer team maintains a line-for-line reimplementation of the
native programs, and until native programs are moved to BPF, those
implementations must exactly match their Agave counterparts.
If this PR represents a change to a native program implementation (not
tests), please include a reviewer from the Firedancer team. And please
keep refactors to a minimum.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jan 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.5%. Comparing base (c80998c) to head (fd08697).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #9800    +/-   ##
========================================
  Coverage    82.5%    82.5%            
========================================
  Files         844      844            
  Lines      316364   316472   +108     
========================================
+ Hits       261228   261320    +92     
- Misses      55136    55152    +16     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LucasSte LucasSte marked this pull request as ready for review January 5, 2026 21:01
@LucasSte LucasSte requested a review from a team as a code owner January 5, 2026 21:01
nagisa
nagisa previously approved these changes Jan 6, 2026
Copy link
Copy Markdown

@nagisa nagisa left a comment

Choose a reason for hiding this comment

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

LGTM on the implementation itself, can't really provide a review on the overarching design yet, though.

nagisa
nagisa previously approved these changes Jan 7, 2026
Copy link
Copy Markdown

@nagisa nagisa left a comment

Choose a reason for hiding this comment

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

LGTM, but maybe worth getting a stamp from somebody else as well.

@LucasSte
Copy link
Copy Markdown
Author

LucasSte commented Jan 7, 2026

LGTM, but maybe worth getting a stamp from somebody else as well.

@Lichtso

self.get_instruction_context_at_index_in_trace(index_in_trace)
}

pub fn configure_cpi_instruction(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is there a reason to factor this out of configure_next_instruction() without parent_index being the optional?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

We only increment the number of instructions during a CPI, so I thought I could split it out. If you wish, I can put back everything together.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yep, I would like it to stay one function.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 6d42301

.transaction_frame
.number_of_instructions
.saturating_add(1);
self.transaction_frame.cpi_scratchpad = VmSlice::new(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How is this not necessary at the top-level instructions too? Or rather how can you have any CPI if only already CPI-ed instructions can do more CPI?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It should be done for top-level instructions too. I did it wrong.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 6d42301

),
current_executing_instruction: 0,
number_of_instructions: number_of_instructions as u16,
number_of_executed_cpis: 0,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Wouldn't it be more useful to have the total_number_of_top_level_instructions here and if somebody really needs the number_of_executed_cpis they calculate number_of_instructions - total_number_of_top_level_instructions?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I don't think it makes much of a difference, and, at the same time, I can't really foresee which parameter users will need more: number of executed CPIs or number of top level instructions.

I followed one suggestion given in this comment: solana-foundation/solana-improvement-documents#177 (comment)

PS: total_number_of_top_level_instructions doesn't need to have the total_ prefix, since this number never changes.

Copy link
Copy Markdown

@Lichtso Lichtso Jan 13, 2026

Choose a reason for hiding this comment

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

Well, without the prefix it could also mean number_of_top_level_instructions_executed_so_far, which is the top_level_instruction_index

Lichtso
Lichtso previously approved these changes Jan 13, 2026
@LucasSte LucasSte added this pull request to the merge queue Jan 13, 2026
Merged via the queue into anza-xyz:master with commit 552674f Jan 13, 2026
47 checks passed
@LucasSte LucasSte deleted the tx-frame branch January 13, 2026 17:05
@Lichtso Lichtso added this to SVM Jan 15, 2026
@github-project-automation github-project-automation bot moved this to Done in SVM Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants