Calldata is useful for passing large amounts of data to a function without having to copy the data into memory, which can be expensive in terms of gas usage. By using calldata, you can avoid the overhead of copying data into memory and reduce the amount of gas needed to execute the function.
Reduce the computation cost of the function resulting in less gas being used.
Add below snippet to RankedChoiceTest.t.sol
and run the test case before and after updating the RankedChoice::rankCandidates()
function like shown.
Replace memory
data location with calldata
in functions that accept array inputs.
Foundry
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.