Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
7b88f15
WIP Aztec Sandbox
spypsy Jun 21, 2023
40a8e6f
merge with master
spypsy Jun 21, 2023
dd29b95
fix yarn lock
spypsy Jun 21, 2023
675cff7
Working zk contract deployment over http Aztec RPC
spypsy Jun 25, 2023
03571d1
add expect statements to http test
spypsy Jun 25, 2023
1a8f13f
Remove 'expect'
spypsy Jun 25, 2023
7c7fe81
remove yarn-project build_manifest
spypsy Jun 25, 2023
161944a
Revert project-base dockerfile changes
spypsy Jun 25, 2023
d5cd0b8
add missing RPC methods, move http RPC test
spypsy Jun 26, 2023
eb66286
Merge branch 'sp/aztec-sandbox' of github.com:AztecProtocol/aztec-pac…
spypsy Jun 26, 2023
51e7308
move utils to aztec.js & add endpoints to rpc server
spypsy Jun 26, 2023
9737f1d
move pointToPublicKey to Aztec.js
spypsy Jun 26, 2023
4f74eb0
uniswap test on sandbox
spypsy Jun 27, 2023
3623029
Merge branch 'master' into sp/aztec-sandbox
spypsy Jun 27, 2023
49542b3
Build system work
PhilWindle Jun 27, 2023
04e07f4
Merge branch 'sp/aztec-sandbox' of github.com:AztecProtocol/aztec3-pa…
PhilWindle Jun 27, 2023
120e950
lockfile
PhilWindle Jun 27, 2023
80f3507
update rpc for deploymentTx
spypsy Jun 27, 2023
848dc85
Fix uniswap sandbox example
spypsy Jun 27, 2023
1970fef
Merge branch 'sp/aztec-sandbox' of github.com:AztecProtocol/aztec-pac…
spypsy Jun 27, 2023
bef74d2
CCI Deploy step
PhilWindle Jun 27, 2023
75ea0fe
Merge branch 'sp/aztec-sandbox' of github.com:AztecProtocol/aztec3-pa…
PhilWindle Jun 27, 2023
78081c5
fix json rpc server tests
spypsy Jun 27, 2023
c6c93fe
Merge branch 'sp/aztec-sandbox' of github.com:AztecProtocol/aztec-pac…
spypsy Jun 27, 2023
3b59913
Deploy fix test
PhilWindle Jun 27, 2023
bbb44f7
Merge branch 'sp/aztec-sandbox' of github.com:AztecProtocol/aztec3-pa…
PhilWindle Jun 27, 2023
e5d814d
Submodule update
PhilWindle Jun 27, 2023
9f7dabd
Test filter
PhilWindle Jun 27, 2023
ff85ead
Updated compose file
PhilWindle Jun 27, 2023
65e58b3
Compse file update
PhilWindle Jun 27, 2023
014b347
CCI fix
PhilWindle Jun 27, 2023
c2e2d83
Additional compose file
PhilWindle Jun 27, 2023
91559e0
Wait for Ethereum RPC server to become available
spypsy Jun 27, 2023
813697d
Merge branch 'sp/aztec-sandbox' of github.com:AztecProtocol/aztec-pac…
spypsy Jun 27, 2023
d982fa6
Updated CCI config
PhilWindle Jun 27, 2023
72b9c64
Merge branch 'sp/aztec-sandbox' of github.com:AztecProtocol/aztec3-pa…
PhilWindle Jun 27, 2023
773cc88
fix anvil command for docker-compose-fork
spypsy Jun 27, 2023
e630f71
Submodule bump
PhilWindle Jun 27, 2023
243ca00
Removed unnecessary dependencies
PhilWindle Jun 27, 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
35 changes: 35 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,17 @@ jobs:
name: "Build and test"
command: build aztec-rpc

aztec-sandbox:
machine:
image: ubuntu-2004:202010-01
resource_class: large
steps:
- *checkout
- *setup_env
- run:
name: "Build and test"
command: build aztec-sandbox

circuits-js:
machine:
image: ubuntu-2004:202010-01
Expand Down Expand Up @@ -535,6 +546,20 @@ jobs:
name: "Noop"
command: echo Noop

deploy:
machine:
image: ubuntu-2004:202010-01
resource_class: medium
steps:
- *checkout
- *setup_env
- run:
name: "deploy-sandbox"
working_directory: aztec-sandbox
command: |
deploy_ecr aztec-sandbox
deploy_dockerhub aztec-sandbox master

# Repeatable config for defining the workflow below.
tag_regex: &tag_regex /v[0-9]+(\.[0-9]+)*(-[a-zA-Z-]+\.[0-9]+)?/
defaults: &defaults
Expand Down Expand Up @@ -615,6 +640,7 @@ workflows:
- types: *yarn_project
- circuits-js: *yarn_project
- rollup-provider: *yarn_project
- aztec-sandbox: *yarn_project

- e2e-join:
requires:
Expand Down Expand Up @@ -667,3 +693,12 @@ workflows:
- integration-archiver-l1-to-l2
- e2e-p2p
<<: *defaults

- deploy:
requires:
- e2e-end
- aztec-sandbox
filters:
branches:
only: master
<<: *defaults
15 changes: 15 additions & 0 deletions build_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,21 @@
"types"
]
},
"aztec-sandbox": {
"buildDir": "yarn-project",
"projectDir": "yarn-project/aztec-sandbox",
"dockerfile": "aztec-sandbox/Dockerfile",
"rebuildPatterns": [
"^yarn-project/aztec-sandbox/"
],
"dependencies": [
"aztec-node",
"aztec-rpc",
"aztec.js",
"ethereum",
"foundation"
]
},
"aztec.js": {
"buildDir": "yarn-project",
"projectDir": "yarn-project/aztec.js",
Expand Down
2 changes: 2 additions & 0 deletions build_manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

PROJECTS=(
circuits:circuits/cpp:./dockerfiles/Dockerfile.wasm-linux-clang:circuits-wasm-linux-clang
l1-contracts:l1-contracts
yarn-project-base:yarn-project
end-to-end:yarn-project
aztec-sandbox:yarn-project
)
11 changes: 10 additions & 1 deletion yarn-project/archiver/src/archiver/archiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ export class Archiver implements L2BlockSource, L2LogsSource, ContractDataSource
*/
private lastProcessedBlockNumber = 0n;

/**
* Use this to track logged block in order to avoid repeating the same message.
*/
private lastLoggedBlockNumber = 0n;

/**
* Creates a new instance of the Archiver.
* @param publicClient - A client for interacting with the Ethereum node.
Expand Down Expand Up @@ -123,7 +128,11 @@ export class Archiver implements L2BlockSource, L2LogsSource, ContractDataSource
private async sync(blockUntilSynced: boolean) {
const currentBlockNumber = await this.publicClient.getBlockNumber();
if (currentBlockNumber <= this.lastProcessedBlockNumber) {
this.log(`No new blocks to process, current block number: ${currentBlockNumber}`);
// reducing logs, otherwise this gets triggered on every loop (1s)
if (currentBlockNumber !== this.lastLoggedBlockNumber) {
this.log(`No new blocks to process, current block number: ${currentBlockNumber}`);
this.lastLoggedBlockNumber = currentBlockNumber;
}
return;
}

Expand Down
5 changes: 3 additions & 2 deletions yarn-project/aztec-node/src/aztec-node/http-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export function txToJson(tx: Tx) {
return {
data: tx.data?.toBuffer().toString('hex'),
encryptedLogs: tx.encryptedLogs?.toBuffer().toString('hex'),
unencryptedLogs: tx.unencryptedLogs?.toBuffer().toString('hex'),
proof: tx.proof?.toBuffer().toString('hex'),
newContractPublicFunctions: tx.newContractPublicFunctions?.map(f => f.toBuffer().toString('hex')) ?? [],
enqueuedPublicFunctions: tx.enqueuedPublicFunctionCalls?.map(f => f.toBuffer().toString('hex')) ?? [],
Expand All @@ -49,10 +50,10 @@ export function txFromJson(json: any) {
const encryptedLogs = TxL2Logs.fromBuffer(Buffer.from(json.encryptedLogs, 'hex'));
const unencryptedLogs = TxL2Logs.fromBuffer(Buffer.from(json.unencryptedLogs, 'hex'));
const proof = Buffer.from(json.proof, 'hex');
const newContractPublicFunctions = json.newContractPublicFunctions
const newContractPublicFunctions = json.newContractPublicFunctions?.length
? json.newContractPublicFunctions.map((x: string) => EncodedContractFunction.fromBuffer(Buffer.from(x, 'hex')))
: [];
const enqueuedPublicFunctions = json.enqueuedPublicFunctions
const enqueuedPublicFunctions = json.enqueuedPublicFunctions?.length
? json.enqueuedPublicFunctions.map((x: string) => PublicCallRequest.fromBuffer(Buffer.from(x, 'hex')))
: [];
return Tx.createTx(
Expand Down
3 changes: 2 additions & 1 deletion yarn-project/aztec-rpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"clean": "rm -rf ./dest .tsbuildinfo",
"formatting": "run -T prettier --check ./src && run -T eslint ./src",
"formatting:fix": "run -T prettier -w ./src",
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --passWithNoTests"
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --passWithNoTests",
"start:http": "DEBUG='aztec:*' && node ./dest/aztec_rpc_http/aztec_rpc_http_server.js"
},
"inherits": [
"../package.common.json"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import { AztecAddress, EthAddress, Fr } from '@aztec/circuits.js';
import { ContractAbi } from '@aztec/foundation/abi';
import { Point } from '@aztec/foundation/fields';
import { ContractDeploymentTx, PartialContractAddress, Tx, TxHash } from '@aztec/types';
import {
ContractData,
ContractDeploymentTx,
ContractPublicData,
L2BlockL2Logs,
PartialContractAddress,
Tx,
TxHash,
} from '@aztec/types';
import { TxReceipt } from '../tx/index.js';
import { CurveType, SignerType } from '../crypto/types.js';

Expand All @@ -25,12 +33,12 @@ export interface DeployedContract {
}

/**
* Represents an Aztec RPC client implementation.
* Represents an Aztec RPC implementation.
* Provides functionality for all the operations needed to interact with the Aztec network,
* including account management, contract deployment, transaction creation, and execution,
* as well as storage and view functions for smart contracts.
*/
export interface AztecRPCClient {
export interface AztecRPC {
createSmartAccount(
privKey?: Buffer,
curve?: CurveType,
Expand Down Expand Up @@ -66,4 +74,8 @@ export interface AztecRPCClient {
getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
getStorageAt(contract: AztecAddress, storageSlot: Fr): Promise<any>;
viewTx(functionName: string, args: any[], to: AztecAddress, from?: AztecAddress): Promise<any>;
getContractData(contractAddress: AztecAddress): Promise<ContractPublicData | undefined>;
getContractInfo(contractAddress: AztecAddress): Promise<ContractData | undefined>;
getUnencryptedLogs(from: number, take: number): Promise<L2BlockL2Logs[]>;
getBlockNum(): Promise<number>;
}
1 change: 1 addition & 0 deletions yarn-project/aztec-rpc/src/aztec_rpc/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './aztec_rpc.js';
33 changes: 33 additions & 0 deletions yarn-project/aztec-rpc/src/aztec_rpc_http/aztec_rpc_http_server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { foundry } from 'viem/chains';
import { Tx, TxHash, ContractDeploymentTx } from '@aztec/types';
import { JsonRpcServer } from '@aztec/foundation/json-rpc';
import { AztecAddress } from '@aztec/foundation/aztec-address';
import { Fr, Point } from '@aztec/foundation/fields';
import { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';

import { EthAddress, createAztecRPCServer } from '../index.js';

export const localAnvil = foundry;

/**
* Wraps an instance of the Aztec RPC Server implementation to a JSON RPC HTTP interface.
* @returns A new instance of the HTTP server.
*/
export async function getHttpRpcServer(nodeConfig: AztecNodeConfig): Promise<JsonRpcServer> {
const aztecNode = await AztecNodeService.createAndSync(nodeConfig);
const aztecRpcServer = await createAztecRPCServer(aztecNode);
const generatedRpcServer = new JsonRpcServer(
aztecRpcServer,
{
AztecAddress,
TxHash,
EthAddress,
Point,
Fr,
},
{ Tx, ContractDeploymentTx },
false,
['start', 'stop'],
);
return generatedRpcServer;
}
1 change: 1 addition & 0 deletions yarn-project/aztec-rpc/src/aztec_rpc_http/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './aztec_rpc_http_server.js';
Loading