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

Add event for ExecuteQuarkScript #130

Merged
merged 7 commits into from
Dec 19, 2023
Merged

Add event for ExecuteQuarkScript #130

merged 7 commits into from
Dec 19, 2023

Conversation

kevincheng96
Copy link
Collaborator

@kevincheng96 kevincheng96 commented Dec 12, 2023

Quark wallet now emits an event when executing a Quark script. We purposely don't emit scriptCalldata as part of the event since that can add a lot of gas. The current gas overhead is ~1.7k.

@kevincheng96
Copy link
Collaborator Author

The event actually adds a fair bit of gas overhead (~3k+). The total cost depends on the length of the scriptCalldata.

@kevincheng96
Copy link
Collaborator Author

kevincheng96 commented Dec 18, 2023

Cut the gas overhead down from >2.5k gas to ~1.8k gas by removing the scriptCalldata field in the event.

It would be nice to keep the calldata as an event parameter, but it just adds too much overhead due to being arbitrary bytes. I considered only emitting the 4-byte function selector from the calldata, but we would need to specifically handle calldata with less than 4 byte lengths, which is possible for scripts with fallbacks.

Copy link
Collaborator

@fluffywaffles fluffywaffles left a comment

Choose a reason for hiding this comment

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

overall looks good to me, will 👍 on resolution of one comment.

@fluffywaffles
Copy link
Collaborator

the factory test gas diffs seem large; is the branch up to date with main? 🤔

@kevincheng96
Copy link
Collaborator Author

the factory test gas diffs seem large; is the branch up to date with main? 🤔

Just rebased. Will wait to see the refreshed gas diffs.

@kevincheng96
Copy link
Collaborator Author

Gas diffs look much smaller now, around 5k extra gas per deploy of the wallet.

Copy link
Contributor

@cwang25 cwang25 left a comment

Choose a reason for hiding this comment

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

LGTM.

I as as long as the gas is not increased to much I always in favor of having more logs hehe.

@kevincheng96 kevincheng96 merged commit 2e78f57 into main Dec 19, 2023
4 checks passed
@kevincheng96 kevincheng96 deleted the kevin/events branch December 19, 2023 23:26
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.

3 participants