@bananapus/address-registry-v6 0.0.21 → 0.0.24
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/AUDIT_INSTRUCTIONS.md +4 -4
- package/STYLE_GUIDE.md +4 -4
- package/package.json +3 -3
- package/script/Deploy.s.sol +1 -1
- package/src/JBAddressRegistry.sol +20 -20
- package/test/audit/CodexFrontRunRegistrationDoS.t.sol +1 -1
- package/test/audit/CodexUnauthorizedRegistrar.t.sol +1 -1
- package/test/audit/ZeroDeployerRegistration.t.sol +1 -1
package/AUDIT_INSTRUCTIONS.md
CHANGED
|
@@ -8,7 +8,7 @@ Find issues that:
|
|
|
8
8
|
|
|
9
9
|
- let callers register contracts under the wrong deployer
|
|
10
10
|
- break determinism or uniqueness assumptions around registration
|
|
11
|
-
- let
|
|
11
|
+
- let callers spoof provenance for contracts the claimed deployer did not create
|
|
12
12
|
- create truncation-related collisions or stale mapping assumptions
|
|
13
13
|
|
|
14
14
|
## Scope
|
|
@@ -35,8 +35,8 @@ The registry maps deployed addresses to the deployer that created them. Downstre
|
|
|
35
35
|
|
|
36
36
|
| Role | Powers | How constrained |
|
|
37
37
|
|------|--------|-----------------|
|
|
38
|
-
|
|
|
39
|
-
| Registry reader |
|
|
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
40
|
|
|
41
41
|
## Integration Assumptions
|
|
42
42
|
|
|
@@ -47,7 +47,7 @@ The registry maps deployed addresses to the deployer that created them. Downstre
|
|
|
47
47
|
## Critical Invariants
|
|
48
48
|
|
|
49
49
|
1. Provenance cannot be forged.
|
|
50
|
-
Only the actual deployer path
|
|
50
|
+
Only inputs matching the actual deployer path may create a successful registration for a contract.
|
|
51
51
|
2. One contract maps to one authoritative deployer record.
|
|
52
52
|
No aliasing or overwrite path should let a later caller replace provenance unexpectedly.
|
|
53
53
|
3. Registration metadata is stable.
|
package/STYLE_GUIDE.md
CHANGED
|
@@ -419,7 +419,7 @@ jobs:
|
|
|
419
419
|
submodules: recursive
|
|
420
420
|
- uses: actions/setup-node@v4
|
|
421
421
|
with:
|
|
422
|
-
node-version:
|
|
422
|
+
node-version: 25.9.0
|
|
423
423
|
- name: Install npm dependencies
|
|
424
424
|
run: npm install --omit=dev
|
|
425
425
|
- name: Install Foundry
|
|
@@ -470,13 +470,13 @@ jobs:
|
|
|
470
470
|
submodules: recursive
|
|
471
471
|
- uses: actions/setup-node@v4
|
|
472
472
|
with:
|
|
473
|
-
node-version:
|
|
473
|
+
node-version: 25.9.0
|
|
474
474
|
- name: Install npm dependencies
|
|
475
475
|
run: npm install --omit=dev
|
|
476
476
|
- name: Install Foundry
|
|
477
477
|
uses: foundry-rs/foundry-toolchain@v1
|
|
478
478
|
- name: Run slither
|
|
479
|
-
uses: crytic/slither-action@v0.
|
|
479
|
+
uses: crytic/slither-action@v0.4.1
|
|
480
480
|
with:
|
|
481
481
|
slither-config: slither-ci.config.json
|
|
482
482
|
fail-on: medium
|
|
@@ -515,7 +515,7 @@ jobs:
|
|
|
515
515
|
},
|
|
516
516
|
"dependencies": { ... },
|
|
517
517
|
"devDependencies": {
|
|
518
|
-
"@sphinx-labs/plugins": "
|
|
518
|
+
"@sphinx-labs/plugins": "0.33.3"
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
521
|
```
|
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.24",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"artifacts": "source ./.env && npx sphinx artifacts --org-id 'ea165b21-7cdc-4d7b-be59-ecdd4c26bee4' --project-name 'nana-address-registry-v6'"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@
|
|
21
|
+
"@sphinx-labs/contracts": "0.23.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@sphinx-labs/plugins": "
|
|
24
|
+
"@sphinx-labs/plugins": "0.33.3"
|
|
25
25
|
}
|
|
26
26
|
}
|
package/script/Deploy.s.sol
CHANGED
|
@@ -4,7 +4,7 @@ pragma solidity 0.8.28;
|
|
|
4
4
|
import {Sphinx} from "@sphinx-labs/contracts/contracts/foundry/SphinxPlugin.sol";
|
|
5
5
|
import {Script} from "forge-std/Script.sol";
|
|
6
6
|
|
|
7
|
-
import {JBAddressRegistry} from "src/JBAddressRegistry.sol";
|
|
7
|
+
import {JBAddressRegistry} from "../src/JBAddressRegistry.sol";
|
|
8
8
|
|
|
9
9
|
contract Deploy is Script, Sphinx {
|
|
10
10
|
bytes32 constant ADDRESS_REGISTRY_SALT = "_JBAddressRegistryV6_";
|
|
@@ -72,6 +72,26 @@ contract JBAddressRegistry is IJBAddressRegistry {
|
|
|
72
72
|
_registerAddress({addr: hook, deployer: deployer});
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
//*********************************************************************//
|
|
76
|
+
// ------------------------ internal functions ----------------------- //
|
|
77
|
+
//*********************************************************************//
|
|
78
|
+
|
|
79
|
+
/// @notice Register a contract's deployer in the `deployerOf` mapping.
|
|
80
|
+
/// @param addr The deployed contract's address.
|
|
81
|
+
/// @param deployer The deployer's address.
|
|
82
|
+
function _registerAddress(address addr, address deployer) internal {
|
|
83
|
+
// The registry only records non-zero deployers.
|
|
84
|
+
if (deployer == address(0)) revert JBAddressRegistry_ZeroDeployer();
|
|
85
|
+
// The address must already contain runtime code before it can be registered.
|
|
86
|
+
if (addr.code.length == 0) revert JBAddressRegistry_AddressNotDeployed(addr);
|
|
87
|
+
// Each address can only be registered once.
|
|
88
|
+
if (deployerOf[addr] != address(0)) revert JBAddressRegistry_AlreadyRegistered(addr);
|
|
89
|
+
|
|
90
|
+
deployerOf[addr] = deployer;
|
|
91
|
+
|
|
92
|
+
emit AddressRegistered({addr: addr, deployer: deployer, caller: msg.sender});
|
|
93
|
+
}
|
|
94
|
+
|
|
75
95
|
//*********************************************************************//
|
|
76
96
|
// -------------------------- internal views ------------------------- //
|
|
77
97
|
//*********************************************************************//
|
|
@@ -126,24 +146,4 @@ contract JBAddressRegistry is IJBAddressRegistry {
|
|
|
126
146
|
addr := mload(0)
|
|
127
147
|
}
|
|
128
148
|
}
|
|
129
|
-
|
|
130
|
-
//*********************************************************************//
|
|
131
|
-
// ------------------------ internal functions ----------------------- //
|
|
132
|
-
//*********************************************************************//
|
|
133
|
-
|
|
134
|
-
/// @notice Register a contract's deployer in the `deployerOf` mapping.
|
|
135
|
-
/// @param addr The deployed contract's address.
|
|
136
|
-
/// @param deployer The deployer's address.
|
|
137
|
-
function _registerAddress(address addr, address deployer) internal {
|
|
138
|
-
// The registry only records non-zero deployers.
|
|
139
|
-
if (deployer == address(0)) revert JBAddressRegistry_ZeroDeployer();
|
|
140
|
-
// The address must already contain runtime code before it can be registered.
|
|
141
|
-
if (addr.code.length == 0) revert JBAddressRegistry_AddressNotDeployed(addr);
|
|
142
|
-
// Each address can only be registered once.
|
|
143
|
-
if (deployerOf[addr] != address(0)) revert JBAddressRegistry_AlreadyRegistered(addr);
|
|
144
|
-
|
|
145
|
-
deployerOf[addr] = deployer;
|
|
146
|
-
|
|
147
|
-
emit AddressRegistered({addr: addr, deployer: deployer, caller: msg.sender});
|
|
148
|
-
}
|
|
149
149
|
}
|
|
@@ -3,7 +3,7 @@ pragma solidity 0.8.28;
|
|
|
3
3
|
|
|
4
4
|
import {Test} from "forge-std/Test.sol";
|
|
5
5
|
|
|
6
|
-
import {JBAddressRegistry} from "src/JBAddressRegistry.sol";
|
|
6
|
+
import {JBAddressRegistry} from "../../src/JBAddressRegistry.sol";
|
|
7
7
|
|
|
8
8
|
contract CodexFrontRunRegistrationDoSTest is Test {
|
|
9
9
|
JBAddressRegistry internal registry;
|
|
@@ -3,7 +3,7 @@ pragma solidity 0.8.28;
|
|
|
3
3
|
|
|
4
4
|
import {Test} from "forge-std/Test.sol";
|
|
5
5
|
|
|
6
|
-
import {JBAddressRegistry} from "src/JBAddressRegistry.sol";
|
|
6
|
+
import {JBAddressRegistry} from "../../src/JBAddressRegistry.sol";
|
|
7
7
|
|
|
8
8
|
contract CodexUnauthorizedRegistrarTest is Test {
|
|
9
9
|
JBAddressRegistry internal registry;
|
|
@@ -3,7 +3,7 @@ pragma solidity 0.8.28;
|
|
|
3
3
|
|
|
4
4
|
import {Test} from "forge-std/Test.sol";
|
|
5
5
|
|
|
6
|
-
import {JBAddressRegistry} from "src/JBAddressRegistry.sol";
|
|
6
|
+
import {JBAddressRegistry} from "../../src/JBAddressRegistry.sol";
|
|
7
7
|
|
|
8
8
|
contract ZeroDeployerRegistrationTest is Test {
|
|
9
9
|
JBAddressRegistry internal registry;
|