Skip to content
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

Draft
wants to merge 15 commits into
base: feat/slashing-release-branch
Choose a base branch
from

Conversation

stevennevins
Copy link
Collaborator

No description provided.

@stevennevins stevennevins changed the title feat: slashers feat: slasher templates / examples Oct 16, 2024
Base automatically changed from chore/bump-slashing-core-dep to feat/slashing-release-branch October 17, 2024 21:05
@@ -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)) {
Copy link
Contributor

@gpsanant gpsanant Oct 18, 2024

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

Copy link
Collaborator

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]);
Copy link
Contributor

Choose a reason for hiding this comment

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

?

Copy link
Collaborator Author

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({
Copy link
Contributor

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);
Copy link
Contributor

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;
Copy link
Contributor

Choose a reason for hiding this comment

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

immutable

Copy link
Collaborator Author

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;
Copy link
Contributor

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 {
Copy link
Contributor

Choose a reason for hiding this comment

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

perms?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

wdym?

Copy link
Collaborator Author

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 {
Copy link
Contributor

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 {
Copy link
Contributor

Choose a reason for hiding this comment

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

vetoSlashingRequest

Copy link
Collaborator Author

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);
Copy link
Contributor

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

Copy link
Collaborator Author

@stevennevins stevennevins Oct 18, 2024

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 {
Copy link
Collaborator

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.

Copy link
Collaborator Author

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];
Copy link
Collaborator

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

Copy link
Collaborator Author

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

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