Skip to content

Conversation

craigmayhew
Copy link
Contributor

@craigmayhew craigmayhew commented Oct 2, 2025

Describe the changes

Migrate partition mining from Actix actors to Tokio services; extend broadcaster to support Tokio subscribers.

  • Motivation

    • Simplify concurrency model, reduce Actix arbiters, unify with other Tokio services, improve testability.
  • Key changes

    • New modules/types: partition_mining_service.rs, PartitionMiningService, PartitionMiningServiceInner, PartitionMiningController.
    • Broadcaster additions: MiningBroadcastEvent, SubscribeTokio, UnsubscribeTokio (best-effort).
    • Removal: addresses.rs and ActorAddresses.
    • Macro/import cleanup: $crate::storage::ie in macros; removed stray ie imports.
    • Observability: added warnings/errors when packing channel try_send is Full/Closed to surface backpressure and failures.
  • Behavioral changes

    • Partition mining now runs as Tokio tasks, controlled via PartitionMiningController.
    • BroadcastMiningService fans out to both Actix and Tokio subscribers; closed Tokio channels are pruned on send failure. Unbounded channels are used.
  • Chain initialization changes

    • Removed ActorAddresses and the set of PartitionMiningActor addresses.
    • Added partition_controllers: Vec<PartitionMiningController> on IrysNodeCtx.
    • Replaced init_partition_mining_actor with init_partition_mining_services returning (Vec<PartitionMiningController>, Vec<TokioServiceHandle>).
    • Call sites switched from sending MiningControl to ctrl.set_mining(should_mine).
  • Operational considerations

    • Packing channel now logs when saturated/closed, aiding visibility into backpressure.
    • BroadcastMiningService should be registered before miners spawn (tests ensure via from_registry()).
  • Testing

    • Tests migrated to tokio::test where appropriate and ensure broadcaster init before miners.
    • Added/updated comments in epoch snapshot tests to clarify partition expiration and repacking behavior.

Follow up PR / out of scope

  • Replace the Actix broadcaster with a Tokio-native bus and remove all actix references from partition_mining_service.rs.
  • Remove Actix System/Arbiter usages from chain.
  • Migrate non-partition tests and services off Actix patterns (e.g., #[actix::test], actix_rt::time::sleep, actix::Message usage in unrelated services).
  • Remove packing sender as a param of ServiceSendersInner::init_with_sender() and move it to be a "regular" member of ServiceSenders.

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

This is the second of three PRS for actix->tokio
Previous in series of actix removal PRs: #829
Next in series of actix removal PRs: #869

…nd PackingHandle, remove Addr<PackingActor> from ActorAddresses/chain, and rewire all call sites to use the handle. Improve wait_for_packing to be race-resistant, update tests and multi-node flows accordingly, and fix runtime handle usage in remote-packing tests.
@craigmayhew
Copy link
Contributor Author

craigmayhew commented Oct 14, 2025

Flagging flaky tests:

FLAKY 2/2 block_production::block_production::heavy_test_always_build_on_max_difficulty_block
FLAKY 2/2 irys-chain::mod::multi_node::mempool_tests::slow_heavy_mempool_publish_fork_recovery_test::case_1_full_validation
FLAKY 2/2 irys-chain::mod::multi_node::validation::heavy_block_invalid_evm_block_reward_gets_rejected
FLAKY 2/2 irys-p2p::tests::integration::heavy_should_not_resend_recently_seen_data
TRY 2 TMT irys-actors::data_sync_test::slow_test_data_sync_with_different_peer_performance

@craigmayhew craigmayhew marked this pull request as ready for review October 14, 2025 10:43
@craigmayhew
Copy link
Contributor Author

Flagging flaky tests:
FLAKY 2/2 [ 12.331s] irys-chain::mod synchronization::heavy_should_resume_from_the_same_block
TRY 2 FAIL [ 11.811s] irys-chain::mod multi_node::reth_restart::reth_restarts_use_block_index_before_sync

@craigmayhew
Copy link
Contributor Author

craigmayhew commented Oct 14, 2025

This has received some review via slack. Merging and will take any feedback into the next PR in the series to remove actix.

@craigmayhew craigmayhew merged commit 0f05611 into master Oct 14, 2025
24 of 25 checks passed
@craigmayhew craigmayhew deleted the craig/actix-tokio-partitions branch October 14, 2025 16:06
@craigmayhew craigmayhew mentioned this pull request Oct 15, 2025
3 tasks
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