@bananapus/address-registry-v6 0.0.25 → 0.0.28
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/README.md +5 -5
- package/foundry.toml +1 -0
- package/package.json +9 -2
- package/references/operations.md +1 -1
- package/references/runtime.md +1 -1
- package/script/Deploy.s.sol +1 -1
- package/script/helpers/AddressRegistryDeploymentLib.sol +2 -3
- package/src/JBAddressRegistry.sol +3 -2
- package/ADMINISTRATION.md +0 -67
- package/ARCHITECTURE.md +0 -84
- package/AUDIT_INSTRUCTIONS.md +0 -67
- package/CHANGELOG.md +0 -39
- package/RISKS.md +0 -58
- package/SKILLS.md +0 -41
- package/STYLE_GUIDE.md +0 -610
- package/USER_JOURNEYS.md +0 -92
- package/foundry.lock +0 -5
- package/slither-ci.config.json +0 -10
- package/sphinx.lock +0 -476
- package/test/JBAddressRegistry.t.sol +0 -104
- package/test/JBAddressRegistryEdge.t.sol +0 -407
- package/test/JBAddressRegistry_Fork.t.sol +0 -76
- package/test/audit/CodexFrontRunRegistrationDoS.t.sol +0 -76
- package/test/audit/CodexUnauthorizedRegistrar.t.sol +0 -59
- package/test/audit/DeploymentHelperNonceSideEffect.t.sol +0 -47
- package/test/audit/DeploymentHelperValidation.t.sol +0 -62
- package/test/audit/ZeroDeployerRegistration.t.sol +0 -31
- package/test/regression/NonceTruncation.t.sol +0 -109
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ The registry supports both `create` and `create2` deployments:
|
|
|
18
18
|
|
|
19
19
|
Because the address is computed deterministically, registrations do not need 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.
|
|
20
20
|
|
|
21
|
-
Use this repo when deployer provenance matters. Do not confuse it with an allowlist,
|
|
21
|
+
Use this repo when deployer provenance matters. Do not confuse it with an allowlist, review registry, or trust oracle.
|
|
22
22
|
|
|
23
23
|
If the question is "is this hook safe?" this repo can only tell you who deployed it, not whether the code is good.
|
|
24
24
|
|
|
@@ -43,7 +43,7 @@ Anything beyond that is out of scope.
|
|
|
43
43
|
1. `src/JBAddressRegistry.sol`
|
|
44
44
|
2. `test/JBAddressRegistry.t.sol`
|
|
45
45
|
3. `test/JBAddressRegistryEdge.t.sol`
|
|
46
|
-
4. `test/
|
|
46
|
+
4. `test/regression/RegressionFrontRunRegistrationDoS.t.sol`
|
|
47
47
|
|
|
48
48
|
## Integration Traps
|
|
49
49
|
|
|
@@ -60,7 +60,7 @@ Anything beyond that is out of scope.
|
|
|
60
60
|
|
|
61
61
|
1. `test/JBAddressRegistry.t.sol`
|
|
62
62
|
2. `test/JBAddressRegistryEdge.t.sol`
|
|
63
|
-
3. `test/
|
|
63
|
+
3. `test/regression/RegressionUnauthorizedRegistrar.t.sol`
|
|
64
64
|
|
|
65
65
|
## Install
|
|
66
66
|
|
|
@@ -93,7 +93,7 @@ src/
|
|
|
93
93
|
JBAddressRegistry.sol
|
|
94
94
|
interfaces/
|
|
95
95
|
test/
|
|
96
|
-
unit, edge, fork,
|
|
96
|
+
unit, edge, fork, review, and regression coverage
|
|
97
97
|
script/
|
|
98
98
|
Deploy.s.sol
|
|
99
99
|
helpers/
|
|
@@ -108,4 +108,4 @@ script/
|
|
|
108
108
|
## For AI Agents
|
|
109
109
|
|
|
110
110
|
- Describe this repo as a provenance registry, not as an allowlist or safety oracle.
|
|
111
|
-
- Read the edge and
|
|
111
|
+
- Read the edge and review tests before making claims about frontrunning or unauthorized registration.
|
package/foundry.toml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bananapus/address-registry-v6",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,5 +22,12 @@
|
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@sphinx-labs/plugins": "0.33.3"
|
|
25
|
-
}
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"foundry.toml",
|
|
28
|
+
"references/",
|
|
29
|
+
"remappings.txt",
|
|
30
|
+
"script/",
|
|
31
|
+
"src/"
|
|
32
|
+
]
|
|
26
33
|
}
|
package/references/operations.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
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
|
|
8
|
+
- If you change registration guards, re-read the review tests before trusting a narrower unit proof.
|
|
9
9
|
|
|
10
10
|
## Common Failure Modes
|
|
11
11
|
|
package/references/runtime.md
CHANGED
|
@@ -16,4 +16,4 @@
|
|
|
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
18
|
- [`test/regression/NonceTruncation.t.sol`](../test/regression/NonceTruncation.t.sol) for nonce-width and reconstruction regressions.
|
|
19
|
-
- [`test/
|
|
19
|
+
- [`test/regression/ZeroDeployerRegistration.t.sol`](../test/regression/ZeroDeployerRegistration.t.sol), [`test/regression/RegressionUnauthorizedRegistrar.t.sol`](../test/regression/RegressionUnauthorizedRegistrar.t.sol), and [`test/regression/RegressionFrontRunRegistrationDoS.t.sol`](../test/regression/RegressionFrontRunRegistrationDoS.t.sol) for the abuse cases this repo is expected to resist.
|
package/script/Deploy.s.sol
CHANGED
|
@@ -10,7 +10,7 @@ contract Deploy is Script, Sphinx {
|
|
|
10
10
|
bytes32 constant ADDRESS_REGISTRY_SALT = "_JBAddressRegistryV6_";
|
|
11
11
|
|
|
12
12
|
function configureSphinx() public override {
|
|
13
|
-
//
|
|
13
|
+
// Safe owners and threshold are resolved by the Sphinx project config.
|
|
14
14
|
sphinxConfig.projectName = "nana-address-registry-v6";
|
|
15
15
|
sphinxConfig.mainnets = ["ethereum", "optimism", "base", "arbitrum"];
|
|
16
16
|
sphinxConfig.testnets = ["ethereum_sepolia", "optimism_sepolia", "base_sepolia", "arbitrum_sepolia"];
|
|
@@ -19,11 +19,10 @@ library AddressRegistryDeploymentLib {
|
|
|
19
19
|
Vm internal constant vm = Vm(VM_ADDRESS);
|
|
20
20
|
|
|
21
21
|
function getDeployment(string memory path) internal returns (AddressRegistryDeployment memory deployment) {
|
|
22
|
-
//
|
|
22
|
+
// Match the current chain ID to the Sphinx network name used in deployment artifacts.
|
|
23
23
|
uint256 chainId = block.chainid;
|
|
24
24
|
|
|
25
|
-
//
|
|
26
|
-
// TODO: get constants without deploy.
|
|
25
|
+
// `SphinxConstants` exposes Sphinx's supported chain ID to network name mapping.
|
|
27
26
|
SphinxConstants sphinxConstants = new SphinxConstants();
|
|
28
27
|
NetworkInfo[] memory networks = sphinxConstants.getNetworkInfoArray();
|
|
29
28
|
|
|
@@ -22,7 +22,8 @@ contract JBAddressRegistry is IJBAddressRegistry {
|
|
|
22
22
|
error JBAddressRegistry_NonceTooLarge(uint256 nonce);
|
|
23
23
|
|
|
24
24
|
/// @notice Thrown when attempting to register with `address(0)` as the deployer.
|
|
25
|
-
|
|
25
|
+
/// @param deployer The invalid deployer address.
|
|
26
|
+
error JBAddressRegistry_ZeroDeployer(address deployer);
|
|
26
27
|
|
|
27
28
|
/// @notice Thrown when attempting to register an address before code exists there.
|
|
28
29
|
/// @param addr The undeployed address being registered.
|
|
@@ -80,7 +81,7 @@ contract JBAddressRegistry is IJBAddressRegistry {
|
|
|
80
81
|
/// @param deployer The deployer's address.
|
|
81
82
|
function _registerAddress(address addr, address deployer) internal {
|
|
82
83
|
// The registry only records non-zero deployers.
|
|
83
|
-
if (deployer == address(0)) revert JBAddressRegistry_ZeroDeployer();
|
|
84
|
+
if (deployer == address(0)) revert JBAddressRegistry_ZeroDeployer(deployer);
|
|
84
85
|
// The address must already contain runtime code before it can be registered.
|
|
85
86
|
if (addr.code.length == 0) revert JBAddressRegistry_AddressNotDeployed(addr);
|
|
86
87
|
// Each address can only be registered once.
|
package/ADMINISTRATION.md
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
# Administration
|
|
2
|
-
|
|
3
|
-
## At A Glance
|
|
4
|
-
|
|
5
|
-
| Item | Details |
|
|
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 |
|
|
11
|
-
|
|
12
|
-
## Purpose
|
|
13
|
-
|
|
14
|
-
`nana-address-registry-v6` has no admin surface. It is a permissionless first-write provenance registry.
|
|
15
|
-
|
|
16
|
-
## Control Model
|
|
17
|
-
|
|
18
|
-
- no owner
|
|
19
|
-
- no governance
|
|
20
|
-
- no pause
|
|
21
|
-
- no upgrade
|
|
22
|
-
- registration is permissionless and correctness comes from deterministic address derivation
|
|
23
|
-
|
|
24
|
-
## Roles
|
|
25
|
-
|
|
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
|
|
31
|
-
|
|
32
|
-
There are no privileged functions. `registerAddress(...)` is permissionless for both registration paths.
|
|
33
|
-
|
|
34
|
-
## Immutable And One-Way
|
|
35
|
-
|
|
36
|
-
- registration is first-write only
|
|
37
|
-
- there is no overwrite or delete path for `deployerOf[address]`
|
|
38
|
-
|
|
39
|
-
## Operational Notes
|
|
40
|
-
|
|
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
|
|
43
|
-
|
|
44
|
-
## Machine Notes
|
|
45
|
-
|
|
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, resolve the derivation logic rather than assuming overwrite is possible
|
|
49
|
-
|
|
50
|
-
## Recovery
|
|
51
|
-
|
|
52
|
-
- there is no admin recovery surface
|
|
53
|
-
- if derivation logic were ever wrong, the contract would need replacement rather than intervention
|
|
54
|
-
|
|
55
|
-
## Admin Boundaries
|
|
56
|
-
|
|
57
|
-
- nobody can curate allowlists, edit entries, or block registration
|
|
58
|
-
- nobody can use this registry to certify code safety
|
|
59
|
-
|
|
60
|
-
## Source Map
|
|
61
|
-
|
|
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
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
# Architecture
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
|
|
5
|
-
`nana-address-registry-v6` is a small provenance primitive. It records which deployer could have created a contract address by recomputing `CREATE` or `CREATE2` inputs and storing the verified result on-chain.
|
|
6
|
-
|
|
7
|
-
## System Overview
|
|
8
|
-
|
|
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.
|
|
10
|
-
|
|
11
|
-
## Core Invariants
|
|
12
|
-
|
|
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
|
|
17
|
-
|
|
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
|
|
34
|
-
|
|
35
|
-
```text
|
|
36
|
-
caller
|
|
37
|
-
-> supplies deployer plus CREATE nonce or CREATE2 salt and bytecode
|
|
38
|
-
-> registry recomputes the target address
|
|
39
|
-
-> registry records the deployer if the address was previously unregistered
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Accounting Model
|
|
43
|
-
|
|
44
|
-
No economic accounting lives here. The only important state is `deployerOf[address]`.
|
|
45
|
-
|
|
46
|
-
## Security Model
|
|
47
|
-
|
|
48
|
-
- the risk is concentrated in a small amount of address-derivation logic
|
|
49
|
-
- the registry records the derived deployer, not the transaction caller
|
|
50
|
-
- overengineering is more dangerous than minimal, auditable derivation code
|
|
51
|
-
|
|
52
|
-
## Safe Change Guide
|
|
53
|
-
|
|
54
|
-
- treat derivation code like cryptographic plumbing
|
|
55
|
-
- keep the undeployed-address check and first-write-only rule intact
|
|
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
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
# Audit Instructions
|
|
2
|
-
|
|
3
|
-
This repo is a small registry, but it sits on a deployer-verification boundary across the ecosystem. Treat incorrect registration as a security failure.
|
|
4
|
-
|
|
5
|
-
## Audit Objective
|
|
6
|
-
|
|
7
|
-
Find issues that:
|
|
8
|
-
|
|
9
|
-
- let callers register contracts under the wrong deployer
|
|
10
|
-
- break determinism or uniqueness assumptions around registration
|
|
11
|
-
- let callers spoof provenance for contracts the claimed deployer did not create
|
|
12
|
-
- create truncation-related collisions or stale mapping assumptions
|
|
13
|
-
|
|
14
|
-
## Scope
|
|
15
|
-
|
|
16
|
-
In scope:
|
|
17
|
-
|
|
18
|
-
- `src/JBAddressRegistry.sol`
|
|
19
|
-
- `src/interfaces/IJBAddressRegistry.sol`
|
|
20
|
-
- all deployment helpers in `script/`
|
|
21
|
-
|
|
22
|
-
## Start Here
|
|
23
|
-
|
|
24
|
-
1. `src/JBAddressRegistry.sol`
|
|
25
|
-
2. `script/Deploy.s.sol`
|
|
26
|
-
|
|
27
|
-
## Security Model
|
|
28
|
-
|
|
29
|
-
The registry maps deployed addresses to the deployer that created them. Downstream repos use it to:
|
|
30
|
-
|
|
31
|
-
- validate provenance for clones or deterministically deployed instances
|
|
32
|
-
- discover whether a contract came from an approved deployer path
|
|
33
|
-
|
|
34
|
-
## Roles And Privileges
|
|
35
|
-
|
|
36
|
-
| Role | Powers | How constrained |
|
|
37
|
-
|------|--------|-----------------|
|
|
38
|
-
| Registrant | Register contracts by supplying deterministic deployment inputs | Must supply inputs that reconstruct an already-deployed contract address |
|
|
39
|
-
| Registry reader | Interpret provenance for downstream decisions | Must pair provenance with an external trust model |
|
|
40
|
-
|
|
41
|
-
## Integration Assumptions
|
|
42
|
-
|
|
43
|
-
| Dependency | Assumption | What breaks if wrong |
|
|
44
|
-
|------------|------------|----------------------|
|
|
45
|
-
| Approved deployers | Produce the addresses they claim | Downstream provenance gates become meaningless |
|
|
46
|
-
|
|
47
|
-
## Critical Invariants
|
|
48
|
-
|
|
49
|
-
1. Provenance cannot be forged.
|
|
50
|
-
Only inputs matching the actual deployer path may create a successful registration for a contract.
|
|
51
|
-
2. One contract maps to one authoritative deployer record.
|
|
52
|
-
No aliasing or overwrite path should let a later caller replace provenance unexpectedly.
|
|
53
|
-
3. Registration metadata is stable.
|
|
54
|
-
Nonce, salt, or address truncation must not allow collisions or stale reads.
|
|
55
|
-
|
|
56
|
-
## Attack Surfaces
|
|
57
|
-
|
|
58
|
-
- registration entrypoints that rely on deployer provenance
|
|
59
|
-
- overwrite and replay paths
|
|
60
|
-
- deterministic deployment assumptions
|
|
61
|
-
- zero-address or malformed registration attempts
|
|
62
|
-
|
|
63
|
-
## Verification
|
|
64
|
-
|
|
65
|
-
- `npm install`
|
|
66
|
-
- `forge build`
|
|
67
|
-
- `forge test`
|
package/CHANGELOG.md
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## Scope
|
|
4
|
-
|
|
5
|
-
This file describes the verified change from `nana-address-registry-v5` to the current `nana-address-registry-v6` repo.
|
|
6
|
-
|
|
7
|
-
## Current v6 surface
|
|
8
|
-
|
|
9
|
-
- `JBAddressRegistry`
|
|
10
|
-
- `IJBAddressRegistry`
|
|
11
|
-
|
|
12
|
-
## Summary
|
|
13
|
-
|
|
14
|
-
- Nonce handling is safer than in v5. The registry now guards against oversized nonces instead of silently producing the wrong derived address once the old encoding assumptions stopped holding.
|
|
15
|
-
- Zero-address deployers are explicitly rejected.
|
|
16
|
-
- The external surface remains intentionally small. This repo changed behavior more than shape.
|
|
17
|
-
- The repo moved from the v5 Solidity baseline to `0.8.28`.
|
|
18
|
-
|
|
19
|
-
## Verified deltas
|
|
20
|
-
|
|
21
|
-
- `_addressFrom(...)` now supports RLP nonce encoding through `uint64` instead of stopping at the old `uint32` path.
|
|
22
|
-
- `JBAddressRegistry_NonceTooLarge(uint256)` is thrown above that supported range.
|
|
23
|
-
- `JBAddressRegistry_ZeroDeployer()` is thrown when trying to register against `address(0)`.
|
|
24
|
-
- Duplicate registration now explicitly reverts with `JBAddressRegistry_AlreadyRegistered(address)`.
|
|
25
|
-
|
|
26
|
-
## Breaking ABI changes
|
|
27
|
-
|
|
28
|
-
- There is no meaningful function-selector migration here.
|
|
29
|
-
- The practical ABI-visible change is new custom errors that callers and tooling may need to decode.
|
|
30
|
-
|
|
31
|
-
## Indexer impact
|
|
32
|
-
|
|
33
|
-
- Event shape is effectively unchanged.
|
|
34
|
-
- The real migration concern is stricter revert behavior for previously tolerated bad inputs.
|
|
35
|
-
|
|
36
|
-
## Migration notes
|
|
37
|
-
|
|
38
|
-
- If you treated this repo as ABI-stable, that is mostly still true, but behavior around bad inputs is stricter.
|
|
39
|
-
- Recheck any tool that depended on silent high-nonce behavior. v6 makes that path explicit instead of permissive.
|
package/RISKS.md
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# Juicebox Address Registry Risk Register
|
|
2
|
-
|
|
3
|
-
This file covers what `JBAddressRegistry` actually proves: deterministic address provenance claims. The main risk is not funds loss inside the registry. It is consumers reading too much into a registration entry.
|
|
4
|
-
|
|
5
|
-
## How To Use This File
|
|
6
|
-
|
|
7
|
-
- Read `Priority risks` first. Most failures here are interpretation and integration failures.
|
|
8
|
-
- Distinguish "address can be derived from these inputs" from "this deployment is trusted."
|
|
9
|
-
- Treat `Invariants to verify` as the narrow correctness envelope of the registry itself.
|
|
10
|
-
|
|
11
|
-
## Priority Risks
|
|
12
|
-
|
|
13
|
-
| Priority | Risk | Why it matters | Primary controls |
|
|
14
|
-
|----------|------|----------------|------------------|
|
|
15
|
-
| P1 | Over-trusting registration as safety approval | A registered deployer mapping does not mean the contract is audited, canonical, or safe. | UIs should 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 proof of malice. | Treat registry data as additive metadata, not an allowlist. |
|
|
18
|
-
|
|
19
|
-
## 1. Trust Assumptions
|
|
20
|
-
|
|
21
|
-
- **Deterministic address formulas are correct.** The contract trusts its `CREATE` and `CREATE2` derivation logic to match EVM semantics.
|
|
22
|
-
- **Consumers define trust externally.** The registry does not decide which deployers are trusted.
|
|
23
|
-
|
|
24
|
-
## 2. Known Risks
|
|
25
|
-
|
|
26
|
-
- **Caller identity is irrelevant.** Anyone may call `registerAddress(...)`. The registry proves that an address matches supplied deployment parameters, not that the caller was the deployer.
|
|
27
|
-
- **First registration wins.** Once `deployerOf[addr]` is set, later registrations revert.
|
|
28
|
-
- **No pre-registration of future deployments.** `registerAddress(...)` requires code to already exist at the computed address.
|
|
29
|
-
- **No removal or correction path.** The registry is intentionally append-only per address.
|
|
30
|
-
- **Registration is provenance, not endorsement.** `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 should pair registry data with a trusted-deployer set.** Displaying `deployerOf` alone can mislead users into treating any registered provenance as official.
|
|
36
|
-
- **`CREATE` and `CREATE2` claims are parameter-based.** In either mode, the right mental model is "the address is compatible with these inputs," not "the registry witnessed deployment."
|
|
37
|
-
- **Off-chain explorers should preserve uncertainty.** "Registered deployer claim" is a safer label than "deployed by" unless the explorer also verified chain 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
|
|
49
|
-
|
|
50
|
-
This is intentional. `JBAddressRegistry` is a deterministic provenance registry, not a permissioned attestation service.
|
|
51
|
-
|
|
52
|
-
### 5.2 Unregistered does not mean unsafe
|
|
53
|
-
|
|
54
|
-
The registry is useful metadata, but it does not cover every legitimate deployment. Consumers should not infer that an unregistered address is malicious just because no entry exists.
|
|
55
|
-
|
|
56
|
-
### 5.3 The registry is retrospective, not a reservation layer
|
|
57
|
-
|
|
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 protect an undeployed `CREATE2` address from later first-writer capture.
|
package/SKILLS.md
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Juicebox Address Registry
|
|
2
|
-
|
|
3
|
-
## Use This File For
|
|
4
|
-
|
|
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 decide whether the issue is `create` address derivation, `create2` derivation, or misuse of provenance as a trust signal.
|
|
7
|
-
|
|
8
|
-
## Read This Next
|
|
9
|
-
|
|
10
|
-
| If you need... | Open this next |
|
|
11
|
-
|---|---|
|
|
12
|
-
| Repo overview and intended guarantees | [`README.md`](./README.md), [`ARCHITECTURE.md`](./ARCHITECTURE.md) |
|
|
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) |
|
|
15
|
-
| Interfaces and deployment | [`src/interfaces/`](./src/interfaces/), [`script/Deploy.s.sol`](./script/Deploy.s.sol) |
|
|
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) |
|
|
17
|
-
|
|
18
|
-
## Repo Map
|
|
19
|
-
|
|
20
|
-
| Area | Where to look |
|
|
21
|
-
|---|---|
|
|
22
|
-
| Main contract | [`src/JBAddressRegistry.sol`](./src/JBAddressRegistry.sol) |
|
|
23
|
-
| Interfaces | [`src/interfaces/`](./src/interfaces/) |
|
|
24
|
-
| Scripts | [`script/`](./script/) |
|
|
25
|
-
| Tests | [`test/`](./test/) |
|
|
26
|
-
|
|
27
|
-
## Purpose
|
|
28
|
-
|
|
29
|
-
Permissionless on-chain provenance registry that records which deployer created a contract by reconstructing deterministic `create` or `create2` addresses from the supplied deployment inputs.
|
|
30
|
-
|
|
31
|
-
## Reference Files
|
|
32
|
-
|
|
33
|
-
- Open [`references/runtime.md`](./references/runtime.md) when you need the core guarantees, first-write semantics, or the difference between provenance and trust.
|
|
34
|
-
- Open [`references/operations.md`](./references/operations.md) when you need deployment breadcrumbs, test pointers, or common stale assumptions about what the registry can verify.
|
|
35
|
-
|
|
36
|
-
## Working Rules
|
|
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.
|
|
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.
|
|
41
|
-
- When a task involves wrong or missing registry data, verify the registration inputs before assuming a contract bug.
|