Serialize lamports per signature#25364
Conversation
cc9ea02 to
76cf6fe
Compare
76cf6fe to
8e699a9
Compare
3aa6098 to
5baba2c
Compare
Codecov Report
@@ Coverage Diff @@
## master #25364 +/- ##
=========================================
Coverage 82.0% 82.0%
=========================================
Files 655 620 -35
Lines 171822 170582 -1240
Branches 335 0 -335
=========================================
- Hits 140972 140027 -945
+ Misses 30734 30555 -179
+ Partials 116 0 -116 |
brooksprumo
left a comment
There was a problem hiding this comment.
Overall looks good! Sorry about the long review delay...
brooksprumo
left a comment
There was a problem hiding this comment.
Thanks for the previous replies; this PR looks good.
One last question is on the decision to put lamports_per_signature as a new field in the returned tuple from serialize_bank_and_storage():
solana/runtime/src/serde_snapshot/newer.rs
Lines 208 to 211 in 5baba2c
Instead, would it be possible to put lamports_per_signature at the end of DeserializableVersionedBank with the serde default_on_eof?
#[serde(deserialize_with = "default_on_eof")]
lamports_per_signature: u64,solana/runtime/src/serde_snapshot/newer.rs
Lines 29 to 63 in 5baba2c
That's how historical_roots is handled for AccountsDbFields:
solana/runtime/src/serde_snapshot.rs
Lines 67 to 78 in 5baba2c
That may make the impl simpler. Sorry if you already tried doing this but I missed it!
|
That was actually my initial approach see here (https://github.com/solana-labs/solana/pull/25181/files). Turns out it doesn't Because of this |
* Serialize lamports per signature * Add full snapshot archive test, enable features in previous tests (cherry picked from commit 8caced6) # Conflicts: # runtime/src/serde_snapshot.rs # runtime/src/serde_snapshot/newer.rs # runtime/src/serde_snapshot/tests.rs
* Serialize lamports per signature * Add full snapshot archive test, enable features in previous tests (cherry picked from commit 8caced6) # Conflicts: # runtime/src/serde_snapshot.rs # runtime/src/serde_snapshot/newer.rs # runtime/src/serde_snapshot/tests.rs
Problem
The
FeeRateGovernorin a bank does not serialize its currentlamports_per_signatureon snapshot. This causes issues if the block that we start a snapshot from is lined up with a fee increase, it is possible for thislamports_per_signatureto be invalid.Summary of Changes
Serialize and deserialize this field by accessing it from the
FeeRateGovernorTo avoid the same issue as #25181, we manually serialize it as an extra field at the end of the snapshot. The issue with the previous solution was that we serialized it as part of the bank which caused problems as the accounts db fields were serialized after it.
Fixes #23545