Skip to content

Commit de8da01

Browse files
authored
Merge branch 'v5-next' into merge-train/fairies-v5
2 parents 30c2f6e + 426a675 commit de8da01

28 files changed

Lines changed: 338 additions & 93 deletions

File tree

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "6.0.0"
2+
".": "5.0.0"
33
}

docs/docs-developers/docs/resources/migration_notes.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,22 @@ The empire slashing model has been removed. Only the tally-based slashing model
959959

960960
## Unreleased (v5)
961961

962+
### [Aztec Node] `getTxByHash`, `getTxsByHash` and `getPendingTxs` no longer return tx proofs by default
963+
964+
`AztecNode.getTxByHash`, `AztecNode.getTxsByHash` and `AztecNode.getPendingTxs` (also exposed on the P2P API) now take an optional `GetTxByHashOptions` argument with an `includeProof` flag. The proof is stripped from returned txs unless `includeProof: true` is passed, cutting roughly 35-52KB per tx over the wire.
965+
966+
**Migration:**
967+
968+
```diff
969+
- const tx = await node.getTxByHash(txHash);
970+
+ const tx = await node.getTxByHash(txHash, { includeProof: true });
971+
972+
- const txs = await node.getPendingTxs(limit, after);
973+
+ const txs = await node.getPendingTxs(limit, after, { includeProof: true });
974+
```
975+
976+
**Impact**: Callers that read the proof off returned txs (eg to re-broadcast or validate them) must now pass `{ includeProof: true }` explicitly; by default the returned txs carry an empty proof.
977+
962978
### [aztec.js] `DeployMethod.send()` always returns `{ contract, receipt, instance }`
963979

964980
The `returnReceipt` option in deploy wait options has been removed. `DeployMethod.send()` now always returns an object with `contract`, `receipt`, and `instance` at the top level, provided the user waits for the transaction to be included.
201 KB
Binary file not shown.

noir-projects/noir-protocol-circuits/bootstrap.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,12 @@ function build {
152152
# If pinned-build.tar.gz exists, use it instead of compiling.
153153
if [ -f pinned-build.tar.gz ]; then
154154
echo_stderr "Using pinned-build.tar.gz instead of compiling."
155+
# The archive holds project-root-relative paths (target/ plus the reset-circuit variant
156+
# manifest, which generate_variants would normally produce but is skipped here), so it
157+
# unpacks straight into place: target/ and private_kernel_reset_dimensions.json land where
158+
# downstream codegen (noir-protocol-circuits-types) expects them.
155159
rm -rf target
156-
mkdir -p target
157-
tar xzf pinned-build.tar.gz -C target
160+
tar xzf pinned-build.tar.gz
158161
return
159162
fi
160163

@@ -257,7 +260,14 @@ function pin-build {
257260
rm -f pinned-build.tar.gz
258261
build
259262
echo_stderr "Creating pinned-build.tar.gz from target..."
260-
tar czf pinned-build.tar.gz -C target .
263+
# Archive project-root-relative paths so the build can unpack straight into place. We bundle
264+
# the reset-circuit variant manifest alongside target/ because generate_variants (which
265+
# produces it) is skipped when a pinned build is consumed, yet downstream codegen
266+
# (noir-protocol-circuits-types) requires it. The manifest only exists for the real circuits,
267+
# so it is included conditionally (mock-protocol-circuits has none).
268+
pin_paths=(target)
269+
[ -f private_kernel_reset_dimensions.json ] && pin_paths+=(private_kernel_reset_dimensions.json)
270+
tar czf pinned-build.tar.gz "${pin_paths[@]}"
261271
echo_stderr "Done. pinned-build.tar.gz created. Commit it to pin these artifacts."
262272
}
263273

77.4 MB
Binary file not shown.

yarn-project/aztec-node/src/aztec-node/server.test.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1639,7 +1639,9 @@ describe('aztec node', () => {
16391639
p2p.getTxStatus.mockResolvedValue('pending');
16401640
l2BlockSource.getTxEffect.mockResolvedValue(undefined);
16411641
const pendingTx = await mockTx();
1642-
p2p.getTxByHashFromPool.mockResolvedValue(pendingTx);
1642+
p2p.getTxByHashFromPool.mockImplementation((_h, opts) =>
1643+
Promise.resolve(opts?.includeProof === false ? pendingTx.withoutProof() : pendingTx),
1644+
);
16431645

16441646
const receipt = await node.getTxReceipt(txHash, { includePendingTx: true });
16451647
expect(receipt).toBeInstanceOf(PendingTxReceipt);
@@ -1650,6 +1652,24 @@ describe('aztec node', () => {
16501652
expect(receipt.tx!.chonkProof).toEqual(pendingTx.withoutProof().chonkProof);
16511653
});
16521654

1655+
it('attaches the pending tx with its proof when includePendingTx and includeProof are set', async () => {
1656+
const txHash = TxHash.random();
1657+
p2p.getTxStatus.mockResolvedValue('pending');
1658+
l2BlockSource.getTxEffect.mockResolvedValue(undefined);
1659+
const pendingTx = await mockTx();
1660+
p2p.getTxByHashFromPool.mockImplementation((_h, opts) =>
1661+
Promise.resolve(opts?.includeProof === false ? pendingTx.withoutProof() : pendingTx),
1662+
);
1663+
1664+
const receipt = await node.getTxReceipt(txHash, { includePendingTx: true, includeProof: true });
1665+
expect(receipt).toBeInstanceOf(PendingTxReceipt);
1666+
if (!receipt.isPending()) {
1667+
throw new Error('expected a pending receipt');
1668+
}
1669+
expect(receipt.tx).toBeDefined();
1670+
expect(receipt.tx!.chonkProof).toEqual(pendingTx.chonkProof);
1671+
});
1672+
16531673
it('returns a dropped receipt when the tx is unknown to the pool and not mined', async () => {
16541674
const txHash = TxHash.random();
16551675
p2p.getTxStatus.mockResolvedValue(undefined);

yarn-project/aztec-node/src/aztec-node/server.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ import type {
9898
CheckpointIncludeOptions,
9999
CheckpointParameter,
100100
CheckpointResponse,
101+
GetTxByHashOptions,
101102
} from '@aztec/stdlib/interfaces/client';
102103
import { AztecNodeAdminConfigSchema } from '@aztec/stdlib/interfaces/client';
103104
import {
@@ -1114,7 +1115,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb
11141115
}
11151116

11161117
public async getMaxPriorityFees(): Promise<GasFees> {
1117-
for await (const tx of this.p2pClient.iteratePendingTxs()) {
1118+
for await (const tx of this.p2pClient.iteratePendingTxs({ includeProof: false })) {
11181119
return tx.getGasSettings().maxPriorityFeesPerGas;
11191120
}
11201121

@@ -1216,8 +1217,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb
12161217
if (options?.includePendingTx) {
12171218
// The tx may have left the pool since we checked its status (mined or dropped); in that case we
12181219
// leave `tx` unset and still return a pending receipt.
1219-
const pendingTx = await this.p2pClient.getTxByHashFromPool(txHash);
1220-
tx = pendingTx && !options.includeProof ? pendingTx.withoutProof() : pendingTx;
1220+
tx = await this.p2pClient.getTxByHashFromPool(txHash, { includeProof: !!options.includeProof });
12211221
}
12221222
receipt = new PendingTxReceipt(txHash, tx);
12231223
} else {
@@ -1305,30 +1305,35 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb
13051305
* @param after - The last known pending tx. Used for pagination
13061306
* @returns - The pending txs.
13071307
*/
1308-
public getPendingTxs(limit?: number, after?: TxHash): Promise<Tx[]> {
1309-
return this.p2pClient!.getPendingTxs(limit, after);
1308+
public getPendingTxs(limit?: number, after?: TxHash, options?: GetTxByHashOptions): Promise<Tx[]> {
1309+
return this.p2pClient!.getPendingTxs(limit, after, options);
13101310
}
13111311

13121312
public getPendingTxCount(): Promise<number> {
13131313
return this.p2pClient!.getPendingTxCount();
13141314
}
13151315

13161316
/**
1317-
* Method to retrieve a single tx from the mempool or unfinalized chain.
1317+
* Method to retrieve a single tx from the mempool or unfinalized chain. The tx's proof is only loaded and returned
1318+
* when `includeProof` is set.
13181319
* @param txHash - The transaction hash to return.
1320+
* @param options - Options for the returned tx (eg whether to include its proof).
13191321
* @returns - The tx if it exists.
13201322
*/
1321-
public getTxByHash(txHash: TxHash): Promise<Tx | undefined> {
1322-
return Promise.resolve(this.p2pClient!.getTxByHashFromPool(txHash));
1323+
public getTxByHash(txHash: TxHash, options?: GetTxByHashOptions): Promise<Tx | undefined> {
1324+
return this.p2pClient!.getTxByHashFromPool(txHash, { includeProof: !!options?.includeProof });
13231325
}
13241326

13251327
/**
1326-
* Method to retrieve txs from the mempool or unfinalized chain.
1328+
* Method to retrieve txs from the mempool or unfinalized chain. The txs' proofs are only loaded and returned when
1329+
* `includeProof` is set.
13271330
* @param txHash - The transaction hash to return.
1331+
* @param options - Options for the returned txs (eg whether to include their proofs).
13281332
* @returns - The txs if it exists.
13291333
*/
1330-
public async getTxsByHash(txHashes: TxHash[]): Promise<Tx[]> {
1331-
return compactArray(await Promise.all(txHashes.map(txHash => this.getTxByHash(txHash))));
1334+
public async getTxsByHash(txHashes: TxHash[], options?: GetTxByHashOptions): Promise<Tx[]> {
1335+
const txs = await this.p2pClient!.getTxsByHashFromPool(txHashes, { includeProof: !!options?.includeProof });
1336+
return compactArray(txs);
13321337
}
13331338

13341339
public async findLeavesIndexes(

yarn-project/aztec/src/mainnet_compatibility.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ import { getGenesisValues } from '@aztec/world-state/testing';
77
* This test suit makes sure that the code in the monorepo is still compatible with the latest version of mainnet
88
* Only update these values after a governance update that changes the protocol is enacted
99
*/
10-
describe('Mainnet compatibility', () => {
10+
// TODO: temporarily skipped on v5-next, which carries unreleased protocol circuit changes that
11+
// shift the VK tree root, protocol contracts hash and genesis roots away from the live mainnet
12+
// values. Re-enable (and refresh the expected values) once we cut the first RC.
13+
describe.skip('Mainnet compatibility', () => {
1114
it('has expected VK tree root', () => {
1215
const expectedRoots = [Fr.fromHexString('0x18e358ea5367f6069a4c1c08a2e0628fbb1b25c00b0b98160072d4ad397bae7c')];
1316
expect(expectedRoots).toContainEqual(getVKTreeRoot());

yarn-project/aztec/src/testnet_compatibility.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import { getGenesisValues } from '@aztec/world-state/testing';
99
* This test suit makes sure that the code in the monorepo is still compatible with the latest version of testnet
1010
* Only update these values after a governance update that changes the protocol is enacted
1111
*/
12-
describe('Testnet compatibility', () => {
12+
// TODO: temporarily skipped on v5-next, which carries unreleased protocol circuit changes that
13+
// shift the VK tree root, protocol contracts hash and genesis roots away from the live testnet
14+
// values. Re-enable (and refresh the expected values) once we cut the first RC.
15+
describe.skip('Testnet compatibility', () => {
1316
it('has expected VK tree root', () => {
1417
const expectedRoots = [Fr.fromHexString('0x18e358ea5367f6069a4c1c08a2e0628fbb1b25c00b0b98160072d4ad397bae7c')];
1518
expect(expectedRoots).toContainEqual(getVKTreeRoot());

yarn-project/p2p/src/client/factory.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ export async function createP2PClient(
7575
}
7676

7777
const bindings = logger.getBindings();
78-
const store = deps.store ?? (await createStore(P2P_STORE_NAME, 2, config, bindings));
78+
// Schema version 3: tx proofs are stored in a separate map from the tx data (see TxPoolV2Impl).
79+
const store = deps.store ?? (await createStore(P2P_STORE_NAME, 3, config, bindings));
7980
const archive = await createStore(P2P_ARCHIVE_STORE_NAME, 1, config, bindings);
8081
const peerStore = await createStore(P2P_PEER_STORE_NAME, 1, config, bindings);
8182
const attestationStore = await createStore(P2P_ATTESTATION_STORE_NAME, 2, config, bindings);

0 commit comments

Comments
 (0)