Rocks db erasure decoding#1900
Conversation
| pub fn recover(id: &Pubkey, window: &mut [WindowSlot], start_idx: u64, start: usize) -> Result<()> { | ||
| let block_start = start - (start % NUM_DATA); | ||
| pub fn recover( | ||
| id: &Pubkey, |
There was a problem hiding this comment.
this can be removed by now, I think
| assert!(!corrupt, " {} ", id); | ||
|
|
||
| Ok(()) | ||
| assert!(!corrupt, " {} ", id); |
There was a problem hiding this comment.
we have an opportunity to do something about this, now. if we end up with a corrupt blob, let's not put it in the ledger/window?
94b6cf0 to
25415d6
Compare
| } | ||
|
|
||
| assert!(!corrupt); | ||
| if corrupt { |
There was a problem hiding this comment.
cool, but we want to remove or mark as bogus the coding blobs from the ledger? maybe we need a way to say "this is a bogus blob" in the ledger/window...
There was a problem hiding this comment.
Yeah we can do that. I don't know how you would be able to tell which of the coding blobs/data blobs were the one that caused the decoding to fail though. We could remove all the coding blobs, and then say that sending bad erasures is a penalizable transgression.
0f23ddb to
967a0b6
Compare
| db_ledger: &mut DbLedger, | ||
| slot: u64, | ||
| start_idx: u64, | ||
| ) -> Result<(Vec<SharedBlob>, Vec<SharedBlob>)> { |
There was a problem hiding this comment.
also, the function comment doesn't seem accurate, it doesn't take a window anymore.
There was a problem hiding this comment.
The result is a list of reconstructed data and coding blobs returned to the caller for processing.
There was a problem hiding this comment.
Ok, yea just could be indicated with a comment or something, I think a reader of the the function wouldn't realize it just reading the signature.
There was a problem hiding this comment.
For sure, updated the comment
| for i in b_wl.meta.size..size { | ||
| b_wl.data[i] = 0; | ||
| // Add the coding blobs we have into the recovery vector, mark the missing ones | ||
| for i in coding_start_idx..block_end_idx { |
There was a problem hiding this comment.
Seems like a lot of logic to duplicate, can be moved into a function?
199ced2 to
9b9f901
Compare
| use db_ledger::DbLedger; | ||
| use db_window::{find_missing_coding_indexes, find_missing_data_indexes}; | ||
| use packet::{Blob, SharedBlob, BLOB_DATA_SIZE, BLOB_HEADER_SIZE}; | ||
| use result::Result as SolanaResult; |
There was a problem hiding this comment.
The original erasure module used its own version of Result, so I had to import our more generic result under a different name (SolanaResult) in an earlier commit in order to work with it. I ultimately replaced the erasure-specific Result type with the one in result.rs, so this import from the earlier commit can now be deleted.
| return Err(ErasureError::InvalidBlobData); | ||
| } | ||
| Ok(Some(b)) => { | ||
| if b.len() <= BLOB_HEADER_SIZE { |
There was a problem hiding this comment.
I guess we don't support zero-length blobs...
| // Mark the missing memory | ||
| erasures.push(erasure_index); | ||
| blobs.push(SharedBlob::default()); | ||
| missing.push(blobs.last_mut().unwrap().clone()); |
There was a problem hiding this comment.
is this more or less code, compiled, than:
let b = Default::default(); blobs.push(b.clone()); missing.push(b);
?
There was a problem hiding this comment.
That's definitely a lot better, yay!
1503315 to
308aa83
Compare
a447149 to
848f8e6
Compare
| impl Blob { | ||
| pub fn new(data: &[u8]) -> Self { | ||
| let mut blob = Self::default(); | ||
| let data_len = cmp::min(data.len(), blob.data.len()); |
There was a problem hiding this comment.
this won't always be zero?
There was a problem hiding this comment.
blob.data is a fixed size array of size 65408, so it shouldn't be
There was a problem hiding this comment.
ok, I see. we're gonna assert!() that data is small enough to fit?
There was a problem hiding this comment.
Added a check where new() is called in erasure to make sure the data fits.
3f43a6f to
9562b6b
Compare
…ob structure in erasure
b4d445d to
419ed35
Compare
…olana-labs#1888) (solana-labs#1900) * Refactor and additional metrics for cost tracking (solana-labs#1888) * Refactor and add metrics: - Combine remove_* and update_* functions to reduce locking on cost-tracker and iteration. - Add method to calculate executed transaction cost by directly using actual execution cost and loaded accounts size; - Wireup histogram to report loaded accounts size; - Report time of block limits checking; - Move account counters from ExecuteDetailsTimings to ExecuteAccountsDetails; * Move committed transactions adjustment into its own function (cherry picked from commit c3fadac) * rename cost_tracker.account_data_size to better describe its purpose is to tracker per-block new account allocation --------- Co-authored-by: Tao Zhu <82401714+tao-stones@users.noreply.github.com> Co-authored-by: Tao Zhu <tao@solana.com>
…port of solana-labs#1888) (solana-labs#1900)" This reverts commit 0aef62e.
…port of solana-labs#1888) (solana-labs#1900) (solana-labs#1937) Revert "v2.0: Refactor and additional metrics for cost tracking (backport of solana-labs#1888) (solana-labs#1900)" This reverts commit 0aef62e.
Problem
Erasure decoding was relying on the old windows instead of RocksDb.
Summary of Changes
Update decoding of windows to use new RocksDb style ledger. Needs some elements of
#1888 to build, but tests should be passing after that.
Fixes #