Skip to content

feat(risk): expand risk anchors + known-address registry#244

Draft
spalen0 wants to merge 1 commit into
mainfrom
feat/risk-anchors-known-addresses
Draft

feat(risk): expand risk anchors + known-address registry#244
spalen0 wants to merge 1 commit into
mainfrom
feat/risk-anchors-known-addresses

Conversation

@spalen0
Copy link
Copy Markdown
Collaborator

@spalen0 spalen0 commented May 27, 2026

Summary

Two small, independent improvements to the AI explainer's risk grounding. Branched off main so 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:

Selector Anchor
enableModule(address) CRITICAL — a module can move funds with no owner signatures
addOwnerWithThreshold / removeOwner / swapOwner HIGH — Safe signer set changes
changeThreshold(uint256) HIGH — signatures-required change
setGuard(address) HIGH — a guard can permit/block every Safe tx
disableModule / setFallbackHandler MEDIUM
acceptOwnership() HIGH — completes an Ownable2Step handover
mint(address,uint256) MEDIUM — new supply, elevate if large/unbacked

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 → label map wired as the highest-priority resolver backend, ahead of Etherscan/swiss-knife. A correct label lets the LLM reason about who an address is — grantRole to a known multisig reads very differently from grantRole to an unknown EOA.

  • Seeded only with canonical burn/null addresses (a transfer to 0x…dEaD is a burn — universally correct, useful signal).
  • _BY_CHAIN is 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)

Testing

367 passing, lint clean, no new mypy errors.

🤖 Generated with Claude Code

- 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant