Skip to content

Conversation

VorobyevIlya
Copy link
Contributor

@VorobyevIlya VorobyevIlya commented Oct 8, 2025

Description of change

PR tracks shards of which authors could be sent to other validators.

Shards for encoded transaction data of validator $v$ are considered as useful for validator $u$ if validator $u$ is ready to include an additional block header of validator $v$ after filtering those blocks. In particular, this means that
the potential sequenced transaction data comes from validator $v$ indirectly.

If the shard of the block created by the validator $v$ was useful, then the shards from the blocks created by $v$ will be sent for some number of rounds. In other words, there is some inertia; we don't stop sending shards as soon as one of them is useless.

In practice, there are two prerequisites for the efficiency of this mechanism:

  1. block bundle streaming is actively working (e.g. this mechanism wouldn't work if a validator is catching up and doesn't produce blocks)
  2. cordial dissemination of block headers is enabled (without additional block headers, validators won't understand which shards are useful for them)

Links to any relevant issues

fixes #8767

How the change has been tested

  • Basic tests (linting, compilation, formatting, unit/integration tests)
  • Patch-specific tests (correctness, functionality coverage)
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that new and existing unit tests pass locally with my changes

Copy link

vercel bot commented Oct 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

6 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
apps-backend Ignored Ignored Preview Oct 9, 2025 10:17pm
apps-ui-kit Ignored Ignored Preview Oct 9, 2025 10:17pm
iota-evm-bridge Ignored Ignored Preview Oct 9, 2025 10:17pm
iota-multisig-toolkit Ignored Ignored Preview Oct 9, 2025 10:17pm
rebased-explorer Ignored Ignored Preview Oct 9, 2025 10:17pm
wallet-dashboard Ignored Ignored Preview Oct 9, 2025 10:17pm

@iota-ci iota-ci added consensus Issues related to the Core Consensus team core-protocol labels Oct 8, 2025
@VorobyevIlya VorobyevIlya marked this pull request as ready for review October 8, 2025 09:07
@VorobyevIlya VorobyevIlya requested a review from a team as a code owner October 8, 2025 09:07
@VorobyevIlya VorobyevIlya marked this pull request as draft October 8, 2025 09:08
@VorobyevIlya VorobyevIlya force-pushed the consensus/feat/starfish/send-only-useful-shards branch from 68da5d0 to cbbff27 Compare October 8, 2025 12:56
@VorobyevIlya VorobyevIlya self-assigned this Oct 8, 2025
@VorobyevIlya VorobyevIlya marked this pull request as ready for review October 8, 2025 14:59
@VorobyevIlya VorobyevIlya force-pushed the consensus/feat/starfish/send-only-useful-shards branch from 4f48fc4 to 57edd30 Compare October 8, 2025 15:34
Copy link
Contributor

@piotrm50 piotrm50 left a comment

Choose a reason for hiding this comment

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

Please update header-related variables so the naming is header-specific rather than general useful_authorities.

pub(crate) const MAX_TRANSACTIONS_ACK_DEPTH: Round = 50;
pub(crate) const MAX_HEADERS_PER_BUNDLE: usize = 150;
pub(crate) const MAX_SHARDS_PER_BUNDLE: usize = 150;
const MAX_ROUND_GAP_FOR_USEFUL_SHARDS: usize = 5;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please describe what this constant controls.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


// Remove the references from the set and update cordial knowledge
for block_ref in &to_take {
set.remove(block_ref);
Copy link
Contributor

Choose a reason for hiding this comment

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

just to make sure: if the blocks are not removed from the set here then they will be evicted at some later point?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, they are removed in evict_cordial_knowledge function

}
}
shards
useful_authorities
Copy link
Contributor

Choose a reason for hiding this comment

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

imo useful_shards_authors is better understandable than useful_authorities. wdyt? maybe we could also change it for headers? Especially when a method is called take_useful_shards_for_authority and a param is called useful_authorities - useful_shards_authors would be more descriptive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, useful_shard_authors is better. Changed it.

}

impl SerializedBlockBundleParts {
pub(crate) fn useful_authorities(&self) -> BTreeSet<AuthorityIndex> {
Copy link
Contributor

Choose a reason for hiding this comment

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

better rename to useful_headers_authors

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

/// useful to them (communicated inside their block bundles).
/// Keyed by the peer’s AuthorityIndex.
useful_authorities_to_peer: Arc<RwLock<BTreeMap<AuthorityIndex, BTreeSet<AuthorityIndex>>>>,
/// For each peer, stores the latest round in which a received block bundle
Copy link
Contributor

Choose a reason for hiding this comment

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

here also rename the header-related fields to be in line with the shard ones

Copy link
Contributor Author

Choose a reason for hiding this comment

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

did renaming

useful_authorities_from_peer_write_guard.insert(peer, useful_authorities);
}
{
let useful_shard_authors = additional_block_headers
Copy link
Contributor

Choose a reason for hiding this comment

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

variable is called useful_shard_authors but we iterate over additional_block_headers? is this correct?

Also, add a comment describing what this block of code does, or update comment for step 13. above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, these headers went through filters and will now be added to dag_state without transaction data, so we request their shards.
Added comment

@VorobyevIlya VorobyevIlya marked this pull request as draft October 9, 2025 21:56
@VorobyevIlya VorobyevIlya marked this pull request as ready for review October 9, 2025 21:57
@VorobyevIlya VorobyevIlya force-pushed the consensus/feat/starfish/send-only-useful-shards branch from 4796d29 to ea4b2f5 Compare October 9, 2025 22:15
@VorobyevIlya VorobyevIlya requested a review from piotrm50 October 10, 2025 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consensus Issues related to the Core Consensus team core-protocol
Projects
None yet
Development

Successfully merging this pull request may close these issues.

starfish: implement hinting mechanism for cordial dissemination of shards
4 participants