R003-parallel_consensus.plan.cspec
1 # R003-parallel_consensus.plan.cspec 2 # Implementation Plan for Parallel Consensus Execution 3 4 # === PLAN METADATA === 5 plan_metadata: 6 component_id: R003 7 component_ref: components/runtime/R003-parallel_consensus.component.cspec 8 plan_version: 1.1.0 9 plan_status: draft 10 created: 2026-01-07 11 updated: 2026-01-07 12 13 # === WAVE CONTEXT === 14 wave_context: 15 topological_level: 2 16 is_root: false 17 upstream_components: [R001, R002] 18 downstream_components: [R004, R005] 19 critical_path: true 20 cascade_group: runtime 21 22 # === PHASES === 23 phases: 24 - phase_id: phase_1 25 name: Parallel Consensus Types and Configuration 26 status: pending 27 blocked_by: 28 - dependency_ref: R001.phase_2 29 reason: Requires dual runtime orchestration framework 30 wait_for: complete 31 - dependency_ref: R002.interface_validator_set 32 reason: Need validator set management for consensus coordination 33 wait_for: interface_stable 34 35 tasks: 36 - task_id: R003-T001 37 name: Define parallel consensus types 38 description: | 39 Core types for parallel Alpha/Delta consensus: 40 - ChainId: enum for Alpha/Delta chain identification 41 - ParallelRound: independent round tracking per chain 42 - CoordinationPoint: epoch boundary, sAX lock, governance execution 43 - SyncStatus: per-chain synchronization state 44 target_files: 45 - path: src/parallel/types.rs 46 action: create 47 estimate: 48 effort: medium 49 confidence: high 50 risk: 51 level: low 52 factors: 53 - well_defined_from_spec 54 55 - task_id: R003-T002 56 name: Define timing configuration per chain 57 description: | 58 Chain-specific timing parameters: 59 - Alpha: 15s block time, port_p2p:4130, port_api:3030 60 - Delta: 3s block time, port_p2p:4131, port_api:4030 61 - Ratio: 5 Delta blocks per Alpha block 62 - Epoch boundary timing synchronization 63 target_files: 64 - path: src/parallel/timing.rs 65 action: create 66 estimate: 67 effort: small 68 confidence: high 69 risk: 70 level: low 71 factors: [] 72 73 - task_id: R003-T003 74 name: Implement chain isolation traits 75 description: | 76 Trait definitions for chain independence: 77 - ChainConsensus trait: run_round, propose_block, vote 78 - ChainState trait: get_state, apply_block 79 - ChainNetwork trait: broadcast, receive 80 These ensure Alpha and Delta can run independently. 81 target_files: 82 - path: src/parallel/traits.rs 83 action: create 84 estimate: 85 effort: medium 86 confidence: high 87 risk: 88 level: low 89 factors: 90 - interface_design 91 92 deliverables: 93 - deliverable_id: R003-D001 94 name: Parallel consensus types 95 type: code 96 verification: cargo test parallel::types 97 - deliverable_id: R003-D002 98 name: Timing configuration 99 type: code 100 verification: cargo test parallel::timing 101 - deliverable_id: R003-D003 102 name: Chain isolation traits 103 type: interface 104 verification: cargo test parallel::traits 105 106 test_requirements: 107 unit: 108 - test_id: R003-U001 109 description: Verify ChainId serialization and equality 110 - test_id: R003-U002 111 description: Verify timing ratio calculation (5 Delta per Alpha) 112 - test_id: R003-U003 113 description: Verify trait default implementations 114 115 success_criteria: 116 - Types compile and serialize correctly 117 - Timing parameters match spec (Alpha 15s, Delta 3s) 118 - Traits provide clear chain isolation interface 119 120 estimated_duration: 2d 121 122 - phase_id: phase_2 123 name: Independent Alpha Consensus Round 124 status: pending 125 blocked_by: 126 - dependency_ref: R003.phase_1 127 reason: Requires parallel consensus types and traits 128 wait_for: complete 129 - dependency_ref: R002.interface_bft_consensus 130 reason: Need BFT consensus protocol for round execution 131 wait_for: interface_stable 132 - dependency_ref: R001.interface_alpha_api 133 reason: Need Alpha runtime API for state access 134 wait_for: interface_stable 135 136 tasks: 137 - task_id: R003-T004 138 name: Implement Alpha consensus round driver 139 description: | 140 Alpha-specific consensus round implementation: 141 - Implements ChainConsensus trait for Alpha 142 - 15s block time with BFT rounds 143 - Record sparse merkle state updates 144 - credits.alpha program execution context 145 target_files: 146 - path: src/parallel/alpha_round.rs 147 action: create 148 estimate: 149 effort: large 150 confidence: medium 151 risk: 152 level: high 153 factors: 154 - alpha_state_model 155 - privacy_constraints 156 157 - task_id: R003-T005 158 name: Implement Alpha block timing coordinator 159 description: | 160 Timing control for Alpha blocks: 161 - 15s target block time enforcement 162 - Slot-based scheduling 163 - Drift compensation 164 - Round timeout handling (Alpha-specific) 165 target_files: 166 - path: src/parallel/alpha_timing.rs 167 action: create 168 estimate: 169 effort: medium 170 confidence: medium 171 risk: 172 level: medium 173 factors: 174 - timing_precision 175 - clock_drift 176 177 - task_id: R003-T006 178 name: Implement Alpha finality tracker 179 description: | 180 Track Alpha chain finality independently: 181 - 3-block probabilistic finality (~45s for Alpha) 182 - Emit alpha_block_finalized events 183 - Track finality for cross-chain attestation 184 target_files: 185 - path: src/parallel/alpha_finality.rs 186 action: create 187 estimate: 188 effort: medium 189 confidence: high 190 risk: 191 level: medium 192 factors: 193 - finality_guarantees 194 195 deliverables: 196 - deliverable_id: R003-D004 197 name: Alpha consensus round driver 198 type: code 199 verification: cargo test parallel::alpha_round 200 - deliverable_id: R003-D005 201 name: Alpha timing coordinator 202 type: code 203 verification: cargo test parallel::alpha_timing 204 - deliverable_id: R003-D006 205 name: Alpha finality tracker 206 type: code 207 verification: cargo test parallel::alpha_finality 208 209 test_requirements: 210 unit: 211 - test_id: R003-U004 212 description: Verify Alpha round produces blocks at 15s intervals 213 - test_id: R003-U005 214 description: Verify Alpha timing drift compensation 215 - test_id: R003-U006 216 description: Verify Alpha finality at 3 blocks (~45s) 217 integration: 218 - test_id: R003-I001 219 description: Alpha consensus standalone block production 220 dependencies: [phase_1] 221 222 success_criteria: 223 - Alpha rounds execute independently 224 - 15s block time maintained within tolerance 225 - alpha_block_finalized events emitted correctly 226 - Privacy constraints preserved 227 228 estimated_duration: 4d 229 230 - phase_id: phase_3 231 name: Independent Delta Consensus Round 232 status: pending 233 blocked_by: 234 - dependency_ref: R003.phase_1 235 reason: Requires parallel consensus types and traits 236 wait_for: complete 237 - dependency_ref: R002.interface_bft_consensus 238 reason: Need BFT consensus protocol for round execution 239 wait_for: interface_stable 240 - dependency_ref: R001.interface_delta_api 241 reason: Need Delta runtime API for state access 242 wait_for: interface_stable 243 244 tasks: 245 - task_id: R003-T007 246 name: Implement Delta consensus round driver 247 description: | 248 Delta-specific consensus round implementation: 249 - Implements ChainConsensus trait for Delta 250 - 3s block time with BFT rounds (5x faster than Alpha) 251 - Account-based state model 252 - Full VM program execution context 253 - Higher throughput transaction ordering 254 target_files: 255 - path: src/parallel/delta_round.rs 256 action: create 257 estimate: 258 effort: large 259 confidence: medium 260 risk: 261 level: high 262 factors: 263 - delta_state_model 264 - throughput_requirements 265 266 - task_id: R003-T008 267 name: Implement Delta block timing coordinator 268 description: | 269 Timing control for Delta blocks: 270 - 3s target block time enforcement 271 - Fast slot scheduling (5 slots per Alpha slot) 272 - Minimal drift tolerance 273 - Optimized round timeout (tighter than Alpha) 274 target_files: 275 - path: src/parallel/delta_timing.rs 276 action: create 277 estimate: 278 effort: medium 279 confidence: medium 280 risk: 281 level: medium 282 factors: 283 - tight_timing 284 - throughput_pressure 285 286 - task_id: R003-T009 287 name: Implement Delta finality tracker 288 description: | 289 Track Delta chain finality independently: 290 - 3-block probabilistic finality (~9s for Delta) 291 - Emit delta_block_finalized events 292 - Fast finality for DEX operations 293 target_files: 294 - path: src/parallel/delta_finality.rs 295 action: create 296 estimate: 297 effort: medium 298 confidence: high 299 risk: 300 level: medium 301 factors: 302 - finality_guarantees 303 304 deliverables: 305 - deliverable_id: R003-D007 306 name: Delta consensus round driver 307 type: code 308 verification: cargo test parallel::delta_round 309 - deliverable_id: R003-D008 310 name: Delta timing coordinator 311 type: code 312 verification: cargo test parallel::delta_timing 313 - deliverable_id: R003-D009 314 name: Delta finality tracker 315 type: code 316 verification: cargo test parallel::delta_finality 317 318 test_requirements: 319 unit: 320 - test_id: R003-U007 321 description: Verify Delta round produces blocks at 3s intervals 322 - test_id: R003-U008 323 description: Verify Delta timing maintains 5:1 ratio with Alpha 324 - test_id: R003-U009 325 description: Verify Delta finality at 3 blocks (~9s) 326 integration: 327 - test_id: R003-I002 328 description: Delta consensus standalone block production 329 dependencies: [phase_1] 330 331 success_criteria: 332 - Delta rounds execute independently 333 - 3s block time maintained within tolerance 334 - delta_block_finalized events emitted correctly 335 - High throughput DEX transaction handling 336 337 estimated_duration: 4d 338 339 - phase_id: phase_4 340 name: Parallel Execution Engine 341 status: pending 342 blocked_by: 343 - dependency_ref: R003.phase_2 344 reason: Requires Alpha consensus round driver 345 wait_for: complete 346 - dependency_ref: R003.phase_3 347 reason: Requires Delta consensus round driver 348 wait_for: complete 349 - dependency_ref: R001.interface_dual_runtime 350 reason: Need orchestration for spawning parallel chains 351 wait_for: interface_stable 352 353 tasks: 354 - task_id: R003-T010 355 name: Implement parallel consensus executor 356 description: | 357 Main executor for running Alpha and Delta consensus in parallel: 358 - Spawn separate tokio tasks for each chain 359 - Independent failure domains 360 - Resource isolation (CPU, memory bounds) 361 - Chain-specific optimizations enabled 362 target_files: 363 - path: src/parallel/executor.rs 364 action: create 365 estimate: 366 effort: large 367 confidence: medium 368 risk: 369 level: high 370 factors: 371 - async_coordination 372 - resource_contention 373 374 - task_id: R003-T011 375 name: Implement chain health monitoring 376 description: | 377 Monitor health of parallel chain execution: 378 - Track block production rate per chain 379 - Detect stalled chains 380 - Alert on timing drift 381 - Chain-specific health metrics 382 target_files: 383 - path: src/parallel/health.rs 384 action: create 385 estimate: 386 effort: medium 387 confidence: high 388 risk: 389 level: low 390 factors: [] 391 392 - task_id: R003-T012 393 name: Implement graceful degradation 394 description: | 395 Handle chain-specific failures gracefully: 396 - One chain failing doesn't stop the other 397 - Recovery procedures per chain 398 - State consistency on restart 399 - Logging and alerting 400 target_files: 401 - path: src/parallel/degradation.rs 402 action: create 403 estimate: 404 effort: medium 405 confidence: medium 406 risk: 407 level: medium 408 factors: 409 - failure_modes 410 - recovery_complexity 411 412 deliverables: 413 - deliverable_id: R003-D010 414 name: Parallel consensus executor 415 type: code 416 verification: cargo test parallel::executor 417 - deliverable_id: R003-D011 418 name: Chain health monitoring 419 type: code 420 verification: cargo test parallel::health 421 - deliverable_id: R003-D012 422 name: Graceful degradation 423 type: code 424 verification: cargo test parallel::degradation 425 426 test_requirements: 427 unit: 428 - test_id: R003-U010 429 description: Verify parallel task spawning 430 - test_id: R003-U011 431 description: Verify health metric collection 432 - test_id: R003-U012 433 description: Verify single chain failure isolation 434 integration: 435 - test_id: R003-I003 436 description: Both chains running in parallel 437 dependencies: [phase_2, phase_3] 438 - test_id: R003-I004 439 description: One chain failure doesn't affect other 440 dependencies: [phase_2, phase_3] 441 442 success_criteria: 443 - Both chains execute in parallel 444 - Independent failure domains confirmed 445 - Health metrics accurate for both chains 446 - Graceful degradation on single chain failure 447 448 estimated_duration: 4d 449 450 - phase_id: phase_5 451 name: Coordination Points - sAX Lock/Unlock 452 status: pending 453 blocked_by: 454 - dependency_ref: R003.phase_4 455 reason: Requires parallel execution engine 456 wait_for: complete 457 - dependency_ref: R001.interface_ipc_channel 458 reason: Need IPC for cross-chain attestation 459 wait_for: interface_stable 460 461 tasks: 462 - task_id: R003-T013 463 name: Implement sAX lock attestation 464 description: | 465 Cross-chain sAX lock coordination: 466 - Alpha records sAX lock in credits.alpha 467 - Attestation sent to Delta via IPC 468 - Delta verifies attestation before action 469 - Emit sax_lock_attested event 470 target_files: 471 - path: src/parallel/sax_lock.rs 472 action: create 473 estimate: 474 effort: large 475 confidence: medium 476 risk: 477 level: high 478 factors: 479 - cross_chain_atomicity 480 - attestation_security 481 482 - task_id: R003-T014 483 name: Implement sAX unlock flow 484 description: | 485 sAX unlock after time-lock expiry: 486 - Delta initiates unlock request 487 - Alpha verifies time-lock conditions 488 - Attestation confirms unlock 489 - State updated on both chains 490 target_files: 491 - path: src/parallel/sax_unlock.rs 492 action: create 493 estimate: 494 effort: large 495 confidence: medium 496 risk: 497 level: high 498 factors: 499 - time_lock_verification 500 - state_consistency 501 502 - task_id: R003-T015 503 name: Implement attestation verification 504 description: | 505 Verify cross-chain attestations: 506 - Signature verification from Alpha validators 507 - Finality proof verification 508 - State root inclusion proof 509 - Rejection of stale attestations 510 target_files: 511 - path: src/parallel/attestation_verify.rs 512 action: create 513 estimate: 514 effort: large 515 confidence: medium 516 risk: 517 level: high 518 factors: 519 - proof_verification 520 - security_critical 521 522 deliverables: 523 - deliverable_id: R003-D013 524 name: sAX lock attestation 525 type: code 526 verification: cargo test parallel::sax_lock 527 - deliverable_id: R003-D014 528 name: sAX unlock flow 529 type: code 530 verification: cargo test parallel::sax_unlock 531 - deliverable_id: R003-D015 532 name: Attestation verification 533 type: code 534 verification: cargo test parallel::attestation_verify 535 536 test_requirements: 537 unit: 538 - test_id: R003-U013 539 description: Verify sAX lock attestation creation 540 - test_id: R003-U014 541 description: Verify sAX unlock conditions 542 - test_id: R003-U015 543 description: Verify attestation signature validation 544 integration: 545 - test_id: R003-I005 546 description: Full sAX lock/unlock flow 547 dependencies: [phase_4] 548 - test_id: R003-I006 549 description: Attestation verification across chains 550 dependencies: [phase_4] 551 552 success_criteria: 553 - sAX lock recorded and attested across chains 554 - sAX unlock correctly verified 555 - Invalid attestations rejected 556 - sax_lock_attested events emitted 557 558 estimated_duration: 5d 559 560 - phase_id: phase_6 561 name: Coordination Points - Governance Execution 562 status: pending 563 blocked_by: 564 - dependency_ref: R003.phase_4 565 reason: Requires parallel execution engine 566 wait_for: complete 567 - dependency_ref: R001.interface_ipc_channel 568 reason: Need IPC for governance attestation 569 wait_for: interface_stable 570 571 tasks: 572 - task_id: R003-T016 573 name: Implement governance vote flow 574 description: | 575 Delta governance voting: 576 - Proposal creation on Delta 577 - Vote collection and tallying 578 - Quorum and threshold verification 579 - Emit governance vote result 580 target_files: 581 - path: src/parallel/governance_vote.rs 582 action: create 583 estimate: 584 effort: medium 585 confidence: medium 586 risk: 587 level: medium 588 factors: 589 - voting_correctness 590 591 - task_id: R003-T017 592 name: Implement governance execution on Alpha 593 description: | 594 Execute approved governance on Alpha: 595 - Receive governance approval from Delta via IPC 596 - Verify governance attestation 597 - Execute GID (governance ID) updates on Alpha 598 - Emit governance_executed event 599 target_files: 600 - path: src/parallel/governance_execute.rs 601 action: create 602 estimate: 603 effort: large 604 confidence: medium 605 risk: 606 level: high 607 factors: 608 - cross_chain_execution 609 - governance_security 610 611 - task_id: R003-T018 612 name: Implement governance attestation 613 description: | 614 Cross-chain governance attestation: 615 - Delta generates governance result attestation 616 - Alpha verifies attestation validity 617 - Time-bounded execution window 618 - Rejection of expired governance 619 target_files: 620 - path: src/parallel/governance_attestation.rs 621 action: create 622 estimate: 623 effort: medium 624 confidence: medium 625 risk: 626 level: medium 627 factors: 628 - attestation_timing 629 630 deliverables: 631 - deliverable_id: R003-D016 632 name: Governance vote flow 633 type: code 634 verification: cargo test parallel::governance_vote 635 - deliverable_id: R003-D017 636 name: Governance execution 637 type: code 638 verification: cargo test parallel::governance_execute 639 - deliverable_id: R003-D018 640 name: Governance attestation 641 type: code 642 verification: cargo test parallel::governance_attestation 643 644 test_requirements: 645 unit: 646 - test_id: R003-U016 647 description: Verify governance vote tallying 648 - test_id: R003-U017 649 description: Verify governance execution on Alpha 650 - test_id: R003-U018 651 description: Verify governance attestation validity 652 integration: 653 - test_id: R003-I007 654 description: Full governance vote to execution flow 655 dependencies: [phase_4] 656 657 success_criteria: 658 - Governance votes recorded correctly on Delta 659 - Approved governance executed on Alpha 660 - governance_executed events emitted 661 - Invalid/expired governance rejected 662 663 estimated_duration: 4d 664 665 - phase_id: phase_7 666 name: Epoch Boundary Synchronization 667 status: pending 668 blocked_by: 669 - dependency_ref: R003.phase_5 670 reason: Requires sAX lock coordination 671 wait_for: complete 672 - dependency_ref: R003.phase_6 673 reason: Requires governance coordination 674 wait_for: complete 675 - dependency_ref: R002.interface_validator_set 676 reason: Need validator set for epoch changes 677 wait_for: interface_stable 678 679 tasks: 680 - task_id: R003-T019 681 name: Implement epoch boundary detection 682 description: | 683 Detect and coordinate epoch boundaries: 684 - Track epoch progress on both chains 685 - Synchronize epoch boundary timing 686 - Buffer cross-chain operations near boundary 687 - Emit epoch_boundary_reached event 688 target_files: 689 - path: src/parallel/epoch_boundary.rs 690 action: create 691 estimate: 692 effort: large 693 confidence: medium 694 risk: 695 level: high 696 factors: 697 - timing_synchronization 698 - boundary_edge_cases 699 700 - task_id: R003-T020 701 name: Implement validator set synchronization 702 description: | 703 Synchronize validator sets at epoch boundary: 704 - Coordinate validator set changes 705 - Both chains update to same validator set 706 - Handle stake changes atomically 707 - Verify synchronized state 708 target_files: 709 - path: src/parallel/validator_sync.rs 710 action: create 711 estimate: 712 effort: large 713 confidence: medium 714 risk: 715 level: high 716 factors: 717 - validator_coordination 718 - state_consistency 719 720 - task_id: R003-T021 721 name: Implement epoch transition protocol 722 description: | 723 Protocol for safe epoch transitions: 724 - Pause cross-chain operations 725 - Verify both chains at boundary 726 - Apply validator set changes 727 - Resume operations with new epoch 728 target_files: 729 - path: src/parallel/epoch_transition.rs 730 action: create 731 estimate: 732 effort: large 733 confidence: medium 734 risk: 735 level: high 736 factors: 737 - transition_safety 738 - coordination_deadlock 739 740 deliverables: 741 - deliverable_id: R003-D019 742 name: Epoch boundary detection 743 type: code 744 verification: cargo test parallel::epoch_boundary 745 - deliverable_id: R003-D020 746 name: Validator set synchronization 747 type: code 748 verification: cargo test parallel::validator_sync 749 - deliverable_id: R003-D021 750 name: Epoch transition protocol 751 type: code 752 verification: cargo test parallel::epoch_transition 753 754 test_requirements: 755 unit: 756 - test_id: R003-U019 757 description: Verify epoch boundary detection 758 - test_id: R003-U020 759 description: Verify validator set sync correctness 760 - test_id: R003-U021 761 description: Verify epoch transition state machine 762 integration: 763 - test_id: R003-I008 764 description: Full epoch transition across both chains 765 dependencies: [phase_5, phase_6] 766 - test_id: R003-I009 767 description: Validator set change at epoch boundary 768 dependencies: [phase_5, phase_6] 769 770 success_criteria: 771 - Epoch boundaries detected and synchronized 772 - Validator sets updated atomically 773 - epoch_boundary_reached events emitted 774 - No cross-chain inconsistency at boundaries 775 776 estimated_duration: 5d 777 778 - phase_id: phase_8 779 name: Integration Tests and Benchmarks 780 status: pending 781 blocked_by: 782 - dependency_ref: R003.phase_7 783 reason: Requires epoch boundary synchronization 784 wait_for: complete 785 - dependency_ref: R002.phase_8 786 reason: Need BFT integration tests for baseline 787 wait_for: complete 788 789 tasks: 790 - task_id: R003-T022 791 name: Create parallel consensus test harness 792 description: | 793 Test harness for parallel consensus: 794 - Simulated dual-chain environment 795 - Configurable timing parameters 796 - Deterministic test execution 797 - Metrics collection for validation 798 target_files: 799 - path: tests/parallel/harness.rs 800 action: create 801 estimate: 802 effort: medium 803 confidence: high 804 risk: 805 level: low 806 factors: [] 807 808 - task_id: R003-T023 809 name: Implement parallel execution tests 810 description: | 811 Tests for parallel chain execution: 812 - Verify 5:1 Delta:Alpha block ratio 813 - Verify independent failure domains 814 - Verify timing accuracy under load 815 - Verify resource isolation 816 target_files: 817 - path: tests/parallel/execution_tests.rs 818 action: create 819 estimate: 820 effort: large 821 confidence: medium 822 risk: 823 level: medium 824 factors: 825 - test_complexity 826 - timing_sensitivity 827 828 - task_id: R003-T024 829 name: Implement coordination point tests 830 description: | 831 Tests for coordination points: 832 - sAX lock/unlock flow tests 833 - Governance execution tests 834 - Epoch boundary tests 835 - Error handling tests 836 target_files: 837 - path: tests/parallel/coordination_tests.rs 838 action: create 839 estimate: 840 effort: large 841 confidence: medium 842 risk: 843 level: medium 844 factors: 845 - cross_chain_test_complexity 846 847 - task_id: R003-T025 848 name: Implement performance benchmarks 849 description: | 850 Benchmarks for parallel consensus: 851 - Block production throughput 852 - Cross-chain attestation latency 853 - Epoch transition time 854 - Memory usage under dual-chain load 855 target_files: 856 - path: benches/parallel_bench.rs 857 action: create 858 estimate: 859 effort: medium 860 confidence: high 861 risk: 862 level: low 863 factors: [] 864 865 deliverables: 866 - deliverable_id: R003-D022 867 name: Parallel test harness 868 type: test 869 verification: cargo test --test harness 870 - deliverable_id: R003-D023 871 name: Execution tests 872 type: test 873 verification: cargo test --test execution_tests 874 - deliverable_id: R003-D024 875 name: Coordination tests 876 type: test 877 verification: cargo test --test coordination_tests 878 - deliverable_id: R003-D025 879 name: Performance benchmarks 880 type: test 881 verification: cargo bench --bench parallel_bench 882 883 test_requirements: 884 integration: 885 - test_id: R003-I010 886 description: Full parallel consensus lifecycle 887 dependencies: [phase_7] 888 - test_id: R003-I011 889 description: All coordination points under load 890 dependencies: [phase_7] 891 - test_id: R003-I012 892 description: Performance targets met 893 dependencies: [phase_7] 894 895 success_criteria: 896 - All integration tests pass 897 - 5:1 block ratio maintained 898 - Coordination points work correctly 899 - Performance benchmarks meet targets 900 901 estimated_duration: 4d 902 903 # === PARALLEL WORKSTREAMS === 904 # Tests, CI, and docs evolve alongside implementation 905 parallel_workstreams: 906 907 testing: 908 strategy: test_alongside 909 coverage_targets: 910 unit_minimum: 80 911 integration_required: true 912 913 per_phase_requirements: 914 - phase_ref: phase_1 915 unit_tests: 916 - ChainId serialization and equality 917 - Timing ratio calculation (5 Delta per Alpha) 918 - Trait default implementations 919 - Parallel consensus type validation 920 test_files: 921 - path: src/parallel/types_tests.rs 922 action: create 923 - path: src/parallel/timing_tests.rs 924 action: create 925 - path: src/parallel/traits_tests.rs 926 action: create 927 928 - phase_ref: phase_2 929 unit_tests: 930 - Alpha round produces blocks at 15s intervals 931 - Alpha timing drift compensation 932 - Alpha finality at 3 blocks (~45s) 933 integration_tests: 934 - Alpha consensus standalone block production 935 test_files: 936 - path: src/parallel/alpha_round_tests.rs 937 action: create 938 - path: src/parallel/alpha_timing_tests.rs 939 action: create 940 - path: tests/parallel/alpha_standalone.rs 941 action: create 942 943 - phase_ref: phase_3 944 unit_tests: 945 - Delta round produces blocks at 3s intervals 946 - Delta timing maintains 5:1 ratio with Alpha 947 - Delta finality at 3 blocks (~9s) 948 integration_tests: 949 - Delta consensus standalone block production 950 test_files: 951 - path: src/parallel/delta_round_tests.rs 952 action: create 953 - path: src/parallel/delta_timing_tests.rs 954 action: create 955 - path: tests/parallel/delta_standalone.rs 956 action: create 957 958 - phase_ref: phase_4 959 unit_tests: 960 - Parallel task spawning 961 - Health metric collection 962 - Single chain failure isolation 963 integration_tests: 964 - Both chains running in parallel 965 - One chain failure doesn't affect other 966 test_files: 967 - path: src/parallel/executor_tests.rs 968 action: create 969 - path: src/parallel/health_tests.rs 970 action: create 971 - path: tests/parallel/dual_chain.rs 972 action: create 973 974 - phase_ref: phase_5 975 unit_tests: 976 - sAX lock attestation creation 977 - sAX unlock conditions 978 - Attestation signature validation 979 integration_tests: 980 - Full sAX lock/unlock flow 981 - Attestation verification across chains 982 test_files: 983 - path: src/parallel/sax_lock_tests.rs 984 action: create 985 - path: src/parallel/attestation_verify_tests.rs 986 action: create 987 - path: tests/parallel/sax_flow.rs 988 action: create 989 990 - phase_ref: phase_6 991 unit_tests: 992 - Governance vote tallying 993 - Governance execution on Alpha 994 - Governance attestation validity 995 integration_tests: 996 - Full governance vote to execution flow 997 test_files: 998 - path: src/parallel/governance_vote_tests.rs 999 action: create 1000 - path: src/parallel/governance_execute_tests.rs 1001 action: create 1002 - path: tests/parallel/governance_flow.rs 1003 action: create 1004 1005 - phase_ref: phase_7 1006 unit_tests: 1007 - Epoch boundary detection 1008 - Validator set sync correctness 1009 - Epoch transition state machine 1010 integration_tests: 1011 - Full epoch transition across both chains 1012 - Validator set change at epoch boundary 1013 test_files: 1014 - path: src/parallel/epoch_boundary_tests.rs 1015 action: create 1016 - path: src/parallel/validator_sync_tests.rs 1017 action: create 1018 - path: tests/parallel/epoch_transition.rs 1019 action: create 1020 1021 - phase_ref: phase_8 1022 integration_tests: 1023 - Full parallel consensus lifecycle 1024 - All coordination points under load 1025 - Performance targets met (5:1 block ratio) 1026 test_files: 1027 - path: tests/parallel/harness.rs 1028 action: create 1029 - path: tests/parallel/execution_tests.rs 1030 action: create 1031 - path: tests/parallel/coordination_tests.rs 1032 action: create 1033 - path: benches/parallel_bench.rs 1034 action: create 1035 1036 ci_test_gates: 1037 - gate_id: unit_tests 1038 command: cargo test --workspace 1039 required: true 1040 - gate_id: integration_tests 1041 command: cargo test --test '*' 1042 required: true 1043 - gate_id: clippy 1044 command: cargo clippy --workspace -- -D warnings 1045 required: true 1046 - gate_id: fmt 1047 command: cargo fmt --check 1048 required: true 1049 1050 ci_workflows: 1051 affected_workflows: 1052 - workflow_file: .forgejo/workflows/ci.yml 1053 repo: adnet 1054 triggers: [phase_1, phase_4, phase_7, phase_8] 1055 1056 per_phase_ci_tasks: 1057 - phase_ref: phase_1 1058 workflow_changes: 1059 - file: .forgejo/workflows/ci.yml 1060 change_type: modify_job 1061 description: Ensure parallel consensus module build and test job exists 1062 1063 - phase_ref: phase_4 1064 workflow_changes: 1065 - file: .forgejo/workflows/ci.yml 1066 change_type: add_step 1067 description: Add dual-chain parallel execution test step 1068 1069 - phase_ref: phase_7 1070 workflow_changes: 1071 - file: .forgejo/workflows/ci.yml 1072 change_type: add_step 1073 description: Add epoch boundary integration test step 1074 1075 - phase_ref: phase_8 1076 workflow_changes: 1077 - file: .forgejo/workflows/ci.yml 1078 change_type: add_job 1079 description: Add parallel consensus benchmarks job (non-blocking) 1080 - file: .forgejo/workflows/ci.yml 1081 change_type: add_artifact 1082 description: Archive parallel consensus benchmark results 1083 1084 required_ci_checks: 1085 - check_name: build 1086 check_type: build 1087 blocking: true 1088 - check_name: test 1089 check_type: test 1090 blocking: true 1091 - check_name: clippy 1092 check_type: lint 1093 blocking: true 1094 - check_name: fmt 1095 check_type: lint 1096 blocking: true 1097 - check_name: parallel_bench 1098 check_type: bench 1099 blocking: false 1100 1101 documentation: 1102 cspec_update_policy: on_interface_change 1103 1104 component_cspec_updates: 1105 - cspec_file: components/runtime/R003-parallel_consensus.component.cspec 1106 update_triggers: 1107 - phase_ref: phase_1 1108 fields_to_update: [implementation_status] 1109 description: Mark parallel types foundation complete 1110 - phase_ref: phase_4 1111 fields_to_update: [implementation_status, interfaces] 1112 description: Mark parallel execution interface available 1113 - phase_ref: phase_5 1114 fields_to_update: [implementation_status, interfaces] 1115 description: Mark coordination points interface available 1116 - phase_ref: phase_8 1117 fields_to_update: [implementation_status, interfaces] 1118 description: Mark all parallel consensus interfaces stable 1119 1120 session_logging: 1121 required: true 1122 log_location: sessions/ 1123 log_format: cspec 1124 log_triggers: 1125 - phase_complete 1126 - blocker_encountered 1127 - interface_change 1128 - major_decision 1129 - cross_chain_coordination_issue 1130 1131 changelog_policy: 1132 update_frequency: per_phase 1133 required_fields: 1134 - version 1135 - date 1136 - type 1137 - description 1138 - affected_interfaces 1139 1140 human_doc_derivation: 1141 target_human_doc: project/architecture/human/parallel-consensus.md 1142 regenerate_triggers: 1143 - phase_4 # Parallel execution interface stable 1144 - phase_7 # Epoch sync interface stable 1145 - phase_8 # All interfaces stable 1146 1147 # === INTERFACE COMMITMENTS === 1148 interface_commitments: 1149 provides: 1150 - interface_id: interface_parallel_execution 1151 name: Parallel Consensus Execution Interface 1152 stability: experimental 1153 available_from: phase_4 1154 stable_from: phase_8 1155 consumers: [R004, R005] 1156 1157 - interface_id: interface_alpha_consensus_round 1158 name: Alpha Consensus Round Interface 1159 stability: unstable 1160 available_from: phase_2 1161 stable_from: phase_8 1162 consumers: [R004, A001] 1163 1164 - interface_id: interface_delta_consensus_round 1165 name: Delta Consensus Round Interface 1166 stability: unstable 1167 available_from: phase_3 1168 stable_from: phase_8 1169 consumers: [R004, D001] 1170 1171 - interface_id: interface_coordination_points 1172 name: Cross-Chain Coordination Points Interface 1173 stability: experimental 1174 available_from: phase_5 1175 stable_from: phase_8 1176 consumers: [R005, A003, D003] 1177 1178 - interface_id: interface_epoch_sync 1179 name: Epoch Boundary Synchronization Interface 1180 stability: experimental 1181 available_from: phase_7 1182 stable_from: phase_8 1183 consumers: [R004, D004] 1184 1185 requires: 1186 - interface_ref: R001.interface_dual_runtime 1187 minimum_stability: experimental 1188 required_from: phase_1 1189 1190 - interface_ref: R001.interface_ipc_channel 1191 minimum_stability: experimental 1192 required_from: phase_5 1193 1194 - interface_ref: R001.interface_alpha_api 1195 minimum_stability: unstable 1196 required_from: phase_2 1197 1198 - interface_ref: R001.interface_delta_api 1199 minimum_stability: unstable 1200 required_from: phase_3 1201 1202 - interface_ref: R002.interface_bft_consensus 1203 minimum_stability: experimental 1204 required_from: phase_2 1205 1206 - interface_ref: R002.interface_validator_set 1207 minimum_stability: unstable 1208 required_from: phase_1 1209 1210 - interface_ref: R002.interface_block_commit 1211 minimum_stability: experimental 1212 required_from: phase_2 1213 1214 - interface_ref: R002.interface_consensus_events 1215 minimum_stability: experimental 1216 required_from: phase_2 1217 1218 # === REPOSITORY TARGETS === 1219 repository_targets: 1220 primary_repo: 1221 name: adnet 1222 branch_strategy: feature_branch 1223 1224 file_manifest: 1225 # Phase 1: Parallel Consensus Types 1226 - path: src/parallel/mod.rs 1227 action: create 1228 purpose: Parallel consensus module root 1229 phase: phase_1 1230 - path: src/parallel/types.rs 1231 action: create 1232 purpose: Parallel consensus types 1233 phase: phase_1 1234 - path: src/parallel/timing.rs 1235 action: create 1236 purpose: Chain timing configuration 1237 phase: phase_1 1238 - path: src/parallel/traits.rs 1239 action: create 1240 purpose: Chain isolation traits 1241 phase: phase_1 1242 1243 # Phase 2: Alpha Consensus Round 1244 - path: src/parallel/alpha_round.rs 1245 action: create 1246 purpose: Alpha consensus round driver 1247 phase: phase_2 1248 - path: src/parallel/alpha_timing.rs 1249 action: create 1250 purpose: Alpha block timing coordinator 1251 phase: phase_2 1252 - path: src/parallel/alpha_finality.rs 1253 action: create 1254 purpose: Alpha finality tracker 1255 phase: phase_2 1256 1257 # Phase 3: Delta Consensus Round 1258 - path: src/parallel/delta_round.rs 1259 action: create 1260 purpose: Delta consensus round driver 1261 phase: phase_3 1262 - path: src/parallel/delta_timing.rs 1263 action: create 1264 purpose: Delta block timing coordinator 1265 phase: phase_3 1266 - path: src/parallel/delta_finality.rs 1267 action: create 1268 purpose: Delta finality tracker 1269 phase: phase_3 1270 1271 # Phase 4: Parallel Execution Engine 1272 - path: src/parallel/executor.rs 1273 action: create 1274 purpose: Parallel consensus executor 1275 phase: phase_4 1276 - path: src/parallel/health.rs 1277 action: create 1278 purpose: Chain health monitoring 1279 phase: phase_4 1280 - path: src/parallel/degradation.rs 1281 action: create 1282 purpose: Graceful degradation handling 1283 phase: phase_4 1284 1285 # Phase 5: sAX Lock/Unlock 1286 - path: src/parallel/sax_lock.rs 1287 action: create 1288 purpose: sAX lock attestation 1289 phase: phase_5 1290 - path: src/parallel/sax_unlock.rs 1291 action: create 1292 purpose: sAX unlock flow 1293 phase: phase_5 1294 - path: src/parallel/attestation_verify.rs 1295 action: create 1296 purpose: Attestation verification 1297 phase: phase_5 1298 1299 # Phase 6: Governance Execution 1300 - path: src/parallel/governance_vote.rs 1301 action: create 1302 purpose: Governance vote flow 1303 phase: phase_6 1304 - path: src/parallel/governance_execute.rs 1305 action: create 1306 purpose: Governance execution on Alpha 1307 phase: phase_6 1308 - path: src/parallel/governance_attestation.rs 1309 action: create 1310 purpose: Governance attestation 1311 phase: phase_6 1312 1313 # Phase 7: Epoch Boundary 1314 - path: src/parallel/epoch_boundary.rs 1315 action: create 1316 purpose: Epoch boundary detection 1317 phase: phase_7 1318 - path: src/parallel/validator_sync.rs 1319 action: create 1320 purpose: Validator set synchronization 1321 phase: phase_7 1322 - path: src/parallel/epoch_transition.rs 1323 action: create 1324 purpose: Epoch transition protocol 1325 phase: phase_7 1326 1327 # Phase 8: Tests and Benchmarks 1328 - path: tests/parallel/mod.rs 1329 action: create 1330 purpose: Parallel test module 1331 phase: phase_8 1332 - path: tests/parallel/harness.rs 1333 action: create 1334 purpose: Parallel test harness 1335 phase: phase_8 1336 - path: tests/parallel/execution_tests.rs 1337 action: create 1338 purpose: Parallel execution tests 1339 phase: phase_8 1340 - path: tests/parallel/coordination_tests.rs 1341 action: create 1342 purpose: Coordination point tests 1343 phase: phase_8 1344 - path: benches/parallel_bench.rs 1345 action: create 1346 purpose: Parallel consensus benchmarks 1347 phase: phase_8 1348 1349 secondary_repos: [] 1350 1351 # === COMPLEXITY ASSESSMENT === 1352 complexity_assessment: 1353 overall_complexity: high 1354 1355 risk_summary: 1356 - risk_id: RISK-001 1357 description: Timing drift between Alpha and Delta chains causing desynchronization 1358 likelihood: medium 1359 impact: high 1360 mitigation: Independent timing coordinators with drift compensation, epoch boundary resync 1361 1362 - risk_id: RISK-002 1363 description: sAX lock/unlock atomicity failure causing asset inconsistency 1364 likelihood: low 1365 impact: critical 1366 mitigation: Strong attestation verification, rollback on failure, conservative timeout 1367 1368 - risk_id: RISK-003 1369 description: Governance execution delay or failure affecting both chains 1370 likelihood: medium 1371 impact: high 1372 mitigation: Time-bounded execution window, retry logic, governance queue 1373 1374 - risk_id: RISK-004 1375 description: Epoch boundary coordination deadlock 1376 likelihood: medium 1377 impact: critical 1378 mitigation: Async coordination with timeouts, deadlock detection, manual override 1379 1380 - risk_id: RISK-005 1381 description: Resource contention between parallel chains 1382 likelihood: medium 1383 impact: medium 1384 mitigation: Resource isolation, bounded memory per chain, priority scheduling 1385 1386 - risk_id: RISK-006 1387 description: Validator set desync at epoch boundary 1388 likelihood: low 1389 impact: critical 1390 mitigation: Atomic validator set updates, verification before resuming operations 1391 1392 # === DEPENDENCIES SUMMARY === 1393 dependencies_summary: 1394 blocks: [R004, R005] 1395 blocked_by: [R001, R002] 1396 parallel_candidates: [] 1397 1398 # === CHANGELOG === 1399 changelog: 1400 - version: 1.1.0 1401 date: 2026-01-07 1402 type: revision 1403 description: "Added parallel_workstreams section for testing, CI, and documentation" 1404 1405 - version: 1.0.0 1406 date: 2026-01-07 1407 type: initial 1408 description: "Initial implementation plan for parallel consensus execution"