Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(svm): L-06 Unnecessary Use of InitSpace Macro #839

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

md0x
Copy link
Contributor

@md0x md0x commented Jan 6, 2025

Changes proposed in this PR:

  • Fix audit issue:
Throughout the codebase, the following structs use the InitSpace macro unnecessarily:

FillV3RelayParams

ExecuteRelayerRefundLeafParams

RequestV3SlowFillParams

ExecuteV3SlowRelayLeafParams

These accounts are initialized using the initialize_instruction_params method, which creates empty accounts with a size specified in the function's instructions. Consequently, the InitSpace macro, which implements the Space trait, becomes redundant as the INIT_SPACE constant generated by this trait is not utilized. The inclusion of the InitSpace macro in these cases adds unnecessary overhead and obscures the intended logic, given that its functionality is not employed.

Consider removing the InitSpace macro from these structs to simplify the codebase and remove superfluous logic. This adjustment would help improve code clarity and align it more closely with actual use patterns.

Copy link

linear bot commented Jan 6, 2025

@md0x md0x marked this pull request as ready for review January 6, 2025 15:12
Copy link
Contributor

@Reinis-FRP Reinis-FRP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might be also able to remove InitSpace from all nested structs

@md0x md0x requested a review from Reinis-FRP January 7, 2025 11:21
@md0x
Copy link
Contributor Author

md0x commented Jan 7, 2025

we might be also able to remove InitSpace from all nested structs

@Reinis-FRP, I’ve removed some more InitSpace instances. Let me know if you were referring to those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants