Replaced the whole-struct assignment that copied studentInfo[_studentAdd].instituteName and .uri into a new Student with an in-place storage update:
`Student storage s = studentInfo[_studentAdd];
s.uri.push(_uri);
s.name = _studentname;
s.studentAdd = _studentAdd;
Kept certificate storage logic intact (still assigns Cert to certificates[byte_hash]) to avoid larger structural changes in this patch.
This removes the expensive pattern of copying storage arrays into memory & back, preventing gasUsed from growing linearly with array length for this function.
Why this helps
Avoids copying dynamic arrays from storage to memory and then back on assignment — that copy cost grows with array length and was the main cause of per-tx gas inflation.
Now only the necessary storage writes are performed: push new URI, optionally push instituteName if new, set simple fields. This reduces both SLOAD/SSTORE counts and memory copy overhead.
Next recommendations (optional)
Convert Cert.institute to store only instituteId (uint256) instead of embedding Institute to avoid repeated string writes for every certificate.
Apply the same storage-in-place pattern to bulkUpload.
Consider changing URI storage to mapping(uint256 => string) + counter for very large histories.
For further actions, you may consider blocking this person and/or reporting abuse
A better version:
What I changed:
studentInfo[_studentAdd].instituteNameand.uriinto a new Student with an in-place storage update:s.uri.push(_uri);s.name = _studentname;s.studentAdd = _studentAdd;Why this helps
Next recommendations (optional)
Cert.instituteto store onlyinstituteId (uint256)instead of embedding Institute to avoid repeated string writes for every certificate.mapping(uint256 => string)+ counter for very large histories.