Skip to content

Commit

Permalink
fix: fixes to CI + add new CI job for testing program (succinctlabs#15)
Browse files Browse the repository at this point in the history
* remove get_execute_state_proof

* cleanup

* formatting

* formatting

* formatting

* clean

* updates to sync_committee_updates

* formatting

* ci job

* sp1 toolchain

* single operator

* test

* clean
  • Loading branch information
umadayal authored Dec 4, 2024
1 parent fcbc76a commit d7133af
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 3 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/run_program.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Run Program

on:
push:
branches: [main]
pull_request:
branches:
- "**"
merge_group:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
run_program:
name: Test SP1 Helios Program
runs-on: [runs-on, runner=4cpu-linux-arm64 , "run-id=${{ github.run_id }}"]
env:
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Install SP1 toolchain
run: |
curl -L https://sp1.succinct.xyz | bash
~/.sp1/bin/sp1up
~/.sp1/bin/cargo-prove prove --version
source ~/.bashrc
- name: Run test
run: |
cd script
cargo run --bin test
env:
SOURCE_CONSENSUS_RPC_URL: ${{ secrets.SOURCE_CONSENSUS_RPC_URL }}
SOURCE_CHAIN_ID: ${{ secrets.SOURCE_CHAIN_ID }}
CONTRACT_ADDRESS: ${{ secrets.CONTRACT_ADDRESS }}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
DEST_RPC_URL: ${{ secrets.DEST_RPC_URL }}
DEST_CHAIN_ID: ${{ secrets.DEST_CHAIN_ID }}
Binary file modified elf/riscv32im-succinct-zkvm-elf
Binary file not shown.
6 changes: 5 additions & 1 deletion program/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ pub fn main() {

// 1. Apply sync committee updates, if any
for (index, update) in sync_committee_updates.iter().enumerate() {
println!("Processing update {} of {}.", index + 1, sync_committee_updates.len());
println!(
"Processing update {} of {}.",
index + 1,
sync_committee_updates.len()
);
let update_is_valid =
verify_update(update, expected_current_slot, &store, genesis_root, &forks).is_ok();

Expand Down
8 changes: 6 additions & 2 deletions script/bin/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,12 @@ impl SP1LightClientOperator {
// We must still apply the update locally to "sync" the helios client, this is due to
// next_sync_committee not being stored when the helios client is bootstrapped.
if !sync_committee_updates.is_empty() {
let next_sync_committee =
B256::from_slice(sync_committee_updates[0].next_sync_committee.tree_hash_root().as_ref());
let next_sync_committee = B256::from_slice(
sync_committee_updates[0]
.next_sync_committee
.tree_hash_root()
.as_ref(),
);

if contract_next_sync_committee == next_sync_committee {
println!("Applying optimization, skipping update");
Expand Down

0 comments on commit d7133af

Please sign in to comment.