diff --git a/.github/workflows/build_elf.yml b/.github/workflows/build_elf.yml new file mode 100644 index 0000000..7f1c802 --- /dev/null +++ b/.github/workflows/build_elf.yml @@ -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 \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 3ac8819..8eb87c6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1199,18 +1199,18 @@ dependencies = [ [[package]] name = "bit-set" -version = "0.5.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" dependencies = [ "bit-vec", ] [[package]] name = "bit-vec" -version = "0.6.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" [[package]] name = "bitflags" @@ -1410,9 +1410,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.13" +version = "1.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7777341816418c02e033934a09f20dc0ccaf65a5201ef8a450ae0105a573fda" +checksum = "0c3d1b2e905a3a7b00a6141adb0e4c0bb941d11caf55349d863942a1cc44e3c9" dependencies = [ "shlex", ] @@ -2056,9 +2056,9 @@ dependencies = [ [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" @@ -2146,17 +2146,6 @@ dependencies = [ "bytes", ] -[[package]] -name = "fastrlp" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce8dba4714ef14b8274c371879b175aa55b16b30f269663f19d576f380018dc4" -dependencies = [ - "arrayvec", - "auto_impl", - "bytes", -] - [[package]] name = "ff" version = "0.12.1" @@ -2530,8 +2519,8 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "helios-consensus-core" -version = "0.8.0" -source = "git+https://github.com/a16z/helios#d35a0b7e776b6284cf3ec042f96df17ae90f0239" +version = "0.8.1" +source = "git+https://github.com/a16z/helios?tag=0.8.1#ca1fb55cbf01109b7f494963c5e4dd5c1f8db6b7" dependencies = [ "alloy", "alloy-rlp", @@ -3362,7 +3351,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", - "libm", ] [[package]] @@ -4060,9 +4048,9 @@ dependencies = [ [[package]] name = "proptest" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" +checksum = "14cae93065090804185d3b75f0bf93b8eeda30c7a9b4a33d3bdb3988d6229e50" dependencies = [ "bit-set", "bit-vec", @@ -4147,9 +4135,9 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.9" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c40286217b4ba3a71d644d752e6a0b71f13f1b6a2c5311acfcbe0c2418ed904" +checksum = "e46f3055866785f6b92bc6164b76be02ca8f2eb4b002c0354b28cf4c119e5944" dependencies = [ "cfg_aliases", "libc", @@ -4382,15 +4370,14 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.8" +version = "0.17.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +checksum = "e75ec5e92c4d8aede845126adc388046234541629e76029599ed35a003c7ed24" dependencies = [ "cc", "cfg-if", "getrandom 0.2.15", "libc", - "spin", "untrusted", "windows-sys 0.52.0", ] @@ -4418,18 +4405,16 @@ dependencies = [ [[package]] name = "ruint" -version = "1.12.4" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5ef8fb1dd8de3870cb8400d51b4c2023854bbafd5431a3ac7e7317243e22d2f" +checksum = "2c3cc4c2511671f327125da14133d0c5c5d137f006a1017a16f557bc85b16286" dependencies = [ "alloy-rlp", "ark-ff 0.3.0", "ark-ff 0.4.2", "bytes", - "fastrlp 0.3.1", - "fastrlp 0.4.0", + "fastrlp", "num-bigint 0.4.6", - "num-integer", "num-traits", "parity-scale-codec", "primitive-types", @@ -4876,8 +4861,7 @@ dependencies = [ [[package]] name = "sha3" version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +source = "git+https://github.com/sp1-patches/RustCrypto-hashes?tag=patch-sha3-0.10.8-sp1-4.0.0#8f6d303c0861ba7e5adcc36207c0f41fe5edaabc" dependencies = [ "digest 0.10.7", "keccak", @@ -4944,9 +4928,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.2" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" dependencies = [ "serde", ] @@ -5485,9 +5469,9 @@ dependencies = [ [[package]] name = "ssz_types" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22bc24c8a61256950632fb6b68ea09f6b5c988070924c6292eb5933635202e00" +checksum = "dad0fa7e9a85c06d0a6ba5100d733fff72e231eb6db2d86078225cf716fd2d95" dependencies = [ "ethereum_serde_utils", "ethereum_ssz", diff --git a/Cargo.toml b/Cargo.toml index 9e8049d..7193466 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" } \ No newline at end of file diff --git a/README.md b/README.md index 7c168d3..865a776 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/elf/sp1-helios-elf b/elf/sp1-helios-elf index 2c2562c..2731c62 100755 Binary files a/elf/sp1-helios-elf and b/elf/sp1-helios-elf differ diff --git a/program/Cargo.toml b/program/Cargo.toml index 2df5183..6eefcc7 100644 --- a/program/Cargo.toml +++ b/program/Cargo.toml @@ -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 } diff --git a/program/src/main.rs b/program/src/main.rs index 366c241..a3a2026 100644 --- a/program/src/main.rs +++ b/program/src/main.rs @@ -56,7 +56,7 @@ pub fn main() { genesis_root, &forks, ) - .is_ok(); + .is_ok(); if !finality_update_is_valid { panic!("Finality update is invalid!"); } diff --git a/scripts/build.rs b/scripts/build.rs index 6edfae0..5ae265e 100644 --- a/scripts/build.rs +++ b/scripts/build.rs @@ -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() - }); -} \ No newline at end of file + // build_program_with_args( + // "../program", + // BuildArgs { + // docker: true, + // elf_name: Some("sp1-helios-elf".to_string()), + // output_directory: Some("../elf".to_string()), + // ..Default::default() + // }, + // ); +} diff --git a/scripts/rust-toolchain b/scripts/rust-toolchain index d9143e6..a531db0 100644 --- a/scripts/rust-toolchain +++ b/scripts/rust-toolchain @@ -1,3 +1,3 @@ [toolchain] -channel = "1.81.0" +channel = "1.82.0" components = ["llvm-tools", "rustc-dev"] \ No newline at end of file