Omniscia Tangible Audit
BasketsVrfConsumer Code Style Findings
BasketsVrfConsumer Code Style Findings
BVC-01C: Redundant Extra Data Payload
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | ![]() | BasketsVrfConsumer.sol:L97 |
Description:
The BasketsVrfConsumer::_requestRandomness function is invoked with an abi.encode(0) payload redundantly as the data point passed in remains unutilized.
Example:
src/BasketsVrfConsumer.sol
88/**89 * @notice This method is used to trigger a request to Gelato's vrf coordinator contract.90 * @dev This contract is only callable by a valid basket contract.91 * @return requestId -> the request identifier given to us by the vrf coordinator.92 */93function makeRequestForRandomWords() external onlyBasket returns (uint256 requestId) {94 address basket = msg.sender;95
96 // make request to vrfCoordinator contract requesting entropy.97 requestId = _requestRandomness(abi.encode(0));98
99 // store the basket requesting entropy in requestTracker using the requestId as the key value.100 requestTracker[requestId] = basket;101 outstandingRequest[basket] = requestId;102
103 emit RequestSubmitted(requestId, basket);104}Recommendation:
We advise an empty string ("") to be passed in instead, optimizing its gas cost.
Alleviation (106fc61dcd38fe29a81d1984ccde9171f5f231af):
The referenced payload has been replaced by an empty string as advised, optimizing the code's gas cost.
