-
Notifications
You must be signed in to change notification settings - Fork 115
feat: slasher templates / examples #310
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
Changes from 15 commits
91c5a53
9eb3446
e579e21
9e5e15f
6068036
eea938a
221b4fe
b70945a
2c80944
860faa8
dad3d4d
c8a8e16
9d5c200
ac12473
8caf960
dd31230
e08cc44
fc2a1ba
0fcee61
337d561
eb22245
4c60219
fcff338
7213174
38dca52
0847612
825b82b
31dd3f3
c287af6
999b2c0
7ce35e1
fdff6f2
a102f9f
9af73b9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,7 @@ | ||
| // SPDX-License-Identifier: BUSL-1.1 | ||
| pragma solidity ^0.8.12; | ||
|
|
||
| import {EIP1271SignatureUtils} from | ||
| "eigenlayer-contracts/src/contracts/libraries/EIP1271SignatureUtils.sol"; | ||
| import "@openzeppelin-upgrades/contracts/utils/cryptography/SignatureCheckerUpgradeable.sol"; | ||
|
|
||
| /** | ||
| * @title SignatureCheckerLib | ||
|
|
@@ -11,6 +10,8 @@ import {EIP1271SignatureUtils} from | |
| * validation logic to this external library. | ||
| */ | ||
| library SignatureCheckerLib { | ||
| error InvalidSignature(); | ||
|
|
||
| /** | ||
| * @notice Validates a signature using EIP-1271 standard. | ||
| * @param signer The address of the signer. | ||
|
|
@@ -22,6 +23,8 @@ library SignatureCheckerLib { | |
| bytes32 digestHash, | ||
| bytes memory signature | ||
| ) external view { | ||
| EIP1271SignatureUtils.checkSignature_EIP1271(signer, digestHash, signature); | ||
| if (!SignatureCheckerUpgradeable.isValidSignatureNow(signer, digestHash, signature)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should use require syntax with new solc version
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah lets bump to 0.8.27 |
||
| revert InvalidSignature(); | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // SPDX-License-Identifier: BUSL-1.1 | ||
| pragma solidity ^0.8.12; | ||
|
|
||
| import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol"; | ||
| import {SlasherBase} from "./SlasherBase.sol"; | ||
|
|
||
| contract Slasher is SlasherBase { | ||
| uint256 public nextRequestId; | ||
|
|
||
| function initialize(address _serviceManager) public initializer { | ||
| __SlasherBase_init(_serviceManager); | ||
| } | ||
|
|
||
| function fulfillSlashingRequest( | ||
| address operator, | ||
| uint32 operatorSetId, | ||
| IStrategy[] memory strategies, | ||
| uint256 wadToSlash, | ||
| string memory description | ||
| ) external virtual { | ||
stevennevins marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| uint256 requestId = nextRequestId++; | ||
| _fulfillSlashingRequest( | ||
| operator, | ||
| operatorSetId, | ||
| strategies, | ||
| wadToSlash, | ||
| description | ||
| ); | ||
| emit OperatorSlashed(requestId, operator, operatorSetId, strategies, wadToSlash, description); | ||
|
||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.