Skip to content

Commit

Permalink
fix(typo): TOKEN_ADDRESS_BYTES_LENTH => TOKEN_ADDRESS_BYTES_LENGTH
Browse files Browse the repository at this point in the history
  • Loading branch information
adu-web3 committed Jul 1, 2024
1 parent c8e08ea commit 31b062a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion script/3_Setup.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ contract SetupScript is BaseScript {
names[1] = "RestakeToken";
metaData[1] = "";

uint256 messageLength = TOKEN_ADDRESS_BYTES_LENTH * whitelistTokensBytes32.length + 2;
uint256 messageLength = TOKEN_ADDRESS_BYTES_LENGTH * whitelistTokensBytes32.length + 2;
uint256 nativeFee = exocoreGateway.quote(clientChainId, new bytes(messageLength));
exocoreGateway.addWhitelistTokens{value: nativeFee}(
clientChainId, whitelistTokensBytes32, decimals, tvlLimits, names, metaData
Expand Down
2 changes: 1 addition & 1 deletion script/BaseScript.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ contract BaseScript is Script {
uint256 constant DEPOSIT_AMOUNT = 1 ether;
uint256 constant WITHDRAW_AMOUNT = 1 ether;
address internal constant VIRTUAL_STAKED_ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
uint256 internal constant TOKEN_ADDRESS_BYTES_LENTH = 32;
uint256 internal constant TOKEN_ADDRESS_BYTES_LENGTH = 32;

bool useExocorePrecompileMock;
bool useEndpointMock;
Expand Down
6 changes: 3 additions & 3 deletions src/core/ClientGatewayLzReceiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,14 @@ abstract contract ClientGatewayLzReceiver is PausableUpgradeable, OAppReceiverUp
whenNotPaused
{
uint8 count = uint8(requestPayload[0]);
uint256 expectedLength = count * TOKEN_ADDRESS_BYTES_LENTH + 1;
uint256 expectedLength = count * TOKEN_ADDRESS_BYTES_LENGTH + 1;
if (requestPayload.length != expectedLength) {
revert InvalidAddWhitelistTokensRequest(expectedLength, requestPayload.length);
}

for (uint256 i; i < count; i++) {
uint256 start = i * TOKEN_ADDRESS_BYTES_LENTH + 1;
uint256 end = start + TOKEN_ADDRESS_BYTES_LENTH;
uint256 start = i * TOKEN_ADDRESS_BYTES_LENGTH + 1;
uint256 end = start + TOKEN_ADDRESS_BYTES_LENGTH;
address token = address(bytes20(requestPayload[start:end]));

if (!isWhitelistedToken[token]) {
Expand Down
2 changes: 1 addition & 1 deletion src/storage/ClientChainGatewayStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ contract ClientChainGatewayStorage is BootstrapStorage {
uint256 internal constant GWEI_TO_WEI = 1e9;
address internal constant VIRTUAL_STAKED_ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
IETHPOSDeposit internal constant ETH_POS = IETHPOSDeposit(0x00000000219ab540356cBB839Cbe05303d7705Fa);
uint256 internal constant TOKEN_ADDRESS_BYTES_LENTH = 32;
uint256 internal constant TOKEN_ADDRESS_BYTES_LENGTH = 32;

uint256[40] private __gap;

Expand Down
2 changes: 1 addition & 1 deletion src/storage/ExocoreGatewayStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ contract ExocoreGatewayStorage is GatewayStorage {
uint256 internal constant CLAIM_REWARD_REQUEST_LENGTH = 96;
// bytes32 token + bytes32 delegator + bytes(42) operator + uint256 amount
uint256 internal constant DEPOSIT_THEN_DELEGATE_REQUEST_LENGTH = DELEGATE_REQUEST_LENGTH;
uint256 internal constant TOKEN_ADDRESS_BYTES_LENTH = 32;
uint256 internal constant TOKEN_ADDRESS_BYTES_LENGTH = 32;
uint256 internal constant UINT8_BYTES_LENGTH = 1;
uint256 internal constant UINT256_BYTES_LENGTH = 32;

Expand Down
22 changes: 11 additions & 11 deletions test/foundry/unit/ExocoreGateway.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ contract AddWhitelistTokens is SetUp {
using stdStorage for StdStorage;
using AddressCast for address;

uint256 internal constant TOKEN_ADDRESS_BYTES_LENTH = 32;
uint256 internal constant TOKEN_ADDRESS_BYTES_LENGTH = 32;

event WhitelistTokenAdded(uint32 clientChainId, bytes32 token);

Expand All @@ -204,7 +204,7 @@ contract AddWhitelistTokens is SetUp {
function test_RevertWhen_CallerNotOwner() public {
_prepareInputs(2);

uint256 messageLength = TOKEN_ADDRESS_BYTES_LENTH * whitelistTokens.length + 2;
uint256 messageLength = TOKEN_ADDRESS_BYTES_LENGTH * whitelistTokens.length + 2;
uint256 nativeFee = exocoreGateway.quote(clientChainId, new bytes(messageLength));

vm.startPrank(deployer.addr);
Expand All @@ -220,7 +220,7 @@ contract AddWhitelistTokens is SetUp {

_prepareInputs(2);

uint256 messageLength = TOKEN_ADDRESS_BYTES_LENTH * whitelistTokens.length + 2;
uint256 messageLength = TOKEN_ADDRESS_BYTES_LENGTH * whitelistTokens.length + 2;
uint256 nativeFee = exocoreGateway.quote(clientChainId, new bytes(messageLength));
vm.expectRevert(PausableUpgradeable.EnforcedPause.selector);
exocoreGateway.addWhitelistTokens{value: nativeFee}(
Expand All @@ -232,7 +232,7 @@ contract AddWhitelistTokens is SetUp {
uint32 anotherClientChain = 3;
_prepareInputs(2);

uint256 messageLength = TOKEN_ADDRESS_BYTES_LENTH * whitelistTokens.length + 2;
uint256 messageLength = TOKEN_ADDRESS_BYTES_LENGTH * whitelistTokens.length + 2;
uint256 nativeFee = exocoreGateway.quote(clientChainId, new bytes(messageLength));

vm.startPrank(exocoreValidatorSet.addr);
Expand All @@ -247,7 +247,7 @@ contract AddWhitelistTokens is SetUp {
function test_RevertWhen_TokensListTooLong() public {
_prepareInputs(256);

uint256 messageLength = TOKEN_ADDRESS_BYTES_LENTH * whitelistTokens.length + 2;
uint256 messageLength = TOKEN_ADDRESS_BYTES_LENGTH * whitelistTokens.length + 2;
uint256 nativeFee = exocoreGateway.quote(clientChainId, new bytes(messageLength));

vm.startPrank(exocoreValidatorSet.addr);
Expand All @@ -261,7 +261,7 @@ contract AddWhitelistTokens is SetUp {
_prepareInputs(2);
decimals.push(18);

uint256 messageLength = TOKEN_ADDRESS_BYTES_LENTH * whitelistTokens.length + 2;
uint256 messageLength = TOKEN_ADDRESS_BYTES_LENGTH * whitelistTokens.length + 2;
uint256 nativeFee = exocoreGateway.quote(clientChainId, new bytes(messageLength));

vm.startPrank(exocoreValidatorSet.addr);
Expand All @@ -277,7 +277,7 @@ contract AddWhitelistTokens is SetUp {
tvlLimits[0] = 1e8 ether;
tvlLimits[1] = 1e8 ether;

uint256 messageLength = TOKEN_ADDRESS_BYTES_LENTH * whitelistTokens.length + 2;
uint256 messageLength = TOKEN_ADDRESS_BYTES_LENGTH * whitelistTokens.length + 2;
uint256 nativeFee = exocoreGateway.quote(clientChainId, new bytes(messageLength));

vm.startPrank(exocoreValidatorSet.addr);
Expand All @@ -291,7 +291,7 @@ contract AddWhitelistTokens is SetUp {
_prepareInputs(1);
whitelistTokens[0] = bytes32(bytes20(address(restakeToken)));

uint256 messageLength = TOKEN_ADDRESS_BYTES_LENTH * whitelistTokens.length + 2;
uint256 messageLength = TOKEN_ADDRESS_BYTES_LENGTH * whitelistTokens.length + 2;
uint256 nativeFee = exocoreGateway.quote(clientChainId, new bytes(messageLength));

vm.startPrank(exocoreValidatorSet.addr);
Expand All @@ -309,7 +309,7 @@ contract AddWhitelistTokens is SetUp {
names[0] = "RestakeToken";
metaData[0] = "";

uint256 messageLength = TOKEN_ADDRESS_BYTES_LENTH * whitelistTokens.length + 2;
uint256 messageLength = TOKEN_ADDRESS_BYTES_LENGTH * whitelistTokens.length + 2;
uint256 nativeFee = exocoreGateway.quote(clientChainId, new bytes(messageLength));

vm.startPrank(exocoreValidatorSet.addr);
Expand Down Expand Up @@ -347,7 +347,7 @@ contract UpdateWhitelistTokens is SetUp {

using AddressCast for address;

uint256 internal constant TOKEN_ADDRESS_BYTES_LENTH = 32;
uint256 internal constant TOKEN_ADDRESS_BYTES_LENGTH = 32;

event WhitelistTokenUpdated(uint32 clientChainId, bytes32 token);

Expand Down Expand Up @@ -489,7 +489,7 @@ contract UpdateWhitelistTokens is SetUp {
string[] memory metaData_
) internal {
vm.startPrank(exocoreValidatorSet.addr);
uint256 messageLength = TOKEN_ADDRESS_BYTES_LENTH * whitelistTokens.length + 2;
uint256 messageLength = TOKEN_ADDRESS_BYTES_LENGTH * whitelistTokens.length + 2;
uint256 nativeFee = exocoreGateway.quote(clientChainId, new bytes(messageLength));
exocoreGateway.addWhitelistTokens{value: nativeFee}(
clientChainId_, whitelistTokens_, decimals_, tvlLimits_, names_, metaData_
Expand Down

0 comments on commit 31b062a

Please sign in to comment.