OpenZeppelin / OpenZeppelin/compact-contracts

Followup: `Ownable refactor -> replace pk with sk #466`

Open
#496 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1-medium effort: 2-S feat:access
Dominant language
TypeScript
Stars
55
Forks
29
Avg merge
5d 7h
Merged PRs (30d)
25

Description

Generalize Either<Bytes<32>, ContractAddress> helpers into Utils

Several Ownable circuits hand-roll the same Left<Bytes<32>, _> plumbing.
Lift them into Utils.compact so AccessControl / Fungible can share.

  • _unsafeUncheckedTransferOwnership(left<Bytes<32>, ContractAddress>(default<Bytes<32>>)) — the verbose Either literal in renounce/zero paths.
    Refs: L191, author agreed in r3167454830 / r3167769096.
  • Generalized isContractAddress (carried over from the AC PR discussion).
    Refs: L240, L138, confirmed r3202262467.
  • Generalize isKeyOrAddressZero (or at least its Left side).
    Refs: L321 / L321, confirmed r3202256488.
Shared AccountId module

Ownable now carries _computeAccountId + the secret-key witness pattern.
AccessControl (and any future identity-bearing module) will want the same
primitives. Consider an AccountId module that owns only the state and
circuits and is composed into the rest.
Ref: L310.

Polish
  • Tighten the header note on contract-owner authentication: until C2C
    calls land, a contract simply cannot authenticate as owner.
    Ref: r3167041751.
  • Style nit: assert(_computeAccountId() == _owner.left, "Ownable: caller is not the owner"); in _assertOnlyOwner.
    Ref: r3166987733.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Ownable circuits and the existing Utils.compact helpers, then compare the AccessControl and Fungible needs described here. Determine how the shared AccountId primitives and generalized Either helpers should be composed, and verify that the listed Ownable cleanup items and shared-use cases are covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
blockchain
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.