sherlock-audit / 2023-01-derby-judging

4 stars 1 forks source link

ak1 - Game.sol#L31 : mapping(uint256 => mapping(uint256 => int256)) allocations; is not implemented as how the comment says. Not clear. #377

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

ak1

medium

Game.sol#L31 : mapping(uint256 => mapping(uint256 => int256)) allocations; is not implemented as how the comment says. Not clear.

Summary

The basket has one of the parameter for allocation.

   mapping(uint256 => mapping(uint256 => int256)) allocations;

The comment says, the mapping is like vaultNumber => chainId => allocation

But in the implementation it is done like chainId => vaultNumber => allocation

Vulnerability Detail

Refer the summary section

Impact

If mapping is based on vaultNumber => chainId => allocation , all the implementation which are using the allocation would end with incorrect working behavior.

Code Snippet

https://github.com/sherlock-audit/2023-01-derby/blob/main/derby-yield-optimiser/contracts/Game.sol#L215-L221

Tool used

Manual Review

Recommendation

Not sure whether it is type error. If not, correct the code and update in other places.