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
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.updateContract` gets 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, `registerContract` also
became less important, so I simplified it to only take an instance, with
`registerContractClass` taking 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 imagine `ContractInstance` would
be deleted on our side.
Most other changes result from these decisions - the effects were quite
far reaching.
---------
Co-authored-by: Nicolas Chamo <nicolas@chamo.com.ar>
Copy file name to clipboardExpand all lines: docs/docs-developers/docs/aztec-js/how_to_test.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,7 +85,7 @@ Use this to set up state preconditions, reproduce production bugs against pinned
85
85
86
86
### Fast-forwarding a contract update
87
87
88
-
`fastForwardContractUpdate` returns a `SimulationOverrides` object that simulates 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.
88
+
`fastForwardContractUpdate` returns a `SimulationOverrides` object that simulates 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 onchain upgrade followed by waiting out the upgrade delay: the override 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.
Copy file name to clipboardExpand all lines: docs/docs-developers/docs/resources/migration_notes.md
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,33 @@ Aztec is in active development. Each version may introduce breaking changes that
9
9
10
10
## TBD
11
11
12
+
### [PXE]`pxe.updateContract` removed and `pxe.registerContract` no longer takes an artifact
13
+
14
+
Registering classes and instances are now separate, unvalidated operations. `registerContractClass(artifact)` registers a class, `registerContract(instance)` registers an instance and no longer takes an artifact. `registerContract` does not check that PXE knows the contract's artifact: a missing artifact surfaces only when the contract is later simulated.
15
+
16
+
**Migration:**
17
+
18
+
-`pxe.registerContract` now takes the instance directly (its address preimage) and returns the derived address. Register the class separately via `registerContractClass`:
If you were calling it without an artifact, just drop the wrapping object: `pxe.registerContract({ instance })` becomes `pxe.registerContract(instance)`. The `wallet.registerContract(instance, artifact?, secretKeyOrKeys?)` convenience is unchanged and performs both registrations for you.
27
+
28
+
- To make a new class's code available after an onchain upgrade, register the new artifact instead of calling `updateContract`:
29
+
30
+
```diff
31
+
- await pxe.updateContract(address, newArtifact);
32
+
+ await pxe.registerContractClass(newArtifact);
33
+
```
34
+
35
+
The new class is used automatically once the upgrade takes effect on chain; no further PXE action is needed. Registering it beforehand is harmless: until the update activates, the node still resolves the contract's current class to the previous one, so it keeps running its old code.
36
+
37
+
-`pxe.getContractInstance(address)` and `wallet.getContractMetadata(address).instance` now return the contract's **address preimage**, which no longer includes `currentContractClassId`.
38
+
12
39
### [Aztec.js]`AccountWithSecretKey` removed, read account keys from the `AccountManager` or PXE
13
40
14
41
`AccountWithSecretKey` was a thin wrapper that bundled an account's transaction signer with its master secret key, used mainly to print or export the secret. It has been removed, and `AccountManager.getAccount()` now returns the plain `Account` signer. The wrapper's extra methods are no longer available on that value:
0 commit comments