@aztec/stdlib 5.0.0-rc.2 → 5.0.0
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/block/attestation_info.d.ts +1 -1
- package/dest/block/attestation_info.d.ts.map +1 -1
- package/dest/block/attestation_info.js +7 -4
- package/dest/block/l2_block_source.d.ts +34 -3
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +15 -0
- package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts +39 -0
- package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts.map +1 -0
- package/dest/block/l2_block_stream/event_driven_l2_block_stream.js +165 -0
- 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 -2
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/interfaces.js +25 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +21 -35
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +5 -30
- package/dest/block/proposal/attestations_and_signers.d.ts +19 -1
- package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -1
- package/dest/block/proposal/attestations_and_signers.js +47 -7
- package/dest/block/validate_block_result.d.ts +16 -1
- package/dest/block/validate_block_result.d.ts.map +1 -1
- package/dest/block/validate_block_result.js +18 -3
- package/dest/config/network-consensus-config.d.ts +1 -1
- package/dest/config/network-consensus-config.d.ts.map +1 -1
- package/dest/config/network-consensus-config.js +2 -10
- package/dest/contract/contract_address.d.ts +5 -4
- package/dest/contract/contract_address.d.ts.map +1 -1
- package/dest/contract/contract_instance.d.ts +16 -2
- package/dest/contract/contract_instance.d.ts.map +1 -1
- package/dest/contract/contract_instance.js +45 -0
- package/dest/contract/interfaces/contract_instance.d.ts +71 -10
- package/dest/contract/interfaces/contract_instance.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_instance.js +7 -2
- package/dest/contract/partial_address.d.ts +9 -3
- package/dest/contract/partial_address.d.ts.map +1 -1
- package/dest/contract/partial_address.js +8 -2
- package/dest/database-version/version_manager.d.ts +18 -4
- package/dest/database-version/version_manager.d.ts.map +1 -1
- package/dest/database-version/version_manager.js +76 -6
- package/dest/ha-signing/config.d.ts +19 -5
- package/dest/ha-signing/config.d.ts.map +1 -1
- package/dest/ha-signing/config.js +9 -3
- package/dest/ha-signing/local_config.d.ts +10 -2
- package/dest/ha-signing/local_config.d.ts.map +1 -1
- package/dest/ha-signing/local_config.js +8 -2
- package/dest/hash/hash.d.ts +1 -2
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +0 -7
- package/dest/interfaces/archiver.d.ts +8 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +2 -1
- package/dest/interfaces/aztec-node-admin.d.ts +5 -2
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/configs.d.ts +4 -1
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +1 -0
- package/dest/interfaces/private_kernel_prover.d.ts +9 -11
- package/dest/interfaces/private_kernel_prover.d.ts.map +1 -1
- package/dest/interfaces/proving-job.d.ts +87 -74
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/proving-job.js +13 -4
- package/dest/interfaces/server_circuit_prover.d.ts +3 -3
- package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +7 -3
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/world_state.d.ts +14 -1
- package/dest/interfaces/world_state.d.ts.map +1 -1
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts +8 -2
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts.map +1 -1
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.js +12 -74
- package/dest/kernel/index.d.ts +2 -2
- package/dest/kernel/index.d.ts.map +1 -1
- package/dest/kernel/index.js +1 -1
- package/dest/kernel/private_circuit_public_inputs.d.ts +13 -3
- package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_circuit_public_inputs.js +14 -7
- package/dest/kernel/private_context_inputs.d.ts +4 -3
- package/dest/kernel/private_context_inputs.d.ts.map +1 -1
- package/dest/kernel/private_context_inputs.js +7 -3
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +7 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.js +7 -0
- package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts +2 -3
- package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_init_2_circuit_private_inputs.js +3 -5
- package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts +2 -3
- package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_init_3_circuit_private_inputs.js +3 -5
- package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts +1 -9
- package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_init_circuit_private_inputs.js +2 -6
- package/dest/kernel/private_kernel_reset_dimensions.d.ts +7 -8
- package/dest/kernel/private_kernel_reset_dimensions.d.ts.map +1 -1
- package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts +29 -0
- package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.js +36 -0
- package/dest/keys/derivation.d.ts +41 -6
- package/dest/keys/derivation.d.ts.map +1 -1
- package/dest/keys/derivation.js +49 -26
- package/dest/logs/app_tagging_secret.d.ts +16 -8
- package/dest/logs/app_tagging_secret.d.ts.map +1 -1
- package/dest/logs/app_tagging_secret.js +24 -27
- package/dest/logs/index.d.ts +1 -3
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +0 -2
- package/dest/logs/shared_secret_derivation.d.ts +19 -6
- package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
- package/dest/logs/shared_secret_derivation.js +26 -11
- package/dest/messaging/l1_to_l2_message.d.ts +23 -2
- package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
- package/dest/messaging/l1_to_l2_message.js +36 -11
- package/dest/p2p/attestation_utils.d.ts +1 -1
- package/dest/p2p/attestation_utils.d.ts.map +1 -1
- package/dest/p2p/attestation_utils.js +8 -1
- package/dest/p2p/checkpoint_attestation.d.ts +9 -1
- package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
- package/dest/p2p/checkpoint_attestation.js +10 -0
- package/dest/p2p/signature_utils.d.ts +10 -1
- package/dest/p2p/signature_utils.d.ts.map +1 -1
- package/dest/p2p/signature_utils.js +9 -1
- package/dest/rollup/avm_proof_data.d.ts +3 -3
- package/dest/rollup/avm_proof_data.d.ts.map +1 -1
- package/dest/stats/stats.d.ts +2 -2
- package/dest/stats/stats.d.ts.map +1 -1
- package/dest/tests/factories.d.ts +1 -1
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +4 -3
- package/dest/tx/private_tx_constant_data.d.ts +18 -2
- package/dest/tx/private_tx_constant_data.d.ts.map +1 -1
- package/dest/tx/private_tx_constant_data.js +13 -4
- package/dest/tx/simulated_tx.d.ts +10 -6
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/world-state/genesis_data.d.ts +9 -1
- package/dest/world-state/genesis_data.d.ts.map +1 -1
- package/dest/world-state/genesis_data.js +1 -0
- package/package.json +8 -8
- package/src/block/attestation_info.ts +7 -2
- package/src/block/l2_block_source.ts +54 -2
- package/src/block/l2_block_stream/event_driven_l2_block_stream.ts +207 -0
- package/src/block/l2_block_stream/index.ts +1 -0
- package/src/block/l2_block_stream/interfaces.ts +35 -1
- package/src/block/l2_block_stream/l2_block_stream.ts +35 -62
- package/src/block/proposal/attestations_and_signers.ts +53 -7
- package/src/block/validate_block_result.ts +48 -2
- package/src/config/network-consensus-config.ts +2 -13
- package/src/contract/contract_address.ts +4 -3
- package/src/contract/contract_instance.ts +62 -1
- package/src/contract/interfaces/contract_instance.ts +26 -8
- package/src/contract/partial_address.ts +8 -2
- package/src/database-version/version_manager.ts +96 -6
- package/src/ha-signing/config.ts +23 -5
- package/src/ha-signing/local_config.ts +20 -1
- package/src/hash/hash.ts +0 -8
- package/src/interfaces/archiver.ts +8 -0
- package/src/interfaces/configs.ts +3 -0
- package/src/interfaces/private_kernel_prover.ts +10 -12
- package/src/interfaces/proving-job.ts +15 -3
- package/src/interfaces/server_circuit_prover.ts +2 -2
- package/src/interfaces/world_state.ts +14 -0
- package/src/kernel/hints/find_private_kernel_reset_dimensions.ts +22 -112
- package/src/kernel/index.ts +1 -1
- package/src/kernel/private_circuit_public_inputs.ts +12 -1
- package/src/kernel/private_context_inputs.ts +10 -3
- package/src/kernel/private_kernel_circuit_public_inputs.ts +9 -0
- package/src/kernel/private_kernel_init_2_circuit_private_inputs.ts +0 -3
- package/src/kernel/private_kernel_init_3_circuit_private_inputs.ts +0 -3
- package/src/kernel/private_kernel_init_circuit_private_inputs.ts +0 -6
- package/src/kernel/private_kernel_reset_dimensions.ts +15 -5
- package/src/kernel/private_kernel_reset_tail_circuit_private_inputs.ts +69 -0
- package/src/keys/derivation.ts +69 -24
- package/src/logs/app_tagging_secret.ts +34 -27
- package/src/logs/index.ts +0 -2
- package/src/logs/shared_secret_derivation.ts +31 -15
- package/src/messaging/l1_to_l2_message.ts +51 -13
- package/src/p2p/attestation_utils.ts +8 -1
- package/src/p2p/checkpoint_attestation.ts +12 -0
- package/src/p2p/signature_utils.ts +9 -0
- package/src/rollup/avm_proof_data.ts +2 -2
- package/src/stats/stats.ts +2 -2
- package/src/tests/factories.ts +3 -6
- package/src/tx/private_tx_constant_data.ts +25 -2
- package/src/world-state/genesis_data.ts +10 -0
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +0 -47
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +0 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +0 -38
- package/dest/logs/message_context.d.ts +0 -17
- package/dest/logs/message_context.d.ts.map +0 -1
- package/dest/logs/message_context.js +0 -9
- package/dest/logs/pending_tagged_log.d.ts +0 -11
- package/dest/logs/pending_tagged_log.d.ts.map +0 -1
- package/dest/logs/pending_tagged_log.js +0 -4
- package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +0 -58
- package/src/logs/message_context.ts +0 -18
- package/src/logs/pending_tagged_log.ts +0 -12
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { isDefined } from '@aztec/foundation/types';
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
2
|
PrivateKernelResetDimensions,
|
|
5
3
|
type PrivateKernelResetDimensionsConfig,
|
|
4
|
+
type ResetCatalogEntry,
|
|
6
5
|
privateKernelResetDimensionNames,
|
|
7
6
|
} from '../private_kernel_reset_dimensions.js';
|
|
8
7
|
|
|
@@ -12,13 +11,6 @@ interface DimensionOption {
|
|
|
12
11
|
remainder?: PrivateKernelResetDimensions;
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
function computeCost(dimensions: PrivateKernelResetDimensions, config: PrivateKernelResetDimensionsConfig) {
|
|
16
|
-
return privateKernelResetDimensionNames.reduce(
|
|
17
|
-
(accum, name) => accum + dimensions[name] * config.dimensions[name].cost,
|
|
18
|
-
0,
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
14
|
function getSize(dimensions: PrivateKernelResetDimensions) {
|
|
23
15
|
return privateKernelResetDimensionNames.reduce((accum, name) => accum + dimensions[name], 0);
|
|
24
16
|
}
|
|
@@ -38,124 +30,42 @@ function getRemainder(
|
|
|
38
30
|
return remainingDimensions ? remainder : undefined;
|
|
39
31
|
}
|
|
40
32
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// If no such value is found, returns the max value.
|
|
49
|
-
return minGte ?? Math.max(...values);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function pickCheapest(options: DimensionOption[]) {
|
|
53
|
-
return options.reduce((prev, curr) => (curr.cost < prev.cost ? curr : prev), options[0]);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function pickSmallestRemainder(options: DimensionOption[]) {
|
|
57
|
-
const optionsWithSize = options
|
|
58
|
-
.filter(o => o.remainder)
|
|
59
|
-
.map(option => ({ option, size: getSize(option.remainder!) }));
|
|
60
|
-
return optionsWithSize.reduce((prev, curr) => (curr.size < prev.size ? curr : prev), optionsWithSize[0])?.option;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function pickBestOption(options: DimensionOption[]) {
|
|
64
|
-
const optionsResetAll = options.filter(opt => !opt.remainder);
|
|
65
|
-
const optionsResetPartial = options.filter(opt => opt.remainder);
|
|
66
|
-
// The best option is the cheapest one that can reset all dimensions.
|
|
67
|
-
// If no such option exists, find one that can reset the most data.
|
|
68
|
-
return pickCheapest(optionsResetAll) || pickSmallestRemainder(optionsResetPartial);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function findVariant(
|
|
72
|
-
requestedDimensions: PrivateKernelResetDimensions,
|
|
73
|
-
config: PrivateKernelResetDimensionsConfig,
|
|
74
|
-
isQualified: (dimensions: PrivateKernelResetDimensions) => boolean,
|
|
75
|
-
): DimensionOption | undefined {
|
|
76
|
-
const variant = PrivateKernelResetDimensions.empty();
|
|
77
|
-
privateKernelResetDimensionNames.forEach(name => {
|
|
78
|
-
variant[name] = pickFromValues(requestedDimensions[name], config.dimensions[name].variants);
|
|
79
|
-
});
|
|
80
|
-
if (!isQualified(variant)) {
|
|
81
|
-
return;
|
|
33
|
+
// Returns the cheapest option that fully covers the request, or the option with the smallest
|
|
34
|
+
// remainder if none do. Caller must pass a non-empty list.
|
|
35
|
+
function pickBestOption(options: DimensionOption[]): DimensionOption {
|
|
36
|
+
const fullCoverage = options.filter(opt => !opt.remainder);
|
|
37
|
+
if (fullCoverage.length) {
|
|
38
|
+
return fullCoverage.reduce((prev, curr) => (curr.cost < prev.cost ? curr : prev));
|
|
82
39
|
}
|
|
83
|
-
|
|
84
|
-
return {
|
|
85
|
-
dimensions: variant,
|
|
86
|
-
cost: computeCost(variant, config),
|
|
87
|
-
remainder: getRemainder(requestedDimensions, variant),
|
|
88
|
-
};
|
|
40
|
+
return options.reduce((prev, curr) => (getSize(curr.remainder!) < getSize(prev.remainder!) ? curr : prev));
|
|
89
41
|
}
|
|
90
42
|
|
|
91
|
-
function
|
|
92
|
-
|
|
93
|
-
config: PrivateKernelResetDimensionsConfig,
|
|
94
|
-
isQualified: (dimensions: PrivateKernelResetDimensions) => boolean,
|
|
95
|
-
): DimensionOption | undefined {
|
|
96
|
-
const needsReset = privateKernelResetDimensionNames.filter(name => requestedDimensions[name] > 0);
|
|
97
|
-
if (needsReset.length !== 1) {
|
|
98
|
-
// At the moment, we only use standalone to reset one dimension when it's about to overflow.
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const name = needsReset[0];
|
|
103
|
-
const value = pickFromValues(requestedDimensions[name], config.dimensions[name].standalone);
|
|
104
|
-
if (!value) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const dimensions = PrivateKernelResetDimensions.from({ [name]: value });
|
|
109
|
-
if (!isQualified(dimensions)) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
|
|
43
|
+
function buildOption(entry: ResetCatalogEntry, requestedDimensions: PrivateKernelResetDimensions): DimensionOption {
|
|
44
|
+
const dimensions = PrivateKernelResetDimensions.fromValues(entry.dimensions);
|
|
113
45
|
return {
|
|
114
46
|
dimensions,
|
|
115
|
-
cost:
|
|
47
|
+
cost: entry.cost,
|
|
116
48
|
remainder: getRemainder(requestedDimensions, dimensions),
|
|
117
49
|
};
|
|
118
50
|
}
|
|
119
51
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const options = specialCases.filter(isQualified).map(dimensions => ({
|
|
127
|
-
dimensions,
|
|
128
|
-
cost: computeCost(dimensions, config),
|
|
129
|
-
remainder: getRemainder(requestedDimensions, dimensions),
|
|
130
|
-
}));
|
|
131
|
-
return pickBestOption(options);
|
|
132
|
-
}
|
|
52
|
+
/**
|
|
53
|
+
* Picks which catalog group the selector should search. Mid-tx resets go to `inner` (no
|
|
54
|
+
* siloing); terminal kernels go to `finalTail` or `finalTailToPublic`, depending on whether
|
|
55
|
+
* the tx has public function calls.
|
|
56
|
+
*/
|
|
57
|
+
export type ResetDimensionsMode = 'inner' | 'finalTail' | 'finalTailToPublic';
|
|
133
58
|
|
|
134
59
|
export function findPrivateKernelResetDimensions(
|
|
135
60
|
requestedDimensions: PrivateKernelResetDimensions,
|
|
136
61
|
config: PrivateKernelResetDimensionsConfig,
|
|
137
|
-
|
|
62
|
+
mode: ResetDimensionsMode,
|
|
138
63
|
allowRemainder = false,
|
|
139
64
|
) {
|
|
140
|
-
const
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const isQualified = !isInner
|
|
146
|
-
? isEnough
|
|
147
|
-
: // If isInner is true, it's a reset to prevent overflow. The following must be zero because siloing can't be done at the moment.
|
|
148
|
-
(dimensions: PrivateKernelResetDimensions) =>
|
|
149
|
-
dimensions.NOTE_HASH_SILOING === 0 &&
|
|
150
|
-
dimensions.NULLIFIER_SILOING === 0 &&
|
|
151
|
-
dimensions.PRIVATE_LOG_SILOING === 0 &&
|
|
152
|
-
isEnough(dimensions);
|
|
153
|
-
|
|
154
|
-
const options = [
|
|
155
|
-
findVariant(requestedDimensions, config, isQualified),
|
|
156
|
-
findStandalone(requestedDimensions, config, isQualified),
|
|
157
|
-
findSpecialCase(requestedDimensions, config, isQualified),
|
|
158
|
-
].filter(isDefined);
|
|
65
|
+
const catalog = config[mode];
|
|
66
|
+
const options = catalog
|
|
67
|
+
.map(entry => buildOption(entry, requestedDimensions))
|
|
68
|
+
.filter(option => allowRemainder || !option.remainder);
|
|
159
69
|
|
|
160
70
|
if (!options.length) {
|
|
161
71
|
throw new Error(`Cannot find an option for dimension: ${requestedDimensions.toValues()}`);
|
package/src/kernel/index.ts
CHANGED
|
@@ -14,7 +14,7 @@ export * from './private_kernel_inner_2_circuit_private_inputs.js';
|
|
|
14
14
|
export * from './private_kernel_inner_3_circuit_private_inputs.js';
|
|
15
15
|
export * from './private_kernel_reset_circuit_private_inputs.js';
|
|
16
16
|
export * from './private_kernel_reset_dimensions.js';
|
|
17
|
-
export * from './
|
|
17
|
+
export * from './private_kernel_reset_tail_circuit_private_inputs.js';
|
|
18
18
|
export * from './private_kernel_tail_circuit_public_inputs.js';
|
|
19
19
|
export * from './private_to_avm_accumulated_data.js';
|
|
20
20
|
export * from './private_to_public_accumulated_data.js';
|
|
@@ -144,6 +144,11 @@ export class PrivateCircuitPublicInputs {
|
|
|
144
144
|
* Hash of the contract class logs emitted in this function call.
|
|
145
145
|
*/
|
|
146
146
|
public contractClassLogsHashes: ClaimedLengthArray<CountedLogHash, typeof MAX_CONTRACT_CLASS_LOGS_PER_CALL>,
|
|
147
|
+
/**
|
|
148
|
+
* The tx request's salt. Keeps `tx_request.hash()` (the protocol nullifier) unpredictable, and lets the init
|
|
149
|
+
* kernel bind this proof to a specific tx request (it asserts this equals `tx_request.salt`).
|
|
150
|
+
*/
|
|
151
|
+
public txRequestSalt: Fr,
|
|
147
152
|
) {}
|
|
148
153
|
|
|
149
154
|
/**
|
|
@@ -188,6 +193,7 @@ export class PrivateCircuitPublicInputs {
|
|
|
188
193
|
reader.readObject(ClaimedLengthArrayFromBuffer(CountedL2ToL1Message, MAX_L2_TO_L1_MSGS_PER_CALL)),
|
|
189
194
|
reader.readObject(ClaimedLengthArrayFromBuffer(PrivateLogData, MAX_PRIVATE_LOGS_PER_CALL)),
|
|
190
195
|
reader.readObject(ClaimedLengthArrayFromBuffer(CountedLogHash, MAX_CONTRACT_CLASS_LOGS_PER_CALL)),
|
|
196
|
+
reader.readObject(Fr),
|
|
191
197
|
);
|
|
192
198
|
}
|
|
193
199
|
|
|
@@ -219,6 +225,7 @@ export class PrivateCircuitPublicInputs {
|
|
|
219
225
|
reader.readObject(ClaimedLengthArrayFromFields(CountedL2ToL1Message, MAX_L2_TO_L1_MSGS_PER_CALL)),
|
|
220
226
|
reader.readObject(ClaimedLengthArrayFromFields(PrivateLogData, MAX_PRIVATE_LOGS_PER_CALL)),
|
|
221
227
|
reader.readObject(ClaimedLengthArrayFromFields(CountedLogHash, MAX_CONTRACT_CLASS_LOGS_PER_CALL)),
|
|
228
|
+
reader.readField(),
|
|
222
229
|
);
|
|
223
230
|
}
|
|
224
231
|
|
|
@@ -251,6 +258,7 @@ export class PrivateCircuitPublicInputs {
|
|
|
251
258
|
ClaimedLengthArray.empty(CountedL2ToL1Message, MAX_L2_TO_L1_MSGS_PER_CALL),
|
|
252
259
|
ClaimedLengthArray.empty(PrivateLogData, MAX_PRIVATE_LOGS_PER_CALL),
|
|
253
260
|
ClaimedLengthArray.empty(CountedLogHash, MAX_CONTRACT_CLASS_LOGS_PER_CALL),
|
|
261
|
+
Fr.ZERO,
|
|
254
262
|
);
|
|
255
263
|
}
|
|
256
264
|
|
|
@@ -278,7 +286,8 @@ export class PrivateCircuitPublicInputs {
|
|
|
278
286
|
this.nullifiers.isEmpty() &&
|
|
279
287
|
this.l2ToL1Msgs.isEmpty() &&
|
|
280
288
|
this.privateLogs.isEmpty() &&
|
|
281
|
-
this.contractClassLogsHashes.isEmpty()
|
|
289
|
+
this.contractClassLogsHashes.isEmpty() &&
|
|
290
|
+
this.txRequestSalt.isZero()
|
|
282
291
|
);
|
|
283
292
|
}
|
|
284
293
|
|
|
@@ -312,6 +321,7 @@ export class PrivateCircuitPublicInputs {
|
|
|
312
321
|
fields.l2ToL1Msgs,
|
|
313
322
|
fields.privateLogs,
|
|
314
323
|
fields.contractClassLogsHashes,
|
|
324
|
+
fields.txRequestSalt,
|
|
315
325
|
] as const;
|
|
316
326
|
}
|
|
317
327
|
|
|
@@ -346,6 +356,7 @@ export class PrivateCircuitPublicInputs {
|
|
|
346
356
|
this.l2ToL1Msgs,
|
|
347
357
|
this.privateLogs,
|
|
348
358
|
this.contractClassLogsHashes,
|
|
359
|
+
this.txRequestSalt,
|
|
349
360
|
]);
|
|
350
361
|
}
|
|
351
362
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { serializeToFields } from '@aztec/foundation/serialize';
|
|
3
3
|
|
|
4
4
|
import { BlockHeader } from '../tx/block_header.js';
|
|
@@ -11,13 +11,20 @@ export class PrivateContextInputs {
|
|
|
11
11
|
public anchorBlockHeader: BlockHeader,
|
|
12
12
|
public txContext: TxContext,
|
|
13
13
|
public startSideEffectCounter: number,
|
|
14
|
+
public txRequestSalt: Fr,
|
|
14
15
|
) {}
|
|
15
16
|
|
|
16
17
|
public static empty(): PrivateContextInputs {
|
|
17
|
-
return new PrivateContextInputs(CallContext.empty(), BlockHeader.empty(), TxContext.empty(), 0);
|
|
18
|
+
return new PrivateContextInputs(CallContext.empty(), BlockHeader.empty(), TxContext.empty(), 0, Fr.ZERO);
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
public toFields(): Fr[] {
|
|
21
|
-
return serializeToFields([
|
|
22
|
+
return serializeToFields([
|
|
23
|
+
this.callContext,
|
|
24
|
+
this.anchorBlockHeader,
|
|
25
|
+
this.txContext,
|
|
26
|
+
this.startSideEffectCounter,
|
|
27
|
+
this.txRequestSalt,
|
|
28
|
+
]);
|
|
22
29
|
}
|
|
23
30
|
}
|
|
@@ -115,3 +115,12 @@ export class PrivateKernelCircuitPublicInputs {
|
|
|
115
115
|
);
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Returns true iff the tx requires the public-bound terminal path: it has either un-processed
|
|
121
|
+
* public-call requests in the side-effect stream or a pending public-teardown call request. Every
|
|
122
|
+
* site picking between the rollup-bound and public-bound terminal artifact must route through this.
|
|
123
|
+
*/
|
|
124
|
+
export function kernelStateIsForPublic(publicInputs: PrivateKernelCircuitPublicInputs): boolean {
|
|
125
|
+
return publicInputs.end.publicCallRequests.claimedLength > 0 || !publicInputs.publicTeardownCallRequest.isEmpty();
|
|
126
|
+
}
|
|
@@ -17,7 +17,6 @@ export class PrivateKernelInit2CircuitPrivateInputs {
|
|
|
17
17
|
public privateCall0: PrivateCallData,
|
|
18
18
|
public privateCall1: PrivateCallData,
|
|
19
19
|
public isPrivateOnly: boolean,
|
|
20
|
-
public firstNullifierHint: Fr,
|
|
21
20
|
public revertibleCounterHint: number,
|
|
22
21
|
) {}
|
|
23
22
|
|
|
@@ -28,7 +27,6 @@ export class PrivateKernelInit2CircuitPrivateInputs {
|
|
|
28
27
|
this.protocolContracts,
|
|
29
28
|
this.privateCall0,
|
|
30
29
|
this.privateCall1,
|
|
31
|
-
this.firstNullifierHint,
|
|
32
30
|
this.revertibleCounterHint,
|
|
33
31
|
);
|
|
34
32
|
}
|
|
@@ -42,7 +40,6 @@ export class PrivateKernelInit2CircuitPrivateInputs {
|
|
|
42
40
|
reader.readObject(PrivateCallData),
|
|
43
41
|
reader.readObject(PrivateCallData),
|
|
44
42
|
reader.readBoolean(),
|
|
45
|
-
Fr.fromBuffer(reader),
|
|
46
43
|
reader.readNumber(),
|
|
47
44
|
);
|
|
48
45
|
}
|
|
@@ -18,7 +18,6 @@ export class PrivateKernelInit3CircuitPrivateInputs {
|
|
|
18
18
|
public privateCall1: PrivateCallData,
|
|
19
19
|
public privateCall2: PrivateCallData,
|
|
20
20
|
public isPrivateOnly: boolean,
|
|
21
|
-
public firstNullifierHint: Fr,
|
|
22
21
|
public revertibleCounterHint: number,
|
|
23
22
|
) {}
|
|
24
23
|
|
|
@@ -30,7 +29,6 @@ export class PrivateKernelInit3CircuitPrivateInputs {
|
|
|
30
29
|
this.privateCall0,
|
|
31
30
|
this.privateCall1,
|
|
32
31
|
this.privateCall2,
|
|
33
|
-
this.firstNullifierHint,
|
|
34
32
|
this.revertibleCounterHint,
|
|
35
33
|
);
|
|
36
34
|
}
|
|
@@ -45,7 +43,6 @@ export class PrivateKernelInit3CircuitPrivateInputs {
|
|
|
45
43
|
reader.readObject(PrivateCallData),
|
|
46
44
|
reader.readObject(PrivateCallData),
|
|
47
45
|
reader.readBoolean(),
|
|
48
|
-
Fr.fromBuffer(reader),
|
|
49
46
|
reader.readNumber(),
|
|
50
47
|
);
|
|
51
48
|
}
|
|
@@ -30,10 +30,6 @@ export class PrivateKernelInitCircuitPrivateInputs {
|
|
|
30
30
|
* Wether this tx will make public calls or not.
|
|
31
31
|
*/
|
|
32
32
|
public isPrivateOnly: boolean,
|
|
33
|
-
/**
|
|
34
|
-
* A hint to what will be the first nullifier of the transaction, used for nonce generation.
|
|
35
|
-
*/
|
|
36
|
-
public firstNullifierHint: Fr,
|
|
37
33
|
/**
|
|
38
34
|
* A claim to the final min revertible side effect counter of a tx.
|
|
39
35
|
*/
|
|
@@ -50,7 +46,6 @@ export class PrivateKernelInitCircuitPrivateInputs {
|
|
|
50
46
|
this.vkTreeRoot,
|
|
51
47
|
this.protocolContracts,
|
|
52
48
|
this.privateCall,
|
|
53
|
-
this.firstNullifierHint,
|
|
54
49
|
this.revertibleCounterHint,
|
|
55
50
|
);
|
|
56
51
|
}
|
|
@@ -68,7 +63,6 @@ export class PrivateKernelInitCircuitPrivateInputs {
|
|
|
68
63
|
reader.readObject(ProtocolContracts),
|
|
69
64
|
reader.readObject(PrivateCallData),
|
|
70
65
|
reader.readBoolean(),
|
|
71
|
-
Fr.fromBuffer(reader),
|
|
72
66
|
reader.readNumber(),
|
|
73
67
|
);
|
|
74
68
|
}
|
|
@@ -68,14 +68,24 @@ export const privateKernelResetDimensionNames: DimensionName[] = [
|
|
|
68
68
|
'PRIVATE_LOG_SILOING',
|
|
69
69
|
];
|
|
70
70
|
|
|
71
|
-
export interface
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
export interface ResetCatalogEntry {
|
|
72
|
+
name: string;
|
|
73
|
+
dimensions: number[];
|
|
74
|
+
// Measured gate count (circuit_size) of the compiled variant. Used by the selector to pick the
|
|
75
|
+
// cheapest variant that covers the requested dimensions, e.g. if the required dimensions are
|
|
76
|
+
// `6 - 2 - 2` then a variant with capacity `8 - 2 - 2` might be cheaper than one with capacity
|
|
77
|
+
// `6 - 4 - 4`.
|
|
74
78
|
cost: number;
|
|
75
79
|
}
|
|
76
80
|
|
|
77
81
|
// Must match the config in noir-projects/noir-protocol-circuits/private_kernel_reset_config.json
|
|
78
82
|
export interface PrivateKernelResetDimensionsConfig {
|
|
79
|
-
|
|
80
|
-
|
|
83
|
+
// Variants used for mid-tx resets that prevent overflow. Never the last kernel in the chain.
|
|
84
|
+
inner: ResetCatalogEntry[];
|
|
85
|
+
// Variants used as the terminal kernel for the rollup-bound private-only path. Each runs
|
|
86
|
+
// final-reset siloing and tail finalisation in one proof.
|
|
87
|
+
finalTail: ResetCatalogEntry[];
|
|
88
|
+
// Terminal variants for the public-bound path (transactions with public function calls). Runs
|
|
89
|
+
// final-reset siloing and tail-to-public partitioning by revertibility in one proof.
|
|
90
|
+
finalTailToPublic: ResetCatalogEntry[];
|
|
81
91
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
MAX_KEY_VALIDATION_REQUESTS_PER_TX,
|
|
3
|
+
MAX_NOTE_HASH_READ_REQUESTS_PER_TX,
|
|
4
|
+
MAX_NULLIFIERS_PER_TX,
|
|
5
|
+
MAX_NULLIFIER_READ_REQUESTS_PER_TX,
|
|
6
|
+
} from '@aztec/constants';
|
|
7
|
+
import { bigintToUInt64BE, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
8
|
+
|
|
9
|
+
import type { UInt64 } from '../types/shared.js';
|
|
10
|
+
import type { PrivateKernelResetHints } from './hints/private_kernel_reset_hints.js';
|
|
11
|
+
import type { PaddedSideEffectAmounts, PaddedSideEffects } from './padded_side_effects.js';
|
|
12
|
+
import { kernelStateIsForPublic } from './private_kernel_circuit_public_inputs.js';
|
|
13
|
+
import type { PrivateKernelData } from './private_kernel_data.js';
|
|
14
|
+
import { PrivateKernelResetCircuitPrivateInputsVariants } from './private_kernel_reset_circuit_private_inputs.js';
|
|
15
|
+
import type { PrivateKernelResetDimensions } from './private_kernel_reset_dimensions.js';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Input to a terminal reset+tail circuit. `isForPublic()` selects the rollup-bound (`reset_tail`)
|
|
19
|
+
* or public-bound (`reset_tail_to_public`) family.
|
|
20
|
+
*/
|
|
21
|
+
export class PrivateKernelResetTailCircuitPrivateInputs {
|
|
22
|
+
constructor(
|
|
23
|
+
public previousKernel: PrivateKernelData,
|
|
24
|
+
public paddedSideEffects: PaddedSideEffects,
|
|
25
|
+
public hints: PrivateKernelResetHints<
|
|
26
|
+
typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX,
|
|
27
|
+
typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX,
|
|
28
|
+
typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX,
|
|
29
|
+
typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX,
|
|
30
|
+
typeof MAX_KEY_VALIDATION_REQUESTS_PER_TX,
|
|
31
|
+
typeof MAX_NULLIFIERS_PER_TX
|
|
32
|
+
>,
|
|
33
|
+
public dimensions: PrivateKernelResetDimensions,
|
|
34
|
+
public paddedSideEffectAmounts: PaddedSideEffectAmounts,
|
|
35
|
+
public expirationTimestampUpperBound: UInt64,
|
|
36
|
+
) {}
|
|
37
|
+
|
|
38
|
+
isForPublic() {
|
|
39
|
+
return kernelStateIsForPublic(this.previousKernel.publicInputs);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Returns a dimension-trimmed view of the reset portion of these inputs (without the tail
|
|
44
|
+
* fields). The prover uses this to feed witness generation of the variant matching the chosen
|
|
45
|
+
* dimensions.
|
|
46
|
+
*/
|
|
47
|
+
trimResetToSizes() {
|
|
48
|
+
const hints = this.hints.trimToSizes(
|
|
49
|
+
this.dimensions.NOTE_HASH_PENDING_READ,
|
|
50
|
+
this.dimensions.NOTE_HASH_SETTLED_READ,
|
|
51
|
+
this.dimensions.NULLIFIER_PENDING_READ,
|
|
52
|
+
this.dimensions.NULLIFIER_SETTLED_READ,
|
|
53
|
+
this.dimensions.KEY_VALIDATION,
|
|
54
|
+
this.dimensions.TRANSIENT_DATA_SQUASHING,
|
|
55
|
+
);
|
|
56
|
+
return new PrivateKernelResetCircuitPrivateInputsVariants(this.previousKernel, this.paddedSideEffects, hints);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
toBuffer() {
|
|
60
|
+
return serializeToBuffer(
|
|
61
|
+
this.previousKernel,
|
|
62
|
+
this.paddedSideEffects,
|
|
63
|
+
this.hints,
|
|
64
|
+
this.dimensions,
|
|
65
|
+
this.paddedSideEffectAmounts,
|
|
66
|
+
bigintToUInt64BE(this.expirationTimestampUpperBound),
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
}
|
package/src/keys/derivation.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DomainSeparator } from '@aztec/constants';
|
|
2
2
|
import { Grumpkin } from '@aztec/foundation/crypto/grumpkin';
|
|
3
3
|
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
|
|
4
4
|
import { sha512ToGrumpkinScalar } from '@aztec/foundation/crypto/sha512';
|
|
@@ -11,8 +11,11 @@ import { PublicKey, hashPublicKey } from './public_key.js';
|
|
|
11
11
|
import { PublicKeys } from './public_keys.js';
|
|
12
12
|
import { getKeyGenerator } from './utils.js';
|
|
13
13
|
|
|
14
|
-
export function computeAppNullifierHidingKey(
|
|
15
|
-
|
|
14
|
+
export function computeAppNullifierHidingKey(
|
|
15
|
+
masterNullifierHidingSecretKey: GrumpkinScalar,
|
|
16
|
+
app: AztecAddress,
|
|
17
|
+
): Promise<Fr> {
|
|
18
|
+
return computeAppSecretKey(masterNullifierHidingSecretKey, app, 'n'); // 'n' is the key prefix for nullifier hiding key
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
export function computeAppSecretKey(skM: GrumpkinScalar, app: AztecAddress, keyPrefix: KeyPrefix): Promise<Fr> {
|
|
@@ -27,7 +30,7 @@ export async function computeOvskApp(ovsk: GrumpkinScalar, app: AztecAddress): P
|
|
|
27
30
|
return GrumpkinScalar.fromBuffer(ovskAppFr.toBuffer());
|
|
28
31
|
}
|
|
29
32
|
|
|
30
|
-
export function
|
|
33
|
+
export function deriveMasterNullifierHidingSecretKey(secretKey: Fr): GrumpkinScalar {
|
|
31
34
|
return sha512ToGrumpkinScalar([secretKey, DomainSeparator.NHK_M]);
|
|
32
35
|
}
|
|
33
36
|
|
|
@@ -39,9 +42,12 @@ export function deriveMasterOutgoingViewingSecretKey(secretKey: Fr): GrumpkinSca
|
|
|
39
42
|
return sha512ToGrumpkinScalar([secretKey, DomainSeparator.OVSK_M]);
|
|
40
43
|
}
|
|
41
44
|
|
|
42
|
-
export function
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
export function deriveMasterMessageSigningSecretKey(secretKey: Fr): GrumpkinScalar {
|
|
46
|
+
return sha512ToGrumpkinScalar([secretKey, DomainSeparator.MSSK_M]);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function deriveMasterFallbackSecretKey(secretKey: Fr): GrumpkinScalar {
|
|
50
|
+
return sha512ToGrumpkinScalar([secretKey, DomainSeparator.FBSK_M]);
|
|
45
51
|
}
|
|
46
52
|
|
|
47
53
|
export function computePreaddress(publicKeysHash: Fr, partialAddress: Fr) {
|
|
@@ -85,52 +91,91 @@ export async function computeAddressSecret(preaddress: Fr, ivsk: Fq) {
|
|
|
85
91
|
}
|
|
86
92
|
|
|
87
93
|
export function derivePublicKeyFromSecretKey(secretKey: Fq): Promise<PublicKey> {
|
|
94
|
+
// 0 * G is the point at infinity. The WASM encodes infinity with an out-of-field x coordinate that Point cannot
|
|
95
|
+
// deserialize, so return the point directly instead of calling into it.
|
|
96
|
+
if (secretKey.isZero()) {
|
|
97
|
+
return Promise.resolve(PublicKey.INFINITY);
|
|
98
|
+
}
|
|
88
99
|
return Grumpkin.mul(Grumpkin.generator, secretKey);
|
|
89
100
|
}
|
|
90
101
|
|
|
102
|
+
/**
|
|
103
|
+
* The six master secret keys that fully define an account's privacy keys.
|
|
104
|
+
*/
|
|
105
|
+
export type MasterSecretKeys = {
|
|
106
|
+
masterNullifierHidingSecretKey: GrumpkinScalar;
|
|
107
|
+
masterIncomingViewingSecretKey: GrumpkinScalar;
|
|
108
|
+
masterOutgoingViewingSecretKey: GrumpkinScalar;
|
|
109
|
+
masterTaggingSecretKey: GrumpkinScalar;
|
|
110
|
+
masterMessageSigningSecretKey: GrumpkinScalar;
|
|
111
|
+
masterFallbackSecretKey: GrumpkinScalar;
|
|
112
|
+
};
|
|
113
|
+
|
|
91
114
|
/**
|
|
92
115
|
* Computes secret and public keys and public keys hash from a secret key.
|
|
93
116
|
* @param secretKey - The secret key to derive keys from.
|
|
94
117
|
* @returns The derived keys.
|
|
95
118
|
*/
|
|
96
|
-
export
|
|
119
|
+
export function deriveKeys(secretKey: Fr) {
|
|
97
120
|
// First we derive master secret/hiding keys - we use sha512 here because this derivation will never take place
|
|
98
121
|
// in a circuit
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
122
|
+
return deriveKeysFromMasterSecretKeys({
|
|
123
|
+
masterNullifierHidingSecretKey: deriveMasterNullifierHidingSecretKey(secretKey),
|
|
124
|
+
masterIncomingViewingSecretKey: deriveMasterIncomingViewingSecretKey(secretKey),
|
|
125
|
+
masterOutgoingViewingSecretKey: deriveMasterOutgoingViewingSecretKey(secretKey),
|
|
126
|
+
masterTaggingSecretKey: sha512ToGrumpkinScalar([secretKey, DomainSeparator.TSK_M]),
|
|
127
|
+
masterMessageSigningSecretKey: deriveMasterMessageSigningSecretKey(secretKey),
|
|
128
|
+
masterFallbackSecretKey: deriveMasterFallbackSecretKey(secretKey),
|
|
129
|
+
});
|
|
130
|
+
}
|
|
103
131
|
|
|
104
|
-
|
|
105
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Derives the master public keys and the {@link PublicKeys} struct from a set of master secret keys.
|
|
134
|
+
* @param secretKeys - The master secret keys to derive public keys from.
|
|
135
|
+
* @returns The provided secret keys alongside the derived public keys.
|
|
136
|
+
*/
|
|
137
|
+
export async function deriveKeysFromMasterSecretKeys(secretKeys: MasterSecretKeys) {
|
|
138
|
+
const {
|
|
139
|
+
masterNullifierHidingSecretKey,
|
|
140
|
+
masterIncomingViewingSecretKey,
|
|
141
|
+
masterOutgoingViewingSecretKey,
|
|
142
|
+
masterTaggingSecretKey,
|
|
143
|
+
masterMessageSigningSecretKey,
|
|
144
|
+
masterFallbackSecretKey,
|
|
145
|
+
} = secretKeys;
|
|
146
|
+
|
|
147
|
+
const masterNullifierHidingPublicKey = await derivePublicKeyFromSecretKey(masterNullifierHidingSecretKey);
|
|
106
148
|
const masterIncomingViewingPublicKey = await derivePublicKeyFromSecretKey(masterIncomingViewingSecretKey);
|
|
107
149
|
const masterOutgoingViewingPublicKey = await derivePublicKeyFromSecretKey(masterOutgoingViewingSecretKey);
|
|
108
150
|
const masterTaggingPublicKey = await derivePublicKeyFromSecretKey(masterTaggingSecretKey);
|
|
151
|
+
const masterMessageSigningPublicKey = await derivePublicKeyFromSecretKey(masterMessageSigningSecretKey);
|
|
152
|
+
const masterFallbackPublicKey = await derivePublicKeyFromSecretKey(masterFallbackSecretKey);
|
|
109
153
|
|
|
110
154
|
// The non-owner-visible PublicKeys carries hashes for npk/ovpk/tpk/mspk/fbpk and the raw
|
|
111
|
-
// point only for ivpk_m. The npk/ovpk/tpk raw points are also returned alongside so the key
|
|
112
|
-
// store can persist them under `${account}-{n|ov|t}pk_m` (only their hashes live in publicKeys).
|
|
155
|
+
// point only for ivpk_m. The npk/ovpk/tpk/mspk/fbpk raw points are also returned alongside so the key
|
|
156
|
+
// store can persist them under `${account}-{n|ov|t|ms|fb}pk_m` (only their hashes live in publicKeys).
|
|
113
157
|
// The ivpk_m point isn't returned separately because it already lives in publicKeys.ivpkM.
|
|
114
|
-
//
|
|
115
|
-
// TODO: There isn't a derivation path for the message signing(msk) and fallback(fbk) keys yet. So we just use the the
|
|
116
|
-
// default values for now.
|
|
117
158
|
const publicKeys = new PublicKeys(
|
|
118
|
-
await hashPublicKey(
|
|
159
|
+
await hashPublicKey(masterNullifierHidingPublicKey),
|
|
119
160
|
masterIncomingViewingPublicKey,
|
|
120
161
|
await hashPublicKey(masterOutgoingViewingPublicKey),
|
|
121
162
|
await hashPublicKey(masterTaggingPublicKey),
|
|
122
|
-
|
|
123
|
-
|
|
163
|
+
await hashPublicKey(masterMessageSigningPublicKey),
|
|
164
|
+
await hashPublicKey(masterFallbackPublicKey),
|
|
124
165
|
);
|
|
125
166
|
|
|
126
167
|
return {
|
|
127
|
-
|
|
168
|
+
masterNullifierHidingSecretKey,
|
|
128
169
|
masterIncomingViewingSecretKey,
|
|
129
170
|
masterOutgoingViewingSecretKey,
|
|
130
171
|
masterTaggingSecretKey,
|
|
131
|
-
|
|
172
|
+
masterMessageSigningSecretKey,
|
|
173
|
+
masterFallbackSecretKey,
|
|
174
|
+
masterNullifierHidingPublicKey,
|
|
132
175
|
masterOutgoingViewingPublicKey,
|
|
133
176
|
masterTaggingPublicKey,
|
|
177
|
+
masterMessageSigningPublicKey,
|
|
178
|
+
masterFallbackPublicKey,
|
|
134
179
|
publicKeys,
|
|
135
180
|
};
|
|
136
181
|
}
|