Skip to content

Commit

Permalink
fix grammatic
Browse files Browse the repository at this point in the history
  • Loading branch information
grishasobol committed Nov 27, 2024
1 parent 87add0f commit 9d60e8b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
34 changes: 17 additions & 17 deletions ethexe/contracts/src/Middleware.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import {MapWithTimeData} from "./libraries/MapWithTimeData.sol";

// TODO (asap): document all functions and variables
// TODO (asap): implement rewards distribution
// TODO (asap): add vaidators commission
// TODO (asap): add validators commission
// TODO: implement forced operators removal
// TODO: implement forced vaults removal
// TODO: use hints for simbiotic calls
// TODO: use hints for symbiotic calls
contract Middleware {
using EnumerableMap for EnumerableMap.AddressToUintMap;
using MapWithTimeData for EnumerableMap.AddressToUintMap;
Expand All @@ -47,8 +47,8 @@ contract Middleware {
error VetoDurationTooShort();
error VetoDurationTooLong();
error IncompatibleVaultVersion();
error NotRegistredVault();
error NotRegistredOperator();
error NotRegisteredVault();
error NotRegisteredOperator();
error RoleMismatch();
error ResolverMismatch();
error ResolverSetDelayTooLong();
Expand All @@ -72,7 +72,7 @@ contract Middleware {
struct Config {
uint48 eraDuration;
uint48 minVaultEpochDuration;
uint48 operatoraGracePeriod;
uint48 operatorGracePeriod;
uint48 vaultGracePeriod;
uint48 minVetoDuration;
uint48 minSlashExecutionDelay;
Expand All @@ -94,7 +94,7 @@ contract Middleware {

uint48 public immutable eraDuration;
uint48 public immutable minVaultEpochDuration;
uint48 public immutable operatoraGracePeriod;
uint48 public immutable operatorGracePeriod;
uint48 public immutable vaultGracePeriod;
uint48 public immutable minVetoDuration;
uint48 public immutable minSlashExecutionDelay;
Expand All @@ -121,7 +121,7 @@ contract Middleware {

eraDuration = cfg.eraDuration;
minVaultEpochDuration = cfg.minVaultEpochDuration;
operatoraGracePeriod = cfg.operatoraGracePeriod;
operatorGracePeriod = cfg.operatorGracePeriod;
vaultGracePeriod = cfg.vaultGracePeriod;
minVetoDuration = cfg.minVetoDuration;
minSlashExecutionDelay = cfg.minSlashExecutionDelay;
Expand Down Expand Up @@ -175,7 +175,7 @@ contract Middleware {
function unregisterOperator(address operator) external {
(, uint48 disabledTime) = operators.getTimes(operator);

if (disabledTime == 0 || Time.timestamp() < disabledTime + operatoraGracePeriod) {
if (disabledTime == 0 || Time.timestamp() < disabledTime + operatorGracePeriod) {
revert OperatorGracePeriodNotPassed();
}

Expand Down Expand Up @@ -328,7 +328,7 @@ contract Middleware {
stake = _collectOperatorStakeFromVaultsAt(operator, ts);
}

// TODO: change return siggnature
// TODO: change return signature
function getActiveOperatorsStakeAt(uint48 ts)
public
view
Expand Down Expand Up @@ -362,14 +362,14 @@ contract Middleware {
for (uint256 i; i < data.length; ++i) {
SlashData calldata slashData = data[i];
if (!operators.contains(slashData.operator)) {
revert NotRegistredOperator();
revert NotRegisteredOperator();
}

for (uint256 j; j < slashData.vaults.length; ++j) {
VaultSlashData calldata vaultData = slashData.vaults[j];

if (!vaults.contains(vaultData.vault)) {
revert NotRegistredVault();
revert NotRegisteredVault();
}

address slasher = IVault(vaultData.vault).slasher();
Expand All @@ -385,7 +385,7 @@ contract Middleware {
SlashIdentifier calldata slash = slashes[i];

if (!vaults.contains(slash.vault)) {
revert NotRegistredVault();
revert NotRegisteredVault();
}

IVetoSlasher(IVault(slash.vault).slasher()).executeSlash(slash.index, new bytes(0));
Expand Down Expand Up @@ -435,7 +435,7 @@ contract Middleware {
// Operator grace period cannot be smaller than minimum vaults epoch duration.
// Otherwise, it would be impossible to do slash in the next era sometimes.
require(
cfg.operatoraGracePeriod >= cfg.minVaultEpochDuration,
cfg.operatorGracePeriod >= cfg.minVaultEpochDuration,
"Operator grace period must be bigger than min vaults epoch duration"
);

Expand All @@ -449,16 +449,16 @@ contract Middleware {
// Give some time for the resolvers to veto slashes.
require(cfg.minVetoDuration > 0, "Veto duration cannot be zero");

// Simbiotic guarantees that any veto slasher has veto duration less than vault epoch duration.
// But we also want to guaratie that there is some time to execute the slash.
// Symbiotic guarantees that any veto slasher has veto duration less than vault epoch duration.
// But we also want to guarantee that there is some time to execute the slash.
require(cfg.minSlashExecutionDelay > 0, "Min slash execution delay cannot be zero");
require(
cfg.minVetoDuration + cfg.minSlashExecutionDelay <= cfg.minVaultEpochDuration,
"Veto duration and slash execution delay must be less than ot equal to min vaults epoch duration"
);

// In order to be able to change resolver, we need to limit max delay in epochs.
// `3` - is minimal number of epochs, which is simbiotic veto slasher impl restrictions.
// `3` - is minimal number of epochs, which is symbiotic veto slasher impl restrictions.
require(cfg.maxResolverSetEpochsDelay >= 3, "Resolver set epochs delay must be at least 3");
}

Expand All @@ -469,7 +469,7 @@ contract Middleware {
revert IncorrectTimestamp();
}

uint48 gracePeriod = operatoraGracePeriod < vaultGracePeriod ? operatoraGracePeriod : vaultGracePeriod;
uint48 gracePeriod = operatorGracePeriod < vaultGracePeriod ? operatorGracePeriod : vaultGracePeriod;
if (ts + gracePeriod <= Time.timestamp()) {
revert IncorrectTimestamp();
}
Expand Down
16 changes: 8 additions & 8 deletions ethexe/contracts/test/Middleware.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ contract MiddlewareTest is Test, POCBaseTest {
WrappedVara public wrappedVara;

function setUp() public override {
// For correct symbiotic work with time artitmeticks
// For correct symbiotic work with time arithmetics
vm.warp(eraDuration * 100);

// set up the symbiotic ecosystem
Expand All @@ -54,7 +54,7 @@ contract MiddlewareTest is Test, POCBaseTest {
Middleware.Config memory cfg = Middleware.Config({
eraDuration: eraDuration,
minVaultEpochDuration: eraDuration * 2,
operatoraGracePeriod: eraDuration * 2,
operatorGracePeriod: eraDuration * 2,
vaultGracePeriod: eraDuration * 2,
minVetoDuration: eraDuration / 3,
minSlashExecutionDelay: eraDuration / 3,
Expand Down Expand Up @@ -166,7 +166,7 @@ contract MiddlewareTest is Test, POCBaseTest {
vm.expectRevert(abi.encodeWithSelector(MapWithTimeData.AlreadyAdded.selector));
middleware.registerOperator();

// Try to register abother operator without registering it in symbiotic
// Try to register another operator without registering it in symbiotic
vm.startPrank(address(0x2));
vm.expectRevert(abi.encodeWithSelector(Middleware.OperatorDoesNotExist.selector));
middleware.registerOperator();
Expand Down Expand Up @@ -400,7 +400,7 @@ contract MiddlewareTest is Test, POCBaseTest {
// Try to request slash from unknown operator
vm.warp(vm.getBlockTimestamp() + 1);
_requestSlash(
address(0xdead), uint48(vm.getBlockTimestamp() - 1), vault1, 100, Middleware.NotRegistredOperator.selector
address(0xdead), uint48(vm.getBlockTimestamp() - 1), vault1, 100, Middleware.NotRegisteredOperator.selector
);
}

Expand All @@ -409,7 +409,7 @@ contract MiddlewareTest is Test, POCBaseTest {

// Try to request slash from unknown vault
_requestSlash(
operator1, uint48(vm.getBlockTimestamp() - 1), address(0xdead), 100, Middleware.NotRegistredVault.selector
operator1, uint48(vm.getBlockTimestamp() - 1), address(0xdead), 100, Middleware.NotRegisteredVault.selector
);
}

Expand Down Expand Up @@ -462,7 +462,7 @@ contract MiddlewareTest is Test, POCBaseTest {
function test_slashTwoOperatorsTwoVaults() external {
(address operator1, address operator2, address vault1, address vault2,,) = _prepareTwoOperators();

// Request slases for 2 operators with corresponding vaults
// Request slashes for 2 operators with corresponding vaults
Middleware.VaultSlashData[] memory operator1_vaults = new Middleware.VaultSlashData[](1);
operator1_vaults[0] = Middleware.VaultSlashData({vault: vault1, amount: 10});

Expand Down Expand Up @@ -507,14 +507,14 @@ contract MiddlewareTest is Test, POCBaseTest {
IVetoSlasher(slasher).vetoSlash(slashIndex, new bytes(0));
}

function test_slashExecutionUnregistredVault() external {
function test_slashExecutionUnregisteredVault() external {
(address operator1,, address vault1,,,) = _prepareTwoOperators();

// Make slash request for operator1 in vault1
uint256 slashIndex = _requestSlash(operator1, uint48(vm.getBlockTimestamp() - 1), vault1, 100, 0);

// Try to execute slash for unknown vault
vm.expectRevert(Middleware.NotRegistredVault.selector);
vm.expectRevert(Middleware.NotRegisteredVault.selector);
_executeSlash(address(0xdead), slashIndex);
}

Expand Down

0 comments on commit 9d60e8b

Please sign in to comment.