Skip to content

Conversation

@piotrm50
Copy link
Contributor

@piotrm50 piotrm50 commented Oct 21, 2025

Description of change

Refactored transaction source tracking in the Starfish consensus implementation to use a type-safe enum instead of string literals for better maintainability and type safety.

Changes:

  • Created TransactionSource enum in dag_state.rs with variants: TransactionSynchronizer, BlockStreaming, ShardReconstructor, and Test
  • Updated DagState::add_transactions() to accept TransactionSource instead of &str
  • Updated all call sites to use enum variants instead of string literals

Benefits:

  • Type safety: Compiler enforces valid source values
  • Better organization: Enum colocated with DagState where it's primarily used
  • Cleaner API: Self-documenting enum variants replace magic strings
  • Improved maintainability: Easier to track all transaction sources

Links to any relevant issues

Fixes #8774

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

@piotrm50 piotrm50 requested a review from a team as a code owner October 21, 2025 12:14
@vercel
Copy link

vercel bot commented Oct 21, 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 23, 2025 11:37am
apps-ui-kit Ignored Ignored Preview Comment Oct 23, 2025 11:37am
iota-evm-bridge Ignored Ignored Preview Oct 23, 2025 11:37am
iota-multisig-toolkit Ignored Ignored Preview Oct 23, 2025 11:37am
rebased-explorer Ignored Ignored Preview Oct 23, 2025 11:37am
wallet-dashboard Ignored Ignored Preview Comment Oct 23, 2025 11:37am

@iota-ci iota-ci added consensus Issues related to the Core Consensus team core-protocol labels Oct 21, 2025
@piotrm50 piotrm50 self-assigned this Oct 21, 2025
@piotrm50 piotrm50 force-pushed the consensus/refactor/transaction-source-enum branch from 804da93 to c9abe4b Compare October 21, 2025 12:20
@piotrm50 piotrm50 force-pushed the consensus/refactor/transaction-source-enum branch from c9abe4b to 1bfc418 Compare October 21, 2025 12:23
@piotrm50 piotrm50 merged commit 0b25bac into develop Oct 23, 2025
40 checks passed
@piotrm50 piotrm50 deleted the consensus/refactor/transaction-source-enum branch October 23, 2025 13:16
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: add enum for source (transaction synchronizer, block streaming, shard reconstructor, heador synchronizer, commit syncer)

4 participants