feat: add TokenSafetyHook and ITokenSafetyOracle#20
Open
JhiNResH wants to merge 1 commit intoerc-8183:mainfrom
Open
feat: add TokenSafetyHook and ITokenSafetyOracle#20JhiNResH wants to merge 1 commit intoerc-8183:mainfrom
JhiNResH wants to merge 1 commit intoerc-8183:mainfrom
Conversation
Contributor
|
@JhiNResH before i do some audit on the hook. Could i suggest some key things to fix ?
it would be better to align this with the shared hook pattern and keep the implementation as close as possible to the base example style, and please remove any remaining provider-specific framing. Once that is cleaned up, happy to review a narrower v2. I would treat this as a standalone policy hook, not something that should be bundled with router or attestation paths. |
…job state v2 rewrite addressing review feedback: - Inherit BaseACPHook, override _preFund only — no manual selector routing - Read paymentToken from getJob(jobId) instead of decoding from callback data - Remove upgradeable pattern — align with non-upgradeable hook style - Remove provider-specific framing (security@maiat.io → security@erc-8183.org) - 9 tests: safe/unsafe/whitelist/no-token/admin/batch/verdict-mask
bd3a633 to
36f7c1b
Compare
Author
|
Rewrote from scratch. All three issues fixed:
9 tests cover: safe token pass, honeypot revert, whitelist bypass, no-token skip, blocked verdict mask, admin access, batch whitelist. Force-pushed — clean single commit on top of current |
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.
TokenSafetyHook v2
Gates job funding when payment token is flagged as unsafe by an external oracle.
Changes from v1
FUND_SELselectorBaseACPHook, override_preFund— no manual selector routingpaymentTokenfromgetJob(jobId)How it works
fund(jobId, ...)triggersbeforeAction→_preFundjob.paymentTokenfromAgenticCommerce.getJob(jobId)ITokenSafetyOracle→ if verdict is blocked → revertFiles
contracts/hooks/TokenSafetyHook.solcontracts/interfaces/ITokenSafetyOracle.soltest/TokenSafetyHook.t.solTest plan
forge test --match-contract TokenSafetyHookTest— 9/9 pass_preFundreads token from job state, not callback data