-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
55 changed files
with
80 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,4 @@ Cargo.lock | |
.python-version | ||
__pycache__ | ||
|
||
.raito/ | ||
.client_cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Bitcoin client in Cairo | ||
|
||
This package is a standalone Cairo program (outside of Starknet context) that implements a Bitcoin client which can work in two modes: | ||
- Light mode: block header validation only | ||
- Full mode: full Bitcoin consensus validation | ||
|
||
## Usage | ||
|
||
```sh | ||
# You have to be in the "packages/client" directory | ||
scarb run client START_HEIGHT END_HEIGHT BATCH_SIZE MODE STRATEGY | ||
``` | ||
|
||
Client expects the following arguments: | ||
* `START_HEIGHT` height of the initial chain state | ||
* `END_HEIGHT` height of the final (resulting) chain state | ||
* `BATCH_SIZE` number of blocks applied per single program run | ||
* `MODE` either `light` or `full` (default is light) | ||
* `STRATEGY` either `sequential` or `random` (default is sequential) | ||
|
||
## Integration tests | ||
|
||
In order to run integration tests: | ||
|
||
```sh | ||
scarb test | ||
``` | ||
|
||
Run a specific test file (or several files): | ||
|
||
```sh | ||
# You have to be in the "packages/client" directory | ||
scarb test tests/data/light_481823.json | ||
``` | ||
|
||
Re-generate integration test data: | ||
|
||
```sh | ||
# You have to be in the "packages/client" directory | ||
scarb run regenerate_tests --force | ||
``` | ||
|
||
If you want to just add a new test case, edit `scripts/data/regenerate_tests.sh` and run without `--force` flag. | ||
|
||
You can also add/remove ignored scenarios, check out `scripts/data/regenerate_tests.sh` as well. |
4 changes: 2 additions & 2 deletions
4
crates/integration_tests/Scarb.toml → packages/client/Scarb.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
mod main; | ||
// TODO: scarb cairo-run should support "features" argument | ||
// so that we can conditionally compile this module | ||
mod test; |
4 changes: 2 additions & 2 deletions
4
crates/shinigami_consensus/src/main.cairo → packages/client/src/main.cairo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Bitcoin consensus in Cairo | ||
|
||
This package is a Cairo library providing primitives for validating Bitcoin consensus. | ||
|
||
It is structured as follows: | ||
* `types` module contains all Bitcoin specific entities (start your codebase tour with this folder) adapted for recursive verification; | ||
* `validation` module contains most of the consensus validation logic; | ||
* `codec` module contains implementation of Bitcoin binary codec for transaction types. |
2 changes: 1 addition & 1 deletion
2
crates/shinigami_consensus/Scarb.toml → packages/consensus/Scarb.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[package] | ||
name = "shinigami_consensus" | ||
name = "consensus" | ||
version = "0.1.0" | ||
edition = "2024_07" | ||
|
||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,5 +15,3 @@ pub mod types { | |
pub mod transaction; | ||
pub mod utxo_set; | ||
} | ||
|
||
mod main; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Common utilities | ||
|
||
This package contains common helpers that are not Bitcoin-specific. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters