Skip to content

Commit b52254e

Browse files
committed
refactor: minor refactor and added missing natspec
1 parent 9497d4d commit b52254e

File tree

2 files changed

+36
-14
lines changed

2 files changed

+36
-14
lines changed

contracts/src/gateway/HomeGateway.sol

+20-10
Original file line numberDiff line numberDiff line change
@@ -76,28 +76,28 @@ contract HomeGateway is IHomeGateway {
7676
// ************************************* //
7777

7878
/**
79-
* @dev Provide the same parameters as on the originalChain while creating a dispute. Providing incorrect parameters will create a different hash than on the originalChain and will not affect the actual dispute/arbitrable's ruling.
80-
* @param _originalChainID originalChainId
81-
* @param _originalBlockHash originalBlockHash
82-
* @param _originalDisputeID originalDisputeID
79+
* @dev Provide the same parameters as on the foreignChain while creating a dispute. Providing incorrect parameters will create a different hash than on the foreignChain and will not affect the actual dispute/arbitrable's ruling.
80+
* @param _foreignChainID foreignChainId
81+
* @param _foreignBlockHash foreignBlockHash
82+
* @param _foreignDisputeID foreignDisputeID
8383
* @param _choices number of ruling choices
8484
* @param _extraData extraData
8585
* @param _arbitrable arbitrable
8686
*/
8787
function relayCreateDispute(
88-
uint256 _originalChainID,
89-
bytes32 _originalBlockHash,
90-
uint256 _originalDisputeID,
88+
uint256 _foreignChainID,
89+
bytes32 _foreignBlockHash,
90+
uint256 _foreignDisputeID,
9191
uint256 _choices,
9292
bytes calldata _extraData,
9393
address _arbitrable
9494
) external payable override {
9595
bytes32 disputeHash = keccak256(
9696
abi.encodePacked(
97-
_originalChainID,
98-
_originalBlockHash,
97+
_foreignChainID,
98+
_foreignBlockHash,
9999
"createDispute",
100-
_originalDisputeID,
100+
_foreignDisputeID,
101101
_choices,
102102
_extraData,
103103
_arbitrable
@@ -118,6 +118,12 @@ contract HomeGateway is IHomeGateway {
118118
emit Dispute(arbitrator, disputeID, 0, 0);
119119
}
120120

121+
/**
122+
* @dev Give a ruling for a dispute. Must be called by the arbitrator.
123+
* The purpose of this function is to ensure that the address calling it has the right to rule on the contract.
124+
* @param _disputeID ID of the dispute in the Arbitrator contract.
125+
* @param _ruling Ruling given by the arbitrator. Note that 0 is reserved for "Not able/wanting to make a decision".
126+
*/
121127
function rule(uint256 _disputeID, uint256 _ruling) external override {
122128
require(msg.sender == address(arbitrator), "Only Arbitrator");
123129

@@ -130,6 +136,10 @@ contract HomeGateway is IHomeGateway {
130136
fastBridgeSender.sendFast(receiverGateway, data);
131137
}
132138

139+
/**
140+
* @dev Looks up the local home disputeID for a disputeHash. For cross-chain Evidence standard.
141+
* @param _disputeHash dispute hash
142+
*/
133143
function disputeHashToHomeID(bytes32 _disputeHash) external view override returns (uint256) {
134144
return disputeHashtoID[_disputeHash];
135145
}

contracts/src/gateway/interfaces/IHomeGateway.sol

+16-4
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,27 @@ import "../../evidence/IMetaEvidence.sol";
1515
import "@kleros/vea-contracts/interfaces/ISenderGateway.sol";
1616

1717
interface IHomeGateway is IArbitrable, IMetaEvidence, ISenderGateway {
18+
/**
19+
* @dev Provide the same parameters as on the foreignChain while creating a dispute. Providing incorrect parameters will create a different hash than on the foreignChain and will not affect the actual dispute/arbitrable's ruling.
20+
* @param _foreignChainID foreignChainId
21+
* @param _foreignBlockHash foreignBlockHash
22+
* @param _foreignDisputeID foreignDisputeID
23+
* @param _choices number of ruling choices
24+
* @param _extraData extraData
25+
* @param _arbitrable arbitrable
26+
*/
1827
function relayCreateDispute(
19-
uint256 _originalChainID,
20-
bytes32 _originalBlockHash,
21-
uint256 _originalDisputeID,
28+
uint256 _foreignChainID,
29+
bytes32 _foreignBlockHash,
30+
uint256 _foreignDisputeID,
2231
uint256 _choices,
2332
bytes calldata _extraData,
2433
address _arbitrable
2534
) external payable;
2635

27-
// For cross-chain Evidence standard
36+
/**
37+
* @dev Looks up the local home disputeID for a disputeHash. For cross-chain Evidence standard.
38+
* @param _disputeHash dispute hash
39+
*/
2840
function disputeHashToHomeID(bytes32 _disputeHash) external view returns (uint256);
2941
}

0 commit comments

Comments
 (0)