Fix nonce fee_calculator overwrite#10973
Conversation
f1e9c6e to
f6c6e04
Compare
|
1.1 backport as well? |
I say yes, assuming there will be more 1.1 releases. |
Yep on demand as needed until we upgrade mainnet-beta to 1.2. Are we going to need to gate the rollout of this PR? It looks like it might cause a bank hash difference with/without |
t-nelson
left a comment
There was a problem hiding this comment.
lgtm! Nice catch 🙏
👍 v1.1 backport
It's actually fairly unlikely to cause a bank hash mismatch, since cluster fees aren't moving afaict. But it is technically possible. |
Ah, ok. Phew. Yeah with the low TPS right now on mainnet-beta it's very unlikely that the fee would increase during an affected slot.
Essentially for each operating_mode, we pick a slot or epoch when we want to switch over from the old to new behavior. Then for testnet/mainnet-beta, ensure everybody upgrades before that slot/epoch hits |
Does this mean you are okay forgoing the gating? @mvines |
Codecov Report
@@ Coverage Diff @@
## master #10973 +/- ##
=========================================
- Coverage 82.1% 82.1% -0.1%
=========================================
Files 318 318
Lines 72747 72804 +57
=========================================
+ Hits 59782 59823 +41
- Misses 12965 12981 +16 |
* Add failing test * Pass fee_calculator to prepare_if_nonce_account; only overwrite in error case (cherry picked from commit 25228ca)
* Add failing test * Pass fee_calculator to prepare_if_nonce_account; only overwrite in error case (cherry picked from commit 25228ca)
* Fix nonce fee_calculator overwrite (#10973) * Add failing test * Pass fee_calculator to prepare_if_nonce_account; only overwrite in error case (cherry picked from commit 25228ca) * v1.1 transaction builder Co-authored-by: Tyera Eulberg <teulberg@gmail.com> Co-authored-by: Tyera Eulberg <tyera@solana.com>
| if let State::Initialized(ref data) = state { | ||
| let new_data = Versions::new_current(State::Initialized(nonce::state::Data { | ||
| blockhash: last_blockhash_with_fee_calculator.0, | ||
| fee_calculator: last_blockhash_with_fee_calculator.1.clone(), |
There was a problem hiding this comment.
@CriesofCarrots I think this causes diverged bank hash because patched validator and unpatched validator save different things into the AccountsDB if tx_result.is_err().
So, I guess this needs gated release, actually.
There was a problem hiding this comment.
Unless we're seeing any fee fluctuation, I don't think this saves anything different if tx_result.is_err(). I think the issue may actually be with the success case, because the blockhash returned from the blockhashes sysvar in system_instruction_processor (and retained in the nonce account as of this pr) may not be the same as that returned from the bank.last_blockhash_with_fee_calculator. @t-nelson , can you confirm?
There was a problem hiding this comment.
@CriesofCarrots I believe they should match. The RecentBlockhashes sysvar is updated in Bank::new_from_parent() and we don't touch bank.blockhash_queue until the next slot boundary
There was a problem hiding this comment.
@t-nelson see test at CriesofCarrots@5239ed4
I believe there is one tick at the block boundary where that isn't true
Problem
The fee calculator in a nonce account will never update from its initial value, even as cluster tx fees change and the nonce is used. This is because
prepare_if_nonce_account(), intended to advance the nonce on an InstructionError, always overwrites the fee_calculator with the account's original fee calculator.Summary of Changes
prepare_if_nonce_account()so that it updates to the correct fee calculatorsolana/sdk/src/nonce/account.rs
Line 66 in 4ef8f89
Enables failing test in #10967