Skip to content

Commit

Permalink
forge fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Raunak Singh authored and Raunak Singh committed Mar 11, 2024
1 parent 9743a8d commit e61a6ab
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 11 deletions.
3 changes: 2 additions & 1 deletion test/Dispatcher.proof.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ contract DispatcherIbcWithRealProofs is DispatcherIbcWithRealProofsSuite {
function setUp() public override {
super.setUp();
consensusStateManager = new OptimisticLightClient(1, opProofVerifier, l1BlockProvider);
(dispatcherProxy, dispatcherImplementation) = TestUtils.deployDispatcherProxyAndImpl("polyibc.eth1.", consensusStateManager);
(dispatcherProxy, dispatcherImplementation) =
TestUtils.deployDispatcherProxyAndImpl("polyibc.eth1.", consensusStateManager);
mars = new Mars(dispatcherProxy);
}
}
14 changes: 10 additions & 4 deletions test/Dispatcher.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ abstract contract ChannelHandshakeTestSuite is Base {

contract ChannelHandshakeTest is ChannelHandshakeTestSuite {
function setUp() public override {
(dispatcherProxy, dispatcherImplementation) = TestUtils.deployDispatcherProxyAndImpl(portPrefix, dummyConsStateManager);
(dispatcherProxy, dispatcherImplementation) =
TestUtils.deployDispatcherProxyAndImpl(portPrefix, dummyConsStateManager);
mars = new Mars(dispatcherProxy);
_local = LocalEnd(mars, portId, "channel-1", connectionHops, "1.0", "1.0");
_remote = CounterParty("eth2.7E5F4552091A69125d5DfCb7b8C2659029395Bdf", "channel-2", "1.0");
Expand All @@ -203,7 +204,8 @@ contract ChannelOpenTestBaseSetup is Base {
Mars mars;

function setUp() public virtual override {
(dispatcherProxy, dispatcherImplementation) = TestUtils.deployDispatcherProxyAndImpl(portPrefix, dummyConsStateManager);
(dispatcherProxy, dispatcherImplementation) =
TestUtils.deployDispatcherProxyAndImpl(portPrefix, dummyConsStateManager);
ChannelHandshakeSetting memory setting =
ChannelHandshakeSetting(ChannelOrder.ORDERED, feeEnabled, true, validProof);

Expand Down Expand Up @@ -362,9 +364,13 @@ contract DispatcherRecvPacketTestSuite is ChannelOpenTestBaseSetup {

// cannot receive packets out of order for ordered channel
function test_outOfOrder() public {
dispatcherProxy.recvPacket(IbcReceiver(mars), IbcPacket(src, dest, 1, payload, ZERO_HEIGHT, maxTimeout), validProof);
dispatcherProxy.recvPacket(
IbcReceiver(mars), IbcPacket(src, dest, 1, payload, ZERO_HEIGHT, maxTimeout), validProof
);
vm.expectRevert(abi.encodeWithSignature("unexpectedPacketSequence()"));
dispatcherProxy.recvPacket(IbcReceiver(mars), IbcPacket(src, dest, 3, payload, ZERO_HEIGHT, maxTimeout), validProof);
dispatcherProxy.recvPacket(
IbcReceiver(mars), IbcPacket(src, dest, 3, payload, ZERO_HEIGHT, maxTimeout), validProof
);
}

// TODO: add tests for unordered channel, wrong port, and invalid proof
Expand Down
3 changes: 2 additions & 1 deletion test/TestUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ library TestUtils {
proxy = IDispatcher(
address(
new ERC1967Proxy(
address(dispatcherImplementation), abi.encodeWithSelector(Dispatcher.initialize.selector, initPortPrefix, lightClient)
address(dispatcherImplementation),
abi.encodeWithSelector(Dispatcher.initialize.selector, initPortPrefix, lightClient)
)
)
);
Expand Down
3 changes: 2 additions & 1 deletion test/VirtualChain.sol
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ contract VirtualChain is Test, IbcEventsEmitter {
constructor(uint256 seed, string memory portPrefix) {
_seed = seed;

(dispatcherProxy, dispatcherImplementation) = TestUtils.deployDispatcherProxyAndImpl(portPrefix, new DummyLightClient());
(dispatcherProxy, dispatcherImplementation) =
TestUtils.deployDispatcherProxyAndImpl(portPrefix, new DummyLightClient());
ucHandler = new UniversalChannelHandler(dispatcherProxy);

mars = new Mars(dispatcherProxy);
Expand Down
8 changes: 6 additions & 2 deletions test/upgradeableProxy/Dispatcher.upgrade.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,13 @@ contract DispatcherRecvPacketTestSuite is ChannelOpenTestBaseSetup {

// cannot receive packets out of order for ordered channel
function test_outOfOrder() public {
dispatcherProxy.recvPacket(IbcReceiver(mars), IbcPacket(src, dest, 1, payload, ZERO_HEIGHT, maxTimeout), validProof);
dispatcherProxy.recvPacket(
IbcReceiver(mars), IbcPacket(src, dest, 1, payload, ZERO_HEIGHT, maxTimeout), validProof
);
vm.expectRevert(abi.encodeWithSignature("unexpectedPacketSequence()"));
dispatcherProxy.recvPacket(IbcReceiver(mars), IbcPacket(src, dest, 3, payload, ZERO_HEIGHT, maxTimeout), validProof);
dispatcherProxy.recvPacket(
IbcReceiver(mars), IbcPacket(src, dest, 3, payload, ZERO_HEIGHT, maxTimeout), validProof
);
}

// TODO: add tests for unordered channel, wrong port, and invalid proof
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ contract DispatcherUUPSAccessControl is Base {
DispatcherV2Initializable dispatcherImplementation3;

function setUp() public override {
(dispatcherProxy, dispatcherImplementation) = TestUtils.deployDispatcherProxyAndImpl(portPrefix, dummyConsStateManager);
(dispatcherProxy, dispatcherImplementation) =
TestUtils.deployDispatcherProxyAndImpl(portPrefix, dummyConsStateManager);
dispatcherImplementation2 = new DispatcherV2();
dispatcherImplementation3 = new DispatcherV2Initializable();
}
Expand All @@ -44,7 +45,9 @@ contract DispatcherUUPSAccessControl is Base {
UUPSUpgradeable(address(dispatcherProxy)).upgradeToAndCall(address(dispatcherImplementation3), initData);
assertEq(address(dispatcherImplementation3), TestUtils.getProxyImplementation(address(dispatcherProxy), vm));
assertEq(dispatcherProxy.portPrefix(), portPrefix2);
assertEq(address(uint160(uint256(vm.load(address(dispatcherProxy), bytes32(uint256(110)))))), address(lightClient2));
assertEq(
address(uint160(uint256(vm.load(address(dispatcherProxy), bytes32(uint256(110)))))), address(lightClient2)
);
}

function test_Dispatcher_Prevents_Non_Owner_Updgrade() public {
Expand Down

0 comments on commit e61a6ab

Please sign in to comment.