Skip to content

Commit 0a0c097

Browse files
authored
refactor(aztec-nr): drop unused HandshakeNote fields (#24595)
1 parent 6a53d40 commit 0a0c097

5 files changed

Lines changed: 28 additions & 52 deletions

File tree

noir-projects/aztec-nr/aztec/src/standard_addresses.nr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
use protocol_types::{address::AztecAddress, traits::FromField};
33

44
pub global STANDARD_AUTH_REGISTRY_ADDRESS: AztecAddress = AztecAddress::from_field(
5-
0x0bbe366bb57059b03929228f7e886b17210cf268e021608392f58cb8f2574f43,
5+
0x0292b01f4e566555534c40ed729eb023cc08afaca647b8c3642738449673480c,
66
);
77

88
pub global STANDARD_MULTI_CALL_ENTRYPOINT_ADDRESS: AztecAddress = AztecAddress::from_field(
9-
0x252e4f53e6bef46e70a37168c52a9eba7501944a40c63f0aa807cf2f823260d9,
9+
0x18470168ca7a775b442cde110b668732f7b6390a505f3784b50f39993c5f3dce,
1010
);
1111

1212
pub global STANDARD_PUBLIC_CHECKS_ADDRESS: AztecAddress = AztecAddress::from_field(
13-
0x05c207d39f7a51de9de6cfd37ab7764bbc9d0434481c4448fc6ddbeac2f67636,
13+
0x2d7745526508f5ceb278bb773a49f776842d1d2f0854c4a385bb661a2fabb9a8,
1414
);
1515

1616
pub global STANDARD_HANDSHAKE_REGISTRY_ADDRESS: AztecAddress = AztecAddress::from_field(
17-
0x0fe4285eada74ef13ea09468db7fcb69861161276f81f24a99e152e5871c5081,
17+
0x0bd62e76a9a3a103dae2e73040e05d3970ac900baff5637ae9f183396745ec7e,
1818
);

noir-projects/noir-contracts/contracts/standard/handshake_registry_contract/src/handshake_note.nr

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ use aztec::{
1919
#[derive(Deserialize, Eq, Packable, Serialize)]
2020
#[note]
2121
pub struct HandshakeNote {
22-
/// Stored so contracts can constrain the kind of handshake they accept (e.g. an app may want to require interactive
23-
/// handshakes only).
24-
handshake_type: u8,
25-
/// The recipient this handshake authorizes. Part of the note preimage so a contract proving note
26-
/// existence can bind the proof to the intended recipient.
27-
recipient: AztecAddress,
2822
/// The raw ECDH shared-secret point `S = eph_sk * recipient_address_point`. Only this module can read it for
2923
/// siloing, and it is never returned by an external function.
3024
secret: EmbeddedCurvePoint,
@@ -36,13 +30,8 @@ pub struct HandshakeNote {
3630
}
3731

3832
impl HandshakeNote {
39-
pub(crate) fn new(
40-
shared_secret: EmbeddedCurvePoint,
41-
handshake_type: u8,
42-
recipient: AztecAddress,
43-
sender_secret: Field,
44-
) -> Self {
45-
Self { handshake_type, recipient, secret: shared_secret, sender_secret }
33+
pub(crate) fn new(shared_secret: EmbeddedCurvePoint, sender_secret: Field) -> Self {
34+
Self { secret: shared_secret, sender_secret }
4635
}
4736

4837
/// Returns the [app-siloed handshake secrets][AppSiloedHandshakeSecrets] for `caller`: the shared secret (via

noir-projects/noir-contracts/contracts/standard/handshake_registry_contract/src/main.nr

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@ mod test;
66

77
use sync::handshake_registry_sync;
88

9-
/// Handshake type identifier for non-interactive handshakes (sender-generated random shared secret, no recipient
10-
/// signature). See [`HandshakeRegistry::non_interactive_handshake`].
11-
global NON_INTERACTIVE_HANDSHAKE: u8 = 1;
12-
13-
/// Handshake type identifier for interactive handshakes (recipient-signed). See
14-
/// [`HandshakeRegistry::interactive_handshake`].
15-
global INTERACTIVE_HANDSHAKE: u8 = 2;
16-
179
/// Registry for the message-delivery handshake protocol.
1810
///
1911
/// The registry establishes a master shared-secret point `S` between a sender and a recipient and stores one current
@@ -34,8 +26,8 @@ global INTERACTIVE_HANDSHAKE: u8 = 2;
3426
#[aztec(::aztec::macros::AztecConfig::new().custom_sync_state(crate::handshake_registry_sync))]
3527
pub contract HandshakeRegistry {
3628
use crate::{
37-
handshake_note::HandshakeNote, INTERACTIVE_HANDSHAKE, NON_INTERACTIVE_HANDSHAKE,
38-
recipient_signature::RecipientSignature, sync::discovered_handshakes::get_all_discovered_handshakes,
29+
handshake_note::HandshakeNote, recipient_signature::RecipientSignature,
30+
sync::discovered_handshakes::get_all_discovered_handshakes,
3931
};
4032
use aztec::{
4133
keys::{ecdh_shared_secret::derive_ecdh_shared_secret, ephemeral::generate_positive_ephemeral_key_pair},
@@ -86,7 +78,7 @@ pub contract HandshakeRegistry {
8678
#[external("private")]
8779
fn non_interactive_handshake(sender: AztecAddress, recipient: AztecAddress) -> AppSiloedHandshakeSecrets {
8880
let (eph_pk, s_raw) = self.internal._generate_shared_secret(recipient);
89-
let secrets = self.internal._store(sender, recipient, s_raw, NON_INTERACTIVE_HANDSHAKE);
81+
let secrets = self.internal._store(sender, recipient, s_raw);
9082

9183
// Announce the handshake: an encrypted private log under the recipient-keyed tag carrying `[eph_pk.x]`, so
9284
// the recipient can discover the handshake by scanning their tag and recover `S` via their own ECDH.
@@ -118,7 +110,7 @@ pub contract HandshakeRegistry {
118110
fn interactive_handshake(sender: AztecAddress, recipient: AztecAddress) -> AppSiloedHandshakeSecrets {
119111
let (eph_pk, s_raw) = self.internal._generate_shared_secret(recipient);
120112
self.internal._request_and_verify_signature(recipient, eph_pk);
121-
self.internal._store(sender, recipient, s_raw, INTERACTIVE_HANDSHAKE)
113+
self.internal._store(sender, recipient, s_raw)
122114
}
123115

124116
/// Asserts that `secrets` match the stored handshake from `sender` to `recipient`, for the caller (`msg_sender()`).
@@ -211,17 +203,12 @@ pub contract HandshakeRegistry {
211203
/// Inserts or replaces the current [`HandshakeNote`] owned by `sender` for `recipient` and returns the
212204
/// app-siloed secrets for the caller (`msg_sender()`).
213205
#[internal("private")]
214-
fn _store(
215-
sender: AztecAddress,
216-
recipient: AztecAddress,
217-
s_raw: EmbeddedCurvePoint,
218-
handshake_type: u8,
219-
) -> AppSiloedHandshakeSecrets {
206+
fn _store(sender: AztecAddress, recipient: AztecAddress, s_raw: EmbeddedCurvePoint) -> AppSiloedHandshakeSecrets {
220207
// Safety: an uncooperative sender could pick a non-random value, but the sender-only secret only protects
221208
// the sender's own ability to advance their sequence, so a bad value only harms themselves. It is a fresh
222209
// random secret known only to the sender, which will be folded into constrained-delivery nullifiers.
223210
let sender_secret = unsafe { random() };
224-
let note = HandshakeNote::new(s_raw, handshake_type, recipient, sender_secret);
211+
let note = HandshakeNote::new(s_raw, sender_secret);
225212

226213
// We deliver onchain unconstrained rather than offchain so the note is discoverable via normal PXE sync. This
227214
// is a self-send (the note is owned by and delivered to `sender`), so the wallet would resolve to an
19.7 KB
Binary file not shown.

yarn-project/standard-contracts/src/standard_contract_data.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,45 +20,45 @@ export const StandardContractSalt: Record<StandardContractName, Fr> = {
2020
};
2121

2222
export const StandardContractAddress: Record<StandardContractName, AztecAddress> = {
23-
AuthRegistry: AztecAddress.fromStringUnsafe('0x0bbe366bb57059b03929228f7e886b17210cf268e021608392f58cb8f2574f43'),
23+
AuthRegistry: AztecAddress.fromStringUnsafe('0x0292b01f4e566555534c40ed729eb023cc08afaca647b8c3642738449673480c'),
2424
MultiCallEntrypoint: AztecAddress.fromStringUnsafe(
25-
'0x252e4f53e6bef46e70a37168c52a9eba7501944a40c63f0aa807cf2f823260d9',
25+
'0x18470168ca7a775b442cde110b668732f7b6390a505f3784b50f39993c5f3dce',
2626
),
27-
PublicChecks: AztecAddress.fromStringUnsafe('0x05c207d39f7a51de9de6cfd37ab7764bbc9d0434481c4448fc6ddbeac2f67636'),
27+
PublicChecks: AztecAddress.fromStringUnsafe('0x2d7745526508f5ceb278bb773a49f776842d1d2f0854c4a385bb661a2fabb9a8'),
2828
HandshakeRegistry: AztecAddress.fromStringUnsafe(
29-
'0x0fe4285eada74ef13ea09468db7fcb69861161276f81f24a99e152e5871c5081',
29+
'0x0bd62e76a9a3a103dae2e73040e05d3970ac900baff5637ae9f183396745ec7e',
3030
),
3131
};
3232

3333
export const StandardContractClassId: Record<StandardContractName, Fr> = {
34-
AuthRegistry: Fr.fromString('0x2f4a272a86482af67aa5beb9db9ea648080f0e140baf55a0af153421ab19e12d'),
35-
MultiCallEntrypoint: Fr.fromString('0x2b2d3d423944a96cc01b3d332ba25e8a53aa486740d68047ca4df1b1c849a8e5'),
36-
PublicChecks: Fr.fromString('0x1c14245c8afceb64326b033fd1841e78e844124e40c49a36712f57dfffd258d6'),
37-
HandshakeRegistry: Fr.fromString('0x250d9a5696197bc0aaa73bd6fe01b89e33a796d91b18b847cc419e433a5cfaf9'),
34+
AuthRegistry: Fr.fromString('0x1f8810cff8690ef53281da87fcda9d4820154d6dcd76012c90bf459b3ba3ab7a'),
35+
MultiCallEntrypoint: Fr.fromString('0x282930170063677f616bcf9dc9fbfd4968a577dbbcdec0ea3c06283a44bcc743'),
36+
PublicChecks: Fr.fromString('0x2a0f1592c7f4c979b328ed030039a4e9a469aab30afa3a036735c338067abbcd'),
37+
HandshakeRegistry: Fr.fromString('0x10fbd0602fe72a04c86e25728c8c2b94a359c684738768cbe4e44fb05f6a908c'),
3838
};
3939

4040
export const StandardContractClassIdPreimage: Record<
4141
StandardContractName,
4242
{ artifactHash: Fr; privateFunctionsRoot: Fr; publicBytecodeCommitment: Fr }
4343
> = {
4444
AuthRegistry: {
45-
artifactHash: Fr.fromString('0x01f4d890c55a73e9164007dfe9833d7fc9daaf29f49886d412188ba02b4c4b81'),
45+
artifactHash: Fr.fromString('0x1bfa3469d2f70892f9ba54117abcf4ca52bb758e66be19b5d0ab86600202ab73'),
4646
privateFunctionsRoot: Fr.fromString('0x17b584350f4c3ccafd8f688729afb9feab8976114fb40012e9dee65022c072a4'),
4747
publicBytecodeCommitment: Fr.fromString('0x2545f39893766508ce37bb5cea5e4dcab04c6f7f79f3089b1c076876e9d268b2'),
4848
},
4949
MultiCallEntrypoint: {
50-
artifactHash: Fr.fromString('0x158b25c22e41ecc134945b6f7fed7b0d523841a6e0ac78be1bdac989eb1ae6c0'),
50+
artifactHash: Fr.fromString('0x05d7e89374f90684063f132a79de9b0f9553508de9ec1b83b8f6110d6ebbc21f'),
5151
privateFunctionsRoot: Fr.fromString('0x0e68dfbb256e80b08b3aef47aca1f2669e97a9c6259787893c1223ac083ad5d5'),
5252
publicBytecodeCommitment: Fr.fromString('0x0ce4c618c3ed7f3a20410e618c06bb701e150af7fe28a3e92f68e7733809f33e'),
5353
},
5454
PublicChecks: {
55-
artifactHash: Fr.fromString('0x18fbef2f3a4f54681c07f1eb9474851e43d5dce9a52cf1ebc0ca4bbebb96527f'),
55+
artifactHash: Fr.fromString('0x0636977743e164f84fbd38ca408ad33794768c994f28dd8609729a8406d352dc'),
5656
privateFunctionsRoot: Fr.fromString('0x202860adb1b8975971eeaf571aaaa88a27f4035290d58532ae7d60b0dfaad54c'),
5757
publicBytecodeCommitment: Fr.fromString('0x013c4f854a5c87c9daf86c5f9bc07a42c2a061f1d924a5b3564ec7edc8e18cb7'),
5858
},
5959
HandshakeRegistry: {
60-
artifactHash: Fr.fromString('0x0e781457b14303befa6080e70bcec27e82a0081191063b9128561a4183722c59'),
61-
privateFunctionsRoot: Fr.fromString('0x02a4dba36389845b8ef0108562f7536d3284f07ca678558fc3c3bce3b24ee821'),
60+
artifactHash: Fr.fromString('0x2fc28e54f5f227307378f4620d793db72a4e1a7937e8cb31396b61a48ea7abef'),
61+
privateFunctionsRoot: Fr.fromString('0x14f4bfbedd0d76e9b66d1f836a71457cb0f5b4f40280eec4a3ed40439440e252'),
6262
publicBytecodeCommitment: Fr.fromString('0x0ce4c618c3ed7f3a20410e618c06bb701e150af7fe28a3e92f68e7733809f33e'),
6363
},
6464
};
@@ -96,19 +96,19 @@ export const StandardContractPrivateFunctions: Record<
9696
selector: FunctionSelector.fromField(
9797
Fr.fromString('0x0000000000000000000000000000000000000000000000000000000019f8b409'),
9898
),
99-
vkHash: Fr.fromString('0x25d87da668c7c52b9c521579f191bb02486b3598d1ec0063927d5c0af2608daf'),
99+
vkHash: Fr.fromString('0x0b9ec5c76f08f8025800691659d7ba1432ddb8a30e40fdbd4d8f5c398b8c9ab7'),
100100
},
101101
{
102102
selector: FunctionSelector.fromField(
103103
Fr.fromString('0x00000000000000000000000000000000000000000000000000000000db548fcf'),
104104
),
105-
vkHash: Fr.fromString('0x0f59fe525df9ff4a400e33dec33fd1dc07e25d95f860734a35b909085cf07809'),
105+
vkHash: Fr.fromString('0x1c0f79ad358fc72c0f8cbac535d2d67f49dcea2f7d6c658eb38c7669f8ae2f93'),
106106
},
107107
{
108108
selector: FunctionSelector.fromField(
109109
Fr.fromString('0x00000000000000000000000000000000000000000000000000000000f1ff839b'),
110110
),
111-
vkHash: Fr.fromString('0x12f43f384aa64661b012b52b1d80eb1d2202b8e459b50f56cfe270b0672c16ff'),
111+
vkHash: Fr.fromString('0x2c2961a5e83daa909242c9ce441526c0a95379fda0976877acba4ffe7be949f3'),
112112
},
113113
],
114114
};

0 commit comments

Comments
 (0)