Skip to content

feat: upgrade existing elements to walkthrough specs (A-01/A-03/A-04/A-13/B-01/B-02)#41

Open
heijiLee wants to merge 8 commits into
feat/element-wave2from
feat/element-upgrades
Open

feat: upgrade existing elements to walkthrough specs (A-01/A-03/A-04/A-13/B-01/B-02)#41
heijiLee wants to merge 8 commits into
feat/element-wave2from
feat/element-upgrades

Conversation

@heijiLee

Copy link
Copy Markdown
Contributor

Summary

Stacked on #39. Upgrades the six pre-existing thin mock elements IN PLACE to their docs/elements walkthrough specs — full failure-code taxonomies (A-01: 10 codes, A-03/A-04/A-13: 9, B-01/B-02: 6, each mapped to the doc §6 names in a contract-header table), the docs' §5.2 decision order, and richer operator-attested inputs:

  • A-01 Sanctions — dual-pattern gate: on-chain SDN wallet set (both parties) + opt-in screening-claim pipeline (issuer/signature/expiry/list-version/fuzzy-match bands/entity 50%-Rule with look-through status).
  • A-03 AccreditedInvestor — claim pipeline (issuer/sig/expiry/506(c) verification basis/(a)(8) look-through), per-asset 506(c)·§4(a)(7) activation flags.
  • A-04 IdentityUniqueness — keeps the 1:1 binding invariant; adds per-identity KYC claim, FROZEN/REVOKED status, and SUSPECTED/CONFIRMED dedup states.
  • A-13 QualifiedPurchaser — 4-branch basis claim (natural/family/trust/institutional/QIB/KE) with trust-vs-family FAILED distinction, KE covered-company match, policy freshness cap (1y, operator-tunable).
  • B-01 AssetClassification — becomes the manifest-integrity card mock: status/version approval/time-lock (inclusive boundary) /invariant/freshness (strict >) checks; classification is invariant INV-C.
  • B-02 Erc3643Native — opt-in live conformance probes against the real T-REX token: wiring drift, paused, party freeze, free-balance (inclusive ≥), isVerified/canTransfer delegation, fail-closed on nonconforming targets.

Compatibility (design invariant)

Every legacy setter keeps its exact signature and happy-path effect (legacy setter writes a fully-valid claim/card), and all new strictness is operator opt-in (defaults off) — DeployStack, IntegrationBase, CLI attest commands and the e2e runner are unaffected. Legacy code-1 meanings preserved per element.

Integration

  • CLI reason.ts decode table extended to all new codes (incl. a recipeId-0 axis) + smoke regressions against cast keccak ground truth.
  • Known limitation surfaced and documented (FEATURES/PROGRESS, deferred): ComplianceEngine._runChecks re-encodes failures with code hardcoded to 1, so recipe-scoped decodes only see code 1 today; per-code detail flows via elements' self-encoded recipeId-0 codes.
  • FEATURES.md CMP-004 entry, PROGRESS.md session record.

Verification

forge fmt --check / forge build / forge test --offline: 581/581 (39 suites). CLI + RFQ smoke pass. (tools/deploy-v3 mocha step: pre-existing local env gap, vendored tool untouched.)

heijiLee added 8 commits July 16, 2026 10:47
Extend services/cli/src/reason.ts to decode the walkthrough-doc failure
codes the six upgraded elements (A-01/A-03/A-04/A-13/B-01/B-02) now emit,
and register the six wave-2 (CMP-003) elements that were missing from
ELEMENT_LABELS despite being registered in DeployStack. Adds a recipeId-0
axis to the decode table since every element self-encodes its reasonCode
with recipeId 0 (ComplianceEngine still hardcodes code 1 on its
recipe-scoped propagation path, unchanged in this wave) - that is where
the new codes are actually observable today (direct check() calls,
HolderCount's ComplianceRejected revert, monitoring-flag events).

Confirmed script/DeployStack.s.sol and test/integration/IntegrationBase.sol
still call every legacy setter with its original signature, and
scripts/e2e-anvil.sh never touches the CLI - no changes needed there.

Adds FEATURES.md CMP-004 and a PROGRESS.md session record.
QualifiedPurchaser already guards its freshness subtraction against a
future verifiedAt (age 0 = fresh), but IdentityUniqueness (_checkIdentity,
KYC claim verifiedAt/maxAge) and AssetClassification (check,
factsAsOf/maxFactAge) did not: an operator-set future anchor made the
uint256 subtraction underflow and revert with a panic instead of the
check returning a reason code. Apply the same `block.timestamp > anchor`
guard to both, mirroring QualifiedPurchaser's comment style, and pin the
behavior with one boundary test each (future anchor + nonzero max age
=> check PASSes, no revert).
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