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

Use HashInput packing for computing call data #1458

Merged
merged 10 commits into from
Feb 22, 2024

Conversation

MartinMinkov
Copy link
Contributor

@MartinMinkov MartinMinkov commented Feb 22, 2024

Description

Uses toInput and HashInput to more efficiently compute call data. This helps when we have method inputs that can be packed into smaller field elements, which leads to less hashing and fewer constraints generated 🎉

This function checks if an object has 'toInput' and 'empty' methods, which are necessary for an object to be hashable. This will help in validating objects before attempting to hash them, preventing potential runtime errors.
@MartinMinkov MartinMinkov linked an issue Feb 22, 2024 that may be closed by this pull request
…ability and maintainability

The computeCallData function has been refactored to improve its readability and maintainability. The changes include reordering the code blocks and removing unnecessary comments. The totalArgSize and returnSize are now calculated and appended in a more logical order. This refactoring does not affect the functionality of the code but makes it easier to understand and maintain.
This method is the implementation of `ProvableExtended.toInput()` for the `Field` type. It returns an object where the `fields` key is a `Field` array of length 1 created from this `Field`. This is mainly for internal use and not intended for zkApp developers.
…ccountUpdate.callData computation

This update includes details about a significant reduction in the number of constraints used when inputs to a zkApp method are many field elements.
@MartinMinkov MartinMinkov marked this pull request as ready for review February 22, 2024 20:18
@MartinMinkov MartinMinkov force-pushed the feat/calldata-hashing-perf branch from de2e7ae to 9ce4ea6 Compare February 22, 2024 20:20
@MartinMinkov MartinMinkov merged commit 7f1745a into main Feb 22, 2024
13 checks passed
@MartinMinkov MartinMinkov deleted the feat/calldata-hashing-perf branch February 22, 2024 21:02
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.

Use toInput() for calldata hashing
2 participants