getListOfStudents()
(and similar functions for teachers) returns an in-memory copy of the storage array. Solidity generates code that:
Iterates over the entire array in _storage.
Allocates a new array in _memory of the same length.
Copies each element one by one.
As the number of elements grows, the gas required can exceed the block gas limit and cause the call to revert. Any UI or off-chain integration relying on this getter becomes unable to read the full list, resulting in a read-side Denial-of-Service (DoS) and poor user experience.
Impact:
With hundreds or thousands of students or teachers, the call may revert, breaking dashboards or scripts that depend on the getter.
The on-chain contract still works, but users cannot retrieve the data—leading to reputational damage and loss of transparency.
Proof of Concept:
output
Recommended Mitigation:
Don’t return the entire array; implement pagination.
Or emit events and let consumers index the data off-chain.
Document that getters for large arrays are for development only and should not be used in production without limits.
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.