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

[fastpath] send certified transactions to fast path #20021

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mwtian
Copy link
Contributor

@mwtian mwtian commented Oct 24, 2024

Description

Keep track of accept and reject votes from blocks. For certified blocks where every transaction has a quorum of accept or reject votes, send them to fastpath.

Test plan

CI


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • Indexer:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:
  • REST API:

Copy link

vercel bot commented Oct 24, 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 Nov 8, 2024 7:42pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Nov 8, 2024 7:42pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Nov 8, 2024 7:42pm
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Nov 8, 2024 7:42pm

@mwtian mwtian force-pushed the tmw/consensus-vote branch from 8ea4bce to 7068af0 Compare October 25, 2024 01:29
@mwtian mwtian marked this pull request as ready for review October 25, 2024 01:29
@mwtian mwtian force-pushed the tmw/consensus-vote branch from 7068af0 to ab25d1a Compare October 25, 2024 02:12
@mwtian mwtian requested a review from mystenmark as a code owner October 25, 2024 05:42
@mwtian mwtian force-pushed the tmw/consensus-vote branch from 91fa8d3 to f1b0d1b Compare October 25, 2024 05:51
@mwtian mwtian force-pushed the tmw/consensus-vote branch from f1b0d1b to a23deb9 Compare October 25, 2024 05:54
@mwtian mwtian force-pushed the tmw/consensus-vote branch from a23deb9 to c74c272 Compare October 25, 2024 06:01
@mwtian mwtian force-pushed the tmw/consensus-vote branch from c74c272 to 38fd8b5 Compare October 25, 2024 07:37
@mwtian mwtian force-pushed the tmw/consensus-vote branch from 38fd8b5 to 03dd704 Compare October 26, 2024 05:33
@mwtian mwtian force-pushed the tmw/consensus-vote branch from 03dd704 to 32bbf8c Compare October 26, 2024 18:29
@mwtian mwtian force-pushed the tmw/consensus-vote branch from 32bbf8c to 53c14dc Compare October 28, 2024 01:26
@mwtian mwtian requested a review from a team as a code owner October 28, 2024 01:26
@mwtian mwtian force-pushed the tmw/consensus-vote branch from 53c14dc to 5690c52 Compare October 28, 2024 02:10
Copy link
Contributor

@akichidis akichidis left a comment

Choose a reason for hiding this comment

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

Haven't finished reviewing but leaving some first comments here.

consensus/core/src/commit_consumer.rs Outdated Show resolved Hide resolved
consensus/core/src/dag_state.rs Outdated Show resolved Hide resolved
consensus/core/src/dag_state.rs Show resolved Hide resolved
consensus/core/src/dag_state.rs Show resolved Hide resolved
consensus/core/src/dag_state.rs Show resolved Hide resolved
consensus/core/src/dag_state.rs Show resolved Hide resolved
consensus/core/src/dag_state.rs Outdated Show resolved Hide resolved
consensus/core/src/dag_state.rs Outdated Show resolved Hide resolved
consensus/core/src/dag_state.rs Show resolved Hide resolved
Comment on lines +1119 to +1161
if self
.accept_votes
.stake()
.checked_sub(reject_votes.stake())
.unwrap()
< committee.quorum_threshold()
{
return None;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The rejected_votes.stake() refers to the single transaction of index idx . Why can't the block be certified in this case? Am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I using certified block to mean not just the block is certified, but all its transactions are certified to be accepted or rejected. Added comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok got it, it makes sense.

Looking on the evolution of the code I start getting the feeling that the certificate term gets overused in different flows (commit rule, fast path txes) and it could result to confusions - especially in the future or new people looking into this.

I would like your view on this , but I believe we might need to somehow differentiate the "fast path certificates" from the "consensus certificate". For example maybe we can introduce the "transactions" concept.

  • take_certified_output -> take_tx_certified_output or take_transactions_certified_output
  • certified_output -> transactions_certified_output
  • BlockOutputBatch::Certified -> BlockOutputBatch::TransactionsCertified, or BlockOutputBatch::TxCertified or BlockOutputBatch::WithCertifiedTransactions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree certificate is already overloaded, for example it can mean certified block in Narwhal, certified transaction in Sui and certified leaders in Mysticeti commit rule.

For a given class of entities (one of blocks, transactions, leaders), do we ever certify them in different ways? I think we do not, so we may just need to be precise on what is being certified. For example in commit rules, we need to use CertifiedLeader / LeaderCertificate instead of just certificate.

@mwtian
Copy link
Contributor Author

mwtian commented Oct 31, 2024

Through prototyping, I start to think that we should explore the alternative where votes are not enforced to be in the causal history of the voter, and total votes are tracked in a data structure (BlockState for now) different from dag state. BlockState can allow concurrent reads and atomic writes on some fields. I may rework the PR later.

@mwtian mwtian marked this pull request as draft November 1, 2024 00:12
@mwtian mwtian removed request for a team and mystenmark November 1, 2024 00:12
Copy link
Contributor

github-actions bot commented Jan 8, 2025

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants