Skip to content

Commit

Permalink
feat: improved resource handling
Browse files Browse the repository at this point in the history
This commit reworks the way resources such a the stone-prover binary,
are handled by the stone-cli.

The new system ensures that:

- The stone-cli works even if build on a different machine and moved.
- Does not modify the users home directory
- Allows uninstalling by using `cargo uninstall`
  (simply deleting the stone-cli binary will do).

Overall, the approach taken:

- Retrieve all the resources for the build
- Create the desired directory structure in build.rs
- Create a tarball with the directory structure
- Embed the tarball inside the stone-cli binary
- Upon execution of the stone-cli binary extract the tarball
  to a "temporary" directory, ensuring however that this is only done on
  the first execution, as oppose to creating a fresh "TempDir" every time.
  • Loading branch information
rot256 committed Jan 28, 2025
1 parent 92d2dda commit 7d56e00
Show file tree
Hide file tree
Showing 10 changed files with 461 additions and 268 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
/bin
annotations.txt
extra_output_file.txt
proof.json
proof.json
resources.rs
18 changes: 3 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,24 @@ swiftness_proof_parser = { git = "https://github.com/zksecurity/integrity-callda
swiftness_stark = { git = "https://github.com/zksecurity/integrity-calldata-generator", rev = "6f2dd268274e40e5ea75e2f17aff6b8e53f8f499" }
swiftness = { git = "https://github.com/zksecurity/integrity-calldata-generator", rev = "6f2dd268274e40e5ea75e2f17aff6b8e53f8f499" }
starknet-crypto = "0.7.2"
tempfile = "3.10.1"
tempfile = "3.10.1"
thiserror = "1.0.61"
uuid = "1.9.1"
tar = "0.4.41"
flate2 = "1.0.30"
fs2 = "0.4.3"

[build-dependencies]
tar = "0.4.41"
flate2 = "1.0.30"
once_cell = "1.18"
reqwest = { version = "0.12.5", features = ["blocking"] }
serde = { version = "1.0", features = ["derive"], default-features = false }
serde_json = "1"
sha256 = "1.5.0"
tar = "0.4.41"
sha2 = "0.10.8"
tempfile = "3.10.1"
thiserror = "1.0.61"
anyhow = "1.0.86"

[dev-dependencies]
assert_cmd = "2.0.14"
Expand Down
Loading

0 comments on commit 7d56e00

Please sign in to comment.