Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ jobs:
run: script -e -c "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --config jest.integration.config.json && aztec test"

- name: Run scripts
run: script -e -c "yarn deploy && yarn deploy-account && yarn fees && yarn multiple-pxe"
run: script -e -c "yarn deploy && yarn deploy-account && yarn fees && yarn multiple-pxe && yarn profile"
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,20 @@ yarn codegen

:warning: Tests and scripts set up and run the Private Execution Environment (PXE) and store PXE data in the `./store` directory. If you restart the sandbox, you will need to delete the `./store` directory to avoid errors.

## Transaction Profiling

**Make sure the sandbox is running before profiling.**

```bash
aztec start --sandbox
```

Then run an example contract deployment profile with:

```bash
yarn profile
```

## 🧪 **Test**

**Make sure the sandbox is running before running tests.**
Expand Down Expand Up @@ -121,6 +135,7 @@ You can find a handful of scripts in the `./scripts` folder.
- `./scripts/deploy.ts` is an example of how to deploy a contract.
- `./scripts/fees.ts` is an example of how to pay for a contract deployment using various fee payment methods.
- `./scripts/multiple_pxe.ts` is an example of how to deploy a contract from one PXE instance and interact with it from another.
- `./scripts/profile_deploy.ts` shows how to profile a transaction and print the results.

## ❗ **Error Resolution**

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"deploy-account": "node --loader ts-node/esm scripts/deploy_account.ts",
"multiple-pxe": "node --loader ts-node/esm scripts/multiple_pxe.ts",
"get-block": "node --loader ts-node/esm scripts/get_block.ts",
"profile": "node --loader ts-node/esm scripts/profile_deploy.ts",
"test": "yarn test:js && yarn test:nr",
"test:js": "rm -rf store/pxe && NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --config jest.integration.config.json",
"test:nr": "aztec test",
Expand Down
28 changes: 28 additions & 0 deletions scripts/profile_deploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { EasyPrivateVotingContract } from "../src/artifacts/EasyPrivateVoting.js"
import { createLogger, PXE, Logger, SponsoredFeePaymentMethod, Fr } from "@aztec/aztec.js";
import { setupPXE } from "../src/utils/setup_pxe.js";
import { getSponsoredFPCInstance } from "../src/utils/sponsored_fpc.js";
import { SponsoredFPCContract } from "@aztec/noir-contracts.js/SponsoredFPC";
import { deploySchnorrAccount } from "../src/utils/deploy_account.js";

async function main() {

let pxe: PXE;
let logger: Logger;

logger = createLogger('aztec:aztec-starter');

pxe = await setupPXE();

const sponsoredFPC = await getSponsoredFPCInstance();
await pxe.registerContract({ instance: sponsoredFPC, artifact: SponsoredFPCContract.artifact });

let accountManager = await deploySchnorrAccount(pxe);
const wallet = await accountManager.getWallet();
const address = accountManager.getAddress();

const profileTx = await EasyPrivateVotingContract.deploy(wallet, address).profile({ profileMode: "full"});
console.dir(profileTx, { depth: 2 });
}

main();