-
Notifications
You must be signed in to change notification settings - Fork 239
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
SVM: account_loader.rs generic over SVMMessage #2303
Conversation
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.
Woohoo!
AccountSharedData::from(Account { | ||
data: construct_instructions_data(&message.decompile_instructions()), | ||
data: construct_instructions_data(&decompiled_instructions), |
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.
The original decompile_instructions
function is also used in benchmarks and some tests. Have you considered adding it to your trait?
I am thinking that these new lines may become repeated code at some point.
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 originally had it as a function, but the only part in actual code it was called was here. Removed as part of the trait simplification.
But also wanted to remove the allocation that BorrowedInstruction
requires:
pub struct BorrowedInstruction<'a> {
pub program_id: &'a Pubkey,
pub accounts: Vec<BorrowedAccountMeta<'a>>, //<-- allocation here
pub data: &'a [u8],
}
In this first step I'm just doing a drop-in replacement where we still do this allocation.
As a follow-up I will write a version of construct_instructions_data
(and its' input) that require no allocations).
This was the reasoning I had behind not having this as part of the trait.
51039e7
to
7d33ed7
Compare
rebased on master to remove the dependency add commit - last time I relied on auto-merging it seemed to break CI: see #2388 |
Problem
#2109 - for SVM to be generic over transaction/message type, account_loader.rs must be generic over the traits
Summary of Changes
account_loader.rs
generic overSVMMessage
Fixes #2109