-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: contracts middleware interface #235
feat: contracts middleware interface #235
Conversation
06401fc
to
cb64e38
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really like the direction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we keep track of whitelisted assets by protocol or in a single mapping?
e.g. symbioticWhitelistedCollaterals
or just whitelistedCollaterals
?
In theory once a collateral token is approved it should be used anywhere, if possible.
Just an observation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love a more abstracted mapping but I think it makes more sense to keep them closer to the restaking protocol since they might have different definition of "collateral". In the context of EigenLayer we are fine with whitelisted ERC20 addresses but in Symbiotic you need to specify the contract instances of "Collateral".
Having a single mapping might be ambiguous because you might think you can use any of such collaterals in any restaking protocol but that's not the case.
What do you think? Not trying to force a point but I think we should genuinely analyse this further
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a single mapping might be ambiguous because you might think you can use any of such collaterals in any restaking protocol but that's not the case.
totally agree with this, however on the flip side having separate whitelists means having governance specific to the middleware instead of keeping all bolt governance stuff on the BoltManager
. It doesn't make a huge difference except complicating things a little bit...
@coderabbitai review |
WalkthroughAhoy mateys! The changes in this here pull request be all about reorganizin' and clarifying the integration process fer the Bolt network and its middleware. The Changes
Possibly related PRs
Suggested labels
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 28
Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Files selected for processing (9)
- bolt-contracts/README.md (3 hunks)
- bolt-contracts/script/Deploy.s.sol (2 hunks)
- bolt-contracts/src/contracts/BoltEigenLayerMiddleware.sol (1 hunks)
- bolt-contracts/src/contracts/BoltManager.sol (3 hunks)
- bolt-contracts/src/contracts/BoltSymbioticMiddleware.sol (1 hunks)
- bolt-contracts/src/interfaces/IBoltManager.sol (0 hunks)
- bolt-contracts/src/interfaces/IBoltMiddleware.sol (1 hunks)
- bolt-contracts/test/BoltManager.EigenLayer.t.sol (11 hunks)
- bolt-contracts/test/BoltManager.Symbiotic.t.sol (10 hunks)
Files not reviewed due to no reviewable changes (1)
- bolt-contracts/src/interfaces/IBoltManager.sol
Additional comments not posted (32)
bolt-contracts/README.md (2)
51-54
: Ahoy, me hearties! These changes be shipshape and Bristol fashion!Ye've done a fine job of updatin' the key features, ye scurvy dog! By removin' the specific mentions of Symbiotic Operators and Vaults, ye've made the BoltManager more flexible than a seasoned sailor's back. This be allowin' for smoother sailin' with different restakin' protocols. Well done, ye bilge rat!
66-68
: Blimey! These steps be clearer than a lighthouse on a foggy night!Ye've done a right proper job of updatin' the Symbiotic Integration guide, ye crafty corsair! By replacin' BoltManager with BoltSymbioticMiddleware and usin' more generic method names, ye've made the process smoother than a well-oiled cannon. Any landlubber could follow these steps now!
bolt-contracts/script/Deploy.s.sol (3)
26-27
: BoltValidators deployment is smooth sailingWell done, matey! The
BoltValidators
contract be deployed properly. All hands can rest easy.
32-38
: Deployment of BoltEigenLayerMiddleware looks shipshapeAye, the way ye've set sail with the
BoltEigenLayerMiddleware
deployment be looking good. No squalls on the horizon here.
40-47
: Verify parameters match BoltSymbioticMiddleware constructorHeed me words! Make sure the order of the parameters passed to
BoltSymbioticMiddleware
be matching its constructor. We wouldn't want any mischief aboard because of a mismatched crew.Run the following script to verify the constructor parameters:
bolt-contracts/src/contracts/BoltManager.sol (1)
36-38
: Aye, the addition ofrestakingProtocols
be a fine move.The use of
EnumerableSet
to keep track of supported restaking protocols ensures no duplicate entries sneak into the ship's ledger.bolt-contracts/test/BoltManager.EigenLayer.t.sol (12)
8-8
: Ahoy! Imported the middleware contract smartly.Bringing in
BoltEigenLayerMiddleware
looks proper and sets sail for modular code.
29-29
: Added the middleware variable—smooth sailing ahead!Declaring
BoltEigenLayerMiddleware public middleware;
readies ye for utilizing the middleware in yer tests.
52-57
: Middleware initialization—shipshape but mind the details.Ye've instantiated the
middleware
correctly with necessary parameters. Ensure all addresses, especially those ofavsDirectory
,delegationManager
, andstrategyManager
, be accurate to avoid any mutinies in deployment.
64-67
: Whitelisting collateral through middleware—aye, that's the way!Adding and verifying the whitelisted collateral via
middleware
is correctly handled.
132-132
: Calculating operator registration digest hash—spot on!Using
avs: address(middleware)
in the digest hash aligns with the middleware's role as the AVS. Well done!
142-145
: Registering operator to AVS via middleware—smooth seas ahead.The registration and subsequent check confirm that the operator is properly registered through the middleware.
162-166
: Operator and strategy registration—executed with finesse!Ye've successfully registered the operator and strategy using the middleware, and the assertions confirm their enabled status.
172-173
: Deregistering operator from AVS—handled gracefully.The operator is correctly deregistered, and the status check verifies the action.
225-225
: Handling non-existent proposer status—smartly done.Expecting a revert when fetching a non-existent proposer is a good check to ensure proper error handling.
230-230
: Fetching whitelisted collaterals—everything's shipshape.Retrieving the collaterals through the middleware works as expected, confirming the whitelisting.
238-238
: Removing whitelisted collateral—verify access control, mate.When calling
middleware.removeWhitelistedCollateral
, ensure that only the rightful captain (authorized personnel) can perform this action to prevent any unwanted meddling.Ye can check the
onlyAdmin
modifier or equivalent access control in themiddleware
contract to confirm proper enforcement.
244-244
: Expecting revert on registering strategy with non-whitelisted collateral—aye, that's proper testing.Ye've correctly anticipated the revert due to
CollateralNotWhitelisted
, ensuring yer contract behaves as intended when facing improper inputs.bolt-contracts/test/BoltManager.Symbiotic.t.sol (14)
25-26
: Aye, importingIBoltMiddleware
be sound.
29-29
: Ye've addedBoltSymbioticMiddleware
import smartly.
43-43
: Introducedmiddleware
variable correctly.
155-161
: Set sail with the newBoltSymbioticMiddleware
, looks shipshape.
164-166
: Whitelisting collateral be done rightly.
178-178
: Set the middleware on the network service, savvy move.
207-208
: Vault be registered and confirmed enabled. Good work.
210-211
: Operator be registered and enabled, all hands on deck.
255-255
: Stake from middleware matches delegator's stake, and both be zero. Well done.Also applies to: 257-258
285-287
: Total stake checks out across epochs, wisely done.
290-292
: Stake from middleware now matches delegator and is 1 ether, as expected. Nicely navigated.
349-349
: Test for nonexistent proposer status be properly verifying the revert. Aye, good.
353-355
: Retrieving whitelisted collaterals looks good, mate.
360-360
: Test for non-whitelisted collateral be correctly expecting revert when registering vault. Well plotted.Also applies to: 363-364
…moved to middleware
…s, now in middleware
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
0740036
to
e9c4418
Compare
…d of BoltValidators
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR introduces the
IBoltMiddleware
interface and decouples many functionalities of theBoltManager
contract into two separate contracts:BoltEigenLayerMiddleware
andBoltSymbioticMiddleware
.Moreover, the
BoltManager
contract is now agnostic of the available restaking protocols.Summary by CodeRabbit
New Features
BoltEigenLayerMiddleware
andBoltSymbioticMiddleware
for enhanced integration with the Bolt Protocol.Bug Fixes
Refactor
BoltManager
by removing EigenLayer and Symbiotic-related functionalities and focusing on restaking protocols.Documentation
README.md
to reflect changes in the integration process and middleware structure.