Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed May 7, 2024
1 parent aa1b9c8 commit 3fda5de
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 2 additions & 0 deletions yarn-project/aztec-node/src/aztec-node/http_rpc_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
L2Block,
LogId,
NullifierMembershipWitness,
PublicDataWitness,
SiblingPath,
Tx,
TxEffect,
Expand Down Expand Up @@ -37,6 +38,7 @@ export function createAztecNodeRpcServer(node: AztecNode) {
TxEffect,
LogId,
TxHash,
PublicDataWitness,
SiblingPath,
},
{ Tx, TxReceipt, EncryptedL2BlockL2Logs, UnencryptedL2BlockL2Logs, NullifierMembershipWitness },
Expand Down
18 changes: 7 additions & 11 deletions yarn-project/circuit-types/src/interfaces/public_data_witness.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Fr, type PUBLIC_DATA_TREE_HEIGHT, PublicDataTreeLeafPreimage } from '@aztec/circuits.js';

import { type SiblingPath } from '../sibling_path/index.js';
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
import { Fr, PUBLIC_DATA_TREE_HEIGHT, PublicDataTreeLeafPreimage } from '@aztec/circuits.js';
import { toBigIntBE } from '@aztec/foundation/bigint-buffer';
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';

import { SiblingPath } from '../sibling_path/index.js';

/**
* Public data witness.
Expand Down Expand Up @@ -43,11 +43,7 @@ export class PublicDataWitness {
}

toBuffer(): Buffer {
return serializeToBuffer([
this.index,
this.leafPreimage,
this.siblingPath,
]);
return serializeToBuffer([this.index, this.leafPreimage, this.siblingPath]);
}

/**
Expand All @@ -59,7 +55,7 @@ export class PublicDataWitness {

/**
* Deserializes an PublicDataWitness object from a buffer.
* @param buf - Buffer to deserialize.
* @param buf - Buffer or BufferReader to deserialize.
* @returns An instance of PublicDataWitness.
*/
static fromBuffer(buffer: Buffer | BufferReader): PublicDataWitness {
Expand All @@ -68,7 +64,7 @@ export class PublicDataWitness {
return new PublicDataWitness(
toBigIntBE(reader.readBytes(32)),
reader.readObject(PublicDataTreeLeafPreimage),
reader.readObject(SiblingPath<typeof PUBLIC_DATA_TREE_HEIGHT>),
SiblingPath.fromBuffer(reader.readBytes(4 + 32 * PUBLIC_DATA_TREE_HEIGHT)),
);
}

Expand Down

0 comments on commit 3fda5de

Please sign in to comment.