This repository has been archived by the owner on Jan 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
uses Option<u64> for SlotMeta.last_index #21775
Merged
behzadnouri
merged 1 commit into
solana-labs:master
from
behzadnouri:slot-meta-last-index
Dec 11, 2021
Merged
uses Option<u64> for SlotMeta.last_index #21775
behzadnouri
merged 1 commit into
solana-labs:master
from
behzadnouri:slot-meta-last-index
Dec 11, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jbiseda
previously approved these changes
Dec 10, 2021
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
Codecov Report
@@ Coverage Diff @@
## master #21775 +/- ##
=========================================
- Coverage 81.6% 81.4% -0.2%
=========================================
Files 511 511
Lines 143320 143590 +270
=========================================
- Hits 116976 116929 -47
- Misses 26344 26661 +317 |
SlotMeta.last_index may be unknown and current code is using u64::MAX to indicate that: https://github.com/solana-labs/solana/blob/6c108c8fc/ledger/src/blockstore_meta.rs#L169-L174 This lacks type-safety and can introduce bugs if not always checked for Several instances of slot_meta.last_index + 1 are also subject to overflow. This commit updates the type to Option<u64>. Backward compatibility is maintained by customizing serde serialize/deserialize implementations.
db0b79f
to
b44fa42
Compare
Pull request has been modified.
mergify bot
pushed a commit
that referenced
this pull request
Dec 11, 2021
SlotMeta.last_index may be unknown and current code is using u64::MAX to indicate that: https://github.com/solana-labs/solana/blob/6c108c8fc/ledger/src/blockstore_meta.rs#L169-L174 This lacks type-safety and can introduce bugs if not always checked for Several instances of slot_meta.last_index + 1 are also subject to overflow. This commit updates the type to Option<u64>. Backward compatibility is maintained by customizing serde serialize/deserialize implementations. (cherry picked from commit e08139f)
mergify bot
added a commit
that referenced
this pull request
Dec 11, 2021
SlotMeta.last_index may be unknown and current code is using u64::MAX to indicate that: https://github.com/solana-labs/solana/blob/6c108c8fc/ledger/src/blockstore_meta.rs#L169-L174 This lacks type-safety and can introduce bugs if not always checked for Several instances of slot_meta.last_index + 1 are also subject to overflow. This commit updates the type to Option<u64>. Backward compatibility is maintained by customizing serde serialize/deserialize implementations. (cherry picked from commit e08139f) Co-authored-by: behzad nouri <[email protected]>
Closed
mergify bot
pushed a commit
that referenced
this pull request
Feb 3, 2022
SlotMeta.last_index may be unknown and current code is using u64::MAX to indicate that: https://github.com/solana-labs/solana/blob/6c108c8fc/ledger/src/blockstore_meta.rs#L169-L174 This lacks type-safety and can introduce bugs if not always checked for Several instances of slot_meta.last_index + 1 are also subject to overflow. This commit updates the type to Option<u64>. Backward compatibility is maintained by customizing serde serialize/deserialize implementations. (cherry picked from commit e08139f) # Conflicts: # core/src/repair_generic_traversal.rs # ledger/src/blockstore.rs # ledger/src/blockstore_meta.rs
mergify bot
added a commit
that referenced
this pull request
Feb 3, 2022
* uses Option<u64> for SlotMeta.last_index (#21775) SlotMeta.last_index may be unknown and current code is using u64::MAX to indicate that: https://github.com/solana-labs/solana/blob/6c108c8fc/ledger/src/blockstore_meta.rs#L169-L174 This lacks type-safety and can introduce bugs if not always checked for Several instances of slot_meta.last_index + 1 are also subject to overflow. This commit updates the type to Option<u64>. Backward compatibility is maintained by customizing serde serialize/deserialize implementations. (cherry picked from commit e08139f) # Conflicts: # core/src/repair_generic_traversal.rs # ledger/src/blockstore.rs # ledger/src/blockstore_meta.rs * removes mergify merge conflicts Co-authored-by: behzad nouri <[email protected]>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
SlotMeta.last_index
may be unknown and current code is usingu64::MAX
to indicate that:
https://github.com/solana-labs/solana/blob/6c108c8fc/ledger/src/blockstore_meta.rs#L169-L174
This lacks type-safety and can introduce bugs if not always checked for
Several instances of
slot_meta.last_index + 1
are also subject tooverflow.
Summary of Changes
This commit updates the type to Option. Backward compatibility is
maintained by customizing serde serialize/deserialize implementations.