-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MessageProcessor::process_message() returns the accounts data len delta, and the bank uses the value to update its accounts_data_len field #21807
MessageProcessor::process_message() returns the accounts data len delta, and the bank uses the value to update its accounts_data_len field #21807
Conversation
Codecov Report
@@ Coverage Diff @@
## master #21807 +/- ##
=========================================
- Coverage 81.3% 81.3% -0.1%
=========================================
Files 515 515
Lines 144033 144044 +11
=========================================
- Hits 117126 117111 -15
- Misses 26907 26933 +26 |
@@ -118,7 +125,7 @@ impl MessageProcessor { | |||
); | |||
timings.accumulate(&invoke_context.timings); | |||
} | |||
Ok(()) | |||
Ok(ProcessedMessageInfo::default()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now just return a default value. The next PR (here) will fill this in with real values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you planning to return the updated meter value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep! Here's a snippet from the next PR:
solana/runtime/src/message_processor.rs
Lines 130 to 132 in 3393d2e
Ok(ProcessedMessageInfo { | |
accounts_data_len_delta: invoke_context.get_accounts_data_meter().take().consumed(), | |
}) |
@jackcmay Let me know if there's any questions on this PR, or if you'd like me to run it by anyone else. TIA! |
@@ -56,7 +63,7 @@ impl MessageProcessor { | |||
sysvars: &[(Pubkey, Vec<u8>)], | |||
blockhash: Hash, | |||
lamports_per_signature: u64, | |||
) -> Result<(), TransactionError> { | |||
) -> Result<ProcessedMessageInfo, TransactionError> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As already discussed on Slack, this part here will most likely change when accounts
are passed back directly (not by Rc
through the parameters). Because the accounts
need to be always returned and this struct only on success, it would become somewhat messy. But I am not sure yet, what a good solution would be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remind why we are passing the accounts back in the return value rather then shared access with Rc
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see an explanation in those prs as to why we must get rid of Rc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, I removed that when splitting the PRs, will add it back in.
The short version is that we can't serialize a Rc
, so we would have to wrap / unwrap it twice in process_message()
which is completely unnecessary. And ABIv2 is all about getting rid of such unnecessary copy steps.
Problem
The bank doesn't get accounts data len changes from MessageProcessor, so it cannot account for any changes.
For more context see the main issue #21604
Summary of Changes
MessageProcessor::process_message() returns the accounts data len delta, and the bank uses the value to update its accounts_data_len field