Skip to content

Commit fc88512

Browse files
alinushwrwg
authored andcommitted
add support for SLH-DSA-SHA2-128s TXN authenticators (#18300)
* initial authenticator for SLH-DSA-SHA2-128s * add API support for SLH-DSA-SHA2-128s * auto-generate API and protobuf files for SLH-DSA-SHA2-128s * add feature gating for SLH-DSA-SHA2-128s * added e2e smoke test for SLH-DSA-SHA2-128s accounts * add feature-gated higher gas costs for SLH-DSA-SHA128s transactions * lints and revert python/scripts/install_deps.sh * oops, should have appended to the enums * added API tests * incorporate gas feedback from victor * Partially-revert "incorporate gas feedback from victor" * oops, let's box things or risk OOM
1 parent 1d081a5 commit fc88512

File tree

51 files changed

+1494
-321
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1494
-321
lines changed

api/doc/spec.json

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17697,6 +17697,9 @@
1769717697
},
1769817698
{
1769917699
"$ref": "#/components/schemas/PublicKey_FederatedKeyless"
17700+
},
17701+
{
17702+
"$ref": "#/components/schemas/PublicKey_SlhDsa_Sha2_128s"
1770017703
}
1770117704
],
1770217705
"discriminator": {
@@ -17706,7 +17709,8 @@
1770617709
"secp256k1_ecdsa": "#/components/schemas/PublicKey_Secp256k1Ecdsa",
1770717710
"secp256r1_ecdsa": "#/components/schemas/PublicKey_Secp256r1Ecdsa",
1770817711
"keyless": "#/components/schemas/PublicKey_Keyless",
17709-
"federated_keyless": "#/components/schemas/PublicKey_FederatedKeyless"
17712+
"federated_keyless": "#/components/schemas/PublicKey_FederatedKeyless",
17713+
"slh_dsa__sha2_128s": "#/components/schemas/PublicKey_SlhDsa_Sha2_128s"
1771017714
}
1771117715
}
1771217716
},
@@ -17820,6 +17824,28 @@
1782017824
}
1782117825
]
1782217826
},
17827+
"PublicKey_SlhDsa_Sha2_128s": {
17828+
"allOf": [
17829+
{
17830+
"type": "object",
17831+
"required": [
17832+
"type"
17833+
],
17834+
"properties": {
17835+
"type": {
17836+
"type": "string",
17837+
"enum": [
17838+
"slh_dsa__sha2_128s"
17839+
],
17840+
"example": "slh_dsa__sha2_128s"
17841+
}
17842+
}
17843+
},
17844+
{
17845+
"$ref": "#/components/schemas/SlhDsa_Sha2_128s"
17846+
}
17847+
]
17848+
},
1782317849
"RSA_JWK": {
1782417850
"type": "object",
1782517851
"description": "Move type `0x1::jwks::RSA_JWK` in rust.\nSee its doc in Move for more details.",
@@ -17984,6 +18010,9 @@
1798418010
},
1798518011
{
1798618012
"$ref": "#/components/schemas/Signature_Keyless"
18013+
},
18014+
{
18015+
"$ref": "#/components/schemas/Signature_SlhDsa_Sha2_128s"
1798718016
}
1798818017
],
1798918018
"discriminator": {
@@ -17992,7 +18021,8 @@
1799218021
"ed25519": "#/components/schemas/Signature_Ed25519",
1799318022
"secp256k1_ecdsa": "#/components/schemas/Signature_Secp256k1Ecdsa",
1799418023
"web_authn": "#/components/schemas/Signature_WebAuthn",
17995-
"keyless": "#/components/schemas/Signature_Keyless"
18024+
"keyless": "#/components/schemas/Signature_Keyless",
18025+
"slh_dsa__sha2_128s": "#/components/schemas/Signature_SlhDsa_Sha2_128s"
1799618026
}
1799718027
}
1799818028
},
@@ -18062,6 +18092,28 @@
1806218092
}
1806318093
]
1806418094
},
18095+
"Signature_SlhDsa_Sha2_128s": {
18096+
"allOf": [
18097+
{
18098+
"type": "object",
18099+
"required": [
18100+
"type"
18101+
],
18102+
"properties": {
18103+
"type": {
18104+
"type": "string",
18105+
"enum": [
18106+
"slh_dsa__sha2_128s"
18107+
],
18108+
"example": "slh_dsa__sha2_128s"
18109+
}
18110+
}
18111+
},
18112+
{
18113+
"$ref": "#/components/schemas/SlhDsa_Sha2_128s"
18114+
}
18115+
]
18116+
},
1806518117
"Signature_WebAuthn": {
1806618118
"allOf": [
1806718119
{
@@ -18100,6 +18152,17 @@
1810018152
}
1810118153
}
1810218154
},
18155+
"SlhDsa_Sha2_128s": {
18156+
"type": "object",
18157+
"required": [
18158+
"value"
18159+
],
18160+
"properties": {
18161+
"value": {
18162+
"$ref": "#/components/schemas/HexEncodedBytes"
18163+
}
18164+
}
18165+
},
1810318166
"StateCheckpointTransaction": {
1810418167
"type": "object",
1810518168
"description": "A state checkpoint transaction",

api/doc/spec.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13279,6 +13279,7 @@ components:
1327913279
- $ref: '#/components/schemas/PublicKey_Secp256r1Ecdsa'
1328013280
- $ref: '#/components/schemas/PublicKey_Keyless'
1328113281
- $ref: '#/components/schemas/PublicKey_FederatedKeyless'
13282+
- $ref: '#/components/schemas/PublicKey_SlhDsa_Sha2_128s'
1328213283
discriminator:
1328313284
propertyName: type
1328413285
mapping:
@@ -13287,6 +13288,7 @@ components:
1328713288
secp256r1_ecdsa: '#/components/schemas/PublicKey_Secp256r1Ecdsa'
1328813289
keyless: '#/components/schemas/PublicKey_Keyless'
1328913290
federated_keyless: '#/components/schemas/PublicKey_FederatedKeyless'
13291+
slh_dsa__sha2_128s: '#/components/schemas/PublicKey_SlhDsa_Sha2_128s'
1329013292
PublicKey_Ed25519:
1329113293
allOf:
1329213294
- type: object
@@ -13347,6 +13349,18 @@ components:
1334713349
- secp256r1_ecdsa
1334813350
example: secp256r1_ecdsa
1334913351
- $ref: '#/components/schemas/Secp256r1Ecdsa'
13352+
PublicKey_SlhDsa_Sha2_128s:
13353+
allOf:
13354+
- type: object
13355+
required:
13356+
- type
13357+
properties:
13358+
type:
13359+
type: string
13360+
enum:
13361+
- slh_dsa__sha2_128s
13362+
example: slh_dsa__sha2_128s
13363+
- $ref: '#/components/schemas/SlhDsa_Sha2_128s'
1335013364
RSA_JWK:
1335113365
type: object
1335213366
description: |-
@@ -13454,13 +13468,15 @@ components:
1345413468
- $ref: '#/components/schemas/Signature_Secp256k1Ecdsa'
1345513469
- $ref: '#/components/schemas/Signature_WebAuthn'
1345613470
- $ref: '#/components/schemas/Signature_Keyless'
13471+
- $ref: '#/components/schemas/Signature_SlhDsa_Sha2_128s'
1345713472
discriminator:
1345813473
propertyName: type
1345913474
mapping:
1346013475
ed25519: '#/components/schemas/Signature_Ed25519'
1346113476
secp256k1_ecdsa: '#/components/schemas/Signature_Secp256k1Ecdsa'
1346213477
web_authn: '#/components/schemas/Signature_WebAuthn'
1346313478
keyless: '#/components/schemas/Signature_Keyless'
13479+
slh_dsa__sha2_128s: '#/components/schemas/Signature_SlhDsa_Sha2_128s'
1346413480
Signature_Ed25519:
1346513481
allOf:
1346613482
- type: object
@@ -13497,6 +13513,18 @@ components:
1349713513
- secp256k1_ecdsa
1349813514
example: secp256k1_ecdsa
1349913515
- $ref: '#/components/schemas/Secp256k1Ecdsa'
13516+
Signature_SlhDsa_Sha2_128s:
13517+
allOf:
13518+
- type: object
13519+
required:
13520+
- type
13521+
properties:
13522+
type:
13523+
type: string
13524+
enum:
13525+
- slh_dsa__sha2_128s
13526+
example: slh_dsa__sha2_128s
13527+
- $ref: '#/components/schemas/SlhDsa_Sha2_128s'
1350013528
Signature_WebAuthn:
1350113529
allOf:
1350213530
- type: object
@@ -13520,6 +13548,13 @@ components:
1352013548
$ref: '#/components/schemas/PublicKey'
1352113549
signature:
1352213550
$ref: '#/components/schemas/Signature'
13551+
SlhDsa_Sha2_128s:
13552+
type: object
13553+
required:
13554+
- value
13555+
properties:
13556+
value:
13557+
$ref: '#/components/schemas/HexEncodedBytes'
1352313558
StateCheckpointTransaction:
1352413559
type: object
1352513560
description: A state checkpoint transaction
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"public_key": "0x14418f867a0bd6d42abb2daa50cd68a5a869ce208282481f57504f630510d0d3",
3+
"signature": "0xe6530660a35b39a78f782ec1653f3774d4fcc67de3b5cc952b88e99139c22e5b3869c64641f78ec96cbf9a5a42ed4fd7ee2b804c327ce89e7783f3ff7c9c6d01",
4+
"type": "ed25519_signature"
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"public_key": "0x14418f867a0bd6d42abb2daa50cd68a5a869ce208282481f57504f630510d0d3",
3+
"signature": "0x3911006313e771d971f581fb64b15f4aa26a2fa60ccc13a02602f6afa627abe22a20212b6ad18801b7c63c56c798ce87167f332730e3a7555c95530f491eca01",
4+
"type": "ed25519_signature"
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"public_key": "0x14418f867a0bd6d42abb2daa50cd68a5a869ce208282481f57504f630510d0d3",
3+
"signature": "0x577369e22ada984a27334c9222443d0863129963a9822f74bb8322e0ef6341c2fdc3f589c5483bac55d625e1f9d2db05bd0812ae9a6938b1de0f5b9852fda703",
4+
"type": "ed25519_signature"
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"public_key": "0x14418f867a0bd6d42abb2daa50cd68a5a869ce208282481f57504f630510d0d3",
3+
"signature": "0xe6530660a35b39a78f782ec1653f3774d4fcc67de3b5cc952b88e99139c22e5b3869c64641f78ec96cbf9a5a42ed4fd7ee2b804c327ce89e7783f3ff7c9c6d01",
4+
"type": "ed25519_signature"
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"public_key": "0x14418f867a0bd6d42abb2daa50cd68a5a869ce208282481f57504f630510d0d3",
3+
"signature": "0x3911006313e771d971f581fb64b15f4aa26a2fa60ccc13a02602f6afa627abe22a20212b6ad18801b7c63c56c798ce87167f332730e3a7555c95530f491eca01",
4+
"type": "ed25519_signature"
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"public_key": "0x14418f867a0bd6d42abb2daa50cd68a5a869ce208282481f57504f630510d0d3",
3+
"signature": "0x577369e22ada984a27334c9222443d0863129963a9822f74bb8322e0ef6341c2fdc3f589c5483bac55d625e1f9d2db05bd0812ae9a6938b1de0f5b9852fda703",
4+
"type": "ed25519_signature"
5+
}

api/src/tests/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ mod resource_groups;
1818
mod secp256k1_ecdsa;
1919
mod signed_int_test;
2020
mod simulation_test;
21+
mod slh_dsa_sha2_128s;
2122
mod state_test;
2223
mod string_resource_test;
2324
mod transaction_vector_test;

api/src/tests/secp256k1_ecdsa.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ async fn test_multi_secp256k1_ecdsa(
4848
)
4949
.account_address();
5050

51-
// Set a dummy key
51+
// NOTE: LocalAccount requires a private key, but we use a dummy Ed25519 key here as a
52+
// placeholder. This key is never used for actual authentication because:
53+
// 1. create_user_account() and mint_user_account() are signed by the root/faucet account
54+
// 2. The transfer transaction will be re-signed below with the actual secp256k1 key
5255
let key_bytes =
5356
hex::decode("a38ba78b1a0fbfc55e2c5dfdedf48d1172283d0f7c59fd64c02d811130a2f4b2").unwrap();
5457
let ed25519_private_key: Ed25519PrivateKey = (&key_bytes[..]).try_into().unwrap();
@@ -123,7 +126,10 @@ async fn test_secp256k1_ecdsa(
123126
let address = AuthenticationKey::any_key(AnyPublicKey::secp256k1_ecdsa(public_key.clone()))
124127
.account_address();
125128

126-
// Set a dummy key
129+
// NOTE: LocalAccount requires a private key, but we use a dummy Ed25519 key here as a
130+
// placeholder. This key is never used for actual authentication because:
131+
// 1. create_user_account() and mint_user_account() are signed by the root/faucet account
132+
// 2. The transfer transaction will be re-signed below with the actual secp256k1 key
127133
let key_bytes =
128134
hex::decode("a38ba78b1a0fbfc55e2c5dfdedf48d1172283d0f7c59fd64c02d811130a2f4b2").unwrap();
129135
let ed25519_private_key: Ed25519PrivateKey = (&key_bytes[..]).try_into().unwrap();

0 commit comments

Comments
 (0)