Skip to content

Commit

Permalink
merge conf
Browse files Browse the repository at this point in the history
  • Loading branch information
eureka-cpu committed Dec 21, 2024
2 parents b535f6f + 6a4cfef commit 089f4a5
Show file tree
Hide file tree
Showing 22 changed files with 488 additions and 313 deletions.
2 changes: 1 addition & 1 deletion .github/docker/Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ RUN /go/bin/yamlfmt -lint .github/workflows/*.yaml .github/workflows/*.yml .gith

RUN cargo check
RUN cargo +nightly fmt --all -- --check
RUN cargo test
RUN cargo test
31 changes: 31 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Integration Tests
on:
pull_request:
branches:
- '**'
concurrency:
group: "integration-tests"
cancel-in-progress: true
permissions: read-all
jobs:
integration-tests:
name: Setup Toolchain and Test
runs-on: ubuntu-latest-m
permissions:
id-token: "write"
contents: "read"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Nix With Bonsol Binary Cache
uses: DeterminateSystems/nix-installer-action@main
with:
extra-conf: |
extra-substituters = https://bonsol.cachix.org
extra-trusted-public-keys = bonsol.cachix.org-1:yz7vi1rCPW1BpqoszdJvf08HZxQ/5gPTPxft4NnT74A=
- name: Setup Toolchain, Build and Test
run: |
nix develop --command bash -c "
cargo build &&
cargo test --features integration -- --nocapture
"
3 changes: 2 additions & 1 deletion .github/workflows/update-cachix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#
# substituter: https://bonsol.cachix.org
# public-key: bonsol.cachix.org-1:yz7vi1rCPW1BpqoszdJvf08HZxQ/5gPTPxft4NnT74A=

name: Update Cachix
on:
push:
Expand Down Expand Up @@ -33,5 +32,7 @@ jobs:
with:
name: bonsol
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Run nix flake check
run: nix flake check
- name: Enter development shell
run: nix develop
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Changed
* `bonsol` cli option requirements and error messages updated for added clarity
* **Breaking**: `bonsol deploy` cli subcommand requirements updated. Please refer to the docs, or use `bonsol deploy --help` for more info.

### Added
* `bonsol estimate` for estimating execution cost of bonsol programs.

### Fixed
* **Breaking**: `execute_v1` interface instruction now uses the new `InputRef` to improve CU usage.
Expand Down
47 changes: 46 additions & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion charts/templates/deployment-tester.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ spec:
- -c
- |
solana config set --keypair {{ .Values.signer.path }} -u $RPC_ENDPOINT
bonsol deploy -y -m {{ include "bonsol-tester.manifestPath" . }} -t url --url $SIMPLE_IMAGE
bonsol deploy url -y -m {{ include "bonsol-tester.manifestPath" . }} --url $SIMPLE_IMAGE
while :
do
date '+%Y/%m/%d %H:%M:%S'
Expand Down
14 changes: 12 additions & 2 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ path = "src/main.rs"
[features]
mac = ["risc0-zkvm/metal"]
linux = ["risc0-zkvm/cuda"]
integration = []

[dependencies]
anyhow = "1.0.86"
atty = "0.2.14"
bincode = "1.3.3"
bonsol-interface.workspace = true
bonsol-prover = { path = "../prover" }
bonsol-sdk = { path = "../sdk" }
byte-unit = "4.0.19"
bytemuck = "1.15.0"
bytes = "1.4.0"
cargo_toml = "0.20.3"
clap = { version = "4.4.2", features = ["derive", "env"] }
Expand All @@ -34,7 +37,12 @@ reqwest = { version = "0.11.26", features = [
"native-tls-vendored",
] }
risc0-binfmt = { workspace = true }
risc0-zkvm = { workspace = true, features = ["prove"] }
risc0-circuit-rv32im = { git = "https://github.com/anagrambuild/risc0", branch = "v1.0.1-bonsai-fix" }
risc0-zkvm = { workspace = true, default-features = false, features = [
"prove",
"std",
] }
risc0-zkvm-platform = { git = "https://github.com/anagrambuild/risc0", branch = "v1.0.1-bonsai-fix" }
serde = { version = "1.0.197", features = ["derive"] }
serde_json = "1.0.104"
sha2 = "0.10.6"
Expand All @@ -46,4 +54,6 @@ tera = "1.17.1"
thiserror = "1.0.65"
tokio = { version = "1.38.0", features = ["full"] }

bonsol-interface.workspace = true
[dev-dependencies]
assert_cmd = "2.0.16"
predicates = "3.1.2"
21 changes: 19 additions & 2 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ The output of the build command is a manifest.json file which is placed in the r
You can deploy a bonsol program with the following command

```
bonsol -k ./keypair.json -u http://localhost:8899 deploy -m {path to manifest.json} -y {auto confirm} -t {s3|shadow-drive|url} ... {upload type specific options}
bonsol -k ./keypair.json -u http://localhost:8899 deploy {s3|shadow-drive|url} -m {path to manifest.json} -y {auto confirm} ... {upload type specific options}
```
There will be many options for how to upload the program, the default is s3. Here is an example of how to deploy a program to s3
```
bonsol -k ./keypair.json -u http://localhost:8899 deploy -m program/manifest.json -t s3 --bucket bonsol-public-images --region us-east-1 --access-key {your key} --secret-key {your secret key}
bonsol -k ./keypair.json -u http://localhost:8899 deploy s3 -m program/manifest.json --bucket bonsol-public-images --region us-east-1 --access-key {your key} --secret-key {your secret key}
```
In the above example the manifest.json file is the file that was created by the build command.
This will try to upload the binary to the s3 bucket and create a deployment account for the program. Programs are indexed by the image id, which is a kind of checksum of the program elf file. This means that if you change the elf file, the image id will change and the program will be deployed again under a new deployment account. Programs are immutable and can only be changed by redeploying the program. When a node downloads a program it will check the image id and if it doesnt match the deployment account it will reject the program. Furthermore when bonsol checks the proof, it will check the image id and if it doesnt match the deployment account and desired image id from execution request it will reject the proof.
Expand All @@ -58,3 +58,20 @@ todo

### Prove
todo

### Estimate

You can estimate the number of cycles and segments using risc0 emulation to step through an ELF by passing the `estimate` command the path to a manifest.json and an inputs file (if required).

```
bonsol -k ./keypair.json -u http://localhost:8899 estimate \
--manifest-path program/manifest.json \
--input-file program/inputs.json \
--max-cycles 16777216 # this is the default
# Example Output:
#
# User cycles: 3380
# Total cycles: 65536
# Segments: 1
```
Loading

0 comments on commit 089f4a5

Please sign in to comment.