Skip to content

Commit

Permalink
evm: address pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
gator-boi committed Apr 22, 2024
1 parent e98f021 commit 0f69b7a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 15 deletions.
4 changes: 2 additions & 2 deletions evm/forge/tests/MatchingEngine.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ contract MatchingEngineTest is Test {
MatchingEngine(address(new ERC1967Proxy(address(implementation), "")));

vm.expectRevert(
abi.encodeWithSignature("InvalidInitDataLength(uint256,uint256)", 0, 40)
abi.encodeWithSignature("LengthMismatch(uint256,uint256)", 0, 40)
);
proxy.initialize(new bytes(0));
}
Expand All @@ -224,7 +224,7 @@ contract MatchingEngineTest is Test {
MatchingEngine(address(new ERC1967Proxy(address(implementation), "")));

vm.expectRevert(
abi.encodeWithSignature("InvalidInitDataLength(uint256,uint256)", 41, 40)
abi.encodeWithSignature("LengthMismatch(uint256,uint256)", 41, 40)
);
proxy.initialize(abi.encodePacked(makeAddr("ownerAssistant"), FEE_RECIPIENT, uint8(69)));
}
Expand Down
4 changes: 2 additions & 2 deletions evm/forge/tests/TokenRouter.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ contract TokenRouterTest is Test {
TokenRouter proxy = TokenRouter(address(new ERC1967Proxy(address(implementation), "")));

vm.expectRevert(
abi.encodeWithSignature("InvalidInitDataLength(uint256,uint256)", 0, 20)
abi.encodeWithSignature("LengthMismatch(uint256,uint256)", 0, 20)
);
proxy.initialize(new bytes(0));
}
Expand All @@ -194,7 +194,7 @@ contract TokenRouterTest is Test {
TokenRouter proxy = TokenRouter(address(new ERC1967Proxy(address(implementation), "")));

vm.expectRevert(
abi.encodeWithSignature("InvalidInitDataLength(uint256,uint256)", 40, 20)
abi.encodeWithSignature("LengthMismatch(uint256,uint256)", 40, 20)
);
proxy.initialize(abi.encodePacked(makeAddr("ownerAssistant"), makeAddr("hole")));
}
Expand Down
4 changes: 1 addition & 3 deletions evm/src/MatchingEngine/MatchingEngine.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ contract MatchingEngine is MatchingEngineFastOrders, MatchingEngineAdmin {
(ownerAssistant, offset) = initData.asAddressUnchecked(offset);
(feeRecipient, offset) = initData.asAddressUnchecked(offset);

if (initData.length != offset) {
revert InvalidInitDataLength(initData.length, offset);
}
initData.checkLength(offset);
}
}
4 changes: 1 addition & 3 deletions evm/src/TokenRouter/TokenRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ contract TokenRouter is TokenRouterAdmin, PlaceMarketOrder, RedeemFill {

(ownerAssistant, offset) = initData.asAddressUnchecked(offset);

if (initData.length != offset) {
revert InvalidInitDataLength(initData.length, offset);
}
initData.checkLength(offset);
}
}
8 changes: 3 additions & 5 deletions evm/src/shared/Implementation.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache 2
pragma solidity >=0.8.8 <0.9.0;
pragma solidity ^0.8.19;

import "./external/Initializable.sol";
import "openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Upgrade.sol";
Expand Down Expand Up @@ -42,16 +42,14 @@ abstract contract Implementation is Initializable, ERC1967Upgrade {
0xe0760c100f4f7987b71e72343e04776f5f180cf968c0fe3a1e429da0bb7630d0;

function _getMigratingStorage() private pure returns (_Migrating storage $) {
uint256 slot = uint256(MIGRATING_SLOT);
assembly ("memory-safe") {
$.slot := slot
$.slot := MIGRATING_SLOT
}
}

function _getMigratesImmutablesStorage() internal pure returns (_Bool storage $) {
uint256 slot = uint256(MIGRATES_IMMUTABLES_SLOT);
assembly ("memory-safe") {
$.slot := slot
$.slot := MIGRATES_IMMUTABLES_SLOT
}
}

Expand Down

0 comments on commit 0f69b7a

Please sign in to comment.