Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
manlikeHB committed Sep 13, 2024
2 parents cf8b7c1 + be2ea99 commit baf4dbf
Show file tree
Hide file tree
Showing 69 changed files with 2,609 additions and 834 deletions.
54 changes: 54 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,60 @@
"contributions": [
"code"
]
},
{
"login": "Gerson2102",
"name": "Gerson",
"avatar_url": "https://avatars.githubusercontent.com/u/71728860?v=4",
"profile": "https://github.com/Gerson2102",
"contributions": [
"code"
]
},
{
"login": "PavitraAgarwal21",
"name": "PavitraAgarwal21",
"avatar_url": "https://avatars.githubusercontent.com/u/85789615?v=4",
"profile": "https://github.com/PavitraAgarwal21",
"contributions": [
"code"
]
},
{
"login": "bloomingpeach",
"name": "Nguyen Dao",
"avatar_url": "https://avatars.githubusercontent.com/u/177087057?v=4",
"profile": "https://github.com/bloomingpeach",
"contributions": [
"code"
]
},
{
"login": "od-hunter",
"name": "Hunter001",
"avatar_url": "https://avatars.githubusercontent.com/u/146340502?v=4",
"profile": "https://github.com/od-hunter",
"contributions": [
"code"
]
},
{
"login": "feltroidprime",
"name": "feltroid Prime",
"avatar_url": "https://avatars.githubusercontent.com/u/96737978?v=4",
"profile": "https://github.com/feltroidprime",
"contributions": [
"code"
]
},
{
"login": "mexes20",
"name": "Mexes",
"avatar_url": "https://avatars.githubusercontent.com/u/127276944?v=4",
"profile": "https://github.com/mexes20",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7,
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/python-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Python Lint and Formatting Check

on: [push, pull_request]

jobs:
lint:
name: Lint and Format Check
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 black
- name: Lint with flake8
run: |
flake8 scripts/ --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 scripts/ --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
- name: Check code formatting with black
run: |
black --check scripts/
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ Cargo.lock
.python-version
__pycache__

.raito
.client_cache/
39 changes: 12 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Raito is a zero-knowledge Bitcoin client implemented in Cairo. It aims to provid
```mermaid
flowchart TB
Pnm1(STARK proof of the chain state<br>up to the block <i>n - 1</i>,<br> including utxo accumulator) --> Vp(zk verifier)
Pnm1(STARK proof of the chain state up to the block <i>n - 1</i>, including utxo accumulator) --> Vp(zk verifier)
Bn(blocks <i>n..m</i>) ----> Vb
subgraph Cairo
Expand All @@ -26,7 +26,7 @@ subgraph Cairo
Vb --> ChS
end
Vb --> Pn(STARK proof of the chain state<br>up to the block <i>m</i>,<br> including utxo accumulator)
Vb --> Pn(STARK proof of the chain state up to the block <i>m</i>,<br> including utxo accumulator)
style Bn fill:pink
style Pn fill:lightgreen
Expand All @@ -49,6 +49,10 @@ Although this is a highly experimental project without immediate plans for deplo

## Roadmap

<p align="center" width="100%">
<img src="./docs/img/components.svg" alt="components"/>
</p>

### Milestone 1 - Block header validation

Implement a reduced light client that can verify a range of blocks starting at genesis.
Expand All @@ -70,7 +74,7 @@ Extend light client with partial transaction validation, but without UTXO checks

Tasks:

* [ ] reassess validation check list (analyze Bitcoin core codebase)
* [x] reassess validation check list (analyze Bitcoin core codebase)
* [x] generate & run integration tests e2e instead of Cairo codegen
* [x] transaction ID calculation
* [x] transaction root computation
Expand Down Expand Up @@ -131,40 +135,18 @@ Raito is a reference to Light Yagami (夜神月, Yagami Raito) from the manga/an

## Usage

This will compile all the components:
This will compile all the packages:

```bash
scarb build
```

This will run unit and integration tests:
This will run tests for all the packages:

```bash
scarb test
```

For integration tests ony:

```bash
scarb run integration_tests
```

Run for specific test file(s):

```bash
scarb run integration_tests tests/data/light_481823.json
```

Re-generate integration test data:

```base
scarb run regenerate_tests --force
```

* Without `--force` flag only non-existent files will be created
* Files are located in [tests/data/](https://github.com/keep-starknet-strange/raito/blob/main/tests/data)
* If you want to add a new test case, edit [scripts/data/regenerate_tests.sh](https://github.com/keep-starknet-strange/raito/blob/main/scripts/data/regenerate_tests.sh)

## Build dependencies

Install necessary packages required by Python scripts:
Expand Down Expand Up @@ -213,6 +195,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Gerson2102"><img src="https://avatars.githubusercontent.com/u/71728860?v=4?s=100" width="100px;" alt="Gerson"/><br /><sub><b>Gerson</b></sub></a><br /><a href="https://github.com/keep-starknet-strange/raito/commits?author=Gerson2102" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/PavitraAgarwal21"><img src="https://avatars.githubusercontent.com/u/85789615?v=4?s=100" width="100px;" alt="PavitraAgarwal21"/><br /><sub><b>PavitraAgarwal21</b></sub></a><br /><a href="https://github.com/keep-starknet-strange/raito/commits?author=PavitraAgarwal21" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/bloomingpeach"><img src="https://avatars.githubusercontent.com/u/177087057?v=4?s=100" width="100px;" alt="bloomingpeach"/><br /><sub><b>Nguyen Dao</b></sub></a><br /><a href="https://github.com/keep-starknet-strange/raito/commits?author=bloomingpeach" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/od-hunter"><img src="https://avatars.githubusercontent.com/u/146340502?v=4?s=100" width="100px;" alt="od-hunter"/><br /><sub><b>Hunter001</b></sub></a><br /><a href="https://github.com/keep-starknet-strange/raito/commits?author=od-hunter" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/feltroidprime"><img src="https://avatars.githubusercontent.com/u/96737978?v=4?s=100" width="100px;" alt="feltroidprime"/><br /><sub><b>feltroid Prime</b></sub></a><br /><a href="https://github.com/keep-starknet-strange/raito/commits?author=feltroidprime" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mexes20"><img src="https://avatars.githubusercontent.com/u/127276944?v=4?s=100" width="100px;" alt="mexes20"/><br /><sub><b>Mexes</b></sub></a><br /><a href="https://github.com/keep-starknet-strange/raito/commits?author=mexes20" title="Code">💻</a></td>
</tr>
</tbody>
</table>
Expand Down
16 changes: 15 additions & 1 deletion Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,19 @@
version = 1

[[package]]
name = "raito"
name = "client"
version = "0.1.0"
dependencies = [
"consensus",
]

[[package]]
name = "consensus"
version = "0.1.0"
dependencies = [
"utils",
]

[[package]]
name = "utils"
version = "0.1.0"
22 changes: 10 additions & 12 deletions Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
[package]
name = "raito"
version = "0.1.0"
edition = "2024_07"

[scripts]
regenerate_tests= "./scripts/data/regenerate_tests.sh"
integration_tests = "scarb build && ./scripts/data/integration_tests.sh"
client= "scarb build && ./scripts/data/client.sh"
test = "scarb cairo-test && scarb run integration_tests"
[workspace]
members = ["packages/*"]

[dependencies]
[workspace.package]
description = "Bitcoin ZK client."
cairo-version = "2.8.2"
version = "0.1.0"
readme = "README.md"
repository = "https://github.com/keep-starknet-strange/raito"
license-file = "LICENSE"

[dev-dependencies]
[workspace.dependencies]
cairo_test = "2.8.0"
Loading

0 comments on commit baf4dbf

Please sign in to comment.