-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* outsource pure functions from dispatcher to ibc * rename consensus manager -> light client * change ibc contract to be a library to cut down on dispatcher contract size * add Dispatcher interface * forge install: openzeppelin-contracts-upgradeable v4.9.6 * implement proxy design * get all existing test cases working w/ proxy * add access control tests * add dispatcher unit tests for upgrade * format + lint, update dispatcher interface * ignore libraries for formatting * respond to code rabbit comments' * rename dispatcher, impl -> dispatcherProxy, dispatcherImplementation * forge fmt * get current test suite working * test state in upgrade tests * fmt + lint * rename test utils file * rename test utils file * rename testUtils -> testUtilsTest * change test library to abstract contract to avoid test contract size limiting --------- Co-authored-by: Raunak Singh <[email protected]> Co-authored-by: Raunak Singh <[email protected]>
- Loading branch information
1 parent
cda477d
commit 7029199
Showing
23 changed files
with
1,387 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {IbcDispatcher, IbcEventsEmitter} from "./IbcDispatcher.sol"; | ||
|
||
import {L1Header, OpL2StateProof, Ics23Proof} from "./ProofVerifier.sol"; | ||
import {IbcChannelReceiver, IbcPacketReceiver} from "./IbcReceiver.sol"; | ||
import { | ||
Channel, | ||
CounterParty, | ||
ChannelOrder, | ||
IbcPacket, | ||
ChannelState, | ||
AckPacket, | ||
IBCErrors, | ||
IbcUtils, | ||
Ibc | ||
} from "../libs/Ibc.sol"; | ||
|
||
interface IDispatcher is IbcDispatcher, IbcEventsEmitter { | ||
function setPortPrefix(string calldata _portPrefix) external; | ||
|
||
function updateClientWithOptimisticConsensusState( | ||
L1Header calldata l1header, | ||
OpL2StateProof calldata proof, | ||
uint256 height, | ||
uint256 appHash | ||
) external returns (uint256 fraudProofEndTime, bool ended); | ||
|
||
/** | ||
* This function is called by a 'relayer' on behalf of a dApp. The dApp should implement IbcChannelHandler's | ||
* onChanOpenInit. If the callback succeeds, the dApp should return the selected version and the emitted event | ||
* will be relayed to the IBC/VIBC hub chain. | ||
*/ | ||
function channelOpenInit( | ||
IbcChannelReceiver portAddress, | ||
string calldata version, | ||
ChannelOrder ordering, | ||
bool feeEnabled, | ||
string[] calldata connectionHops, | ||
string calldata counterpartyPortId | ||
) external; | ||
|
||
/** | ||
* This function is called by a 'relayer' on behalf of a dApp. The dApp should implement IbcChannelHandler's | ||
* onChanOpenTry. If the callback succeeds, the dApp should return the selected version and the emitted event | ||
* will be relayed to the IBC/VIBC hub chain. | ||
*/ | ||
function channelOpenTry( | ||
IbcChannelReceiver portAddress, | ||
CounterParty calldata local, | ||
ChannelOrder ordering, | ||
bool feeEnabled, | ||
string[] calldata connectionHops, | ||
CounterParty calldata counterparty, | ||
Ics23Proof calldata proof | ||
) external; | ||
|
||
/** | ||
* This func is called by a 'relayer' after the IBC/VIBC hub chain has processed the ChannelOpenTry event. | ||
* The dApp should implement the onChannelConnect method to handle the third channel handshake method: ChanOpenAck | ||
*/ | ||
function channelOpenAck( | ||
IbcChannelReceiver portAddress, | ||
CounterParty calldata local, | ||
string[] calldata connectionHops, | ||
ChannelOrder ordering, | ||
bool feeEnabled, | ||
CounterParty calldata counterparty, | ||
Ics23Proof calldata proof | ||
) external; | ||
|
||
/** | ||
* This func is called by a 'relayer' after the IBC/VIBC hub chain has processed the ChannelOpenTry event. | ||
* The dApp should implement the onChannelConnect method to handle the last channel handshake method: | ||
* ChannelOpenConfirm | ||
*/ | ||
function channelOpenConfirm( | ||
IbcChannelReceiver portAddress, | ||
CounterParty calldata local, | ||
string[] calldata connectionHops, | ||
ChannelOrder ordering, | ||
bool feeEnabled, | ||
CounterParty calldata counterparty, | ||
Ics23Proof calldata proof | ||
) external; | ||
|
||
function closeIbcChannel(bytes32 channelId) external; | ||
|
||
function sendPacket(bytes32 channelId, bytes calldata packet, uint64 timeoutTimestamp) external; | ||
|
||
function acknowledgement( | ||
IbcPacketReceiver receiver, | ||
IbcPacket calldata packet, | ||
bytes calldata ack, | ||
Ics23Proof calldata proof | ||
) external; | ||
|
||
function timeout(IbcPacketReceiver receiver, IbcPacket calldata packet, Ics23Proof calldata proof) external; | ||
|
||
function recvPacket(IbcPacketReceiver receiver, IbcPacket calldata packet, Ics23Proof calldata proof) external; | ||
|
||
function getOptimisticConsensusState(uint256 height) | ||
external | ||
view | ||
returns (uint256 appHash, uint256 fraudProofEndTime, bool ended); | ||
|
||
function portIdAddressMatch(address addr, string calldata portId) external view returns (bool isMatch); | ||
|
||
function getChannel(address portAddress, bytes32 channelId) external view returns (Channel memory channel); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 3 additions & 4 deletions
7
...acts/utils/DummyConsensusStateManager.sol → contracts/utils/DummyLightClient.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule openzeppelin-contracts-upgradeable
added at
2d081f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.