-
Notifications
You must be signed in to change notification settings - Fork 200
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
agave-transaction-ffi #2125
base: master
Are you sure you want to change the base?
agave-transaction-ffi #2125
Conversation
cd2b21d
to
5f7ec9c
Compare
LGTM. Should we plan to have this in solana docs as it could be useful to a wider audience? |
|
||
extern "C" fn iter_accounts<Tx: SVMTransaction>( | ||
transaction_ptr: TransactionPtr, | ||
callback: AccountCallback, |
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.
this looks similar to any_of/none_of algorithm? https://cplusplus.com/reference/algorithm/none_of/ ?
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.
Yeah a bit similar to those in that we will stop iteration if the callback returns false for any element; but the iter_accounts
itself doesn't return true or false here.
The return of the callback is just used to early exit on some condition, like a break
statement.
Yeah. I need to create a c-header for the structs in the added file as well. The plan is for this to be used in any plugin that needs to inspect transactions; including geyser. Will need to document it somewhere. Not sure the doc-comments that will be on crates.io be enough. |
@lijunwangs added you to this review. This transaction interface should be used in geyser as well instead of |
@lijunwangs - this will soon be a blocking item for moving to the new transaction type. Do you have any comments here? or thoughts on how we should transition geyser to using this interface? |
Transaction is just one of the interface -- what is plan for other information such as account, slot, block etc.? We also need to make sure the interface change in geyser introduce forced minimal changes for existing geyser plugins. |
11e8420
to
ba8a79f
Compare
Yes, transaction is just one of the interfaces. Transaction item is somewhat separate because there are plans to use it for non-geyser plugins for scheduler, hence I have separated it here. Other changes needed to items passed to geyser:
Realistically, there is no way we can make the interface c-compatible without breaking existing code - unless we have a time machine. We could make this an easier transition by adding member functions on the new interfaces. |
To be clear as well. Only the transaction for account updates is blocking work on the new transaction type. |
@lijunwangs c09fc1a added a bit simpler rust interface so rust users can transition more easily. |
@lijunwangs not having an abstract interface here (and then used in geyser) is making us have ugly code in #2820 |
/// Given a reference to any type that implements `SVMTransaction`, create a | ||
/// `TransactionInterface` that can be used to interact with the transaction in | ||
/// C-compatible code. This interface is only valid for the lifetime of the | ||
/// transaction reference, which cannot be guaranteed by this function interface. |
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.
not sure this is strictly true, possibly could add an unsized marker to the TransactionInterface
to hold the lifetime 🤔
Problem
Summary of Changes
SVMTransaction
traitFixes #