Skip to content

style: pin compiler version, dedupe helpers#34

Merged
chunter-cb merged 2 commits into
fix/policymanager-note-and-shadowed-localsfrom
style/compiler-pins-and-dedup
Jul 13, 2026
Merged

style: pin compiler version, dedupe helpers#34
chunter-cb merged 2 commits into
fix/policymanager-note-and-shadowed-localsfrom
style/compiler-pins-and-dedup

Conversation

@chunter-cb

@chunter-cb chunter-cb commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Style/polish pass on the EIP-8130 reference contracts. No behavior change — all 355 tests pass on the pinned compiler.

Style fixes

  • Compiler pinning (reproducibility): pin deployed contracts to an exact solc 0.8.36 (AccountConfiguration, the four accounts/*, and the canonical authenticators/*) and bump foundry.toml solc to match. The pragma now equals the build compiler, so AccountConfiguration's bytecode/address — and every CREATE2-derived account address salted by it — stays reproducible. Interfaces, examples, and the test-only AlwaysValidAuthenticator keep open ^ pragmas per the Coinbase style guide.
  • NatSpec accuracy: written iffnon-zero only when for the policy accessors, corrected the ActorConfig field list, and updated SCOPE_NONCE wording to the merged EIP's sequenced-nonce_key terminology.

Refactor (dedup)

  • Extract _writePolicySlots, _disableInlineSelf, _resolveExplicitActor, and _policyTargetFor to remove duplicated policy-slot writes and actor-resolution logic shared across the authenticate / authorize / revoke paths.
  • Flatten _slicePolicy with an early return.

Notes

Test plan

  • forge build clean on 0.8.36
  • forge test — 355 passed, 0 failed

…ming comments

- Pin deployed contracts (AccountConfiguration, accounts, canonical
  authenticators) to solc 0.8.36 and bump foundry.toml to match, so the
  pragma equals the build compiler and CREATE2-derived addresses stay
  reproducible; interfaces/examples keep open pragmas.
- Extract _writePolicySlots, _disableInlineSelf, _resolveExplicitActor,
  and _policyTargetFor to remove duplicated policy-slot writes and
  actor-resolution logic across the auth/authorize/revoke paths.
- Flatten _slicePolicy with an early return; rename the "ACTOR ELEVATED
  SCOPES" divider to "ACTOR SCOPE BITS" and reword the ERC-1271 note to
  positive framing (no phantom SIGNER bit).
- Refresh stale NatSpec ("written iff" -> "non-zero only when",
  ActorConfig fields, SCOPE_NONCE) to match the merged EIP.
Per Coinbase style guide 3.B.1 (errors minimally need @notice). Convert
@dev error docs to @notice in SessionPolicy and PolicyManager, and add
@notice to the four previously-undocumented PolicyManager errors.
@chunter-cb chunter-cb changed the title style: pin compiler version, dedupe helpers, positive-framing comments style: pin compiler version, dedupe helpers Jul 13, 2026
@chunter-cb chunter-cb merged commit b356b97 into fix/policymanager-note-and-shadowed-locals Jul 13, 2026
3 checks passed
chunter-cb added a commit that referenced this pull request Jul 13, 2026
* fix: silence shadowed-local warnings; document zero-commitment policy actors

- Rename local `unlocksAt`/`policyTarget` variables that shadowed named
  returns (getLockStatus, _authenticate) and an outer-scope local
  (_authenticateK1), clearing the solc "declaration shadows" warnings. Pure
  renames, no behavior change.
- Add an inline note to PolicyManager.execute/_enforceExternal clarifying
  that a zero-commitment SCOPE_POLICY actor is valid per the spec (gating is
  the scope bit, not the commitment) but is treated as ungated by this
  reference manager, since a real binding commits to nonzero keccak256 params.
- Sharpen the README SCOPE_POLICY example to state that combining SENDER adds
  no authority the protocol will honor.

* style: pin compiler version, dedupe helpers (#34)

* style: pin compiler version, dedupe policy/self helpers, positive-framing comments

- Pin deployed contracts (AccountConfiguration, accounts, canonical
  authenticators) to solc 0.8.36 and bump foundry.toml to match, so the
  pragma equals the build compiler and CREATE2-derived addresses stay
  reproducible; interfaces/examples keep open pragmas.
- Extract _writePolicySlots, _disableInlineSelf, _resolveExplicitActor,
  and _policyTargetFor to remove duplicated policy-slot writes and
  actor-resolution logic across the auth/authorize/revoke paths.
- Flatten _slicePolicy with an early return; rename the "ACTOR ELEVATED
  SCOPES" divider to "ACTOR SCOPE BITS" and reword the ERC-1271 note to
  positive framing (no phantom SIGNER bit).
- Refresh stale NatSpec ("written iff" -> "non-zero only when",
  ActorConfig fields, SCOPE_NONCE) to match the merged EIP.

* style: use @notice for error NatSpec in example policy contracts

Per Coinbase style guide 3.B.1 (errors minimally need @notice). Convert
@dev error docs to @notice in SessionPolicy and PolicyManager, and add
@notice to the four previously-undocumented PolicyManager errors.
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