@aztec/end-to-end 1.0.0-nightly.20250730 → 1.0.0-nightly.20250801
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/integration_l1_publisher/write_json.d.ts +8 -0
- package/dest/integration_l1_publisher/write_json.d.ts.map +1 -0
- package/dest/integration_l1_publisher/write_json.js +57 -0
- package/dest/shared/uniswap_l1_l2.js +6 -6
- package/package.json +35 -35
- package/src/integration_l1_publisher/write_json.ts +74 -0
- package/src/shared/uniswap_l1_l2.ts +6 -6
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AztecAddress, Fr, type L2Block } from '@aztec/aztec.js';
|
|
2
|
+
import { BatchedBlob, Blob } from '@aztec/blob-lib';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a json object that can be used to test the solidity contract.
|
|
5
|
+
* The json object must be put into
|
|
6
|
+
*/
|
|
7
|
+
export declare function writeJson(fileName: string, block: L2Block, l1ToL2Content: Fr[], blobs: Blob[], batchedBlob: BatchedBlob, recipientAddress: AztecAddress, deployerAddress: `0x${string}`): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=write_json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write_json.d.ts","sourceRoot":"","sources":["../../src/integration_l1_publisher/write_json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAOpD;;;GAGG;AACH,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,OAAO,EACd,aAAa,EAAE,EAAE,EAAE,EACnB,KAAK,EAAE,IAAI,EAAE,EACb,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,YAAY,EAC9B,eAAe,EAAE,KAAK,MAAM,EAAE,GAC7B,OAAO,CAAC,IAAI,CAAC,CAqDf"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Blob } from '@aztec/blob-lib';
|
|
2
|
+
import { writeFile } from 'fs/promises';
|
|
3
|
+
const AZTEC_GENERATE_TEST_DATA = !!process.env.AZTEC_GENERATE_TEST_DATA;
|
|
4
|
+
/**
|
|
5
|
+
* Creates a json object that can be used to test the solidity contract.
|
|
6
|
+
* The json object must be put into
|
|
7
|
+
*/ export async function writeJson(fileName, block, l1ToL2Content, blobs, batchedBlob, recipientAddress, deployerAddress) {
|
|
8
|
+
if (!AZTEC_GENERATE_TEST_DATA) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
// Path relative to the package.json in the end-to-end folder
|
|
12
|
+
const path = `../../l1-contracts/test/fixtures/${fileName}.json`;
|
|
13
|
+
const asHex = (value, size = 64)=>{
|
|
14
|
+
const buffer = Buffer.isBuffer(value) ? value : value.toBuffer();
|
|
15
|
+
return `0x${buffer.toString('hex').padStart(size, '0')}`;
|
|
16
|
+
};
|
|
17
|
+
const jsonObject = {
|
|
18
|
+
populate: {
|
|
19
|
+
l1ToL2Content: l1ToL2Content.map(asHex),
|
|
20
|
+
recipient: asHex(recipientAddress.toField()),
|
|
21
|
+
sender: deployerAddress
|
|
22
|
+
},
|
|
23
|
+
messages: {
|
|
24
|
+
l2ToL1Messages: block.body.txEffects.flatMap((txEffect)=>txEffect.l2ToL1Msgs).map(asHex)
|
|
25
|
+
},
|
|
26
|
+
block: {
|
|
27
|
+
// The json formatting in forge is a bit brittle, so we convert Fr to a number in the few values below.
|
|
28
|
+
// This should not be a problem for testing as long as the values are not larger than u32.
|
|
29
|
+
archive: asHex(block.archive.root),
|
|
30
|
+
blobCommitments: Blob.getPrefixedEthBlobCommitments(blobs),
|
|
31
|
+
batchedBlobInputs: batchedBlob.getEthBlobEvaluationInputs(),
|
|
32
|
+
blockNumber: block.number,
|
|
33
|
+
body: `0x${block.body.toBuffer().toString('hex')}`,
|
|
34
|
+
header: {
|
|
35
|
+
lastArchiveRoot: asHex(block.header.lastArchive.root),
|
|
36
|
+
contentCommitment: {
|
|
37
|
+
blobsHash: asHex(block.header.contentCommitment.blobsHash),
|
|
38
|
+
inHash: asHex(block.header.contentCommitment.inHash),
|
|
39
|
+
outHash: asHex(block.header.contentCommitment.outHash)
|
|
40
|
+
},
|
|
41
|
+
slotNumber: Number(block.header.globalVariables.slotNumber),
|
|
42
|
+
timestamp: Number(block.header.globalVariables.timestamp),
|
|
43
|
+
coinbase: asHex(block.header.globalVariables.coinbase, 40),
|
|
44
|
+
feeRecipient: asHex(block.header.globalVariables.feeRecipient),
|
|
45
|
+
gasFees: {
|
|
46
|
+
feePerDaGas: Number(block.header.globalVariables.gasFees.feePerDaGas),
|
|
47
|
+
feePerL2Gas: Number(block.header.globalVariables.gasFees.feePerL2Gas)
|
|
48
|
+
},
|
|
49
|
+
totalManaUsed: block.header.totalManaUsed.toNumber()
|
|
50
|
+
},
|
|
51
|
+
headerHash: asHex(block.header.toPropose().hash()),
|
|
52
|
+
numTxs: block.body.txEffects.length
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const output = JSON.stringify(jsonObject, null, 2);
|
|
56
|
+
await writeFile(path, output, 'utf8');
|
|
57
|
+
}
|
|
@@ -167,9 +167,9 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
167
167
|
const daiL1BalanceOfPortalBeforeSwap = await daiCrossChainHarness.getL1BalanceOf(daiCrossChainHarness.tokenPortalAddress);
|
|
168
168
|
const swapResult = await computeL2ToL1MembershipWitness(aztecNode, l2UniswapInteractionReceipt.blockNumber, swapPrivateLeaf);
|
|
169
169
|
const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, l2UniswapInteractionReceipt.blockNumber, withdrawLeaf);
|
|
170
|
-
const swapPrivateL2MessageIndex = swapResult.
|
|
170
|
+
const swapPrivateL2MessageIndex = swapResult.leafIndex;
|
|
171
171
|
const swapPrivateSiblingPath = swapResult.siblingPath;
|
|
172
|
-
const withdrawL2MessageIndex = withdrawResult.
|
|
172
|
+
const withdrawL2MessageIndex = withdrawResult.leafIndex;
|
|
173
173
|
const withdrawSiblingPath = withdrawResult.siblingPath;
|
|
174
174
|
const withdrawMessageMetadata = {
|
|
175
175
|
_l2BlockNumber: BigInt(l2UniswapInteractionReceipt.blockNumber),
|
|
@@ -559,9 +559,9 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
559
559
|
});
|
|
560
560
|
const swapResult = await computeL2ToL1MembershipWitness(aztecNode, withdrawReceipt.blockNumber, swapPrivateLeaf);
|
|
561
561
|
const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, withdrawReceipt.blockNumber, withdrawLeaf);
|
|
562
|
-
const swapPrivateL2MessageIndex = swapResult.
|
|
562
|
+
const swapPrivateL2MessageIndex = swapResult.leafIndex;
|
|
563
563
|
const swapPrivateSiblingPath = swapResult.siblingPath;
|
|
564
|
-
const withdrawL2MessageIndex = withdrawResult.
|
|
564
|
+
const withdrawL2MessageIndex = withdrawResult.leafIndex;
|
|
565
565
|
const withdrawSiblingPath = withdrawResult.siblingPath;
|
|
566
566
|
const withdrawMessageMetadata = {
|
|
567
567
|
_l2BlockNumber: BigInt(withdrawReceipt.blockNumber),
|
|
@@ -643,9 +643,9 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
643
643
|
});
|
|
644
644
|
const swapResult = await computeL2ToL1MembershipWitness(aztecNode, withdrawReceipt.blockNumber, swapPublicLeaf);
|
|
645
645
|
const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, withdrawReceipt.blockNumber, withdrawLeaf);
|
|
646
|
-
const swapPublicL2MessageIndex = swapResult.
|
|
646
|
+
const swapPublicL2MessageIndex = swapResult.leafIndex;
|
|
647
647
|
const swapPublicSiblingPath = swapResult.siblingPath;
|
|
648
|
-
const withdrawL2MessageIndex = withdrawResult.
|
|
648
|
+
const withdrawL2MessageIndex = withdrawResult.leafIndex;
|
|
649
649
|
const withdrawSiblingPath = withdrawResult.siblingPath;
|
|
650
650
|
const withdrawMessageMetadata = {
|
|
651
651
|
_l2BlockNumber: BigInt(withdrawReceipt.blockNumber),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/end-to-end",
|
|
3
|
-
"version": "1.0.0-nightly.
|
|
3
|
+
"version": "1.0.0-nightly.20250801",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"inherits": [
|
|
@@ -25,40 +25,40 @@
|
|
|
25
25
|
"formatting": "run -T prettier --check ./src && run -T eslint ./src"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aztec/accounts": "1.0.0-nightly.
|
|
29
|
-
"@aztec/archiver": "1.0.0-nightly.
|
|
30
|
-
"@aztec/aztec": "1.0.0-nightly.
|
|
31
|
-
"@aztec/aztec-node": "1.0.0-nightly.
|
|
32
|
-
"@aztec/aztec.js": "1.0.0-nightly.
|
|
33
|
-
"@aztec/bb-prover": "1.0.0-nightly.
|
|
34
|
-
"@aztec/blob-lib": "1.0.0-nightly.
|
|
35
|
-
"@aztec/blob-sink": "1.0.0-nightly.
|
|
36
|
-
"@aztec/bot": "1.0.0-nightly.
|
|
37
|
-
"@aztec/cli": "1.0.0-nightly.
|
|
38
|
-
"@aztec/constants": "1.0.0-nightly.
|
|
39
|
-
"@aztec/entrypoints": "1.0.0-nightly.
|
|
40
|
-
"@aztec/epoch-cache": "1.0.0-nightly.
|
|
41
|
-
"@aztec/ethereum": "1.0.0-nightly.
|
|
42
|
-
"@aztec/foundation": "1.0.0-nightly.
|
|
43
|
-
"@aztec/kv-store": "1.0.0-nightly.
|
|
44
|
-
"@aztec/l1-artifacts": "1.0.0-nightly.
|
|
45
|
-
"@aztec/merkle-tree": "1.0.0-nightly.
|
|
46
|
-
"@aztec/noir-contracts.js": "1.0.0-nightly.
|
|
47
|
-
"@aztec/noir-noirc_abi": "1.0.0-nightly.
|
|
48
|
-
"@aztec/noir-protocol-circuits-types": "1.0.0-nightly.
|
|
49
|
-
"@aztec/noir-test-contracts.js": "1.0.0-nightly.
|
|
50
|
-
"@aztec/p2p": "1.0.0-nightly.
|
|
51
|
-
"@aztec/protocol-contracts": "1.0.0-nightly.
|
|
52
|
-
"@aztec/prover-client": "1.0.0-nightly.
|
|
53
|
-
"@aztec/prover-node": "1.0.0-nightly.
|
|
54
|
-
"@aztec/pxe": "1.0.0-nightly.
|
|
55
|
-
"@aztec/sequencer-client": "1.0.0-nightly.
|
|
56
|
-
"@aztec/simulator": "1.0.0-nightly.
|
|
57
|
-
"@aztec/slasher": "1.0.0-nightly.
|
|
58
|
-
"@aztec/stdlib": "1.0.0-nightly.
|
|
59
|
-
"@aztec/telemetry-client": "1.0.0-nightly.
|
|
60
|
-
"@aztec/validator-client": "1.0.0-nightly.
|
|
61
|
-
"@aztec/world-state": "1.0.0-nightly.
|
|
28
|
+
"@aztec/accounts": "1.0.0-nightly.20250801",
|
|
29
|
+
"@aztec/archiver": "1.0.0-nightly.20250801",
|
|
30
|
+
"@aztec/aztec": "1.0.0-nightly.20250801",
|
|
31
|
+
"@aztec/aztec-node": "1.0.0-nightly.20250801",
|
|
32
|
+
"@aztec/aztec.js": "1.0.0-nightly.20250801",
|
|
33
|
+
"@aztec/bb-prover": "1.0.0-nightly.20250801",
|
|
34
|
+
"@aztec/blob-lib": "1.0.0-nightly.20250801",
|
|
35
|
+
"@aztec/blob-sink": "1.0.0-nightly.20250801",
|
|
36
|
+
"@aztec/bot": "1.0.0-nightly.20250801",
|
|
37
|
+
"@aztec/cli": "1.0.0-nightly.20250801",
|
|
38
|
+
"@aztec/constants": "1.0.0-nightly.20250801",
|
|
39
|
+
"@aztec/entrypoints": "1.0.0-nightly.20250801",
|
|
40
|
+
"@aztec/epoch-cache": "1.0.0-nightly.20250801",
|
|
41
|
+
"@aztec/ethereum": "1.0.0-nightly.20250801",
|
|
42
|
+
"@aztec/foundation": "1.0.0-nightly.20250801",
|
|
43
|
+
"@aztec/kv-store": "1.0.0-nightly.20250801",
|
|
44
|
+
"@aztec/l1-artifacts": "1.0.0-nightly.20250801",
|
|
45
|
+
"@aztec/merkle-tree": "1.0.0-nightly.20250801",
|
|
46
|
+
"@aztec/noir-contracts.js": "1.0.0-nightly.20250801",
|
|
47
|
+
"@aztec/noir-noirc_abi": "1.0.0-nightly.20250801",
|
|
48
|
+
"@aztec/noir-protocol-circuits-types": "1.0.0-nightly.20250801",
|
|
49
|
+
"@aztec/noir-test-contracts.js": "1.0.0-nightly.20250801",
|
|
50
|
+
"@aztec/p2p": "1.0.0-nightly.20250801",
|
|
51
|
+
"@aztec/protocol-contracts": "1.0.0-nightly.20250801",
|
|
52
|
+
"@aztec/prover-client": "1.0.0-nightly.20250801",
|
|
53
|
+
"@aztec/prover-node": "1.0.0-nightly.20250801",
|
|
54
|
+
"@aztec/pxe": "1.0.0-nightly.20250801",
|
|
55
|
+
"@aztec/sequencer-client": "1.0.0-nightly.20250801",
|
|
56
|
+
"@aztec/simulator": "1.0.0-nightly.20250801",
|
|
57
|
+
"@aztec/slasher": "1.0.0-nightly.20250801",
|
|
58
|
+
"@aztec/stdlib": "1.0.0-nightly.20250801",
|
|
59
|
+
"@aztec/telemetry-client": "1.0.0-nightly.20250801",
|
|
60
|
+
"@aztec/validator-client": "1.0.0-nightly.20250801",
|
|
61
|
+
"@aztec/world-state": "1.0.0-nightly.20250801",
|
|
62
62
|
"@iarna/toml": "^2.2.5",
|
|
63
63
|
"@jest/globals": "^30.0.0",
|
|
64
64
|
"@noble/curves": "^1.0.0",
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { AztecAddress, Fr, type L2Block } from '@aztec/aztec.js';
|
|
2
|
+
import { BatchedBlob, Blob } from '@aztec/blob-lib';
|
|
3
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
|
+
|
|
5
|
+
import { writeFile } from 'fs/promises';
|
|
6
|
+
|
|
7
|
+
const AZTEC_GENERATE_TEST_DATA = !!process.env.AZTEC_GENERATE_TEST_DATA;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Creates a json object that can be used to test the solidity contract.
|
|
11
|
+
* The json object must be put into
|
|
12
|
+
*/
|
|
13
|
+
export async function writeJson(
|
|
14
|
+
fileName: string,
|
|
15
|
+
block: L2Block,
|
|
16
|
+
l1ToL2Content: Fr[],
|
|
17
|
+
blobs: Blob[],
|
|
18
|
+
batchedBlob: BatchedBlob,
|
|
19
|
+
recipientAddress: AztecAddress,
|
|
20
|
+
deployerAddress: `0x${string}`,
|
|
21
|
+
): Promise<void> {
|
|
22
|
+
if (!AZTEC_GENERATE_TEST_DATA) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
// Path relative to the package.json in the end-to-end folder
|
|
26
|
+
const path = `../../l1-contracts/test/fixtures/${fileName}.json`;
|
|
27
|
+
|
|
28
|
+
const asHex = (value: Fr | Buffer | EthAddress | AztecAddress, size = 64) => {
|
|
29
|
+
const buffer = Buffer.isBuffer(value) ? value : value.toBuffer();
|
|
30
|
+
return `0x${buffer.toString('hex').padStart(size, '0')}`;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const jsonObject = {
|
|
34
|
+
populate: {
|
|
35
|
+
l1ToL2Content: l1ToL2Content.map(asHex),
|
|
36
|
+
recipient: asHex(recipientAddress.toField()),
|
|
37
|
+
sender: deployerAddress,
|
|
38
|
+
},
|
|
39
|
+
messages: {
|
|
40
|
+
l2ToL1Messages: block.body.txEffects.flatMap(txEffect => txEffect.l2ToL1Msgs).map(asHex),
|
|
41
|
+
},
|
|
42
|
+
block: {
|
|
43
|
+
// The json formatting in forge is a bit brittle, so we convert Fr to a number in the few values below.
|
|
44
|
+
// This should not be a problem for testing as long as the values are not larger than u32.
|
|
45
|
+
archive: asHex(block.archive.root),
|
|
46
|
+
blobCommitments: Blob.getPrefixedEthBlobCommitments(blobs),
|
|
47
|
+
batchedBlobInputs: batchedBlob.getEthBlobEvaluationInputs(),
|
|
48
|
+
blockNumber: block.number,
|
|
49
|
+
body: `0x${block.body.toBuffer().toString('hex')}`,
|
|
50
|
+
header: {
|
|
51
|
+
lastArchiveRoot: asHex(block.header.lastArchive.root),
|
|
52
|
+
contentCommitment: {
|
|
53
|
+
blobsHash: asHex(block.header.contentCommitment.blobsHash),
|
|
54
|
+
inHash: asHex(block.header.contentCommitment.inHash),
|
|
55
|
+
outHash: asHex(block.header.contentCommitment.outHash),
|
|
56
|
+
},
|
|
57
|
+
slotNumber: Number(block.header.globalVariables.slotNumber),
|
|
58
|
+
timestamp: Number(block.header.globalVariables.timestamp),
|
|
59
|
+
coinbase: asHex(block.header.globalVariables.coinbase, 40),
|
|
60
|
+
feeRecipient: asHex(block.header.globalVariables.feeRecipient),
|
|
61
|
+
gasFees: {
|
|
62
|
+
feePerDaGas: Number(block.header.globalVariables.gasFees.feePerDaGas),
|
|
63
|
+
feePerL2Gas: Number(block.header.globalVariables.gasFees.feePerL2Gas),
|
|
64
|
+
},
|
|
65
|
+
totalManaUsed: block.header.totalManaUsed.toNumber(),
|
|
66
|
+
},
|
|
67
|
+
headerHash: asHex(block.header.toPropose().hash()),
|
|
68
|
+
numTxs: block.body.txEffects.length,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const output = JSON.stringify(jsonObject, null, 2);
|
|
73
|
+
await writeFile(path, output, 'utf8');
|
|
74
|
+
}
|
|
@@ -290,10 +290,10 @@ export const uniswapL1L2TestSuite = (
|
|
|
290
290
|
withdrawLeaf,
|
|
291
291
|
);
|
|
292
292
|
|
|
293
|
-
const swapPrivateL2MessageIndex = swapResult!.
|
|
293
|
+
const swapPrivateL2MessageIndex = swapResult!.leafIndex;
|
|
294
294
|
const swapPrivateSiblingPath = swapResult!.siblingPath;
|
|
295
295
|
|
|
296
|
-
const withdrawL2MessageIndex = withdrawResult!.
|
|
296
|
+
const withdrawL2MessageIndex = withdrawResult!.leafIndex;
|
|
297
297
|
const withdrawSiblingPath = withdrawResult!.siblingPath;
|
|
298
298
|
|
|
299
299
|
const withdrawMessageMetadata = {
|
|
@@ -868,10 +868,10 @@ export const uniswapL1L2TestSuite = (
|
|
|
868
868
|
withdrawLeaf,
|
|
869
869
|
);
|
|
870
870
|
|
|
871
|
-
const swapPrivateL2MessageIndex = swapResult!.
|
|
871
|
+
const swapPrivateL2MessageIndex = swapResult!.leafIndex;
|
|
872
872
|
const swapPrivateSiblingPath = swapResult!.siblingPath;
|
|
873
873
|
|
|
874
|
-
const withdrawL2MessageIndex = withdrawResult!.
|
|
874
|
+
const withdrawL2MessageIndex = withdrawResult!.leafIndex;
|
|
875
875
|
const withdrawSiblingPath = withdrawResult!.siblingPath;
|
|
876
876
|
|
|
877
877
|
const withdrawMessageMetadata = {
|
|
@@ -1002,10 +1002,10 @@ export const uniswapL1L2TestSuite = (
|
|
|
1002
1002
|
withdrawLeaf,
|
|
1003
1003
|
);
|
|
1004
1004
|
|
|
1005
|
-
const swapPublicL2MessageIndex = swapResult!.
|
|
1005
|
+
const swapPublicL2MessageIndex = swapResult!.leafIndex;
|
|
1006
1006
|
const swapPublicSiblingPath = swapResult!.siblingPath;
|
|
1007
1007
|
|
|
1008
|
-
const withdrawL2MessageIndex = withdrawResult!.
|
|
1008
|
+
const withdrawL2MessageIndex = withdrawResult!.leafIndex;
|
|
1009
1009
|
const withdrawSiblingPath = withdrawResult!.siblingPath;
|
|
1010
1010
|
|
|
1011
1011
|
const withdrawMessageMetadata = {
|