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

Operator: Bump SP1 and Risc0 version + Retro-Compatible Operator #1208

Closed
wants to merge 37 commits into from

Conversation

PatStiles
Copy link
Contributor

@PatStiles PatStiles commented Oct 9, 2024

closes #1205

This PR:

  • Bumps the risc0 and sp1 verifier versions of operators.
  • Provides retro-compatibility for each version. If proof verification for SP1 and Risc0 between the current and old ('_old') verifier versions fails within the operator it will try verifying using the older version of SP1/Risc0 before returning false.
  • Changes the prompt library in the quiz example from dialoguer -> inquire to accomodate a dependency conflict.

To Test:

Verify network bindings works on a local network:

  • make test_risc_zero_go_bindings_macos
  • make test_sp1_go_bindings_macos
  • run local testnet and confirm you can submit sp1 and risc0 proofs. via
    make batcher_send_risc0_task
    make batcher_send_sp1_task
  • confirm examples work:
    cd examples/zkquiz/quiz/script && cargo run -r
    cd examples/validating-public-input/risc_zero/fibonacci_proof_generator && cargo run -r

Verify Retro Compatiblility of Operator Verifiers:

To verify operator retro-compatibility we deploy the rest of infrastructure of Aligned and boot the retro-compatible operator. This tests that network retro-compatible operator can verify SP1/Risc0 proofs from both verifier versions.

Note:
Commands suffixed with _old indicate the deprecated version of the SP1/Risc0 verifier that is currently running on testnet

To test this have two repos of aligned_layer one set to testnet and one to 1205-bump-sp1-and-risc0-version.

In testnet repo:

go clean
go mod tidy
make go_deps
make deps
  • Then you must run anvil, aggregator and batcher:
make anvil_start_with_block_time
make aggregator_start
make batcher_start_local

In 1205-bump-sp1-and-risc0-version repo:

make deps
  • Then you can run operator
make operator_register_and_start
  • Send proof from the older SP1 and Risc0 versions from the testnet repo.
make batcher_send_burst_groth16
make batcher_send_sp1_burst
make batcher_send_risc0_burst

Observe the Risc0 proof verification failed. and SP1 proof verification failed. logs are emitted and the operator successfully verifying the proofs from the old SP1/Risc0 verifiers. If you send a proof from the latest version of SP1/Risc0 you should notice its verification fails in the batcher.

  • Keep the operator running on the 1205-bump-sp1-and-risc0-version repo.
  • In the testnet repo, kill the batcher.
  • Navigate to the 1205-bump-sp1-and-risc0-version and start the batcher within the repo.
  • Send proof from both the SP1 and Risc0 versions from the 1205-bump-sp1-and-risc0-version repo.
make batcher_send_sp1_burst
make batcher_send_risc0_burst

Observe the operator successfully verifying the proofs from the new SP1/Risc0 verifiers. If you send a proof from the older version of SP1/Risc0 you should notice its verification fails in the batcher.

@PatStiles PatStiles self-assigned this Oct 9, 2024
Copy link
Collaborator

@MarcosNicolau MarcosNicolau left a comment

Choose a reason for hiding this comment

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

Tested on my machine.

Copy link
Collaborator

@Oppen Oppen left a comment

Choose a reason for hiding this comment

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

Looks OK, will test later today.

Copy link
Collaborator

@Oppen Oppen left a comment

Choose a reason for hiding this comment

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

Works on my machine.

Copy link
Contributor

@uri-99 uri-99 left a comment

Choose a reason for hiding this comment

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

Operators should have retrocompatibility. So we should have 2 ffis and each operator check with both

@PatStiles PatStiles changed the title chore(dependency): Bump sp1 and risc0 version Operator: Bump sp1 and risc0 version Oct 14, 2024
@PatStiles PatStiles changed the title Operator: Bump sp1 and risc0 version Operator: Bump SP1 and Risc0 version + Retro-Compatible Operator Oct 17, 2024
Copy link
Contributor

@uri-99 uri-99 left a comment

Choose a reason for hiding this comment

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

We don't need to push old proof generators. To test we can checkout previous branch. I would avoid pushing this because this pr is 87 files, and a very big portion of these are the old proof generators

Makefile Outdated Show resolved Hide resolved
Comment on lines -511 to -512
@mv scripts/test_files/sp1/fibonacci_proof_generator/program/elf/riscv32im-succinct-zkvm-elf scripts/test_files/sp1/sp1_fibonacci.elf
@mv scripts/test_files/sp1/fibonacci_proof_generator/script/sp1_fibonacci.proof scripts/test_files/sp1/
Copy link
Contributor

Choose a reason for hiding this comment

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

why?

Makefile Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
operator/risc_zero/lib/librisc_zero_verifier.dylib Outdated Show resolved Hide resolved
scripts/test_files/risc_zero/risc_zero_fibonacci_old.proof Outdated Show resolved Hide resolved
scripts/test_files/risc_zero/risc_zero_fibonacci_old.pub Outdated Show resolved Hide resolved
operator/pkg/operator.go Outdated Show resolved Hide resolved
operator/pkg/operator.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@MarcosNicolau MarcosNicolau left a comment

Choose a reason for hiding this comment

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

Other than the minor comments, I tested on Linux and everything worked as expected!

Screenshot 2024-10-21 at 11 39 47 AM

Makefile Outdated Show resolved Hide resolved
examples/zkquiz/quiz/script/Cargo.toml Show resolved Hide resolved
use risc0_zkvm::{InnerReceipt, Receipt};

#[no_mangle]
pub extern "C" fn verify_risc_zero_receipt_old_ffi(
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should add the try-catch.

Copy link
Collaborator

Choose a reason for hiding this comment

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

See #1174.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If it is too much work now, maybe don't.

}

#[no_mangle]
pub extern "C" fn verify_sp1_proof_old_ffi(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ditto.

Makefile Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you uploaded this by err.

@PatStiles
Copy link
Contributor Author

@MarcosNicolau @uri-99 I am closing this in favor or #1307 due to merge issues

@PatStiles PatStiles closed this Oct 22, 2024
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.

4 participants