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

Analyze Gas Consumption #594

Open
2 of 4 tasks
matthiaszimmermann opened this issue Aug 13, 2024 · 3 comments
Open
2 of 4 tasks

Analyze Gas Consumption #594

matthiaszimmermann opened this issue Aug 13, 2024 · 3 comments

Comments

@doerfli doerfli removed their assignment Aug 22, 2024
@doerfli doerfli self-assigned this Sep 3, 2024
@doerfli
Copy link
Contributor

doerfli commented Sep 3, 2024

Analysis of the create application transaction

comparing the two transactions before and after the storage slot optimisation reveals almost no change in tx gas consumption. Further analysis revealed that the culprit is the abi.encode(...) in the KeyValueStore which pads each field to 32 bytes (https://medium.com/@scourgedev/deep-dive-into-abi-encode-types-padding-and-disassembly-84472f1b4543). So a crucial look at how to store the infos in necessary as currently storing costs a lot of gas.

Also we think it might be worth trying to further gas optimize the authz methods. They are not expensive, but called often.

Update: directly storing IPolicy as struct instead of encoded bytes will reduce gas consumption for createApplication by ~50%. Same for fees (both are large objects that use less slots than they have fields).

Ideas:

  • store infos as structs not in encoded bytes
  • try to improve authz methods
  • remove data and initalowner from IRegistry.ObjectInfo

@doerfli doerfli removed their assignment Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants