Skip to content

Commit

Permalink
[ Informal Audit ] enforce 2 length connection hops in dispatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
RnkSngh committed Sep 12, 2024
1 parent 9e8eb81 commit 515d592
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions contracts/core/Dispatcher.sol
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,9 @@ contract Dispatcher is Ownable2StepUpgradeable, UUPSUpgradeable, ReentrancyGuard
string calldata counterpartyPortId
) external nonReentrant {
// We need to validate connectionHops & counterpartyPortId since they aren't validated in an internal
// function like all other instances of these arguments
if (connectionHops.length < 2 || bytes(counterpartyPortId).length == 0) {
// function like all other instances of these arguments. ConnectionHops can only be of length 2 for now since we
// don't yet support multihop, but this will be updated in the future
if (connectionHops.length != 2 || bytes(counterpartyPortId).length == 0) {
revert IBCErrors.invalidCounterParty();
}
if (bytes(version).length == 0) {
Expand Down Expand Up @@ -212,7 +213,9 @@ contract Dispatcher is Ownable2StepUpgradeable, UUPSUpgradeable, ReentrancyGuard
ChannelEnd calldata counterparty,
Ics23Proof calldata proof
) external nonReentrant {
if (connectionHops.length < 2) {
// Note: ConnectionHops can only be of length 2 for now since we don't yet support multihop, but this will be
// updated in the future
if (connectionHops.length != 2) {
revert IBCErrors.invalidConnectionHops();
}
_checkInvalidCounterParty(local.portId, local.channelId, counterparty.portId, counterparty.channelId);
Expand Down
Loading

0 comments on commit 515d592

Please sign in to comment.