Repository navigation
feat(runtime)!: import the Groth16 host function so proofs verify natively; nodes older than 0.4.0 cannot import spec 19 (zk-verifier 3.3.0, pallet-zk-verifier 0.18.0) - #168
Merged
Conversation
…ively; nodes older than 0.4.0 cannot import spec 19 (zk-verifier 3.3.0, pallet-zk-verifier 0.18.0)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Spec 19 imports
bn254_groth16_verify: Groth16 proof verification runs natively in the node instead of in Wasm (verify_proof2.43 → 0.61 ms). The host function has been registered (register_only) since node 0.4.0, which is live with spec 18.Versions
orbinum-zk-verifierpallet-zk-verifierorbinum-runtime/orbinum-nodeChanges
orbinum-zk-verifier#[version(1, register_only)]→#[version(1)]. Symbol and behaviour unchangedpallet-zk-verifiergroth16-native:do_verifycalls the host function; without it,verify_preparedin Wasm as beforeorbinum-runtimegroth16-native-runtime(indefault);build.rsenables it for the Wasm, except try-runtime buildsthe_runtime_does_not_import_the_groth16_host_function_yet→the_runtime_imports_the_groth16_host_functiontest.ymlno_std matrix also checksorbinum-zk-verifierwith and withoutgroth16-nativeRUNTIME_VERSIONS.mdspec 19 § 4 "Groth16 host function"Both paths run the same function (
verify_prepared), so verification results and consensus do not change. Weights are unchanged: they were measured in Wasm, so they overcharge; re-benchmarking can lower fees later.A node without the host function cannot instantiate this runtime and stops importing at the upgrade block. Before
setCode:0x747bd58e…4205, does not and must upgrade).setMinAuthorVersioncannot be used as a guard on spec 18: the author-identification bug fixed in spec 19 leaves its quorum unreachable. Set the minimum after the upgrade.Test plan
cargo test -p orbinum-zk-verifier --libcargo test -p pallet-zk-verifier --features groth16-nativecargo check -p pallet-zk-verifier --features groth16-native,runtime-benchmarks,skip-proof-verificationcargo test --release -p orbinum-runtime --lib(Wasm built; import test runs)cargo test -p orbinum-node service(node registers the function)cargo check -p orbinum-zk-verifier --no-default-features [--features groth16-native]