Skip to content

Commit

Permalink
add expect revert for timeout change
Browse files Browse the repository at this point in the history
  • Loading branch information
RnkSngh committed Mar 29, 2024
1 parent edcf78e commit 7cb9c0f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.0;
import "forge-std/Script.sol";
import "../contracts/utils/DummyProofVerifier.sol";
import "../contracts/utils/DummyLightClient.sol";
import "../contracts/core/Dispatcher.sol";
import {Dispatcher} from "../contracts/core/Dispatcher.sol";
import "../contracts/examples/Mars.sol";
import {IDispatcher} from "../contracts/core/Dispatcher.sol";
import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
Expand Down
16 changes: 14 additions & 2 deletions test/Dispatcher.proof.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,20 @@ abstract contract DispatcherIbcWithRealProofsSuite is IbcEventsEmitter, Base {
dispatcherProxy.recvPacket(mars, packet, proof);
}

function test_timeout_packet() public {
vm.skip(true); // not implemented
function test_timeout_packet_revert() public {
// Timeout reverts since it is not yet implemented
Ics23Proof memory proof = load_proof("/test/payload/packet_commitment_proof.hex");
IbcPacket memory packet;
packet.data = bytes("packet-1");
packet.timeoutTimestamp = 15_566_401_733_896_437_760;
packet.dest.channelId = ch1.channelId;
packet.dest.portId = string(abi.encodePacked("polyibc.eth1.", IbcUtils.toHexStr(address(mars))));
packet.src.portId = string(abi.encodePacked("polyibc.eth1.", IbcUtils.toHexStr(address(mars))));
packet.src.channelId = ch0.channelId;
packet.sequence = 1;

vm.expectRevert(abi.encodeWithSelector(ProofVerifier.MethodNotImplemented.selector));
dispatcherProxy.timeout(mars, packet, proof);
}

function load_proof(string memory filepath) internal returns (Ics23Proof memory) {
Expand Down
3 changes: 2 additions & 1 deletion test/VirtualChain.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import "@openzeppelin/contracts/utils/Strings.sol";
import {IbcDispatcher, IbcEventsEmitter} from "../contracts/interfaces/IbcDispatcher.sol";
import {IDispatcher} from "../contracts/interfaces/IDispatcher.sol";
import "../contracts/libs/Ibc.sol";
import "../contracts/core/Dispatcher.sol";
import {Dispatcher} from "../contracts/core/Dispatcher.sol";
import {IbcChannelReceiver, IbcPacketReceiver} from "../contracts/interfaces/IbcReceiver.sol";
import "../contracts/interfaces/ProofVerifier.sol";
import {UniversalChannelHandler} from "../contracts/core/UniversalChannelHandler.sol";
import {Mars} from "../contracts/examples/Mars.sol";
Expand Down

0 comments on commit 7cb9c0f

Please sign in to comment.