Skip to content

Commit 8c12d34

Browse files
authored
fix[N12] Fix typographical errors (#110)
* fix[N12] Fix typographical errors Signed-off-by: chrismaree <christopher.maree@gmail.com> * nit Signed-off-by: chrismaree <christopher.maree@gmail.com> * nit Signed-off-by: chrismaree <christopher.maree@gmail.com>
1 parent 6896cf9 commit 8c12d34

24 files changed

+182
-168
lines changed

contracts/HubPool.sol

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
104104
// Mapping of L1 token addresses to the associated pool information.
105105
mapping(address => PooledToken) public pooledTokens;
106106

107-
// Heler contracts to facilitate cross chain actions between HubPool and SpokePool for a specific network.
107+
// Helper contracts to facilitate cross chain actions between HubPool and SpokePool for a specific network.
108108
struct CrossChainContract {
109109
address adapter;
110110
address spokePool;
@@ -222,7 +222,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
222222
event RootBundleCanceled(address indexed disputer, uint256 requestTime, bytes disputedAncillaryData);
223223

224224
modifier noActiveRequests() {
225-
require(!_activeRequest(), "proposal has unclaimed leafs");
225+
require(!_activeRequest(), "Proposal has unclaimed leaves");
226226
_;
227227
}
228228

@@ -289,8 +289,8 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
289289

290290
/**
291291
* @notice Sends message to SpokePool from this contract. Callable only by owner.
292-
* @dev This function has permission to call onlyAdmin functions on the SpokePool, so its imperative
293-
* that this contract only allows the owner to call this method directly or indirectly.
292+
* @dev This function has permission to call onlyAdmin functions on the SpokePool, so it's imperative that this
293+
* contract only allows the owner to call this method directly or indirectly.
294294
* @param chainId Chain with SpokePool to send message to.
295295
* @param functionData ABI encoded function call to send to SpokePool, but can be any arbitrary data technically.
296296
*/
@@ -361,7 +361,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
361361
}
362362

363363
/**
364-
* @notice Sets identifier for root bundle disputes.. Callable only by owner.
364+
* @notice Sets identifier for root bundle disputes. Callable only by owner.
365365
* @param newIdentifier New identifier.
366366
*/
367367
function setIdentifier(bytes32 newIdentifier) public override onlyOwner noActiveRequests nonReentrant {
@@ -477,7 +477,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
477477
* @notice Deposit liquidity into this contract to earn LP fees in exchange for funding relays on SpokePools.
478478
* Caller is essentially loaning their funds to be sent from this contract to the SpokePool, where it will be used
479479
* to repay a relayer, and ultimately receives their loan back after the tokens are bridged back to this contract
480-
* via the canonical token bridge. Then, the caller's loans are used for again. This loan cycle repeats continuously
480+
* via the canonical token bridge. Then, the caller's loans are used again. This loan cycle repeats continuously
481481
* and the caller, or "liquidity provider" earns a continuous fee for their credit that they are extending relayers.
482482
* @notice Caller will receive an LP token representing their share of this pool. The LP token's redemption value
483483
* increments from the time that they enter the pool to reflect their accrued fees.
@@ -581,12 +581,12 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
581581
*************************************************/
582582

583583
/**
584-
* @notice Publish a new root bundle to along with all of the block numbers that the merkle roots are relevant for.
584+
* @notice Publish a new root bundle along with all of the block numbers that the merkle roots are relevant for.
585585
* This is used to aid off-chain validators in evaluating the correctness of this bundle. Caller stakes a bond that
586586
* can be slashed if the root bundle proposal is invalid, and they will receive it back if accepted.
587587
* @notice After proposeRootBundle is called, if the any props are wrong then this proposal can be challenged.
588588
* Once the challenge period passes, then the roots are no longer disputable, and only executeRootBundle can be
589-
* called; moreover, this method can't be called again until all leafs are executed.
589+
* called; moreover, this method can't be called again until all leaves are executed.
590590
* @param bundleEvaluationBlockNumbers should contain the latest block number for all chains, even if there are no
591591
* relays contained on some of them. The usage of this variable should be defined in an off chain UMIP.
592592
* @notice The caller of this function must approve this contract to spend bondAmount of bondToken.
@@ -641,7 +641,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
641641
* @notice Deletes the published root bundle if this is the last leaf to be executed in the root bundle.
642642
* @param chainId ChainId number of the target spoke pool on which the bundle is executed.
643643
* @param groupIndex If set to 0, then relay roots to SpokePool via cross chain bridge. Used by off-chain validator
644-
* to organize leafs with the same chain ID and also set which leaves should result in relayed messages.
644+
* to organize leaves with the same chain ID and also set which leaves should result in relayed messages.
645645
* @param bundleLpFees Array representing the total LP fee amount per token in this bundle for all bundled relays.
646646
* @param netSendAmounts Array representing the amount of tokens to send to the SpokePool on the target chainId.
647647
* @param runningBalances Array used to track any unsent tokens that are not included in the netSendAmounts.
@@ -694,6 +694,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
694694
rootBundleProposal.unclaimedPoolRebalanceLeafCount--;
695695

696696
// Relay each L1 token to destination chain.
697+
697698
// Note: if any of the keccak256(l1Tokens, chainId) combinations are not mapped to a destination token address,
698699
// then this internal method will revert. In this case the admin will have to associate a destination token
699700
// with each l1 token. If the destination token mapping was missing at the time of the proposal, we assume
@@ -726,8 +727,8 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
726727
require(success, "delegatecall failed");
727728
}
728729

729-
// Transfer the bondAmount to back to the proposer, if this the last executed leaf. Only sending this once all
730-
// leafs have been executed acts to force the data worker to execute all bundles or they wont receive their bond.
730+
// Transfer the bondAmount back to the proposer, if this the last executed leaf. Only sending this once all
731+
// leaves have been executed acts to force the data worker to execute all bundles or they won't receive their bond.
731732
if (rootBundleProposal.unclaimedPoolRebalanceLeafCount == 0)
732733
bondToken.safeTransfer(rootBundleProposal.proposer, bondAmount);
733734

@@ -780,8 +781,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
780781
// Set reward to 0, since we'll settle proposer reward payouts directly from this contract after a root
781782
// proposal has passed the challenge period.
782783
0,
783-
// Set the Optimistic oracle proposer bond for the price request. We can assume that
784-
// bondAmount > finalFee.
784+
// Set the Optimistic oracle proposer bond for the request. We can assume that bondAmount > finalFee.
785785
bondAmount - finalFee,
786786
// Set the Optimistic oracle liveness for the price request.
787787
liveness,
@@ -984,7 +984,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
984984
// Calculate the unallocated accumulatedFees from the last time the contract was called.
985985
function _getAccumulatedFees(uint256 undistributedLpFees, uint256 lastLpFeeUpdate) internal view returns (uint256) {
986986
// accumulatedFees := min(undistributedLpFees * lpFeeRatePerSecond * timeFromLastInteraction, undistributedLpFees)
987-
// The min acts to pay out all fees in the case the equation returns more than the remaining a fees.
987+
// The min acts to pay out all fees in the case the equation returns more than the remaining fees.
988988
uint256 timeFromLastInteraction = getCurrentTime() - lastLpFeeUpdate;
989989
uint256 maxUndistributedLpFees = (undistributedLpFees * lpFeeRatePerSecond * timeFromLastInteraction) / (1e18);
990990
return maxUndistributedLpFees < undistributedLpFees ? maxUndistributedLpFees : undistributedLpFees;
@@ -1031,7 +1031,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
10311031
uint256 lpFeesCaptured = bundleLpFees - protocolFeesCaptured;
10321032

10331033
// Assign any LP fees included into the bundle to the pooled token. These LP fees are tracked in the
1034-
// undistributedLpFees and within the utilizedReserves. undistributedLpFees is gradually decrease
1034+
// undistributedLpFees and within the utilizedReserves. undistributedLpFees is gradually decreased
10351035
// over the smear duration to give the LPs their rewards over a period of time. Adding to utilizedReserves
10361036
// acts to track these rewards after the smear duration. See _exchangeRateCurrent for more details.
10371037
if (lpFeesCaptured > 0) {
@@ -1086,7 +1086,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
10861086
}
10871087

10881088
// Added to enable the HubPool to receive ETH. This will occur both when the HubPool unwraps WETH to send to LPs and
1089-
// when ETH is send over the canonical Optimism bridge, which sends ETH.
1089+
// when ETH is sent over the canonical Optimism bridge, which sends ETH.
10901090
fallback() external payable {
10911091
_depositEthToWeth();
10921092
}

contracts/HubPoolInterface.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
1111
interface HubPoolInterface {
1212
// This leaf is meant to be decoded in the HubPool to rebalance tokens between HubPool and SpokePool.
1313
struct PoolRebalanceLeaf {
14-
// This is used to know which chain to send cross-chain transactions to (and which SpokePool to sent to).
14+
// This is used to know which chain to send cross-chain transactions to (and which SpokePool to send to).
1515
uint256 chainId;
1616
// Total LP fee amount per token in this bundle, encompassing all associated bundled relays.
1717
uint256[] bundleLpFees;

contracts/Polygon_SpokePool.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ contract Polygon_SpokePool is IFxMessageProcessor, SpokePool {
4141

4242
// Note: validating calls this way ensures that strange calls coming from the fxChild won't be misinterpreted.
4343
// Put differently, just checking that msg.sender == fxChild is not sufficient.
44-
// All calls that have admin priviledges must be fired from within the processMessageFromRoot method that's gone
44+
// All calls that have admin privileges must be fired from within the processMessageFromRoot method that's gone
4545
// through validation where the sender is checked and the root (mainnet) sender is also validated.
4646
// This modifier sets the callValidated variable so this condition can be checked in _requireAdminSender().
4747
modifier validateInternalCalls() {

contracts/SpokePool.sol

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall
4747
uint32 public numberOfDeposits;
4848

4949
// Origin token to destination token routings can be turned on or off, which can enable or disable deposits.
50+
5051
mapping(address => mapping(uint256 => bool)) public enabledDepositRoutes;
5152

5253
// Stores collection of merkle roots that can be published to this contract from the HubPool, which are referenced
@@ -56,7 +57,7 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall
5657
bytes32 slowRelayRoot;
5758
// Merkle root of relayer refunds for successful relays.
5859
bytes32 relayerRefundRoot;
59-
// This is a 2D bitmap tracking which leafs in the relayer refund root have been claimed, with max size of
60+
// This is a 2D bitmap tracking which leaves in the relayer refund root have been claimed, with max size of
6061
// 256x256 leaves per root.
6162
mapping(uint256 => uint256) claimedBitmap;
6263
}
@@ -279,7 +280,7 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall
279280
if (originToken == address(weth) && msg.value > 0) {
280281
require(msg.value == amount, "msg.value must match amount");
281282
weth.deposit{ value: msg.value }();
282-
// Else, it is a normal ERC20. In this case pull the token from the users wallet as per normal.
283+
// Else, it is a normal ERC20. In this case pull the token from the user's wallet as per normal.
283284
// Note: this includes the case where the L2 user has WETH (already wrapped ETH) and wants to bridge them.
284285
// In this case the msg.value will be set to 0, indicating a "normal" ERC20 bridging action.
285286
} else IERC20(originToken).safeTransferFrom(msg.sender, address(this), amount);
@@ -337,7 +338,7 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall
337338
**************************************/
338339

339340
/**
340-
* @notice Called by relayer to fulfill part of a deposit by sending destination tokens to the receipient.
341+
* @notice Called by relayer to fulfill part of a deposit by sending destination tokens to the recipient.
341342
* Relayer is expected to pass in unique identifying information for deposit that they want to fulfill, and this
342343
* relay submission will be validated by off-chain data workers who can dispute this relay if any part is invalid.
343344
* If the relay is valid, then the relayer will be refunded on their desired repayment chain. If relay is invalid,

contracts/SpokePoolInterface.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ interface SpokePoolInterface {
88
// This leaf is meant to be decoded in the SpokePool to pay out successful relayers.
99
struct RelayerRefundLeaf {
1010
// This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that
11-
// is negative. This is just that value inverted.
11+
// is negative. This is just the negative of this value.
1212
uint256 amountToReturn;
1313
// Used to verify that this is being executed on the correct destination chainId.
1414
uint256 chainId;
@@ -24,7 +24,7 @@ interface SpokePoolInterface {
2424

2525
// This struct represents the data to fully specify a relay. If any portion of this data differs, the relay is
2626
// considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be
27-
// considered valid and repaid. This data is hashed and inserted into a the slow relay merkle root so that an off
27+
// considered valid and repaid. This data is hashed and inserted into the slow relay merkle root so that an off
2828
// chain validator can choose when to refund slow relayers.
2929
struct RelayData {
3030
// The address that made the deposit on the origin chain.

test/HubPool.Admin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ describe("HubPool Admin functions", function () {
136136
await seedWallet(owner, [], weth, totalBond);
137137
await weth.approve(hubPool.address, totalBond);
138138
await hubPool.proposeRootBundle([1, 2, 3], 5, mockTreeRoot, mockTreeRoot, mockSlowRelayRoot);
139-
await expect(hubPool.setBond(usdc.address, "1")).to.be.revertedWith("proposal has unclaimed leafs");
139+
await expect(hubPool.setBond(usdc.address, "1")).to.be.revertedWith("Proposal has unclaimed leaves");
140140
});
141141
it("Cannot change bond token to unwhitelisted token", async function () {
142142
await expect(hubPool.setBond(randomAddress(), "1")).to.be.revertedWith("Not on whitelist");

0 commit comments

Comments
 (0)