Skip to content

Commit

Permalink
cleanup: update Module interface references
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiTimesChi committed May 9, 2024
1 parent eea0c77 commit b90e634
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
11 changes: 4 additions & 7 deletions packages/contracts-communication/contracts/InterchainDB.sol
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ contract InterchainDB is InterchainDBEvents, IInterchainDB {
/// @param dstChainId The chain id of the destination chain
/// @param srcModules The source chain addresses of the Interchain Modules to use for verification
function getInterchainFee(uint64 dstChainId, address[] calldata srcModules) external view returns (uint256 fee) {
(, fee) = _getModuleFees(dstChainId, getDBNonce(), srcModules);
(, fee) = _getModuleFees(dstChainId, srcModules);
}

/// @notice Check if the entry is verified by the Interchain Module on the destination chain.
Expand Down Expand Up @@ -221,7 +221,7 @@ contract InterchainDB is InterchainDBEvents, IInterchainDB {
)
internal
{
(uint256[] memory fees, uint256 totalFee) = _getModuleFees(dstChainId, entry.dbNonce, srcModules);
(uint256[] memory fees, uint256 totalFee) = _getModuleFees(dstChainId, srcModules);
if (msg.value < totalFee) {
revert InterchainDB__FeeAmountBelowMin(msg.value, totalFee);
} else if (msg.value > totalFee) {
Expand All @@ -234,9 +234,7 @@ contract InterchainDB is InterchainDBEvents, IInterchainDB {
payload: InterchainEntryLib.encodeEntry(entry)
});
for (uint256 i = 0; i < len; ++i) {
IInterchainModule(srcModules[i]).requestEntryVerification{value: fees[i]}(
dstChainId, entry.dbNonce, versionedEntry
);
IInterchainModule(srcModules[i]).requestEntryVerification{value: fees[i]}(dstChainId, versionedEntry);
}
emit InterchainEntryVerificationRequested(dstChainId, entry.dbNonce, srcModules);
}
Expand Down Expand Up @@ -265,7 +263,6 @@ contract InterchainDB is InterchainDBEvents, IInterchainDB {
/// @dev Get the verification fees for the modules
function _getModuleFees(
uint64 dstChainId,
uint64 dbNonce,
address[] calldata srcModules
)
internal
Expand All @@ -278,7 +275,7 @@ contract InterchainDB is InterchainDBEvents, IInterchainDB {
}
fees = new uint256[](len);
for (uint256 i = 0; i < len; ++i) {
fees[i] = IInterchainModule(srcModules[i]).getModuleFee(dstChainId, dbNonce);
fees[i] = IInterchainModule(srcModules[i]).getModuleFee(dstChainId);
totalFee += fees[i];
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts-communication/test/InterchainDB.Src.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ contract InterchainDBSourceTest is Test, InterchainDBEvents {
}

function getModuleCalldata(InterchainEntry memory entry) internal view returns (bytes memory) {
bytes memory vEntry = getVersionedEntry(entry);
return abi.encodeCall(IInterchainModule.requestEntryVerification, (DST_CHAIN_ID, entry.dbNonce, vEntry));
bytes memory versionedEntry = getVersionedEntry(entry);
return abi.encodeCall(IInterchainModule.requestEntryVerification, (DST_CHAIN_ID, versionedEntry));
}

function addressToBytes32(address addr) internal pure returns (bytes32) {
Expand Down

0 comments on commit b90e634

Please sign in to comment.