Skip to content

Commit 8667775

Browse files
authored
chore(consensus): clean up TODOs (#8385)
# Description of change - Adds issue tracking to TODOs in `starfish` consensus crate - removes obsolite TODOs. ## Links to any relevant issues closes #7529 ## 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 ### Release Notes - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: - [ ] REST API:
1 parent 0a01191 commit 8667775

File tree

8 files changed

+15
-25
lines changed

8 files changed

+15
-25
lines changed

crates/starfish/core/src/commit.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ impl CommitAPI for CommitV1 {
146146
&self.blocks
147147
}
148148

149-
// TODO: does this need to be a vector? block refs are a slice == less cloning?
149+
// TODO: https://github.com/iotaledger/iota/issues/8375
150+
// Does this need to be a vector? block refs are a slice == less cloning?
150151
fn committed_transactions(&self) -> Vec<BlockRef> {
151152
self.committed_transactions.clone()
152153
}

crates/starfish/core/src/commit_syncer.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,8 @@ impl<C: NetworkClient> CommitSyncer<C> {
368368
"Fetched blocks have missing committed transactions: {:?} for commit range {:?}",
369369
missing_committed_txns, fetched_commit_range
370370
);
371-
// TODO: decide whether to rely on periodic transactions
371+
// TODO: https://github.com/iotaledger/iota/issues/8376
372+
// Decide whether to rely on periodic transactions
372373
// synchronizer or make use of live one
373374
if let Err(err) = self
374375
.inner

crates/starfish/core/src/core.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,9 @@ use tokio::{
2626
use tracing::{debug, info, trace, warn};
2727

2828
#[cfg(test)]
29-
use crate::{CommitConsumer, TransactionClient, storage::mem_store::MemStore};
30-
// TODO: remove this once CommittedSubDag is properly used again
31-
#[allow(unused_imports)]
29+
use crate::{CommitConsumer, CommittedSubDag, TransactionClient, storage::mem_store::MemStore};
3230
use crate::{
33-
CommittedSubDag, Transaction,
31+
Transaction,
3432
block_header::{
3533
BlockHeader, BlockHeaderAPI, BlockHeaderV1, BlockRef, BlockTimestampMs, GENESIS_ROUND,
3634
Round, SignedBlockHeader, Slot, TransactionsCommitment, VerifiedBlock, VerifiedBlockHeader,
@@ -58,7 +56,8 @@ const MAX_COMMIT_VOTES_PER_BLOCK: usize = 100;
5856
// reasonably larger than the number of validators because not all validators
5957
// create their blocks at the same pace. For now we set it as a
6058
// constant to not make the block header size too large.
61-
// TODO: after testing decide how to compress acknowledgments and move to a
59+
// TODO: https://github.com/iotaledger/iota/issues/8378
60+
// After testing decide how to compress acknowledgments and move to a
6261
// protocol config
6362
const MAX_ACKNOWLEDGMENTS_PER_BLOCK: usize = 400;
6463

@@ -627,9 +626,6 @@ impl Core {
627626
// this would acknowledge the inclusion of transactions. Just let this
628627
// be done in the end of the method.
629628
let (transactions, ack_transactions, _limit_reached) = self.transaction_consumer.next();
630-
// TODO: remove this info debug when transaction consumption is ensured to be
631-
// aligned with expectation
632-
debug!("{} transaction are consumed by a block", transactions.len());
633629
// Serialize the transaction
634630
let serialized_transactions = Transaction::serialize(&transactions)
635631
.expect("We should expect correct serialization for transactions");
@@ -702,7 +698,6 @@ impl Core {
702698
}
703699

704700
// Construct verified transactions to be used for storing and broadcasting
705-
// TODO: consume this transactions in the data manager and for broadcasting
706701
let verified_transactions = VerifiedTransactions::new(
707702
transactions,
708703
verified_block_header.reference(),
@@ -788,8 +783,6 @@ impl Core {
788783
// Always try to process the synced commits first. If there are certified
789784
// commits to process then the decided leaders and the commits will be returned.
790785

791-
// TODO: limit commits by commits_until_update, which may be needed when leader
792-
// schedule length is reduced.
793786
let mut decided_leaders = self.committer.try_decide(self.last_decided_leader);
794787

795788
// Truncate the decided leaders to fit the commit schedule limit.

crates/starfish/core/src/encoder.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,8 @@ impl ShardEncoder for ReedSolomonEncoder {
7171
let mut shard_bytes = (bytes_length + 4).div_ceil(info_length);
7272

7373
// Ensure shard_bytes meets alignment requirements.
74-
// TODO:
75-
// - New version of the crate only requires shard_bytes to be even.
76-
// - Create tests to check alignment.
77-
// - Change 64 to 2 when the crate is updated.
78-
if shard_bytes % 64 != 0 {
79-
shard_bytes += 64 - shard_bytes % 64;
74+
if shard_bytes % 2 != 0 {
75+
shard_bytes += 1;
8076
}
8177

8278
let length_with_padding = shard_bytes * info_length;

crates/starfish/core/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ pub(crate) enum ConsensusError {
142142
InsufficientParentStakes { parent_stakes: Stake, quorum: Stake },
143143

144144
#[error("Invalid transaction: {0}")]
145-
InvalidTransaction(String), // TODO: To be used for transaction validation errors in tests
145+
InvalidTransaction(String),
146146

147147
#[error("Ancestors max timestamp {max_timestamp_ms} > block timestamp {block_timestamp_ms}")]
148148
InvalidBlockTimestamp {

crates/starfish/core/src/linearizer.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ use crate::{
2222

2323
/// The maximum depth of the linearizer, i.e. how many rounds back it will
2424
/// traverse the DAG from a committed leader block
25-
// TODO: make it derivable from the protocol parameters
25+
// TODO: https://github.com/iotaledger/iota/issues/8379
26+
// make it derivable from the protocol parameters
2627
pub(crate) const MAX_LINEARIZER_DEPTH: Round = 60;
2728

2829
/// The `StorageAPI` trait provides an interface for the block store and has

crates/starfish/core/src/subscriber.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ impl<C: NetworkClient, S: NetworkService> Subscriber<C, S> {
143143
}
144144
retries += 1;
145145

146-
// TODO:: Port PR 7292 from consensus crate to starfish
146+
// TODO: https://github.com/iotaledger/iota/issues/8380
147+
// Port PR 7292 from consensus crate to starfish
147148
let mut block_bundles = match network_client
148149
.subscribe_block_bundles(peer, last_received, MAX_RETRY_INTERVAL)
149150
.await
@@ -187,7 +188,6 @@ impl<C: NetworkClient, S: NetworkService> Subscriber<C, S> {
187188
'stream: loop {
188189
match block_bundles.next().await {
189190
Some(block) => {
190-
// TODO:: make new metric for bundle, rename, or leave it as it is?
191191
context
192192
.metrics
193193
.node_metrics

crates/starfish/core/src/synchronizer.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,6 @@ impl<C: NetworkClient, V: BlockVerifier, D: CoreThreadDispatcher> Synchronizer<C
656656
"Missing committed transactions after fetching blocks: {:?}",
657657
missing_committed_txns
658658
);
659-
// TODO: decide whether remove this live transactions synchronizer
660-
// here or not.
661659
if let Err(err) = transactions_synchronizer
662660
.fetch_transactions(missing_committed_txns)
663661
.await

0 commit comments

Comments
 (0)