refactor(tangle-cloud): unify approval form to securityCommitments[]#3169
Merged
Conversation
…mitments
The unified `approveService(ApprovalParams)` entrypoint takes a single
`securityCommitments[]` array; the operator's slider value for the
default-TNT case was being silently dropped because the form sent
`stakingPercent` / `tntExposureBps` fields that the hook ignored.
- Drop `stakingPercent` and `tntExposureBps` from `ApprovalConfirmationFormFields`.
- Render every requirement (custom or default-TNT) through one `commitments.${key}`
controller; the operator's slider always reaches the contract via
`securityCommitments[]`.
- Type-safe `TeeBackend` const for `useServiceApproveTx` (Phala, AwsNitro,
GcpConfidential, AzureSkr only — Unset and DirectTdx are rejected on-chain
and thus unrepresentable in the type).
Net -45 LOC. typecheck + lint + format + vitest pass.
✅ Deploy Preview for tangle-cloud ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for tangle-leaderboard ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for tangle-dapp ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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
Closes the silent-data-drop bug in
PendingInstanceTableintroduced when thecontract collapsed five
approveServiceWith*overloads into oneapproveService(ApprovalParams)entrypoint (tnt-core #119). The form waspassing
stakingPercent/tntExposureBpsfields thatuseServiceApproveTxno longer reads, so the operator's slider value for the default-TNT case
reached the contract as "no commitment" — the contract then auto-filled at
the requirement's
minExposureBpsregardless of what the operator typed.What changed
ApprovalConfirmationFormFields: drop deadstakingPercentandtntExposureBps. The form now produces a singlesecurityCommitments[]array — the only thing the unified contract entrypoint accepts.
ServiceRequestDetailModal: collapse the two render branches (custom vsdefault-TNT) into one. Every requirement renders as a per-asset slider
bound to
commitments.\${tokenKey}. The default-TNT case keeps theoperator-recommended-exposure marker via
derivedSimpleStakingPercent.useServiceApproveTx: type-safeTeeBackendconst so callers can't passinvalid backends (
Unset = 0andDirectTdx = 5are rejected on-chainand thus unrepresentable in the type).
Net -45 LOC.
Verification
Test plan
contract receives
securityCommitments[0].exposureBpsmatching theoperator's slider (not auto-filled at min).
slider value reaches the contract.
securityCommitments[]is sent and the contract takes theeffectiveStakingPercent = 100path.