Skip to content

darwinia-network/apk-verifier

Repository files navigation

APK verifier

Solidity verifier implementation for accountable light client. This project is funded by the web3 foundation.

Overview

This repo holds two scheme apk verifier and associated libs:

Documentation

Usage

To install with Foundry:

forge install darwinia-network/apk-verifier

Install

To install dependencies and compile contracts:

git clone --recurse-submodules https://github.com/darwinia-network/apk-verifier.git && cd apk-verifier
make tools
make

See inline code docs in the book

Testing and Testing Guide

  1. Install Rust.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  1. Install Foundry.
curl -L https://foundry.paradigm.xyz | bash
  1. Build Darwinia Node.
git clone https://github.com/darwinia-network/darwinia.git --branch apk-verifier
cargo build --release -p darwinia --features pangolin-native
  1. Run darwinia node.
./target/release/darwinia --chain pangolin-dev --alice --tmp --rpc-external --rpc-cors all --execution=native
  1. Deploy basic/packed contract to local darwinia node.
make deploy-basic
make deploy-packed
  1. Contract deployed at last transaction hash.
  2. Run test script.
make test-basic  ADDR=0x3ed62137c5DB927cb137c26455969116BF0c23Cb
make test-packed ADDR=0xeAB4eEBa1FF8504c124D031F6844AD98d07C318f
  1. Seeing the following results indicates that the test was successful.
0x0000000000000000000000000000000000000000000000000000000000000001

Run Test in Docker

1. Run darwinia dev node

local% docker run -it --name my_container ghcr.io/darwinia-network/apk-verifier:v0.1.1 "./bin/darwinia --chain pangolin-dev --alice --tmp --rpc-external --rpc-cors all --execution=native"

2. Deploy test contracts

Enter the running my_container:

local% docker exec -it my_container bash

In my_container:

root@097f7b4f10da:/usr/src/app# make deploy-basic
root@097f7b4f10da:/usr/src/app# make deploy-packed

3. Run test

In my_container:

root@097f7b4f10da:/usr/src/app# make test-basic  ADDR=0x3ed62137c5DB927cb137c26455969116BF0c23Cb
root@097f7b4f10da:/usr/src/app# make test-packed ADDR=0xeAB4eEBa1FF8504c124D031F6844AD98d07C318f

Seeing the following results indicates that the test was successful:

0x0000000000000000000000000000000000000000000000000000000000000001

License

Apache License v2.0