refactor: share common code and test the precompiles end to end - #69
Open
sphamjoli wants to merge 4 commits into
Open
refactor: share common code and test the precompiles end to end#69sphamjoli wants to merge 4 commits into
sphamjoli wants to merge 4 commits into
Conversation
Zebedeusz
approved these changes
Aug 27, 2026
sphamjoli
enabled auto-merge (squash)
August 27, 2026 13:54
Member
Author
|
Hello @tindzk can you please have a look when you get time |
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.
The scarcity and NFT-claims precompiles are already in place, but each had its own copy of the same guards and test scaffolding, revert reasons written out inline at each site, and the collection interface holding two contracts in one file. Nothing exercised them the way a real caller does, through a compiled contract running inside the virtual machine, so the behaviour that only shows up across that boundary was never tested.
This shares the common parts and adds that coverage. The guards and mock helpers move to a single support crate; both precompiles reuse, so they cannot drift apart. Small example contracts are now compiled at test time and run against the precompiles, covering a plain read, the delegate-call and value refusals, a contract that owns and gates its own collection, and a proxy that owns a collection under its own address, on both the EVM and PolkaVM backends. Revert reasons become named constants shared by the code and the tests, the collection interface is split so each file holds one interface, and the standard interface identifiers are checked against the compiler's own computation of them rather than trusted by hand.
Changes
balanceOfandownerOfagree, and native transfers and burns emit no ERC-721 log.