Note: At the judges request here, this downgraded issue from the same warden has been included in this report for completeness.
https://github.com/code-423n4/2024-02-ai-arena/blob/cd1a0e6d1b40168657d1aaee8223dc050e15f8cc/src/VoltageManager.sol#L93-L99
When players deplete their voltage through battles, they have the option to replenish it using a voltage battery. Although the maximum voltage capacity is 100, and each battle reduces it by 10, the useVoltageBattery() function resets the voltage to 100, disregarding any remaining voltage a player has.
From a design point of view it looks good to have the number 100 as max and 0 as min value for voltage. But in this situation it is doing players a disservice.
The core issue arises from the function overwriting the existing voltage value instead of incrementally adding to it.
Voltage batteries, as valuable paid items, enable more frequent participation in ranking matches. However, players risk losing up to 90% of their replenished voltage due to the current implementation, leading to potential losses in NRN (the games currency).
Should a player replenish their voltage without checking their current level, they risk using a battery without receiving its full value, thereby not maximizing the items cost-effectiveness.
In VoltageManager.t.sol:
Modify the function to add the voltage batterys value to the existing voltage, rather than resetting it:
hickuphh3 (judge) commented:
brandinho (AI Arena) acknowledged
For this audit, 36 reports were submitted by wardens detailing gas optimizations. The report highlighted below by 0xDetermination received the top score from the judge.
The following wardens also submitted reports: 0x11singh99, K42, mikesans, hunter_w3b, SY_S, SAQ, SM3_SS, PetarTolev, shamsulhaq123, donkicha, favelanky, dharma09, rekxor, unique, MatricksDeCoder, McToady, Raihan, yashgoel72, yovchev_yoan, ahmedaghadi, lrivo, 0xAnah, al88nsk, merlinboii, offside0011, lsaudit, peter, emrekocak, oualidpro, ziyou-, Timenov, judeabara, 0xRiO, kiqo, and JcFichtner.
