@aztec/stdlib 4.0.0-nightly.20260112 → 4.0.0-nightly.20260114
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/utils.d.ts +7 -1
- package/dest/abi/utils.d.ts.map +1 -1
- package/dest/abi/utils.js +7 -0
- package/dest/avm/avm.d.ts +300 -300
- package/dest/block/attestation_info.d.ts +5 -5
- package/dest/block/attestation_info.d.ts.map +1 -1
- package/dest/block/attestation_info.js +4 -4
- package/dest/block/body.d.ts +1 -1
- package/dest/block/body.d.ts.map +1 -1
- package/dest/block/body.js +2 -1
- package/dest/block/checkpointed_l2_block.d.ts +1 -1
- package/dest/block/checkpointed_l2_block.d.ts.map +1 -1
- package/dest/block/checkpointed_l2_block.js +5 -4
- package/dest/block/l2_block.d.ts +6 -3
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +3 -3
- package/dest/block/l2_block_code_to_purge.d.ts +1 -1
- package/dest/block/l2_block_code_to_purge.d.ts.map +1 -1
- package/dest/block/l2_block_code_to_purge.js +1 -1
- package/dest/block/l2_block_header.d.ts +6 -2
- package/dest/block/l2_block_header.d.ts.map +1 -1
- package/dest/block/l2_block_header.js +14 -7
- package/dest/block/l2_block_new.d.ts +1 -2
- package/dest/block/l2_block_new.d.ts.map +1 -1
- package/dest/block/l2_block_new.js +4 -1
- package/dest/block/l2_block_source.d.ts +247 -42
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +23 -5
- package/dest/block/l2_block_stream/index.d.ts +2 -1
- package/dest/block/l2_block_stream/index.d.ts.map +1 -1
- package/dest/block/l2_block_stream/index.js +1 -0
- package/dest/block/l2_block_stream/interfaces.d.ts +16 -5
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +4 -2
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +102 -30
- package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts +24 -16
- package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_tips_memory_store.js +55 -61
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +49 -0
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -0
- package/dest/block/l2_block_stream/l2_tips_store_base.js +179 -0
- package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
- package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
- package/dest/block/test/l2_tips_store_test_suite.js +483 -38
- package/dest/block/validate_block_result.d.ts +24 -24
- package/dest/block/validate_block_result.d.ts.map +1 -1
- package/dest/block/validate_block_result.js +18 -17
- package/dest/checkpoint/checkpoint.d.ts +2 -1
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +11 -1
- package/dest/checkpoint/checkpoint_info.d.ts +32 -3
- package/dest/checkpoint/checkpoint_info.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint_info.js +34 -1
- package/dest/checkpoint/index.d.ts +2 -1
- package/dest/checkpoint/index.d.ts.map +1 -1
- package/dest/checkpoint/index.js +1 -0
- package/dest/checkpoint/published_checkpoint.d.ts +1 -1
- package/dest/checkpoint/published_checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/published_checkpoint.js +4 -3
- package/dest/contract/index.d.ts +1 -3
- package/dest/contract/index.d.ts.map +1 -1
- package/dest/contract/index.js +0 -2
- package/dest/deserialization/index.d.ts +11 -0
- package/dest/deserialization/index.d.ts.map +1 -0
- package/dest/deserialization/index.js +10 -0
- package/dest/interfaces/api_limit.d.ts +2 -1
- package/dest/interfaces/api_limit.d.ts.map +1 -1
- package/dest/interfaces/api_limit.js +1 -0
- package/dest/interfaces/archiver.d.ts +6 -6
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +6 -4
- package/dest/interfaces/aztec-node-admin.d.ts +12 -9
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +2 -2
- package/dest/interfaces/aztec-node.d.ts +2 -2
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +8 -3
- package/dest/interfaces/block-builder.d.ts +2 -2
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/configs.d.ts +6 -1
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +2 -1
- package/dest/interfaces/p2p.d.ts +7 -9
- package/dest/interfaces/p2p.d.ts.map +1 -1
- package/dest/interfaces/p2p.js +3 -4
- package/dest/interfaces/validator.d.ts +41 -15
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +3 -2
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts +6 -5
- 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 +5 -6
- package/dest/messaging/l2_to_l1_membership.d.ts +1 -1
- package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.js +5 -3
- package/dest/messaging/out_hash.d.ts +41 -4
- package/dest/messaging/out_hash.d.ts.map +1 -1
- package/dest/messaging/out_hash.js +52 -26
- package/dest/note/note_dao.d.ts +8 -5
- package/dest/note/note_dao.d.ts.map +1 -1
- package/dest/note/note_dao.js +15 -12
- package/dest/p2p/attestation_utils.d.ts +3 -3
- package/dest/p2p/attestation_utils.d.ts.map +1 -1
- package/dest/p2p/attestation_utils.js +1 -1
- package/dest/p2p/block_proposal.d.ts +85 -21
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +126 -38
- package/dest/p2p/checkpoint_attestation.d.ts +78 -0
- package/dest/p2p/checkpoint_attestation.d.ts.map +1 -0
- package/dest/p2p/{block_attestation.js → checkpoint_attestation.js} +22 -19
- package/dest/p2p/checkpoint_proposal.d.ts +155 -0
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -0
- package/dest/p2p/checkpoint_proposal.js +222 -0
- package/dest/p2p/consensus_payload.d.ts +5 -2
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.js +3 -2
- package/dest/p2p/index.d.ts +4 -2
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +3 -1
- package/dest/p2p/signature_utils.d.ts +5 -3
- package/dest/p2p/signature_utils.d.ts.map +1 -1
- package/dest/p2p/signature_utils.js +3 -1
- package/dest/p2p/signed_txs.d.ts +40 -0
- package/dest/p2p/signed_txs.d.ts.map +1 -0
- package/dest/p2p/signed_txs.js +75 -0
- package/dest/p2p/topic_type.d.ts +3 -2
- package/dest/p2p/topic_type.d.ts.map +1 -1
- package/dest/p2p/topic_type.js +8 -2
- package/dest/rollup/block_headers_hash.js +1 -1
- package/dest/rollup/block_rollup_public_inputs.d.ts +2 -2
- package/dest/rollup/block_rollup_public_inputs.js +2 -2
- package/dest/rollup/checkpoint_header.d.ts +16 -2
- package/dest/rollup/checkpoint_header.d.ts.map +1 -1
- package/dest/rollup/checkpoint_header.js +25 -5
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts +11 -6
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.js +10 -6
- package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts +14 -3
- package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_root_rollup_private_inputs.js +13 -2
- package/dest/rollup/root_rollup_public_inputs.d.ts +5 -2
- package/dest/rollup/root_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/root_rollup_public_inputs.js +4 -1
- package/dest/tests/factories.d.ts +13 -1
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +53 -3
- package/dest/tests/mocks.d.ts +55 -9
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +84 -35
- package/dest/tx/private_execution_result.d.ts +1 -5
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +3 -20
- package/dest/tx/tx_effect.d.ts +1 -6
- package/dest/tx/tx_effect.d.ts.map +1 -1
- package/dest/tx/tx_effect.js +0 -7
- package/package.json +9 -8
- package/src/abi/utils.ts +17 -0
- package/src/block/attestation_info.ts +9 -6
- package/src/block/body.ts +2 -1
- package/src/block/checkpointed_l2_block.ts +5 -4
- package/src/block/l2_block.ts +4 -3
- package/src/block/l2_block_code_to_purge.ts +1 -0
- package/src/block/l2_block_header.ts +13 -0
- package/src/block/l2_block_new.ts +5 -1
- package/src/block/l2_block_source.ts +69 -17
- package/src/block/l2_block_stream/index.ts +1 -0
- package/src/block/l2_block_stream/interfaces.ts +16 -4
- package/src/block/l2_block_stream/l2_block_stream.ts +121 -38
- package/src/block/l2_block_stream/l2_tips_memory_store.ts +62 -56
- package/src/block/l2_block_stream/l2_tips_store_base.ts +226 -0
- package/src/block/test/l2_tips_store_test_suite.ts +485 -36
- package/src/block/validate_block_result.ts +40 -35
- package/src/checkpoint/checkpoint.ts +12 -1
- package/src/checkpoint/checkpoint_info.ts +45 -2
- package/src/checkpoint/index.ts +1 -0
- package/src/checkpoint/published_checkpoint.ts +4 -3
- package/src/contract/index.ts +0 -2
- package/src/deserialization/index.ts +21 -0
- package/src/interfaces/api_limit.ts +1 -0
- package/src/interfaces/archiver.ts +14 -6
- package/src/interfaces/aztec-node-admin.ts +5 -2
- package/src/interfaces/aztec-node.ts +30 -3
- package/src/interfaces/block-builder.ts +1 -0
- package/src/interfaces/configs.ts +5 -0
- package/src/interfaces/p2p.ts +8 -12
- package/src/interfaces/validator.ts +57 -11
- package/src/kernel/hints/build_note_hash_read_request_hints.ts +5 -8
- package/src/messaging/l2_to_l1_membership.ts +5 -3
- package/src/messaging/out_hash.ts +60 -29
- package/src/note/note_dao.ts +18 -13
- package/src/p2p/attestation_utils.ts +3 -3
- package/src/p2p/block_proposal.ts +191 -42
- package/src/p2p/{block_attestation.ts → checkpoint_attestation.ts} +31 -25
- package/src/p2p/checkpoint_proposal.ts +342 -0
- package/src/p2p/consensus_payload.ts +5 -2
- package/src/p2p/index.ts +3 -1
- package/src/p2p/signature_utils.ts +3 -1
- package/src/p2p/signed_txs.ts +88 -0
- package/src/p2p/topic_type.ts +3 -2
- package/src/rollup/block_headers_hash.ts +1 -1
- package/src/rollup/block_rollup_public_inputs.ts +2 -2
- package/src/rollup/checkpoint_header.ts +33 -0
- package/src/rollup/checkpoint_rollup_public_inputs.ts +12 -6
- package/src/rollup/checkpoint_root_rollup_private_inputs.ts +14 -1
- package/src/rollup/root_rollup_public_inputs.ts +4 -1
- package/src/tests/factories.ts +46 -2
- package/src/tests/mocks.ts +146 -50
- package/src/tx/private_execution_result.ts +0 -15
- package/src/tx/tx_effect.ts +0 -9
- package/dest/contract/contract_class_metadata.d.ts +0 -8
- package/dest/contract/contract_class_metadata.d.ts.map +0 -1
- package/dest/contract/contract_class_metadata.js +0 -1
- package/dest/contract/contract_metadata.d.ts +0 -7
- package/dest/contract/contract_metadata.d.ts.map +0 -1
- package/dest/contract/contract_metadata.js +0 -1
- package/dest/p2p/block_attestation.d.ts +0 -77
- package/dest/p2p/block_attestation.d.ts.map +0 -1
- package/src/contract/contract_class_metadata.ts +0 -8
- package/src/contract/contract_metadata.ts +0 -7
|
@@ -7,9 +7,10 @@ export const ValidatorClientConfigSchema = zodFor()(z.object({
|
|
|
7
7
|
disabledValidators: z.array(schemas.EthAddress),
|
|
8
8
|
attestationPollingIntervalMs: z.number().min(0),
|
|
9
9
|
validatorReexecute: z.boolean(),
|
|
10
|
-
validatorReexecuteDeadlineMs: z.number().min(0),
|
|
11
10
|
alwaysReexecuteBlockProposals: z.boolean().optional(),
|
|
12
|
-
fishermanMode: z.boolean().optional()
|
|
11
|
+
fishermanMode: z.boolean().optional(),
|
|
12
|
+
skipCheckpointProposalValidation: z.boolean().optional(),
|
|
13
|
+
skipPushProposedBlocksToArchiver: z.boolean().optional()
|
|
13
14
|
}));
|
|
14
15
|
export const ValidatorClientFullConfigSchema = zodFor()(ValidatorClientConfigSchema.extend({
|
|
15
16
|
txPublicSetupAllowList: z.array(AllowedElementSchema).optional(),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type MAX_NOTE_HASHES_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, type NOTE_HASH_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
3
|
import type { MembershipWitness } from '@aztec/foundation/trees';
|
|
3
4
|
import type { ClaimedLengthArray } from '../claimed_length_array.js';
|
|
4
5
|
import type { ScopedNoteHash } from '../note_hash.js';
|
|
@@ -7,9 +8,9 @@ import { ReadRequestResetActions } from './read_request_hints.js';
|
|
|
7
8
|
export declare function isValidNoteHashReadRequest(readRequest: ScopedReadRequest, noteHash: ScopedNoteHash): boolean;
|
|
8
9
|
export declare function getNoteHashReadRequestResetActions(noteHashReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX>, noteHashes: ClaimedLengthArray<ScopedNoteHash, typeof MAX_NOTE_HASHES_PER_TX>, futureNoteHashes: ScopedNoteHash[]): ReadRequestResetActions<typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX>;
|
|
9
10
|
export declare function buildNoteHashReadRequestHintsFromResetActions<PENDING extends number, SETTLED extends number>(oracle: {
|
|
10
|
-
getNoteHashMembershipWitness(
|
|
11
|
-
}, noteHashReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX>, noteHashes: ClaimedLengthArray<ScopedNoteHash, typeof MAX_NOTE_HASHES_PER_TX>, resetActions: ReadRequestResetActions<typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX>,
|
|
11
|
+
getNoteHashMembershipWitness(noteHash: Fr): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT> | undefined>;
|
|
12
|
+
}, noteHashReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX>, noteHashes: ClaimedLengthArray<ScopedNoteHash, typeof MAX_NOTE_HASHES_PER_TX>, resetActions: ReadRequestResetActions<typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX>, maxPending?: PENDING, maxSettled?: SETTLED): Promise<import("./note_hash_read_request_hints.js").NoteHashReadRequestHints<PENDING, SETTLED>>;
|
|
12
13
|
export declare function buildNoteHashReadRequestHints<PENDING extends number, SETTLED extends number>(oracle: {
|
|
13
|
-
getNoteHashMembershipWitness(
|
|
14
|
-
}, noteHashReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX>, noteHashes: ClaimedLengthArray<ScopedNoteHash, typeof MAX_NOTE_HASHES_PER_TX>,
|
|
15
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
14
|
+
getNoteHashMembershipWitness(noteHash: Fr): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT>>;
|
|
15
|
+
}, noteHashReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX>, noteHashes: ClaimedLengthArray<ScopedNoteHash, typeof MAX_NOTE_HASHES_PER_TX>, futureNoteHashes: ScopedNoteHash[], maxPending?: PENDING, maxSettled?: SETTLED): Promise<import("./note_hash_read_request_hints.js").NoteHashReadRequestHints<PENDING, SETTLED>>;
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGRfbm90ZV9oYXNoX3JlYWRfcmVxdWVzdF9oaW50cy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2tl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ings":"AAAA,OAAO,EACL,KAAK,sBAAsB,EAC3B,kCAAkC,EAClC,KAAK,qBAAqB,EAC3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAA0C,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAG1G,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,iBAAiB,EAAE,QAAQ,EAAE,cAAc,WAMlG;AAED,wBAAgB,kCAAkC,CAChD,oBAAoB,EAAE,kBAAkB,CAAC,iBAAiB,EAAE,OAAO,kCAAkC,CAAC,EACtG,UAAU,EAAE,kBAAkB,CAAC,cAAc,EAAE,OAAO,sBAAsB,CAAC,EAC7E,gBAAgB,EAAE,cAAc,EAAE,GACjC,uBAAuB,CAAC,OAAO,kCAAkC,CAAC,CAiCpE;AAED,wBAAsB,6CAA6C,CAAC,OAAO,SAAS,MAAM,EAAE,OAAO,SAAS,MAAM,EAChH,MAAM,EAAE;IACN,4BAA4B,CAAC,
|
|
1
|
+
{"version":3,"file":"build_note_hash_read_request_hints.d.ts","sourceRoot":"","sources":["../../../src/kernel/hints/build_note_hash_read_request_hints.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,sBAAsB,EAC3B,kCAAkC,EAClC,KAAK,qBAAqB,EAC3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,cA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AE,OAAO,sBAAsB,CAAC,EAC7E,gBAAgB,EAAE,cAAc,EAAE,EAClC,UAAU,GAAE,OAAuD,EACnE,UAAU,GAAE,OAAuD,mGAWpE"}
|
|
@@ -30,7 +30,7 @@ export function getNoteHashReadRequestResetActions(noteHashReadRequests, noteHas
|
|
|
30
30
|
}
|
|
31
31
|
return resetActions;
|
|
32
32
|
}
|
|
33
|
-
export async function buildNoteHashReadRequestHintsFromResetActions(oracle, noteHashReadRequests, noteHashes, resetActions,
|
|
33
|
+
export async function buildNoteHashReadRequestHintsFromResetActions(oracle, noteHashReadRequests, noteHashes, resetActions, maxPending = MAX_NOTE_HASH_READ_REQUESTS_PER_TX, maxSettled = MAX_NOTE_HASH_READ_REQUESTS_PER_TX) {
|
|
34
34
|
const builder = new NoteHashReadRequestHintsBuilder(maxPending, maxSettled);
|
|
35
35
|
resetActions.pendingReadHints.forEach((hint)=>{
|
|
36
36
|
builder.addPendingReadRequest(hint.readRequestIndex, hint.pendingValueIndex);
|
|
@@ -38,11 +38,10 @@ export async function buildNoteHashReadRequestHintsFromResetActions(oracle, note
|
|
|
38
38
|
for(let i = 0; i < resetActions.actions.length; i++){
|
|
39
39
|
if (resetActions.actions[i] === ReadRequestActionEnum.READ_AS_SETTLED) {
|
|
40
40
|
const readRequest = noteHashReadRequests.array[i];
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
41
|
+
const membershipWitness = await oracle.getNoteHashMembershipWitness(readRequest.value);
|
|
42
|
+
if (!membershipWitness) {
|
|
43
43
|
throw new Error('Read request is reading an unknown note hash.');
|
|
44
44
|
}
|
|
45
|
-
const membershipWitness = await oracle.getNoteHashMembershipWitness(leafIndex);
|
|
46
45
|
builder.addSettledReadRequest(i, membershipWitness, readRequest.value);
|
|
47
46
|
}
|
|
48
47
|
}
|
|
@@ -58,7 +57,7 @@ export async function buildNoteHashReadRequestHintsFromResetActions(oracle, note
|
|
|
58
57
|
});
|
|
59
58
|
return builder.toHints();
|
|
60
59
|
}
|
|
61
|
-
export async function buildNoteHashReadRequestHints(oracle, noteHashReadRequests, noteHashes,
|
|
60
|
+
export async function buildNoteHashReadRequestHints(oracle, noteHashReadRequests, noteHashes, futureNoteHashes, maxPending = MAX_NOTE_HASH_READ_REQUESTS_PER_TX, maxSettled = MAX_NOTE_HASH_READ_REQUESTS_PER_TX) {
|
|
62
61
|
const resetActions = getNoteHashReadRequestResetActions(noteHashReadRequests, noteHashes, futureNoteHashes);
|
|
63
|
-
return await buildNoteHashReadRequestHintsFromResetActions(oracle, noteHashReadRequests, noteHashes, resetActions,
|
|
62
|
+
return await buildNoteHashReadRequestHintsFromResetActions(oracle, noteHashReadRequests, noteHashes, resetActions, maxPending, maxSettled);
|
|
64
63
|
}
|
|
@@ -94,4 +94,4 @@ export type L2ToL1MembershipWitness = {
|
|
|
94
94
|
};
|
|
95
95
|
export declare function computeL2ToL1MembershipWitness(messageRetriever: MessageRetrieval, epoch: EpochNumber, message: Fr): Promise<L2ToL1MembershipWitness | undefined>;
|
|
96
96
|
export declare function computeL2ToL1MembershipWitnessFromMessagesInEpoch(messagesInEpoch: Fr[][][][], message: Fr): L2ToL1MembershipWitness;
|
|
97
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
97
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibDJfdG9fbDFfbWVtYmVyc2hpcC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL21lc3NhZ2luZy9sMl90b19sMV9tZW1iZXJzaGlwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ25FLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNwRCxPQUFPLEVBQUUsV0FBVyxFQUE0RCxNQUFNLHlCQUF5QixDQUFDO0FBRWhIO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;;;;;;;;;;;;;;;;;;;;GAwEG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,iBAAiB,EAAE,IAAI,CAAC,uBAAuB,EAAE,WAAW,GAAG,aAAa,CAAC,GAC5E,MAAM,CAER;AAED,MAAM,WAAW,gBAAgB;IAC/B,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;CAC5D;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,EAAE,CAAC;IACT,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAClC,CAAC;AAEF,wBAAsB,8BAA8B,CAClD,gBAAgB,EAAE,gBAAgB,EAClC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,EAAE,GACV,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC,CAO9C;AAID,wBAAgB,iDAAiD,CAC/D,eAAe,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAC3B,OAAO,EAAE,EAAE,GACV,uBAAuB,CAqFzB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OUT_HASH_TREE_LEAF_COUNT } from '@aztec/constants';
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import { SiblingPath, UnbalancedMerkleTreeCalculator, computeUnbalancedShaRoot } from '@aztec/foundation/trees';
|
|
4
4
|
/**
|
|
@@ -133,9 +133,11 @@ export function computeL2ToL1MembershipWitnessFromMessagesInEpoch(messagesInEpoc
|
|
|
133
133
|
});
|
|
134
134
|
// Pad to AZTEC_MAX_EPOCH_DURATION with zeros.
|
|
135
135
|
checkpointOutHashes = checkpointOutHashes.concat(Array.from({
|
|
136
|
-
length:
|
|
136
|
+
length: OUT_HASH_TREE_LEAF_COUNT - messagesInEpoch.length
|
|
137
137
|
}, ()=>Buffer.alloc(32)));
|
|
138
|
-
// Build the epoch tree with all the checkpoint out hashes, including the padded zeros
|
|
138
|
+
// Build the epoch tree with all the checkpoint out hashes, including the padded zeros.
|
|
139
|
+
// Note: The epoch tree is actually a balanced tree, but we use an unbalanced tree calculator here to avoid turning
|
|
140
|
+
// this function into async.
|
|
139
141
|
const epochTree = UnbalancedMerkleTreeCalculator.create(checkpointOutHashes);
|
|
140
142
|
// Get the sibling path of the checkpoint out hash in the epoch tree.
|
|
141
143
|
const pathToCheckpointOutHashInEpochTree = epochTree.getSiblingPathByLeafIndex(checkpointIndex);
|
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
/**
|
|
3
|
+
* Computes the out hash of a tx. It's the root of the unbalanced tree of all the L2-to-L1 messages emitted by the tx.
|
|
4
|
+
* @param messages - The L2-to-L1 messages emitted by the tx.
|
|
5
|
+
* @returns The out hash of the tx.
|
|
6
|
+
*/
|
|
2
7
|
export declare function computeTxOutHash(messages: Fr[]): Fr;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Computes the out hash of a block. It's the root of the wonky tree of all the tx out hashes.
|
|
10
|
+
* @param messagesPerTx - The L2-to-L1 messages emitted by the txs in the block. This is an array of message arrays.
|
|
11
|
+
* The array at index 0 contains the messages emitted by the first tx, the array at index 1 contains the messages
|
|
12
|
+
* emitted by the second tx, and so on.
|
|
13
|
+
* @returns The out hash of the block.
|
|
14
|
+
*/
|
|
15
|
+
export declare function computeBlockOutHash(messagesPerTx: Fr[][]): Fr;
|
|
16
|
+
/**
|
|
17
|
+
* Computes the out hash of a checkpoint. It's the root of the wonky tree of all the block out hashes.
|
|
18
|
+
* @param messagesPerBlock - The L2-to-L1 messages emitted by the txs in the blocks in the checkpoint. This is an array
|
|
19
|
+
* of arrays of messages. The array at index 0 contains the arrays of messages emitted by the first block, the array at
|
|
20
|
+
* index 1 contains the arrays of messages emitted by the second block, and so on.
|
|
21
|
+
* @returns The out hash of the checkpoint.
|
|
22
|
+
*/
|
|
23
|
+
export declare function computeCheckpointOutHash(messagesPerBlock: Fr[][][]): Fr;
|
|
24
|
+
/**
|
|
25
|
+
* Computes the accumulated (epoch) out hash of a checkpoint. It's the root of the balanced tree of all the out hashes
|
|
26
|
+
* from the first checkpoint in an epoch to the current checkpoint.
|
|
27
|
+
* It's this value that's set to the checkpoint header and validated on L1 instead of the checkpoint out hash.
|
|
28
|
+
* @param checkpointOutHashes - The out hashes of all checkpoints in the epoch.
|
|
29
|
+
* @returns The accumulated (epoch) out hash.
|
|
30
|
+
*/
|
|
31
|
+
export declare function accumulateCheckpointOutHashes(checkpointOutHashes: Fr[]): Fr;
|
|
32
|
+
/**
|
|
33
|
+
* Computes the epoch out hash. It's the root of the balanced tree of all the checkpoint out hashes.
|
|
34
|
+
* It should match the **accumulated** out hash of the last checkpoint in the epoch.
|
|
35
|
+
* This value will be inserted into the Outbox on L1.
|
|
36
|
+
* @param messagesPerCheckpoint - The L2-to-L1 messages emitted by the txs in the blocks in the checkpoints in the epoch.
|
|
37
|
+
* This is an array of arrays of arrays of messages. The array at index 0 contains the arrays of arrays of messages
|
|
38
|
+
* emitted by the first checkpoint, the array at index 1 contains the arrays of arrays of messages emitted by the second
|
|
39
|
+
* checkpoint, and so on.
|
|
40
|
+
* @returns The epoch out hash.
|
|
41
|
+
*/
|
|
42
|
+
export declare function computeEpochOutHash(messagesPerCheckpoint: Fr[][][][]): Fr;
|
|
43
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3V0X2hhc2guZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9tZXNzYWdpbmcvb3V0X2hhc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBR3BEOzs7O0dBSUc7QUFDSCx3QkFBZ0IsZ0JBQWdCLENBQUMsUUFBUSxFQUFFLEVBQUUsRUFBRSxHQUFHLEVBQUUsQ0FPbkQ7QUFFRDs7Ozs7O0dBTUc7QUFDSCx3QkFBZ0IsbUJBQW1CLENBQUMsYUFBYSxFQUFFLEVBQUUsRUFBRSxFQUFFLEdBQUcsRUFBRSxDQUk3RDtBQUVEOzs7Ozs7R0FNRztBQUNILHdCQUFnQix3QkFBd0IsQ0FBQyxnQkFBZ0IsRUFBRSxFQUFFLEVBQUUsRUFBRSxFQUFFLEdBQUcsRUFBRSxDQUl2RTtBQUVEOzs7Ozs7R0FNRztBQUNILHdCQUFnQiw2QkFBNkIsQ0FBQyxtQkFBbUIsRUFBRSxFQUFFLEVBQUUsR0FBRyxFQUFFLENBUTNFO0FBRUQ7Ozs7Ozs7OztHQVNHO0FBQ0gsd0JBQWdCLG1CQUFtQixDQUFDLHFCQUFxQixFQUFFLEVBQUUsRUFBRSxFQUFFLEVBQUUsRUFBRSxHQUFHLEVBQUUsQ0FJekUifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"out_hash.d.ts","sourceRoot":"","sources":["../../src/messaging/out_hash.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAGpD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,EAAE,EAAE,GAAG,EAAE,CAOnD;AAED,wBAAgB,mBAAmB,CAAC,
|
|
1
|
+
{"version":3,"file":"out_hash.d.ts","sourceRoot":"","sources":["../../src/messaging/out_hash.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAGpD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,EAAE,EAAE,GAAG,EAAE,CAOnD;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAI7D;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,gBAAgB,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAIvE;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,mBAAmB,EAAE,EAAE,EAAE,GAAG,EAAE,CAQ3E;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,qBAAqB,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAIzE"}
|
|
@@ -1,37 +1,63 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OUT_HASH_TREE_LEAF_COUNT } from '@aztec/constants';
|
|
2
2
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
3
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { computeBalancedShaRoot, computeUnbalancedShaRoot, computeWonkyShaRoot } from '@aztec/foundation/trees';
|
|
5
|
+
/**
|
|
6
|
+
* Computes the out hash of a tx. It's the root of the unbalanced tree of all the L2-to-L1 messages emitted by the tx.
|
|
7
|
+
* @param messages - The L2-to-L1 messages emitted by the tx.
|
|
8
|
+
* @returns The out hash of the tx.
|
|
9
|
+
*/ export function computeTxOutHash(messages) {
|
|
10
|
+
// Must match the implementation in `tx_base_public_inputs_composer.nr > compute_kernel_out_hash()`
|
|
6
11
|
if (!messages.length) {
|
|
7
12
|
return Fr.ZERO;
|
|
8
13
|
}
|
|
9
|
-
//
|
|
10
|
-
// Zero hashes (which should not happen) are not compressed.
|
|
14
|
+
// It's an unbalanced tree because zero hashes (which should not happen) will be included.
|
|
11
15
|
return Fr.fromBuffer(computeUnbalancedShaRoot(messages.map((msg)=>msg.toBuffer())));
|
|
12
16
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Computes the out hash of a block. It's the root of the wonky tree of all the tx out hashes.
|
|
19
|
+
* @param messagesPerTx - The L2-to-L1 messages emitted by the txs in the block. This is an array of message arrays.
|
|
20
|
+
* The array at index 0 contains the messages emitted by the first tx, the array at index 1 contains the messages
|
|
21
|
+
* emitted by the second tx, and so on.
|
|
22
|
+
* @returns The out hash of the block.
|
|
23
|
+
*/ export function computeBlockOutHash(messagesPerTx) {
|
|
24
|
+
// See how the tx out hashes are aggregated into a block out hash in `merge_tx_rollups.nr > accumulate_out_hash()`.
|
|
25
|
+
const txOutHashes = messagesPerTx.map((messages)=>computeTxOutHash(messages));
|
|
26
|
+
return Fr.fromBuffer(computeWonkyShaRoot(txOutHashes.map((hash)=>hash.toBuffer())));
|
|
16
27
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Computes the out hash of a checkpoint. It's the root of the wonky tree of all the block out hashes.
|
|
30
|
+
* @param messagesPerBlock - The L2-to-L1 messages emitted by the txs in the blocks in the checkpoint. This is an array
|
|
31
|
+
* of arrays of messages. The array at index 0 contains the arrays of messages emitted by the first block, the array at
|
|
32
|
+
* index 1 contains the arrays of messages emitted by the second block, and so on.
|
|
33
|
+
* @returns The out hash of the checkpoint.
|
|
34
|
+
*/ export function computeCheckpointOutHash(messagesPerBlock) {
|
|
35
|
+
// See how the block out hashes are aggregated into a checkpoint out hash in `merge_block_rollups.nr > accumulate_out_hash()`.
|
|
36
|
+
const blockOutHashes = messagesPerBlock.map((block)=>computeBlockOutHash(block));
|
|
37
|
+
return Fr.fromBuffer(computeWonkyShaRoot(blockOutHashes.map((hash)=>hash.toBuffer())));
|
|
20
38
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Computes the accumulated (epoch) out hash of a checkpoint. It's the root of the balanced tree of all the out hashes
|
|
41
|
+
* from the first checkpoint in an epoch to the current checkpoint.
|
|
42
|
+
* It's this value that's set to the checkpoint header and validated on L1 instead of the checkpoint out hash.
|
|
43
|
+
* @param checkpointOutHashes - The out hashes of all checkpoints in the epoch.
|
|
44
|
+
* @returns The accumulated (epoch) out hash.
|
|
45
|
+
*/ export function accumulateCheckpointOutHashes(checkpointOutHashes) {
|
|
46
|
+
// See how the checkpoint out hashes are accumulated in `checkpoint_rollup_public_inputs_composer.nr > accumulate_checkpoint_out_hash()`.
|
|
47
|
+
const paddedOutHashes = padArrayEnd(checkpointOutHashes.map((hash)=>hash.toBuffer()), Buffer.alloc(32), OUT_HASH_TREE_LEAF_COUNT);
|
|
48
|
+
return Fr.fromBuffer(computeBalancedShaRoot(paddedOutHashes));
|
|
29
49
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Computes the epoch out hash. It's the root of the balanced tree of all the checkpoint out hashes.
|
|
52
|
+
* It should match the **accumulated** out hash of the last checkpoint in the epoch.
|
|
53
|
+
* This value will be inserted into the Outbox on L1.
|
|
54
|
+
* @param messagesPerCheckpoint - The L2-to-L1 messages emitted by the txs in the blocks in the checkpoints in the epoch.
|
|
55
|
+
* This is an array of arrays of arrays of messages. The array at index 0 contains the arrays of arrays of messages
|
|
56
|
+
* emitted by the first checkpoint, the array at index 1 contains the arrays of arrays of messages emitted by the second
|
|
57
|
+
* checkpoint, and so on.
|
|
58
|
+
* @returns The epoch out hash.
|
|
59
|
+
*/ export function computeEpochOutHash(messagesPerCheckpoint) {
|
|
60
|
+
// See how the accumulated out hash is assigned to the root rollup's public inputs in `root_rollup.nr`.
|
|
61
|
+
const checkpointOutHashes = messagesPerCheckpoint.map((checkpoint)=>computeCheckpointOutHash(checkpoint));
|
|
62
|
+
return accumulateCheckpointOutHashes(checkpointOutHashes);
|
|
37
63
|
}
|
package/dest/note/note_dao.d.ts
CHANGED
|
@@ -20,7 +20,8 @@ export declare class NoteDao {
|
|
|
20
20
|
txHash: TxHash;
|
|
21
21
|
l2BlockNumber: BlockNumber;
|
|
22
22
|
l2BlockHash: string;
|
|
23
|
-
|
|
23
|
+
txIndexInBlock: number;
|
|
24
|
+
noteIndexInTx: number;
|
|
24
25
|
constructor(
|
|
25
26
|
/** The packed content of the note, as will be returned in the getNotes oracle. */
|
|
26
27
|
note: Note,
|
|
@@ -59,8 +60,10 @@ export declare class NoteDao {
|
|
|
59
60
|
/** The L2 block hash in which the tx with this note was included. Used for note management while processing
|
|
60
61
|
* reorgs.*/
|
|
61
62
|
l2BlockHash: string,
|
|
62
|
-
/** The index of the
|
|
63
|
-
|
|
63
|
+
/** The index of the tx within the block, used for ordering notes. */
|
|
64
|
+
txIndexInBlock: number,
|
|
65
|
+
/** The index of the note within the tx (based on note hash position), used for ordering notes. */
|
|
66
|
+
noteIndexInTx: number);
|
|
64
67
|
toBuffer(): Buffer;
|
|
65
68
|
static fromBuffer(buffer: Buffer | BufferReader): NoteDao;
|
|
66
69
|
toString(): string;
|
|
@@ -74,6 +77,6 @@ export declare class NoteDao {
|
|
|
74
77
|
* @returns - Its size in bytes.
|
|
75
78
|
*/
|
|
76
79
|
getSize(): number;
|
|
77
|
-
static random({ note, contractAddress, owner, storageSlot, randomness, noteNonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash,
|
|
80
|
+
static random({ note, contractAddress, owner, storageSlot, randomness, noteNonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, txIndexInBlock, noteIndexInTx }?: Partial<NoteDao>): Promise<NoteDao>;
|
|
78
81
|
}
|
|
79
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
82
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm90ZV9kYW8uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ub3RlL25vdGVfZGFvLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBL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QUFFLEVBQUU7SUFDbkI7OztPQUdHO0lBQ0ksZUFBZSxFQUFFLEVBQUU7SUFHMUI7O09BRUc7SUFDSSxNQUFNLEVBQUUsTUFBTTtJQUNyQjtnQkFDWTtJQUNMLGFBQWEsRUFBRSxXQUFXO0lBQ2pDO2dCQUNZO0lBQ0wsV0FBVyxFQUFFLE1BQU07SUFDMUIscUVBQXFFO0lBQzlELGNBQWMsRUFBRSxNQUFNO0lBQzdCLGtHQUFrRztJQUMzRixhQUFhLEVBQUUsTUFBTSxFQUMxQjtJQUVKLFFBQVEsSUFBSSxNQUFNLENBZ0JqQjtJQUVELE1BQU0sQ0FBQyxVQUFVLENBQUMsTUFBTSxFQUFFLE1BQU0sR0FBRyxZQUFZLFdBZ0M5QztJQUVELFFBQVEsV0FFUDtJQUVELE1BQU0sQ0FBQyxVQUFVLENBQUMsR0FBRyxFQUFFLE1BQU0sV0FHNUI7SUFFRDs7T0FFRztJQUNILE1BQU0sQ0FBQyxLQUFLLEVBQUUsT0FBTyxHQUFHLE9BQU8sQ0FnQjlCO0lBRUQ7OztPQUdHO0lBQ0ksT0FBTyxXQUliO0lBRUQsT0FBYSxNQUFNLENBQUMsRUFDbEIsSUFBb0IsRUFDcEIsZUFBMkIsRUFDM0IsS0FBaUIsRUFDakIsV0FBeUIsRUFDekIsVUFBd0IsRUFDeEIsU0FBdUIsRUFDdkIsUUFBc0IsRUFDdEIsZUFBNkIsRUFDN0IsTUFBd0IsRUFDeEIsYUFBNkQsRUFDN0QsV0FBb0MsRUFDcEMsY0FBZ0QsRUFDaEQsYUFBK0MsRUFDaEQsR0FBRSxPQUFPLENBQUMsT0FBTyxDQUFNLG9CQWdCdkI7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"note_dao.d.ts","sourceRoot":"","sources":["../../src/note/note_dao.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"note_dao.d.ts","sourceRoot":"","sources":["../../src/note/note_dao.ts"],"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AM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,WAgC9C;IAED,QAAQ,WAEP;IAED,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,WAG5B;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAgB9B;IAED;;;OAGG;IACI,OAAO,WAIb;IAED,OAAa,MAAM,CAAC,EAClB,IAAoB,EACpB,eAA2B,EAC3B,KAAiB,EACjB,WAAyB,EACzB,UAAwB,EACxB,SAAuB,EACvB,QAAsB,EACtB,eAA6B,EAC7B,MAAwB,EACxB,aAA6D,EAC7D,WAAoC,EACpC,cAAgD,EAChD,aAA+C,EAChD,GAAE,OAAO,CAAC,OAAO,CAAM,oBAgBvB;CACF"}
|
package/dest/note/note_dao.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { toBigIntBE } from '@aztec/foundation/bigint-buffer';
|
|
2
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
3
|
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
@@ -21,7 +20,8 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
21
20
|
txHash;
|
|
22
21
|
l2BlockNumber;
|
|
23
22
|
l2BlockHash;
|
|
24
|
-
|
|
23
|
+
txIndexInBlock;
|
|
24
|
+
noteIndexInTx;
|
|
25
25
|
constructor(// Note information
|
|
26
26
|
/** The packed content of the note, as will be returned in the getNotes oracle. */ note, /** The address of the contract that created the note (i.e. the address used by the kernel during siloing). */ contractAddress, /** The owner of the note - generally the account that can spend the note. */ owner, /**
|
|
27
27
|
* The storage location of the note. This value is not used for anything in PXE, but we do index by storage slot
|
|
@@ -40,7 +40,7 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
40
40
|
* when searching for txEffects.
|
|
41
41
|
*/ txHash, /** The L2 block number in which the tx with this note was included. Used for note management while processing
|
|
42
42
|
* reorgs.*/ l2BlockNumber, /** The L2 block hash in which the tx with this note was included. Used for note management while processing
|
|
43
|
-
* reorgs.*/ l2BlockHash, /** The index of the
|
|
43
|
+
* reorgs.*/ l2BlockHash, /** The index of the tx within the block, used for ordering notes. */ txIndexInBlock, /** The index of the note within the tx (based on note hash position), used for ordering notes. */ noteIndexInTx){
|
|
44
44
|
this.note = note;
|
|
45
45
|
this.contractAddress = contractAddress;
|
|
46
46
|
this.owner = owner;
|
|
@@ -52,7 +52,8 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
52
52
|
this.txHash = txHash;
|
|
53
53
|
this.l2BlockNumber = l2BlockNumber;
|
|
54
54
|
this.l2BlockHash = l2BlockHash;
|
|
55
|
-
this.
|
|
55
|
+
this.txIndexInBlock = txIndexInBlock;
|
|
56
|
+
this.noteIndexInTx = noteIndexInTx;
|
|
56
57
|
}
|
|
57
58
|
toBuffer() {
|
|
58
59
|
return serializeToBuffer([
|
|
@@ -67,7 +68,8 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
67
68
|
this.txHash,
|
|
68
69
|
this.l2BlockNumber,
|
|
69
70
|
Fr.fromHexString(this.l2BlockHash),
|
|
70
|
-
this.
|
|
71
|
+
this.txIndexInBlock,
|
|
72
|
+
this.noteIndexInTx
|
|
71
73
|
]);
|
|
72
74
|
}
|
|
73
75
|
static fromBuffer(buffer) {
|
|
@@ -83,8 +85,9 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
83
85
|
const txHash = reader.readObject(TxHash);
|
|
84
86
|
const l2BlockNumber = BlockNumber(reader.readNumber());
|
|
85
87
|
const l2BlockHash = Fr.fromBuffer(reader).toString();
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
+
const txIndexInBlock = reader.readNumber();
|
|
89
|
+
const noteIndexInTx = reader.readNumber();
|
|
90
|
+
return new NoteDao(note, contractAddress, owner, storageSlot, randomness, noteNonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, txIndexInBlock, noteIndexInTx);
|
|
88
91
|
}
|
|
89
92
|
toString() {
|
|
90
93
|
return '0x' + this.toBuffer().toString('hex');
|
|
@@ -96,17 +99,17 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
96
99
|
/**
|
|
97
100
|
* Returns true if this note is equal to the `other` one.
|
|
98
101
|
*/ equals(other) {
|
|
99
|
-
return this.note.equals(other.note) && this.contractAddress.equals(other.contractAddress) && this.owner.equals(other.owner) && this.storageSlot.equals(other.storageSlot) && this.randomness.equals(other.randomness) && this.noteNonce.equals(other.noteNonce) && this.noteHash.equals(other.noteHash) && this.siloedNullifier.equals(other.siloedNullifier) && this.txHash.equals(other.txHash) && this.l2BlockNumber === other.l2BlockNumber && this.l2BlockHash === other.l2BlockHash && this.
|
|
102
|
+
return this.note.equals(other.note) && this.contractAddress.equals(other.contractAddress) && this.owner.equals(other.owner) && this.storageSlot.equals(other.storageSlot) && this.randomness.equals(other.randomness) && this.noteNonce.equals(other.noteNonce) && this.noteHash.equals(other.noteHash) && this.siloedNullifier.equals(other.siloedNullifier) && this.txHash.equals(other.txHash) && this.l2BlockNumber === other.l2BlockNumber && this.l2BlockHash === other.l2BlockHash && this.txIndexInBlock === other.txIndexInBlock && this.noteIndexInTx === other.noteIndexInTx;
|
|
100
103
|
}
|
|
101
104
|
/**
|
|
102
105
|
* Returns the size in bytes of the Note Dao.
|
|
103
106
|
* @returns - Its size in bytes.
|
|
104
107
|
*/ getSize() {
|
|
105
|
-
const indexSize = Math.ceil(Math.log2(Number(this.index)));
|
|
106
108
|
const noteSize = 4 + this.note.items.length * Fr.SIZE_IN_BYTES;
|
|
107
|
-
|
|
109
|
+
// 2 numbers for txIndexInBlock and noteIndexInTx (4 bytes each)
|
|
110
|
+
return noteSize + AztecAddress.SIZE_IN_BYTES * 2 + Fr.SIZE_IN_BYTES * 4 + TxHash.SIZE + Point.SIZE_IN_BYTES + 8;
|
|
108
111
|
}
|
|
109
|
-
static async random({ note = Note.random(), contractAddress = undefined, owner = undefined, storageSlot = Fr.random(), randomness = Fr.random(), noteNonce = Fr.random(), noteHash = Fr.random(), siloedNullifier = Fr.random(), txHash = TxHash.random(), l2BlockNumber = BlockNumber(Math.floor(Math.random() * 1000)), l2BlockHash = Fr.random().toString(),
|
|
110
|
-
return new NoteDao(note, contractAddress ?? await AztecAddress.random(), owner ?? await AztecAddress.random(), storageSlot, randomness, noteNonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash,
|
|
112
|
+
static async random({ note = Note.random(), contractAddress = undefined, owner = undefined, storageSlot = Fr.random(), randomness = Fr.random(), noteNonce = Fr.random(), noteHash = Fr.random(), siloedNullifier = Fr.random(), txHash = TxHash.random(), l2BlockNumber = BlockNumber(Math.floor(Math.random() * 1000)), l2BlockHash = Fr.random().toString(), txIndexInBlock = Math.floor(Math.random() * 100), noteIndexInTx = Math.floor(Math.random() * 100) } = {}) {
|
|
113
|
+
return new NoteDao(note, contractAddress ?? await AztecAddress.random(), owner ?? await AztecAddress.random(), storageSlot, randomness, noteNonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, txIndexInBlock, noteIndexInTx);
|
|
111
114
|
}
|
|
112
115
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
2
|
import { CommitteeAttestation } from '../block/index.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { CheckpointAttestation } from './checkpoint_attestation.js';
|
|
4
4
|
/**
|
|
5
5
|
* Returns attestation signatures in the order of a series of provided ethereum addresses
|
|
6
6
|
* The rollup smart contract expects attestations to appear in the order of the committee
|
|
7
7
|
* @todo: perform this logic within the memory attestation store instead?
|
|
8
8
|
*/
|
|
9
|
-
export declare function orderAttestations(attestations:
|
|
10
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
9
|
+
export declare function orderAttestations(attestations: CheckpointAttestation[], orderAddresses: EthAddress[]): CommitteeAttestation[];
|
|
10
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXR0ZXN0YXRpb25fdXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wMnAvYXR0ZXN0YXRpb25fdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFFaEUsT0FBTyxFQUFFLG9CQUFvQixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFDekQsT0FBTyxLQUFLLEVBQUUscUJBQXFCLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUV6RTs7OztHQUlHO0FBQ0gsd0JBQWdCLGlCQUFpQixDQUMvQixZQUFZLEVBQUUscUJBQXFCLEVBQUUsRUFDckMsY0FBYyxFQUFFLFVBQVUsRUFBRSxHQUMzQixvQkFBb0IsRUFBRSxDQXFCeEIifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attestation_utils.d.ts","sourceRoot":"","sources":["../../src/p2p/attestation_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"attestation_utils.d.ts","sourceRoot":"","sources":["../../src/p2p/attestation_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,qBAAqB,EAAE,EACrC,cAAc,EAAE,UAAU,EAAE,GAC3B,oBAAoB,EAAE,CAqBxB"}
|
|
@@ -4,7 +4,7 @@ import { CommitteeAttestation } from '../block/index.js';
|
|
|
4
4
|
* The rollup smart contract expects attestations to appear in the order of the committee
|
|
5
5
|
* @todo: perform this logic within the memory attestation store instead?
|
|
6
6
|
*/ export function orderAttestations(attestations, orderAddresses) {
|
|
7
|
-
// Create a map of sender addresses to
|
|
7
|
+
// Create a map of sender addresses to attestations
|
|
8
8
|
const attestationMap = new Map();
|
|
9
9
|
for (const attestation of attestations){
|
|
10
10
|
const sender = attestation.getSender();
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
1
|
+
import { BlockNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
3
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
4
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
5
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
6
6
|
import { BufferReader } from '@aztec/foundation/serialize';
|
|
7
|
+
import type { L2Block } from '../block/l2_block.js';
|
|
7
8
|
import type { L2BlockInfo } from '../block/l2_block_info.js';
|
|
9
|
+
import { BlockHeader } from '../tx/block_header.js';
|
|
8
10
|
import { TxHash } from '../tx/index.js';
|
|
9
|
-
import { Tx } from '../tx/tx.js';
|
|
10
|
-
import { ConsensusPayload } from './consensus_payload.js';
|
|
11
|
+
import type { Tx } from '../tx/tx.js';
|
|
11
12
|
import { Gossipable } from './gossipable.js';
|
|
13
|
+
import { SignatureDomainSeparator } from './signature_utils.js';
|
|
14
|
+
import { SignedTxs } from './signed_txs.js';
|
|
12
15
|
import { TopicType } from './topic_type.js';
|
|
13
16
|
export declare class BlockProposalHash extends Buffer32 {
|
|
14
17
|
constructor(hash: Buffer);
|
|
@@ -19,40 +22,101 @@ export type BlockProposalOptions = {
|
|
|
19
22
|
broadcastInvalidBlockProposal?: boolean;
|
|
20
23
|
};
|
|
21
24
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* be included in the head of the chain
|
|
25
|
+
* A block proposal is created by the leader of the chain proposing a sequence of transactions
|
|
26
|
+
* to be included in a block within a checkpoint. This is used for non-last blocks in a slot.
|
|
27
|
+
* The last block is sent as part of a CheckpointProposal.
|
|
26
28
|
*/
|
|
27
29
|
export declare class BlockProposal extends Gossipable {
|
|
28
|
-
readonly
|
|
29
|
-
readonly
|
|
30
|
+
readonly blockHeader: BlockHeader;
|
|
31
|
+
readonly indexWithinCheckpoint: number;
|
|
32
|
+
readonly inHash: Fr;
|
|
33
|
+
readonly archiveRoot: Fr;
|
|
30
34
|
readonly txHashes: TxHash[];
|
|
31
|
-
readonly
|
|
35
|
+
readonly signature: Signature;
|
|
36
|
+
readonly signedTxs?: SignedTxs | undefined;
|
|
32
37
|
static p2pTopic: TopicType;
|
|
33
38
|
private sender;
|
|
34
39
|
constructor(
|
|
35
|
-
/** The
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
|
|
40
|
+
/** The per-block header containing block state and global variables */
|
|
41
|
+
blockHeader: BlockHeader,
|
|
42
|
+
/** Index of this block within the checkpoint (0-indexed) */
|
|
43
|
+
indexWithinCheckpoint: number,
|
|
44
|
+
/** Hash of L1 to L2 messages for this checkpoint (constant across all blocks in checkpoint) */
|
|
45
|
+
inHash: Fr,
|
|
46
|
+
/** Archive root after this block is applied */
|
|
47
|
+
archiveRoot: Fr,
|
|
39
48
|
/** The sequence of transactions in the block */
|
|
40
49
|
txHashes: TxHash[],
|
|
41
|
-
/** The
|
|
42
|
-
|
|
50
|
+
/** The proposer's signature over the block data */
|
|
51
|
+
signature: Signature,
|
|
52
|
+
/** The signed transactions in the block (optional, for DA guarantees) */
|
|
53
|
+
signedTxs?: SignedTxs | undefined);
|
|
43
54
|
generateP2PMessageIdentifier(): Promise<Buffer32>;
|
|
44
55
|
get archive(): Fr;
|
|
45
56
|
get slotNumber(): SlotNumber;
|
|
57
|
+
get blockNumber(): BlockNumber;
|
|
58
|
+
/** Convenience getter for txs from signedTxs */
|
|
59
|
+
get txs(): Tx[] | undefined;
|
|
46
60
|
toBlockInfo(): Omit<L2BlockInfo, 'blockNumber'>;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*
|
|
50
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Get the payload to sign for this block proposal.
|
|
63
|
+
* The signature is over: blockHeader + indexWithinCheckpoint + inHash + archiveRoot + txHashes
|
|
64
|
+
*/
|
|
65
|
+
getPayloadToSign(domainSeparator: SignatureDomainSeparator): Buffer;
|
|
66
|
+
static createProposalFromSigner(blockHeader: BlockHeader, indexWithinCheckpoint: number, inHash: Fr, archiveRoot: Fr, txHashes: TxHash[], txs: Tx[] | undefined, payloadSigner: (payload: Buffer32) => Promise<Signature>): Promise<BlockProposal>;
|
|
67
|
+
/**
|
|
68
|
+
* Lazily evaluate the sender of the proposal; result is cached.
|
|
69
|
+
* If there's signedTxs, also verifies the signedTxs sender matches the block proposal sender.
|
|
70
|
+
* @returns The sender address, or undefined if signature recovery fails or senders don't match
|
|
51
71
|
*/
|
|
52
72
|
getSender(): EthAddress | undefined;
|
|
53
73
|
getPayload(): Buffer<ArrayBufferLike>;
|
|
54
74
|
toBuffer(): Buffer;
|
|
55
75
|
static fromBuffer(buf: Buffer | BufferReader): BlockProposal;
|
|
56
76
|
getSize(): number;
|
|
77
|
+
static empty(): BlockProposal;
|
|
78
|
+
static random(): BlockProposal;
|
|
79
|
+
toInspect(): {
|
|
80
|
+
blockHeader: {
|
|
81
|
+
lastArchive: `0x${string}`;
|
|
82
|
+
state: {
|
|
83
|
+
l1ToL2MessageTree: `0x${string}`;
|
|
84
|
+
noteHashTree: `0x${string}`;
|
|
85
|
+
nullifierTree: `0x${string}`;
|
|
86
|
+
publicDataTree: `0x${string}`;
|
|
87
|
+
};
|
|
88
|
+
spongeBlobHash: bigint;
|
|
89
|
+
globalVariables: {
|
|
90
|
+
chainId: number;
|
|
91
|
+
version: number;
|
|
92
|
+
blockNumber: BlockNumber;
|
|
93
|
+
slotNumber: SlotNumber;
|
|
94
|
+
timestamp: bigint;
|
|
95
|
+
coinbase: `0x${string}`;
|
|
96
|
+
feeRecipient: `0x${string}`;
|
|
97
|
+
feePerDaGas: number;
|
|
98
|
+
feePerL2Gas: number;
|
|
99
|
+
};
|
|
100
|
+
totalFees: bigint;
|
|
101
|
+
totalManaUsed: bigint;
|
|
102
|
+
};
|
|
103
|
+
indexWithinCheckpoint: number;
|
|
104
|
+
inHash: `0x${string}`;
|
|
105
|
+
archiveRoot: `0x${string}`;
|
|
106
|
+
signature: `0x${string}`;
|
|
107
|
+
txHashes: `0x${string}`[];
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Check if this proposal matches the given block.
|
|
111
|
+
* Compares the archive root and block header.
|
|
112
|
+
* @param block - The L2Block to compare against
|
|
113
|
+
* @returns True if the proposal matches the block
|
|
114
|
+
*/
|
|
115
|
+
matchesBlock(block: L2Block): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Returns a copy of this proposal without signedTxs.
|
|
118
|
+
* Used when storing proposals in attestation pool to avoid storing full tx data.
|
|
119
|
+
*/
|
|
120
|
+
withoutSignedTxs(): BlockProposal;
|
|
57
121
|
}
|
|
58
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
122
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxvY2tfcHJvcG9zYWwuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wMnAvYmxvY2tfcHJvcG9zYWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFdBQVcsRUFBRSxVQUFVLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUMxRSxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sMEJBQTBCL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