Repository navigation
Add SetPolicyEngine and GetPolicyEngine scripts for AdvancedPoolHooks ACE integration - #47
Merged
Merged
Conversation
|
👋 SyedAsadKazmi, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
aelmanaa
approved these changes
Sep 27, 2026
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.
Adds the policy engine surface to the hooks tooling, so an
AdvancedPoolHookscontract can be connected to a Chainlink ACE Policy Engine on the same chain, or disconnected, without hand-rolledcast sendcalls. The detach-revert recovery path is first-class:ALLOW_FAILED_DETACH=trueroutes the same script tosetPolicyEngineAllowFailedDetach.What's included
CctActions._setPolicyEngineandCctActions._setPolicyEngineAllowFailedDetach: action-layer builders encoding both hook setters viaabi.encodeCall, so the recovery path composes into Safe batches like every other operationscript/configure/policy-engine/SetPolicyEngine.s.sol: env-driven (POOL_HOOKS,POLICY_ENGINE,ALLOW_FAILED_DETACH), resolves the hooks via the standard ladder, refuses a same-address no-op and a codeless engine address before broadcasting (the hook'sattach()would revert with empty data), notes the zero-address disconnect, and prints themake snapshot-chainfollow-up (mode-aware:Next:vsAfter the Safe executes:) becausehooks.policyEngineis a governance-criticalroles{}field. A parameterizedrunWith(address,address,bool)entrypoint carries the behavior so tests drive it without process-wide env writesscript/configure/policy-engine/GetPolicyEngine.s.sol: read-only companiontest/actions/PolicyEngineActions.t.sol: fork tests for attach/swap/disconnect, the same-address no-op, and builder selector paritytest/actions/PolicyEngineReviewProofs.t.sol+test/actions/PolicyEngineReviewFixes.t.sol: proofs and fix validations against the REAL ACE 1.0.0PolicyEngine+VolumePolicy(deployed as clones, not the mock): the roles{} drift after a swap, the codeless-engine empty revert, the unprovisioned-enginePolicyRunRejected, the detach-revert block and itsTargetAlreadyAttachedfollow-on, the provision-then-swap order, and thepostflightCheckgas measurement (oneVolumePolicyalone runs ~97k gas against the 90kdestGasOverheaddefault)test/governance/SafeMode.t.sol: both builders in the byte-equality catalog, plus an end-to-end Mode B test (hooks owned by a 2-of-3 Safe takesetPolicyEnginethroughexecTransaction; the former EOA owner is refused)@openzeppelin/contracts-upgradeable@5.0.2as a direct dependency: ACE 1.0.0'sPolicy.solcalls the 5.x__Ownable_init(initialOwner), and the transitively hoisted 4.9.6 broke compilation of the real enginescript/docs/gen-primitives.mjs:policy-enginegroup mapping; regenerateddocs/primitives/catalog, index, and pages with authored_meta.jsoncontext (destructive: true, provisioning anddestGasOverheadpreconditions, the re-snapshot postcondition, and the failure modes includingTokenHandlingError(token, 0x))docs/operations/policy-engine.md: banner namesmake snapshot-chain, a "Before you set an engine" section covers provisioning,destGasOverheadand the ACE 1.0.0 vs 1.1.1TargetNotAttacheddifference,MODE=safefor Safe-owned hooks, the two pre-broadcast refusals, andALLOW_FAILED_DETACH; linked fromhooks-allowlist.md, the README production-operations list, and the guides index