diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7000814..3deac88 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,9 +4,6 @@ on: release: types: [created] -env: - FOUNDRY_PROFILE: ci - jobs: package: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a68fbbc..674a981 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,9 +9,6 @@ on: pull_request: workflow_dispatch: -env: - FOUNDRY_PROFILE: ci - jobs: check: strategy: diff --git a/src/utils/vrng/VRNGConsumerAdvanced.sol b/src/utils/vrng/VRNGConsumerAdvanced.sol index 561e0be..05650a0 100644 --- a/src/utils/vrng/VRNGConsumerAdvanced.sol +++ b/src/utils/vrng/VRNGConsumerAdvanced.sol @@ -16,7 +16,7 @@ abstract contract VRNGConsumerAdvanced is IVRNGSystemCallback { bytes32 private constant VRNG_STORAGE_LOCATION = 0xfc4de942100e62e9eb61034c75124e3689e7605ae081e19c59907d5c442ea700; /// @dev The function used to normalize the drand random number - function(uint256,uint256) internal returns(uint256) internal immutable _normalizeRandomNumber; + function(uint256, uint256) internal returns (uint256) internal immutable _normalizeRandomNumber; struct VRNGConsumerStorage { IVRNGSystem vrng; @@ -24,7 +24,9 @@ abstract contract VRNGConsumerAdvanced is IVRNGSystemCallback { } /// @notice The VRNG system contract address - IVRNGSystem public immutable vrng; + function vrng() public view virtual returns (address) { + return address(_getVRNGStorage().vrng); + } /// @dev Create a new VRNG consumer with the specified normalization method. /// @param normalizationMethod The normalization method to use. See `VRNGNormalizationMethod` for more details. diff --git a/test/vrng/VRNGConsumerTest.sol b/test/vrng/VRNGConsumerTest.sol index b4ac7f5..cf30d25 100644 --- a/test/vrng/VRNGConsumerTest.sol +++ b/test/vrng/VRNGConsumerTest.sol @@ -30,6 +30,12 @@ contract VRNGConsumerTest is TestBase { vrngConsumerMostEfficient.setVRNG(address(vrngSystem)); } + function test_vrngGetterReturnsVrngSystem() public view { + assertEq(address(vrngConsumer.vrng()), address(vrngSystem)); + assertEq(address(vrngConsumerMostNormalized.vrng()), address(vrngSystem)); + assertEq(address(vrngConsumerMostEfficient.vrng()), address(vrngSystem)); + } + function test_uninitializedVrngRevertsOnRequest() public { // uninitialize the vrng system vrngConsumer.setVRNG(address(0)); @@ -59,9 +65,7 @@ contract VRNGConsumerTest is TestBase { vrngConsumer.randomNumberCallback(requestId, randomNumber); } - function testFuzz_fulfillRandomRequestAlreadyFulfilledReverts(uint256 randomNumber1, uint256 randomNumber2) - public - { + function testFuzz_fulfillRandomRequestAlreadyFulfilledReverts(uint256 randomNumber1, uint256 randomNumber2) public { uint256 requestId = vrngSystem.nextRequestId(); vrngConsumer.triggerRandomNumberRequest(); @@ -158,8 +162,9 @@ contract VRNGConsumerTest is TestBase { } function _assemblyCreate(uint8 normalizationMethod) internal returns (address result) { - bytes memory code = - abi.encodePacked(type(MockVRNGConsumerAdvancedImplementation).creationCode, abi.encode(normalizationMethod)); + bytes memory code = abi.encodePacked( + type(MockVRNGConsumerAdvancedImplementation).creationCode, abi.encode(normalizationMethod) + ); // Deploy via assembly to avoid enum revert inside the test code assembly {