Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: auto-recompile the boxes and fix broken frontend CompleteAddress import #2727

Merged
merged 57 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
fecbc51
add new blank contract
dan-aztec Oct 3, 2023
9f1508a
add to top level toml
dan-aztec Oct 3, 2023
6c76497
Merge branch 'master' into dan/auto-copy-box-artifacts
dan-aztec Oct 3, 2023
b79f8a3
ecdsa changes
dan-aztec Oct 3, 2023
b4ca725
update docs test
dan-aztec Oct 3, 2023
e0c9575
Merge branch 'master' into dan/auto-copy-box-artifacts
dan-aztec Oct 3, 2023
0508976
revert to local paths in box Nargo.toml and overwrite on unbox
dan-aztec Oct 3, 2023
9dcc009
add support for copying noir source files in noir-contracts
dan-aztec Oct 3, 2023
2c71c34
Merge branch 'master' into dan/auto-copy-box-artifacts
dan-aztec Oct 3, 2023
61b6a8e
break link with noir-contracts
dan-aztec Oct 4, 2023
8cb6af3
revert changes to noir-contracts
dan-aztec Oct 4, 2023
dd7a554
revert docs change
dan-aztec Oct 4, 2023
ce47d49
Merge branch 'master' into dan/auto-copy-box-artifacts
dan-aztec Oct 4, 2023
8d45b54
add a bootstrap to compile files
dan-aztec Oct 4, 2023
d23e1d7
add boxes bootstrap to yarn bootstrap
dan-aztec Oct 4, 2023
f791d0d
back and forth on lint vs compiled output
dan-aztec Oct 4, 2023
db1bfa1
fix relative import in edge case
dan-aztec Oct 4, 2023
470bb5c
Merge branch 'master' into dan/auto-copy-box-artifacts
dan-aztec Oct 4, 2023
e3d0997
update imports
dan-aztec Oct 4, 2023
d2b4695
typo
dan-aztec Oct 4, 2023
b8981ef
osx is case insensitive...
dan-aztec Oct 4, 2023
651a49b
readd uppercase
dan-aztec Oct 4, 2023
878008c
Merge branch 'master' into dan/auto-copy-box-artifacts
dan-aztec Oct 4, 2023
769143d
formatting
dan-aztec Oct 4, 2023
e866c5e
Merge branch 'master' into dan/auto-copy-box-artifacts
dan-aztec Oct 4, 2023
308d5e8
Merge branch 'master' into dan/auto-copy-box-artifacts
dan-aztec Oct 4, 2023
5b31efc
Merge branch 'master' into dan/auto-copy-box-artifacts
dan-aztec Oct 4, 2023
d59e7e4
Merge branch 'master' into dan/auto-copy-box-artifacts
dan-aztec Oct 5, 2023
903486d
turn on source maps
dan-aztec Oct 4, 2023
241d435
move Point import in circuits
dan-aztec Oct 5, 2023
5d81be8
add check for completeaddress in browser
dan-aztec Oct 5, 2023
88a1703
revert fix to see if e2e test catches it
dan-aztec Oct 5, 2023
fecb80b
refix it
dan-aztec Oct 5, 2023
3b3fdad
fix test and rebreak
dan-aztec Oct 5, 2023
b70a899
refix and see if e2e passes
dan-aztec Oct 5, 2023
f79844c
Merge branch 'master' into dan/auto-copy-box-artifacts
dan-aztec Oct 5, 2023
e327b53
try different test
dan-aztec Oct 5, 2023
f5bba47
move all Point imports to foundation
dan-aztec Oct 5, 2023
50588c6
didnt realize random needed wasm
dan-aztec Oct 5, 2023
4c7db71
only test this one
dan-aztec Oct 5, 2023
42d49ea
Merge branch 'master' into dan/auto-copy-box-artifacts
dan-aztec Oct 6, 2023
eeb8d48
thanks alex for debugging e2e test
dan-aztec Oct 6, 2023
452e5dd
empty log
dan-aztec Oct 6, 2023
3d29209
Merge remote-tracking branch 'origin/master' into dan/auto-copy-box-fix
dan-aztec Oct 6, 2023
b0bbbea
fix to use local cli instead of installed aztec-cli, recompile on 0.16
dan-aztec Oct 6, 2023
c3cdf2c
revert change to browser headless config
dan-aztec Oct 6, 2023
edf9086
turn on source maps in boxes
dan-aztec Oct 6, 2023
8335e9e
Merge branch 'master' into dan/auto-copy-box-fix
dan-aztec Oct 6, 2023
6c19a4f
Merge branch 'master' into dan/auto-copy-box-fix
dan-aztec Oct 6, 2023
c636548
Merge branch 'master' into dan/auto-copy-box-fix
dan-aztec Oct 9, 2023
8c9f1c9
just remove cli dep, remove others in followup
dan-aztec Oct 9, 2023
10cdfdc
pr feedback
dan-aztec Oct 9, 2023
fb9a2d1
Merge branch 'master' into dan/auto-copy-box-fix
dan-aztec Oct 9, 2023
ce2e927
get string without trailing 0s
dan-aztec Oct 9, 2023
79e2d4b
adjust for trailing 0s in return
dan-aztec Oct 9, 2023
0b63a54
Merge branch 'master' into dan/auto-copy-box-fix
dan-aztec Oct 10, 2023
b6838e7
move relative path correction logic up, add to other command
dan-aztec Oct 10, 2023
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Point } from '@aztec/circuits.js';
import { ContractAbi } from '@aztec/foundation/abi';
import { Point } from '@aztec/foundation/fields';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there was some import error with CompleteAddress inside the box frontend apps, this was the fix (same change is in a few files)

import { PXE, PublicKey } from '@aztec/types';

import { DeployMethod } from './deploy_method.js';
Expand Down
1 change: 1 addition & 0 deletions yarn-project/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ yarn --cwd circuits.js remake-bindings
yarn --cwd circuits.js remake-constants

(cd noir-contracts && ./bootstrap.sh)
(cd boxes && ./bootstrap.sh)
(cd .. && l1-contracts/bootstrap.sh)

# Until we push .yarn/cache, we still need to install.
Expand Down
3 changes: 3 additions & 0 deletions yarn-project/boxes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This contains the "boxes" that are meant for quickstarts for Aztec smart contract developers, containing simple Noir smart contracts and frontends.

If CI is failing, it may be due to incompatibility with previous build artifacts - running "./bootstrap.sh" inside this boxes folder should regenerate the artifacts.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import { Fr, Point } from '@aztec/foundation/fields';
import { PXE, PublicKey } from '@aztec/types';
import { ContractAbi } from '@aztec/foundation/abi';
import BlankContractAbiJson from './blank_contract.json' assert { type: 'json' };
import BlankContractAbiJson from './Blank.json' assert { type: 'json' };
export const BlankContractAbi = BlankContractAbiJson as ContractAbi;

/**
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/boxes/blank-react/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PXE, createPXEClient } from '@aztec/aztec.js';
import { ContractAbi } from '@aztec/foundation/abi';
import { BlankContractAbi } from './artifacts/blank.js';
import { BlankContractAbi } from './artifacts/Blank.js';

// update this if using a different contract

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/boxes/blank-react/src/contracts/Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ compiler_version = "0.1"
type = "contract"

[dependencies]
aztec = { git="https://github.com/AztecProtocol/aztec-packages", tag="master", directory="yarn-project/aztec-nr/aztec" }
aztec = { path = "../../../../aztec-nr/aztec" }
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { BlankContract } from '../artifacts/blank.js';
import { callContractFunction, deployContract, getWallet } from '../scripts/index.js';
import {
AccountWallet,
AztecAddress,
PXE,
CompleteAddress,
Contract,
Fr,
PXE,
TxStatus,
Wallet,
createPXEClient,
waitForSandbox,
} from '@aztec/aztec.js';
import { createDebugLogger } from '@aztec/foundation/log';
import { BlankContract } from '../artifacts/Blank.js';
import { callContractFunction, deployContract, getWallet } from '../scripts/index.js';

const logger = createDebugLogger('aztec:http-pxe-client');

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/boxes/blank-react/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const require = createRequire(import.meta.url);
export default (_, argv) => ({
target: 'web',
mode: 'production',
devtool: false,
devtool: 'source-map',
entry: {
main: './src/app/index.tsx',
},
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import { Fr, Point } from '@aztec/foundation/fields';
import { PXE, PublicKey } from '@aztec/types';
import { ContractAbi } from '@aztec/foundation/abi';
import BlankContractAbiJson from './blank_contract.json' assert { type: 'json' };
import BlankContractAbiJson from './Blank.json' assert { type: 'json' };
export const BlankContractAbi = BlankContractAbiJson as ContractAbi;

/**
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/boxes/blank/src/contracts/Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ compiler_version = "0.1"
type = "contract"

[dependencies]
aztec = { git="https://github.com/AztecProtocol/aztec-packages", tag="master", directory="yarn-project/aztec-nr/aztec" }
aztec = { path = "../../../../aztec-nr/aztec" }
2 changes: 1 addition & 1 deletion yarn-project/boxes/blank/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from '@aztec/aztec.js';
import { ContractAbi, FunctionAbi, encodeArguments } from '@aztec/foundation/abi';
import { FieldsOf } from '@aztec/foundation/types';
import { BlankContractAbi } from './artifacts/blank.js';
import { BlankContractAbi } from './artifacts/Blank.js';
export const contractAbi: ContractAbi = BlankContractAbi;

export const PXE_URL: string = process.env.PXE_URL || 'http://localhost:8080';
Expand Down
5 changes: 3 additions & 2 deletions yarn-project/boxes/blank/src/tests/blank.contract.test.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import {
AccountWallet,
AztecAddress,
PXE,
CompleteAddress,
Contract,
Fr,
PXE,
TxStatus,
Wallet,
createPXEClient,
waitForSandbox,
} from '@aztec/aztec.js';
import { createDebugLogger } from '@aztec/foundation/log';
import { BlankContract } from '../artifacts/blank.js';
// eslint-disable-next-line import/no-unresolved
dan-aztec marked this conversation as resolved.
Show resolved Hide resolved
import { BlankContract } from '../artifacts/Blank.js';
import { callContractFunction, deployContract, getWallet } from '../index.js';
const logger = createDebugLogger('aztec:blank-box-test');

Expand Down
3 changes: 0 additions & 3 deletions yarn-project/boxes/blank/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@
{
"path": "../../circuits.js"
},
{
"path": "../../cli"
},
{
"path": "../../foundation"
}
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/boxes/blank/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const require = createRequire(import.meta.url);
export default (_, argv) => ({
target: 'web',
mode: 'production',
devtool: false,
devtool: 'source-map',
entry: {
main: './src/index.ts',
},
Expand Down
25 changes: 25 additions & 0 deletions yarn-project/boxes/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash


# should be run from yarn-project/boxes
original_path=$(pwd)

# Loop through all directories in 'boxes'
for dir in *; do
# Check if it's a directory
if [ -d "${dir}" ]; then

# Run the compile command
echo "Running compile command inside ${dir}..."

# Change directory to ../cli
cd ../cli

# Run ts-node command to use latest "compile" code
ts-node --esm src/bin/index.ts compile "${original_path}/${dir}/src/contracts" --outdir "${original_path}/${dir}/src/artifacts" --typescript "${original_path}/${dir}/src/artifacts"

# Change back to the original directory
cd "${original_path}"

fi
done
Loading