Skip to content

Commit 066f002

Browse files
committed
add some comments about ILightClient and IIBCModule's security
Signed-off-by: Jun Kimura <jun.kimura@datachain.jp>
1 parent 44ae785 commit 066f002

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

contracts/core/02-client/ILightClient.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ interface ILightClient {
7878
/**
7979
* @dev verifyMembership is a generic proof verification method which verifies a proof of the existence of a value at a given CommitmentPath at the specified height.
8080
* The caller is expected to construct the full CommitmentPath from a CommitmentPrefix and a standardized path (as defined in ICS 24).
81+
* This function should not perform `call` to the IBC contract. However, `staticcall` is permitted.
8182
*/
8283
function verifyMembership(
8384
string calldata clientId,
@@ -93,6 +94,7 @@ interface ILightClient {
9394
/**
9495
* @dev verifyNonMembership is a generic proof verification method which verifies the absence of a given CommitmentPath at a specified height.
9596
* The caller is expected to construct the full CommitmentPath from a CommitmentPrefix and a standardized path (as defined in ICS 24).
97+
* This function should not perform `call` to the IBC contract. However, `staticcall` is permitted.
9698
*/
9799
function verifyNonMembership(
98100
string calldata clientId,

contracts/core/24-host/IIBCHostConfigurator.sol

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,24 @@ import {IIBCModule} from "../26-router/IIBCModule.sol";
77
interface IIBCHostConfigurator {
88
/**
99
* @dev setExpectedTimePerBlock sets expected time per block.
10+
* Typically this function should be called by an authority like an IBC contract owner or govenance.
1011
*/
1112
function setExpectedTimePerBlock(uint64 expectedTimePerBlock_) external;
1213

1314
/**
1415
* @dev registerClient registers a new client type into the client registry
16+
* Typically this function should be called by an authority like an IBC contract owner or govenance.
17+
* The authority should verify the light client contract is a valid implementation as follows:
18+
* - The contract implements ILightClient
19+
* - To avoid reentrancy attack, the contract never performs `call` to the IBC contract directly or indirectly in the `verifyMembership` and the `verifyNonMembership`
1520
*/
1621
function registerClient(string calldata clientType, ILightClient client) external;
1722

1823
/**
1924
* @dev bindPort binds to an unallocated port, failing if the port has already been allocated.
25+
* Typically this function should be called by an authority like an IBC contract owner or govenance.
26+
* The authority should verify the light client contract is a valid implementation as follows:
27+
* - The contract implements IIBCModule
2028
*/
2129
function bindPort(string calldata portId, IIBCModule moduleAddress) external;
2230
}

0 commit comments

Comments
 (0)