Eggstravaganza

First Flight #37
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: low
Invalid

`public` functions not used internally could be marked `external`

Summary

Using a public function can cost a lot of gas, if not used internally.

Vulnerability Details

  • src/EggVault.sol:

function depositEgg(uint256 tokenId, address depositor) public {
.
.
.
function withdrawEgg(uint256 tokenId) public {
.
.
.
function isEggDeposited(uint256 tokenId) public view returns (bool) {

Impact

It will cost a lot of gas

Tools Used

  1. Foundry

  2. Aderyn

Recommendations

consider marking it as external if it is not used internally.

- function depositEgg(uint256 tokenId, address depositor) public {
+ function depositEgg(uint256 tokenId, address depositor) external {
.
.
.
- function withdrawEgg(uint256 tokenId) public {
+ function withdrawEgg(uint256 tokenId) external {
.
.
.
- function isEggDeposited(uint256 tokenId) public view returns (bool) {
+ function isEggDeposited(uint256 tokenId) external view returns (bool) {
Updates

Lead Judging Commences

m3dython Lead Judge 2 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Gas optimization

Strategy to save gas and minimize transaction costs

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.