Skip to content

contracts: CapacityBond.bond() self-reinstatement clears governance blacklist ejection — the ejected flag conflates two ban mechanisms #850

Closed

Description

@thiras

Severity: HIGH — from the 2026-06-10 full-repository review.

Location

  • contracts/src/CapacityBond.sol:559-562 (reinstatement in bond()), :1020-1030 (ejectNode), :930-936 (_maybeAutoEject)
  • contracts/src/ContentBlacklist.sol:251-258 (addOperator → ejectNode)

Problem

The single ejected[operator] flag is set by two mechanisms with different intended permanence:

  1. Slash-driven auto-ejection (bond fell below minBond/2) — meant to be recoverable by re-bonding.
  2. Governance operator blacklisting via ContentBlacklist.addOperator() → CapacityBond.ejectNode() — the protocol's primary response to an operator repeatedly sourcing illegal content (ADR 011).

bond() clears ejected for any cause once newBalance >= minBond:

if (ejected[msg.sender] && newBalance >= minBond) {
    ejected[msg.sender] = false;
    emit Reinstated(msg.sender);
}

CapacityBond never consults ContentBlacklist.isOperatorBlacklisted, and the node binding survives ejection (_ejectNodeEffects only flips active / bumps registrationNonce).

Scenario

Governance blacklists operator X for repeatedly serving illegal blobs. X calls bond(minBond) then registerNode(...) and isActive() is true again within one block — fully back online as an authorized origin / channel provider. Governance must re-addOperator each cycle; the "permanent" ban is non-durable. Corollary: ContentBlacklist.removeOperator does not un-eject on CapacityBond, so re-bonding is the only un-eject path — which is exactly why the two causes got conflated.

Not a duplicate

#688 covers ADR-031 appeal-integrity mechanisms (cooldown, perjury denylist, clawback, concurrent-appeal cap), not the ejected-flag reinstatement conflation. No test locks in the current behavior.

Fix direction

Track ejection cause separately — e.g. a blacklistEjected[op] flag set only by the BLACKLIST_ROLE ejectNode path that bond() does not clear; clear it only via a governance / removeOperator-driven call. bond() reinstatement should clear only the slash-shortfall ejection. Note: CapacityBond is near the EIP-170 size limit — watch the --sizes CI gate.

Activity

  1. added
    kind:bug
    kind:security
    prio:high
    on Jun 10, 2026
  2. github-actions commented on Jun 10, 2026

    @github-actions

    🎯 Triage report

    CapacityBond.bond() unconditionally clears ejected[operator] on re-bond, which means a governance-blacklisted operator (banned for serving illegal content via ContentBlacklist.addOperator()) can fully self-reinstate in a single block by depositing minBond USDC. The ejected flag conflates two semantically different bans — a recoverable slash-shortfall ejection and a permanent governance blacklist ejection — with no distinction. The fix direction is explicit in the issue (split into ejected vs blacklistEjected), but CapacityBond is near the EIP-170 bytecode size limit, requiring careful implementation.

    📊 Assessment

    Dimension Value Reasoning
    Type Bug Security defect in existing governance enforcement logic
    Labels bug, security, high, technical, poc-blocking High-severity bypass of the protocol's primary content-enforcement mechanism; must be resolved before any network launch
    Coding agent Suitable Fix direction is fully specified (split flags, update bond(), ejectNode(), isActive(), removeOperator cross-contract callback); constraints are stated (EIP-170 size gate)

    🔗 Similar issues

    💡 Notes and suggestions

    Implementation checklist

    • Add mapping(address => bool) public blacklistEjected to CapacityBond
    • In ejectNode(): when called via BLACKLIST_ROLE path (i.e., from ContentBlacklist), set blacklistEjected[operator] = true in addition to (or instead of) ejected[operator]
    • In bond(): change the reinstatement guard to ejected[msg.sender] && !blacklistEjected[msg.sender] && newBalance >= minBond — only clear the slash-shortfall ejection
    • In isActive() / any active-check path: require !blacklistEjected[operator] as an additional gate
    • Add a governance-callable clearBlacklistEjection(address operator) restricted to BLACKLIST_ROLE (or a dedicated GOVERNANCE_ROLE)
    • Wire ContentBlacklist.removeOperator() to call CapacityBond.clearBlacklistEjection(operator) so un-blacklisting does un-eject (closing the inverse gap noted in Audit residuals + acknowledged postures (deferred from #777) #780)
    • Add new events: BlacklistEjected(operator), BlacklistReinstatement(operator) — distinct from Ejected/Reinstated
    • Write tests: happy-path (re-bond after slash ejection succeeds), revert-path (re-bond after blacklist ejection fails), governance un-eject path

    Size gate

    Run FOUNDRY_PROFILE=ci forge build --sizes --deny warnings before and after. CapacityBond is near EIP-170 (24 576 bytes). A new storage mapping + 2 functions will add ~200–400 bytes of deployed bytecode. If headroom is tight, consider sharing the same ejectNode function signature but encoding cause in a uint8 rather than two separate bool mappings (saves one SLOAD slot and reduces function dispatch overhead slightly).

    Solidity CI reminders

    • Any new branch that can emit before reverting must do so (W5740 / mutability warnings are fatal under --deny warnings)
    • // slither-disable-next-line for unused-return goes above the function declaration, not the call site
    • forge fmt + solhint 120-char disagreements: use positional revert args

    ADR note

    The issue implies an ADR-011 semantics question: is governance blacklisting intended to be permanent-until-governance-removes, or permanent-permanent? The fix as described assumes the former (governance can un-blacklist). If the latter is ever desired, clearBlacklistEjection can simply be omitted, but the cross-contract wiring of removeOperator should still be clarified.

    Generated by Agentic Triage for issue #850 · sonnet46 713.2K · ◷

    Add this agentic workflows to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/issue-triage.md@94ec5db57374c5b04a4b8eef8b4413f9af44d63f
    
  3. self-assigned this
    on Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind:bugkind:securityprio:high

Type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions