-
Notifications
You must be signed in to change notification settings - Fork 978
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
Replay protection storage optimization #1977
Conversation
895eaf2
to
9178c79
Compare
9178c79
to
8cf0901
Compare
8cf0901
to
7d476fb
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.
Can we call write_tx_hash
or other functions for replay protection without wl_storage.write_log
? I mean wl_storage.write_tx_hash()
.
There are many callers with wl_storage.write_log
or wl_storage.storage
. They are a bit confusing because they are not clear when these data are persistent in the storage. (Some bugs happened before by writing data with wl_storage.storage
directly before the block commit. I think that the direct write to the storage only for testing.
//! - `pred`: predecessor values of the top-level keys of the same name | ||
//! - `tx_queue` | ||
//! - `next_epoch_min_start_height` | ||
//! - `next_epoch_min_start_time` | ||
//! - `replay_protection` |
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 this stored in the state
column family?
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.
Ah no, this is a typo
7d476fb
to
f77aee3
Compare
f77aee3
to
1a00430
Compare
So the keys for replay protection are meant to be written even in case the transaction failed, so the |
Reexposing the functions in |
1a00430
to
4fca277
Compare
* origin/grarco/replay-protection-storage: Changelog #1977 Expose replay protection methods from `WlStorage` Reworks replay protection check Fixes check for replay protection keys Writes only one hash at a time for replay protection Removes wrapper hash when committed inner tx Renames `finalize_tx_hashes` Fixes unit tests Improves replay protection `WriteLog` API New field in `WriteLog` for replay protection changes Refactors replay protection helper functions Updates `DB` and `DBIter` traits for replay protection Removes replay protecion internal address and vp Renames replay protection storage key getter Removes hacky solution for replay protection merkle tree Writes replay protection keys under separate storage root Replay protection column family and related methods in `DB` trait and `Storage`
* origin/grarco/replay-protection-storage: Changelog #1977 Expose replay protection methods from `WlStorage` Reworks replay protection check Fixes check for replay protection keys Writes only one hash at a time for replay protection Removes wrapper hash when committed inner tx Renames `finalize_tx_hashes` Fixes unit tests Improves replay protection `WriteLog` API New field in `WriteLog` for replay protection changes Refactors replay protection helper functions Updates `DB` and `DBIter` traits for replay protection Removes replay protecion internal address and vp Renames replay protection storage key getter Removes hacky solution for replay protection merkle tree Writes replay protection keys under separate storage root Replay protection column family and related methods in `DB` trait and `Storage`
* origin/grarco/replay-protection-storage: Changelog #1977 Expose replay protection methods from `WlStorage` Reworks replay protection check Fixes check for replay protection keys Writes only one hash at a time for replay protection Removes wrapper hash when committed inner tx Renames `finalize_tx_hashes` Fixes unit tests Improves replay protection `WriteLog` API New field in `WriteLog` for replay protection changes Refactors replay protection helper functions Updates `DB` and `DBIter` traits for replay protection Removes replay protecion internal address and vp Renames replay protection storage key getter Removes hacky solution for replay protection merkle tree Writes replay protection keys under separate storage root Replay protection column family and related methods in `DB` trait and `Storage`
Describe your changes
Addresses #1566.
Moves the replay protection storage outside of
subspace
to prevent writing the diff keys (still keeps the keys written at the previous height to allow for a rollback). Removes the previous solution to prevent merkelizing the replay protection keys which isn't needed anymore. Finally, implements a small optimization for which only one hash for tx is ever needed in storage (either the wrapper or the inner one, instead of both).Improves unit tests.
Indicate on which release or other PRs this topic is based on
v0.23.0
Checklist before merging to
draft