Solidity's low-level function call()
usage might lead to incorrect event emissions.
In the process of delegating calls for prize distribution, the _delegate()
function eventually gets called, triggering proxy.call(data)
.
The data
in the call may not always pertain to the Distributor.sol
contract's distribute()
function. For instance, it might eventually call the getConstants()
function and still result in a successful call.
This inconsistency would lead the Proxy.sol
contract to emit the Distributed(proxy, data)
event, even if no actual distribution took place.
🚧 Note ⚠️: The test is a variant of the team's original test:
testSucceedsIfAllConditionsMet (ProxyFactoryTest.t.sol)
. Adding event checks and adjusted data value. New additions are highlighted in 🟢.
The impact is relatively minimal. However, users can emit misleading events. Ensuring accurate logging of system actions and intentions is important, especially considering SPARKN's targeted adoption by government and public institutions, emphasizing the need for transparency.
Manual audit.
Two possible fixes are proposed:
1️⃣ Introduce a filter to inspect the data parameter's function call. If it deviates from distribute(), the function should revert.
🚧 Note ⚠️: This code is illustrative and has not been tested.
2️⃣ Examine the return data. If distribute() gets invoked, the output will be 0; otherwise, the function should revert.
🚧 Note ⚠️: This code is illustrative and has not been tested.
Given its straightforwardness and the absence of any other function in Distributor.sol
returning nothing, solution 2️⃣ stands out as the preferable choice.
If in the future the Distributor.sol
gets more complex and has more functions returning something, implementation 1️⃣ should be considered.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.