refactor: split ContractSelf into context-specific structs#20624
Merged
benesjan merged 3 commits intomerge-train/fairiesfrom Feb 18, 2026
Merged
refactor: split ContractSelf into context-specific structs#20624benesjan merged 3 commits intomerge-train/fairiesfrom
benesjan merged 3 commits intomerge-train/fairiesfrom
Conversation
…blic, ContractSelfUtility Each context-specific struct now lives in its own file under contract_self/ and only contains the type parameters and fields relevant to that context. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7cab322 to
5466b11
Compare
github-merge-queue bot
pushed a commit
that referenced
this pull request
Feb 19, 2026
BEGIN_COMMIT_OVERRIDE refactor: authwit not consumable when reject all is set (#20533) fix: displaying debug logs from public function simulations (#20551) fix: allow compiling mixed (contract + noir script) aztec project (#20428) refactor: split ContractSelf into context-specific structs (#20624) feat: add optional additional scopes to wallet transaction API (#20487) feat(aztec.js): add additionalScopes to ContractFunctionPattern in capabilities (#20660) END_COMMIT_OVERRIDE
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.
When I initially implemented
ContractSelfI chose an incorrect pattern and that is having 1 ContractSelf struct for all the function types and then having there a genericContextparam that specializes it for the given execution context. This has undesirable effects like needing to use unit types to disable certain functionality in utility and public contexts:Another advantage with the change is that we follow the pattern of having
PrivateContext,PublicContextandUtilityContext.Summary
ContractSelfgeneric struct into three context-specific structs:ContractSelfPrivate,ContractSelfPublic, andContractSelfUtilitycontract_self/and only carries the type parameters and fields relevant to its context (e.g.ContractSelfPublichas noenqueue_self/enqueue_self_staticfields,ContractSelfUtilityhas no call/enqueue fields)Test plan
nargo compile --package nft_contractcompiles successfully🤖 Generated with Claude Code