-
Notifications
You must be signed in to change notification settings - Fork 18
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
Nomos node tree overlay #415
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
98221e3
Use tree overlay in nomos node
bacv ddeaf24
Use tree overlay in tests module
bacv 8e78539
Handle unexpected consensus vote stream end in tally
bacv f57bfc8
Spawn the next leader first (#425)
youngjoon-lee f4f7d62
Merge branch 'master' into nomos-node-tree-overlay
bacv 80844f5
Merge branch 'master' into nomos-node-tree-overlay
al8n 5b8fb85
Report unhappy blocks in happy path test (#430)
al8n 602ea51
Merge branch 'master' into nomos-node-tree-overlay
youngjoon-lee ecfe7e0
Make threshold configurable for TreeOverlay (#426)
youngjoon-lee f069890
Modified test, so that all nodes don’t all connect to the first node …
youngjoon-lee a9cd499
Merge branch 'master' into nomos-node-tree-overlay
youngjoon-lee 5c5d813
merge fix
youngjoon-lee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use fraction::{Fraction, GenericFraction, ToPrimitive}; | ||
|
||
const SUPER_MAJORITY_THRESHOLD_NUM: u64 = 2; | ||
const SUPER_MAJORITY_THRESHOLD_DEN: u64 = 3; | ||
|
||
pub(crate) fn default_super_majority_threshold() -> GenericFraction<u64> { | ||
Fraction::new(SUPER_MAJORITY_THRESHOLD_NUM, SUPER_MAJORITY_THRESHOLD_DEN) | ||
} | ||
|
||
pub(crate) fn apply_threshold(size: usize, threshold: GenericFraction<u64>) -> usize { | ||
// `threshold` is a tuple of (num, den) where `num/den` is the super majority threshold | ||
(Fraction::from(size) * threshold) | ||
.ceil() | ||
.to_usize() | ||
.unwrap() | ||
} | ||
|
||
pub mod deser_fraction { | ||
use fraction::Fraction; | ||
use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; | ||
use std::str::FromStr; | ||
|
||
pub fn deserialize<'de, D>(deserializer: D) -> Result<Option<Fraction>, D::Error> | ||
where | ||
D: Deserializer<'de>, | ||
{ | ||
<Option<String>>::deserialize(deserializer)? | ||
.map(|s| FromStr::from_str(&s).map_err(de::Error::custom)) | ||
.transpose() | ||
} | ||
|
||
pub fn serialize<S>(value: &Option<Fraction>, serializer: S) -> Result<S::Ok, S::Error> | ||
where | ||
S: Serializer, | ||
{ | ||
value.map(|v| v.to_string()).serialize(serializer) | ||
} | ||
} |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
@zeegomo This should be ok right? I have been working with Gusto and in reality if failing to gather the initial votes nodes should catch up anyway.
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.
Failing to gather initial votes means we go to the timeout routine, why does this happen now?