Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add elf build workflow. #1

Merged
merged 3 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/build_elf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: elf

on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:

jobs:
elf:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Install SP1 toolchain
run: |
curl -L https://sp1.succinct.xyz | bash
~/.sp1/bin/sp1up
~/.sp1/bin/cargo-prove prove --version
source ~/.bashrc
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Verify the SP1 Helios Binary
run: |
# Build the binaries
cd program
~/.sp1/bin/cargo-prove prove build --elf-name sp1-helios-elf --docker --output-directory ../elf
cd ../

# Check for any changes in the elf directory
if [ -n "$(git status --porcelain elf/)" ]; then
echo "❌ ELF files changed during build!"
git diff elf/
exit 1
else
echo "✅ ELF files remained unchanged"
fi
64 changes: 24 additions & 40 deletions Cargo.lock

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

22 changes: 10 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,24 @@ authors = ["0xSasaPrsic"]
[workspace.dependencies]
sp1-helios-primitives = { path = "primitives" }

helios-consensus-core = { git = "https://github.com/a16z/helios", tag = "0.8.1" }

# TODO use the latest release of the helios
helios = { git = "https://github.com/a16z/helios", version = "0.8.0" }
helios-consensus-core = { git = "https://github.com/a16z/helios", version = "0.8.0" }

sp1-sdk = "4.0.0"
sp1-build = "4.0.0"
serde = { version = "1.0.203", features = ["derive"] }
sp1-sdk = "4.0.1"
sp1-build = "4.0.1"
serde = { version = "1.0.203" }
serde_cbor = "0.11.2"

alloy-sol-types = "0.8.21"
alloy-primitives = { version = "0.8.21", features = ["serde"] }
alloy = { version = "0.1.1", features = ["full"] }
alloy-sol-types = "0.8.15"
alloy-primitives = "0.8.15"
alloy = { version = "0.9.1", features = ["full"] }
anyhow = "1.0.86"
tree_hash = "0.9.1"
tree_hash = "0.9.0"

[patch.crates-io]
sha2-v0-9-9 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha2", tag = "patch-sha2-0.9.9-sp1-4.0.0" }
sha2-v0-10-8 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha2", tag = "patch-sha2-0.10.8-sp1-4.0.0" }
sha3-v0-10-8 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha3", tag = "patch-sha3-0.10.8-sp1-4.0.0" }
tiny-keccak = { git = "https://github.com/sp1-patches/tiny-keccak", tag = "patch-2.0.2-sp1-4.0.0" }
bls12_381 = { git = "https://github.com/sp1-patches/bls12_381", tag = "patch-0.8.0-sp1-4.0.0" }
# From upstream: https://github.com/a16z/helios/blob/master/Cargo.toml#L115
ethereum_hashing = { git = "https://github.com/ncitron/ethereum_hashing", rev = "7ee70944ed4fabe301551da8c447e4f4ae5e6c35" }
ethereum_hashing = { git = "https://github.com/ncitron/ethereum_hashing", rev = "7ee70944ed4fabe301551da8c447e4f4ae5e6c35" }
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Helios SP1 program


## Build the program from the program dir run:
```bash
cargo prove build --docker --tag v4.0.0 --elf-name sp1-helios-elf --output-directory ../elf
cd program && cargo prove build --elf-name sp1-helios-elf --docker --output-directory ../elf
```

## To get the verification key run:
Expand Down
Binary file modified elf/sp1-helios-elf
Binary file not shown.
4 changes: 2 additions & 2 deletions program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ license.workspace = true
authors.workspace = true

[dependencies]
sp1-zkvm = "4.0.0"
sp1-zkvm = "4.1.0"
helios-consensus-core = { workspace = true }
serde_cbor = { workspace = true }
sp1-helios-primitives = { workspace = true }
alloy-sol-types = { workspace = true }
alloy-primitives = { workspace = true }
alloy-primitives = { workspace = true, features = ["sha3-keccak"] }
tree_hash = { workspace = true }
2 changes: 1 addition & 1 deletion program/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn main() {
genesis_root,
&forks,
)
.is_ok();
.is_ok();
if !finality_update_is_valid {
panic!("Finality update is invalid!");
}
Expand Down
17 changes: 10 additions & 7 deletions scripts/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
use sp1_build::{build_program_with_args, BuildArgs};

fn main() {
build_program_with_args("../program", BuildArgs {
tag: "v4.0.0".to_string(),
docker: true,
elf_name: Some("sp1-helios-program".to_string()),
..Default::default()
});
}
// build_program_with_args(
// "../program",
// BuildArgs {
// docker: true,
// elf_name: Some("sp1-helios-elf".to_string()),
// output_directory: Some("../elf".to_string()),
// ..Default::default()
// },
// );
}
2 changes: 1 addition & 1 deletion scripts/rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.81.0"
channel = "1.82.0"
components = ["llvm-tools", "rustc-dev"]