fix(registry): one-time setRegistry on GRUAssetRegistryFacet (GRU-005).
Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Has been cancelled
CI/CD Pipeline / Security Scanning (push) Has been cancelled
CI/CD Pipeline / Lint and Format (push) Has been cancelled
CI/CD Pipeline / Terraform Validation (push) Has been cancelled
CI/CD Pipeline / Kubernetes Validation (push) Has been cancelled
Validation / validate-genesis (push) Has started running
Validation / validate-terraform (push) Has been cancelled
Validation / validate-kubernetes (push) Has been cancelled
Validation / validate-smart-contracts (push) Has been cancelled
Validation / validate-security (push) Has been cancelled
Validation / validate-documentation (push) Has been cancelled

Prevent post-init registry pointer swaps; add test_setRegistry_oneTimeOnly (8/8 GRUCompliantTokensRegistryTest).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
defiQUG
2026-06-08 06:51:46 -07:00
parent cc787380f8
commit 378a9fb11d
2 changed files with 9 additions and 1 deletions

View File

@@ -13,8 +13,9 @@ contract GRUAssetRegistryFacet {
event RegistrySet(address indexed registry);
/// @notice Set the UniversalAssetRegistry to delegate to. Call from Diamond cut init (only Diamond owner can execute cut).
/// @notice One-time set of UniversalAssetRegistry delegate. Callable once (diamond cut init or standalone deploy).
function setRegistry(address _registry) external {
require(address(registry) == address(0), "RegistryAlreadySet");
require(_registry != address(0), "Zero registry");
registry = UniversalAssetRegistry(_registry);
emit RegistrySet(_registry);

View File

@@ -53,6 +53,13 @@ contract GRUCompliantTokensRegistryTest is Test {
vm.stopPrank();
}
function test_setRegistry_oneTimeOnly() public {
GRUAssetRegistryFacet localFacet = new GRUAssetRegistryFacet();
localFacet.setRegistry(address(registry));
vm.expectRevert("RegistryAlreadySet");
localFacet.setRegistry(makeAddr("otherRegistry"));
}
function test_registerGRUCompliantAsset_cUSDT() public {
vm.prank(admin);
registry.registerGRUCompliantAsset(