Skip to content

fix: unify edition to 2024 via workspace inheritance#1261

Merged
JesseTheRobot merged 1 commit into
masterfrom
fix/edition-unify
Mar 30, 2026
Merged

fix: unify edition to 2024 via workspace inheritance#1261
JesseTheRobot merged 1 commit into
masterfrom
fix/edition-unify

Conversation

@JesseTheRobot

@JesseTheRobot JesseTheRobot commented Mar 30, 2026

Copy link
Copy Markdown
Member

Describe the changes
All crate Cargo.toml files now use edition.workspace = true instead of hardcoding their own edition. This also fixes edition 2024 migration issues: reserved gen keyword, collapsible if-let chains, pattern matching changes, and impl Trait lifetime capture rules.

Related Issue(s)
Please link to the issue(s) that will be closed with this PR.

Checklist

  • Tests have been added/updated for the changes.
  • Documentation has been updated for the changes (if applicable).
  • The code follows Rust's style guidelines.

Additional Context
Add any other context about the pull request here.

Summary by CodeRabbit

  • Refactor

    • Standardized Rust edition configuration across workspace crates to inherit from workspace settings.
    • Reorganized module imports and consolidated grouped imports throughout the codebase.
    • Simplified nested conditional statements by combining conditions using compound boolean expressions.
  • Style

    • Reformatted assertions, log statements, and error messages for improved readability.

All crate Cargo.toml files now use `edition.workspace = true` instead of
hardcoding their own edition. This also fixes edition 2024 migration
issues: reserved `gen` keyword, collapsible if-let chains, pattern
matching changes, and impl Trait lifetime capture rules.
@coderabbitai

coderabbitai Bot commented Mar 30, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR standardizes workspace configuration by updating multiple crate manifests to inherit Rust edition from workspace settings, refactors numerous imports for consistency, and simplifies control flow by combining nested conditionals throughout the codebase using compound boolean expressions.

Changes

Cohort / File(s) Summary
Workspace Edition Standardization
crates/api-client/Cargo.toml, crates/api-server/Cargo.toml, crates/chain-tests/Cargo.toml, crates/chain/Cargo.toml, crates/efficient-sampling/Cargo.toml, crates/p2p/Cargo.toml, crates/price-oracle/Cargo.toml, crates/reth-node-bridge/Cargo.toml, crates/types/Cargo.toml, crates/utils/nextest-monitor/Cargo.toml, xtask/Cargo.toml
Changed edition = "2021" to edition.workspace = true for workspace-level edition inheritance.
Control Flow Simplification
crates/api-client/src/lib.rs, crates/api-server/src/routes/balance.rs, crates/api-server/src/routes/block_tree.rs, crates/chain-tests/src/api/tx_commitments.rs, crates/chain-tests/src/block_production/unpledge_refund.rs, crates/chain-tests/src/block_production/unstake_refund.rs, crates/chain-tests/src/external/sync_partition_data_remote.rs, crates/chain-tests/src/external/utils/monitoring.rs, crates/chain-tests/src/multi_node/fork_recovery_epoch.rs, crates/chain-tests/src/perm_ledger_expiry/mod.rs, crates/chain-tests/src/programmable_data/basic.rs, crates/chain-tests/src/term_ledger_expiry/mod.rs, crates/chain-tests/src/utils.rs, crates/chain-tests/src/validation/ledger_expiry_with_unstake.rs, crates/p2p/src/block_pool.rs, crates/p2p/src/chain_sync.rs, crates/p2p/src/gossip_client.rs, crates/p2p/src/gossip_data_handler.rs, crates/p2p/src/gossip_service.rs, crates/p2p/src/peer_network_service.rs, crates/reth-node-bridge/src/adapter.rs, crates/types/src/hardfork_config.rs, crates/utils/nextest-monitor/src/bin/nextest-report.rs, crates/utils/nextest-monitor/src/bin/nextest-wrapper.rs, crates/utils/nextest-monitor/src/memory_monitor.rs, xtask/src/failures.rs
Consolidated nested conditionals into single compound expressions using && and || operators, reducing indentation depth while preserving equivalent control flow.
Pervasive Import Reordering
crates/api-server/src/{error.rs, lib.rs, metrics.rs, routes/*}, crates/chain-tests/src/{api/*, block_production/*, external/*, integration/*, multi_node/*, packing/*, promotion/*, startup/*, synchronization/*, term_ledger_expiry/*, validation/*, perm_ledger_expiry/*, programmable_data/*, utils.rs}, crates/chain/src/{chain.rs, genesis_utilities.rs, main.rs, peer_utilities.rs}, crates/efficient-sampling/src/lib.rs, crates/p2p/src/{block_pool.rs, block_status_provider.rs, cache.rs, chain_sync.rs, gossip_client.rs, gossip_data_handler.rs, gossip_fixture_tests.rs, gossip_service.rs, lib.rs, peer_network_service.rs, rate_limiting.rs, server.rs, tests/*, types.rs, wire_types/*}, crates/reth-node-bridge/src/{adapter.rs, dump.rs, node.rs}, crates/types/src/{address.rs, block.rs, block_production.rs, canonical.rs, chainspec.rs, chunk.rs, commitment_*.rs, config/*, difficulty_adjustment_config.rs, gossip.rs, hardfork_config.rs, ingress.rs, irys.rs, lib.rs, merkle.rs, partition.rs, peer_list.rs, range_specifier.rs, remote_packing.rs, serialization.rs, signature.rs, storage.rs, storage_pricing.rs, time.rs, transaction.rs, transaction/fee_distribution.rs, version.rs, tests/*}, xtask/src/{failures.rs, main.rs}
Reorganized use statements, moving imports between positions and consolidating multi-line import blocks; no functional changes to imported items or visibility.
Test/Signature Updates
crates/chain-tests/src/utils.rs
Added + use<> trait bound to start_public_api and start_mock_gossip_server return types for improved type inference; no logic changes.
Formatting & Assertion Refactoring
crates/chain-tests/src/{api/pricing_endpoint.rs, api/tx_commitments.rs, block_production/difficulty_adjustment.rs, block_production/reset_seed.rs, block_production/test_double_spend.rs, external/api.rs, external/sync_partition_data_remote.rs, multi_node/mempool_tests.rs, multi_node/peer_discovery.rs, multi_node/sync_chain_state.rs, multi_node/validation.rs, promotion/*, startup/auto_stake.rs, synchronization/mod.rs, validation/*, perm_ledger_expiry/mod.rs}, crates/p2p/src/{block_pool.rs, chain_sync.rs, gossip_client.rs, gossip_data_handler.rs, server.rs, wire_types/tests.rs}, crates/types/src/{address.rs, block.rs, canonical.rs, commitment_v1.rs, commitment_v2.rs, config/mod.rs, ingress.rs, lib.rs, storage_pricing.rs, tests/transaction_signing_*.rs}, xtask/src/main.rs
Reformatted multi-line assertions, log statements, panic calls, and eprintln! invocations without changing underlying logic or conditions.
Type Re-export Reordering
crates/types/src/{commitment_common.rs, commitment_v1.rs, commitment_v2.rs, transaction.rs, lib.rs}
Reordered pub use re-export lists and removed duplicate export blocks; one change removes address_base58_stringify from public re-exports in transaction.rs.

Sequence Diagram(s)

No sequence diagrams generated—this PR is primarily composed of homogeneous import reordering, control flow simplification patterns, and manifest standardization without introducing new features or significantly altering multi-component interactions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

While the diff is large in line count, the changes are predominantly homogeneous: workspace edition standardization across manifests, repetitive import reordering across many files following consistent patterns, and standardized control-flow simplification (combining nested conditionals). These patterns require minimal per-file reasoning. The exception is signature changes in utils.rs and the public re-export modifications in transaction.rs, which merit closer attention but remain straightforward. The heterogeneity is low given the consistent refactoring patterns applied throughout.

Possibly related PRs

Suggested reviewers

  • glottologist
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/edition-unify

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
crates/reth-node-bridge/src/adapter.rs (1)

63-77: ⚠️ Potential issue | 🟠 Major

Avoid unbounded polling that can hang forever.

On Line 71, the loop exits only when latest_block.header.number == block_number. If the head moves past that height before this check, the condition never recovers, and with the unbounded loop on Line 63 this can stall indefinitely.

🔧 Proposed fix (timeout + deterministic target lookup)
     pub async fn assert_new_block_irys(
         &self,
         block_hash: B256,
         block_number: BlockNumber,
     ) -> eyre::Result<()> {
-        loop {
+        let start = tokio::time::Instant::now();
+        let timeout = std::time::Duration::from_secs(15);
+        loop {
+            if start.elapsed() > timeout {
+                eyre::bail!(
+                    "timed out waiting for block {} (expected hash {:?})",
+                    block_number,
+                    block_hash
+                );
+            }
+
             // wait for the block to commit
             tokio::time::sleep(std::time::Duration::from_millis(20)).await;
+
+            // Query the exact target height to avoid missing it when head advances quickly.
+            if let Some(target_block) = self
+                .reth_node
+                .inner
+                .provider
+                .block_by_number_or_tag(BlockNumberOrTag::Number(block_number))?
+            {
+                assert_eq!(target_block.hash_slow(), block_hash);
+                break;
+            }
+
             if let Some(latest_block) = self
                 .reth_node
                 .inner
                 .provider
                 .block_by_number_or_tag(BlockNumberOrTag::Latest)?
                 && latest_block.header.number == block_number
             {
                 // make sure the block hash we submitted via FCU engine api is the new latest
                 // block using an RPC call
                 assert_eq!(latest_block.hash_slow(), block_hash);
                 break;
             }
         }
         Ok(())
     }
crates/chain-tests/src/utils.rs (1)

2633-2686: ⚠️ Potential issue | 🟠 Major

Fail when a required publish chunk is missing.

With enable_full_ingress_proof_validation enabled, this helper is expected to send every publish chunk before delivering the block. The current guarded path silently skips missing cache entries or chunk: None, so send_full_block can return Ok(()) even though the peer never received a full block.

🧩 Proposed fix
-                        if let Ok(Some((_meta, cached_chunk))) = self.node_ctx.db.view_eyre(|tx| {
-                            irys_database::cached_chunk_by_chunk_offset(
-                                tx,
-                                tx_header.data_root,
-                                tx_chunk_offset,
-                            )
-                        }) && let Some(bytes) = cached_chunk.chunk
-                        {
+                        let (_meta, cached_chunk) = self
+                            .node_ctx
+                            .db
+                            .view_eyre(|tx| {
+                                irys_database::cached_chunk_by_chunk_offset(
+                                    tx,
+                                    tx_header.data_root,
+                                    tx_chunk_offset,
+                                )
+                            })?
+                            .ok_or_else(|| {
+                                eyre!(
+                                    "missing cached chunk for data_root {} at tx_offset {:?} while sending full block",
+                                    tx_header.data_root,
+                                    tx_chunk_offset
+                                )
+                            })?;
+                        let data_path = cached_chunk.data_path.0.clone();
+                        let bytes = cached_chunk.chunk.ok_or_else(|| {
+                            eyre!(
+                                "cached chunk for data_root {} at tx_offset {:?} has no bytes while sending full block",
+                                tx_header.data_root,
+                                tx_chunk_offset
+                            )
+                        })?;
+                        {
                             let unpacked = irys_types::UnpackedChunk {
                                 data_root: tx_header.data_root,
                                 data_size: tx_header.data_size,
-                                data_path: irys_types::Base64(cached_chunk.data_path.0.clone()),
+                                data_path: irys_types::Base64(data_path),
                                 bytes,
                                 tx_offset: tx_chunk_offset,
                             };
                             let verify_data_root = unpacked.data_root;
                             let verify_tx_offset = unpacked.tx_offset;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/chain-tests/src/utils.rs` around lines 2633 - 2686, The code currently
silently skips when a required cached chunk is missing (the guarded if using
self.node_ctx.db.view_eyre -> irys_database::cached_chunk_by_chunk_offset and
checking cached_chunk.chunk), which lets send_full_block succeed even if a peer
never received a publish chunk; change that behavior so send_full_block fails
immediately when a required cache entry is absent or cached_chunk.chunk is None.
Concretely, in the function that builds/sends the full block (the code around
send_full_block / enable_full_ingress_proof_validation), replace the guarded
if-let that requires Ok(Some((_meta, cached_chunk))) && let Some(bytes) =
cached_chunk.chunk with explicit error handling: when view_eyre returns Err or
None, or cached_chunk.chunk is None, return an Err (or propagate a descriptive
error) indicating the missing cached chunk (include tx_header.data_root and
tx_chunk_offset in the error message), instead of silently skipping; keep the
existing path that sends via peer.node_ctx.service_senders.chunk_ingress with
ChunkIngressMessage::IngestChunk when the chunk is present.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@crates/chain-tests/src/utils.rs`:
- Around line 1769-1779: The code currently swallows errors from
get_block_by_hash and treats them as a "tx not found" timeout; instead propagate
or surface the error immediately. Replace the conditional pattern using if let
Ok(block) = self.get_block_by_hash(&block_hash) ... with code that calls let
block = self.get_block_by_hash(&block_hash)? (or explicitly match Err and return
Err with context) so that a missing/corrupt canonical block from canonical_chain
fails fast rather than turning into a slow timeout; reference get_block_by_hash
and canonical_chain to locate the change.

In `@crates/chain/src/chain.rs`:
- Around line 2132-2143: The PackingRequest::new call is currently inside an
if-let that ignores construction failures, so construct the request explicitly
and handle its Result: call PackingRequest::new(sm.clone(),
PartitionChunkRange(interval)) into a local (e.g., let req_res = ...), match or
if let Err(e) => log the constructor error with context (include
storage_module.id and packing.interval) and return or propagate as appropriate,
and on Ok(req) attempt sender.send(req).await and keep the existing error
handling for send failures (the tracing::event for channel closed). This ensures
constructor errors from PackingRequest::new are not silently dropped.

In `@crates/p2p/src/tests/integration/mod.rs`:
- Around line 2-3: This file imports (GossipServiceTestFixture,
create_test_chunks, generate_test_tx, poll_until, wait_until_listening) may be
misformatted or lint-violating; run cargo fmt --all and cargo clippy --workspace
--tests --all-targets locally, fix any formatter or clippy warnings/errors
(reorder or group imports, adjust code to satisfy lints, add allow attributes
where justified), re-run the commands until they pass, then update the commit so
the tests and formatting are clean before merging.

---

Outside diff comments:
In `@crates/chain-tests/src/utils.rs`:
- Around line 2633-2686: The code currently silently skips when a required
cached chunk is missing (the guarded if using self.node_ctx.db.view_eyre ->
irys_database::cached_chunk_by_chunk_offset and checking cached_chunk.chunk),
which lets send_full_block succeed even if a peer never received a publish
chunk; change that behavior so send_full_block fails immediately when a required
cache entry is absent or cached_chunk.chunk is None. Concretely, in the function
that builds/sends the full block (the code around send_full_block /
enable_full_ingress_proof_validation), replace the guarded if-let that requires
Ok(Some((_meta, cached_chunk))) && let Some(bytes) = cached_chunk.chunk with
explicit error handling: when view_eyre returns Err or None, or
cached_chunk.chunk is None, return an Err (or propagate a descriptive error)
indicating the missing cached chunk (include tx_header.data_root and
tx_chunk_offset in the error message), instead of silently skipping; keep the
existing path that sends via peer.node_ctx.service_senders.chunk_ingress with
ChunkIngressMessage::IngestChunk when the chunk is present.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 505200ba-bfa8-4a96-8e1c-aa247cd7d7b1

📥 Commits

Reviewing files that changed from the base of the PR and between 1e2e898 and 76e5095.

📒 Files selected for processing (171)
  • crates/api-client/Cargo.toml
  • crates/api-client/src/ext.rs
  • crates/api-client/src/lib.rs
  • crates/api-server/Cargo.toml
  • crates/api-server/src/error.rs
  • crates/api-server/src/lib.rs
  • crates/api-server/src/metrics.rs
  • crates/api-server/src/routes/anchor.rs
  • crates/api-server/src/routes/balance.rs
  • crates/api-server/src/routes/block.rs
  • crates/api-server/src/routes/block_index.rs
  • crates/api-server/src/routes/block_tree.rs
  • crates/api-server/src/routes/commitment.rs
  • crates/api-server/src/routes/config.rs
  • crates/api-server/src/routes/get_chunk.rs
  • crates/api-server/src/routes/index.rs
  • crates/api-server/src/routes/ledger.rs
  • crates/api-server/src/routes/mempool.rs
  • crates/api-server/src/routes/mining.rs
  • crates/api-server/src/routes/peer_list.rs
  • crates/api-server/src/routes/post_chunk.rs
  • crates/api-server/src/routes/price.rs
  • crates/api-server/src/routes/proxy.rs
  • crates/api-server/src/routes/storage.rs
  • crates/api-server/src/routes/supply.rs
  • crates/api-server/src/routes/tx.rs
  • crates/chain-tests/Cargo.toml
  • crates/chain-tests/src/api/api.rs
  • crates/chain-tests/src/api/client.rs
  • crates/chain-tests/src/api/hardfork_tests.rs
  • crates/chain-tests/src/api/pricing_endpoint.rs
  • crates/chain-tests/src/api/tx.rs
  • crates/chain-tests/src/api/tx_commitments.rs
  • crates/chain-tests/src/api/tx_duplicates.rs
  • crates/chain-tests/src/block_production/basic_contract.rs
  • crates/chain-tests/src/block_production/block_production.rs
  • crates/chain-tests/src/block_production/block_rebuilding.rs
  • crates/chain-tests/src/block_production/block_validation.rs
  • crates/chain-tests/src/block_production/difficulty_adjustment.rs
  • crates/chain-tests/src/block_production/reset_seed.rs
  • crates/chain-tests/src/block_production/test_double_spend.rs
  • crates/chain-tests/src/block_production/testing_primitives.rs
  • crates/chain-tests/src/block_production/treasury_tracking.rs
  • crates/chain-tests/src/block_production/unpledge_refund.rs
  • crates/chain-tests/src/block_production/unstake_refund.rs
  • crates/chain-tests/src/data_sync/sync_partition_data_tests.rs
  • crates/chain-tests/src/ema_pricing/ema_pricing.rs
  • crates/chain-tests/src/external/api.rs
  • crates/chain-tests/src/external/block_production.rs
  • crates/chain-tests/src/external/programmable_data_basic.rs
  • crates/chain-tests/src/external/sync_partition_data_remote.rs
  • crates/chain-tests/src/external/utils/monitoring.rs
  • crates/chain-tests/src/external/utils/signer.rs
  • crates/chain-tests/src/external/utils/types.rs
  • crates/chain-tests/src/integration/cache_service.rs
  • crates/chain-tests/src/multi_node/ema_forks.rs
  • crates/chain-tests/src/multi_node/epoch_replay.rs
  • crates/chain-tests/src/multi_node/fork_recovery.rs
  • crates/chain-tests/src/multi_node/fork_recovery_epoch.rs
  • crates/chain-tests/src/multi_node/mempool_tests.rs
  • crates/chain-tests/src/multi_node/peer_discovery.rs
  • crates/chain-tests/src/multi_node/sync_chain_state.rs
  • crates/chain-tests/src/multi_node/validation.rs
  • crates/chain-tests/src/packing/remote_packing.rs
  • crates/chain-tests/src/partition_assignments/sm_reassignment_tests.rs
  • crates/chain-tests/src/perm_ledger_expiry/mod.rs
  • crates/chain-tests/src/programmable_data/basic.rs
  • crates/chain-tests/src/promotion/data_promotion_basic.rs
  • crates/chain-tests/src/promotion/data_promotion_double.rs
  • crates/chain-tests/src/promotion/promotion_with_multiple_proofs.rs
  • crates/chain-tests/src/startup/auto_stake.rs
  • crates/chain-tests/src/startup/genesis.rs
  • crates/chain-tests/src/synchronization/mod.rs
  • crates/chain-tests/src/term_ledger_expiry/mod.rs
  • crates/chain-tests/src/term_ledger_expiry/perm_refund.rs
  • crates/chain-tests/src/utils.rs
  • crates/chain-tests/src/validation/anchor_canonical_reorg.rs
  • crates/chain-tests/src/validation/blobs_rejected.rs
  • crates/chain-tests/src/validation/data_tx_pricing.rs
  • crates/chain-tests/src/validation/ingress_proof_reanchor_dedup.rs
  • crates/chain-tests/src/validation/ingress_proof_validation.rs
  • crates/chain-tests/src/validation/invalid_perm_fee_refund.rs
  • crates/chain-tests/src/validation/ledger_expiry_with_unstake.rs
  • crates/chain-tests/src/validation/mempool_ingress_proof_dedup.rs
  • crates/chain-tests/src/validation/mod.rs
  • crates/chain-tests/src/validation/unpledge_partition.rs
  • crates/chain-tests/src/validation/unstake_edge_cases.rs
  • crates/chain/Cargo.toml
  • crates/chain/src/chain.rs
  • crates/chain/src/genesis_utilities.rs
  • crates/chain/src/main.rs
  • crates/chain/src/peer_utilities.rs
  • crates/efficient-sampling/Cargo.toml
  • crates/efficient-sampling/src/lib.rs
  • crates/p2p/Cargo.toml
  • crates/p2p/src/block_pool.rs
  • crates/p2p/src/block_status_provider.rs
  • crates/p2p/src/cache.rs
  • crates/p2p/src/chain_sync.rs
  • crates/p2p/src/gossip_client.rs
  • crates/p2p/src/gossip_data_handler.rs
  • crates/p2p/src/gossip_fixture_tests.rs
  • crates/p2p/src/gossip_service.rs
  • crates/p2p/src/lib.rs
  • crates/p2p/src/peer_network_service.rs
  • crates/p2p/src/rate_limiting.rs
  • crates/p2p/src/server.rs
  • crates/p2p/src/tests/block_pool/mod.rs
  • crates/p2p/src/tests/integration/mod.rs
  • crates/p2p/src/tests/util.rs
  • crates/p2p/src/types.rs
  • crates/p2p/src/wire_types/block.rs
  • crates/p2p/src/wire_types/block_index.rs
  • crates/p2p/src/wire_types/chunk.rs
  • crates/p2p/src/wire_types/commitment_transaction.rs
  • crates/p2p/src/wire_types/data_transaction.rs
  • crates/p2p/src/wire_types/gossip_data.rs
  • crates/p2p/src/wire_types/handshake.rs
  • crates/p2p/src/wire_types/ingress_proof.rs
  • crates/p2p/src/wire_types/node_info.rs
  • crates/p2p/src/wire_types/test_helpers.rs
  • crates/p2p/src/wire_types/tests.rs
  • crates/price-oracle/Cargo.toml
  • crates/reth-node-bridge/Cargo.toml
  • crates/reth-node-bridge/src/adapter.rs
  • crates/reth-node-bridge/src/dump.rs
  • crates/reth-node-bridge/src/node.rs
  • crates/types/Cargo.toml
  • crates/types/src/address.rs
  • crates/types/src/arbiter_handle.rs
  • crates/types/src/block.rs
  • crates/types/src/block_production.rs
  • crates/types/src/canonical.rs
  • crates/types/src/chainspec.rs
  • crates/types/src/chunk.rs
  • crates/types/src/commitment_common.rs
  • crates/types/src/commitment_v1.rs
  • crates/types/src/commitment_v2.rs
  • crates/types/src/config/consensus.rs
  • crates/types/src/config/mod.rs
  • crates/types/src/config/node.rs
  • crates/types/src/difficulty_adjustment_config.rs
  • crates/types/src/gossip.rs
  • crates/types/src/hardfork_config.rs
  • crates/types/src/ingress.rs
  • crates/types/src/irys.rs
  • crates/types/src/lib.rs
  • crates/types/src/merkle.rs
  • crates/types/src/partition.rs
  • crates/types/src/peer_list.rs
  • crates/types/src/range_specifier.rs
  • crates/types/src/remote_packing.rs
  • crates/types/src/serialization.rs
  • crates/types/src/signature.rs
  • crates/types/src/storage.rs
  • crates/types/src/storage_pricing.rs
  • crates/types/src/time.rs
  • crates/types/src/transaction.rs
  • crates/types/src/transaction/fee_distribution.rs
  • crates/types/src/version.rs
  • crates/types/tests/commitment_signing_tests.rs
  • crates/types/tests/transaction_signing_versioned_tests.rs
  • crates/types/tests/versioned_compact_roundtrip_tests.rs
  • crates/types/tests/versioned_json_serde_tests.rs
  • crates/utils/nextest-monitor/Cargo.toml
  • crates/utils/nextest-monitor/src/bin/nextest-report.rs
  • crates/utils/nextest-monitor/src/bin/nextest-wrapper.rs
  • crates/utils/nextest-monitor/src/memory_monitor.rs
  • xtask/Cargo.toml
  • xtask/src/failures.rs
  • xtask/src/main.rs

Comment on lines +1769 to 1779
if let Ok(block) = self.get_block_by_hash(&block_hash)
&& block.data_ledgers[ledger].tx_ids.0.contains(&txid)
{
tracing::info!(
"found block containing tx {} on {} after {} attempt(s)",
txid,
self.name.clone().unwrap_or_else(|| "genesis".to_string()),
attempt
);
return Ok(block);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Don't hide missing canonical blocks behind a timeout.

A hash coming from canonical_chain should always resolve in get_block_by_hash. Swallowing that error turns an invariant break into a slow “tx not found” timeout, which makes chain-test failures much harder to diagnose.

🩹 Proposed fix
-                if let Ok(block) = self.get_block_by_hash(&block_hash)
-                    && block.data_ledgers[ledger].tx_ids.0.contains(&txid)
-                {
-                    tracing::info!(
-                        "found block containing tx {} on {} after {} attempt(s)",
-                        txid,
-                        self.name.clone().unwrap_or_else(|| "genesis".to_string()),
-                        attempt
-                    );
-                    return Ok(block);
-                }
+                match self.get_block_by_hash(&block_hash) {
+                    Ok(block) if block.data_ledgers[ledger].tx_ids.0.contains(&txid) => {
+                        tracing::info!(
+                            "found block containing tx {} on {} after {} attempt(s)",
+                            txid,
+                            self.name.clone().unwrap_or_else(|| "genesis".to_string()),
+                            attempt
+                        );
+                        return Ok(block);
+                    }
+                    Ok(_) => {}
+                    Err(err) => {
+                        return Err(eyre!(
+                            "canonical block {} could not be loaded while searching for tx {}: {err:#}",
+                            block_hash,
+                            txid
+                        ));
+                    }
+                }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/chain-tests/src/utils.rs` around lines 1769 - 1779, The code currently
swallows errors from get_block_by_hash and treats them as a "tx not found"
timeout; instead propagate or surface the error immediately. Replace the
conditional pattern using if let Ok(block) = self.get_block_by_hash(&block_hash)
... with code that calls let block = self.get_block_by_hash(&block_hash)? (or
explicitly match Err and return Err with context) so that a missing/corrupt
canonical block from canonical_chain fails fast rather than turning into a slow
timeout; reference get_block_by_hash and canonical_chain to locate the change.

Comment thread crates/chain/src/chain.rs
Comment on lines 2132 to 2143
if let Ok(req) = PackingRequest::new(sm.clone(), PartitionChunkRange(interval))
&& let Err(e) = sender.send(req).await
{
if let Err(e) = sender.send(req).await {
tracing::event!(
target: "irys::packing",
tracing::Level::ERROR,
storage_module.id = %sm.id,
packing.interval = ?interval,
"Packing channel closed - {e}; failed to enqueue repacking request"
);
return; // assume this is unrecoverable
}
tracing::event!(
target: "irys::packing",
tracing::Level::ERROR,
storage_module.id = %sm.id,
packing.interval = ?interval,
"Packing channel closed - {e}; failed to enqueue repacking request"
);
return; // assume this is unrecoverable
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Handle PackingRequest::new errors explicitly to avoid silent dropped intervals.

At Line 2132, request-construction failures are currently ignored, so an uninitialized interval can be skipped without any signal. Please log (or propagate) constructor errors explicitly.

🔧 Proposed fix
             runtime_handle.spawn(async move {
                 for interval in uninitialized {
-                    if let Ok(req) = PackingRequest::new(sm.clone(), PartitionChunkRange(interval))
-                        && let Err(e) = sender.send(req).await
-                    {
-                        tracing::event!(
-                            target: "irys::packing",
-                            tracing::Level::ERROR,
-                            storage_module.id = %sm.id,
-                            packing.interval = ?interval,
-                            "Packing channel closed - {e}; failed to enqueue repacking request"
-                        );
-                        return; // assume this is unrecoverable
-                    }
+                    let req = match PackingRequest::new(sm.clone(), PartitionChunkRange(interval)) {
+                        Ok(req) => req,
+                        Err(e) => {
+                            tracing::event!(
+                                target: "irys::packing",
+                                tracing::Level::ERROR,
+                                storage_module.id = %sm.id,
+                                "Failed to build repacking request: {e}"
+                            );
+                            continue;
+                        }
+                    };
+
+                    if let Err(e) = sender.send(req).await {
+                        tracing::event!(
+                            target: "irys::packing",
+                            tracing::Level::ERROR,
+                            storage_module.id = %sm.id,
+                            packing.interval = ?interval,
+                            "Packing channel closed - {e}; failed to enqueue repacking request"
+                        );
+                        return; // assume this is unrecoverable
+                    }
                 }
             });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if let Ok(req) = PackingRequest::new(sm.clone(), PartitionChunkRange(interval))
&& let Err(e) = sender.send(req).await
{
if let Err(e) = sender.send(req).await {
tracing::event!(
target: "irys::packing",
tracing::Level::ERROR,
storage_module.id = %sm.id,
packing.interval = ?interval,
"Packing channel closed - {e}; failed to enqueue repacking request"
);
return; // assume this is unrecoverable
}
tracing::event!(
target: "irys::packing",
tracing::Level::ERROR,
storage_module.id = %sm.id,
packing.interval = ?interval,
"Packing channel closed - {e}; failed to enqueue repacking request"
);
return; // assume this is unrecoverable
}
let req = match PackingRequest::new(sm.clone(), PartitionChunkRange(interval)) {
Ok(req) => req,
Err(e) => {
tracing::event!(
target: "irys::packing",
tracing::Level::ERROR,
storage_module.id = %sm.id,
"Failed to build repacking request: {e}"
);
continue;
}
};
if let Err(e) = sender.send(req).await {
tracing::event!(
target: "irys::packing",
tracing::Level::ERROR,
storage_module.id = %sm.id,
packing.interval = ?interval,
"Packing channel closed - {e}; failed to enqueue repacking request"
);
return; // assume this is unrecoverable
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/chain/src/chain.rs` around lines 2132 - 2143, The PackingRequest::new
call is currently inside an if-let that ignores construction failures, so
construct the request explicitly and handle its Result: call
PackingRequest::new(sm.clone(), PartitionChunkRange(interval)) into a local
(e.g., let req_res = ...), match or if let Err(e) => log the constructor error
with context (include storage_module.id and packing.interval) and return or
propagate as appropriate, and on Ok(req) attempt sender.send(req).await and keep
the existing error handling for send failures (the tracing::event for channel
closed). This ensures constructor errors from PackingRequest::new are not
silently dropped.

Comment on lines +2 to +3
GossipServiceTestFixture, create_test_chunks, generate_test_tx, poll_until,
wait_until_listening,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
cargo fmt --all -- --check
cargo clippy --workspace --tests --all-targets

Repository: Irys-xyz/irys

Length of output: 435


🏁 Script executed:

cat -n crates/p2p/src/tests/integration/mod.rs | head -20

Repository: Irys-xyz/irys

Length of output: 813


Run cargo fmt --all and cargo clippy --workspace --tests --all-targets locally before submitting.

This is a Rust file requiring workspace checks per coding guidelines. The import reordering at lines 2-3 suggests formatting may have been addressed, but workspace verification tools (cargo fmt and cargo clippy) cannot execute in this environment. Please confirm these commands were run locally and passed before merging.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/p2p/src/tests/integration/mod.rs` around lines 2 - 3, This file
imports (GossipServiceTestFixture, create_test_chunks, generate_test_tx,
poll_until, wait_until_listening) may be misformatted or lint-violating; run
cargo fmt --all and cargo clippy --workspace --tests --all-targets locally, fix
any formatter or clippy warnings/errors (reorder or group imports, adjust code
to satisfy lints, add allow attributes where justified), re-run the commands
until they pass, then update the commit so the tests and formatting are clean
before merging.

@github-actions

Copy link
Copy Markdown
Contributor

@JesseTheRobot JesseTheRobot merged commit da9b360 into master Mar 30, 2026
26 checks passed
@JesseTheRobot JesseTheRobot deleted the fix/edition-unify branch March 30, 2026 21:10
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.

1 participant