mirror of
https://github.com/datahaven-xyz/datahaven
synced 2026-05-24 01:38:32 +00:00
This PR: - Sets up the slasher infrastructure with the base functionality required (in `ISlasher.sol`, `SlasherBase.sol` and `SlasherBaseStorage.sol`) and adds the tests for it (in `SlasherBase.t.sol`). - Adds an implementation of a more complex slasher (in `IVetoableSlasher.sol` and `VetoableSlasher.sol`) and tests for it (in `VetoableSlasher.t.sol`). - Modifies the `ServiceManagerBase` contract to use the new `VetoableSlasher` contract to manage slashing. - Updates mocks and tests to reflect the newly added functionality. --------- Co-authored-by: Facundo Farall <37149322+ffarall@users.noreply.github.com>
37 lines
1.2 KiB
Solidity
37 lines
1.2 KiB
Solidity
// SPDX-License-Identifier: UNLICENSED
|
|
pragma solidity ^0.8.27;
|
|
|
|
import {SlasherBase} from "../../src/middleware/SlasherBase.sol";
|
|
import {
|
|
IAllocationManager,
|
|
IAllocationManagerTypes
|
|
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
|
|
import {IServiceManager} from "../../src/interfaces/IServiceManager.sol";
|
|
|
|
// SlasherMock implementation for testing
|
|
contract SlasherMock is SlasherBase {
|
|
constructor(
|
|
IAllocationManager _allocationManager,
|
|
IServiceManager _serviceManager
|
|
) SlasherBase(_allocationManager, _serviceManager) {}
|
|
|
|
// Expose the internal _fulfilSlashingRequest function for testing
|
|
function fulfilSlashingRequest(
|
|
uint256 _requestId,
|
|
IAllocationManagerTypes.SlashingParams memory _params
|
|
) external {
|
|
_fulfilSlashingRequest(_requestId, _params);
|
|
}
|
|
|
|
// Function with the onlySlasher modifier for testing
|
|
function restrictedFunction() external onlySlasher {
|
|
// Do nothing, just for testing the modifier
|
|
}
|
|
|
|
// Expose the internal _checkSlasher function for testing
|
|
function checkSlasher(
|
|
address account
|
|
) external view {
|
|
_checkSlasher(account);
|
|
}
|
|
}
|