Skip to content

Commit

Permalink
chore(evm): rearrange libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
hussein-aitlahcen committed Dec 16, 2024
1 parent 07d94b0 commit 6ad2b0b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 15 deletions.
11 changes: 5 additions & 6 deletions evm/contracts/clients/CometblsClient.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ import "@openzeppelin-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin-upgradeable/utils/PausableUpgradeable.sol";

import "./ICS23MembershipVerifier.sol";
import "./Verifier.sol";

import "../core/02-client/ILightClient.sol";
import "../core/24-host/IBCStore.sol";
import "../core/24-host/IBCCommitment.sol";
import "../lib/Common.sol";
import "../lib/ICS23.sol";
import "../lib/CometblsZKVerifier.sol";
import "../lib/ICS23Verifier.sol";

struct SignedHeader {
uint64 height;
Expand Down Expand Up @@ -402,7 +401,7 @@ contract CometblsClient is
}
bytes32 contractAddress = clientStates[clientId].contractAddress;
bytes32 appHash = consensusStates[clientId][height].appHash;
return ICS23MembershipVerifier.verifyMembership(
return ICS23Verifier.verifyMembership(
appHash,
proof,
abi.encodePacked(IBCStoreLib.COMMITMENT_PREFIX),
Expand All @@ -424,7 +423,7 @@ contract CometblsClient is
}
bytes32 contractAddress = clientStates[clientId].contractAddress;
bytes32 appHash = consensusStates[clientId][height].appHash;
return ICS23MembershipVerifier.verifyNonMembership(
return ICS23Verifier.verifyNonMembership(
appHash,
proof,
abi.encodePacked(IBCStoreLib.COMMITMENT_PREFIX),
Expand Down Expand Up @@ -550,7 +549,7 @@ contract CometblsClient is
commitmentHash
];

return Verifier.verifyProof(
return CometblsZKVerifier.verifyProof(
zkp.proof, zkp.proofCommitment, zkp.proofCommitmentPOK, publicInputs
);
}
Expand Down
7 changes: 3 additions & 4 deletions evm/contracts/clients/CosmosInCosmosClient.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import "../core/24-host/IBCStore.sol";
import "../core/24-host/IBCCommitment.sol";
import "../lib/ICS23.sol";
import "../lib/Common.sol";

import "./ICS23MembershipVerifier.sol";
import "../lib/ICS23Verifier.sol";

struct TendermintConsensusState {
uint64 timestamp;
Expand Down Expand Up @@ -216,7 +215,7 @@ contract CosmosInCosmosClient is
revert CosmosInCosmosLib.ErrClientFrozen();
}
bytes32 appHash = consensusStates[clientId][height].appHash;
return ICS23MembershipVerifier.verifyMembership(
return ICS23Verifier.verifyMembership(
appHash,
proof,
abi.encodePacked(IBCStoreLib.COMMITMENT_PREFIX),
Expand All @@ -235,7 +234,7 @@ contract CosmosInCosmosClient is
revert CosmosInCosmosLib.ErrClientFrozen();
}
bytes32 appHash = consensusStates[clientId][height].appHash;
return ICS23MembershipVerifier.verifyNonMembership(
return ICS23Verifier.verifyNonMembership(
appHash,
proof,
abi.encodePacked(IBCStoreLib.COMMITMENT_PREFIX),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.27;
/// @author Remco Bloemen
/// @notice Supports verifying Groth16 proofs. Proofs can be in uncompressed
/// (256 bytes) and compressed (128 bytes) format.
library Verifier {
library CometblsZKVerifier {
// Addresses of precompiles
uint256 constant PRECOMPILE_MODEXP = 0x05;
uint256 constant PRECOMPILE_ADD = 0x06;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.27;
import "../lib/ICS23.sol";
import "../lib/UnionICS23.sol";

library ICS23MembershipVerifier {
library ICS23Verifier {
function verifyMembership(
bytes32 root,
bytes calldata proof,
Expand Down
2 changes: 0 additions & 2 deletions evm/evm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -467,13 +467,11 @@ _: {
# FOUNDRY_PROFILE="test" forge coverage --ir-minimum --report lcov
# lcov --remove ./lcov.info -o ./lcov.info.pruned \
# 'contracts/Multicall.sol' \
# 'contracts/clients/Verifier.sol' \
# 'contracts/apps/ucs/00-pingpong/*' \
# 'contracts/lib/*' \
# 'contracts/core/OwnableIBCHandler.sol' \
# 'contracts/core/24-host/IBCCommitment.sol' \
# 'contracts/core/25-handler/IBCHandler.sol' \
# 'contracts/clients/ICS23MembershipVerifier.sol' \
# 'tests/*'
# genhtml lcov.info.pruned -o $out --branch-coverage
# mv lcov.info.pruned $out/lcov.info
Expand Down
2 changes: 1 addition & 1 deletion evm/tests/src/Verifier.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pragma solidity ^0.8.27;

import "forge-std/Test.sol";

import "../../contracts/clients/Verifier.sol";
import "../../contracts/lib/CometblsZKVerifier.sol";
import {
CometblsClient,
SignedHeader
Expand Down

0 comments on commit 6ad2b0b

Please sign in to comment.