Skip to content

Commit 56c6d2f

Browse files
committed
test: assert on state and event
1 parent 4aa5ca5 commit 56c6d2f

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/StakeRegistry.sol

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,9 +799,8 @@ contract StakeRegistry is StakeRegistryStorage {
799799
* @param _stakeType The type of stake to track (TOTAL_DELEGATED, TOTAL_SLASHABLE, or BOTH)
800800
*/
801801
function _setStakeType(uint8 quorumNumber, StakeType _stakeType) internal {
802-
StakeType oldStakeType = stakeTypePerQuorum[quorumNumber];
803802
stakeTypePerQuorum[quorumNumber] = _stakeType;
804-
emit StakeTypeSet(oldStakeType, _stakeType);
803+
emit StakeTypeSet(_stakeType);
805804
}
806805

807806
/**

src/interfaces/IStakeRegistry.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ interface IStakeRegistry is IRegistry {
5555
event LookAheadPeriodChanged(uint32 oldLookAheadDays, uint32 newLookAheadDays);
5656

5757
/// @notice emitted when the stake type is updated
58-
event StakeTypeSet(StakeType previousStakeType, StakeType newStakeType);
58+
event StakeTypeSet(StakeType newStakeType);
5959
/// @notice emitted when the minimum stake for a quorum is updated
6060
event MinimumStakeForQuorumUpdated(uint8 indexed quorumNumber, uint96 minimumStake);
6161
/// @notice emitted when a new quorum is created

test/unit/StakeRegistryUnit.t.sol

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ contract StakeRegistryUnitTests is MockAVSDeployer, IStakeRegistryEvents {
102102
cheats.prank(address(registryCoordinator));
103103
stakeRegistry.initializeDelegatedStakeQuorum(quorumNumber, minimumStake, strategyParams);
104104

105+
StakeType stakeType = stakeRegistry.stakeTypePerQuorum(quorumNumber);
106+
assertEq(uint8(stakeType), uint8(StakeType.TOTAL_DELEGATED), "invalid stake type");
107+
105108
// Mark quorum initialized for other tests
106109
initializedQuorumBitmap = uint192(initializedQuorumBitmap.setBit(quorumNumber));
107110
initializedQuorumBytes = initializedQuorumBitmap.bitmapToBytesArray();
@@ -614,6 +617,7 @@ contract StakeRegistryUnitTests_Config is StakeRegistryUnitTests {
614617
cheats.prank(address(registryCoordinator));
615618
stakeRegistry.initializeDelegatedStakeQuorum(quorumNumber, minimumStake, strategyParams);
616619
}
620+
event StakeTypeSet(StakeType newStakeType);
617621

618622
function test_initializeSlashableStakeQuorum() public {
619623
uint8 quorumNumber = nextQuorum;
@@ -626,6 +630,8 @@ contract StakeRegistryUnitTests_Config is StakeRegistryUnitTests {
626630
);
627631

628632
cheats.prank(address(registryCoordinator));
633+
cheats.expectEmit(true, true, true, true);
634+
emit StakeTypeSet(StakeType.TOTAL_SLASHABLE);
629635
stakeRegistry.initializeSlashableStakeQuorum(
630636
quorumNumber,
631637
minimumStake,

0 commit comments

Comments
 (0)