@bananapus/address-registry-v6 0.0.18 → 0.0.20

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 CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  | Item | Details |
6
6
  | --- | --- |
7
- | Scope | Permissionless provenance registration for CREATE and CREATE2 addresses |
7
+ | Scope | Permissionless provenance registration for `CREATE` and `CREATE2` addresses |
8
8
  | Control posture | Fully permissionless and adminless |
9
9
  | Highest-risk actions | Incorrect first registration or bad derivation assumptions in offchain tooling |
10
10
  | Recovery posture | No in-place recovery; replacement contract is the only fix for logic mistakes |
@@ -15,47 +15,47 @@
15
15
 
16
16
  ## Control Model
17
17
 
18
- - No owner
19
- - No governance
20
- - No pause
21
- - No upgrade
22
- - Registration is permissionless and correctness comes from deterministic address derivation
18
+ - no owner
19
+ - no governance
20
+ - no pause
21
+ - no upgrade
22
+ - registration is permissionless and correctness comes from deterministic address derivation
23
23
 
24
24
  ## Roles
25
25
 
26
26
  | Role | How Assigned | Scope | Notes |
27
27
  | --- | --- | --- | --- |
28
- | Anyone | No assignment | Global | Can register an address if they provide correct CREATE or CREATE2 inputs |
28
+ | Anyone | No assignment | Global | Can register an address if they provide correct `CREATE` or `CREATE2` inputs |
29
29
 
30
30
  ## Privileged Surfaces
31
31
 
32
- There are no privileged functions. `registerAddress(...)` is permissionless for both CREATE and CREATE2 registration paths.
32
+ There are no privileged functions. `registerAddress(...)` is permissionless for both registration paths.
33
33
 
34
34
  ## Immutable And One-Way
35
35
 
36
- - Registration is first-write only.
37
- - There is no overwrite or delete path for `deployerOf[address]`.
36
+ - registration is first-write only
37
+ - there is no overwrite or delete path for `deployerOf[address]`
38
38
 
39
39
  ## Operational Notes
40
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.
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
43
 
44
44
  ## Machine Notes
45
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, stop and resolve the derivation logic rather than assuming overwrite is possible.
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
49
 
50
50
  ## Recovery
51
51
 
52
- - There is no admin recovery surface.
53
- - If derivation logic were ever wrong, the contract would need replacement rather than intervention.
52
+ - there is no admin recovery surface
53
+ - if derivation logic were ever wrong, the contract would need replacement rather than intervention
54
54
 
55
55
  ## Admin Boundaries
56
56
 
57
- - Nobody can curate allowlists, edit entries, or block registration.
58
- - Nobody can use this registry to certify code safety.
57
+ - nobody can curate allowlists, edit entries, or block registration
58
+ - nobody can use this registry to certify code safety
59
59
 
60
60
  ## Source Map
61
61
 
package/ARCHITECTURE.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Purpose
4
4
 
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.
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
6
 
7
7
  ## System Overview
8
8
 
@@ -10,10 +10,10 @@ The repo is intentionally small. `JBAddressRegistry` accepts deterministic deplo
10
10
 
11
11
  ## Core Invariants
12
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.
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
17
 
18
18
  ## Modules
19
19
 
@@ -24,9 +24,9 @@ The repo is intentionally small. `JBAddressRegistry` accepts deterministic deplo
24
24
 
25
25
  ## Trust Boundaries
26
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.
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
30
 
31
31
  ## Critical Flows
32
32
 
@@ -41,24 +41,24 @@ caller
41
41
 
42
42
  ## Accounting Model
43
43
 
44
- No economic accounting lives here. The only critical state is `deployerOf[address]`.
44
+ No economic accounting lives here. The only important state is `deployerOf[address]`.
45
45
 
46
46
  ## Security Model
47
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. Mixing those concepts would turn provenance into an authority bug.
50
- - Overengineering is more dangerous than minimal, auditable derivation code.
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
51
 
52
52
  ## Safe Change Guide
53
53
 
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.
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
58
 
59
59
  ## Canonical Checks
60
60
 
61
- - CREATE and CREATE2 derivation correctness:
61
+ - `CREATE` and `CREATE2` derivation correctness:
62
62
  `test/JBAddressRegistry.t.sol`
63
63
  - edge-path validation and first-write behavior:
64
64
  `test/JBAddressRegistryEdge.t.sol`
@@ -1,18 +1,20 @@
1
1
  # Audit Instructions
2
2
 
3
- This repo is a small registry, but it participates in deployer verification across the ecosystem. Treat incorrect registration as a security boundary failure.
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
4
 
5
5
  ## Audit Objective
6
6
 
7
7
  Find issues that:
8
+
8
9
  - let callers register contracts under the wrong deployer
9
10
  - break determinism or uniqueness assumptions around registration
10
11
  - let a malicious deployer spoof provenance for contracts it did not create
11
- - create stale or truncation-related collisions in recorded mappings
12
+ - create truncation-related collisions or stale mapping assumptions
12
13
 
13
14
  ## Scope
14
15
 
15
16
  In scope:
17
+
16
18
  - `src/JBAddressRegistry.sol`
17
19
  - `src/interfaces/IJBAddressRegistry.sol`
18
20
  - all deployment helpers in `script/`
@@ -25,6 +27,7 @@ In scope:
25
27
  ## Security Model
26
28
 
27
29
  The registry maps deployed addresses to the deployer that created them. Downstream repos use it to:
30
+
28
31
  - validate provenance for clones or deterministically deployed instances
29
32
  - discover whether a contract came from an approved deployer path
30
33
 
@@ -43,14 +46,12 @@ The registry maps deployed addresses to the deployer that created them. Downstre
43
46
 
44
47
  ## Critical Invariants
45
48
 
46
- 1. Provenance cannot be forged
47
- Only the actual deployer path the registry intends to trust may create a successful registration for a contract.
48
-
49
- 2. One contract maps to one authoritative deployer record
50
- No aliasing or overwrite path should let a later caller replace provenance unexpectedly.
51
-
52
- 3. Registration metadata is stable
53
- Nonce, salt, or address truncation must not allow collisions or stale reads.
49
+ 1. Provenance cannot be forged.
50
+ Only the actual deployer path the registry intends to trust 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.
54
55
 
55
56
  ## Attack Surfaces
56
57
 
package/README.md CHANGED
@@ -11,12 +11,12 @@ Audit instructions: [AUDIT_INSTRUCTIONS.md](./AUDIT_INSTRUCTIONS.md)
11
11
 
12
12
  ## Overview
13
13
 
14
- The registry supports both `create` and `create2` style deployments:
14
+ The registry supports both `create` and `create2` deployments:
15
15
 
16
16
  - for `create`, it reconstructs the deployed address from the deployer and nonce
17
17
  - for `create2`, it reconstructs the deployed address from the deployer, salt, and deployment bytecode
18
18
 
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.
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
21
  Use this repo when deployer provenance matters. Do not confuse it with an allowlist, audit registry, or trust oracle.
22
22
 
@@ -36,7 +36,7 @@ The registry is intentionally narrow:
36
36
  2. bind that address to a deployer once
37
37
  3. expose the result for other systems and clients
38
38
 
39
- Anything beyond that is out of scope by design.
39
+ Anything beyond that is out of scope.
40
40
 
41
41
  ## Read These Files First
42
42
 
@@ -47,14 +47,14 @@ Anything beyond that is out of scope by design.
47
47
 
48
48
  ## Integration Traps
49
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
50
+ - provenance is only useful if callers also know what the deployer is trusted for
51
+ - permissionless registration is intentional, so integrations should verify the computed inputs rather than assume caller authority
52
52
  - `create` nonce reconstruction and `create2` salt-bytecode reconstruction are different trust paths and should be reasoned about separately
53
53
 
54
54
  ## Where State Lives
55
55
 
56
- - deployer provenance lives in `JBAddressRegistry`
57
- - deployment truth still lives outside this repo in the target chain history and bytecode inputs
56
+ - deployer provenance: `JBAddressRegistry`
57
+ - deployment truth: the target chain history and bytecode inputs outside this repo
58
58
 
59
59
  ## High-Signal Tests
60
60
 
@@ -101,9 +101,9 @@ script/
101
101
 
102
102
  ## Risks And Notes
103
103
 
104
- - provenance is not the same thing as safety; a known deployer can still deploy unsafe code
105
- - registrations are first-write only, so bad operational processes around initial registration can be sticky
106
- - the `create` address path relies on nonce reconstruction and intentionally rejects unrealistic nonce ranges
104
+ - provenance is not the same as safety; a known deployer can still deploy unsafe code
105
+ - registrations are first-write only, so bad initial registration is sticky
106
+ - the `create` path relies on nonce reconstruction and intentionally rejects unrealistic nonce ranges
107
107
 
108
108
  ## For AI Agents
109
109
 
package/RISKS.md CHANGED
@@ -1,47 +1,47 @@
1
1
  # Juicebox Address Registry Risk Register
2
2
 
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.
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
4
 
5
- ## How to use this file
5
+ ## How To Use This File
6
6
 
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.
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
10
 
11
- ## Priority risks
11
+ ## Priority Risks
12
12
 
13
13
  | Priority | Risk | Why it matters | Primary controls |
14
14
  |----------|------|----------------|------------------|
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. |
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
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. |
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
18
 
19
19
  ## 1. Trust Assumptions
20
20
 
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.
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
23
 
24
24
  ## 2. Known Risks
25
25
 
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.
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
31
  - **Operational lag matters.** If a trusted deployer forgets to register immediately, someone else can publish the first valid claim for that address.
32
32
 
33
33
  ## 3. Integration Risks
34
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.
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
38
 
39
- ## 4. Invariants to Verify
39
+ ## 4. Invariants To Verify
40
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.
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
45
 
46
46
  ## 5. Accepted Behaviors
47
47
 
@@ -51,8 +51,8 @@ This is intentional. `JBAddressRegistry` is a deterministic provenance registry,
51
51
 
52
52
  ### 5.2 Unregistered does not mean unsafe
53
53
 
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.
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
55
 
56
56
  ### 5.3 The registry is retrospective, not a reservation layer
57
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 to protect an undeployed CREATE2 address from later first-writer capture once deployment happens.
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 CHANGED
@@ -31,11 +31,11 @@ Permissionless on-chain provenance registry that records which deployer created
31
31
  ## Reference Files
32
32
 
33
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 the common stale assumptions around what the registry can verify.
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
35
 
36
36
  ## Working Rules
37
37
 
38
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
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.
40
+ - Registration is first-write only and requires code to already exist at the computed address.
41
41
  - When a task involves wrong or missing registry data, verify the registration inputs before assuming a contract bug.
package/USER_JOURNEYS.md CHANGED
@@ -2,15 +2,13 @@
2
2
 
3
3
  ## Repo Purpose
4
4
 
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.
5
+ This repo records deployer provenance for contracts whose address can be reconstructed from `create` or `create2` inputs. It does not say whether a deployment is safe, canonical, or approved. It only says who deployed it when the inputs are correct and someone registered them.
8
6
 
9
7
  ## Primary Actors
10
8
 
11
9
  - deployers who want onchain provenance for hooks, clones, and helper contracts
12
10
  - integrators who need to verify who deployed an address before trusting it
13
- - auditors who want a deterministic provenance check rather than offchain screenshots
11
+ - auditors who want a deterministic provenance check instead of offchain screenshots
14
12
 
15
13
  ## Key Surfaces
16
14
 
@@ -43,7 +41,7 @@ correct and someone registered them.
43
41
 
44
42
  **Actor:** deployer, operator, or auditor with the original deterministic deployment inputs.
45
43
 
46
- **Intent:** bind a `create2` deployment to its deployer without needing privileged access.
44
+ **Intent:** bind a `create2` deployment to its deployer without privileged access.
47
45
 
48
46
  **Preconditions**
49
47
  - the contract was deployed with `create2`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bananapus/address-registry-v6",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -72,6 +72,8 @@ library AddressRegistryDeploymentLib {
72
72
  string memory deploymentJson =
73
73
  // forge-lint: disable-next-line(unsafe-cheatcode)
74
74
  vm.readFile(string.concat(path, projectName, "/", networkName, "/", contractName, ".json"));
75
- return stdJson.readAddress({json: deploymentJson, key: ".address"});
75
+ address deployed = stdJson.readAddress({json: deploymentJson, key: ".address"});
76
+ require(deployed.code.length != 0, "AddressRegistryDeploymentLib: registry has no code");
77
+ return deployed;
76
78
  }
77
79
  }
@@ -0,0 +1,62 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity 0.8.28;
3
+
4
+ import {Test} from "forge-std/Test.sol";
5
+ import {stdJson} from "forge-std/Script.sol";
6
+
7
+ import {
8
+ AddressRegistryDeploymentLib,
9
+ AddressRegistryDeployment
10
+ } from "../../script/helpers/AddressRegistryDeploymentLib.sol";
11
+
12
+ /// @notice Wrapper that makes the library's internal functions callable externally so vm.expectRevert works.
13
+ contract DeploymentLibCaller {
14
+ function getDeployment(
15
+ string memory path,
16
+ string memory networkName
17
+ )
18
+ external
19
+ returns (AddressRegistryDeployment memory)
20
+ {
21
+ return AddressRegistryDeploymentLib.getDeployment({path: path, networkName: networkName});
22
+ }
23
+ }
24
+
25
+ /// @notice Tests M-40: Deployment helper rejects stale artifacts pointing to non-contract addresses.
26
+ contract DeploymentHelperValidationTest is Test {
27
+ DeploymentLibCaller internal caller;
28
+
29
+ function setUp() public {
30
+ caller = new DeploymentLibCaller();
31
+ }
32
+
33
+ /// @notice Stale deployment artifact pointing to an EOA reverts.
34
+ function test_deploymentHelper_revertsForEOARegistry() external {
35
+ address eoa = makeAddr("staleEOA");
36
+ string memory json = string.concat('{"address":"', vm.toString(eoa), '"}');
37
+
38
+ string memory dir = "test/audit/tmp-eoa/nana-address-registry-v6/testnet/";
39
+ vm.createDir(dir, true);
40
+ vm.writeFile(string.concat(dir, "JBAddressRegistry.json"), json);
41
+
42
+ vm.expectRevert("AddressRegistryDeploymentLib: registry has no code");
43
+ caller.getDeployment({path: "test/audit/tmp-eoa/", networkName: "testnet"});
44
+
45
+ vm.removeFile(string.concat(dir, "JBAddressRegistry.json"));
46
+ }
47
+
48
+ /// @notice Valid deployment artifact with a contract address is accepted.
49
+ function test_deploymentHelper_acceptsContractRegistry() external {
50
+ address registry = makeAddr("registryContract");
51
+ vm.etch(registry, hex"6080604052");
52
+ string memory json = string.concat('{"address":"', vm.toString(registry), '"}');
53
+
54
+ string memory dir = "test/audit/tmp-contract/nana-address-registry-v6/testnet/";
55
+ vm.createDir(dir, true);
56
+ vm.writeFile(string.concat(dir, "JBAddressRegistry.json"), json);
57
+
58
+ caller.getDeployment({path: "test/audit/tmp-contract/", networkName: "testnet"});
59
+
60
+ vm.removeFile(string.concat(dir, "JBAddressRegistry.json"));
61
+ }
62
+ }