feat(fwss): emit dataset deletion auth signer#474
Conversation
Lift the DeleteDataSet EIP-712 typehash into SignatureVerificationLib and use it to optionally verify deletion auth passed through PDP extraData. Emit an FWSS DataSetDeleted event with the authorized signer when the client or a valid session key signed the delete request, or address(0) when deletion is unauthenticated, malformed, or unilateral. Closes: #457
There was a problem hiding this comment.
Pull request overview
This PR adds optional EIP-712 attribution for dataset deletions in the FilecoinWarmStorageService (FWSS) callback flow: when a delete request includes a valid DeleteDataSet(uint256 dataSetId) signature (from the payer or an authorized session key), FWSS emits the authorized signer in a new DataSetDeleted event; otherwise it emits address(0) while still allowing deletion.
Changes:
- Lift
DeleteDataSet(uint256 dataSetId)EIP-712 typehash intoSignatureVerificationLiband add non-reverting signer recovery + authorization helper for optional delete signatures. - Extend FWSS
dataSetDeletedcallback to parse optionalextraData, verify attribution, and emitDataSetDeleted(dataSetId, payer, serviceProvider, signer). - Add tests covering
tryRecoverSignerbehavior andDataSetDeletedsigner attribution scenarios; update fixtures/spec/ABI accordingly.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| SPEC.md | Documents optional delete authorization via PDP extraData and expected event attribution semantics. |
| service_contracts/src/lib/SignatureVerificationLib.sol | Adds DELETE_DATA_SET_TYPEHASH, tryRecoverSigner, and authorizedDeleteDataSetSigner helper. |
| service_contracts/src/FilecoinWarmStorageService.sol | Decodes optional delete auth from extraData, computes EIP-712 digest, emits new DataSetDeleted event. |
| service_contracts/test/FilecoinWarmStorageService.t.sol | Adds unit tests for tryRecoverSigner and deletion event signer attribution paths. |
| service_contracts/test/SignatureFixtureTest.t.sol | Switches delete typehash fixture to reference library constant. |
| service_contracts/abi/FilecoinWarmStorageService.abi.json | Adds DataSetDeleted event and names the extraData parameter in dataSetDeleted. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| _hashTypedDataV4(keccak256(abi.encode(SignatureVerificationLib.DELETE_DATA_SET_TYPEHASH, dataSetId))); | ||
|
|
||
| return SignatureVerificationLib.authorizedDeleteDataSetSigner(payer, signature, digest, sessionKeyRegistry); | ||
| } |
There was a problem hiding this comment.
Should we move this to SignatureVerificationLib to not increase the size of this contract?
There was a problem hiding this comment.
Unfortunately, moving _hashTypedDataV4 out of the contract is nontrivial. We would have to find another library.
There was a problem hiding this comment.
Latest commit saves 2 bytes, but not really by moving stuff.
We could move the typehash creation out of here into the library, we'd want to do the same with schedulePieceRemovals, but then we incur a cross-contract call gas just to do a trivial abi.encode in both cases. The createDataSet and addPieces typehash creation is in the library right now, so conceptually everything belongs in there, but in those two cases there's a non-trivial amount of work to do.
This whole change so far adds 43 bytes to the contract. We still have 594 bytes headroom so the pricing changes may be forced to use library calls.
|
Converting to draft for now, #469 (comment) is an important point, the timing of using the 712 for this call makes an awkward gap from client->deletion. We need a better mechanism here to incentivise clean-up, make it so the client doesn't have to submit an on-chain msg under normal circumstances, and get the SP some funds to justify the clean-up work. Will move some design discussion back to #457 first cause there are options. |
|
Closing this pending #477; same code could be reused but some of it will need to change. |
Lift the DeleteDataSet EIP-712 typehash into SignatureVerificationLib and use it to optionally verify deletion auth passed through PDP extraData.
Emit an FWSS DataSetDeleted event with the authorized signer when the client or a valid session key signed the delete request, or address(0) when deletion is unauthenticated, malformed, or unilateral.
Closes: #457