-
Notifications
You must be signed in to change notification settings - Fork 78
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: slasher templates / examples #310
base: feat/slashing-release-branch
Are you sure you want to change the base?
feat: slasher templates / examples #310
Conversation
@@ -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)) { |
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.
we should use require syntax with new solc version
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.
yeah lets bump to 0.8.27
@@ -491,7 +491,8 @@ contract StakeRegistry is StakeRegistryStorage { | |||
uint256 stratsLength = strategyParamsLength(quorumNumber); | |||
StrategyParams memory strategyAndMultiplier; | |||
|
|||
uint256[] memory strategyShares = delegation.getOperatorShares(operator, strategiesPerQuorum[quorumNumber]); | |||
uint256[] memory strategyShares; | |||
// = delegation.getDelegatableShares(operator, strategiesPerQuorum[quorumNumber]); |
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.
?
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.
The interface changed just commented out temporarily. It was initially more annoying to deal with because the type returned changed and then the function signature changed
string memory description | ||
) internal virtual { | ||
|
||
IAllocationManagerTypes.SlashingParams memory params = IAllocationManagerTypes.SlashingParams({ |
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.
have them pass in the SlashingParams
wadToSlash, | ||
description | ||
); | ||
emit OperatorSlashed(requestId, operator, operatorSetId, strategies, wadToSlash, description); |
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.
the core will emit this event
SlashingStatus status; | ||
} | ||
|
||
uint256 public constant VETO_PERIOD = 3 days; |
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.
immutable
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.
constant feels fine imho. what do you view the benefit of the immutable vs constant?
|
||
contract VetoableSlashing is SlasherBase { | ||
struct SlashingRequest { | ||
address operator; |
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.
abstract a SlashingParams in here
IStrategy[] memory strategies, | ||
uint256 wadToSlash, | ||
string memory description | ||
) external virtual { |
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.
perms?
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.
wdym?
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.
oh you mean access control. yeah i made this virtual so some type of access control could be added via inheritance
IStrategy[] memory strategies, | ||
uint256 wadToSlash, | ||
string memory description | ||
) external virtual { |
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.
perms?
_queueSlashingRequest(operator, operatorSetId, strategies, wadToSlash, description); | ||
} | ||
|
||
function cancelSlashingRequest(uint256 requestId) external virtual onlyVetoCommittee { |
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.
vetoSlashingRequest
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.
Request, Slash, and Cancel are more generic. Cancellation is just happening through a veto committee in this case
request.description | ||
); | ||
|
||
emit OperatorSlashed(requestId, request.operator, request.operatorSetId, request.strategies, request.wadToSlash, request.description); |
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.
we should have a cohesive theory around events
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 agree; what do you view as incohesive?
There are 3 event categories.
Requested
Slashed <- This is duplicated from core so that we can have a cohesive requestId
tied to all 3
Cancelled
* @param newSlasher The new slasher address | ||
* @dev only callable by the owner | ||
*/ | ||
function setSlasher(address newSlasher) external onlyOwner { |
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.
Do we plan on changing this because this is a bit concerning how the slasher can just be updated without any significant delay or additional security measures. Not sure if we want to have something in place by default or leave it up to AVSs because there are trust assumptions that operators have done their due diligence on AVSs they are securing.
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.
Sure we can add a delay
|
||
emit OperatorSlashed(requestId, request.operator, request.operatorSetId, request.strategies, request.wadToSlash, request.description); | ||
|
||
delete slashingRequests[requestId]; |
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.
Lets just change SlashingStatus to Completed
and leave in storage
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.
nice catch, i think i added the enum after writing this
No description provided.