Skip to content

Add Nightstream zkVM adapter and integration tests - #90

Open
guillevalin wants to merge 38 commits into
feature/midnight-privacyfrom
feature/nightstream-zkvm
Open

Add Nightstream zkVM adapter and integration tests#90
guillevalin wants to merge 38 commits into
feature/midnight-privacyfrom
feature/nightstream-zkvm

Conversation

@guillevalin

@guillevalin guillevalin commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

Description

  • Introduced the sov-nightstream-adapter crate to enable Nightstream as a zkVM backend for the Sovereign SDK.
  • Implemented the Nightstream host and guest environments, including proof generation and verification.
  • Added integration tests to validate the prove-verify cycle for the value-validator ROM.
  • Updated the ValueSetterZk module to support multiple proof backends, including Nightstream.
  • Enhanced documentation and examples for the new adapter and its usage.

Testing

Run on one terminal the rollup script:
./examples/demo-rollup/run_rollup.sh

On other terminal run the TX generator:
./scripts/test_nightstream_e2e_rollup.sh --no-rollup --value 42 --release

Both scripts have a --skip-build arg to just run the binary after it's compiled.

Additional information

- Introduced the `sov-nightstream-adapter` crate to enable Nightstream as a zkVM backend for the Sovereign SDK.
- Implemented the Nightstream host and guest environments, including proof generation and verification.
- Added integration tests to validate the prove-verify cycle for the value-validator ROM.
- Updated the `ValueSetterZk` module to support multiple proof backends, including Nightstream.
- Enhanced documentation and examples for the new adapter and its usage.
@guillevalin
guillevalin marked this pull request as ready for review February 13, 2026 16:46

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b7c704cbb4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/adapters/nightstream/circuits/note_spend/src/main.rs Outdated
Comment thread crates/utils/sov-proof-verifier-service/src/lib.rs Outdated
Comment thread crates/adapters/midnight-da/src/storable/shared_db.rs
guillevalin and others added 24 commits February 13, 2026 14:08
- Deleted the Ligero adapter, including its associated files and configurations.
- Updated `.gitignore` to reflect the removal of Ligero-related files.
- Adjusted `Cargo.toml` and `Cargo.lock` to remove dependencies related to Ligero.
- Cleaned up references to Ligero in the project structure and documentation.
- Updated the default chunk size comment to reflect the new ECALL behavior for Poseidon2.
- Improved logging in the `prove_timings` method to include detailed breakdowns of VM execution timings, specifically trace and witness durations.
- Updated the cache preloading logic to conditionally use a digest if available, improving the verification process.
- Ensured backward compatibility by retaining the original preloading method when no digest is present.
- Updated the rollup configuration to use PostgreSQL instead of SQLite for local development.
- Added new scripts for running various Nightstream services, including the controller, indexer, and verifier service.
- Introduced environment variable management for service configurations, enhancing flexibility and usability.
- Cleaned up the Dockerfile for the sov-proof-verifier-service, removing unnecessary dependencies and comments.
- Updated `.gitignore` to include new temporary data files.
- Improved Makefile to support PostgreSQL database cleanup during the clean process.
- Introduced the Midnight bridge for improved data availability and transaction processing.
- Added new scripts for generating genesis keys and prefunding wallets.
- Updated rollup configuration to support read-only replica mode.
- Enhanced the Nightstream service controller with asset seeding for the Midnight bridge.
- Added new binaries for generating authority FVK and decrypting authority notes.
- Updated dependencies in Cargo.toml and Cargo.lock to include base64, rockbound, and sov-midnight-adapter.
- Created new README documentation for the Nightstream rollup, detailing setup and usage instructions.
…ist proofs

- Added support for viewer attestations in the NoteSpendWitness structure, allowing for enhanced privacy features.
- Implemented blacklist proof generation for sender and recipient identities, improving security against unauthorized access.
- Updated the transfer operation to build and include NoteSpendWitness, facilitating proof generation with viewer data.
- Integrated pool viewer signature injection into proof packages, ensuring compliance with viewer authority requirements.
- Updated dependencies in Cargo.toml and Cargo.lock to include flate2 for compression functionalities.
- Updated Nightstream dependencies in Cargo.toml and Cargo.lock to point to the latest Git revisions.
- Changed the target architecture for RISC-V builds from `riscv32im-unknown-none-elf` to `riscv32i-unknown-none-elf` for improved compatibility.
- Refactored the Nightstream host to utilize the new `Rv32TraceWiring` builder, enhancing performance and trace capabilities.
- Removed references to the old CCS caching mechanism in the Nightstream proof package, streamlining the verification process.
- Updated integration tests to reflect changes in the proving and verification workflow.
- Updated Nightstream dependencies in Cargo.toml and Cargo.lock to the latest Git revisions for improved functionality.
- Introduced a new linker script for the RISC-V architecture, enhancing compatibility and memory management.
- Refactored the NoteSpend circuit to optimize data handling and improve performance metrics.
- Enhanced the run_controller script to manage dashboard processes and streamline service startup.
- Improved PostgreSQL database cleanup procedures in the Makefile for better local development experience.
- Changed the target architecture from `riscv32im-unknown-none-elf` to `riscv32i-unknown-none-elf` in `export_rom_rs.py` and `.cargo/config.toml` for improved compatibility and consistency across build configurations.
# Conflicts:
#	.gitignore
#	crates/mcp-external/src/ligero.rs
#	crates/utils/midnight-e2e-benchmarks/src/continuous_transfers.rs
#	crates/utils/midnight-proof-pool-service/src/main.rs
#	crates/utils/sov-proof-verifier-service/src/lib.rs
#	examples/rollup-ligero/Makefile
#	examples/rollup-ligero/README.md
#	examples/rollup-ligero/run_all.sh
#	examples/rollup-ligero/run_metrics.sh
#	examples/rollup-ligero/run_rollup.sh
#	examples/rollup-ligero/services/README.md
#	examples/rollup-ligero/services/rollup-ligero-continuous-transfers.service
#	examples/rollup-ligero/services/rollup-ligero-mcp.service
#	examples/rollup-ligero/services/rollup-ligero-service-controller.service
#	examples/rollup-ligero/services/services-nginx.conf
#	examples/rollup-nightstream/MAINTENANCE.md
#	examples/rollup-nightstream/generate_operator_wallets.sh
#	examples/rollup-nightstream/prepare_production_genesis.sh
#	examples/rollup-nightstream/rollup_config_replica.toml
#	examples/rollup-nightstream/run_controller.sh
#	examples/rollup-nightstream/services/rollup-ligero-replica-controller.service
- Downgraded `itertools` from version 0.14.0 to 0.13.0 across multiple Cargo.lock files.
- Updated `syn` from version 2.0.116 to 1.0.109 in dependencies.
- Changed references to `neo-ccs`, `neo-math`, and `neo-params` to remove specific revision hashes, simplifying dependency management.
- Enhanced the `NightstreamHost` struct to include an optional `max_steps` field for architectural instruction limits.
- Improved proof verification process by encoding proof bytes directly, avoiding reliance on upstream serde implementations.
- Adjusted integration tests to reflect changes in proof handling and added logging for proof generation and verification times.
- Updated references to Nightstream dependencies in Cargo.toml and Cargo.lock files to use the latest revision hash.
- Modified build scripts for note_deposit and note_spend circuits to reflect changes in architecture from RISC-V to RV64IM.
- Enhanced export scripts to handle ELF byte arrays instead of ROM sections, improving compatibility with the new architecture.
- Updated comments and documentation for clarity on the build process and prerequisites.
…t handling

- Updated references in Cargo.toml and Cargo.lock files to use the new revision hash for Nightstream dependencies.
- Added a .gitignore file for the circuits directory to exclude build artifacts.
- Modified the note_spend ROM to increase its size and updated the corresponding hash.
- Refactored the note_spend circuit implementation for improved clarity and performance.
- Adjusted integration tests to align with the new input/output address mappings for note spend and deposit circuits.
- Introduced new functions for generating public binding digests in the note spend circuit, including `spend_public_bind_init`, `spend_public_bind_nullifier`, `spend_public_bind_output_commitment`, and `spend_public_bind_view_attestation`.
- Updated the `note_spend` function to utilize these new digest functions for improved proof binding.
- Refactored output claims handling in `NightstreamHost` to accommodate the new binding digest mechanism.
- Adjusted integration tests to validate the new functionality and ensure compatibility with the updated circuit logic.
- Replaced the `test_note_spend_prove_verify_with_viewer_witness` function with a new helper function `realistic_viewer_attested_note_spend_case` to improve clarity and reusability.
- Updated the `test_note_spend_replay_viewer_witness_with_output_binding` to utilize the new helper, enhancing the test flow and reducing reliance on external JSON witness files.
- Adjusted assertions and logging for better validation of viewer attestations and simulation results.
…handling

- Updated references in Cargo.toml and Cargo.lock files to use the new revision hash for Nightstream dependencies.
- Refactored the Nightstream proof package to include a verifier context, allowing for direct verification without replaying the trace.
- Introduced new functions for output binding and verifier context management in the NightstreamHost implementation.
- Adjusted integration tests to validate the new proof handling and ensure compatibility with the updated circuit logic.
Signed-off-by: Guillermo Valin <contacto@guillermovalin.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants