@aztec/txe 0.0.1-commit.7d4e6cd → 0.0.1-commit.9372f48
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/constants.d.ts +1 -2
- package/dest/constants.d.ts.map +1 -1
- package/dest/constants.js +0 -1
- package/dest/oracle/interfaces.d.ts +3 -3
- package/dest/oracle/interfaces.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.d.ts +3 -3
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.js +6 -6
- package/dest/oracle/txe_oracle_top_level_context.d.ts +3 -2
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +30 -22
- package/dest/rpc_translator.d.ts +16 -10
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +53 -40
- package/dest/state_machine/archiver.d.ts +20 -69
- package/dest/state_machine/archiver.d.ts.map +1 -1
- package/dest/state_machine/archiver.js +34 -178
- package/dest/state_machine/index.d.ts +1 -1
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +22 -4
- package/dest/state_machine/mock_epoch_cache.d.ts +6 -6
- package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
- package/dest/state_machine/mock_epoch_cache.js +7 -7
- package/dest/state_machine/synchronizer.d.ts +3 -3
- package/dest/state_machine/synchronizer.d.ts.map +1 -1
- package/dest/txe_session.d.ts +5 -3
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +31 -15
- package/dest/util/encoding.d.ts +17 -17
- package/dest/utils/block_creation.d.ts +4 -4
- package/dest/utils/block_creation.d.ts.map +1 -1
- package/dest/utils/block_creation.js +16 -4
- package/dest/utils/tx_effect_creation.d.ts +2 -3
- package/dest/utils/tx_effect_creation.d.ts.map +1 -1
- package/dest/utils/tx_effect_creation.js +3 -6
- package/package.json +16 -16
- package/src/constants.ts +0 -1
- package/src/oracle/interfaces.ts +2 -2
- package/src/oracle/txe_oracle_public_context.ts +6 -8
- package/src/oracle/txe_oracle_top_level_context.ts +50 -24
- package/src/rpc_translator.ts +62 -47
- package/src/state_machine/archiver.ts +35 -234
- package/src/state_machine/index.ts +26 -4
- package/src/state_machine/mock_epoch_cache.ts +6 -11
- package/src/state_machine/synchronizer.ts +2 -2
- package/src/txe_session.ts +38 -24
- package/src/utils/block_creation.ts +17 -16
- package/src/utils/tx_effect_creation.ts +3 -11
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
NULLIFIER_SUBTREE_HEIGHT,
|
|
5
5
|
NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP,
|
|
6
6
|
} from '@aztec/constants';
|
|
7
|
-
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
7
|
+
import { BlockNumber, CheckpointNumber, IndexWithinCheckpoint } from '@aztec/foundation/branded-types';
|
|
8
8
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
9
9
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
10
|
-
import { Body, L2Block
|
|
10
|
+
import { Body, L2Block } from '@aztec/stdlib/block';
|
|
11
11
|
import { AppendOnlyTreeSnapshot, MerkleTreeId, type MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
|
|
12
|
-
import { GlobalVariables, TxEffect } from '@aztec/stdlib/tx';
|
|
12
|
+
import { BlockHeader, GlobalVariables, TxEffect } from '@aztec/stdlib/tx';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Returns a transaction request hash that is valid for transactions that are the only ones in a block.
|
|
@@ -46,21 +46,18 @@ export async function insertTxEffectIntoWorldTrees(
|
|
|
46
46
|
export async function makeTXEBlockHeader(
|
|
47
47
|
worldTrees: MerkleTreeWriteOperations,
|
|
48
48
|
globalVariables: GlobalVariables,
|
|
49
|
-
): Promise<
|
|
49
|
+
): Promise<BlockHeader> {
|
|
50
50
|
const stateReference = await worldTrees.getStateReference();
|
|
51
51
|
const archiveInfo = await worldTrees.getTreeInfo(MerkleTreeId.ARCHIVE);
|
|
52
52
|
|
|
53
|
-
return
|
|
54
|
-
new AppendOnlyTreeSnapshot(new Fr(archiveInfo.root), Number(archiveInfo.size)),
|
|
55
|
-
Fr.ZERO,
|
|
56
|
-
|
|
57
|
-
stateReference,
|
|
53
|
+
return BlockHeader.from({
|
|
54
|
+
lastArchive: new AppendOnlyTreeSnapshot(new Fr(archiveInfo.root), Number(archiveInfo.size)),
|
|
55
|
+
spongeBlobHash: Fr.ZERO,
|
|
56
|
+
state: stateReference,
|
|
58
57
|
globalVariables,
|
|
59
|
-
Fr.ZERO,
|
|
60
|
-
Fr.ZERO,
|
|
61
|
-
|
|
62
|
-
Fr.ZERO,
|
|
63
|
-
);
|
|
58
|
+
totalFees: Fr.ZERO,
|
|
59
|
+
totalManaUsed: Fr.ZERO,
|
|
60
|
+
});
|
|
64
61
|
}
|
|
65
62
|
|
|
66
63
|
/**
|
|
@@ -84,11 +81,15 @@ export async function makeTXEBlock(
|
|
|
84
81
|
const header = await makeTXEBlockHeader(worldTrees, globalVariables);
|
|
85
82
|
|
|
86
83
|
// Update the archive tree with this block's header hash
|
|
87
|
-
await worldTrees.updateArchive(header
|
|
84
|
+
await worldTrees.updateArchive(header);
|
|
88
85
|
|
|
89
86
|
// Get the new archive state after updating
|
|
90
87
|
const newArchiveInfo = await worldTrees.getTreeInfo(MerkleTreeId.ARCHIVE);
|
|
91
88
|
const newArchive = new AppendOnlyTreeSnapshot(new Fr(newArchiveInfo.root), Number(newArchiveInfo.size));
|
|
92
89
|
|
|
93
|
-
|
|
90
|
+
// L2Block requires checkpointNumber and indexWithinCheckpoint
|
|
91
|
+
const checkpointNumber = CheckpointNumber.fromBlockNumber(globalVariables.blockNumber);
|
|
92
|
+
const indexWithinCheckpoint = IndexWithinCheckpoint(0);
|
|
93
|
+
|
|
94
|
+
return new L2Block(newArchive, header, new Body(txEffects), checkpointNumber, indexWithinCheckpoint);
|
|
94
95
|
}
|
|
@@ -4,16 +4,12 @@ import type { ExecutionNoteCache } from '@aztec/pxe/simulator';
|
|
|
4
4
|
import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash } from '@aztec/stdlib/hash';
|
|
5
5
|
import { TxEffect, TxHash } from '@aztec/stdlib/tx';
|
|
6
6
|
|
|
7
|
-
export async function makeTxEffect(
|
|
8
|
-
noteCache: ExecutionNoteCache,
|
|
9
|
-
protocolNullifier: Fr,
|
|
10
|
-
txBlockNumber: BlockNumber,
|
|
11
|
-
): Promise<TxEffect> {
|
|
7
|
+
export async function makeTxEffect(noteCache: ExecutionNoteCache, txBlockNumber: BlockNumber): Promise<TxEffect> {
|
|
12
8
|
const txEffect = TxEffect.empty();
|
|
13
9
|
|
|
14
|
-
|
|
15
|
-
const nonceGenerator = usedProtocolNullifierForNonces ? protocolNullifier : noteCache.getAllNullifiers()[0];
|
|
10
|
+
noteCache.finish();
|
|
16
11
|
|
|
12
|
+
const nonceGenerator = noteCache.getNonceGenerator();
|
|
17
13
|
txEffect.noteHashes = await Promise.all(
|
|
18
14
|
noteCache
|
|
19
15
|
.getAllNotes()
|
|
@@ -28,10 +24,6 @@ export async function makeTxEffect(
|
|
|
28
24
|
// Nullifiers are already siloed
|
|
29
25
|
txEffect.nullifiers = noteCache.getAllNullifiers();
|
|
30
26
|
|
|
31
|
-
if (usedProtocolNullifierForNonces) {
|
|
32
|
-
txEffect.nullifiers.unshift(protocolNullifier);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
27
|
txEffect.txHash = new TxHash(new Fr(txBlockNumber));
|
|
36
28
|
|
|
37
29
|
return txEffect;
|