Skip to content

Commit

Permalink
fix ci, naming, return fr
Browse files Browse the repository at this point in the history
  • Loading branch information
rahul-kothari committed Jun 7, 2023
1 parent baf1da8 commit 4f53e53
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,8 @@ describe('Private Execution test suite', () => {
const secret = new Fr(1n);
const preimage = await buildL1ToL2Message([new Fr(bridgedAmount), new Fr(recipient.x)], contractAddress, secret);

const messageKey = preimage.hash();
// stub message key
const messageKey = Fr.random();

const tree: AppendOnlyTree = await newTree(
StandardTree,
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec.js/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './utils.js';
export * from './secrets.js';
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import { computeSecretMessageHash } from '@aztec/circuits.js/abis';
/**
* Given a secret, it computes its pederson hash - used to send l1 to l2 messages
* @param secret - the secret to hash (defaults to a random field element)
* @returns secret and its pederson hash (in hex).
* @returns the hash
*/
export async function createMessageSecretAndHash(secret = Fr.random()) {
export async function computeMessageSecretHash(secret = Fr.random()): Promise<Fr> {
const wasm = await CircuitsWasm.get();
const secretHash = computeSecretMessageHash(wasm, secret);
const secretHashHex = `0x${secretHash.toBuffer().toString('hex')}` as `0x${string}`;
return secretHashHex;
return computeSecretMessageHash(wasm, secret);
}
5 changes: 3 additions & 2 deletions yarn-project/end-to-end/src/e2e_cross_chain_messaging.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AztecNodeService } from '@aztec/aztec-node';
import { AztecAddress, AztecRPCServer, Contract, TxStatus, createMessageSecretAndHash } from '@aztec/aztec.js';
import { AztecAddress, AztecRPCServer, Contract, TxStatus, computeMessageSecretHash } from '@aztec/aztec.js';
import { EthAddress } from '@aztec/foundation/eth-address';

import { DeployL1Contracts } from '@aztec/ethereum';
Expand Down Expand Up @@ -88,7 +88,8 @@ describe('e2e_cross_chain_messaging', () => {
// Generate a claim secret using pedersen
logger("Generating a claim secret using pedersen's hash function");
const secret = Fr.random();
const secretString = await createMessageSecretAndHash(secret);
const secretHash = await computeMessageSecretHash(secret);
const secretString = `0x${secretHash.toBuffer().toString('hex')}` as `0x${string}`;
logger('Generated claim secret: ', secretString);

logger('Minting tokens on L1');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
import { AztecAddress, AztecRPCServer, Contract, createMessageSecretAndHash } from '@aztec/aztec.js';
import { AztecAddress, AztecRPCServer, Contract, computeMessageSecretHash } from '@aztec/aztec.js';
import { EthAddress } from '@aztec/foundation/eth-address';

import { DeployL1Contracts } from '@aztec/ethereum';
Expand Down Expand Up @@ -83,8 +83,8 @@ describe('archiver integration with l1 to l2 messages', () => {

// Generate a claim secret using pedersen
logger("Generating a claim secret using pedersen's hash function");
const secret = Fr.random();
const secretString = await createMessageSecretAndHash(secret);
const secretHash = await computeMessageSecretHash();
const secretString = `0x${secretHash.toBuffer().toString('hex')}` as `0x${string}`;
logger('Generated claim secret: ', secretString);

logger('Minting tokens on L1');
Expand Down

0 comments on commit 4f53e53

Please sign in to comment.