@bananapus/address-registry-v6 0.0.26 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bananapus/address-registry-v6",
3
- "version": "0.0.26",
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/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, reviewable 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/regression/RegressionFrontRunRegistrationDoS.t.sol`
67
- - provenance abuse and zero-deployer edge cases:
68
- `test/regression/RegressionUnauthorizedRegistrar.t.sol`
69
- `test/regression/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/regression/RegressionFrontRunRegistrationDoS.t.sol`
78
- - `test/regression/RegressionUnauthorizedRegistrar.t.sol`
79
- - `test/regression/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`
@@ -1,69 +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
- There is a billion dollars of well-meaning projects' money in the Juicebox Money Engine, growing exponentially. Your job is to hack it before anyone else. Whoever hacks it first saves/steals the money, and you are obsessed with being this winner, while also being a steward of the protocol and wanting it to keep growing safely.
8
-
9
- Suggestions of where to look:
10
-
11
- - let callers register contracts under the wrong deployer
12
- - break determinism or uniqueness assumptions around registration
13
- - let callers spoof provenance for contracts the claimed deployer did not create
14
- - create truncation-related collisions or stale mapping assumptions
15
-
16
- ## Scope
17
-
18
- In scope:
19
-
20
- - `src/JBAddressRegistry.sol`
21
- - `src/interfaces/IJBAddressRegistry.sol`
22
- - all deployment helpers in `script/`
23
-
24
- ## Start Here
25
-
26
- 1. `src/JBAddressRegistry.sol`
27
- 2. `script/Deploy.s.sol`
28
-
29
- ## Security Model
30
-
31
- The registry maps deployed addresses to the deployer that created them. Downstream repos use it to:
32
-
33
- - validate provenance for clones or deterministically deployed instances
34
- - discover whether a contract came from an approved deployer path
35
-
36
- ## Roles And Privileges
37
-
38
- | Role | Powers | How constrained |
39
- |------|--------|-----------------|
40
- | Registrant | Register contracts by supplying deterministic deployment inputs | Must supply inputs that reconstruct an already-deployed contract address |
41
- | Registry reader | Interpret provenance for downstream decisions | Must pair provenance with an external trust model |
42
-
43
- ## Integration Assumptions
44
-
45
- | Dependency | Assumption | What breaks if wrong |
46
- |------------|------------|----------------------|
47
- | Approved deployers | Produce the addresses they claim | Downstream provenance gates become meaningless |
48
-
49
- ## Critical Invariants
50
-
51
- 1. Provenance cannot be forged.
52
- Only inputs matching the actual deployer path may create a successful registration for a contract.
53
- 2. One contract maps to one authoritative deployer record.
54
- No aliasing or overwrite path should let a later caller replace provenance unexpectedly.
55
- 3. Registration metadata is stable.
56
- Nonce, salt, or address truncation must not allow collisions or stale reads.
57
-
58
- ## Attack Surfaces
59
-
60
- - registration entrypoints that rely on deployer provenance
61
- - overwrite and replay paths
62
- - deterministic deployment assumptions
63
- - zero-address or malformed registration attempts
64
-
65
- ## Verification
66
-
67
- - `npm install`
68
- - `forge build`
69
- - `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 reviewed, 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, review 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.