-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: Use new deployment flow in ContractDeployer (#4497)
Updates the `ContractDeployer` to use the new deployment flow. Instead of creating txs flagged as `isDeployment`, the deployer now creates a batch call that registers the contract class (if needed), publicly deploys the contract via the canonical `InstanceDeployer`, and then initializes it by calling the constructor. This batch call is then sent via an account contract entrypoint and executed in a single tx. Check out `e2e_deploy` _publicly deploys and initializes a contract_ to see it in action. However, since this requires sending txs through an account entrypoint, it breaks for deploying accounts. So we still keep the old deployment flow around for those scenarios, under the `LegacyDeployMethod` name. We'll need to tweak account contracts constructors so they can be initialized and optionally deployed in the same single direct call, and they also pay fees for it. Alternatively, we can also add a canonical `MultiCall` contract, which could take care of this, though fee payment is unclear. This PR also changes the `ClassRegisterer` API so that bytecode is provided via a capsule instead of an arg, since having args of size over ~2k elements was causing a loop in the Hasher that massively increased build times (see noir-lang/noir#4395). **Breaking changes:** Since deployments are now done from an account, deploying a contract via `Contract.deploy` now requires a `Wallet` instance instead of a `PXE`, and deploy a contract via CLI now requires a `--private-key`. --------- Co-authored-by: PhilWindle <60546371+PhilWindle@users.noreply.github.com>
- Loading branch information
1 parent
d3ae287
commit 0702dc6
Showing
67 changed files
with
1,075 additions
and
768 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
10 changes: 10 additions & 0 deletions
10
noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/capsule.nr
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copied from noir-contracts/contracts/slow_tree_contract/src/capsule.nr | ||
// We should extract this to a shared lib in aztec-nr once we settle on a design for capsules | ||
|
||
#[oracle(popCapsule)] | ||
fn pop_capsule_oracle<N>() -> [Field; N] {} | ||
|
||
// A capsule is a "blob" of data that is passed to the contract through an oracle. | ||
unconstrained pub fn pop_capsule<N>() -> [Field; N] { | ||
pop_capsule_oracle() | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.