feat(risk): expand risk anchors + known-address registry#244
Draft
spalen0 wants to merge 1 commit into
Draft
Conversation
- risk_anchors: add Safe self-administration selectors (addOwner, removeOwner, swapOwner, changeThreshold, enableModule=CRITICAL, disableModule, setGuard, setFallbackHandler) plus acceptOwnership() and mint(). Directly relevant to the Safe monitor — these change who/what can move multisig funds. - known_addresses: curated address→label registry wired as the highest-priority resolver backend, ahead of Etherscan/swiss-knife. Seeded with canonical burn/null addresses; _BY_CHAIN is left for per-deployment curation (verified multisigs/EOAs only — no fabricated entries). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Two small, independent improvements to the AI explainer's risk grounding. Branched off
mainso it's reviewable independently of #243.Expanded risk anchors (
utils/risk_anchors.py)Anchors stabilize the LLM's risk verdicts by giving well-understood selectors a typical floor/ceiling. Added the ones most relevant to Safe monitoring — they change who or what can move multisig funds:
enableModule(address)addOwnerWithThreshold/removeOwner/swapOwnerchangeThreshold(uint256)setGuard(address)disableModule/setFallbackHandleracceptOwnership()mint(address,uint256)A test recomputes each selector from its signature to guard against typos, and validates the whole table (well-formed keys, valid levels).
Known-address registry (
utils/known_addresses.py)A curated
address → labelmap wired as the highest-priority resolver backend, ahead of Etherscan/swiss-knife. A correct label lets the LLM reason about who an address is —grantRoleto a known multisig reads very differently fromgrantRoleto an unknown EOA.0x…dEaDis a burn — universally correct, useful signal)._BY_CHAINis left empty for per-deployment curation — I did not fabricate multisig addresses. Populate with verified Yearn multisigs/EOAs (there's a commented example).Deferred (need #243 or your input)
simulation.pychanges; better as a follow-up once that merges.Testing
367 passing, lint clean, no new mypy errors.
🤖 Generated with Claude Code