Make arm package dependency-minimum (issue #204)#206
Conversation
29609c3 to
dfb0174
Compare
- risc0-zkvm, k256, lazy_static become optional dependencies - New `zkvm` and `k256` feature flags control their inclusion - Standalone Digest type (wire-compatible with risc0) for non-zkvm builds - Feature-conditional DeltaProof/DeltaWitness via delta_types module - Feature-gate all modules in lib.rs appropriately
- Replace hex::FromHex + lazy_static with hex_literal byte constants - Gate lazy_static Digests and ELF includes on zkvm/aggregation - Gate hash_two/hash_bytes on zkvm - Replace PADDING_LEAF lazy_static with padding_leaf() function - Gate MerklePath::root() on zkvm - Gate NullifierKey::commit/random_pair on zkvm - Remove InvalidComplianceInstance error (instance now structured)
- ComplianceUnit.instance is now structured ComplianceInstance (was Vec<u8>) - Remove get_instance() deserialization (instance accessed directly) - Add to_journal() for serialization when needed (zkvm-gated) - Gate ComplianceWitness on zkvm+k256 - Replace INITIAL_ROOT lazy_static with initial_root() function - Gate verify/delta/get_inner_receipt appropriately
…urnal - Move LogicVerifierInputs from logic_proof.rs to logic_instance.rs - Add to_journal() on LogicInstance gated on zkvm - Add get_inner_receipt() on LogicVerifierInputs gated on zkvm - Use instance.to_journal() in to_logic_verifier() instead of risc0_zkvm::serde::to_vec - Import LogicVerifierInputs from logic_instance in logic_proof.rs
- Ungated: get_compliance_units, get_logic_verifier_inputs, get_delta_msg - get_delta_msg now infallible (reads structured instance directly) - zkvm: new, get_logic_verifiers, verify - k256: delta - Import LogicVerifierInputs from logic_instance instead of logic_proof
- Split into ungated/k256/zkvm/aggregation impl blocks - get_delta_msg now infallible (structured instance access) - nf_duplication_check reads cu.instance directly (no deserialization) - get_compliance_instances returns Result (calls to_journal) - Use delta_types for feature-conditional DeltaProof/DeltaWitness - Adapt inline batch aggregation for structured ComplianceInstance - verify() gated on k256+zkvm
…EAF lazy_static Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cee0817 to
f6ffde4
Compare
…fix clippy and fmt - Re-export LogicVerifierInputs from logic_proof to maintain public API - Update arm_test_app to use initial_root() instead of removed INITIAL_ROOT - Fix clippy::manual_is_multiple_of in action_tree.rs - Fix formatting in action_tree.rs and transaction.rs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
XuyangSong
left a comment
There was a problem hiding this comment.
Thanks for your work!
The circuits don’t compile, run cd arm_circuits && cargo build.
As I understand it, Solana only needs the Transaction struct (including nested structs like Action, Compliance, etc.) and cannot depend on risc0-zkvm. A simpler approach is to reimplement Transaction and its verify method in a standalone on-chain package—eliminating dependencies on risc0-zkvm and k256. On the client side, you’ll need a lightweight binding library to convert the ARM-RISC0 Transaction into a Solana-compatible one before submission, similar to how we handle EVM-PA.
The long-term ideal is to split arm-risc0 into focused sub-crates. Relying on feature flags will make maintenance harder, since the same arm-risc0 crate is used across circuits, clients, and multiple chains/servers and so many structs and methods are feature-gated.
we can discuss it at some point @AHartNtkn @agureev
… ARM items After tightening cfg gates, resource, resource_logic, ComplianceWitness, and hash_bytes all require both zkvm and k256. Add explicit feature declarations to every crate that directly uses these gated items. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ece8158 to
90a4fa8
Compare
Why
Solana-facing code needs ARM data types without pulling in
risc0-zkvmand full proving dependencies.This PR addresses #204 by making
armusable as a lightweight/types-first dependency while preserving full functionality under feature flags.This is a precursor for PR #207.
What This PR Changes
arm:risc0-zkvm(viazkvm)k256(viak256)lazy_static(viazkvm)Digestimplementation used whenzkvmis disabled.hex_literal) and helper constructors (e.g.initial_root(),padding_leaf()).ComplianceUnit.instancefrom serialized bytes to structuredComplianceInstance.ungated/zkvm/k256/zkvm+k256) sozkvmandk256remain independent.delta_types) so transaction types remain serializable withoutk256.Breaking Changes
ComplianceUnit.instance:Vec<u8>->ComplianceInstanceComplianceUnit::get_instance(); usecu.instancedirectly.get_delta_msg()now returnsVec<u8>instead ofResult<Vec<u8>, ArmError>.INITIAL_ROOT->initial_root()PADDING_LEAF->padding_leaf()Feature Behavior
--no-default-features: types-only build (norisc0-zkvm, nok256)--features transaction: transaction/types surface without zkVM/k256 proving--features transaction,zkvm: compiles without forcingk256--features transaction,zkvm,k256(and default): full proof-related functionalityaggregationpaths require prover/client capability (prove) for successful buildValidation Run
cargo fmt --all -- --checkcd arm_circuits && cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningscargo check -p anoma-rm-risc0cargo check -p anoma-rm-risc0 --no-default-features --features transactioncargo check -p anoma-rm-risc0 --no-default-features --features transaction,zkvmcargo check -p anoma-rm-risc0 --no-default-features --features transaction,zkvm,k256Closes #204.