feat: nullifier re-registration barrier, solvency monitor, proof-of-reserves page, ZK proof SDK - #1087
Merged
Conversation
… proof SDK - FinesseStudioLab#740: Add per-participant PARTICIPATED persistent storage key to campaign register() that survives deregistration and merkle root rotations; returns NullifierAlreadyUsed on re-register attempts. Add clear_participation() and has_participated() admin/view functions. Five new tests covering marker set/persist/block/clear/rotation flows. - FinesseStudioLab#874: New SolvencyMonitorService with Prometheus Gauges for reserve, liabilities, solvency ratio, and contract TTL; polls every 60s and logs WARN on shortfall or low TTL. Four new alert rules added to alerting_rules.yml: ContractSolvencyShortfall (critical, <1.0), ContractSolvencyLow (warning, <1.1), ContractTtlLow (warning, <50k ledgers), ContractTtlExpired (critical, ==0). - FinesseStudioLab#956: ProofOfReserves React page at /proof-of-reserves; polls /api/v1/reserves/snapshot every 60s, shows reserve/liabilities/ solvency-ratio/TTL metric cards with status badge, auto-refresh, and an independent-verification guide. Lazy-loaded in App.jsx. - FinesseStudioLab#847: ZK proof SDK scaffolding in sdk/client/src/zk/ — typed ClaimProofInputs/ClaimProof interfaces, generateClaimProof() public API that delegates to a Web Worker, proof.worker.ts stub prover with progress reporting, and isZkSupported() environment check. Closes FinesseStudioLab#740 Closes FinesseStudioLab#874 Closes FinesseStudioLab#956 Closes FinesseStudioLab#847
| return proverReady; | ||
| } | ||
|
|
||
| self.onmessage = async (event: MessageEvent) => { |
Closed
3 tasks
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
PARTICIPATEDpersistent storage key in the campaign contract'sregister()path that is set on first successful registration and is never cleared byderegister(). Any subsequentregister()call from the same address returnsNullifierAlreadyUsed, even after deregistration or merkle root rotation — eliminating referral-count inflation from de/re-register cycles. Two new admin functions:clear_participation()(explicit opt-in to allow re-registration for a specific address) andhas_participated()(view). Five new tests cover marker set, persist-after-deregister, re-register block, admin clear, and root-rotation scenarios.SolvencyMonitorServiceNestJS service that exports four Prometheus Gauges (trivela_contract_reserve_xlm,trivela_contract_liabilities_xlm,trivela_solvency_ratio,trivela_contract_ttl_ledgers) and polls every 60 s. LogsWARNon shortfall or low TTL. Four new Prometheus alert rules inalerting_rules.yml:ContractSolvencyShortfall(critical, ratio < 1.0, 2 m),ContractSolvencyLow(warning, ratio < 1.1, 10 m),ContractTtlLow(warning, < 50 000 ledgers, 5 m),ContractTtlExpired(critical, == 0, immediate).ProofOfReservesReact page at/proof-of-reservesthat polls/api/v1/reserves/snapshotevery 60 s and displays reserve, liabilities, solvency ratio, and contract TTL as metric cards with a colour-coded status badge. Includes an independent-verification guide pointing users to Stellar Expert and the Soroban RPC. Lazy-loaded inApp.jsx.sdk/client/src/zk/— typedClaimProofInputs/ClaimProofinterfaces (types.ts),generateClaimProof()public API that spawns a Web Worker so the main thread stays responsive (index.ts),proof.worker.tswith a stub prover stub and progress reporting (replace the innerloadProver()return with the real circom/snarkjs WASM build), andisZkSupported()environment check.Test plan
cargo test -p trivela-campaign-contract— five new#[test]functions pass; existing tests unaffected (no signature changes)deregister()returnsNullifierAlreadyUsedclear_participation()followed byregister()succeeds; subsequent re-register is blocked againGET /metricsexposes all four solvency Gauges; simulatingliabilities > reservefiresContractSolvencyShortfallalert in Prometheus/proof-of-reservespage loads, displays metric cards, and auto-refreshes every 60 sgenerateClaimProof(inputs, { onProgress })resolves with aClaimProofand emits progress events 0 → 100Closes #740
Closes #874
Closes #956
Closes #847