You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: contractOverrides for private-call simulation
Plumbs the existing PXE-side SimulationOverrides.contracts mechanism through
wallet.simulateTx and aztec.js .simulate() options as 'contractOverrides'.
This covers private-function dispatch during simulation against an upgraded
class - the PXE's ACIR simulator uses the override artifact for the given
address instead of its registered one.
Together with the existing node-side stateOverrides, .simulate() now handles
both private and public call flavors when simulating against an upgraded
contract.
fastForwardContractUpdate now takes a ContractArtifact and returns both
override layers in one blob so callers can spread it across .simulate():
const overrides = await fastForwardContractUpdate({
instanceAddress, newArtifact, node,
});
await updatedContract.methods.X().simulate({ ...overrides });
Adds e2e coverage for the private-call path (set_private_value, which only
exists on the upgraded class) to demonstrate the full flow.
Copy file name to clipboardExpand all lines: docs/docs-developers/docs/aztec-js/how_to_test.md
+7-4Lines changed: 7 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,18 +89,21 @@ Use this to:
89
89
90
90
### Fast-forwarding a contract update
91
91
92
-
`fastForwardContractUpdate` builds the full set of overrides needed to simulate a deployed instance as if it had already been upgraded to a new contract class. The new class must already be registered on chain. The cheat mirrors a real `pxe.updateContract` followed by waiting out the upgrade delay: the instance's `currentContractClassId` is bumped, and the `ContractInstanceRegistry`'s delayed-public-mutable storage is rewritten to look like the upgrade was scheduled in the past.
92
+
`fastForwardContractUpdate` builds the override blobs needed to simulate a deployed instance as if it had already been upgraded to a new contract class. The new class must already be registered on chain. Mirrors a real `pxe.updateContract` followed by waiting out the upgrade delay.
93
+
94
+
It returns two coherent override layers - `stateOverrides` (node-side, redirects public-call dispatch) and `contractOverrides` (PXE-side, redirects private-call dispatch) - so a single spread covers any mix of private and public function calls on the upgraded contract.
Copy file name to clipboardExpand all lines: docs/docs-developers/docs/resources/migration_notes.md
+9-4Lines changed: 9 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,17 +23,22 @@ const result = await contract.methods.read_balance(account).simulate({
23
23
24
24
The same option flows through `wallet.simulateTx` and eventually to `simulatePublicCalls` RPC on `AztecNode`.
25
25
26
-
A second override flavor, `contractInstances`, shadows contract instances in the simulator's contract DB - useful for simulating a contract being on a different class than the one it was deployed with. To simulate a complete on-chain upgrade flow, use the `fastForwardContractUpdate` helper which produces a coherent set of `publicStorage` and `contractInstances` overrides:
26
+
A second override flavor, `contractInstances`, shadows contract instances in the simulator's contract DB - useful for simulating a contract being on a different class than the one it was deployed with.
27
+
28
+
`.simulate(...)` also accepts `contractOverrides`, which replaces the (instance, artifact) pair the PXE-side ACIR simulator uses for a given address. Required to redirect private-function dispatch when simulating against an upgraded class.
29
+
30
+
To simulate a complete on-chain upgrade flow, use the `fastForwardContractUpdate` helper. It returns both `stateOverrides` (node-side, public dispatch) and `contractOverrides` (PXE-side, private dispatch) so a single spread covers any mix of call flavors:
0 commit comments