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

predicate: document predicate results size cap #943

Merged
merged 4 commits into from
Oct 11, 2023

Conversation

aaronbuchwald
Copy link
Collaborator

@aaronbuchwald aaronbuchwald commented Oct 6, 2023

This PR

  • moves the precompile/results/README.md file -> predicate/Results.md since the relevant code was moved into this package.
  • renames predicate/README.md to predicate/Predicate.md.
  • adds documentation for the maximum size of Results to predicate/Predicate.md

Resolves #824

predicate/Results.md Outdated Show resolved Hide resolved

We make this easy to reason about by assigning a minimum gas cost to the `PredicateGas` function of precompiles. In the case of Warp, the minimum gas cost is set to 200k gas, which can lead to at most 32 additional bytes being included in Results.

The additional bytes come from the transaction hash (32 bytes), length of tx predicate results (4 bytes), the precompile address (20 bytes), length of the bytes result (4 bytes), and the additional byte in the results bitset (1 byte). This results in 200k gas contributing a maximum of 61 additional bytes to Result.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought we are changing to indices instead of hashes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is currently using hashes, so this documentation is correct as is. I don't have a strong opinion on switching to index offsets.

Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
Signed-off-by: aaronbuchwald <aaron.buchwald56@gmail.com>
@darioush darioush merged commit 07903bc into master Oct 11, 2023
8 checks passed
@darioush darioush deleted the document-predicate-results-size-cap branch October 11, 2023 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Document Warp Precompile Result Size Limitations
4 participants