Skip to content

Fix/settle cap terminate hardening - #201

Merged
tuddman merged 3 commits into
mainfrom
fix/settle-cap-terminate-hardening
Sep 23, 2026
Merged

tuddman merged 3 commits into
mainfrom
fix/settle-cap-terminate-hardening

Conversation

@tuddman

@tuddman tuddman commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

No description provided.

… set_settle_epoch_cap

The midrib program's `Deposit` and `WithdrawVoucher` accounts structs now end
with the instance's Termination PDA (`[b"terminated", instance]`, read-only,
must be empty). Anchor binds accounts positionally, so without it every
Solana deposit and voucher withdrawal fails account validation.

- deposit_ix: termination appended after the rent sysvar (11 accounts).
- withdraw_voucher_ix: termination appended after system_program (14).
- set_settle_epoch_cap_ix + derive_settle_epoch_pda: the operator-admin-signed
  per-(instance, mint) settlement cap, same shape as set_withdraw_epoch_cap.
- fetch_settle_epoch / SettleEpochState (settled is u128 on chain).
- explain_midrib_error: submit errors carrying Terminated,
  TerminationDelayPending, WithdrawEpochCapExceeded or OperatorAdminIsSigner
  gain a plain-English line.

Account-list tests pin deposit, withdraw_voucher and set_settle_epoch_cap
against the program structs, and the two new seeds against the program's
literals.
Rebuilt with forge 1.7.1 from arborter fix/settle-cap-terminate-hardening
(7a8e4a1). Purely additive to the ABI — no existing function, event or
error changed:

  MidribV3
    functions  setSettleEpochCap(address,uint256), settleEpochCap(address),
               settledInEpoch(address,uint256), terminatedAt(),
               TERMINATION_DELAY()
    events     SettleEpochCapSet
    errors     SETTLE_RATE_LIMITED(uint256,uint256),
               TERMINATION_DELAY_PENDING(uint256), OPERATOR_ADMIN_IS_SIGNER
  MidribFactory
    errors     OPERATOR_ADMIN_IS_SIGNER

No sdk code calls the new entries yet.
…n rules

- aspens::operator::set_settle_epoch_cap and `aspens-cli
  set-settle-epoch-cap <network> <token> <cap>`: arm the Solana settlement
  cap with the offline operator-admin key, pre-flighted and read back like
  set-withdraw-epoch-cap (the shared pre-flight is now one helper).
- The operator admin can no longer equal the TEE signer (program, factory
  and deployer all refuse it), so the "default deploy shape" wording is
  gone; the warning remains for an instance created before that check.
- set-operator-fee / rotate-operator-admin docs: the arborter submits these
  with its own key, so they fail on-chain against any instance the current
  contracts mint.
- README and CHANGELOG.
@tuddman
tuddman merged commit c9e09b1 into main Sep 23, 2026
9 checks passed
@tuddman
tuddman deleted the fix/settle-cap-terminate-hardening branch September 23, 2026 12:11
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