Dria

Swan
NFTHardhat
21,000 USDC
View results
Submission Details
Severity: low
Invalid

For Cycles Can Be Removed

Summary

In LLMOracleCoordinator::validate and LLMOracleCoordinator::respond instead of making a simple check whether an address is part of the request as validator or responder, the logic is iterating through all records.

Impact

The code currently is consuming a lot of gas, because the complexity of both of these are respectively O(N) and O(N+M), where N is number of the responders and M is the number of validators.

Tools Used

Manual Review

Recommendations

In LLMOracleCoordinator::validate and LLMOracleCoordinator::respond add two mappings that will keep the addresses of validators and responders for a certain request. Instead of iterating through the lists, it will directly check whether an address is part of the given mapping.

struct TaskRequest {
/// @dev Requesting address, also responsible of the fee payment.
address requester;
/// @dev Protocol string, such as `dria/0.1.0`.
bytes32 protocol;
/// @dev Task parameters, e.g. difficulty and number of generations & validations.
LLMOracleTaskParameters parameters;
/// @dev Task status.
TaskStatus status;
/// @dev Fee paid to each generator per generation.
uint256 generatorFee;
/// @dev Fee paid to each validator per validated generation.
uint256 validatorFee;
/// @dev Fee paid to the platform
uint256 platformFee;
/// @dev Input data for the task, usually a human-readable string.
bytes input;
/// @dev Allowed model names for the task.
bytes models;
+ mapping(address => boolean) mapOfResponders;
+ mapping(address => boolean) mapOfValidators;
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.