Skip to content

feat(compliance): wave-3 illustrative element library (A-06, A-12, E-03, F-01, F-03, F-04)#54

Open
heijiLee wants to merge 4 commits into
mainfrom
feature/wave3-elements
Open

feat(compliance): wave-3 illustrative element library (A-06, A-12, E-03, F-01, F-03, F-04)#54
heijiLee wants to merge 4 commits into
mainfrom
feature/wave3-elements

Conversation

@heijiLee

@heijiLee heijiLee commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

docs/elements 브랜치에서 새로 문서화된 element 6개를 wave-2 전례를 따라 opt-in illustrative library로 구현합니다 (CMP-004). 이 PR은 근거 문서(docs/compliance/elements/ new-format walkthrough, docs/elements 브랜치 커밋 포함)와 구현을 함께 담습니다.

Element 컨트랙트 패턴 단위 테스트
A-06 Affiliate Affiliate.sol 증명서형 — attested basis + 이원 Rule 144 look-back decay (90일 (b)(2) tail + 3역월 (b)(1), 보수적 92d) 28
A-12 Red Flag Knowledge Bar RedFlagKnowledgeBar.sol 감시형 STATELESS — 표시만, check() 항상 pass, 당사자 노출 없음 20
E-03 Bad Actor Disqualification BadActorDisqualification.sol 기계 판정형 — offering-keyed clearance 게이트 (V1–V4/G1–G6), L2 봉인 결론 재판정 금지 27
F-01 Operator Self-Dealing OperatorSelfDealing.sol negative screen — 양측 대칭 대조, fail-closed roster 스위치, primary/involuntary 예외 31
F-03 Fraud Surveillance FraudSurveillance.sol 감시형 STATEFUL — SAR 파이프라인, no-tipping-off 표면 (pure check(), 무이벤트 onTransfer) 37
F-04 Reg M Issuer Buying RegMIssuerBuying.sol strict 게이트 — 시점×방향×주체, issuer/participant 갈래 라우팅, de minimis 비대칭 45

Scope

  • wave-2 컨벤션 준수: BaseElement/BaseStatefulElement + Governed(onlyOperator setter + 이벤트), ReasonCodes.encode(0, ELEMENT_ID, n), 문서 §→코드 매핑 헤더 주석, production data-source seam 문서화, fail-closed default.
  • active recipe / DeployStack 미변경 — 등록은 tools/deploy-wave3/DeployWave3Elements.s.sol opt-in 스크립트로만 (F-03은 setEngine wiring, D-01 HolderCount 패턴).
  • CLI: services/cli reason-decode 테이블에 wave-2와 동일한 parity(라벨 + 코드-이름 테이블, 총 23 element / 119 codes)로 추가. attest 명령/DeployStack에는 미배선 (wave-2와 동일).
  • FEATURES.md CMP-004 entry, PROGRESS.md 세션 기록 추가. (wave-2가 reason.ts에서 CMP-003으로 지칭되어 있어 이번 feature는 CMP-004로 명명)

Verification

  • forge test --offline 770/770 (pre-task 582 + 신규 188)
  • forge fmt --check, forge build, forge lint --severity high --deny warnings src 모두 통과
  • cd services/cli && npm test 통과 (reason-decode round-trip에 wave-3 포함, cast-keccak ground-truth 대조)
  • wave-3 deploy script는 forge script … --offline으로 컴파일 검증 (env-var 단계에서만 정지)
  • scripts/check.sh: Foundry·RFQ SDK·CLI·demo backend·Toolkit·Operator API/dashboard 단계 통과. vendored deploy-v3 단계는 로컬 환경에 yarn이 없어 미실행 (deploy-v3 미변경, CI parity gate가 커버)

Notes / Follow-ups

  • wave-2 script 잠재 버그 발견: tools/deploy-wave2/DeployWave2Elements.s.sol의 import 경로가 ../src/...로 한 단계 얕아 repo root 기준 컴파일 불가 (컴파일 게이트 부재로 미검출). wave-3는 올바른 ../../src/... 사용. wave-2 수정은 별도 follow-up.
  • F-01 운영 주의: registryAvailable 기본 false (fail-closed) — operator가 roster 적재 후 명시적으로 켜기 전까지 모든 거래 차단. deploy script가 자동으로 켜지 않음 (의도된 설계).
  • 이 브랜치에서 수정된 기존 element 문서(A-03/A-11/A-13)와 기존 구현의 재정합은 스코프 밖 (신규 element만 구현).

heijiLee and others added 4 commits July 15, 2026 14:09
Implement the six newly documented elements from the docs/elements
walkthrough docs as an opt-in illustrative library, mirroring the wave-2
precedent (not attached to any recipe, outside default script discovery):

- A-06 Affiliate: attested AffiliateBasis + dual Rule 144 look-back decay
  (90-day (b)(2) tail + three-calendar-month (b)(1), conservative 92d)
- A-12 Red Flag Knowledge Bar: pre-trade STATELESS marking, never blocks,
  party-facing surface leaks nothing
- E-03 Bad Actor Disqualification: offering-keyed clearance gate
  (V1-V4/G1-G6, L2-sealed substance never re-adjudicated)
- F-01 Operator Self-Dealing: symmetric negative screen with fail-closed
  roster switch, primary/involuntary exceptions
- F-03 Fraud Surveillance: STATEFUL post-trade SAR pipeline with
  no-tipping-off surface (pure check(), silent onTransfer)
- F-04 Reg M Issuer Buying: restricted-period buy-side gate with
  issuer/participant two-branch routing and de minimis asymmetry

Also: per-element unit tests (188 new; forge test --offline 770/770),
tools/deploy-wave3/DeployWave3Elements.s.sol opt-in registration script
(F-03 setEngine wiring; F-01 fail-closed default not auto-enabled),
CLI reason-decode coverage at wave-2 parity (labels + code-name tables),
FEATURES.md CMP-004 entry and PROGRESS.md session record.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@heijiLee heijiLee self-assigned this Jul 22, 2026
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