@aztec/stdlib 1.0.0-nightly.20250708 → 1.0.0-staging.1
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/abi/decoder.d.ts.map +1 -1
- package/dest/abi/decoder.js +6 -3
- package/dest/abi/index.d.ts +0 -1
- package/dest/abi/index.d.ts.map +1 -1
- package/dest/abi/index.js +0 -1
- package/dest/block/l2_block.d.ts +0 -7
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +0 -8
- package/dest/block/l2_block_stream/l2_block_stream.js +1 -1
- package/dest/gas/gas.d.ts +0 -1
- package/dest/gas/gas.d.ts.map +1 -1
- package/dest/gas/gas.js +0 -3
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +1 -3
- package/dest/interfaces/client.d.ts +0 -1
- package/dest/interfaces/client.d.ts.map +1 -1
- package/dest/interfaces/client.js +0 -1
- package/dest/interfaces/configs.d.ts +0 -10
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +1 -3
- package/dest/interfaces/proving-job.d.ts +18 -18
- package/dest/interfaces/pxe.d.ts +0 -2
- package/dest/interfaces/pxe.d.ts.map +1 -1
- package/dest/interfaces/server.d.ts +1 -3
- package/dest/interfaces/server.d.ts.map +1 -1
- package/dest/interfaces/server.js +1 -3
- package/dest/interfaces/tx-collector.d.ts +15 -0
- package/dest/interfaces/tx-collector.d.ts.map +1 -0
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts +6 -6
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.js +20 -18
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +10 -7
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_nullifier_read_request_hints.js +32 -17
- package/dest/kernel/hints/build_transient_data_hints.d.ts +1 -2
- package/dest/kernel/hints/build_transient_data_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_transient_data_hints.js +8 -7
- package/dest/kernel/hints/index.d.ts +1 -0
- package/dest/kernel/hints/index.d.ts.map +1 -1
- package/dest/kernel/hints/index.js +1 -0
- package/dest/kernel/hints/note_hash_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/note_hash_read_request_hints.js +4 -4
- package/dest/kernel/hints/nullifier_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/nullifier_read_request_hints.js +4 -4
- package/dest/kernel/hints/read_request_hints.d.ts +17 -17
- package/dest/kernel/hints/read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/read_request_hints.js +28 -28
- package/dest/kernel/hints/rollup_validation_requests.d.ts +34 -0
- package/dest/kernel/hints/rollup_validation_requests.d.ts.map +1 -0
- package/dest/kernel/hints/rollup_validation_requests.js +55 -0
- package/dest/kernel/index.d.ts +0 -1
- package/dest/kernel/index.d.ts.map +1 -1
- package/dest/kernel/index.js +0 -1
- package/dest/kernel/private_accumulated_data.d.ts +15 -16
- package/dest/kernel/private_accumulated_data.d.ts.map +1 -1
- package/dest/kernel/private_accumulated_data.js +3 -3
- package/dest/kernel/private_circuit_public_inputs.d.ts +25 -26
- package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_circuit_public_inputs.js +15 -33
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +0 -9
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.js +4 -8
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +1 -10
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +6 -9
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +4 -11
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +18 -20
- package/dest/kernel/private_to_public_kernel_circuit_public_inputs.d.ts +4 -4
- package/dest/kernel/private_to_public_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_to_public_kernel_circuit_public_inputs.js +10 -9
- package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts +11 -11
- package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.js +12 -11
- package/dest/kernel/private_validation_requests.d.ts +20 -8
- package/dest/kernel/private_validation_requests.d.ts.map +1 -1
- package/dest/kernel/private_validation_requests.js +21 -9
- package/dest/kernel/utils/order_and_comparison.d.ts +3 -0
- package/dest/kernel/utils/order_and_comparison.d.ts.map +1 -1
- package/dest/kernel/utils/order_and_comparison.js +19 -0
- package/dest/messaging/l2_to_l1_message.d.ts +0 -2
- package/dest/messaging/l2_to_l1_message.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_message.js +0 -7
- package/dest/p2p/block_proposal.d.ts +1 -8
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +8 -21
- package/dest/p2p/consensus_payload.d.ts +11 -3
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.js +22 -13
- package/dest/p2p/topic_type.d.ts.map +1 -1
- package/dest/p2p/topic_type.js +3 -5
- package/dest/tests/factories.d.ts +2 -0
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +22 -20
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +12 -14
- package/dest/tx/include_by_timestamp.d.ts +54 -0
- package/dest/tx/include_by_timestamp.d.ts.map +1 -0
- package/dest/tx/include_by_timestamp.js +72 -0
- package/dest/tx/index.d.ts +1 -0
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +1 -0
- package/dest/tx/private_execution_result.d.ts +2 -2
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +11 -11
- package/dest/tx/simulated_tx.js +1 -1
- package/dest/tx/tx.d.ts +2 -7
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +0 -8
- package/dest/versioning/versioning.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/abi/decoder.ts +6 -3
- package/src/abi/index.ts +0 -1
- package/src/block/l2_block.ts +0 -16
- package/src/block/l2_block_stream/l2_block_stream.ts +1 -1
- package/src/gas/gas.ts +0 -4
- package/src/interfaces/aztec-node-admin.ts +1 -8
- package/src/interfaces/client.ts +0 -1
- package/src/interfaces/configs.ts +0 -6
- package/src/interfaces/pxe.ts +0 -2
- package/src/interfaces/server.ts +1 -3
- package/src/interfaces/tx-collector.ts +17 -0
- package/src/kernel/hints/build_note_hash_read_request_hints.ts +30 -28
- package/src/kernel/hints/build_nullifier_read_request_hints.ts +59 -28
- package/src/kernel/hints/build_transient_data_hints.ts +11 -9
- package/src/kernel/hints/index.ts +1 -0
- package/src/kernel/hints/note_hash_read_request_hints.ts +16 -4
- package/src/kernel/hints/nullifier_read_request_hints.ts +16 -4
- package/src/kernel/hints/read_request_hints.ts +22 -22
- package/src/kernel/hints/rollup_validation_requests.ts +71 -0
- package/src/kernel/index.ts +0 -1
- package/src/kernel/private_accumulated_data.ts +23 -23
- package/src/kernel/private_circuit_public_inputs.ts +68 -92
- package/src/kernel/private_kernel_circuit_public_inputs.ts +1 -9
- package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +4 -13
- package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +20 -20
- package/src/kernel/private_to_public_kernel_circuit_public_inputs.ts +7 -7
- package/src/kernel/private_to_rollup_kernel_circuit_public_inputs.ts +10 -16
- package/src/kernel/private_validation_requests.ts +50 -19
- package/src/kernel/utils/order_and_comparison.ts +25 -0
- package/src/messaging/l2_to_l1_message.ts +0 -9
- package/src/p2p/block_proposal.ts +5 -23
- package/src/p2p/consensus_payload.ts +29 -10
- package/src/p2p/topic_type.ts +1 -3
- package/src/tests/factories.ts +26 -33
- package/src/tests/mocks.ts +9 -7
- package/src/tx/include_by_timestamp.ts +90 -0
- package/src/tx/index.ts +1 -0
- package/src/tx/private_execution_result.ts +9 -11
- package/src/tx/simulated_tx.ts +2 -2
- package/src/tx/tx.ts +1 -14
- package/src/versioning/versioning.ts +3 -0
- package/dest/abi/authorization_selector.d.ts +0 -52
- package/dest/abi/authorization_selector.d.ts.map +0 -1
- package/dest/abi/authorization_selector.js +0 -70
- package/dest/interfaces/tx_provider.d.ts +0 -24
- package/dest/interfaces/tx_provider.d.ts.map +0 -1
- package/dest/kernel/claimed_length_array.d.ts +0 -34
- package/dest/kernel/claimed_length_array.d.ts.map +0 -1
- package/dest/kernel/claimed_length_array.js +0 -58
- package/src/abi/authorization_selector.ts +0 -95
- package/src/interfaces/tx_provider.ts +0 -16
- package/src/kernel/claimed_length_array.ts +0 -104
- /package/dest/interfaces/{tx_provider.js → tx-collector.js} +0 -0
package/src/tests/factories.ts
CHANGED
|
@@ -43,11 +43,11 @@ import {
|
|
|
43
43
|
VK_TREE_HEIGHT,
|
|
44
44
|
} from '@aztec/constants';
|
|
45
45
|
import { type FieldsOf, makeHalfFullTuple, makeTuple } from '@aztec/foundation/array';
|
|
46
|
-
import { compact
|
|
46
|
+
import { compact } from '@aztec/foundation/collection';
|
|
47
47
|
import { SchnorrSignature, poseidon2HashWithSeparator, sha256 } from '@aztec/foundation/crypto';
|
|
48
48
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
49
49
|
import { BLS12Point, Fr, GrumpkinScalar, Point } from '@aztec/foundation/fields';
|
|
50
|
-
import type { Bufferable
|
|
50
|
+
import type { Bufferable } from '@aztec/foundation/serialize';
|
|
51
51
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
52
52
|
|
|
53
53
|
import { FunctionSelector } from '../abi/function_selector.js';
|
|
@@ -97,8 +97,8 @@ import type { MerkleTreeReadOperations } from '../interfaces/merkle_tree_operati
|
|
|
97
97
|
import { KeyValidationRequest } from '../kernel/hints/key_validation_request.js';
|
|
98
98
|
import { KeyValidationRequestAndGenerator } from '../kernel/hints/key_validation_request_and_generator.js';
|
|
99
99
|
import { ReadRequest } from '../kernel/hints/read_request.js';
|
|
100
|
+
import { RollupValidationRequests } from '../kernel/hints/rollup_validation_requests.js';
|
|
100
101
|
import {
|
|
101
|
-
ClaimedLengthArray,
|
|
102
102
|
PartialPrivateTailPublicInputsForPublic,
|
|
103
103
|
PartialPrivateTailPublicInputsForRollup,
|
|
104
104
|
PrivateKernelTailCircuitPublicInputs,
|
|
@@ -107,6 +107,7 @@ import {
|
|
|
107
107
|
PrivateToPublicAccumulatedData,
|
|
108
108
|
PrivateToPublicKernelCircuitPublicInputs,
|
|
109
109
|
PrivateToRollupAccumulatedData,
|
|
110
|
+
mergeAccumulatedData,
|
|
110
111
|
} from '../kernel/index.js';
|
|
111
112
|
import { CountedLogHash, LogHash, ScopedLogHash } from '../kernel/log_hash.js';
|
|
112
113
|
import { NoteHash } from '../kernel/note_hash.js';
|
|
@@ -164,6 +165,7 @@ import { CallContext } from '../tx/call_context.js';
|
|
|
164
165
|
import { ContentCommitment } from '../tx/content_commitment.js';
|
|
165
166
|
import { FunctionData } from '../tx/function_data.js';
|
|
166
167
|
import { GlobalVariables } from '../tx/global_variables.js';
|
|
168
|
+
import { IncludeByTimestamp } from '../tx/include_by_timestamp.js';
|
|
167
169
|
import { PartialStateReference } from '../tx/partial_state_reference.js';
|
|
168
170
|
import { makeProcessedTxFromPrivateOnlyTx, makeProcessedTxFromTxWithPublicCalls } from '../tx/processed_tx.js';
|
|
169
171
|
import { PublicCallRequestWithCalldata } from '../tx/public_call_request_with_calldata.js';
|
|
@@ -305,6 +307,10 @@ export function makeContractStorageRead(seed = 1): ContractStorageRead {
|
|
|
305
307
|
return new ContractStorageRead(fr(seed), fr(seed + 1), seed + 2);
|
|
306
308
|
}
|
|
307
309
|
|
|
310
|
+
export function makeRollupValidationRequests(seed = 1) {
|
|
311
|
+
return new RollupValidationRequests(new IncludeByTimestamp(true, BigInt(seed + 0x31415)));
|
|
312
|
+
}
|
|
313
|
+
|
|
308
314
|
function makeTxConstantData(seed = 1) {
|
|
309
315
|
return new TxConstantData(makeHeader(seed), makeTxContext(seed + 0x100), new Fr(seed + 0x200), new Fr(seed + 0x201));
|
|
310
316
|
}
|
|
@@ -403,9 +409,9 @@ export function makePrivateKernelTailCircuitPublicInputs(
|
|
|
403
409
|
: undefined;
|
|
404
410
|
return new PrivateKernelTailCircuitPublicInputs(
|
|
405
411
|
makeTxConstantData(seed + 0x300),
|
|
412
|
+
makeRollupValidationRequests(seed + 0x500),
|
|
406
413
|
makeGas(seed + 0x600),
|
|
407
414
|
makeAztecAddress(seed + 0x700),
|
|
408
|
-
BigInt(seed + 0x800),
|
|
409
415
|
forPublic,
|
|
410
416
|
forRollup,
|
|
411
417
|
);
|
|
@@ -414,12 +420,12 @@ export function makePrivateKernelTailCircuitPublicInputs(
|
|
|
414
420
|
function makePrivateToPublicKernelCircuitPublicInputs(seed = 1) {
|
|
415
421
|
return new PrivateToPublicKernelCircuitPublicInputs(
|
|
416
422
|
makeTxConstantData(seed),
|
|
423
|
+
makeRollupValidationRequests(seed + 0x100),
|
|
417
424
|
makePrivateToPublicAccumulatedData(seed + 0x200),
|
|
418
425
|
makePrivateToPublicAccumulatedData(seed + 0x300),
|
|
419
426
|
makePublicCallRequest(seed + 0x400),
|
|
420
427
|
makeGas(seed + 0x500),
|
|
421
428
|
makeAztecAddress(seed + 0x600),
|
|
422
|
-
BigInt(seed + 0x700),
|
|
423
429
|
);
|
|
424
430
|
}
|
|
425
431
|
|
|
@@ -434,10 +440,10 @@ export function makePrivateToRollupKernelCircuitPublicInputs(
|
|
|
434
440
|
): PrivateToRollupKernelCircuitPublicInputs {
|
|
435
441
|
return new PrivateToRollupKernelCircuitPublicInputs(
|
|
436
442
|
makeTxConstantData(seed + 0x100),
|
|
443
|
+
makeRollupValidationRequests(seed),
|
|
437
444
|
makePrivateToRollupAccumulatedData(seed, fullAccumulatedData),
|
|
438
445
|
makeGas(seed + 0x600),
|
|
439
446
|
makeAztecAddress(seed + 0x700),
|
|
440
|
-
BigInt(seed + 0x800),
|
|
441
447
|
);
|
|
442
448
|
}
|
|
443
449
|
|
|
@@ -554,15 +560,6 @@ export function makeTxRequest(seed = 1): TxRequest {
|
|
|
554
560
|
});
|
|
555
561
|
}
|
|
556
562
|
|
|
557
|
-
function makeClaimedLengthArray<T extends Serializable, N extends number>(
|
|
558
|
-
arraySize: N,
|
|
559
|
-
makeItem: (seed: number) => T,
|
|
560
|
-
seed: number,
|
|
561
|
-
length = arraySize,
|
|
562
|
-
): ClaimedLengthArray<T, N> {
|
|
563
|
-
return new ClaimedLengthArray(makeTuple(arraySize, makeItem, seed) as Tuple<T, N>, length);
|
|
564
|
-
}
|
|
565
|
-
|
|
566
563
|
/**
|
|
567
564
|
* Makes arbitrary private circuit public inputs.
|
|
568
565
|
* @param seed - The seed to use for generating the private circuit public inputs.
|
|
@@ -570,30 +567,26 @@ function makeClaimedLengthArray<T extends Serializable, N extends number>(
|
|
|
570
567
|
*/
|
|
571
568
|
export function makePrivateCircuitPublicInputs(seed = 0): PrivateCircuitPublicInputs {
|
|
572
569
|
return PrivateCircuitPublicInputs.from({
|
|
573
|
-
includeByTimestamp: BigInt(seed + 0x31415),
|
|
570
|
+
includeByTimestamp: new IncludeByTimestamp(true, BigInt(seed + 0x31415)),
|
|
574
571
|
callContext: makeCallContext(seed, { isStaticCall: true }),
|
|
575
572
|
argsHash: fr(seed + 0x100),
|
|
576
573
|
returnsHash: fr(seed + 0x200),
|
|
577
574
|
minRevertibleSideEffectCounter: fr(0),
|
|
578
|
-
noteHashReadRequests:
|
|
579
|
-
nullifierReadRequests:
|
|
580
|
-
keyValidationRequestsAndGenerators:
|
|
575
|
+
noteHashReadRequests: makeTuple(MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, makeReadRequest, seed + 0x300),
|
|
576
|
+
nullifierReadRequests: makeTuple(MAX_NULLIFIER_READ_REQUESTS_PER_CALL, makeReadRequest, seed + 0x310),
|
|
577
|
+
keyValidationRequestsAndGenerators: makeTuple(
|
|
581
578
|
MAX_KEY_VALIDATION_REQUESTS_PER_CALL,
|
|
582
579
|
makeKeyValidationRequestAndGenerators,
|
|
583
580
|
seed + 0x320,
|
|
584
581
|
),
|
|
585
|
-
noteHashes:
|
|
586
|
-
nullifiers:
|
|
587
|
-
privateCallRequests:
|
|
588
|
-
|
|
589
|
-
makePrivateCallRequest,
|
|
590
|
-
seed + 0x600,
|
|
591
|
-
),
|
|
592
|
-
publicCallRequests: makeClaimedLengthArray(MAX_ENQUEUED_CALLS_PER_CALL, makeCountedPublicCallRequest, seed + 0x700),
|
|
582
|
+
noteHashes: makeTuple(MAX_NOTE_HASHES_PER_CALL, makeNoteHash, seed + 0x400),
|
|
583
|
+
nullifiers: makeTuple(MAX_NULLIFIERS_PER_CALL, makeNullifier, seed + 0x500),
|
|
584
|
+
privateCallRequests: makeTuple(MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, makePrivateCallRequest, seed + 0x600),
|
|
585
|
+
publicCallRequests: makeTuple(MAX_ENQUEUED_CALLS_PER_CALL, makeCountedPublicCallRequest, seed + 0x700),
|
|
593
586
|
publicTeardownCallRequest: makePublicCallRequest(seed + 0x800),
|
|
594
|
-
l2ToL1Msgs:
|
|
595
|
-
privateLogs:
|
|
596
|
-
contractClassLogsHashes:
|
|
587
|
+
l2ToL1Msgs: makeTuple(MAX_L2_TO_L1_MSGS_PER_CALL, makeCountedL2ToL1Message, seed + 0x800),
|
|
588
|
+
privateLogs: makeTuple(MAX_PRIVATE_LOGS_PER_CALL, makePrivateLogData, seed + 0x875),
|
|
589
|
+
contractClassLogsHashes: makeTuple(MAX_CONTRACT_CLASS_LOGS_PER_TX, makeCountedLogHash, seed + 0xa00),
|
|
597
590
|
startSideEffectCounter: fr(seed + 0x849),
|
|
598
591
|
endSideEffectCounter: fr(seed + 0x850),
|
|
599
592
|
historicalHeader: makeHeader(seed + 0xd00, undefined),
|
|
@@ -1695,9 +1688,9 @@ export async function makeBloatedProcessedTx({
|
|
|
1695
1688
|
avmOutput.previousRevertibleAccumulatedData.getArrayLengths();
|
|
1696
1689
|
// Assign final data emitted from avm.
|
|
1697
1690
|
avmOutput.accumulatedData.noteHashes = revertibleData.noteHashes;
|
|
1698
|
-
avmOutput.accumulatedData.nullifiers =
|
|
1699
|
-
nonRevertibleData.nullifiers
|
|
1700
|
-
|
|
1691
|
+
avmOutput.accumulatedData.nullifiers = mergeAccumulatedData(
|
|
1692
|
+
nonRevertibleData.nullifiers,
|
|
1693
|
+
revertibleData.nullifiers,
|
|
1701
1694
|
MAX_NULLIFIERS_PER_TX,
|
|
1702
1695
|
);
|
|
1703
1696
|
avmOutput.accumulatedData.l2ToL1Msgs = revertibleData.l2ToL1Msgs;
|
package/src/tests/mocks.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MAX_ENQUEUED_CALLS_PER_TX
|
|
1
|
+
import { MAX_ENQUEUED_CALLS_PER_TX } from '@aztec/constants';
|
|
2
2
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
3
3
|
import { times } from '@aztec/foundation/collection';
|
|
4
4
|
import { Secp256k1Signer, randomBytes } from '@aztec/foundation/crypto';
|
|
@@ -126,9 +126,6 @@ export const mockTx = async (
|
|
|
126
126
|
data.constants.vkTreeRoot = vkTreeRoot;
|
|
127
127
|
data.constants.protocolContractTreeRoot = protocolContractTreeRoot;
|
|
128
128
|
|
|
129
|
-
// Set includeByTimestamp to the maximum allowed duration from the current time.
|
|
130
|
-
data.includeByTimestamp = BigInt(Math.floor(Date.now() / 1000) + MAX_INCLUDE_BY_TIMESTAMP_DURATION);
|
|
131
|
-
|
|
132
129
|
const publicFunctionCalldata: HashedValues[] = [];
|
|
133
130
|
if (!isForPublic) {
|
|
134
131
|
data.forRollup!.end.nullifiers[0] = firstNullifier.value;
|
|
@@ -255,12 +252,18 @@ const makeAndSignConsensusPayload = (
|
|
|
255
252
|
options?: MakeConsensusPayloadOptions,
|
|
256
253
|
) => {
|
|
257
254
|
const header = options?.header ?? makeHeader(1);
|
|
258
|
-
const {
|
|
255
|
+
const {
|
|
256
|
+
signer = Secp256k1Signer.random(),
|
|
257
|
+
archive = Fr.random(),
|
|
258
|
+
stateReference = header.state,
|
|
259
|
+
txHashes = [0, 1, 2, 3, 4, 5].map(() => TxHash.random()),
|
|
260
|
+
} = options ?? {};
|
|
259
261
|
|
|
260
262
|
const payload = ConsensusPayload.fromFields({
|
|
261
263
|
header: header.toPropose(),
|
|
262
264
|
archive,
|
|
263
265
|
stateReference,
|
|
266
|
+
txHashes,
|
|
264
267
|
});
|
|
265
268
|
|
|
266
269
|
const hash = getHashedSignaturePayloadEthSignedMessage(payload, domainSeparator);
|
|
@@ -274,8 +277,7 @@ export const makeBlockProposal = (options?: MakeConsensusPayloadOptions): BlockP
|
|
|
274
277
|
SignatureDomainSeparator.blockProposal,
|
|
275
278
|
options,
|
|
276
279
|
);
|
|
277
|
-
|
|
278
|
-
return new BlockProposal(blockNumber, payload, signature, txHashes, options?.txs ?? []);
|
|
280
|
+
return new BlockProposal(blockNumber, payload, signature, options?.txs ?? []);
|
|
279
281
|
};
|
|
280
282
|
|
|
281
283
|
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/8028)
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { INCLUDE_BY_TIMESTAMP_LENGTH } from '@aztec/constants';
|
|
2
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
+
import { BufferReader, FieldReader, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
|
|
4
|
+
import type { FieldsOf } from '@aztec/foundation/types';
|
|
5
|
+
|
|
6
|
+
import type { UInt64 } from '../types/index.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Maximum block timestamp value at which the transaction can still be included.
|
|
10
|
+
*/
|
|
11
|
+
export class IncludeByTimestamp {
|
|
12
|
+
constructor(
|
|
13
|
+
/**
|
|
14
|
+
* Whether max inclusion timestamp was requested.
|
|
15
|
+
*/
|
|
16
|
+
public isSome: boolean,
|
|
17
|
+
/**
|
|
18
|
+
* The requested max inclusion timestamp of a block, if isSome is true.
|
|
19
|
+
*/
|
|
20
|
+
public value: UInt64,
|
|
21
|
+
) {
|
|
22
|
+
// For sanity we check that the value is less than 2 ** 64.
|
|
23
|
+
if (value >= 1n << 64n) {
|
|
24
|
+
throw new Error('Value is not a u64.');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Serialize as a buffer.
|
|
30
|
+
* @returns The buffer.
|
|
31
|
+
*/
|
|
32
|
+
toBuffer() {
|
|
33
|
+
return serializeToBuffer(...IncludeByTimestamp.getFields(this));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
toFields(): Fr[] {
|
|
37
|
+
const fields = serializeToFields(...IncludeByTimestamp.getFields(this));
|
|
38
|
+
if (fields.length !== INCLUDE_BY_TIMESTAMP_LENGTH) {
|
|
39
|
+
throw new Error(
|
|
40
|
+
`Invalid number of fields for IncludeByTimestamp. Expected ${INCLUDE_BY_TIMESTAMP_LENGTH}, got ${fields.length}`,
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
return fields;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Deserializes IncludeByTimestamp from a buffer or reader.
|
|
48
|
+
* @param buffer - Buffer to read from.
|
|
49
|
+
* @returns The IncludeByTimestamp.
|
|
50
|
+
*/
|
|
51
|
+
static fromBuffer(buffer: Buffer | BufferReader): IncludeByTimestamp {
|
|
52
|
+
const reader = BufferReader.asReader(buffer);
|
|
53
|
+
const isSome = reader.readBoolean();
|
|
54
|
+
// UInt64 is aliased to bigint in TypeScript, causing it to be serialized as a 256-bit integer.
|
|
55
|
+
// Therefore, we must read it back using readUInt256() rather than readUInt64().
|
|
56
|
+
const value = reader.readUInt256();
|
|
57
|
+
return new IncludeByTimestamp(isSome, value);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
static fromFields(fields: Fr[] | FieldReader): IncludeByTimestamp {
|
|
61
|
+
const reader = FieldReader.asReader(fields);
|
|
62
|
+
return new IncludeByTimestamp(reader.readBoolean(), reader.readU64());
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
static empty() {
|
|
66
|
+
return new IncludeByTimestamp(false, 0n);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
isEmpty(): boolean {
|
|
70
|
+
return !this.isSome && this.value === 0n;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Create a new instance from a fields dictionary.
|
|
75
|
+
* @param fields - The dictionary.
|
|
76
|
+
* @returns A new instance.
|
|
77
|
+
*/
|
|
78
|
+
static from(fields: FieldsOf<IncludeByTimestamp>): IncludeByTimestamp {
|
|
79
|
+
return new IncludeByTimestamp(...IncludeByTimestamp.getFields(fields));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Serialize into a field array. Low-level utility.
|
|
84
|
+
* @param fields - Object with fields.
|
|
85
|
+
* @returns The array.
|
|
86
|
+
*/
|
|
87
|
+
static getFields(fields: FieldsOf<IncludeByTimestamp>) {
|
|
88
|
+
return [fields.isSome, fields.value] as const;
|
|
89
|
+
}
|
|
90
|
+
}
|
package/src/tx/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './block_header.js';
|
|
2
2
|
export * from './call_context.js';
|
|
3
3
|
export * from './global_variables.js';
|
|
4
|
+
export * from './include_by_timestamp.js';
|
|
4
5
|
export * from './content_commitment.js';
|
|
5
6
|
export * from './state_reference.js';
|
|
6
7
|
export * from './partial_state_reference.js';
|
|
@@ -136,7 +136,7 @@ export class PrivateCallExecutionResult {
|
|
|
136
136
|
/** The offchain effects emitted during execution of this function call via the `emit_offchain_effect` oracle. */
|
|
137
137
|
public offchainEffects: { data: Fr[] }[],
|
|
138
138
|
/** The nested executions. */
|
|
139
|
-
public
|
|
139
|
+
public nestedExecutions: PrivateCallExecutionResult[],
|
|
140
140
|
/**
|
|
141
141
|
* Contract class logs emitted during execution of this function call.
|
|
142
142
|
* Note: We only need to collect the ContractClassLogFields as preimages for the tx.
|
|
@@ -158,7 +158,7 @@ export class PrivateCallExecutionResult {
|
|
|
158
158
|
noteHashNullifierCounterMap: mapSchema(z.coerce.number(), z.number()),
|
|
159
159
|
returnValues: z.array(schemas.Fr),
|
|
160
160
|
offchainEffects: z.array(z.object({ data: z.array(schemas.Fr) })),
|
|
161
|
-
|
|
161
|
+
nestedExecutions: z.array(z.lazy(() => PrivateCallExecutionResult.schema)),
|
|
162
162
|
contractClassLogs: z.array(CountedContractClassLog.schema),
|
|
163
163
|
})
|
|
164
164
|
.transform(PrivateCallExecutionResult.from);
|
|
@@ -175,7 +175,7 @@ export class PrivateCallExecutionResult {
|
|
|
175
175
|
fields.noteHashNullifierCounterMap,
|
|
176
176
|
fields.returnValues,
|
|
177
177
|
fields.offchainEffects,
|
|
178
|
-
fields.
|
|
178
|
+
fields.nestedExecutions,
|
|
179
179
|
fields.contractClassLogs,
|
|
180
180
|
);
|
|
181
181
|
}
|
|
@@ -205,7 +205,7 @@ export function collectNoteHashLeafIndexMap(execResult: PrivateExecutionResult)
|
|
|
205
205
|
const accum: Map<bigint, bigint> = new Map();
|
|
206
206
|
const collectNoteHashLeafIndexMapRecursive = (callResult: PrivateCallExecutionResult, accum: Map<bigint, bigint>) => {
|
|
207
207
|
callResult.noteHashLeafIndexMap.forEach((value, key) => accum.set(key, value));
|
|
208
|
-
callResult.
|
|
208
|
+
callResult.nestedExecutions.forEach(nested => collectNoteHashLeafIndexMapRecursive(nested, accum));
|
|
209
209
|
};
|
|
210
210
|
collectNoteHashLeafIndexMapRecursive(execResult.entrypoint, accum);
|
|
211
211
|
return accum;
|
|
@@ -218,7 +218,7 @@ export function collectNoteHashNullifierCounterMap(execResult: PrivateExecutionR
|
|
|
218
218
|
accum: Map<number, number>,
|
|
219
219
|
) => {
|
|
220
220
|
callResult.noteHashNullifierCounterMap.forEach((value, key) => accum.set(key, value));
|
|
221
|
-
callResult.
|
|
221
|
+
callResult.nestedExecutions.forEach(nested => collectNoteHashNullifierCounterMapRecursive(nested, accum));
|
|
222
222
|
};
|
|
223
223
|
collectNoteHashNullifierCounterMapRecursive(execResult.entrypoint, accum);
|
|
224
224
|
return accum;
|
|
@@ -230,7 +230,7 @@ export function collectNoteHashNullifierCounterMap(execResult: PrivateExecutionR
|
|
|
230
230
|
* @returns All contract class logs.
|
|
231
231
|
*/
|
|
232
232
|
function collectContractClassLogs(execResult: PrivateCallExecutionResult): CountedContractClassLog[] {
|
|
233
|
-
return [execResult.contractClassLogs, ...execResult.
|
|
233
|
+
return [execResult.contractClassLogs, ...execResult.nestedExecutions.flatMap(collectContractClassLogs)].flat();
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
/**
|
|
@@ -256,7 +256,7 @@ export function collectOffchainEffects(execResult: PrivateExecutionResult): Offc
|
|
|
256
256
|
...msg,
|
|
257
257
|
contractAddress: callResult.publicInputs.callContext.contractAddress, // contract that emitted the effect
|
|
258
258
|
})),
|
|
259
|
-
...callResult.
|
|
259
|
+
...callResult.nestedExecutions.flatMap(nested => collectEffectsRecursive(nested)),
|
|
260
260
|
];
|
|
261
261
|
};
|
|
262
262
|
return collectEffectsRecursive(execResult.entrypoint);
|
|
@@ -264,7 +264,7 @@ export function collectOffchainEffects(execResult: PrivateExecutionResult): Offc
|
|
|
264
264
|
|
|
265
265
|
export function getFinalMinRevertibleSideEffectCounter(execResult: PrivateExecutionResult): number {
|
|
266
266
|
const collectFinalMinRevertibleSideEffectCounterRecursive = (callResult: PrivateCallExecutionResult): number => {
|
|
267
|
-
return callResult.
|
|
267
|
+
return callResult.nestedExecutions.reduce((counter, exec) => {
|
|
268
268
|
const nestedCounter = collectFinalMinRevertibleSideEffectCounterRecursive(exec);
|
|
269
269
|
return nestedCounter ? nestedCounter : counter;
|
|
270
270
|
}, callResult.publicInputs.minRevertibleSideEffectCounter.toNumber());
|
|
@@ -279,9 +279,7 @@ export function collectNested<T>(
|
|
|
279
279
|
const thisExecutionReads = executionStack.flatMap(extractExecutionItems);
|
|
280
280
|
|
|
281
281
|
return thisExecutionReads.concat(
|
|
282
|
-
executionStack.flatMap(({
|
|
283
|
-
collectNested(nestedExecutionResults, extractExecutionItems),
|
|
284
|
-
),
|
|
282
|
+
executionStack.flatMap(({ nestedExecutions }) => collectNested(nestedExecutions, extractExecutionItems)),
|
|
285
283
|
);
|
|
286
284
|
}
|
|
287
285
|
|
package/src/tx/simulated_tx.ts
CHANGED
|
@@ -166,8 +166,8 @@ export function accumulatePrivateReturnValues(executionResult: PrivateExecutionR
|
|
|
166
166
|
executionResult: PrivateCallExecutionResult,
|
|
167
167
|
): NestedProcessReturnValues => {
|
|
168
168
|
const acc = new NestedProcessReturnValues(executionResult.returnValues);
|
|
169
|
-
acc.nested = executionResult.
|
|
170
|
-
collectPrivateReturnValuesRecursive(
|
|
169
|
+
acc.nested = executionResult.nestedExecutions.map(nestedExecution =>
|
|
170
|
+
collectPrivateReturnValuesRecursive(nestedExecution),
|
|
171
171
|
);
|
|
172
172
|
return acc;
|
|
173
173
|
};
|
package/src/tx/tx.ts
CHANGED
|
@@ -27,8 +27,7 @@ import { TxHash } from './tx_hash.js';
|
|
|
27
27
|
export class Tx extends Gossipable {
|
|
28
28
|
static override p2pTopic = TopicType.tx;
|
|
29
29
|
// For memoization
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
private txHash: TxHash | undefined;
|
|
32
31
|
private calldataMap: Map<string, Fr[]> | undefined;
|
|
33
32
|
|
|
34
33
|
constructor(
|
|
@@ -201,7 +200,6 @@ export class Tx extends Gossipable {
|
|
|
201
200
|
*/
|
|
202
201
|
setTxHash(hash: TxHash) {
|
|
203
202
|
this.txHash = hash;
|
|
204
|
-
return this as unknown as TxWithHash;
|
|
205
203
|
}
|
|
206
204
|
|
|
207
205
|
getCalldataMap(): Map<string, Fr[]> {
|
|
@@ -313,15 +311,6 @@ export class Tx extends Gossipable {
|
|
|
313
311
|
const calldata = calldataMap.get(request.calldataHash.toString()) ?? [];
|
|
314
312
|
return new PublicCallRequestWithCalldata(request, calldata);
|
|
315
313
|
}
|
|
316
|
-
|
|
317
|
-
public async toTxWithHash() {
|
|
318
|
-
await this.getTxHash();
|
|
319
|
-
return this as unknown as TxWithHash;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
public static toTxsWithHashes(txs: Tx[]): Promise<TxWithHash[]> {
|
|
323
|
-
return Promise.all(txs.map(tx => tx.toTxWithHash()));
|
|
324
|
-
}
|
|
325
314
|
}
|
|
326
315
|
|
|
327
316
|
/** Utility type for an entity that has a hash property for a txhash */
|
|
@@ -330,5 +319,3 @@ type HasHash = { /** The tx hash */ hash: TxHash };
|
|
|
330
319
|
function hasHash(tx: Tx | HasHash): tx is HasHash {
|
|
331
320
|
return (tx as HasHash).hash !== undefined;
|
|
332
321
|
}
|
|
333
|
-
|
|
334
|
-
export type TxWithHash = Tx & { txHash: TxHash };
|
|
@@ -6,6 +6,9 @@ import type Koa from 'koa';
|
|
|
6
6
|
|
|
7
7
|
import type { ChainConfig } from '../config/chain-config.js';
|
|
8
8
|
|
|
9
|
+
// REFACTOR: This file is not a circuit-type, but at the moment we don't have any other
|
|
10
|
+
// package common to all components that we can use for this shared code.
|
|
11
|
+
|
|
9
12
|
/** Fields that identify a version of the Aztec protocol. Any mismatch between these fields should signal an incompatibility between nodes. */
|
|
10
13
|
export type ComponentsVersions = {
|
|
11
14
|
l1ChainId: number;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { BufferReader } from '@aztec/foundation/serialize';
|
|
3
|
-
import { Selector } from './selector.js';
|
|
4
|
-
/** Authorization selector branding */
|
|
5
|
-
export interface AuthorizationSelector {
|
|
6
|
-
/** Brand. */
|
|
7
|
-
_branding: 'AuthorizationSelector';
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* An authorization selector is the first 4 bytes of the hash of an authorization struct signature.
|
|
11
|
-
*/
|
|
12
|
-
export declare class AuthorizationSelector extends Selector {
|
|
13
|
-
/**
|
|
14
|
-
* Deserializes from a buffer or reader, corresponding to a write in cpp.
|
|
15
|
-
* @param buffer - Buffer or BufferReader to read from.
|
|
16
|
-
* @returns The Selector.
|
|
17
|
-
*/
|
|
18
|
-
static fromBuffer(buffer: Buffer | BufferReader): AuthorizationSelector;
|
|
19
|
-
/**
|
|
20
|
-
* Converts a field to selector.
|
|
21
|
-
* @param fr - The field to convert.
|
|
22
|
-
* @returns The selector.
|
|
23
|
-
*/
|
|
24
|
-
static fromField(fr: Fr): AuthorizationSelector;
|
|
25
|
-
/**
|
|
26
|
-
* Creates a selector from a signature.
|
|
27
|
-
* @param signature - Signature to generate the selector for (e.g. "CallAuthorization(field,field)").
|
|
28
|
-
* @returns selector.
|
|
29
|
-
*/
|
|
30
|
-
static fromSignature(signature: string): Promise<AuthorizationSelector>;
|
|
31
|
-
/**
|
|
32
|
-
* Create a Selector instance from a hex-encoded string.
|
|
33
|
-
*
|
|
34
|
-
* @param selector - The hex-encoded string representing the Selector.
|
|
35
|
-
* @returns An Selector instance.
|
|
36
|
-
* @throws If the selector length is invalid.
|
|
37
|
-
*/
|
|
38
|
-
static fromString(selector: string): AuthorizationSelector;
|
|
39
|
-
/**
|
|
40
|
-
* Creates an empty selector.
|
|
41
|
-
* @returns An empty selector.
|
|
42
|
-
*/
|
|
43
|
-
static empty(): AuthorizationSelector;
|
|
44
|
-
/**
|
|
45
|
-
* Creates a random selector.
|
|
46
|
-
* @returns A random selector.
|
|
47
|
-
*/
|
|
48
|
-
static random(): AuthorizationSelector;
|
|
49
|
-
toJSON(): string;
|
|
50
|
-
static get schema(): import("zod").ZodType<AuthorizationSelector, any, string>;
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=authorization_selector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authorization_selector.d.ts","sourceRoot":"","sources":["../../src/abi/authorization_selector.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAIzC,sCAAsC;AACtC,MAAM,WAAW,qBAAqB;IACpC,aAAa;IACb,SAAS,EAAE,uBAAuB,CAAC;CACpC;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,QAAQ;IACjD;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAM/C;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE;IAIvB;;;;OAIG;WACU,aAAa,CAAC,SAAS,EAAE,MAAM;IAW5C;;;;;;OAMG;IACH,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM;IAQlC;;;OAGG;IACH,MAAM,CAAC,KAAK;IAIZ;;;OAGG;IACH,MAAM,CAAC,MAAM;IAIb,MAAM;IAIN,MAAM,KAAK,MAAM,8DAEhB;CACF"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { fromHex, toBigIntBE } from '@aztec/foundation/bigint-buffer';
|
|
2
|
-
import { poseidon2HashBytes, randomBytes } from '@aztec/foundation/crypto';
|
|
3
|
-
import { hexSchemaFor } from '@aztec/foundation/schemas';
|
|
4
|
-
import { BufferReader } from '@aztec/foundation/serialize';
|
|
5
|
-
import { Selector } from './selector.js';
|
|
6
|
-
/**
|
|
7
|
-
* An authorization selector is the first 4 bytes of the hash of an authorization struct signature.
|
|
8
|
-
*/ export class AuthorizationSelector extends Selector {
|
|
9
|
-
/**
|
|
10
|
-
* Deserializes from a buffer or reader, corresponding to a write in cpp.
|
|
11
|
-
* @param buffer - Buffer or BufferReader to read from.
|
|
12
|
-
* @returns The Selector.
|
|
13
|
-
*/ static fromBuffer(buffer) {
|
|
14
|
-
const reader = BufferReader.asReader(buffer);
|
|
15
|
-
const value = Number(toBigIntBE(reader.readBytes(Selector.SIZE)));
|
|
16
|
-
return new AuthorizationSelector(value);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Converts a field to selector.
|
|
20
|
-
* @param fr - The field to convert.
|
|
21
|
-
* @returns The selector.
|
|
22
|
-
*/ static fromField(fr) {
|
|
23
|
-
return new AuthorizationSelector(Number(fr.toBigInt()));
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Creates a selector from a signature.
|
|
27
|
-
* @param signature - Signature to generate the selector for (e.g. "CallAuthorization(field,field)").
|
|
28
|
-
* @returns selector.
|
|
29
|
-
*/ static async fromSignature(signature) {
|
|
30
|
-
// throw if signature contains whitespace
|
|
31
|
-
if (/\s/.test(signature)) {
|
|
32
|
-
throw new Error('Signature cannot contain whitespace');
|
|
33
|
-
}
|
|
34
|
-
const hash = await poseidon2HashBytes(Buffer.from(signature));
|
|
35
|
-
// We take the last Selector.SIZE big endian bytes
|
|
36
|
-
const bytes = hash.toBuffer().slice(-Selector.SIZE);
|
|
37
|
-
return AuthorizationSelector.fromBuffer(bytes);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Create a Selector instance from a hex-encoded string.
|
|
41
|
-
*
|
|
42
|
-
* @param selector - The hex-encoded string representing the Selector.
|
|
43
|
-
* @returns An Selector instance.
|
|
44
|
-
* @throws If the selector length is invalid.
|
|
45
|
-
*/ static fromString(selector) {
|
|
46
|
-
const buf = fromHex(selector);
|
|
47
|
-
if (buf.length !== Selector.SIZE) {
|
|
48
|
-
throw new Error(`Invalid AuthorizationSelector length ${buf.length} (expected ${Selector.SIZE}).`);
|
|
49
|
-
}
|
|
50
|
-
return AuthorizationSelector.fromBuffer(buf);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Creates an empty selector.
|
|
54
|
-
* @returns An empty selector.
|
|
55
|
-
*/ static empty() {
|
|
56
|
-
return new AuthorizationSelector(0);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Creates a random selector.
|
|
60
|
-
* @returns A random selector.
|
|
61
|
-
*/ static random() {
|
|
62
|
-
return AuthorizationSelector.fromBuffer(randomBytes(Selector.SIZE));
|
|
63
|
-
}
|
|
64
|
-
toJSON() {
|
|
65
|
-
return this.toString();
|
|
66
|
-
}
|
|
67
|
-
static get schema() {
|
|
68
|
-
return hexSchemaFor(AuthorizationSelector);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { L2Block } from '@aztec/stdlib/block';
|
|
2
|
-
import type { BlockProposal } from '@aztec/stdlib/p2p';
|
|
3
|
-
import { TxHash, type TxWithHash } from '@aztec/stdlib/tx';
|
|
4
|
-
import type { PeerId } from '@libp2p/interface';
|
|
5
|
-
export interface ITxProvider {
|
|
6
|
-
getAvailableTxs(txHashes: TxHash[]): Promise<{
|
|
7
|
-
txs: TxWithHash[];
|
|
8
|
-
missingTxs: TxHash[];
|
|
9
|
-
}>;
|
|
10
|
-
getTxsForBlockProposal(blockProposal: BlockProposal, opts: {
|
|
11
|
-
pinnedPeer: PeerId | undefined;
|
|
12
|
-
deadline: Date;
|
|
13
|
-
}): Promise<{
|
|
14
|
-
txs: TxWithHash[];
|
|
15
|
-
missingTxs: TxHash[];
|
|
16
|
-
}>;
|
|
17
|
-
getTxsForBlock(block: L2Block, opts: {
|
|
18
|
-
deadline: Date;
|
|
19
|
-
}): Promise<{
|
|
20
|
-
txs: TxWithHash[];
|
|
21
|
-
missingTxs: TxHash[];
|
|
22
|
-
}>;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=tx_provider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tx_provider.d.ts","sourceRoot":"","sources":["../../src/interfaces/tx_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,WAAW,WAAW;IAC1B,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAAE,GAAG,EAAE,UAAU,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IAE1F,sBAAsB,CACpB,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE;QAAE,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE,GACvD,OAAO,CAAC;QAAE,GAAG,EAAE,UAAU,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IAExD,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE;QAAE,QAAQ,EAAE,IAAI,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,GAAG,EAAE,UAAU,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;CAChH"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { BufferReader, FieldReader, type Serializable, type Tuple } from '@aztec/foundation/serialize';
|
|
3
|
-
import { inspect } from 'util';
|
|
4
|
-
export declare class ClaimedLengthArray<T extends Serializable, N extends number> {
|
|
5
|
-
array: Tuple<T, N>;
|
|
6
|
-
claimedLength: number;
|
|
7
|
-
constructor(array: Tuple<T, N>, claimedLength: number);
|
|
8
|
-
static fromBuffer<T extends Serializable, N extends number>(buffer: Buffer | BufferReader, deserializer: {
|
|
9
|
-
fromBuffer: (reader: BufferReader) => T;
|
|
10
|
-
}, arrayLength: N): ClaimedLengthArray<T, N>;
|
|
11
|
-
toBuffer(): Buffer<ArrayBufferLike>;
|
|
12
|
-
static fromFields<T extends Serializable, N extends number>(fields: Fr[] | FieldReader, deserializer: {
|
|
13
|
-
fromFields: (reader: FieldReader) => T;
|
|
14
|
-
}, arrayLength: N): ClaimedLengthArray<T, N>;
|
|
15
|
-
toFields(): Fr[];
|
|
16
|
-
static empty<T extends Serializable, N extends number>(elem: {
|
|
17
|
-
empty: () => T;
|
|
18
|
-
}, arraySize: number): ClaimedLengthArray<T, N>;
|
|
19
|
-
isEmpty(): boolean;
|
|
20
|
-
getActiveItems(): T[];
|
|
21
|
-
getSize(): number;
|
|
22
|
-
[inspect.custom](): string;
|
|
23
|
-
}
|
|
24
|
-
export declare function ClaimedLengthArrayFromBuffer<T extends Serializable, N extends number>(deserializer: {
|
|
25
|
-
fromBuffer: (reader: BufferReader) => T;
|
|
26
|
-
}, arrayLength: N): {
|
|
27
|
-
fromBuffer: (reader: BufferReader) => ClaimedLengthArray<T, N>;
|
|
28
|
-
};
|
|
29
|
-
export declare function ClaimedLengthArrayFromFields<T extends Serializable, N extends number>(deserializer: {
|
|
30
|
-
fromFields: (reader: FieldReader) => T;
|
|
31
|
-
}, arrayLength: N): {
|
|
32
|
-
fromFields: (reader: FieldReader) => ClaimedLengthArray<T, N>;
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=claimed_length_array.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claimed_length_array.d.ts","sourceRoot":"","sources":["../../src/kernel/claimed_length_array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EACL,YAAY,EACZ,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,KAAK,EAGX,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,qBAAa,kBAAkB,CAAC,CAAC,SAAS,YAAY,EAAE,CAAC,SAAS,MAAM;IAE7D,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;IAElB,aAAa,EAAE,MAAM;gBAFrB,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAElB,aAAa,EAAE,MAAM;IAG9B,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,YAAY,EAAE,CAAC,SAAS,MAAM,EACxD,MAAM,EAAE,MAAM,GAAG,YAAY,EAC7B,YAAY,EAAE;QACZ,UAAU,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,CAAC,CAAC;KACzC,EACD,WAAW,EAAE,CAAC,GACb,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC;IAO3B,QAAQ;IAIR,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,YAAY,EAAE,CAAC,SAAS,MAAM,EACxD,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW,EAC1B,YAAY,EAAE;QACZ,UAAU,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,CAAC,CAAC;KACxC,EACD,WAAW,EAAE,CAAC,GACb,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC;IAO3B,QAAQ;IAIR,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,YAAY,EAAE,CAAC,SAAS,MAAM,EACnD,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC,CAAA;KAAE,EACxB,SAAS,EAAE,MAAM,GAChB,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC;IAK3B,OAAO;IAIP,cAAc,IAAI,CAAC,EAAE;IAIrB,OAAO;IAIP,CAAC,OAAO,CAAC,MAAM,CAAC;CAQjB;AAED,wBAAgB,4BAA4B,CAAC,CAAC,SAAS,YAAY,EAAE,CAAC,SAAS,MAAM,EACnF,YAAY,EAAE;IACZ,UAAU,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,CAAC,CAAC;CACzC,EACD,WAAW,EAAE,CAAC,GACb;IACD,UAAU,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAChE,CAEA;AAED,wBAAgB,4BAA4B,CAAC,CAAC,SAAS,YAAY,EAAE,CAAC,SAAS,MAAM,EACnF,YAAY,EAAE;IACZ,UAAU,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,CAAC,CAAC;CACxC,EACD,WAAW,EAAE,CAAC,GACb;IACD,UAAU,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAC/D,CAEA"}
|