Skip to content

fix(jobs): defer terminate to operator when payer is multisig#547

Closed
SgtPooki wants to merge 1 commit into
mainfrom
fix/operator-required-terminate-skip
Closed

fix(jobs): defer terminate to operator when payer is multisig#547
SgtPooki wants to merge 1 commit into
mainfrom
fix/operator-required-terminate-skip

Conversation

@SgtPooki
Copy link
Copy Markdown
Collaborator

What changed

In session-key + multisig payer mode, repairTerminatedDataSet now throws a typed DataSetTerminateRequiresOperatorError instead of calling synapse.storage.terminateDataSet. The data_set_creation handler catches the typed error and emits dataset_terminate_operator_action_required so the operator can submit terminateService via Safe (as we did in #545).

The existing already-terminated branch in repairTerminatedDataSet is unchanged. Once an operator's Safe batch lands and FWSS reports pdpEndEpoch != 0, the next tick marks the affected Deal rows cleaned_up=true automatically.

EOA-mode behavior is unchanged.

Why

FWSS.terminateService gates on msg.sender ∈ {payer, payee}. Our session-key EOA is neither, so any direct call would revert with CallerNotPayerOrPayee on-chain. Pre-flight simulation also fails today because Lotus rejects eth_call with from set to a contract address (lotus#13470 still open), and apps/backend/src/common/synapse-factory.ts:safeReadTransport strips from to work around that.

Full context: #546

How to verify

pnpm test from the repo root (362 tests pass).

Manual: in staging, after this lands, a dataset_terminated_detected event for a known-terminated dataset is now followed by dataset_terminate_operator_action_required (with payerAddress in the log) instead of failing on CallerNotPayerOrPayee. After the operator runs a Safe batch like #545, the next data_set_creation tick logs dataset_already_terminated + dataset_terminated_repaired and marks the corresponding Deal rows cleaned_up=true.

Notes / risks

Refs:

In session-key mode with a contract payer, dealbot cannot auto-terminate
PDP-terminated datasets: FWSS.terminateService gates on
msg.sender ∈ {payer, payee}, and our signer is the session-key EOA. Any
direct call reverts with CallerNotPayerOrPayee on-chain (and currently
even fails simulation because Lotus rejects eth_call from a contract).

Detect this case in repairTerminatedDataSet and throw a typed
DataSetTerminateRequiresOperatorError. The data_set_creation handler
catches it and emits dataset_terminate_operator_action_required so an
operator can submit terminateService via Safe Transaction Builder. The
existing already-terminated branch still runs the DB cleanup once an
operator's batch lands.

Tracking: #546
@FilOzzy FilOzzy added this to FOC May 19, 2026
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FOC May 19, 2026
@SgtPooki SgtPooki self-assigned this May 19, 2026
@BigLep BigLep moved this from 📌 Triage to ⌨️ In Progress in FOC May 20, 2026
@BigLep
Copy link
Copy Markdown
Contributor

BigLep commented May 26, 2026

@SgtPooki : I want to make sure any work here is accounting for changes / simplifications that are coming with terminations as outlined in https://www.notion.so/filecoindev/Data-Set-Terminations-Clean-up-360dc41950c1801ebf0aff017a322e7f

@SgtPooki SgtPooki moved this from ⌨️ In Progress to 🐱 Todo in FOC May 26, 2026
@SgtPooki
Copy link
Copy Markdown
Collaborator Author

@SgtPooki : I want to make sure any work here is accounting for changes / simplifications that are coming with terminations as outlined in https://www.notion.so/filecoindev/Data-Set-Terminations-Clean-up-360dc41950c1801ebf0aff017a322e7f

This was exploratory and im not a big fan.. i think we should just close this and wait for the changes you mentioned

@BigLep
Copy link
Copy Markdown
Contributor

BigLep commented May 27, 2026

Closing given #547 (comment)

@BigLep BigLep closed this May 27, 2026
@github-project-automation github-project-automation Bot moved this from 🐱 Todo to 🎉 Done in FOC May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

3 participants