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

Update Feature.sol #38

Merged
merged 3 commits into from
Nov 1, 2023
Merged

Update Feature.sol #38

merged 3 commits into from
Nov 1, 2023

Conversation

0xScratch
Copy link
Contributor

This PR aims for two types of optimizations:

  • Changing constant to immutable for variables storing the keccak hashes. Refer this
  • Improvement of 'for' loops. Refer this

Some typos were fixed

Also, there's one more fix we can make in the structs. The structs which are used currently are kind of using more slots than required which costs more gas. If we aim to pack structs, then it be more efficient

Thanks!

@0xScratch
Copy link
Contributor Author

Fixed the code readability which was messed up on line 662 (Refer feature.sol)

@n1c01a5 n1c01a5 self-requested a review November 1, 2023 16:09
@n1c01a5
Copy link
Member

n1c01a5 commented Nov 1, 2023

Thank you @Aryan9592 for your contribution !

@n1c01a5 n1c01a5 merged commit 9159610 into feature-sh:main Nov 1, 2023
3 checks passed
Copy link

gitpoap-bot bot commented Nov 1, 2023

Congrats, your important contribution to this open-source project has earned you a GitPOAP!

GitPOAP: 2023 Feature Contributor:

GitPOAP: 2023 Feature Contributor GitPOAP Badge

Head to gitpoap.io & connect your GitHub account to mint!

Learn more about GitPOAPs here.

@0xScratch 0xScratch deleted the patch-1 branch November 1, 2023 16:27
@0xScratch 0xScratch restored the patch-1 branch November 1, 2023 16:27
@0xScratch
Copy link
Contributor Author

0xScratch commented Nov 1, 2023

Also, there's one more fix we can make in the structs. The structs which are used currently are kind of using more slots than required which costs more gas. If we aim to pack structs, then it be more efficient

@n1c01a5 what about this?

@n1c01a5
Copy link
Member

n1c01a5 commented Nov 1, 2023

Also, there's one more fix we can make in the structs. The structs which are used currently are kind of using more slots than required which costs more gas. If we aim to pack structs, then it be more efficient

@n1c01a5 what about this?

I would not prioritarize this refactoring but feel free to do it.

@Aryan9592 I had never heard of this optimization before. Thank you for teaching it to me!

@0xScratch
Copy link
Contributor Author

@n1c01a5 Rareskills really explained it in a hard way. This is a clear one https://gist.github.com/grGred/9bab8b9bad0cd42fc23d4e31e7347144#pack-structs-in-solidity

I be implementing this one in feature.sol. If you felt it good, gonna implement the same in rest!

@0xScratch 0xScratch deleted the patch-1 branch November 1, 2023 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants