@bananapus/address-registry-v6 0.0.17 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ADMINISTRATION.md +41 -48
- package/ARCHITECTURE.md +63 -27
- package/AUDIT_INSTRUCTIONS.md +26 -12
- package/README.md +37 -3
- package/RISKS.md +37 -21
- package/SKILLS.md +4 -2
- package/USER_JOURNEYS.md +71 -22
- package/package.json +1 -1
- package/references/operations.md +2 -0
- package/references/runtime.md +2 -0
package/ADMINISTRATION.md
CHANGED
|
@@ -1,74 +1,67 @@
|
|
|
1
1
|
# Administration
|
|
2
2
|
|
|
3
|
-
Admin privileges and their scope in nana-address-registry-v6.
|
|
4
|
-
|
|
5
3
|
## At A Glance
|
|
6
4
|
|
|
7
5
|
| Item | Details |
|
|
8
|
-
|
|
9
|
-
| Scope | Permissionless
|
|
10
|
-
|
|
|
11
|
-
| Highest-risk actions |
|
|
12
|
-
| Recovery posture |
|
|
13
|
-
|
|
14
|
-
## Routine Operations
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| Scope | Permissionless provenance registration for CREATE and CREATE2 addresses |
|
|
8
|
+
| Control posture | Fully permissionless and adminless |
|
|
9
|
+
| Highest-risk actions | Incorrect first registration or bad derivation assumptions in offchain tooling |
|
|
10
|
+
| Recovery posture | No in-place recovery; replacement contract is the only fix for logic mistakes |
|
|
15
11
|
|
|
16
|
-
|
|
17
|
-
- Pair registry lookups with a separate trusted-deployer allowlist in clients or indexing infrastructure.
|
|
18
|
-
- Treat every registration as permissionless input, not proof that the caller was authorized by the deployer.
|
|
12
|
+
## Purpose
|
|
19
13
|
|
|
20
|
-
|
|
14
|
+
`nana-address-registry-v6` has no admin surface. It is a permissionless first-write provenance registry.
|
|
21
15
|
|
|
22
|
-
|
|
23
|
-
- A later registration can overwrite an earlier mapping for the same computed address.
|
|
24
|
-
- The registry does not verify that code is deployed at the registered address.
|
|
16
|
+
## Control Model
|
|
25
17
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
18
|
+
- No owner
|
|
19
|
+
- No governance
|
|
20
|
+
- No pause
|
|
21
|
+
- No upgrade
|
|
22
|
+
- Registration is permissionless and correctness comes from deterministic address derivation
|
|
30
23
|
|
|
31
24
|
## Roles
|
|
32
25
|
|
|
33
|
-
|
|
26
|
+
| Role | How Assigned | Scope | Notes |
|
|
27
|
+
| --- | --- | --- | --- |
|
|
28
|
+
| Anyone | No assignment | Global | Can register an address if they provide correct CREATE or CREATE2 inputs |
|
|
29
|
+
|
|
30
|
+
## Privileged Surfaces
|
|
34
31
|
|
|
35
|
-
|
|
32
|
+
There are no privileged functions. `registerAddress(...)` is permissionless for both CREATE and CREATE2 registration paths.
|
|
36
33
|
|
|
37
|
-
|
|
34
|
+
## Immutable And One-Way
|
|
38
35
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
| `registerAddress(address deployer, uint256 nonce)` | None | N/A | Global | Computes a `create` address from deployer + nonce and stores the deployer mapping |
|
|
42
|
-
| `registerAddress(address deployer, bytes32 salt, bytes bytecode)` | None | N/A | Global | Computes a `create2` address from deployer + salt + bytecode and stores the deployer mapping |
|
|
43
|
-
| `deployerOf(address)` | None | N/A | Global | View function — returns the registered deployer for a given address |
|
|
36
|
+
- Registration is first-write only.
|
|
37
|
+
- There is no overwrite or delete path for `deployerOf[address]`.
|
|
44
38
|
|
|
45
|
-
|
|
39
|
+
## Operational Notes
|
|
46
40
|
|
|
47
|
-
|
|
41
|
+
- Treat registration as provenance, not endorsement.
|
|
42
|
+
- Register addresses from trustworthy operational pipelines because bad first registration is sticky even though anyone can submit the correct derivation inputs.
|
|
48
43
|
|
|
49
|
-
|
|
50
|
-
- **No caller verification.** The registry does not check whether `msg.sender` is the deployer. It only verifies that the computed address is valid by storing the mapping.
|
|
51
|
-
- **Overwritable.** A second registration for the same computed address overwrites the previous deployer mapping. Last writer wins.
|
|
52
|
-
- **Permanent storage, no removal.** There is no `unregister` or `removeAddress` function. Entries can be overwritten but never deleted.
|
|
53
|
-
- **No approval or queue.** Registrations take effect immediately in the same transaction.
|
|
44
|
+
## Machine Notes
|
|
54
45
|
|
|
55
|
-
|
|
46
|
+
- Do not treat registration as a safety certification or allowlist signal.
|
|
47
|
+
- `src/JBAddressRegistry.sol` is the only control-relevant runtime file; there is no hidden owner path.
|
|
48
|
+
- If offchain derivation and onchain registration disagree, stop and resolve the derivation logic rather than assuming overwrite is possible.
|
|
56
49
|
|
|
57
|
-
|
|
50
|
+
## Recovery
|
|
58
51
|
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
- **Overwrite risk.** Since registrations are overwritable, a client that caches `deployerOf(addr)` at time T may see a different result at time T+1 if someone re-registers the same address with a different deployer/nonce or deployer/salt/bytecode combination. Clients should re-check at time of use rather than caching indefinitely.
|
|
62
|
-
- **No validation of deployment.** The registry computes the expected address from the inputs but does not verify that a contract actually exists at that address. A registration can be created for an address that has not yet been deployed (or will never be deployed).
|
|
52
|
+
- There is no admin recovery surface.
|
|
53
|
+
- If derivation logic were ever wrong, the contract would need replacement rather than intervention.
|
|
63
54
|
|
|
64
55
|
## Admin Boundaries
|
|
65
56
|
|
|
66
|
-
|
|
57
|
+
- Nobody can curate allowlists, edit entries, or block registration.
|
|
58
|
+
- Nobody can use this registry to certify code safety.
|
|
67
59
|
|
|
68
|
-
|
|
69
|
-
- **No upgrade path.** The contract is not proxied or upgradeable.
|
|
70
|
-
- **No fee extraction.** The contract holds no funds and collects no fees.
|
|
71
|
-
- **No blocklist.** No address can be prevented from registering.
|
|
72
|
-
- **No migration.** There is no way to transfer state to a new registry contract.
|
|
60
|
+
## Source Map
|
|
73
61
|
|
|
74
|
-
|
|
62
|
+
- `src/JBAddressRegistry.sol`
|
|
63
|
+
- `src/interfaces/IJBAddressRegistry.sol`
|
|
64
|
+
- `script/Deploy.s.sol`
|
|
65
|
+
- `script/helpers/AddressRegistryDeploymentLib.sol`
|
|
66
|
+
- `test/JBAddressRegistry_Fork.t.sol`
|
|
67
|
+
- `test/regression/NonceTruncation.t.sol`
|
package/ARCHITECTURE.md
CHANGED
|
@@ -2,47 +2,83 @@
|
|
|
2
2
|
|
|
3
3
|
## Purpose
|
|
4
4
|
|
|
5
|
-
`nana-address-registry-v6` is a
|
|
5
|
+
`nana-address-registry-v6` is a narrow provenance primitive. It records which deployer could have created a contract address by recomputing CREATE or CREATE2 derivation inputs and storing the verified result on-chain.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## System Overview
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- It does not manage upgrades, ownership, or deployment permissions.
|
|
11
|
-
- It only answers one question: "which deployer could have created this address?"
|
|
9
|
+
The repo is intentionally small. `JBAddressRegistry` accepts deterministic deployment inputs, reconstructs the resulting address, and records the deployer if that address has not already been registered. It does not judge code safety, manage upgrades, or gate deployments.
|
|
12
10
|
|
|
13
|
-
##
|
|
11
|
+
## Core Invariants
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
- Registration is permissionless because correctness comes from deterministic derivation, not caller authority.
|
|
14
|
+
- A contract address can only be registered once.
|
|
15
|
+
- Registration must fail until runtime code actually exists at the derived address.
|
|
16
|
+
- CREATE and CREATE2 derivation must match EVM rules exactly.
|
|
19
17
|
|
|
20
|
-
##
|
|
18
|
+
## Modules
|
|
19
|
+
|
|
20
|
+
| Module | Responsibility | Notes |
|
|
21
|
+
| --- | --- | --- |
|
|
22
|
+
| `JBAddressRegistry` | Address derivation and first-write provenance storage | Main contract |
|
|
23
|
+
| `IJBAddressRegistry` | Minimal lookup and registration interface | External surface |
|
|
24
|
+
|
|
25
|
+
## Trust Boundaries
|
|
26
|
+
|
|
27
|
+
- The registry attests to deterministic provenance, not code quality.
|
|
28
|
+
- It does not manage ownership, upgrades, or allowlists.
|
|
29
|
+
- External systems may trust its recorded provenance, so derivation correctness is the whole product.
|
|
30
|
+
|
|
31
|
+
## Critical Flows
|
|
32
|
+
|
|
33
|
+
### Register
|
|
21
34
|
|
|
22
35
|
```text
|
|
23
36
|
caller
|
|
24
|
-
->
|
|
37
|
+
-> supplies deployer plus CREATE nonce or CREATE2 salt and bytecode
|
|
25
38
|
-> registry recomputes the target address
|
|
26
|
-
-> registry
|
|
39
|
+
-> registry records the deployer if the address was previously unregistered
|
|
27
40
|
```
|
|
28
41
|
|
|
29
|
-
##
|
|
30
|
-
|
|
31
|
-
- Registration is permissionless because correctness comes from deterministic address derivation, not caller authority.
|
|
32
|
-
- Re-registration must stay impossible.
|
|
33
|
-
- CREATE and CREATE2 derivations must match EVM address derivation exactly; this repo is useless if the reconstruction is even slightly wrong.
|
|
34
|
-
|
|
35
|
-
## Where Complexity Lives
|
|
42
|
+
## Accounting Model
|
|
36
43
|
|
|
37
|
-
|
|
38
|
-
- The repo is simple enough that overengineering is a bigger risk than underengineering.
|
|
44
|
+
No economic accounting lives here. The only critical state is `deployerOf[address]`.
|
|
39
45
|
|
|
40
|
-
##
|
|
46
|
+
## Security Model
|
|
41
47
|
|
|
42
|
-
-
|
|
48
|
+
- The risk is concentrated in a small amount of address-derivation logic.
|
|
49
|
+
- The registry records the derived deployer, not the transaction caller. Mixing those concepts would turn provenance into an authority bug.
|
|
50
|
+
- Overengineering is more dangerous than minimal, auditable derivation code.
|
|
43
51
|
|
|
44
52
|
## Safe Change Guide
|
|
45
53
|
|
|
46
|
-
- Treat derivation
|
|
47
|
-
-
|
|
48
|
-
-
|
|
54
|
+
- Treat derivation code like cryptographic plumbing.
|
|
55
|
+
- Keep the undeployed-address check and first-write-only rule intact; they are part of the provenance guarantee, not optional hygiene.
|
|
56
|
+
- If nonce handling or bytecode hashing changes, keep CREATE and CREATE2 tests aligned.
|
|
57
|
+
- Do not expand the repo into an allowlist or trust-oracle system.
|
|
58
|
+
|
|
59
|
+
## Canonical Checks
|
|
60
|
+
|
|
61
|
+
- CREATE and CREATE2 derivation correctness:
|
|
62
|
+
`test/JBAddressRegistry.t.sol`
|
|
63
|
+
- edge-path validation and first-write behavior:
|
|
64
|
+
`test/JBAddressRegistryEdge.t.sol`
|
|
65
|
+
- pre-registration, frontrun, and undeployed-code defenses:
|
|
66
|
+
`test/audit/CodexFrontRunRegistrationDoS.t.sol`
|
|
67
|
+
- provenance abuse and zero-deployer edge cases:
|
|
68
|
+
`test/audit/CodexUnauthorizedRegistrar.t.sol`
|
|
69
|
+
`test/audit/ZeroDeployerRegistration.t.sol`
|
|
70
|
+
|
|
71
|
+
## Source Map
|
|
72
|
+
|
|
73
|
+
- `src/JBAddressRegistry.sol`
|
|
74
|
+
- `src/interfaces/IJBAddressRegistry.sol`
|
|
75
|
+
- `test/JBAddressRegistry.t.sol`
|
|
76
|
+
- `test/JBAddressRegistryEdge.t.sol`
|
|
77
|
+
- `test/audit/CodexFrontRunRegistrationDoS.t.sol`
|
|
78
|
+
- `test/audit/CodexUnauthorizedRegistrar.t.sol`
|
|
79
|
+
- `test/audit/ZeroDeployerRegistration.t.sol`
|
|
80
|
+
- `test/regression/NonceTruncation.t.sol`
|
|
81
|
+
- `script/Deploy.s.sol`
|
|
82
|
+
- `script/helpers/AddressRegistryDeploymentLib.sol`
|
|
83
|
+
- `references/runtime.md`
|
|
84
|
+
- `references/operations.md`
|
package/AUDIT_INSTRUCTIONS.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This repo is a small registry, but it participates in deployer verification across the ecosystem. Treat incorrect registration as a security boundary failure.
|
|
4
4
|
|
|
5
|
-
## Objective
|
|
5
|
+
## Audit Objective
|
|
6
6
|
|
|
7
7
|
Find issues that:
|
|
8
8
|
- let callers register contracts under the wrong deployer
|
|
@@ -15,14 +15,32 @@ Find issues that:
|
|
|
15
15
|
In scope:
|
|
16
16
|
- `src/JBAddressRegistry.sol`
|
|
17
17
|
- `src/interfaces/IJBAddressRegistry.sol`
|
|
18
|
-
- deployment
|
|
18
|
+
- all deployment helpers in `script/`
|
|
19
19
|
|
|
20
|
-
##
|
|
20
|
+
## Start Here
|
|
21
|
+
|
|
22
|
+
1. `src/JBAddressRegistry.sol`
|
|
23
|
+
2. `script/Deploy.s.sol`
|
|
24
|
+
|
|
25
|
+
## Security Model
|
|
21
26
|
|
|
22
27
|
The registry maps deployed addresses to the deployer that created them. Downstream repos use it to:
|
|
23
28
|
- validate provenance for clones or deterministically deployed instances
|
|
24
29
|
- discover whether a contract came from an approved deployer path
|
|
25
30
|
|
|
31
|
+
## Roles And Privileges
|
|
32
|
+
|
|
33
|
+
| Role | Powers | How constrained |
|
|
34
|
+
|------|--------|-----------------|
|
|
35
|
+
| Deployer | Register contracts as its outputs | Must prove authentic deployment provenance |
|
|
36
|
+
| Registry reader | Trust provenance for privileged decisions | Must not observe spoofable or mutable history |
|
|
37
|
+
|
|
38
|
+
## Integration Assumptions
|
|
39
|
+
|
|
40
|
+
| Dependency | Assumption | What breaks if wrong |
|
|
41
|
+
|------------|------------|----------------------|
|
|
42
|
+
| Approved deployers | Produce the addresses they claim | Downstream provenance gates become meaningless |
|
|
43
|
+
|
|
26
44
|
## Critical Invariants
|
|
27
45
|
|
|
28
46
|
1. Provenance cannot be forged
|
|
@@ -34,19 +52,15 @@ No aliasing or overwrite path should let a later caller replace provenance unexp
|
|
|
34
52
|
3. Registration metadata is stable
|
|
35
53
|
Nonce, salt, or address truncation must not allow collisions or stale reads.
|
|
36
54
|
|
|
37
|
-
##
|
|
55
|
+
## Attack Surfaces
|
|
38
56
|
|
|
39
|
-
|
|
57
|
+
- registration entrypoints that rely on deployer provenance
|
|
58
|
+
- overwrite and replay paths
|
|
59
|
+
- deterministic deployment assumptions
|
|
40
60
|
- zero-address or malformed registration attempts
|
|
41
|
-
- deterministic deployment edge cases
|
|
42
|
-
- overwrite or replay behavior
|
|
43
|
-
- any assumption that `msg.sender` is sufficient proof without deployment linkage
|
|
44
61
|
|
|
45
|
-
##
|
|
62
|
+
## Verification
|
|
46
63
|
|
|
47
|
-
Standard workflow:
|
|
48
64
|
- `npm install`
|
|
49
65
|
- `forge build`
|
|
50
66
|
- `forge test`
|
|
51
|
-
|
|
52
|
-
Tests already focus on zero deployers and nonce-truncation regressions. A meaningful finding here should show downstream trust in the registry becoming misplaced, not just a cosmetic mismatch.
|
package/README.md
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
# Juicebox Address Registry
|
|
2
2
|
|
|
3
|
-
`@bananapus/address-registry-v6` is a permissionless registry that records
|
|
3
|
+
`@bananapus/address-registry-v6` is a permissionless registry that records deployer provenance for contracts when callers provide matching `create` or `create2` deployment inputs. It is meant to make deployer provenance visible on-chain, especially for hooks and helper contracts that users may need to trust before interacting with them.
|
|
4
4
|
|
|
5
|
-
Architecture: [ARCHITECTURE.md](./ARCHITECTURE.md)
|
|
5
|
+
Architecture: [ARCHITECTURE.md](./ARCHITECTURE.md)
|
|
6
|
+
User journeys: [USER_JOURNEYS.md](./USER_JOURNEYS.md)
|
|
7
|
+
Skills: [SKILLS.md](./SKILLS.md)
|
|
8
|
+
Risks: [RISKS.md](./RISKS.md)
|
|
9
|
+
Administration: [ADMINISTRATION.md](./ADMINISTRATION.md)
|
|
10
|
+
Audit instructions: [AUDIT_INSTRUCTIONS.md](./AUDIT_INSTRUCTIONS.md)
|
|
6
11
|
|
|
7
12
|
## Overview
|
|
8
13
|
|
|
@@ -11,7 +16,7 @@ The registry supports both `create` and `create2` style deployments:
|
|
|
11
16
|
- for `create`, it reconstructs the deployed address from the deployer and nonce
|
|
12
17
|
- for `create2`, it reconstructs the deployed address from the deployer, salt, and deployment bytecode
|
|
13
18
|
|
|
14
|
-
Because the address is computed deterministically, registrations do not require access control. Anyone can submit the correct deployment inputs, and the registry records the
|
|
19
|
+
Because the address is computed deterministically, registrations do not require access control. Anyone can submit the correct deployment inputs, and the registry records the deployer for the computed address after confirming code already exists there.
|
|
15
20
|
|
|
16
21
|
Use this repo when deployer provenance matters. Do not confuse it with an allowlist, audit registry, or trust oracle.
|
|
17
22
|
|
|
@@ -33,6 +38,30 @@ The registry is intentionally narrow:
|
|
|
33
38
|
|
|
34
39
|
Anything beyond that is out of scope by design.
|
|
35
40
|
|
|
41
|
+
## Read These Files First
|
|
42
|
+
|
|
43
|
+
1. `src/JBAddressRegistry.sol`
|
|
44
|
+
2. `test/JBAddressRegistry.t.sol`
|
|
45
|
+
3. `test/JBAddressRegistryEdge.t.sol`
|
|
46
|
+
4. `test/audit/CodexFrontRunRegistrationDoS.t.sol`
|
|
47
|
+
|
|
48
|
+
## Integration Traps
|
|
49
|
+
|
|
50
|
+
- provenance is only meaningful if callers also know what the deployer is supposed to be trusted for
|
|
51
|
+
- permissionless registration is intentional, so integrations should verify the computed inputs rather than assuming caller authority
|
|
52
|
+
- `create` nonce reconstruction and `create2` salt-bytecode reconstruction are different trust paths and should be reasoned about separately
|
|
53
|
+
|
|
54
|
+
## Where State Lives
|
|
55
|
+
|
|
56
|
+
- deployer provenance lives in `JBAddressRegistry`
|
|
57
|
+
- deployment truth still lives outside this repo in the target chain history and bytecode inputs
|
|
58
|
+
|
|
59
|
+
## High-Signal Tests
|
|
60
|
+
|
|
61
|
+
1. `test/JBAddressRegistry.t.sol`
|
|
62
|
+
2. `test/JBAddressRegistryEdge.t.sol`
|
|
63
|
+
3. `test/audit/CodexUnauthorizedRegistrar.t.sol`
|
|
64
|
+
|
|
36
65
|
## Install
|
|
37
66
|
|
|
38
67
|
```bash
|
|
@@ -75,3 +104,8 @@ script/
|
|
|
75
104
|
- provenance is not the same thing as safety; a known deployer can still deploy unsafe code
|
|
76
105
|
- registrations are first-write only, so bad operational processes around initial registration can be sticky
|
|
77
106
|
- the `create` address path relies on nonce reconstruction and intentionally rejects unrealistic nonce ranges
|
|
107
|
+
|
|
108
|
+
## For AI Agents
|
|
109
|
+
|
|
110
|
+
- Describe this repo as a provenance registry, not as an allowlist or safety oracle.
|
|
111
|
+
- Read the edge and audit tests before making claims about frontrunning or unauthorized registration.
|
package/RISKS.md
CHANGED
|
@@ -1,42 +1,58 @@
|
|
|
1
1
|
# Juicebox Address Registry Risk Register
|
|
2
2
|
|
|
3
|
-
This file focuses on
|
|
3
|
+
This file focuses on what `JBAddressRegistry` actually proves: deterministic address provenance claims. The core risk is not funds loss inside the registry; it is consumers over-reading the meaning of a registration entry.
|
|
4
4
|
|
|
5
5
|
## How to use this file
|
|
6
6
|
|
|
7
|
-
- Read `Priority risks` first;
|
|
8
|
-
-
|
|
9
|
-
- Treat `Invariants to Verify` as the
|
|
7
|
+
- Read `Priority risks` first; most failures here are interpretive and integration-driven.
|
|
8
|
+
- Distinguish "address can be derived from these deployment inputs" from "this deployment is trusted".
|
|
9
|
+
- Treat `Invariants to Verify` as the narrow correctness envelope of the registry itself.
|
|
10
10
|
|
|
11
11
|
## Priority risks
|
|
12
12
|
|
|
13
13
|
| Priority | Risk | Why it matters | Primary controls |
|
|
14
14
|
|----------|------|----------------|------------------|
|
|
15
|
-
| P1 | Over-trusting registration as approval |
|
|
16
|
-
| P1 |
|
|
17
|
-
| P2 |
|
|
18
|
-
|
|
15
|
+
| P1 | Over-trusting registration as safety approval | A registered deployer mapping does not mean the contract is audited, canonical, or safe. | UIs must label registration as provenance evidence only. |
|
|
16
|
+
| P1 | First-writer capture of a valid provenance claim | The registry records the first valid claim for an address and never updates it. | Operational discipline for trusted deployers and curated allowlists for consumers. |
|
|
17
|
+
| P2 | Completeness assumptions | Unregistered contracts can still be legitimate; absence from the registry is not a proof of malice. | Treat registry data as additive metadata, not an allowlist. |
|
|
19
18
|
|
|
20
19
|
## 1. Trust Assumptions
|
|
21
20
|
|
|
22
|
-
- **
|
|
23
|
-
- **
|
|
21
|
+
- **Deterministic address formulas.** The contract trusts its CREATE and CREATE2 address-derivation logic to match EVM semantics.
|
|
22
|
+
- **Consumer trust policy.** The registry does not decide which deployers are trusted. Every consumer must maintain that policy externally.
|
|
24
23
|
|
|
25
24
|
## 2. Known Risks
|
|
26
25
|
|
|
27
|
-
- **
|
|
28
|
-
- **
|
|
29
|
-
- **
|
|
30
|
-
- **
|
|
26
|
+
- **Caller identity is irrelevant.** Anyone may call `registerAddress(...)`. The registry proves that an address is consistent with supplied deployment parameters, not that the caller was the deployer.
|
|
27
|
+
- **First registration wins.** Once `deployerOf[addr]` is set, later registrations revert with `JBAddressRegistry_AlreadyRegistered`, even if a different valid provenance claim exists.
|
|
28
|
+
- **No pre-registration of future deployments.** `registerAddress(...)` requires `addr.code.length != 0`. The registry only records provenance for contracts that already exist on-chain; it cannot reserve a deterministic CREATE2 address ahead of deployment.
|
|
29
|
+
- **No removal or correction path.** The registry is intentionally append-only per address. Mistakes are sticky.
|
|
30
|
+
- **Registration is provenance, not endorsement.** A mapping like `deployerOf[hook] = someFactory` says nothing about code safety, upgradeability, audit status, or whether the deployer itself is trustworthy.
|
|
31
|
+
- **Operational lag matters.** If a trusted deployer forgets to register immediately, someone else can publish the first valid claim for that address.
|
|
32
|
+
|
|
33
|
+
## 3. Integration Risks
|
|
34
|
+
|
|
35
|
+
- **Frontends must pair registry data with a trusted-deployer set.** Displaying `deployerOf` without a trust list can mislead users into treating any registered provenance as "official".
|
|
36
|
+
- **CREATE and CREATE2 claims are both parameter-based.** In either mode, users should think "the address is compatible with these inputs", not "the registry witnessed deployment".
|
|
37
|
+
- **Off-chain explorers should preserve uncertainty.** A better label is "registered deployer claim" than "deployed by", unless the explorer independently verified the transaction history.
|
|
38
|
+
|
|
39
|
+
## 4. Invariants to Verify
|
|
40
|
+
|
|
41
|
+
- `deployerOf[addr]` is set at most once.
|
|
42
|
+
- CREATE registrations only succeed for addresses derivable from the provided `(deployer, nonce)`.
|
|
43
|
+
- CREATE2 registrations only succeed for addresses derivable from the provided `(deployer, salt, bytecode)`.
|
|
44
|
+
- `_addressFrom` remains correct for the supported nonce range and reverts outside that range.
|
|
45
|
+
|
|
46
|
+
## 5. Accepted Behaviors
|
|
47
|
+
|
|
48
|
+
### 5.1 The registry does not authenticate the registrant
|
|
31
49
|
|
|
32
|
-
|
|
50
|
+
This is intentional. `JBAddressRegistry` is a deterministic provenance registry, not a permissioned attestation service.
|
|
33
51
|
|
|
34
|
-
|
|
35
|
-
- `create2` registrations: `deployerOf[addr]` corresponds to a valid deployer/salt/bytecode combination whose `keccak256(bytecode)` produces `addr` via the CREATE2 formula.
|
|
36
|
-
- Registration idempotency: `deployerOf[addr]` reflects the first and only registration. Subsequent attempts to register the same address revert with `JBAddressRegistry_AlreadyRegistered`.
|
|
52
|
+
### 5.2 Unregistered does not mean unsafe
|
|
37
53
|
|
|
38
|
-
|
|
54
|
+
The registry is useful metadata, but it is not complete coverage of all legitimate deployments. Consumers should not infer that an unregistered address is malicious solely because no entry exists.
|
|
39
55
|
|
|
40
|
-
###
|
|
56
|
+
### 5.3 The registry is retrospective, not a reservation layer
|
|
41
57
|
|
|
42
|
-
|
|
58
|
+
This is intentional. A deterministic address can only be registered after code already exists there. Consumers should not expect `JBAddressRegistry` to signal future deployment intent or to protect an undeployed CREATE2 address from later first-writer capture once deployment happens.
|
package/SKILLS.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
## Use This File For
|
|
4
4
|
|
|
5
5
|
- Use this file when the task involves deployer provenance, `create` or `create2` registration logic, or determining what the registry does and does not prove.
|
|
6
|
-
- Start here, then
|
|
6
|
+
- Start here, then decide whether the issue is `create` address derivation, `create2` derivation, or misuse of provenance as a trust signal.
|
|
7
7
|
|
|
8
8
|
## Read This Next
|
|
9
9
|
|
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
|---|---|
|
|
12
12
|
| Repo overview and intended guarantees | [`README.md`](./README.md), [`ARCHITECTURE.md`](./ARCHITECTURE.md) |
|
|
13
13
|
| Registry implementation | [`src/JBAddressRegistry.sol`](./src/JBAddressRegistry.sol) |
|
|
14
|
+
| Runtime and operational assumptions | [`references/runtime.md`](./references/runtime.md), [`references/operations.md`](./references/operations.md) |
|
|
14
15
|
| Interfaces and deployment | [`src/interfaces/`](./src/interfaces/), [`script/Deploy.s.sol`](./script/Deploy.s.sol) |
|
|
15
|
-
| Edge
|
|
16
|
+
| Edge and fork coverage | [`test/JBAddressRegistry.t.sol`](./test/JBAddressRegistry.t.sol), [`test/JBAddressRegistryEdge.t.sol`](./test/JBAddressRegistryEdge.t.sol), [`test/JBAddressRegistry_Fork.t.sol`](./test/JBAddressRegistry_Fork.t.sol) |
|
|
16
17
|
|
|
17
18
|
## Repo Map
|
|
18
19
|
|
|
@@ -36,4 +37,5 @@ Permissionless on-chain provenance registry that records which deployer created
|
|
|
36
37
|
|
|
37
38
|
- Start in [`src/JBAddressRegistry.sol`](./src/JBAddressRegistry.sol). This repo is intentionally small, so most questions should collapse quickly to the core contract.
|
|
38
39
|
- Treat provenance and safety as separate questions. The registry only proves who deployed something.
|
|
40
|
+
- Registration is first-write only and requires code to already exist at the computed address. Treat both as part of the registry’s guarantee, not just implementation details.
|
|
39
41
|
- When a task involves wrong or missing registry data, verify the registration inputs before assuming a contract bug.
|
package/USER_JOURNEYS.md
CHANGED
|
@@ -1,43 +1,92 @@
|
|
|
1
1
|
# User Journeys
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Repo Purpose
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
This repo records deployer provenance for contracts whose address can be reconstructed from `create` or `create2` inputs.
|
|
6
|
+
It does not say whether a deployment is safe, canonical, or approved. It only says who deployed it when the inputs are
|
|
7
|
+
correct and someone registered them.
|
|
8
|
+
|
|
9
|
+
## Primary Actors
|
|
10
|
+
|
|
11
|
+
- deployers who want onchain provenance for hooks, clones, and helper contracts
|
|
12
|
+
- integrators who need to verify who deployed an address before trusting it
|
|
13
|
+
- auditors who want a deterministic provenance check rather than offchain screenshots
|
|
14
|
+
|
|
15
|
+
## Key Surfaces
|
|
16
|
+
|
|
17
|
+
- `JBAddressRegistry`: stores `deployerOf[address]` after reconstructing the target address from deployment inputs
|
|
18
|
+
- `registerAddress(deployer, nonce)` and `registerAddress(deployer, salt, bytecode)`: the two provenance-registration paths
|
|
8
19
|
|
|
9
20
|
## Journey 1: Register A `CREATE` Deployment
|
|
10
21
|
|
|
11
|
-
**
|
|
22
|
+
**Actor:** deployer, operator, or auditor with the original deployment inputs.
|
|
23
|
+
|
|
24
|
+
**Intent:** bind an already-deployed `create` address to the account that deployed it.
|
|
25
|
+
|
|
26
|
+
**Preconditions**
|
|
27
|
+
- the contract was deployed with `create`
|
|
28
|
+
- the caller knows the deployer address and nonce used for the deployment
|
|
29
|
+
- the address has not already been registered
|
|
12
30
|
|
|
13
|
-
**
|
|
31
|
+
**Main Flow**
|
|
32
|
+
1. Call `registerAddress(deployer, nonce)`.
|
|
33
|
+
2. `JBAddressRegistry` reconstructs the deployed address from the deployer and nonce.
|
|
34
|
+
3. If the computed address is valid and unused, the registry stores `deployerOf[address] = deployer`.
|
|
14
35
|
|
|
15
|
-
**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
36
|
+
**Failure Modes**
|
|
37
|
+
- the nonce does not match the real deployment
|
|
38
|
+
- the computed address has already been registered
|
|
39
|
+
- the nonce exceeds the supported `uint64` range and registration reverts
|
|
40
|
+
- the deployment assumptions are wrong and the reconstructed address is useless
|
|
19
41
|
|
|
20
42
|
## Journey 2: Register A `CREATE2` Deployment
|
|
21
43
|
|
|
22
|
-
**
|
|
44
|
+
**Actor:** deployer, operator, or auditor with the original deterministic deployment inputs.
|
|
23
45
|
|
|
24
|
-
**
|
|
46
|
+
**Intent:** bind a `create2` deployment to its deployer without needing privileged access.
|
|
25
47
|
|
|
26
|
-
**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
48
|
+
**Preconditions**
|
|
49
|
+
- the contract was deployed with `create2`
|
|
50
|
+
- the caller knows the deployer, salt, and init code
|
|
51
|
+
- the address has not already been registered
|
|
52
|
+
|
|
53
|
+
**Main Flow**
|
|
54
|
+
1. Call `registerAddress(deployer, salt, bytecode)`.
|
|
55
|
+
2. The registry reconstructs the deterministic address from the standard `create2` formula.
|
|
56
|
+
3. If the address is valid and unused, the registry records the deployer.
|
|
57
|
+
|
|
58
|
+
**Failure Modes**
|
|
59
|
+
- the bytecode or salt is wrong
|
|
60
|
+
- the address was registered already
|
|
61
|
+
- a third party publishes the first valid provenance claim before the expected deployer registers it
|
|
62
|
+
- operators assume registration proves a contract exists there right now
|
|
63
|
+
- consumers misread provenance as an allowlist or audit stamp
|
|
30
64
|
|
|
31
65
|
## Journey 3: Resolve Provenance For An Existing Address
|
|
32
66
|
|
|
33
|
-
**
|
|
67
|
+
**Actor:** integrator, frontend, or auditor.
|
|
68
|
+
|
|
69
|
+
**Intent:** answer "who deployed this?" before trusting a hook, helper, or clone.
|
|
70
|
+
|
|
71
|
+
**Preconditions**
|
|
72
|
+
- the address was registered previously
|
|
73
|
+
- the caller understands that an empty result means "unknown" rather than "unsafe"
|
|
74
|
+
|
|
75
|
+
**Main Flow**
|
|
76
|
+
1. Query `deployerOf[address]`.
|
|
77
|
+
2. If a deployer is present, use it as provenance evidence for who originated the deployment.
|
|
78
|
+
3. If no deployer is present, treat the address as unregistered and keep investigating elsewhere.
|
|
79
|
+
4. Pair the result with an external trust list, transaction history, or audit context before relying on the contract.
|
|
80
|
+
|
|
81
|
+
**Postconditions**
|
|
82
|
+
- downstream reviewers know which deployer or factory to inspect next
|
|
83
|
+
- the trust decision still happens outside this repo
|
|
34
84
|
|
|
35
|
-
|
|
85
|
+
## Trust Boundaries
|
|
36
86
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
3. Treat absence as "not registered," not as a trust verdict on the code.
|
|
87
|
+
- this repo only proves registered deployer provenance from deterministic inputs
|
|
88
|
+
- anyone can submit a valid claim, so the mapping authenticates deployment inputs rather than caller identity
|
|
89
|
+
- it does not prove code quality, audit status, or governance approval
|
|
41
90
|
|
|
42
91
|
## Hand-Offs
|
|
43
92
|
|
package/package.json
CHANGED
package/references/operations.md
CHANGED
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
- If you edit `create` reconstruction logic, verify nonce-boundary behavior.
|
|
6
6
|
- If you edit `create2` behavior, verify bytecode hashing and salt assumptions.
|
|
7
7
|
- If a user asks whether a contract is "safe," redirect the question to code provenance plus code review, not the registry alone.
|
|
8
|
+
- If you change registration guards, re-read the audit tests before trusting a narrower unit proof.
|
|
8
9
|
|
|
9
10
|
## Common Failure Modes
|
|
10
11
|
|
|
11
12
|
- Operators confuse deployer provenance with trustworthiness.
|
|
12
13
|
- Registration is attempted with stale deployment inputs from another repo or environment.
|
|
14
|
+
- The wrong party is allowed to bind or front-run a computed address because the first-write assumption was weakened.
|
package/references/runtime.md
CHANGED
|
@@ -15,3 +15,5 @@
|
|
|
15
15
|
- [`test/JBAddressRegistry.t.sol`](../test/JBAddressRegistry.t.sol) for baseline behavior.
|
|
16
16
|
- [`test/JBAddressRegistryEdge.t.sol`](../test/JBAddressRegistryEdge.t.sol) for boundary conditions.
|
|
17
17
|
- [`test/JBAddressRegistry_Fork.t.sol`](../test/JBAddressRegistry_Fork.t.sol) for live assumptions.
|
|
18
|
+
- [`test/regression/NonceTruncation.t.sol`](../test/regression/NonceTruncation.t.sol) for nonce-width and reconstruction regressions.
|
|
19
|
+
- [`test/audit/ZeroDeployerRegistration.t.sol`](../test/audit/ZeroDeployerRegistration.t.sol), [`test/audit/CodexUnauthorizedRegistrar.t.sol`](../test/audit/CodexUnauthorizedRegistrar.t.sol), and [`test/audit/CodexFrontRunRegistrationDoS.t.sol`](../test/audit/CodexFrontRunRegistrationDoS.t.sol) for the abuse cases this repo is expected to resist.
|