Skip to content

chore: Add authorizedThirdPartyBonders mapping - #669

Open
SidestreamCrunchyCarrot wants to merge 2 commits into
deltafrom
add-third-party-mapping
Open

SidestreamCrunchyCarrot wants to merge 2 commits into
deltafrom
add-third-party-mapping

Conversation

@SidestreamCrunchyCarrot

Copy link
Copy Markdown
Collaborator

What does this pull request do? Explain your changes. (required)

A setter-only PR that adds an on-chain authorization registry to BondingManager. It lets a delegator explicitly allow specific addresses to act as third-party bonders on their behalf.

Specific updates (required)

  • Added authorizedThirdPartyBonders private mapping(address => mapping(address => bool)) on BondingManager, keyed by delegator then authorized bonder.
  • Added setThirdPartyBonderAuthorization(address _bonder, bool _authorized). Lets msg.sender (the delegator) grant or revoke authorization for _bonder. The write and the event are guarded behind a change check, so repeating the current value is a no-op and emits nothing.
  • Added isThirdPartyBonderAuthorized(address _delegator, address _bonder) getter over the private mapping
  • Declared the ThirdPartyBonderAuthorization(address indexed delegator, address indexed bonder, bool authorized) event in IBondingManager, alongside the existing RewardCallerSet.
  • Added a setThirdPartyBonderAuthorization unit test block to test/unit/BondingManager.js (6 cases).

How did you test each of these updates (required)

  • New unit tests in test/unit/BondingManager.js, under describe("setThirdPartyBonderAuthorization"):
  • should fail if system is paused covering the whenSystemNotPaused modifier.
  • should return false for an address that was never authorized checks zero-value default for an untouched pair.
  • should authorize a third party bonder asserts that the event is emitted with (delegator, bonder, true) and that the getter then returns true.
  • should revoke a previously granted authorization authorizes, then revokes; asserts the event fires with false and the getter returns false
  • should not emit an event when authorizing an already authorized bonder asserts no event is emitted on a redundant write while state stays true
  • should allow a delegator to authorize multiple bonders authorizes two bonders, then revokes one, asserting the other is untouched. Confirms the mapping is keyed per bonder

Does this pull request close any open issues?

No.

Checklist:

  • README and other documentation updated
  • All tests using yarn test pass

Copilot AI balanced review requested due to automatic review settings November 19, 2026 17:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues were identified for the delegator-controlled authorization registry change.

No open issues 🎉

What changed in this PR

Adds a delegator-controlled authorization registry to BondingManager for third-party bonders. This PR records authorization preferences only; it does not change bonding enforcement.

Changes:

  • Adds a private authorization mapping, a pause-guarded setter, and a public getter.
  • Exposes the functions and authorization-change event through IBondingManager, emitting events only when authorization changes.
  • Adds six unit tests covering pause behavior, default values, granting, revocation, redundant grants, and multiple bonders.
File Description
test/​unit/​BondingManager.js Adds six authorization registry tests.
contracts/​bonding/​IBondingManager.sol Declares the authorization event, setter, and getter.
contracts/​bonding/​BondingManager.sol Implements authorization storage and access functions.

Review effort: Balanced

@codecov

codecov Bot commented Nov 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00000%. Comparing base (46c24fe) to head (35c4333).

Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff               @@
##                delta         #669   +/-   ##
===============================================
  Coverage   100.00000%   100.00000%           
===============================================
  Files              29           29           
  Lines            1349         1355    +6     
  Branches          226          227    +1     
===============================================
+ Hits             1349         1355    +6     
Files with missing lines Coverage Δ
contracts/bonding/BondingManager.sol 100.00000% <100.00000%> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 46c24fe...35c4333. Read the comment docs.

Files with missing lines Coverage Δ
contracts/bonding/BondingManager.sol 100.00000% <100.00000%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

3 participants