Skip to content

Commit

Permalink
Implement verifyEntry()
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiTimesChi committed Feb 16, 2024
1 parent 8b0caa2 commit 50b16a4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {InterchainEntry} from "../libs/InterchainEntry.sol";

abstract contract InterchainModuleEvents {
event VerificationRequested(uint256 indexed destChainId, bytes entry, bytes32 ethSignedEntryHash);

event EntryVerified(InterchainEntry entry);
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ abstract contract InterchainModule is InterchainModuleEvents, IInterchainModule
function _verifyEntry(bytes memory encodedEntry) internal {
InterchainEntry memory entry = abi.decode(encodedEntry, (InterchainEntry));
IInterchainDB(INTERCHAIN_DB).verifyEntry(entry);
emit EntryVerified(entry);
}

/// @dev Internal logic to request the verification of an entry on the destination chain.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {ThresholdECDSA} from "../libs/ThresholdECDSA.sol";

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol";

contract ThresholdECDSAModule is InterchainModule, Ownable, ThresholdECDSAModuleEvents, IThresholdECDSAModule {
uint256 public constant VERIFY_GAS_LIMIT = 100_000;
Expand Down Expand Up @@ -66,7 +67,11 @@ contract ThresholdECDSAModule is InterchainModule, Ownable, ThresholdECDSAModule
// ══════════════════════════════════════════════ PERMISSIONLESS ═══════════════════════════════════════════════════

/// @inheritdoc IThresholdECDSAModule
function verifyEntry(bytes calldata encodedEntry, bytes calldata signatures) external {}
function verifyEntry(bytes calldata encodedEntry, bytes calldata signatures) external {
bytes32 ethSignedHash = MessageHashUtils.toEthSignedMessageHash(keccak256(encodedEntry));
_verifiers.verifySignedHash(ethSignedHash, signatures);
_verifyEntry(encodedEntry);
}

// ═══════════════════════════════════════════════════ VIEWS ═══════════════════════════════════════════════════════

Expand Down

0 comments on commit 50b16a4

Please sign in to comment.