-
Notifications
You must be signed in to change notification settings - Fork 6
Krace - Agents with Healing Opportunity Will Be Terminated Directly if The escape
Reduces activeAgents to the Number of NUMBER_OF_SECONDARY_PRIZE_POOL_WINNERS
or Fewer
#43
Comments
This is a valid PvP game strategy. |
I can see sponsors view of disputing these issues given this protocol focuses on a PVP game. The difference between this two #43 and #57 and issue #98 is because #98 actually triggers an invalid game state and #84 truly skews the odds, but #43 and #57 don't fall into either categories. However, due to a lack of concrete details on PVP strategies, I also see watsons point of view of how the use of As such, I am going to keep #43 and #57 as medium severity findings, given the attack path requires specific conditions that would otherwise have been valid PVP strategies. |
We won't further dispute this issue and we won't fix it. |
After further considerations, going to mark this issue as invalid due to the analysis of the following test. It supports the sponsor claim that instant killing of wounded agents once active agents fall below
Only #29 and #34 mentions the other root cause of instantly ending the game with |
escape
Reduces activeAgents to the Number of NUMBER_OF_SECONDARY_PRIZE_POOL_WINNERS
or Fewerescape
Reduces activeAgents to the Number of NUMBER_OF_SECONDARY_PRIZE_POOL_WINNERS
or Fewer
Krace
high
Agents with Healing Opportunity Will Be Terminated Directly if The
escape
Reduces activeAgents to the Number ofNUMBER_OF_SECONDARY_PRIZE_POOL_WINNERS
or FewerSummary
Wounded Agents face the risk of losing their last opportunity to heal and are immediately terminated if certain Active Agents decide to escape.
Vulnerability Detail
In each round, agents have the opportunity to either
escape
orheal
before the_requestForRandomness
function is called. However, the order of execution between these two functions is not specified, and anyone can be executed at any time just beforestartNewRound
. Typically, this isn't an issue. However, the problem arises when there are only a few Active Agents left in the game.On one hand, the
heal
function requires that the number ofgameInfo.activeAgents
is greater thanNUMBER_OF_SECONDARY_PRIZE_POOL_WINNERS
.On the other hand, the
escape
function will directly set the status of agents to "ESCAPE" and reduce the count ofgameInfo.activeAgents
.Threrefore, if the
heal
function is invoked first then the corresponding Wounded Agents will be healed in functionfulfillRandomWords
. If theescape
function is invoked first and the number ofgameInfo.activeAgents
becomes equal to or less thanNUMBER_OF_SECONDARY_PRIZE_POOL_WINNERS
, theheal
function will be disable. This obviously violates the fairness of the game.Example
Consider the following situation:
After Round N, there are 100 agents alive. And, 1 Active Agent wants to
escape
and 10 Wounded Agents want toheal
.According to the order of execution, there are two situations.
Please note that the result is calculated only after
_healRequestFulfilled
, so therer are no new wounded or dead agentsFirst, invoking
escape
beforeheal
.heal
is disable and all Wounded Agents are killed because there are not enough Active Agents.Second, invoking
heal
beforeescape
.Suppose that
heal
saves 5 agents, and we got:Obviously, different execution orders lead to drastically different outcomes, which affects the fairness of the game.
Impact
If some Active Agents choose to escape, causing the count of
activeAgents
to become equal to or less thanNUMBER_OF_SECONDARY_PRIZE_POOL_WINNERS
, the Wounded Agents will lose their final chance to heal themselves.This situation can significantly impact the game's fairness. The Wounded Agents would have otherwise had the opportunity to heal themselves and continue participating in the game. However, the escape of other agents leads to their immediate termination, depriving them of that chance.
Code Snippet
Heal will be disabled if there are not enout activeAgents.
Infiltration.sol#L804
Escape will directly reduce the activeAgents.
Infiltration.sol#L769
Tool used
Manual Review
Recommendation
It is advisable to ensure that the
escape
function is always called after theheal
function in every round. This guarantees that every wounded agent has the opportunity to heal themselves when there are a sufficient number ofactiveAgents
at the start of each round. This approach can enhance fairness and gameplay balance.The text was updated successfully, but these errors were encountered: