chore(tnt-core-v0.13.0): regenerate ABIs + slashing UX polish#3198
Merged
chore(tnt-core-v0.13.0): regenerate ABIs + slashing UX polish#3198
Conversation
- Run yarn sync:tnt-core-assets against tnt-core@v0.13.0 (PR #124, #125). - ITangleFull: SlashConfig now exposes 6 fields including disputeResolutionDeadline, disputeBond, maxPendingSlashesPerOperator. SlashProposal grows disputer/disputeBond/ disputedAt/disputeDeadline. New events SlashCancelled, SlashConfigUpdated, SlashDisputed. JobQuoteDetails now puts requester first (wildcard rejected). expireServiceRequest is permissionless on the proxy. Types.ServiceRequest.activated moved to end of struct. - IBlueprintServiceManager: new forceRemoveAllowsBelowMin(uint64) -> bool hook. - Sync script: tnt-core no longer ships IOperatorStatusRegistry.json; switch to the implementation ABI (OperatorStatusRegistry.json) which carries the same external surface and is what the dapp consumes. Future regenerations now succeed cleanly. Refs: tangle-network/tnt-core#124, tangle-network/tnt-core#125
tnt-core v0.13.0 adds disputer, disputeBond, disputedAt, and disputeDeadline to the SlashProposal struct returned by getSlashProposal. Surface these on the SlashProposal interface so the UI can render the disputer and an authoritative dispute resolution countdown once a slash flips to Disputed. - Update normalizeOnChainSlashProposal to read positions 10-13 of the tuple (the source of truth for an in-flight dispute). - Default the GraphQL fallback path to zero-values; the indexer schema does not yet ship these columns, and consumers that need authoritative dispute data should hit useSlashProposalDetails (on-chain read). - Re-export useSlashConfig from data/graphql so feature code can pull the active SlashConfig (disputeBond, maxSlashBps, etc.) without reaching into the implementation file directly.
…uteSlashModal Operators repeatedly hit "insufficient funds" when admins enable a non-zero dispute bond because the modal never tells them how much ETH the contract will demand. Pull the active SlashConfig from the Tangle proxy and render the required bond inline as "X ETH (refunded if dispute upheld)" so users see the cost before signing — matches the message attached to the disputeSlash hook in useSlashing. When the slash is already in `Disputed` state, also render the on-chain disputer address and a live countdown to disputeDeadline (the new field from getSlashProposal in tnt-core v0.13.0). This gives the operator and the admin a shared view of how long the resolution window has left.
…hModal Operators were burning simulation gas on slash proposals that the contract will deterministically reject because slashBps > SlashConfig.maxSlashBps. Pull the active cap from useSlashConfig and: - Render the cap in the BPS field placeholder + a helper line so users see the upper bound before typing. - Short-circuit the validation pipeline once the cap loads — proposals above maxSlashBps are blocked client-side with an explicit message. Falls through to the contract hard ceiling (10_000) while the config is still loading, preserving the previous behaviour for the first paint.
tnt-core v0.13.0 routes expireServiceRequest through the proxy so anyone can call it once `now > req.createdAt + REQUEST_EXPIRY_GRACE_PERIOD`. The path refunds the requester and frees the operator candidates — without it stale requests linger forever with their payment locked. Surface this as a real action on the request-detail modal: - New useExpireServiceRequestTx hook (libs/tangle-shared-ui/src/data/services/ useExpireServiceRequest.ts) wired through useContractWrite so it gets the same simulation, receipt-wait, and toast machinery as the rest of the tx hooks. On success it invalidates serviceRequestDetails, serviceRequests, and services so the calling surface refetches without a hard reload. - REQUEST_EXPIRY_GRACE_PERIOD_SECONDS constant + isServiceRequestExpired / getServiceRequestExpiryEligibleAt helpers, mirroring ProtocolConfig.sol (1 hour). The contract permits admins to override the grace period but exposes no getter, so we use the protocol default — conservative because any custom override is always >= 1 hour in practice. - "Expire request" button on ServiceRequestDetailModal, shown both in the default and viewOnly footers since the call is permissionless. Gated on `isServiceRequestExpired(createdAt)` AND `!rejected` so we don't waste gas on a guaranteed revert. Loading + error states are handled inline and the modal closes on success.
…management
tnt-core v0.13.0 grew SlashConfig from 3 to 6 fields — disputeResolutionDeadline,
disputeBond, and maxPendingSlashesPerOperator are now operator-visible policy
levers, not just internal contract state. Add a read-only SlashingParametersCard
above the slashing summary on the operator-management page so both proposers
and operators see the active caps and bond up front:
- maxSlashBps (rendered as bps + %)
- disputeWindow + disputeResolutionDeadline (humanised durations)
- disputeBond (ETH-formatted, "None" when zero)
- maxPendingSlashesPerOperator ("Unlimited" when zero)
- instantSlashEnabled flag
The card is read-only and self-loads via useSlashConfig — no extra props
required from the page beyond the data the page already fetches.
…eRequest Lets the @typescript-eslint/no-inferrable-types rule pass without changing the call surface. The defaults still resolve to bigints because both the Date.now() expression and REQUEST_EXPIRY_GRACE_PERIOD_SECONDS are bigints.
…quest modals The sync script previously emitted raw JSON.stringify output (double-quoted, no trailing commas) which drifted from the rest of the codebase's prettier config and caused yarn format:check to fail after every regeneration. Pipe the four generated ABI files through `npx prettier --write` at the end of the sync, and reformat the existing artifacts in the same pass. Also pick up minor prettier-driven whitespace fixes on the two modals touched in the slashing UX commits. No behaviour changes — prettier rewrites are pure-formatting only.
✅ Deploy Preview for tangle-cloud 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. |
✅ Deploy Preview for tangle-leaderboard ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Both `https://nx.dev/packages/storybook/generators/migrate-7` and `https://nx.dev/packages/storybook/documents/storybook-7-setup` now return 404 — Nx restructured their docs site and the documents/<slug> URL scheme is retired. The link-check CI on this PR was correctly flagging the 404; the file was last touched in #3183 so this isn't a regression introduced here, just a passing-through fix. Replaced the bracketed links with a plain-text pointer to the Nx docs root. The bigger Storybook upstream links above are still valid.
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.
Picks up the v0.13.0 surface changes from tnt-core (audit follow-ups landed
in PR #124 and
PR #125) and uses
the resync as a chance to close the loop on a handful of UX gaps that the
new contract fields make actionable.
REQUIRED — ABI sync
chore(abi): regenerate from tnt-core v0.13.0— runsyarn sync:tnt-core-assetsagainst tnt-core@v0.13.0. Generated ABIs now containSlashCancelled,SlashConfigUpdated,SlashDisputedevents; the 6-fieldSlashConfig; the 14-fieldSlashProposal;forceRemoveAllowsBelowMinonIBlueprintServiceManager; therequester-firstJobQuoteDetails; and the now-routableexpireServiceRequestselector. Sync script swapped toOperatorStatusRegistry.json(impl ABI) since tnt-core v0.13.0 stopped emitting the interface JSON.chore(abi-sync): run prettier on generated ABIs— drops the JSON-style output the sync script was producing in favour of the codebase's prettier style soyarn format:checkstays clean across regenerations.RECOMMENDED — UX polish (each in its own commit)
a. DisputeSlashModal surfaces the required
disputeBondfeat(slashing-ui): surface dispute bond + resolution deadline on DisputeSlashModalThe modal now reads the active
SlashConfigand renders the required bond inline asX ETH (refunded if dispute upheld), matching the message theuseDisputeSlashTxhook already attaches asmsg.value. When the slash is already inDisputedstate, also surface the on-chaindisputeraddress and a live countdown todisputeDeadline(the field added by tnt-core v0.13.0). User-facing: the "Submit Dispute" CTA is no longer a black box — operators see what bond they're posting before signing.b. ProposeSlashModal enforces
SlashConfig.maxSlashBpsfeat(slashing-ui): enforce SlashConfig.maxSlashBps cap on ProposeSlashModalPulls
maxSlashBpsfromuseSlashConfig, surfaces it in both the BPS input placeholder and a helper line under the field, and short-circuits validation client-side. User-facing: proposers stop wasting simulation gas on out-of-range values.c.
SlashProposalextended with dispute lifecycle fieldsfeat(slashing): extend SlashProposal with dispute lifecycle fieldsSlashProposalnow exposesdisputer,disputeBond,disputedAt, anddisputeDeadline.normalizeOnChainSlashProposalreads positions 10–13 of the newgetSlashProposaltuple; the GraphQL fallback path defaults the new columns to zero-values with a comment so callers needing authoritative dispute data can hituseSlashProposalDetails(on-chain).useSlashConfigis now exported fromdata/graphqlso feature code consumes it via the public surface.d. New "Expire request" action
feat(services): permissionless expire-service-request actionNew
useExpireServiceRequestTxhook +REQUEST_EXPIRY_GRACE_PERIOD_SECONDS/isServiceRequestExpiredhelpers inlibs/tangle-shared-ui/src/data/services/useExpireServiceRequest.ts. Wired into the request-detail modal as an "Expire request" button gated onnow > createdAt + graceand!rejected, with full loading / error / success handling andserviceRequestDetailscache invalidation. Available in both default andviewOnlyfooters because the call is permissionless. User-facing: anyone can clean up a stale request, refunding the requester and freeing the operator candidates without a manual contract call.e. SlashConfig parameters card
feat(slashing-ui): surface SlashConfig parameters at top of operator managementNew read-only
SlashingParametersCardrendered above the slashing summary onapps/tangle-cloud/src/pages/operators/manage. SurfacesmaxSlashBps,disputeWindow,disputeResolutionDeadline,disputeBond,maxPendingSlashesPerOperator, andinstantSlashEnabled. User-facing: proposers and operators see the active policy levers up front instead of discovering them via failed simulations.Verification
TNT_CORE_DIR=/home/drew/code/tnt-core yarn sync:tnt-core-assets— green; regenerated ABIs contain the expected new entries.yarn nx run tangle-cloud:typecheck— greenyarn nx run tangle-cloud:build— greenyarn nx run tangle-cloud:lint— greenyarn nx run tangle-dapp:typecheck/:build/:lint— green (no behavioural changes there; the regenerated ABIs are the only shared touchpoint)yarn nx run tangle-shared-ui:test— 32 passed, 0 failedyarn nx run tangle-shared-ui:lint— greenyarn format:check— greenTest plan
SlashConfig.disputeBond > 0and confirm the new SlashingParametersCard renders the bond, deadlines, and caps.msg.valueto match.createdAt + 1h < nowand is not yet rejected; click "Expire request"; expect a successful tx, modal close, and the request to disappear from the parent list.