-
Notifications
You must be signed in to change notification settings - Fork 365
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
feat(operator): Update SP1 and Risc0 Versions #1319
Conversation
@@ -17,7 +17,7 @@ ifeq ($(OS),Darwin) | |||
endif | |||
|
|||
ifeq ($(OS),Linux) | |||
LD_LIBRARY_PATH += $(CURDIR)/operator/risc_zero/lib | |||
LD_LIBRARY_PATH+=$(CURDIR)/operator/risc_zero_old/lib:$(CURDIR)/operator/risc_zero/lib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that I pay more attention to this, the correct pattern isn't this here, it's:
LD_LIBRARY_PATH+=$(CURDIR)/operator/risc_zero_old/lib:$(CURDIR)/operator/risc_zero/lib | |
LD_LIBRARY_PATH=$(CURDIR)/operator/risc_zero_old/lib:$(CURDIR)/operator/risc_zero/lib:$(LD_LIBRARY_PATH) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is, you do not append a string (it will be separated by a space, while lookup paths are separated by colon), but instead prepend and separate with :
from the originals.
#[no_mangle] | ||
pub extern "C" fn verify_risc_zero_receipt_old_ffi( | ||
inner_receipt_bytes: *const u8, | ||
inner_receipt_len: u32, | ||
image_id: *const u8, | ||
image_id_len: u32, | ||
public_input: *const u8, | ||
public_input_len: u32, | ||
) -> bool { | ||
if inner_receipt_bytes.is_null() || image_id.is_null() { | ||
error!("Input buffer null"); | ||
return false; | ||
} | ||
|
||
if inner_receipt_len == 0 || image_id_len == 0 { | ||
error!("Input buffer length zero size"); | ||
return false; | ||
} | ||
|
||
//NOTE: We allow the public input for risc0 to be empty. | ||
let mut public_input_slice: &[u8] = &[]; | ||
if !public_input.is_null() && public_input_len > 0 { | ||
public_input_slice = | ||
unsafe { std::slice::from_raw_parts(public_input, public_input_len as usize) }; | ||
} | ||
|
||
let inner_receipt_bytes = | ||
unsafe { std::slice::from_raw_parts(inner_receipt_bytes, inner_receipt_len as usize) }; | ||
|
||
let image_id = unsafe { std::slice::from_raw_parts(image_id, image_id_len as usize) }; | ||
|
||
let mut image_id_array = [0u8; 32]; | ||
image_id_array.copy_from_slice(image_id); | ||
|
||
if let Ok(inner_receipt) = bincode::deserialize::<InnerReceipt>(inner_receipt_bytes) { | ||
let receipt = Receipt::new(inner_receipt, public_input_slice.to_vec()); | ||
|
||
return receipt.verify(image_id_array).is_ok(); | ||
} | ||
false | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would need to follow the try_catch behavior of the other lib.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Risc0 and SP1 are being rejected by the batcher when doing batcher_send_risc0
, this is because the test files have been updated to the newer versions and the batcher only accepts old versions of the proofs. Anyway, I modified it so that they point to the old files and both sp1
and risc0
are working well on the operator.
Update SP1 and Risc0 verifier versions
closes #1205
This PR:
risc0
andsp1
verifier versions of operators.dialoguer
->inquire
to accomadate 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
make batcher_send_risc0_task
make batcher_send_sp1_task
cd examples/zkquiz && make answer_quix
cd examples/validating-public-input && make generate_risc_zero_fibonacci_proof
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 ontestnet
To test this have two repos of aligned_layer one set to
testnet
and one to1205-bump-sp1-and-risc0-version
.In
testnet
repo:In
1205-operator-sp1-risc0-update
repo:testnet
repo.Observe the
Risc0 proof verification failed.
andSP1 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.1205-operator-sp1-risc0-update
repo.testnet
repo, kill the batcher.1205-bump-sp1-and-risc0-version
and start the batcher within the repo.1205-operator-sp1-risc0-update
repo.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.
Type of change
Please delete options that are not relevant.
Checklist