-
Notifications
You must be signed in to change notification settings - Fork 264
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
AddressLoader: allow for non-owned MessageAddressTableLookup #2592
Conversation
I hate adding something new to
|
@jstarry think you're familiar with loading. Please let me know what you think. @LucasSte relevant to the new Another option would be to move this out of |
Can you explain more why you wouldn't have owned data or even a slice of lookups? |
The new transaction type(s) that are in progress, do not deserialize data in the same way our current transaction types. There's no forced allocation - the transaction accesses fields directly from the packet data and some cached offsets. Some difficulty comes with the instructions and ATLs in the message, since these structs do not have fixed serialized sizes (because their internal vecs are serialized inline). |
Got it, makes sense to me. Can we add a new |
That seems reasonable. It seems we could move this new trait out of For edit: Thinking for a moment, I think runtime is probably good. This address resolver is ideally non-public (imo). It should be meant strictly for our runtime to prepare transactions for execution, not used by users. |
Yeah runtime sounds reasonable to me. Note that it's still useful for users to construct a |
Yeah, my thinking is we won't change |
54ba97b
to
969017e
Compare
|
||
impl Bank { | ||
/// Load addresses from an iterator of `MessageAddressTableLookupRef`. | ||
pub fn load_addresses_from_ref<'a>( |
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.
Don't even need a trait - this is just a function on Bank
. We will/can use this for resolving our transactions inside core/runtime.
@@ -103,6 +103,27 @@ impl AddressTableLookupMeta { | |||
} | |||
} | |||
|
|||
/// A non-owning version of `MessageAddressTableLookup`. | |||
pub struct MessageAddressTableLookupRef<'a> { |
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.
struct defined here because ideally this is the same type that Bank
's function takes. If same struct, needs to be somewhere that's accessible to both transaction-view and runtime, so this made more sense to me. I don't think it makes much sense to put this in its' own crate for something so simple; nor does it belong in svm-transaction since those are already resolved and SVM needs no knowledge of these.
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.
Iterator to access these using TransactionMeta
is not here yet, want to agree on where this lives and I'll do a follow-up PR to add the iterator once this is settled.
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.
Welp - turns out I am actually dumb. I already have the type I need, from svm-transaction
.
It is there beacuse we (sometimes) need to re-sanitize transactions in the runtime - though that's not explicitly part of SVM.
self.load_addresses_from_ref( | ||
address_table_lookups | ||
.iter() | ||
.map(MessageAddressTableLookupRef::from), | ||
) |
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.
It is advantageous to add another indirection before calling the function? It seems to me that we are doing more work to first create the references then to call the function.
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.
Change here will not make this any faster - and you're right, it may even be slightly slower (copying a reference and 2 slice ptrs => ~40 bytes).
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.
^ To clarify - we do this mapping so we can use a shared implementation. Not for a specific benefit to the current function.
Additionally, the plan is for this function to not be called in our processing pipeline.
bbef458
to
ff011e0
Compare
Problem
MessageAddressTableLookup
nor do we have a slice.AddressLoader
is overly restrictiveSummary of Changes
AddressLoader
which allows a for a non-owning iteratorFixes #