@bananapus/address-registry-v6 0.0.33 → 0.0.35
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
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
- [AUDIT_INSTRUCTIONS.md](./AUDIT_INSTRUCTIONS.md) — scope, critical invariants, and attack surfaces for auditors.
|
|
13
13
|
- [SKILLS.md](./SKILLS.md) — orientation map for AI agents working in this repo.
|
|
14
14
|
- [STYLE_GUIDE.md](./STYLE_GUIDE.md) — Solidity and repo conventions for the V6 ecosystem.
|
|
15
|
-
- [CHANGELOG.md](./CHANGELOG.md)
|
|
15
|
+
- [CHANGELOG.md](./CHANGELOG.md) - verified V5 to V6 deltas.
|
|
16
16
|
|
|
17
17
|
## Overview
|
|
18
18
|
|
|
@@ -25,15 +25,13 @@ Because the address is computed deterministically, registrations do not need acc
|
|
|
25
25
|
|
|
26
26
|
Use this repo when deployer provenance matters. Do not confuse it with an allowlist, review registry, or trust oracle.
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
## Key Contract
|
|
28
|
+
## Key contract
|
|
31
29
|
|
|
32
30
|
| Contract | Role |
|
|
33
31
|
| --- | --- |
|
|
34
32
|
| `JBAddressRegistry` | Standalone registry that stores `deployerOf[address]` and exposes overloaded `registerAddress` entrypoints. |
|
|
35
33
|
|
|
36
|
-
## Mental
|
|
34
|
+
## Mental model
|
|
37
35
|
|
|
38
36
|
The registry is intentionally narrow:
|
|
39
37
|
|
|
@@ -43,25 +41,25 @@ The registry is intentionally narrow:
|
|
|
43
41
|
|
|
44
42
|
Anything beyond that is out of scope.
|
|
45
43
|
|
|
46
|
-
## Read
|
|
44
|
+
## Read these files first
|
|
47
45
|
|
|
48
46
|
1. `src/JBAddressRegistry.sol`
|
|
49
47
|
2. `test/JBAddressRegistry.t.sol`
|
|
50
48
|
3. `test/JBAddressRegistryEdge.t.sol`
|
|
51
49
|
4. `test/regression/RegressionFrontRunRegistrationDoS.t.sol`
|
|
52
50
|
|
|
53
|
-
## Integration
|
|
51
|
+
## Integration traps
|
|
54
52
|
|
|
55
53
|
- provenance is only useful if callers also know what the deployer is trusted for
|
|
56
54
|
- permissionless registration is intentional, so integrations should verify the computed inputs rather than assume caller authority
|
|
57
55
|
- `create` nonce reconstruction and `create2` salt-bytecode reconstruction are different trust paths and should be reasoned about separately
|
|
58
56
|
|
|
59
|
-
## Where
|
|
57
|
+
## Where state lives
|
|
60
58
|
|
|
61
59
|
- deployer provenance: `JBAddressRegistry`
|
|
62
60
|
- deployment truth: the target chain history and bytecode inputs outside this repo
|
|
63
61
|
|
|
64
|
-
## High-
|
|
62
|
+
## High-signal tests
|
|
65
63
|
|
|
66
64
|
1. `test/JBAddressRegistry.t.sol`
|
|
67
65
|
2. `test/JBAddressRegistryEdge.t.sol`
|
|
@@ -87,7 +85,7 @@ Useful scripts:
|
|
|
87
85
|
- `npm run deploy:mainnets`
|
|
88
86
|
- `npm run deploy:testnets`
|
|
89
87
|
|
|
90
|
-
## Deployment
|
|
88
|
+
## Deployment notes
|
|
91
89
|
|
|
92
90
|
The deploy script uses Sphinx for deterministic deployment. This package is intentionally small and independent because many other repos use it to record clone factories and helper deployments.
|
|
93
91
|
|
|
@@ -101,7 +99,7 @@ Provide the matching RPC URLs through environment variables before proposing or
|
|
|
101
99
|
- `RPC_ETHEREUM_MAINNET`, `RPC_OPTIMISM_MAINNET`, `RPC_BASE_MAINNET`, `RPC_ARBITRUM_MAINNET`
|
|
102
100
|
- `RPC_ETHEREUM_SEPOLIA`, `RPC_OPTIMISM_SEPOLIA`, `RPC_BASE_SEPOLIA`, `RPC_ARBITRUM_SEPOLIA`
|
|
103
101
|
|
|
104
|
-
## Repository
|
|
102
|
+
## Repository layout
|
|
105
103
|
|
|
106
104
|
```text
|
|
107
105
|
src/
|
|
@@ -114,13 +112,15 @@ script/
|
|
|
114
112
|
helpers/
|
|
115
113
|
```
|
|
116
114
|
|
|
117
|
-
## Risks
|
|
115
|
+
## Risks and notes
|
|
118
116
|
|
|
119
117
|
- provenance is not the same as safety; a known deployer can still deploy unsafe code
|
|
120
118
|
- registrations are first-write only, so bad initial registration is sticky
|
|
121
119
|
- the `create` path relies on nonce reconstruction and intentionally rejects unrealistic nonce ranges
|
|
122
120
|
|
|
123
|
-
## For AI
|
|
121
|
+
## For AI agents
|
|
124
122
|
|
|
125
123
|
- Describe this repo as a provenance registry, not as an allowlist or safety oracle.
|
|
126
124
|
- Read the edge and review tests before making claims about frontrunning or unauthorized registration.
|
|
125
|
+
|
|
126
|
+
If the question is "is this hook safe?" this repo can only tell you who deployed it, not whether the code is good.
|
package/package.json
CHANGED
package/references/operations.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# Address Registry Operations
|
|
2
2
|
|
|
3
|
-
## Change
|
|
3
|
+
## Change checklist
|
|
4
4
|
|
|
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
8
|
- If you change registration guards, re-read the review tests before trusting a narrower unit proof.
|
|
9
9
|
|
|
10
|
-
## Common
|
|
10
|
+
## Common failure modes
|
|
11
11
|
|
|
12
12
|
- Operators confuse deployer provenance with trustworthiness.
|
|
13
13
|
- Registration is attempted with stale deployment inputs from another repo or environment.
|
package/references/runtime.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# Address Registry Runtime
|
|
2
2
|
|
|
3
|
-
## Core
|
|
3
|
+
## Core role
|
|
4
4
|
|
|
5
5
|
- [`src/JBAddressRegistry.sol`](../src/JBAddressRegistry.sol) reconstructs deployment addresses from `create` or `create2` inputs and binds a deployer to that computed address once.
|
|
6
6
|
|
|
7
|
-
## High-
|
|
7
|
+
## High-risk areas
|
|
8
8
|
|
|
9
9
|
- First-write semantics: bad initial registration can become sticky.
|
|
10
10
|
- Provenance scope: this repo proves deployer identity, not code safety or allowlist status.
|
|
11
11
|
- Input correctness: wrong nonce, salt, or bytecode assumptions produce wrong addresses.
|
|
12
12
|
|
|
13
|
-
## Tests
|
|
13
|
+
## Tests to trust first
|
|
14
14
|
|
|
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.
|
|
@@ -101,6 +101,7 @@ contract JBAddressRegistry is IJBAddressRegistry {
|
|
|
101
101
|
/// @dev Adapted from https://ethereum.stackexchange.com/a/87840/68134
|
|
102
102
|
/// @param origin The deployer's address.
|
|
103
103
|
/// @param nonce The nonce used to deploy the contract.
|
|
104
|
+
/// @return addr The computed address of the contract deployed with `create`.
|
|
104
105
|
function _addressFrom(address origin, uint256 nonce) internal pure returns (address addr) {
|
|
105
106
|
if (nonce > type(uint64).max) revert JBAddressRegistry_NonceTooLarge(nonce);
|
|
106
107
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.0;
|
|
3
3
|
|
|
4
|
-
/// @notice A registry that
|
|
5
|
-
///
|
|
4
|
+
/// @notice A public registry that records who deployed a given contract. Anyone can register a contract's deployer,
|
|
5
|
+
/// and anyone can look it up — enabling frontend clients and other contracts to verify that a Juicebox hook or
|
|
6
|
+
/// extension was deployed by a trusted source.
|
|
6
7
|
interface IJBAddressRegistry {
|
|
7
8
|
/// @notice Emitted when a contract's deployer is registered.
|
|
8
9
|
/// @param addr The address of the registered contract.
|
|
@@ -16,11 +17,15 @@ interface IJBAddressRegistry {
|
|
|
16
17
|
function deployerOf(address addr) external view returns (address deployer);
|
|
17
18
|
|
|
18
19
|
/// @notice Register a contract that was deployed with `create` (standard deployment).
|
|
20
|
+
/// @dev The address is derived deterministically from the deployer and nonce, and code must already exist there
|
|
21
|
+
/// before the deployer is recorded.
|
|
19
22
|
/// @param deployer The address that deployed the contract.
|
|
20
23
|
/// @param nonce The deployer's transaction nonce at the time of deployment.
|
|
21
24
|
function registerAddress(address deployer, uint256 nonce) external;
|
|
22
25
|
|
|
23
26
|
/// @notice Register a contract that was deployed with `create2` (deterministic deployment).
|
|
27
|
+
/// @dev The address is derived deterministically from the deployer, salt, and bytecode, and code must already
|
|
28
|
+
/// exist there before the deployer is recorded.
|
|
24
29
|
/// @param deployer The address that deployed the contract.
|
|
25
30
|
/// @param salt The `create2` salt used during deployment.
|
|
26
31
|
/// @param bytecode The full deployment bytecode, including constructor arguments.
|