Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
release:
types: [created]

env:
FOUNDRY_PROFILE: ci

jobs:
package:

Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ on:
pull_request:
workflow_dispatch:

env:
FOUNDRY_PROFILE: ci

jobs:
check:
strategy:
Expand Down
6 changes: 4 additions & 2 deletions src/utils/vrng/VRNGConsumerAdvanced.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ 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;
mapping(uint256 requestId => VRNGRequest details) requests;
}

/// @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.
Expand Down
15 changes: 10 additions & 5 deletions test/vrng/VRNGConsumerTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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 {
Expand Down