Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

transaction-status: Add return data to meta #23688

Merged
merged 5 commits into from
Mar 22, 2022

Conversation

joncinque
Copy link
Contributor

Problem

Programs can set return data, but that information isn't propagated outside of programs.

Summary of Changes

Expose all return data information by adding it in TransactionStatusMeta and TransactionSimulationResults. For (slightly?) easier review, the first commit is just adding all of the wiring everywhere to expose in the meta, and the second commit is all about adding it to simulations.

The bank only propagates return data if it's not all 0, and cuts off at the first non-zero byte starting from the end.

Fixes #

@codecov
Copy link

codecov bot commented Mar 16, 2022

Codecov Report

Merging #23688 (7c3fae0) into master (1535748) will decrease coverage by 0.0%.
The diff coverage is 93.4%.

❗ Current head 7c3fae0 differs from pull request most recent head 68abb15. Consider uploading reports for the commit 68abb15 to get more accurate results

@@            Coverage Diff            @@
##           master   #23688     +/-   ##
=========================================
- Coverage    81.7%    81.7%   -0.1%     
=========================================
  Files         583      580      -3     
  Lines      158720   158428    -292     
=========================================
- Hits       129767   129528    -239     
+ Misses      28953    28900     -53     

Copy link
Contributor

@CriesofCarrots CriesofCarrots left a comment

Choose a reason for hiding this comment

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

Just nits and bikeshedding. The meat of this looks good!

validator/src/main.rs Outdated Show resolved Hide resolved
validator/src/main.rs Outdated Show resolved Hide resolved
validator/src/main.rs Outdated Show resolved Hide resolved
cli-output/src/display.rs Outdated Show resolved Hide resolved
@joncinque
Copy link
Contributor Author

Another thing I was thinking about -- are there any concerns with adding fields to RPC return data? Or do all of the old versions of client libraries correctly handle unknown fields?

Comment on lines 67 to 71
) -> (
Vec<TransactionAccount>,
Vec<Vec<InstructionContext>>,
TransactionReturnData,
) {
Copy link
Contributor

Choose a reason for hiding this comment

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

time for a struct!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went with TransactionRecord, let me know if you prefer another name

Copy link
Contributor

Choose a reason for hiding this comment

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

There's already a TransactionRecorder in solana-poh, which is pretty close 🤔

Maybe something like ExecutionRecord?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can get down with that -- done!

@CriesofCarrots
Copy link
Contributor

Another thing I was thinking about -- are there any concerns with adding fields to RPC return data? Or do all of the old versions of client libraries correctly handle unknown fields?

No concerns; adding new fields is acceptable per our backward compatibility policy (and yes, our clients correctly handle unknown fields).

@joncinque
Copy link
Contributor Author

Let me know if you have any other issues, but that should be everything

CriesofCarrots
CriesofCarrots previously approved these changes Mar 21, 2022
Copy link
Contributor

@CriesofCarrots CriesofCarrots left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@mergify mergify bot dismissed CriesofCarrots’s stale review March 21, 2022 20:00

Pull request has been modified.

@joncinque joncinque merged commit 7af4846 into solana-labs:master Mar 22, 2022
@joncinque joncinque deleted the meta-return branch March 22, 2022 22:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants