Skip to content

Commit 55c9b06

Browse files
committed
test: ♻️ avoid using hardcoded eid wherever is possible
1 parent 219284a commit 55c9b06

1 file changed

Lines changed: 37 additions & 27 deletions

File tree

src/DssSpell.t.sol

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,38 +1732,48 @@ contract DssSpellTest is DssSpellTestBase {
17321732
_scheduleWaitAndCast(address(spell));
17331733
assertTrue(spell.done(), "TestError/spell-not-done");
17341734

1735-
L1GovernanceRelayLike l1GovernanceRelay = L1GovernanceRelayLike(addr.addr("LZ_GOV_RELAY"));
1736-
1737-
// Build governance payload: delegatecall spell → spell calls setRateLimits on OFT
1738-
RateLimitConfig[] memory inbound = new RateLimitConfig[](1);
1739-
inbound[0] = RateLimitConfig({ eid: 30101, window: uint48(1 days), limit: 10_000_000 * WAD });
1740-
RateLimitConfig[] memory outbound = new RateLimitConfig[](1);
1741-
outbound[0] = RateLimitConfig({ eid: 30101, window: uint48(1 days), limit: 10_000_000 * WAD });
1742-
bytes memory targetData = abi.encodeWithSelector(AvaxSetRateLimitsSpell.execute.selector, avaxUsdsOft, inbound, outbound);
1743-
1744-
vm.startPrank(pauseProxy);
1745-
vm.deal(pauseProxy, 10 ether);
1746-
1747-
vm.recordLogs();
1748-
l1GovernanceRelay.relayEVM{value: 1 ether}(
1749-
lane.remoteChain.eid,
1750-
avaxL2GovRelay,
1751-
avaxSpell,
1752-
targetData,
1753-
LZLaneTesting.executorLzReceiveOption(200_000),
1754-
L1GovernanceRelayLike.MessagingFee({ nativeFee: 1 ether, lzTokenFee: 0 }),
1755-
address(0xdead)
1756-
);
1757-
vm.stopPrank();
1758-
1759-
Vm.Log[] memory logs = vm.getRecordedLogs();
1735+
// Build governance payload and send
1736+
Vm.Log[] memory logs;
1737+
{
1738+
RateLimitConfig[] memory inbound = new RateLimitConfig[](1);
1739+
inbound[0] = RateLimitConfig({
1740+
eid: lane.localChain.eid,
1741+
window: uint48(1 days),
1742+
limit: 10_000_000 * WAD
1743+
});
1744+
RateLimitConfig[] memory outbound = new RateLimitConfig[](1);
1745+
outbound[0] = RateLimitConfig({
1746+
eid: lane.localChain.eid,
1747+
window: uint48(1 days),
1748+
limit: 10_000_000 * WAD
1749+
});
1750+
bytes memory targetData = abi.encodeWithSelector(AvaxSetRateLimitsSpell.execute.selector, avaxUsdsOft, inbound, outbound);
1751+
1752+
vm.startPrank(pauseProxy);
1753+
vm.deal(pauseProxy, 10 ether);
1754+
vm.recordLogs();
1755+
L1GovernanceRelayLike(addr.addr("LZ_GOV_RELAY")).relayEVM{value: 1 ether}(
1756+
lane.remoteChain.eid,
1757+
avaxL2GovRelay,
1758+
avaxSpell,
1759+
targetData,
1760+
LZLaneTesting.executorLzReceiveOption(200_000),
1761+
L1GovernanceRelayLike.MessagingFee({
1762+
nativeFee: 1 ether,
1763+
lzTokenFee: 0
1764+
}),
1765+
address(0xdead)
1766+
);
1767+
vm.stopPrank();
1768+
logs = vm.getRecordedLogs();
1769+
}
17601770

17611771
// Relay to Avalanche and verify state
17621772
LZLaneTesting.relayToFork(logs, lane, avaxFork);
17631773
vm.selectFork(avaxFork);
17641774

1765-
(, uint48 outW,, uint256 outL) = SkyOFTAdapterLike(avaxUsdsOft).outboundRateLimits(30101);
1766-
(, uint48 inW,, uint256 inL) = SkyOFTAdapterLike(avaxUsdsOft).inboundRateLimits(30101);
1775+
(, uint48 outW,, uint256 outL) = SkyOFTAdapterLike(avaxUsdsOft).outboundRateLimits(lane.localChain.eid);
1776+
(, uint48 inW,, uint256 inL) = SkyOFTAdapterLike(avaxUsdsOft).inboundRateLimits(lane.localChain.eid);
17671777
assertEq(outW, uint48(1 days), "TestError/gov/outbound-window-not-set");
17681778
assertEq(outL, 10_000_000 * WAD, "TestError/gov/outbound-limit-not-set");
17691779
assertEq(inW, uint48(1 days), "TestError/gov/inbound-window-not-set");

0 commit comments

Comments
 (0)