Skip to content

Conversation

roberts-pumpurs
Copy link
Contributor

@roberts-pumpurs roberts-pumpurs commented Oct 10, 2025

Describe the changes

A user with no pledges and active stake can unstake. refund will be given out at the epoch block. immediate tx inclusion costs a fixed fee.

Unstaking is now a 2 step process:

  • split unstake handling into fee-only inclusion debits and epoch refund credits, add the UnstakeDebit packet type, and adjust shadow transaction execution paths and unit tests.
    • Affected files: crates/actors/src/shadow_tx_generator.rs, crates/irys-reth/src/shadow_tx.rs, crates/irys-reth/src/evm.rs, crates/irys-reth/src/lib.rs
  • derive UnstakeRefundEvents alongside unpledge refunds so epoch blocks repay stakers only after pledges clear, and reuse the same logic during block validation.
    • crates/actors/src/block_producer.rs, crates/actors/src/block_validation.rs, crates/actors/src/commitment_refunds.rs

Snapshots:

  • extend commitment snapshots to track pending unstake requests, block duplicates, and reject attempts while pledges remain active; epoch processing now applies unstakes with explicit errors for inconsistent state.
    • crates/domain/src/snapshots/commitment_snapshot.rs, crates/domain/src/snapshots/epoch_snapshot/epoch_snapshot.rs, crates/actors/src/block_discovery.rs, crates/actors/src/mempool_service/commitment_txs.rs

Mempool:

  • include all commitment types in the scheduling pipeline and surface validation errors when commitments are dropped. Previously unstake txs were blocked.

Misc:

  • (if anyone is using nix) crates/c/build/capacity.rs: honor NIX_ENFORCE_NO_NATIVE by skipping -march=native when the environment requests it.
  • fix issue where commitment tx fee was applied twice (bug in shadow tx generator)

Tests:

  • crates/chain/tests/block_production/unstake_refund.rs, crates/chain/tests/validation/unstake_edge_cases.rs add end-to-end coverage for unstake refunds, rejection scenarios, and updated fee expectations.

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.

@roberts-pumpurs roberts-pumpurs self-assigned this Oct 13, 2025
@roberts-pumpurs roberts-pumpurs marked this pull request as ready for review October 13, 2025 15:22
@roberts-pumpurs roberts-pumpurs requested review from DanMacDonald, JesseTheRobot and craigmayhew and removed request for DanMacDonald October 13, 2025 17:53
Copy link
Collaborator

@DanMacDonald DanMacDonald left a comment

Choose a reason for hiding this comment

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

This looks solid 👍. Some minor (optional) nits.

@roberts-pumpurs roberts-pumpurs merged commit 3be2710 into master Oct 14, 2025
17 checks passed
@roberts-pumpurs roberts-pumpurs deleted the rob/unstake branch October 14, 2025 08: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.

2 participants