feat!: make contract classes dynamic#24282
Merged
Merged
Conversation
# Conflicts: # yarn-project/pxe/src/contract_function_simulator/oracle/oracle_type_mappings.ts
nchamo
reviewed
Jun 25, 2026
nchamo
left a comment
Contributor
There was a problem hiding this comment.
Much needed work!
FYI Claude suggested we should also make some updates to simulated_tx.ts
Co-authored-by: Nicolas Chamo <nicolas@chamo.com.ar>
registerContract no longer takes an artifact; register the class separately via registerContractClass.
…v/dynamic-current-class
nchamo
approved these changes
Jun 30, 2026
Reconcile crossed renames: adopt fairies-v5's TxResolverService/ResolvedTx naming while keeping this branch's contract/ dir and ContractClassService. Keep the dynamic contract-class registration model (preimage input, no updateContract/currentContractClassId validation) and layer in fairies-v5's secretKeyOrKeys parameter. Rewire private_execution_oracle's resolveCustomRequest/tagging hooks to resolve the current class id via AnchoredContractData instead of the removed instance field.
nventuro
enabled auto-merge (squash)
July 1, 2026 19:20
…v/dynamic-current-class
…v/dynamic-current-class
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 makes PXE stop trying to track a contract's current class. Instead, we fetch it on the fly from the node (which we already had to do anyway to make sure PXE's tracking of it was not out of sync). As a result,
pxe.updateContractgets deleted.I introduced a contract class service, which deals with the interaction with the node for determining the current class (plus a cache to avoid repeated roundtrips), and an anchored contract data class for a given execution. There are some rough edges here (mostly in pxe.ts, which contains too much inlined code, and in some cases which receive both the anchored data and the raw store because the anchored data doesn't expose enough), but it's good enough for now I think. I created multiple follow up issues to clean some of this up.
With this weird current class management gone,
registerContractalso became less important, so I simplified it to only take an instance, withregisterContractClasstaking the artifact. Both must be called.I also introduced a simpler version of
ContractInstance(ContractInstacePreimage) which does not contain the current class - something only the AVM and the node care about - this is what PXE uses throughout. Once we fork the monorepo I imagineContractInstancewould be deleted on our side.Most other changes result from these decisions - the effects were quite far reaching.