Skip to content

Commit

Permalink
fix: typos and missed renames (Layr-Labs#91)
Browse files Browse the repository at this point in the history
* fix: typos and missed renames

* fix: additional typos
  • Loading branch information
stevennevins authored Oct 17, 2024
1 parent dc43937 commit a0b6cfd
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 35 deletions.
24 changes: 12 additions & 12 deletions contracts/script/IncredibleSquaringDeployer.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import "forge-std/StdJson.sol";
import "forge-std/console.sol";

// # To deploy and verify our contract
// forge script script/CredibleSquaringDeployer.s.sol:CredibleSquaringDeployer --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast -vvvv
// forge script script/IncredibleSquaringDeployer.s.sol:IncredibleSquaringDeployer --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast -vvvv
contract IncredibleSquaringDeployer is Script, Utils {
// DEPLOYMENT CONSTANTS
uint256 public constant QUORUM_THRESHOLD_PERCENTAGE = 100;
Expand All @@ -48,12 +48,12 @@ contract IncredibleSquaringDeployer is Script, Utils {
address public constant AGGREGATOR_ADDR = 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720;
address public constant TASK_GENERATOR_ADDR = 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720;

// ERC20 and Strategy: we need to deploy this erc20, create a strategy for it, and whitelist this strategy in the strategymanager
// ERC20 and Strategy: we need to deploy this ERC20, create a strategy for it, and whitelist this strategy in the strategymanager

ERC20Mock public erc20Mock;
StrategyBaseTVLLimits public erc20MockStrategy;

// Credible Squaring contracts
// Incredible Squaring contracts
ProxyAdmin public incredibleSquaringProxyAdmin;
PauserRegistry public incredibleSquaringPauserReg;

Expand Down Expand Up @@ -104,20 +104,20 @@ contract IncredibleSquaringDeployer is Script, Utils {
stdJson.readAddress(eigenlayerDeployedContracts, ".addresses.rewardsCoordinator")
);

address credibleSquaringCommunityMultisig = msg.sender;
address credibleSquaringPauser = msg.sender;
address incredibleSquaringCommunityMultisig = msg.sender;
address incredibleSquaringPauser = msg.sender;

vm.startBroadcast();
_deployErc20AndStrategyAndWhitelistStrategy(
eigenLayerProxyAdmin, eigenLayerPauserReg, baseStrategyImplementation, strategyManager
);
_deployCredibleSquaringContracts(
_deployIncredibleSquaringContracts(
delegationManager,
avsDirectory,
rewardsCoordinator,
erc20MockStrategy,
credibleSquaringCommunityMultisig,
credibleSquaringPauser
incredibleSquaringCommunityMultisig,
incredibleSquaringPauser
);
vm.stopBroadcast();
}
Expand Down Expand Up @@ -153,13 +153,13 @@ contract IncredibleSquaringDeployer is Script, Utils {
strategyManager.addStrategiesToDepositWhitelist(strats, thirdPartyTransfersForbiddenValues);
}

function _deployCredibleSquaringContracts(
function _deployIncredibleSquaringContracts(
IDelegationManager delegationManager,
IAVSDirectory avsDirectory,
IRewardsCoordinator rewardsCoordinator,
IStrategy strat,
address incredibleSquaringCommunityMultisig,
address credibleSquaringPauser
address incredibleSquaringPauser
) internal {
// Adding this as a temporary fix to make the rest of the script work with a single strategy
// since it was originally written to work with an array of strategies
Expand All @@ -172,7 +172,7 @@ contract IncredibleSquaringDeployer is Script, Utils {
// deploy pauser registry
{
address[] memory pausers = new address[](2);
pausers[0] = credibleSquaringPauser;
pausers[0] = incredibleSquaringPauser;
pausers[1] = incredibleSquaringCommunityMultisig;
incredibleSquaringPauserReg =
new PauserRegistry(pausers, incredibleSquaringCommunityMultisig);
Expand Down Expand Up @@ -264,7 +264,7 @@ contract IncredibleSquaringDeployer is Script, Utils {

{
uint256 numQuorums = 1;
// for each quorum to setup, we need to define
// for each quorum to set up, we need to define
// QuorumOperatorSetParam, minimumStakeForQuorum, and strategyParams
regcoord.IRegistryCoordinator.OperatorSetParam[] memory quorumsOperatorSetParams =
new regcoord.IRegistryCoordinator.OperatorSetParam[](numQuorums);
Expand Down
2 changes: 1 addition & 1 deletion contracts/script/utils/Utils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import "forge-std/Script.sol";
import "forge-std/StdJson.sol";

contract Utils is Script {
// Note that this fct will only work for the ERC20Mock that has a public mint function
// Note that this function will only work for the ERC20Mock that has a public mint function
function _mintTokens(
address strategyAddress,
address[] memory tos,
Expand Down
8 changes: 4 additions & 4 deletions contracts/src/IIncredibleSquaringTaskManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ interface IIncredibleSquaringTaskManager {
}

// Task response is hashed and signed by operators.
// these signatures are aggregated and sent to the contract as response.
// These signatures are aggregated and sent to the contract as response.
struct TaskResponse {
// Can be obtained by the operator from the event NewTaskCreated.
uint32 referenceTaskIndex;
Expand All @@ -46,12 +46,12 @@ interface IIncredibleSquaringTaskManager {
// It thus cannot be signed by operators, so we keep it in a separate struct than TaskResponse
// This metadata is needed by the challenger, so we emit it in the TaskResponded event
struct TaskResponseMetadata {
uint32 taskResponsedBlock;
uint32 taskRespondedBlock;
bytes32 hashOfNonSigners;
}

// FUNCTIONS
// NOTE: this function creates new task.
// NOTE: this function creates a new task.
function createNewTask(
uint256 numberToBeSquared,
uint32 quorumThresholdPercentage,
Expand All @@ -61,7 +61,7 @@ interface IIncredibleSquaringTaskManager {
/// @notice Returns the current 'taskNumber' for the middleware
function taskNumber() external view returns (uint32);

// // NOTE: this function raises challenge to existing tasks.
// NOTE: this function raises a challenge to existing tasks.
function raiseAndResolveChallenge(
Task calldata task,
TaskResponse calldata taskResponse,
Expand Down
8 changes: 4 additions & 4 deletions contracts/src/IncredibleSquaringServiceManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ import "./IIncredibleSquaringTaskManager.sol";
import "@eigenlayer-middleware/src/ServiceManagerBase.sol";

/**
* @title Primary entrypoint for procuring services from IncredibleSquaring.
* @title Primary entry point for procuring services from IncredibleSquaring.
* @author Layr Labs, Inc.
*/
contract IncredibleSquaringServiceManager is ServiceManagerBase {
using BytesLib for bytes;

IIncredibleSquaringTaskManager public immutable incredibleSquaringTaskManager;

/// @notice when applied to a function, ensures that the function is only callable by the `registryCoordinator`.
/// @notice When applied to a function, ensures that the function is only callable by the `incredibleSquaringTaskManager`.
modifier onlyIncredibleSquaringTaskManager() {
require(
msg.sender == address(incredibleSquaringTaskManager),
"onlyIncredibleSquaringTaskManager: not from credible squaring task manager"
"onlyIncredibleSquaringTaskManager: not from incredible squaring task manager"
);
_;
}
Expand All @@ -36,7 +36,7 @@ contract IncredibleSquaringServiceManager is ServiceManagerBase {
}

/// @notice Called in the event of challenge resolution, in order to forward a call to the Slasher, which 'freezes' the `operator`.
/// @dev The Slasher contract is under active development and its interface expected to change.
/// @dev The Slasher contract is under active development and its interface is expected to change.
/// We recommend writing slashing logic without integrating with the Slasher at this point in time.
function freezeOperator(
address operatorAddr
Expand Down
28 changes: 14 additions & 14 deletions contracts/src/IncredibleSquaringTaskManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ contract IncredibleSquaringTaskManager is
// The number of blocks from the task initialization within which the aggregator has to respond to
uint32 public immutable TASK_RESPONSE_WINDOW_BLOCK;
uint32 public constant TASK_CHALLENGE_WINDOW_BLOCK = 100;
uint256 internal constant _THRESHOLD_DENOMINATOR = 100;
uint256 internal constant THRESHOLD_DENOMINATOR = 100;

/* STORAGE */
// The latest task index
Expand All @@ -44,7 +44,7 @@ contract IncredibleSquaringTaskManager is
// mapping of task indices to hash of abi.encode(taskResponse, taskResponseMetadata)
mapping(uint32 => bytes32) public allTaskResponses;

mapping(uint32 => bool) public taskSuccesfullyChallenged;
mapping(uint32 => bool) public taskSuccessfullyChallenged;

address public aggregator;
address public generator;
Expand Down Expand Up @@ -122,7 +122,7 @@ contract IncredibleSquaringTaskManager is
bytes calldata quorumNumbers = task.quorumNumbers;
uint32 quorumThresholdPercentage = task.quorumThresholdPercentage;

// check that the task is valid, hasn't been responsed yet, and is being responsed in time
// check that the task is valid, hasn't been responded to yet, and is being responded to in time
require(
keccak256(abi.encode(task)) == allTaskHashes[taskResponse.referenceTaskIndex],
"supplied task does not match the one recorded in the contract"
Expand All @@ -145,20 +145,20 @@ contract IncredibleSquaringTaskManager is
(QuorumStakeTotals memory quorumStakeTotals, bytes32 hashOfNonSigners) =
checkSignatures(message, quorumNumbers, taskCreatedBlock, nonSignerStakesAndSignature);

// check that signatories own at least a threshold percentage of each quourm
// check that signatories own at least a threshold percentage of each quorum
for (uint256 i = 0; i < quorumNumbers.length; i++) {
// we don't check that the quorumThresholdPercentages are not >100 because a greater value would trivially fail the check, implying
// signed stake > total stake
require(
quorumStakeTotals.signedStakeForQuorum[i] * _THRESHOLD_DENOMINATOR
quorumStakeTotals.signedStakeForQuorum[i] * THRESHOLD_DENOMINATOR
>= quorumStakeTotals.totalStakeForQuorum[i] * uint8(quorumThresholdPercentage),
"Signatories do not own at least threshold percentage of a quorum"
);
}

TaskResponseMetadata memory taskResponseMetadata =
TaskResponseMetadata(uint32(block.number), hashOfNonSigners);
// updating the storage with task responsea
// updating the storage with task response
allTaskResponses[taskResponse.referenceTaskIndex] =
keccak256(abi.encode(taskResponse, taskResponseMetadata));

Expand Down Expand Up @@ -191,13 +191,13 @@ contract IncredibleSquaringTaskManager is
"Task response does not match the one recorded in the contract"
);
require(
taskSuccesfullyChallenged[referenceTaskIndex] == false,
taskSuccessfullyChallenged[referenceTaskIndex] == false,
"The response to this task has already been challenged successfully."
);

require(
uint32(block.number)
<= taskResponseMetadata.taskResponsedBlock + TASK_CHALLENGE_WINDOW_BLOCK,
<= taskResponseMetadata.taskRespondedBlock + TASK_CHALLENGE_WINDOW_BLOCK,
"The challenge period for this task has already expired."
);

Expand Down Expand Up @@ -231,10 +231,10 @@ contract IncredibleSquaringTaskManager is
);

// get the address of operators who didn't sign
address[] memory addresssOfNonSigningOperators =
address[] memory addressesOfNonSigningOperators =
new address[](pubkeysOfNonSigningOperators.length);
for (uint256 i = 0; i < pubkeysOfNonSigningOperators.length; i++) {
addresssOfNonSigningOperators[i] = BLSApkRegistry(address(blsApkRegistry))
addressesOfNonSigningOperators[i] = BLSApkRegistry(address(blsApkRegistry))
.pubkeyHashToOperator(hashesOfPubkeysOfNonSigningOperators[i]);
}

Expand Down Expand Up @@ -275,14 +275,14 @@ contract IncredibleSquaringTaskManager is
// bool wasSigningOperator = true;
// for (
// uint k = 0;
// k < addresssOfNonSigningOperators.length;
// k < addressesOfNonSigningOperators.length;
// k++
// ) {
// if (
// operatorAddress == addresssOfNonSigningOperators[k]
// operatorAddress == addressesOfNonSigningOperators[k]
// ) {
// // if the operator was a non-signer, then we set the flag to false
// wasSigningOperator == false;
// wasSigningOperator = false;
// break;
// }
// }
Expand All @@ -297,7 +297,7 @@ contract IncredibleSquaringTaskManager is
// }

// the task response has been challenged successfully
taskSuccesfullyChallenged[referenceTaskIndex] = true;
taskSuccessfullyChallenged[referenceTaskIndex] = true;

emit TaskChallengedSuccessfully(referenceTaskIndex, msg.sender);
}
Expand Down

0 comments on commit a0b6cfd

Please sign in to comment.