fix: adopt Sapling proving resource limits and JNI regressions

Draft
FE
1d ago
+1191-36

Adopt the Sapling proving resource gate from https://github.com/tronprotocol/librustzcash/pull/17. Native proving now rejects overload before circuit synthesis and state/output mutation, while verification remains available.

  • Pin the Rust gitlink to 7b76c8e01bbe77148fd5960a119b0839a84fb550; no submodule source files are copied.
  • Preserve boolean false for ordinary admission rejection. Map invalid startup resource configuration (FFI status 3) to a clear IllegalStateException; Java signatures remain unchanged.
  • Add four child-JVM regressions using the existing opt-in test bridge: distinguish memory/count exhaustion, preserve nonempty contexts and outputs, retry valid Spend/Output proofs through final binding signatures, verify during saturation, reject eight concurrent callers, and reject malformed configuration.
  • Test reservation handles are absent from ordinary builds and use the existing non-installable ZKSNARK_PANIC_TESTS artifact.

Defaults: 2 active operations, 256 MiB working-set reservation budget, and 2 shared CPU-pool threads. Spend reserves 256 MiB, Output 128 MiB; defaults allow one Spend or two Outputs. Startup environment permits bounded tuning. These are admission estimates, not a JVM RSS hard cap. No native waiting queue is added; asynchronous tasks retain capacity until cleanup completes.

This branch targets develop and builds on SDK #23 / Rust #16. Prerequisite commits remain visible until merged; the final commit contains this resource integration. Existing PRs are unchanged. No Sprout or proof-validation rule changes.

Validation on macOS x86_64 / JDK 8:

  • 42 Java tests passed with the instrumented release JNI, including all four new resource scenarios and existing initialization/panic regressions.
  • All four resource scenarios passed with java-tron's production parameters.
  • Ordinary release JNI passed 35 tests; normal Rust and JNI symbol checks confirm no reservation/panic-injection exports.
  • Rust library tests: 26 passed (one fixture-dependent test ignored by default). Bellman: all 11 tests passed in release mode, including caller-unwind/task-lifetime handling, bounded chunks, FFT equivalence and fixed-randomness proof equality.

Draft for release integration: rebuild the combined fixes into all four packaged macOS/Linux x86_64/aarch64 libraries, validate the final JAR artifacts, and update java-tron's dependency. This PR does not replace the bundled native binaries. Configuration and test commands: docs/proving-resources.md.