Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds per-page opcodes budget calibration to ensure sufficient computational budget for operations that scale with metadata page count. The changes introduce budget allocation calls for hash computation operations and add a test suite to validate budget sufficiency across all possible page counts.
- Adds
ensure_budgetcalls to_compute_header_hashand_compute_page_hashmethods with calibrated budget values - Introduces
pages_min_feehelper function to calculate appropriate transaction fees based on page count - Adds parametrized test covering all page counts from 0 to MAX_PAGES (31)
Reviewed changes
Copilot reviewed 7 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_per_page_op_budget_calibration.py | New test file that validates budget calibration across all possible page counts (0-31) |
| tests/helpers/utils.py | Adds pages_min_fee function for calculating fees based on page count; updates add_extra_resources with default count parameter |
| tests/helpers/factories.py | Adds create_metadata_with_page_count factory function to generate metadata with specific page counts for testing |
| tests/conftest.py | Updates fixture to use pages_min_fee function for consistent fee calculation |
| smart_contracts/asa_metadata_registry/constants.py | Renames APP_CALL_OP_CODE_BUDGET to APP_CALL_OP_BUDGET and adds HEADER_HASH_OP_BUDGET and PAGE_HASH_OP_BUDGET constants; renames ARC89_REPLACE_METADATA_FIXED_SIZE to ARC89_REPLACE_METADATA_SLICE_FIXED_SIZE for clarity |
| smart_contracts/asa_metadata_registry/contract.py | Adds ensure_budget calls with calibrated budgets to hash computation methods; reorders comment and code for clarity |
| smart_contracts/artifacts/asa_metadata_registry/AsaMetadataRegistry.approval.teal | Updated TEAL bytecode reflecting the source code changes with budget allocation logic |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds opcodes budget calibration to ensure sufficient per-page budget