-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Add RPC support for versioned transactions #22530
Conversation
7bea926
to
8091f1d
Compare
cf6b5dc
to
84699da
Compare
2744901
to
034fa50
Compare
24ea904
to
e1816e3
Compare
34241b9
to
0b54e92
Compare
@@ -389,6 +389,7 @@ Returns identity and transaction information about a confirmed block in the ledg | |||
- (optional) `transactionDetails: <string>` - level of transaction detail to return, either "full", "signatures", or "none". If parameter not provided, the default detail level is "full". | |||
- (optional) `rewards: bool` - whether to populate the `rewards` array. If parameter not provided, the default includes rewards. | |||
- (optional) [Commitment](jsonrpc-api.md#configuring-state-commitment); "processed" is not supported. If parameter not provided, the default is "finalized". | |||
- (optional) `maxSupportedTransactionVersion: <number>` - set the max transaction version to return in responses. If the requested block contains a transaction with a higher version, an error will be returned. |
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.
Sorry, I might be being dense, but I'm not sure I follow why this is necessary for either getBlock
and getTransaction
? We generally consider adding fields to rpc responses as non-breaking, and it looks to me like all the new rpc fields are additive (loadedAddresses
and version
for blocks, addressTableLookups
for transactions).
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.
Is it that you think it's important for clients to receive an error rather than a v0 block/transaction that is just missing those fields? If so, I don't think I agree. Change my mind?
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.
My intent here is that we can totally diverge from keeping backwards compatible fields for future transaction versions if we want.
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.
Is it that you think it's important for clients to receive an error rather than a v0 block/transaction that is just missing those fields? If so, I don't think I agree. Change my mind?
And yes, I also think this is important. Clients might be parsing transactions for certain account keys and if they don't explicitly support the loaded addresses field for v0 transactions, they can totally miss important certain accounts
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.
Hmm, I still don't really love that it forces all clients to upgrade (unexpectedly) when the first v0 transaction comes down the pipe. But to confirm, this won't affect clients querying getBlock
with transactionDetails: none|signatures
, right?
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.
That said, I will start giving this a proper review now :)
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.
What do you envision the client upgrade / feature-activation process looking like? Basically every exchange will be affected.
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.
Hmm, I still don't really love that it forces all clients to upgrade (unexpectedly) when the first v0 transaction comes down the pipe
Yeah, I don't love the forced upgrade either but I do feel like this approach opens the door for us to start iterating on the transaction format. We will likely be changing other things about the format in the future and it's inevitable that clients will need to be upgraded to support new features.
What do you envision the client upgrade / feature-activation process looking like? Basically every exchange will be affected.
The rollout process should look like this:
- Clients are updated with support for handling versioned transactions
- RPC servers and runtime are updated to handle versioned transactions
- Once clients and validators are updated, the feature can be activated
- Users start processing these new versioned transactions
- Old clients will start getting errors when they request blocks / transactions which they don't opt in to receiving
- Users complain and realize they need to update their clients
But to confirm, this won't affect clients querying getBlock with transactionDetails: none|signatures, right?
Correct
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 catch any issues with implementation, just maybe need a little more persuading on the approach ;) One test case would be nice to add.
I also want to sanity-test Blockstore-Bigtable writes and reads -- what's the easiest way to generate and submit a v0 transaction?
expect58 | ||
); | ||
} | ||
|
||
#[test] |
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 know it's a bit of a pita to construct, but would be nice to have a test case demonstrating unsupported tx error for getBlock
to make the effect of one v0 tx clear.
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 rebased off master to get the rpc test refactorings and added a new test test_get_block_with_versioned_tx
This test is a good starting point: solana/core/src/banking_stage.rs Line 3242 in c69e3b7
|
62e5b49
to
be3ce9e
Compare
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.
Okay, thank you for your patience with me. Blockstore/bigtable flow all works, and I guess I am on board with the approach. It feels okay in practice, and I'm stuck coming up with a better one.
Just the question about the AddressLoader bank commitment on this PR
Oh also, incidentally: I hacked together solana-client methods that will submit a VersionedTransaction, and wrote a little program that creates an address-lookup account and submits a v0 transaction using that account. Can share, if it would be helpful.
Yes, that would be great, thanks! |
Here's the solana(-client) branch: https://github.com/CriesofCarrots/solana/tree/tx-v0-client |
Problem
Summary of Changes
max_supported_transaction_version
request parameter to enable receiving versioned transactions in RPC responses and pubsub notifications. This ensures that older clients will get an "unsupported version error" instead of a response for a transaction version they can't parse.version
field to transaction responses when themax_supported_transaction_version
is used whose value is "legacy" string for legacy transactions and a number (ie 0) for versioned transactions.loaded_addresses
field to transaction metadata responses for transactions with version 0address_table_lookups
field to transaction message responses for transactions with version 0Fixes #