Skip to content

Commit

Permalink
Merge branch 'master' into 02-23-refactor_renamings_of_state_var_wrap…
Browse files Browse the repository at this point in the history
…pers
  • Loading branch information
benesjan authored Feb 26, 2024
2 parents 165027d + f3c65ce commit f0fb71c
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 53 deletions.
7 changes: 3 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1389,16 +1389,15 @@ workflows:
# Yarn Project
- yarn-project-base:
requires:
- avm-transpiler
- l1-contracts
- bb-js
- noir-packages
- noir-projects
- boxes-files
<<: *defaults
- yarn-project:
requires:
- yarn-project-base
- l1-contracts
- noir-projects
- boxes-files
<<: *defaults
- yarn-project-prod: *defaults_yarn_project
- yarn-project-formatting: *defaults_yarn_project
Expand Down
3 changes: 2 additions & 1 deletion boxes/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ node_modules
.tsbuildinfo
Dockerfile*
.dockerignore
docker-compose.yml
docker-compose.yml
**/artifacts
3 changes: 2 additions & 1 deletion boxes/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/noir-projects as noir-projects

# We need yarn. Start fresh container.
FROM node:18.19.0
RUN apt update && apt install netcat-openbsd
COPY --from=aztec /usr/src /usr/src
COPY --from=noir /usr/src/noir/target/release/nargo /usr/src/noir/target/release/nargo
COPY --from=noir-projects /usr/src/noir-projects/aztec-nr /usr/src/noir-projects/aztec-nr
WORKDIR /usr/src/boxes
ENV AZTEC_NARGO=/usr/src/noir/target/release/nargo
ENV AZTEC_CLI=/usr/src/yarn-project/cli/aztec-cli-dest
RUN yarn && yarn build
ENTRYPOINT ["yarn", "workspace"]
ENTRYPOINT ["/bin/sh", "-c"]
6 changes: 5 additions & 1 deletion boxes/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ services:

boxes:
image: aztecprotocol/boxes
command: "@aztec/$BOX test"
entrypoint: >
sh -c '
while ! nc -z aztec 8080; do sleep 1; done;
yarn workspace @aztec/$BOX test
'
environment:
DEBUG: "aztec:*"
DEBUG_COLORS: "true"
Expand Down
2 changes: 1 addition & 1 deletion boxes/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"serve": "serve -p 3000 ./dist",
"formatting": "prettier --check ./src && eslint ./src",
"formatting:fix": "prettier -w ./src",
"test": "yarn prep && NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --runInBand"
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --runInBand"
},
"jest": {
"preset": "ts-jest/presets/default-esm",
Expand Down
8 changes: 3 additions & 5 deletions build_manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,8 @@ yarn-project-base:
- ^yarn-project/yarn.lock
- ^yarn-project/.*/package.json$
dependencies:
- l1-contracts
- bb.js
- noir
- noir-packages
- boxes-files
- avm-transpiler
- noir-projects

yarn-project:
buildDir: yarn-project
Expand All @@ -151,6 +146,9 @@ yarn-project:
- ^yarn-project/cli/aztec-cli
dependencies:
- yarn-project-base
- l1-contracts
- boxes-files
- noir-projects

yarn-project-prod:
buildDir: yarn-project
Expand Down
15 changes: 10 additions & 5 deletions yarn-project/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,24 @@
# - Run the tests.
# - Run the formatter checks.
# Any subsequent build steps needed to support downstream containers should be done in those containers build files.
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/yarn-project-base as builder
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/l1-contracts as contracts
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/noir-projects as noir-projects
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/boxes-files as boxes-files

# Copy in the entire workspace.
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/yarn-project-base
COPY --from=contracts /usr/src/l1-contracts /usr/src/l1-contracts
COPY --from=noir-projects /usr/src/noir-projects /usr/src/noir-projects
COPY --from=boxes-files /usr/src/boxes /usr/src/boxes
COPY . .

# Generate L1 contract TypeScript artifacts.
RUN cd l1-artifacts && ./scripts/generate-artifacts.sh && rm -rf /usr/src/l1-contracts
# This is actually our code generation tool. Needed to build contract typescript wrappers.
RUN yarn workspace @aztec/noir-compiler build
# Builds noir contracts (TODO: move this stage pre yarn-project). Generates typescript wrappers.
# Generates typescript wrappers.
RUN yarn workspace @aztec/noir-contracts.js build:contracts
# We need to build accounts as it needs to copy in account contracts from noir-contracts.
RUN yarn workspace @aztec/accounts build:copy-contracts
RUN yarn workspace @aztec/protocol-contracts build:copy-contracts
RUN yarn workspace @aztec/noir-protocol-circuits-types build
RUN yarn tsc -b

ENTRYPOINT ["yarn"]
3 changes: 2 additions & 1 deletion yarn-project/aztec-node/src/aztec-node/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ export class AztecNodeService implements AztecNode {
`Registry: ${config.l1Contracts.registryAddress.toString()}\n` +
`Inbox: ${config.l1Contracts.inboxAddress.toString()}\n` +
`Outbox: ${config.l1Contracts.outboxAddress.toString()}\n` +
`Contract Emitter: ${config.l1Contracts.contractDeploymentEmitterAddress.toString()}`;
`Contract Emitter: ${config.l1Contracts.contractDeploymentEmitterAddress.toString()}\n` +
`Availability Oracle: ${config.l1Contracts.availabilityOracleAddress.toString()}`;
this.log(message);
}

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec-node/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ resource "aws_ecs_task_definition" "aztec-node" {
"value": "false"
},
{
"name": "AZTEC_NODE_PORT",
"name": "AZTEC_PORT",
"value": "80"
},
{
Expand Down
22 changes: 11 additions & 11 deletions yarn-project/aztec.js/src/rpc_clients/pxe_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,28 @@ import { createJsonRpcClient, makeFetch } from '@aztec/foundation/json-rpc/clien
* @param fetch - The fetch implementation to use.
* @returns A JSON-RPC client of PXE.
*/
export const createPXEClient = (url: string, fetch = makeFetch([1, 2, 3], true)): PXE =>
export const createPXEClient = (url: string, fetch = makeFetch([1, 2, 3], false)): PXE =>
createJsonRpcClient<PXE>(
url,
{
CompleteAddress,
FunctionSelector,
AuthWitness,
AztecAddress,
TxExecutionRequest,
CompleteAddress,
ContractData,
FunctionSelector,
EthAddress,
ExtendedContractData,
ExtendedNote,
ExtendedUnencryptedL2Log,
TxHash,
EthAddress,
Point,
Fr,
GrumpkinScalar,
Note,
ExtendedNote,
AuthWitness,
L2Block,
L2Tx,
LogId,
L2Block,
Note,
Point,
TxExecutionRequest,
TxHash,
},
{ Tx, TxReceipt, L2BlockL2Logs },
false,
Expand Down
3 changes: 2 additions & 1 deletion yarn-project/end-to-end/src/fixtures/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
createDebugLogger,
createPXEClient,
deployL1Contracts,
makeFetch,
waitForPXE,
} from '@aztec/aztec.js';
import {
Expand Down Expand Up @@ -164,7 +165,7 @@ async function setupWithRemoteEnvironment(
logger(`Creating Aztec Node client to remote host ${aztecNodeUrl}`);
const aztecNode = createAztecNodeClient(aztecNodeUrl);
logger(`Creating PXE client to remote host ${PXE_URL}`);
const pxeClient = createPXEClient(PXE_URL);
const pxeClient = createPXEClient(PXE_URL, makeFetch([1, 2, 3], true));
await waitForPXE(pxeClient, logger);
logger('JSON RPC client connected to PXE');
logger(`Retrieving contract addresses from ${PXE_URL}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export function makeFetch(retries: number[], noRetry: boolean, log?: DebugLogger
return async (host: string, rpcMethod: string, body: any, useApiEndpoints: boolean) => {
return await retry(
() => defaultFetch(host, rpcMethod, body, useApiEndpoints, noRetry),
`JsonRpcClient request to ${host}`,
`JsonRpcClient request ${rpcMethod} to ${host}`,
makeBackoff(retries),
log,
true,
Expand Down
5 changes: 3 additions & 2 deletions yarn-project/pxe/src/pxe_http/pxe_http_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { FunctionSelector } from '@aztec/circuits.js';
import { AztecAddress } from '@aztec/foundation/aztec-address';
import { EthAddress } from '@aztec/foundation/eth-address';
import { Fr, GrumpkinScalar, Point } from '@aztec/foundation/fields';
import { JsonRpcServer } from '@aztec/foundation/json-rpc/server';
import { JsonRpcServer, createNamespacedJsonRpcServer } from '@aztec/foundation/json-rpc/server';

import http from 'http';

Expand Down Expand Up @@ -63,7 +63,8 @@ export function createPXERpcServer(pxeService: PXE): JsonRpcServer {
* @returns A running http server.
*/
export function startPXEHttpServer(pxeService: PXE, port: string | number): http.Server {
const rpcServer = createPXERpcServer(pxeService);
const pxeServer = createPXERpcServer(pxeService);
const rpcServer = createNamespacedJsonRpcServer([{ pxe: pxeServer }]);

const app = rpcServer.getApp();
const httpServer = http.createServer(app.callback());
Expand Down
20 changes: 2 additions & 18 deletions yarn-project/yarn-project-base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,15 @@
# RUN yarn workspaces focus --production && yarn cache clean && rm -rf ../**/src
# - Create final slim image by copying needed dirs into a fresh image.
#
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/l1-contracts as contracts
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/bb.js as bb.js
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/noir-projects as noir-projects
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/noir-packages as noir-packages
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/boxes-files as boxes-files

FROM node:18.19.0
RUN apt update && apt install -y jq curl perl && rm -rf /var/lib/apt/lists/* && apt-get clean

# Copy L1 contracts.
COPY --from=contracts /usr/src/l1-contracts /usr/src/l1-contracts
# Copy in bb.js
# Copy in portalled packages.
COPY --from=bb.js /usr/src/barretenberg/ts /usr/src/barretenberg/ts
# Copy in noir packages
COPY --from=noir-packages /usr/src/noir/packages /usr/src/noir/packages
# Copy in noir projects
COPY --from=noir-projects /usr/src/noir-projects /usr/src/noir-projects
# Copy in boxes
COPY --from=boxes-files /usr/src/boxes /usr/src/boxes

# We install a symlink to yarn-project's node_modules at a location that all portalled packages can find as they
# walk up the tree as part of module resolution. The supposedly idiomatic way of supporting module resolution
Expand Down Expand Up @@ -88,11 +78,5 @@ RUN yarn --immutable && rm -rf /root/.cache/puppeteer && /bin/bash -c '\
[[ $F =~ (.*-) ]] && ln $F /root/.yarn/berry/cache/${BASH_REMATCH[1]}8.zip; \
done'

# If everything's worked properly, we should no longer need access to the network.
RUN echo "enableNetwork: false" >> .yarnrc.yml

# Check package.json inheritance and tsconfig project references.
RUN yarn prepare:check

# Generate L1 contract TypeScript artifacts.
RUN cd l1-artifacts && ./scripts/generate-artifacts.sh && rm -rf /usr/src/l1-contracts
RUN yarn prepare:check

0 comments on commit f0fb71c

Please sign in to comment.