Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: example ISM #1

Merged
merged 3 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 6 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,16 @@ jobs:
with:
version: nightly

- name: Setup pnpm
uses: pnpm/action-setup@v3.0.0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
version: 9
run_install: false
node-version: 18

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Yarn
run: npm install -g yarn

- name: Install dependencies
run: pnpm i --frozen-lockfile
run: yarn install

- name: Run Forge build
run: |
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
Expand Down
3 changes: 1 addition & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ cache_forge
*.log
.DS_Store
.pnp.*
lcov.info
pnpm-lock.yaml
lcov.info
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"name": "@ethsign/",
"name": "@hyperlane-xyz/community",
"version": "1.0.0",
"description": "",
"repository": {
"type": "git",
"url": "git+https://github.com/EthSign"
},
"description": "A repository for community-contributions to Hyperlane protocol.",
"repository": "https://github.com/hyperlane-xyz/community-isms",
"license": "Apache-2.0",
"keywords": [
"Hyperlane",
"Solidity"
],
"scripts": {
"prepare": "husky",
"clean": "forge clean && hardhat clean && rm -rf cache_hardhat",
Expand All @@ -18,9 +20,8 @@
"test:coverage": "forge coverage",
"test:gas": "forge test --gas-report"
},
"author": "",
"license": "ISC",
"dependencies": {
"@hyperlane-xyz/core": "^5.8.0",
"@openzeppelin/contracts": "5.0.2",
"@openzeppelin/contracts-upgradeable": "5.0.2"
},
Expand Down
6,917 changes: 0 additions & 6,917 deletions pnpm-lock.yaml

This file was deleted.

1 change: 1 addition & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/
@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/
@hyperlane-xyz/=node_modules/@hyperlane-xyz/core/
ds-test/=node_modules/ds-test/src
forge-std/=node_modules/forge-std/src
9 changes: 0 additions & 9 deletions scripts/01-deploy-upgradeable.ts

This file was deleted.

14 changes: 0 additions & 14 deletions src/Counter.sol

This file was deleted.

17 changes: 17 additions & 0 deletions src/ExampleIsm.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.8.0;

import { IInterchainSecurityModule } from "@hyperlane-xyz/contracts/interfaces/IInterchainSecurityModule.sol";

contract ExampleIsm is IInterchainSecurityModule {
// @inheritdoc IInterchainSecurityModule
// @dev CCIP_READ is the type for CCIP read messages
uint8 public moduleType = uint8(IInterchainSecurityModule.Types.CCIP_READ);

// @inheritdoc IInterchainSecurityModule
function verify(bytes calldata, bytes calldata) public view returns (bool) {
// TODO: Implement the verification logic for incoming messages and return true if the message is valid
// check AbstractMultisigIsm.sol for a reference implementation
return true;
}
}
24 changes: 0 additions & 24 deletions test/Counter.t.sol

This file was deleted.

24 changes: 24 additions & 0 deletions test/ExampleIsm.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: MIT or Apache-2.0
pragma solidity ^0.8.13;

import { Test } from "forge-std/Test.sol";
import { IInterchainSecurityModule } from "@hyperlane-xyz/contracts/interfaces/IInterchainSecurityModule.sol";

import { ExampleIsm } from "../src/ExampleIsm.sol";

contract ExampleIsmTest is Test {
ExampleIsm public exampleIsm;

function setUp() public {
exampleIsm = new ExampleIsm();
}

function test_moduleType() public view {
assertEq(exampleIsm.moduleType(), uint8(IInterchainSecurityModule.Types.CCIP_READ));
}

// TODO: Implement the test for the verify function
function test_verify() public view {
assertTrue(exampleIsm.verify(abi.encode(""), abi.encode("")));
}
}
Loading