-
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
Add feature for tracking dynamic reserved account set #34901
Conversation
1ac031e
to
a1ddd7b
Compare
35d4efd
to
3b98447
Compare
oof. the number of touch points here begs a refactor... i'm going to have to look at it more closely 🤔 |
I don't disagree that a refactor of transaction / message types should be done at some point but I would like to point out that the plumbing for |
5725338
to
bf8a046
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #34901 +/- ##
=========================================
- Coverage 81.7% 81.7% -0.1%
=========================================
Files 834 830 -4
Lines 224232 224570 +338
=========================================
+ Hits 183382 183476 +94
- Misses 40850 41094 +244 |
Is it possible to break this up into logical commits? Right now, review is horrible. |
bf8a046
to
71a02bd
Compare
71a02bd
to
8685df2
Compare
I split it up.. apologies for not doing that earlier! The PR description includes a detailed breakdown of each commit as well. |
Would you prefer I open a pr for each individual commit? Also, considering that 2.0 is coming soon, breaking changes should be an issue? |
@CriesofCarrots @t-nelson ping on this! |
Sorry for the delay. This is on my list for tomorrow. Is it worth waiting on a rebase at this point? |
ea9e3ca
to
701119b
Compare
@CriesofCarrots I just rebased! |
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.
Phew, okay, I think I got through everything. (Commit 5 was a bear; splitting out test fixes from other updates might have been nice to draw attention to the critical code paths.)
Generally, looks good to me; just one api suggestion. I didn't catch any issues with the feature/list handling.
The banking_stage changes look straightforward to me, but it might be worth having an module expert sanity check.
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.
lgtm, but recommend at least one more set of eyes on everything
This repository is no longer in use. Please re-open this pull request in the agave repo: https://github.com/anza-xyz/agave |
Problem
There's no way to add new builtin programs and sysvars to the list of read-only reserved accounts.
Summary of Changes
Bank now tracks a dynamic set of reserved account keys which gets updated on epoch boundaries with feature activations. The set of reserved account keys needs to get passed to all the transaction and message constructors and then we take advantage of the is_writable cache to avoid passing the reserved account set to
is_writable
everywhere. It's inevitable that a change like this will result in breaking changes unfortunately. There is an option of moving towards using more internal sdk crates (likesolana-runtime-transactions
) for core types rather than thrashing the external sdk whenever internal needs change, but that's a pretty big effort.Detailed changes
1fa7b7d: refactors tests to minimize diff size when plumbing reserved accounts
c8cb15f: adds the zk token module to the sdk so that reserved accounts can reference the program id
9ea7043: removes the
TryFrom<Message>
impl forSanitizedMessage
and replaces it withSanitizedMessage::try_from_legacy_message
which will allow plumbing the reserved accounts throughedbdf6f: adds
Message::is_maybe_writable
for times when the reserved accounts set is not available but we want a rough guess still (cli output, durable nonce checking in rpc, etc)8fb6616: is the meat of the change, it introduces the reserved accounts module, adds it to bank, and plumbs the reserved accounts set everywhere
701119b: deprecates uses of static lists of sysvars and builtins. Unfortunately the lists themselves can't be deprecated due to use of
lazy_static
solana_program::message::is_builtin_key_or_sysvar
functionsolana_program::sysvar::is_sysvar_id
functionis_sysvar_id
which a check for owner equal to sysvarBreaking changes:
solana_rpc_client::rpc_client::SerializableTransaction::uses_durable_nonce
tomaybe_uses_durable_nonce
to prevent misusesolana_sdk::transaction::uses_durable_nonce
tomaybe_uses_durable_nonce
to prevent misusesolana_sdk::transaction::VersionedTransaction::uses_durable_nonce
tomaybe_uses_durable_nonce
to prevent misusesolana_sdk::transaction::SanitizedTransaction::try_from_legacy_transaction
has a newreserved_account_keys
argumentsolana_sdk::transaction::SanitizedTransaction::try_create
has a newreserved_account_keys
argumentsolana_sdk::transaction::SanitizedTransaction::try_new
has a newreserved_account_keys
argumentsolana_program::message::Message::is_writable
has a newreserved_account_keys
argumentsolana_program::message::Message::get_account_keys_by_lock_type
has a newreserved_account_keys
argumentsolana_program::message::LegacyMessage::new
has a newreserved_account_keys
argumentsolana_program::message::SanitizedMessage::try_new
has a newreserved_account_keys
argumentsolana_program::message::LoadedMessage::new
has a newreserved_account_keys
argumentsolana_program::message::LoadedMessage::new_borrowed
has a newreserved_account_keys
argumentsolana_program::message::SanitizedMessage
no longer implementsTryFrom<Message>
(I added atry_from_legacy_message
method instead in order to pass thereserved_account_keys
argument)Feature Gate Issue: #34899