Skip to content

Commit 705e994

Browse files
committed
chore: remove artifact from slashing interface
1 parent 5352d62 commit 705e994

File tree

8 files changed

+30
-47
lines changed

8 files changed

+30
-47
lines changed

bytecode/src/lib.rs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/BlueprintServiceManagerBase.sol

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ contract BlueprintServiceManagerBase is IBlueprintServiceManager, RootChainEnabl
133133
function onUnappliedSlash(
134134
uint64 serviceId,
135135
bytes calldata offender,
136-
uint8 slashPercent,
137-
uint256 totalPayout
136+
uint8 slashPercent
138137
)
139138
external
140139
virtual
@@ -145,8 +144,7 @@ contract BlueprintServiceManagerBase is IBlueprintServiceManager, RootChainEnabl
145144
function onSlash(
146145
uint64 serviceId,
147146
bytes calldata offender,
148-
uint8 slashPercent,
149-
uint256 totalPayout
147+
uint8 slashPercent
150148
)
151149
external
152150
virtual

src/IBlueprintServiceManager.sol

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,21 +115,18 @@ interface IBlueprintServiceManager {
115115
/// @param serviceId The ID of the service related to the slash.
116116
/// @param offender The offender's details in bytes format.
117117
/// @param slashPercent The percentage of the slash.
118-
/// @param totalPayout The total payout amount in wei.
119118
function onUnappliedSlash(
120119
uint64 serviceId,
121120
bytes calldata offender,
122-
uint8 slashPercent,
123-
uint256 totalPayout
121+
uint8 slashPercent
124122
)
125123
external;
126124

127125
/// @dev Hook for handling applied slashes. Called when a slash is applied to an offender.
128126
/// @param serviceId The ID of the service related to the slash.
129127
/// @param offender The offender's details in bytes format.
130128
/// @param slashPercent The percentage of the slash.
131-
/// @param totalPayout The total payout amount in wei.
132-
function onSlash(uint64 serviceId, bytes calldata offender, uint8 slashPercent, uint256 totalPayout) external;
129+
function onSlash(uint64 serviceId, bytes calldata offender, uint8 slashPercent) external;
133130

134131
/// @dev Hook to check if an operator can join a service instance
135132
/// @param serviceId The ID of the service instance

src/MasterBlueprintServiceManager.sol

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -185,19 +185,17 @@ contract MasterBlueprintServiceManager is RootChainEnabled, AccessControl, Pausa
185185
/// @param serviceId The ID of the service.
186186
/// @param offender The offender's details.
187187
/// @param slashPercent The percentage of the slash.
188-
/// @param totalPayout The total payout amount.
189188
event UnappliedSlash(
190-
uint64 indexed blueprintId, uint64 indexed serviceId, bytes offender, uint8 slashPercent, uint256 totalPayout
189+
uint64 indexed blueprintId, uint64 indexed serviceId, bytes offender, uint8 slashPercent
191190
);
192191

193192
/// @dev Emitted when a slash is applied to an offender.
194193
/// @param blueprintId The unique identifier of the blueprint.
195194
/// @param serviceId The ID of the service.
196195
/// @param offender The offender's details.
197196
/// @param slashPercent The percentage of the slash.
198-
/// @param totalPayout The total payout amount.
199197
event Slashed(
200-
uint64 indexed blueprintId, uint64 indexed serviceId, bytes offender, uint8 slashPercent, uint256 totalPayout
198+
uint64 indexed blueprintId, uint64 indexed serviceId, bytes offender, uint8 slashPercent
201199
);
202200

203201
// =========== Errors ============
@@ -480,43 +478,39 @@ contract MasterBlueprintServiceManager is RootChainEnabled, AccessControl, Pausa
480478
/// @param serviceId The ID of the service.
481479
/// @param offender The offender's details.
482480
/// @param slashPercent The percentage of the slash.
483-
/// @param totalPayout The total payout amount.
484481
function onUnappliedSlash(
485482
uint64 blueprintId,
486483
uint64 serviceId,
487484
bytes calldata offender,
488-
uint8 slashPercent,
489-
uint256 totalPayout
485+
uint8 slashPercent
490486
)
491487
public
492488
onlyFromRootChain
493489
whenNotPaused
494490
{
495491
address manager = blueprints.get(blueprintId);
496-
IBlueprintServiceManager(manager).onUnappliedSlash(serviceId, offender, slashPercent, totalPayout);
497-
emit UnappliedSlash(blueprintId, serviceId, offender, slashPercent, totalPayout);
492+
IBlueprintServiceManager(manager).onUnappliedSlash(serviceId, offender, slashPercent);
493+
emit UnappliedSlash(blueprintId, serviceId, offender, slashPercent);
498494
}
499495

500496
/// @dev Called when a slash is applied to an offender.
501497
/// @param blueprintId The blueprint unique identifier.
502498
/// @param serviceId The ID of the service.
503499
/// @param offender The offender's details.
504500
/// @param slashPercent The percentage of the slash.
505-
/// @param totalPayout The total payout amount.
506501
function onSlash(
507502
uint64 blueprintId,
508503
uint64 serviceId,
509504
bytes calldata offender,
510-
uint8 slashPercent,
511-
uint256 totalPayout
505+
uint8 slashPercent
512506
)
513507
public
514508
onlyFromRootChain
515509
whenNotPaused
516510
{
517511
address manager = blueprints.get(blueprintId);
518-
IBlueprintServiceManager(manager).onSlash(serviceId, offender, slashPercent, totalPayout);
519-
emit Slashed(blueprintId, serviceId, offender, slashPercent, totalPayout);
512+
IBlueprintServiceManager(manager).onSlash(serviceId, offender, slashPercent);
513+
emit Slashed(blueprintId, serviceId, offender, slashPercent);
520514
}
521515

522516
/// @dev Query the slashing origin for a service.

src/Permissions.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pragma solidity ^0.8.20;
66
/// @notice This contract is used to restrict access of certain functions to the root chain only.
77
contract RootChainEnabled {
88
/// @notice The address of the root chain
9-
address public constant ROOT_CHAIN = 0x6D6F646C53657276696365730000000000000000;
9+
address public constant ROOT_CHAIN = 0x09dF6A941ee03B1e632904E382e10862fA9cc0e3;
1010
/// @notice The address of the rewards pallet
1111
address public constant REWARDS_PALLET = address(0x7e87d5);
1212

test/BlueprintServiceManagerBase.t.sol

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ contract BlueprintServiceManagerBaseTest is Test {
1313
using Assets for bytes32;
1414

1515
MockBlueprintServiceManager manager;
16-
address rootChain = 0x1111111111111111111111111111111111111111;
16+
address rootChain = 0x09dF6A941ee03B1e632904E382e10862fA9cc0e3;
1717
address masterBlueprintServiceManager = address(0x2222222222222222222222222222222222222222);
1818
address blueprintOwner = address(0x3333333333333333333333333333333333333333);
1919
MockERC20 mockToken;
@@ -444,17 +444,15 @@ contract BlueprintServiceManagerBaseTest is Test {
444444
uint64 serviceId = 104;
445445
bytes memory offender = "offender data";
446446
uint8 slashPercent = 5;
447-
uint256 totalPayout = 1000 ether;
448447

449448
// Expect no revert
450-
manager.onUnappliedSlash(serviceId, offender, slashPercent, totalPayout);
449+
manager.onUnappliedSlash(serviceId, offender, slashPercent);
451450
}
452451

453452
function test_OnUnappliedSlash_RevertsWhenNotMaster() public {
454453
uint64 serviceId = 104;
455454
bytes memory offender = "offender data";
456455
uint8 slashPercent = 5;
457-
uint256 totalPayout = 1000 ether;
458456

459457
vm.expectRevert(
460458
abi.encodeWithSelector(
@@ -464,7 +462,7 @@ contract BlueprintServiceManagerBaseTest is Test {
464462
)
465463
);
466464
vm.prank(address(0x999));
467-
manager.onUnappliedSlash(serviceId, offender, slashPercent, totalPayout);
465+
manager.onUnappliedSlash(serviceId, offender, slashPercent);
468466
}
469467

470468
// Test onSlash
@@ -475,7 +473,7 @@ contract BlueprintServiceManagerBaseTest is Test {
475473
uint256 totalPayout = 2000 ether;
476474

477475
// Expect no revert
478-
manager.onSlash(serviceId, offender, slashPercent, totalPayout);
476+
manager.onSlash(serviceId, offender, slashPercent);
479477
}
480478

481479
function test_OnSlash_RevertsWhenNotMaster() public {
@@ -492,7 +490,7 @@ contract BlueprintServiceManagerBaseTest is Test {
492490
)
493491
);
494492
vm.prank(address(0x999));
495-
manager.onSlash(serviceId, offender, slashPercent, totalPayout);
493+
manager.onSlash(serviceId, offender, slashPercent);
496494
}
497495

498496
// Test querySlashingOrigin

test/HookTest.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,13 @@ contract HookTestBlueprintServiceManager is BlueprintServiceManagerBase {
111111
function onUnappliedSlash(
112112
uint64,
113113
bytes calldata,
114-
uint8,
115-
uint256
114+
uint8
116115
) external override onlyFromMaster {
117116
emit OnUnappliedSlash();
118117
}
119118

120119
/// @inheritdoc IBlueprintServiceManager
121-
function onSlash(uint64, bytes calldata, uint8, uint256) external override {
120+
function onSlash(uint64, bytes calldata, uint8) external override {
122121
emit OnSlash();
123122
}
124123
}

test/MasterBlueprintServiceManager.t.sol

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ contract MasterBlueprintServiceManagerTest is Test {
2525
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
2626
bytes32 public constant TRENCH_UPDATE_ROLE = keccak256("TRENCH_UPDATE_ROLE");
2727

28-
address public ROOT_CHAIN = address(0x1111111111111111111111111111111111111111);
28+
address public ROOT_CHAIN = address(0x09dF6A941ee03B1e632904E382e10862fA9cc0e3);
2929

3030
uint16 public constant BASE_PERCENT = 10_000;
3131

@@ -65,10 +65,10 @@ contract MasterBlueprintServiceManagerTest is Test {
6565
);
6666
event ServiceTerminated(uint64 indexed blueprintId, uint64 indexed serviceId, address owner);
6767
event UnappliedSlash(
68-
uint64 indexed blueprintId, uint64 indexed serviceId, bytes offender, uint8 slashPercent, uint256 totalPayout
68+
uint64 indexed blueprintId, uint64 indexed serviceId, bytes offender, uint8 slashPercent
6969
);
7070
event Slashed(
71-
uint64 indexed blueprintId, uint64 indexed serviceId, bytes offender, uint8 slashPercent, uint256 totalPayout
71+
uint64 indexed blueprintId, uint64 indexed serviceId, bytes offender, uint8 slashPercent
7272
);
7373

7474
function setUp() public {
@@ -831,7 +831,6 @@ contract MasterBlueprintServiceManagerTest is Test {
831831
uint64 serviceId = 1;
832832
bytes memory offender = hex"abcd";
833833
uint8 slashPercent = 20;
834-
uint256 totalPayout = 1000 ether;
835834

836835
// Create a blueprint first
837836
address owner = address(this);
@@ -856,23 +855,22 @@ contract MasterBlueprintServiceManagerTest is Test {
856855

857856
// Expect the UnappliedSlash event
858857
vm.expectEmit(true, true, false, true);
859-
emit UnappliedSlash(blueprintId, serviceId, offender, slashPercent, totalPayout);
858+
emit UnappliedSlash(blueprintId, serviceId, offender, slashPercent);
860859

861-
masterManager.onUnappliedSlash(blueprintId, serviceId, offender, slashPercent, totalPayout);
860+
masterManager.onUnappliedSlash(blueprintId, serviceId, offender, slashPercent);
862861
}
863862

864863
function test_onUnappliedSlash_NotFromRootChain() public {
865864
uint64 blueprintId = 1;
866865
uint64 serviceId = 1;
867866
bytes memory offender = hex"abcd";
868867
uint8 slashPercent = 20;
869-
uint256 totalPayout = 1000 ether;
870868

871869
vm.expectRevert(
872870
abi.encodeWithSelector(RootChainEnabled.OnlyRootChainAllowed.selector, address(this), ROOT_CHAIN)
873871
);
874872

875-
masterManager.onUnappliedSlash(blueprintId, serviceId, offender, slashPercent, totalPayout);
873+
masterManager.onUnappliedSlash(blueprintId, serviceId, offender, slashPercent);
876874
}
877875

878876
// Test onSlash
@@ -906,23 +904,22 @@ contract MasterBlueprintServiceManagerTest is Test {
906904

907905
// Expect the Slashed event
908906
vm.expectEmit(true, true, false, true);
909-
emit Slashed(blueprintId, serviceId, offender, slashPercent, totalPayout);
907+
emit Slashed(blueprintId, serviceId, offender, slashPercent);
910908

911-
masterManager.onSlash(blueprintId, serviceId, offender, slashPercent, totalPayout);
909+
masterManager.onSlash(blueprintId, serviceId, offender, slashPercent);
912910
}
913911

914912
function test_onSlash_NotFromRootChain() public {
915913
uint64 blueprintId = 1;
916914
uint64 serviceId = 1;
917915
bytes memory offender = hex"abcd";
918916
uint8 slashPercent = 15;
919-
uint256 totalPayout = 500 ether;
920917

921918
vm.expectRevert(
922919
abi.encodeWithSelector(RootChainEnabled.OnlyRootChainAllowed.selector, address(this), ROOT_CHAIN)
923920
);
924921

925-
masterManager.onSlash(blueprintId, serviceId, offender, slashPercent, totalPayout);
922+
masterManager.onSlash(blueprintId, serviceId, offender, slashPercent);
926923
}
927924

928925
// Test querySlashingOrigin

0 commit comments

Comments
 (0)