Repository navigation
SDK v3: drop ZK export, verify challenges, enforce spend budget - #1757
Merged
Merged
Conversation
…channel st Closes Calebux#1671
|
@kaynaomi-oss Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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
SDK v3: drop ZK export, verify challenges, enforce spend budget
What was solved
#1670 — [v3][sdk] Ship or remove the ZK prover placeholder
Remove the non-functional ZK prover placeholder from the SDK's public exports for the v3 major and record the decision (ZK payment proofs out of v3 scope) in an ADR. The
zk-payment-verifiercontract is not in the v3 component list, so the SDK should stop exporting code that cannot produce proofs.Addressed:
sdk/src/zkfrom the SDK's public exports so the SDK no longer exports code that can't work.#1671 — [v3][sdk] Verify gateway challenges before signing channel states
Add challenge verification to the v3 SDK's paid-fetch flow so that before signing a channel state it validates the PAYMENT-REQUIRED challenge against the deployment manifest (contract id and network), confirms the channel belongs to this principal and provider, and enforces a caller-set maxPricePerCall. Introduce typed errors for each refusal and add tests covering the contract-mismatch, channel-ownership, and price-cap checks.
Addressed:
#1672 — [v3][sdk] Spend budget option on
createPaidFetchAdd a local spend budget to the v3 SDK's
createPaidFetch: extendPaidFetchConfigwithbudget: { amount, asset }, track cumulative spend from payment receipts, and throw a typedBudgetExceededErrorbefore signing any state that would exceed the budget. Expose read/reset accessors for the budget so callers can inspect and clear accumulated spend.Addressed:
budget: { amount, asset }toPaidFetchConfigBudgetExceededErrorbefore signing a state that would cross the budgetChanges
sdk/src/zk/wasm/index.ts(delete)docs/adr/0001-zk-prover-out-of-v3-scope.md(create)packages/sdk/src/paid-fetch.ts(create)sdk/src/index.ts(modify)docs/adr/README.md(modify)packages/sdk/src/errors.ts(create)Approach
createPaidFetch#1672 — [v3][sdk] Spend budget option oncreatePaidFetch(Changed: packages/sdk/src/paid-fetch.ts, packages/sdk/src/errors.ts)Issues
Closes #1670
Closes #1671
Closes #1672