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: implement verifyMembership #38

Merged
merged 2 commits into from
Dec 19, 2023
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
43 changes: 40 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,55 @@ on:
jobs:
test:
runs-on: ubuntu-latest
env:
SRC_DIR: ${{ github.workspace }}
# https://github.com/axonweb3/axon/commits/forcerelay-dev
AXON_COMMIT: 343f329b78b8187e28fdac9e9af6c28222656b92
AXON_HTTP_RPC_URL: "http://127.0.0.1:8000"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
cache-dependency-path: 'yarn.lock'

- name: Prepare Axon source
run: git clone --recursive https://github.com/axonweb3/axon.git $SRC_DIR/axon && cd $SRC_DIR/axon && git checkout $AXON_COMMIT

- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: "."

- name: Cache axon bin
id: cache-axon-bin
uses: actions/cache@v3
env:
cache-name: cache-axon-bin
with:
path: ${{env.SRC_DIR}}/axon/target/release/axon
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.AXON_COMMIT }}

- name: Build Axon
if: ${{ steps.cache-axon-bin.outputs.cache-hit != 'true' }}
uses: actions-rs/cargo@v1
with:
command: build
args: --release --manifest-path ${{env.SRC_DIR}}/axon/Cargo.toml

- name: Add axon bin to path
run: echo "${{env.SRC_DIR}}/axon/target/release/" >> $GITHUB_PATH

- name: Config axon
run: axon init --config ${{env.SRC_DIR}}/axon/devtools/chain/config.toml --chain-spec ${{env.SRC_DIR}}/axon/devtools/chain/specs/single_node/chain-spec.toml

- name: Start axon
run: axon run --config ${{env.SRC_DIR}}/axon/devtools/chain/config.toml &

- run: yarn install
- run: npx truffle version

- name: Run Ethereum locally for test
run: npx ganache > ganache.log &
- run: yarn compile
- name: Run test
run: npx truffle test
run: npx truffle test --network axon_forcerelay
12 changes: 7 additions & 5 deletions contracts/clients/CkbClient.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ pragma solidity ^0.8.9;
import "../core/02-client/ILightClient.sol";
import "../core/02-client/IBCHeight.sol";
import "../proto/Client.sol";
import "./CkbProof.sol";

// MokkClient implements https://github.com/datachainlab/ibc-mock-client
// WARNING: This client is intended to be used for testing purpose. Therefore, it is not generally available in a production, except in a fully trusted environment.
contract CkbClient is ILightClient {
using CkbProof for *;
uint64 private constant MAX_UINT64 = 18446744073709551615;
constructor() {}

Expand Down Expand Up @@ -66,12 +68,12 @@ contract CkbClient is ILightClient {
Height.Data calldata,
uint64,
uint64,
bytes calldata,
bytes memory,
bytes calldata proof,
bytes memory,
bytes calldata
) external pure override returns (bool) {
return true;
bytes memory path,
bytes calldata value
) external override returns (bool) {
return CkbProof.verifyProof(proof, path, value);
}

/**
Expand Down
Loading
Loading