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: GrumpkinScalar type #1919

Merged
merged 29 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1d0f22d
feat: GrumpkinScalar
benesjan Sep 5, 2023
75aeb0d
typo fix
benesjan Sep 5, 2023
c166e5b
WIP
benesjan Sep 5, 2023
077b65d
fix
benesjan Sep 5, 2023
562ae2d
typo fix to trigger full rebuild
benesjan Sep 5, 2023
6c3c743
feat: grumpkin_scalar.nr
benesjan Sep 6, 2023
2967ab0
feat: serialization of grumpkin scalar to 2 Fr elements
benesjan Sep 6, 2023
d0ccd96
WIP
benesjan Sep 6, 2023
1e2d94a
better naming + linking issue
benesjan Sep 6, 2023
8830d6d
test fix
benesjan Sep 6, 2023
9c8c7b0
snake case
benesjan Sep 6, 2023
324d193
better description
benesjan Sep 6, 2023
1159e07
reverting incorrectly introduced change
benesjan Sep 6, 2023
a06534f
camel case issue 2
benesjan Sep 6, 2023
18d6287
using sign closure to avoid code duplication
benesjan Sep 6, 2023
5b696fd
removed redundant argument
benesjan Sep 6, 2023
4ea726b
Merge branch 'master' into janb/private-key-as-grumpkin-field
benesjan Sep 7, 2023
cc23973
WIP
benesjan Sep 7, 2023
4521c85
fixes
benesjan Sep 7, 2023
de5568a
fix
benesjan Sep 7, 2023
abaf0df
typo fix to trigger full rebuild
benesjan Sep 7, 2023
332f9e7
attempt at getting more info
benesjan Sep 7, 2023
20840e8
update e2e docker-compose sandbox image
spypsy Sep 7, 2023
431103c
tag :latest in run_tests_local
spypsy Sep 7, 2023
e398fe5
revert img name
spypsy Sep 7, 2023
84515bb
Attempt build fix
PhilWindle Sep 7, 2023
941a9ce
Try again
PhilWindle Sep 7, 2023
fa2eaf3
Another attempt
PhilWindle Sep 7, 2023
0ab32ee
Merge branch 'pw/fix-build-3' into janb/private-key-as-grumpkin-field
benesjan Sep 7, 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
2 changes: 1 addition & 1 deletion circuits/cpp/src/aztec3/circuits/kernel/private/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void common_update_end_values(DummyBuilder& builder,

const auto& storage_contract_address = private_call_public_inputs.call_context.storage_contract_address;

// Transient read requests and witnessess are accumulated in public_inputs.end
// Transient read requests and witnesses are accumulated in public_inputs.end
// We silo the read requests (domain separation per contract address)
{
for (size_t i = 0; i < read_requests.size(); ++i) {
Expand Down
4 changes: 2 additions & 2 deletions circuits/cpp/src/aztec3/circuits/rollup/base/.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,8 @@ TEST_F(base_rollup_tests, native_nullifier_tree_regression)
DummyCircuitBuilder builder = DummyCircuitBuilder("base_rollup_tests__native_nullifier_tree_regression");

// This test runs after some data has already been inserted into the tree
// This test will pre-populate the tree with 6 * KERNEL_NEW_NULLILFIERS_LENGTH values (0 item + 6 *
// KERNEL_NEW_NULLILFIERS_LENGTH -1 more) simulating that a rollup inserting two random values has already
// This test will pre-populate the tree with 6 * KERNEL_NEW_NULLIFIERS_LENGTH values (0 item + 6 *
// KERNEL_NEW_NULLIFIERS_LENGTH -1 more) simulating that a rollup inserting two random values has already
// succeeded. Note that this corresponds to 3 (1 already initialized and 2 new ones) base rollups. This rollup then
// adds two further random values that will end up having their low nullifiers point at each other
std::vector<fr> initial_values(6 * MAX_NEW_NULLIFIERS_PER_TX - 1, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,14 @@ export class ClientTxExecutionContext {
* @param contractAddress - The contract address.
* @param ownerX - The x coordinate of the owner's public key.
* @param ownerY - The y coordinate of the owner's public key.
* @returns The secret key of the owner.
* @returns The secret key of the owner as a pair of ACVM fields.
*/
public async getSecretKey(contractAddress: AztecAddress, ownerX: ACVMField, ownerY: ACVMField) {
return toACVMField(
(await this.db.getSecretKey(contractAddress, new Point(fromACVMField(ownerX), fromACVMField(ownerY)))).value,
const secretKey = await this.db.getSecretKey(
contractAddress,
new Point(fromACVMField(ownerX), fromACVMField(ownerY)),
);
return [toACVMField(secretKey.high), toACVMField(secretKey.low)];
}

/**
Expand Down
6 changes: 3 additions & 3 deletions yarn-project/acir-simulator/src/client/db_oracle.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CompleteAddress, HistoricBlockData, PrivateKey, PublicKey } from '@aztec/circuits.js';
import { CompleteAddress, GrumpkinPrivateKey, HistoricBlockData, PublicKey } from '@aztec/circuits.js';
import { FunctionAbi, FunctionDebugMetadata, FunctionSelector } from '@aztec/foundation/abi';
import { AztecAddress } from '@aztec/foundation/aztec-address';
import { EthAddress } from '@aztec/foundation/eth-address';
Expand Down Expand Up @@ -95,10 +95,10 @@ export interface DBOracle extends CommitmentsDB {
*
* @param contractAddress - The contract address. Ignored here. But we might want to return different keys for different contracts.
* @param pubKey - The public key of an account.
* @returns A Promise that resolves to the secret key as a Buffer.
* @returns A Promise that resolves to the secret key.
* @throws An Error if the input address does not match the public key address of the key pair.
*/
getSecretKey(contractAddress: AztecAddress, pubKey: PublicKey): Promise<PrivateKey>;
getSecretKey(contractAddress: AztecAddress, pubKey: PublicKey): Promise<GrumpkinPrivateKey>;

/**
* Retrieves a set of notes stored in the database for a given contract address and storage slot.
Expand Down
23 changes: 15 additions & 8 deletions yarn-project/acir-simulator/src/client/private_execution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
L1_TO_L2_MSG_TREE_HEIGHT,
MAX_NEW_COMMITMENTS_PER_CALL,
PRIVATE_DATA_TREE_HEIGHT,
PrivateKey,
PublicCallRequest,
TxContext,
} from '@aztec/circuits.js';
Expand All @@ -28,7 +27,7 @@ import { asyncMap } from '@aztec/foundation/async-map';
import { AztecAddress } from '@aztec/foundation/aztec-address';
import { toBufferBE } from '@aztec/foundation/bigint-buffer';
import { EthAddress } from '@aztec/foundation/eth-address';
import { Fr } from '@aztec/foundation/fields';
import { Fr, GrumpkinScalar } from '@aztec/foundation/fields';
import { DebugLogger, createDebugLogger } from '@aztec/foundation/log';
import { AppendOnlyTree, Pedersen, StandardTree, newTree } from '@aztec/merkle-tree';
import {
Expand Down Expand Up @@ -66,7 +65,7 @@ describe('Private Execution test suite', () => {
let logger: DebugLogger;

const defaultContractAddress = AztecAddress.random();
const ownerPk = PrivateKey.fromString('5e30a2f886b4b6a11aea03bf4910fbd5b24e61aa27ea4d05c393b3ab592a8d33');
const ownerPk = GrumpkinScalar.fromString('2dcc5485a58316776299be08c78fa3788a1a7961ae30dc747fb1be17692a8d32');

const treeHeights: { [name: string]: number } = {
privateData: PRIVATE_DATA_TREE_HEIGHT,
Expand Down Expand Up @@ -168,7 +167,7 @@ describe('Private Execution test suite', () => {

describe('private token airdrop contract', () => {
const contractAddress = defaultContractAddress;
const recipientPk = PrivateKey.fromString('0c9ed344548e8f9ba8aa3c9f8651eaa2853130f6c1e9c050ccf198f7ea18a7ec');
const recipientPk = GrumpkinScalar.fromString('0c9ed344548e8f9ba8aa3c9f8651eaa2853130f6c1e9c050ccf198f7ea18a7ec');
const mockFirstNullifier = new Fr(1111);
let owner: AztecAddress;
let recipient: AztecAddress;
Expand Down Expand Up @@ -233,7 +232,11 @@ describe('Private Execution test suite', () => {
const siloedNoteHash = siloCommitment(circuitsWasm, contractAddress, innerNoteHash);
const uniqueSiloedNoteHash = computeUniqueCommitment(circuitsWasm, note.nonce, siloedNoteHash);
const innerNullifier = Fr.fromBuffer(
pedersenPlookupCommitInputs(circuitsWasm, [uniqueSiloedNoteHash.toBuffer(), ownerPk.value]),
pedersenPlookupCommitInputs(circuitsWasm, [
uniqueSiloedNoteHash.toBuffer(),
ownerPk.high.toBuffer(),
ownerPk.low.toBuffer(),
]),
);

const result = await acirSimulator.computeNoteHashAndNullifier(
Expand Down Expand Up @@ -400,7 +403,7 @@ describe('Private Execution test suite', () => {

describe('private token contract', () => {
const contractAddress = defaultContractAddress;
const recipientPk = PrivateKey.fromString('0c9ed344548e8f9ba8aa3c9f8651eaa2853130f6c1e9c050ccf198f7ea18a7ec');
const recipientPk = GrumpkinScalar.fromString('0c9ed344548e8f9ba8aa3c9f8651eaa2853130f6c1e9c050ccf198f7ea18a7ec');
const mockFirstNullifier = new Fr(1111);
let owner: AztecAddress;
let recipient: AztecAddress;
Expand Down Expand Up @@ -465,7 +468,11 @@ describe('Private Execution test suite', () => {
const siloedNoteHash = siloCommitment(circuitsWasm, contractAddress, innerNoteHash);
const uniqueSiloedNoteHash = computeUniqueCommitment(circuitsWasm, note.nonce, siloedNoteHash);
const innerNullifier = Fr.fromBuffer(
pedersenPlookupCommitInputs(circuitsWasm, [uniqueSiloedNoteHash.toBuffer(), ownerPk.value]),
pedersenPlookupCommitInputs(circuitsWasm, [
uniqueSiloedNoteHash.toBuffer(),
ownerPk.high.toBuffer(),
ownerPk.low.toBuffer(),
]),
);

const result = await acirSimulator.computeNoteHashAndNullifier(
Expand Down Expand Up @@ -680,7 +687,7 @@ describe('Private Execution test suite', () => {

describe('consuming messages', () => {
const contractAddress = defaultContractAddress;
const recipientPk = PrivateKey.fromString('0c9ed344548e8f9ba8aa3c9f8651eaa2853130f6c1e9c050ccf198f7ea18a7ec');
const recipientPk = GrumpkinScalar.fromString('0c9ed344548e8f9ba8aa3c9f8651eaa2853130f6c1e9c050ccf198f7ea18a7ec');

let recipient: AztecAddress;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CompleteAddress, FunctionData, HistoricBlockData, PrivateKey } from '@aztec/circuits.js';
import { CompleteAddress, FunctionData, HistoricBlockData } from '@aztec/circuits.js';
import { FunctionSelector, encodeArguments } from '@aztec/foundation/abi';
import { AztecAddress } from '@aztec/foundation/aztec-address';
import { EthAddress } from '@aztec/foundation/eth-address';
import { Fr } from '@aztec/foundation/fields';
import { Fr, GrumpkinScalar } from '@aztec/foundation/fields';
import { PrivateTokenContractAbi } from '@aztec/noir-contracts/artifacts';
import { FunctionCall } from '@aztec/types';

Expand All @@ -21,7 +21,7 @@ describe('Unconstrained Execution test suite', () => {
});

describe('private token contract', () => {
const ownerPk = PrivateKey.fromString('5e30a2f886b4b6a11aea03bf4910fbd5b24e61aa27ea4d05c393b3ab592a8d33');
const ownerPk = GrumpkinScalar.fromString('2dcc5485a58316776299be08c78fa3788a1a7961ae30dc747fb1be17692a8d32');

let owner: AztecAddress;

Expand Down
4 changes: 2 additions & 2 deletions yarn-project/acir-simulator/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CircuitsWasm, PrivateKey } from '@aztec/circuits.js';
import { CircuitsWasm, GrumpkinPrivateKey } from '@aztec/circuits.js';
import { Grumpkin, pedersenPlookupCommitInputs } from '@aztec/circuits.js/barretenberg';
import { Fr } from '@aztec/foundation/fields';

Expand Down Expand Up @@ -37,7 +37,7 @@ export function computeSlotForMapping(mappingSlot: Fr, owner: NoirPoint | Fr, bb
* @param grumpkin - The grumpkin instance.
* @returns The public key.
*/
export function toPublicKey(privateKey: PrivateKey, grumpkin: Grumpkin): NoirPoint {
export function toPublicKey(privateKey: GrumpkinPrivateKey, grumpkin: Grumpkin): NoirPoint {
const point = grumpkin.mul(Grumpkin.generator, privateKey);
return {
x: point.x.value,
Expand Down
19 changes: 10 additions & 9 deletions yarn-project/aztec-cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
Contract,
ContractDeployer,
Fr,
GrumpkinScalar,
Point,
generatePublicKey,
getAccountWallets,
Expand All @@ -15,7 +16,7 @@ import { DebugLogger, LogFn } from '@aztec/foundation/log';
import { fileURLToPath } from '@aztec/foundation/url';
import { compileContract } from '@aztec/noir-compiler/cli';
import { SchnorrAccountContractAbi } from '@aztec/noir-contracts/artifacts';
import { CompleteAddress, ContractData, L2BlockL2Logs, PrivateKey, TxHash } from '@aztec/types';
import { CompleteAddress, ContractData, L2BlockL2Logs, TxHash } from '@aztec/types';

import { Command } from 'commander';
import { readFileSync } from 'fs';
Expand Down Expand Up @@ -96,7 +97,7 @@ export function getProgram(log: LogFn, debugLogger: DebugLogger): Command {

program
.command('generate-private-key')
.description('Generates a 32-byte private key.')
.description('Generates a private key which fits into the field used by Grumpkin curve.')
benesjan marked this conversation as resolved.
Show resolved Hide resolved
.option(
'-m, --mnemonic',
'An optional mnemonic string used for the private key generation. If not provided, random private key will be generated.',
Expand All @@ -106,11 +107,11 @@ export function getProgram(log: LogFn, debugLogger: DebugLogger): Command {
let publicKey;
if (options.mnemonic) {
const acc = mnemonicToAccount(options.mnemonic);
const key = Buffer.from(acc.getHdKey().privateKey!);
privKey = key.toString('hex');
publicKey = await generatePublicKey(new PrivateKey(key));
// TODO(#2052): This reduction is not secure enough. TACKLE THIS ISSUE BEFORE MAINNET.
const key = GrumpkinScalar.fromBufferWithReduction(Buffer.from(acc.getHdKey().privateKey!));
publicKey = await generatePublicKey(key);
} else {
const key = PrivateKey.random();
const key = GrumpkinScalar.random();
privKey = key.toString();
publicKey = await generatePublicKey(key);
}
Expand All @@ -132,8 +133,8 @@ export function getProgram(log: LogFn, debugLogger: DebugLogger): Command {
.action(async options => {
const client = await createCompatibleClient(options.rpcUrl, debugLogger);
const privateKey = options.privateKey
? PrivateKey.fromString(stripLeadingHex(options.privateKey))
: PrivateKey.random();
? GrumpkinScalar.fromString(stripLeadingHex(options.privateKey))
: GrumpkinScalar.random();

const account = getSchnorrAccount(client, privateKey, privateKey, accountCreationSalt);
const wallet = await account.waitDeploy();
Expand Down Expand Up @@ -382,7 +383,7 @@ export function getProgram(log: LogFn, debugLogger: DebugLogger): Command {
);
}

const privateKey = PrivateKey.fromString(stripLeadingHex(options.privateKey));
const privateKey = GrumpkinScalar.fromString(stripLeadingHex(options.privateKey));

const client = await createCompatibleClient(options.rpcUrl, debugLogger);
const wallet = await getAccountWallets(
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec-cli/src/test/cli_test_suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export const cliTestSuite = (
// generate a private key
debug('Create an account using a private key');
await run('generate-private-key', false);
const privKey = findInLogs(/Private\sKey:\s+(?<privKey>[a-fA-F0-9]+)/)?.groups?.privKey;
const privKey = findInLogs(/Private\sKey:\s+0x(?<privKey>[a-fA-F0-9]+)/)?.groups?.privKey;
expect(privKey).toHaveLength(64);
await run(`create-account --private-key ${privKey}`);
const foundAddress = findInLogs(/Address:\s+(?<address>0x[a-fA-F0-9]+)/)?.groups?.address;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { AztecAddress } from '@aztec/foundation/aztec-address';
import { Fr, Point } from '@aztec/foundation/fields';
import { Fr, GrumpkinScalar, Point } from '@aztec/foundation/fields';
import { JsonRpcServer } from '@aztec/foundation/json-rpc/server';
import {
AztecRPC,
CompleteAddress,
ContractData,
ExtendedContractData,
L2BlockL2Logs,
PrivateKey,
Tx,
TxExecutionRequest,
TxHash,
Expand Down Expand Up @@ -36,8 +35,8 @@ export function getHttpRpcServer(aztecRpcServer: AztecRPC): JsonRpcServer {
TxHash,
EthAddress,
Point,
PrivateKey,
Fr,
GrumpkinScalar,
},
{ Tx, TxReceipt, L2BlockL2Logs },
false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import {
CompleteAddress,
EthAddress,
FunctionData,
GrumpkinPrivateKey,
KernelCircuitPublicInputsFinal,
MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX,
PartialAddress,
PrivateKey,
PublicCallRequest,
} from '@aztec/circuits.js';
import { encodeArguments } from '@aztec/foundation/abi';
Expand Down Expand Up @@ -99,7 +99,7 @@ export class AztecRPCServer implements AztecRPC {
this.log.info('Stopped');
}

public async registerAccount(privKey: PrivateKey, partialAddress: PartialAddress) {
public async registerAccount(privKey: GrumpkinPrivateKey, partialAddress: PartialAddress) {
const completeAddress = await CompleteAddress.fromPrivateKeyAndPartialAddress(privKey, partialAddress);
const wasAdded = await this.db.addCompleteAddress(completeAddress);
if (wasAdded) {
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/aztec-rpc/src/simulator_oracle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
EthAddress,
Fr,
FunctionSelector,
GrumpkinPrivateKey,
HistoricBlockData,
PrivateKey,
PublicKey,
} from '@aztec/circuits.js';
import { siloCommitment } from '@aztec/circuits.js/abis';
Expand All @@ -33,7 +33,7 @@ export class SimulatorOracle implements DBOracle {
private dataTreeProvider: DataCommitmentProvider,
) {}

getSecretKey(_contractAddress: AztecAddress, pubKey: PublicKey): Promise<PrivateKey> {
getSecretKey(_contractAddress: AztecAddress, pubKey: PublicKey): Promise<GrumpkinPrivateKey> {
return this.keyStore.getAccountPrivateKey(pubKey);
}

Expand Down
4 changes: 2 additions & 2 deletions yarn-project/aztec-rpc/src/synchroniser/synchroniser.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CompleteAddress, Fr, HistoricBlockData, PrivateKey } from '@aztec/circuits.js';
import { CompleteAddress, Fr, GrumpkinScalar, HistoricBlockData } from '@aztec/circuits.js';
import { Grumpkin } from '@aztec/circuits.js/barretenberg';
import { TestKeyStore } from '@aztec/key-store';
import { AztecNode, L2Block, MerkleTreeId } from '@aztec/types';
Expand Down Expand Up @@ -103,7 +103,7 @@ describe('Synchroniser', () => {

// Manually adding account to database so that we can call synchroniser.isAccountStateSynchronised
const keyStore = new TestKeyStore(await Grumpkin.new());
const privateKey = PrivateKey.random();
const privateKey = GrumpkinScalar.random();
keyStore.addAccount(privateKey);
const completeAddress = await CompleteAddress.fromPrivateKeyAndPartialAddress(privateKey, Fr.random());
await database.addCompleteAddress(completeAddress);
Expand Down
12 changes: 10 additions & 2 deletions yarn-project/aztec-sandbox/src/examples/private_token_contract.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import { AztecAddress, Contract, Fr, PrivateKey, Wallet, createAccounts, createAztecRpcClient } from '@aztec/aztec.js';
import {
AztecAddress,
Contract,
Fr,
GrumpkinScalar,
Wallet,
createAccounts,
createAztecRpcClient,
} from '@aztec/aztec.js';
import { createDebugLogger } from '@aztec/foundation/log';
import { SchnorrSingleKeyAccountContractAbi } from '@aztec/noir-contracts/artifacts';
import { PrivateTokenContract } from '@aztec/noir-contracts/types';

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

export const privateKey = PrivateKey.fromString('ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80');
export const privateKey = GrumpkinScalar.fromString('ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80');

const url = 'http://localhost:8080';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
createAztecRpcClient,
getL1ContractAddresses,
} from '@aztec/aztec.js';
import { PrivateKey } from '@aztec/circuits.js';
import { GrumpkinScalar } from '@aztec/circuits.js';
import { createDebugLogger } from '@aztec/foundation/log';
import { UniswapPortalAbi, UniswapPortalBytecode } from '@aztec/l1-artifacts';
import { SchnorrSingleKeyAccountContractAbi } from '@aztec/noir-contracts/artifacts';
Expand Down Expand Up @@ -37,7 +37,7 @@ const aztecRpcUrl = 'http://localhost:8080';
const ethRpcUrl = 'http://localhost:8545';

const hdAccount = mnemonicToAccount(MNEMONIC);
const privateKey = new PrivateKey(Buffer.from(hdAccount.getHdKey().privateKey!));
const privateKey = GrumpkinScalar.fromBuffer(Buffer.from(hdAccount.getHdKey().privateKey!));

const walletClient = createWalletClient({
account: hdAccount,
Expand Down
3 changes: 1 addition & 2 deletions yarn-project/aztec-sandbox/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
import { createAztecRPCServer, getConfigEnvVars as getRpcConfigEnvVars } from '@aztec/aztec-rpc';
import { deployInitialSandboxAccounts } from '@aztec/aztec.js';
import { PrivateKey } from '@aztec/circuits.js';
import { deployL1Contracts } from '@aztec/ethereum';
import { createDebugLogger } from '@aztec/foundation/log';
import { retryUntil } from '@aztec/foundation/retry';
Expand Down Expand Up @@ -72,7 +71,7 @@ async function main() {
logger.info(`Setting up Aztec Sandbox v${version}, please stand by...`);
logger.info('Deploying rollup contracts to L1...');
const deployedL1Contracts = await waitThenDeploy(aztecNodeConfig.rpcUrl, hdAccount);
aztecNodeConfig.publisherPrivateKey = new PrivateKey(Buffer.from(privKey!));
aztecNodeConfig.publisherPrivateKey = `0x${Buffer.from(privKey!).toString('hex')}`;
aztecNodeConfig.rollupContract = deployedL1Contracts.rollupAddress;
aztecNodeConfig.contractDeploymentEmitterContract = deployedL1Contracts.contractDeploymentEmitterAddress;
aztecNodeConfig.inboxContract = deployedL1Contracts.inboxAddress;
Expand Down
Loading