Skip to content
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

[consensus] Make CommitRange inclusive and use in commit syncer #17788

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

arun-koshy
Copy link
Contributor

Test plan

pending ptn run

Copy link

vercel bot commented May 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 1, 2024 4:33am
3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Jun 1, 2024 4:33am
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Jun 1, 2024 4:33am
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Jun 1, 2024 4:33am

timeout: Duration,
) -> ConsensusResult<(Vec<Bytes>, Vec<Bytes>)> {
let mut client = self.get_client(peer, timeout).await?;
let mut request = Request::new(FetchCommitsRequest { start, end });
let mut request = Request::new(FetchCommitsRequest {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: decided against using CommitRange in FetchCommitsRequest so we could keep the types of the message as u32 which should be more efficient.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that would be a backward incompatible change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh right! That should have been the main reason not to do it 😆

consensus/core/src/commit.rs Outdated Show resolved Hide resolved
consensus/core/src/commit.rs Outdated Show resolved Hide resolved
consensus/core/src/commit_syncer.rs Outdated Show resolved Hide resolved
consensus/core/src/commit_syncer.rs Outdated Show resolved Hide resolved
consensus/core/src/network/mod.rs Outdated Show resolved Hide resolved
Update authority_service.rs

Update authority_service.rs
consensus/core/src/commit.rs Outdated Show resolved Hide resolved
#[derive(Clone, Default, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub(crate) struct CommitRange(Range<CommitIndex>);
/// and end (inclusive) commit indices and can be ordered for use as the key of a table.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy can be derived as well, so we don't need to explicitly clone() CommitRange.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately RangeInclusive does not impl Copy

consensus/core/src/authority_service.rs Outdated Show resolved Hide resolved
@@ -694,11 +699,19 @@ mod tests {
assert_eq!(range1.start(), 1);
assert_eq!(range1.end(), 5);

tracing::debug!("test");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants