Skip to content

Commit 04b6bed

Browse files
committed
kms: Rename contracts
1 parent 14db101 commit 04b6bed

25 files changed

Lines changed: 452 additions & 452 deletions

docs/deployment.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -57,31 +57,31 @@ rm -f dstack-${DSTACK_VERSION}.tar.gz
5757
./dstack-vmm -c vmm.toml
5858
```
5959

60-
## Deploy the KmsAuth contract
60+
## Deploy the DstackKms contract
6161

62-
A KMS node requires a KMSAuth contract to be deployed on the Ethereum-compatible network.
62+
A KMS node requires a DstackKms contract to be deployed on the Ethereum-compatible network.
6363

6464
```bash
6565
cd dstack/kms/auth-eth
6666
npm install
6767
npx hardhat compile
6868
PRIVATE_KEY=<your-private-key> npx hardhat kms:deploy --with-app-impl --network phala
6969
```
70-
It will deploy both the AppAuth implementation and KmsAuth contract to the Phala network and print the contract addresses:
70+
It will deploy both the DstackApp implementation and DstackKms contract to the Phala network and print the contract addresses:
7171

7272
```
73-
Step 1: Deploying AppAuth implementation...
74-
AppAuth implementation deployed to: 0x5FbDB2315678afecb367f032d93F642f64180aa3
75-
Step 2: Deploying KmsAuth...
73+
Step 1: Deploying DstackApp implementation...
74+
DstackApp implementation deployed to: 0x5FbDB2315678afecb367f032d93F642f64180aa3
75+
Step 2: Deploying DstackKms...
7676
Deploying proxy...
7777
Waiting for deployment...
78-
KmsAuth Proxy deployed to: 0xFE6C45aE66344CAEF5E5D7e2cbD476286D651875
78+
DstackKms Proxy deployed to: 0xFE6C45aE66344CAEF5E5D7e2cbD476286D651875
7979
Implementation deployed to: 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0
8080
Deployment completed successfully
8181
Transaction hash: 0xd413d01a0640b6193048b0e98afb7c173abe58c74d9cf01f368166bc53f4fefe
8282
✅ Complete KMS setup deployed successfully!
83-
- AppAuth implementation: 0x5FbDB2315678afecb367f032d93F642f64180aa3
84-
- KmsAuth proxy: 0xFE6C45aE66344CAEF5E5D7e2cbD476286D651875
83+
- DstackApp implementation: 0x5FbDB2315678afecb367f032d93F642f64180aa3
84+
- DstackKms proxy: 0xFE6C45aE66344CAEF5E5D7e2cbD476286D651875
8585
🚀 Ready for factory app deployments!
8686
```
8787

@@ -93,7 +93,7 @@ cd dstack/kms/dstack-app/
9393
./deploy-to-vmm.sh
9494
```
9595
It will create a template `.env` file. Edit the `.env` file and set the required variables.
96-
Especially the `KMS_CONTRACT_ADDR` variable set to the address of the KmsAuth Proxy contract deployed in the previous step.
96+
Especially the `KMS_CONTRACT_ADDR` variable set to the address of the DstackKms Proxy contract deployed in the previous step.
9797
The `IMAGE_DOWNLOAD_URL` variable should be set to the URL of the dstack OS image used to verify the os_image_hash.
9898
```
9999
# .env
@@ -169,19 +169,19 @@ npx hardhat kms:add-image --network phala --mr <os-image-hash>
169169
```
170170

171171
### Register dstack-gateway in KMS
172-
As a normal dstack app, it requires the app to be registered in the KmsAuth contract first.
172+
As a normal dstack app, it requires the app to be registered in the DstackKms contract first.
173173

174174
```bash
175175
cd dstack/kms/auth-eth
176176
npx hardhat app:deploy --network phala
177177
```
178178

179-
This will deploy an AppAuth contract in the KmsAuth contract and print the app ID:
179+
This will deploy an DstackApp contract in the DstackKms contract and print the app ID:
180180

181181
```
182182
Deploying proxy...
183183
Waiting for deployment...
184-
AppAuth Proxy deployed to: 0x539D0d59D1742780De41b85b2c3674b24369e292
184+
DstackApp Proxy deployed to: 0x539D0d59D1742780De41b85b2c3674b24369e292
185185
Implementation deployed to: 0x5aC1671E1Df54994D023F0B05806821d6D84e086
186186
Deployment completed successfully
187187
Transaction hash: 0xceac2ac6d56a40fef903b947d3a05df42ccce66da7f356c5d54afda68277f9a9
@@ -212,7 +212,7 @@ SRV_DOMAIN=test2.dstack.phala.network
212212
# Public IP address
213213
PUBLIC_IP=$(curl -s ifconfig.me)
214214
215-
# Gateway application ID. Register the app in KmsAuth first to get the app ID.
215+
# Gateway application ID. Register the app in DstackKms first to get the app ID.
216216
GATEWAY_APP_ID=0x31884c4b7775affe4c99735f6c2aff7d7bc6cfcd
217217
218218
# Whether to use ACME staging (yes/no)
@@ -262,7 +262,7 @@ GUEST_AGENT_ADDR: 127.0.0.1:9206
262262
Continue? [y/N]
263263
```
264264

265-
Don't press `y` yet. We need to add the compose hash to the AppAuth contract first. Go back to the `kms/auth-eth` directory and run the following command:
265+
Don't press `y` yet. We need to add the compose hash to the DstackApp contract first. Go back to the `kms/auth-eth` directory and run the following command:
266266

267267
```bash
268268
npx hardhat app:add-hash --network phala --app-id 0x31884c4b7775affe4c99735f6c2aff7d7bc6cfcd 0x700a50336df7c07c82457b116e144f526c29f6d8f4a0946b3e88065c9beba0f4
@@ -294,8 +294,8 @@ After the dstack-vmm is ready, you can deploy an app on it following the steps b
294294

295295
The on-chain registration process includes two steps:
296296

297-
1. Deploy an App's control contract AppAuth. Developers can develop their own or choose the reference contract from the Dstack repository. Custom contracts need to implement the IAppAuth interface.
298-
2. Call KmsAuth.registerApp(appAuthAddress) to register the contract.
297+
1. Deploy an App's control contract DstackApp. Developers can develop their own or choose the reference contract from the Dstack repository. Custom contracts need to implement the IAppAuth interface.
298+
2. Call DstackKms.registerApp(appContractAddress) to register the contract.
299299

300300
The Dstack repository provides scripts to complete these two steps:
301301

@@ -320,10 +320,10 @@ Command output:
320320
Deploying with account: 0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199
321321
Account balance: 9999.995278992293365404
322322
App ID: 0xA35b434eE853fdf9c2Bf48Fa1583Ac1332d50255
323-
Starting AppAuth deployment process...
323+
Starting DstackApp deployment process...
324324
Deploying proxy...
325325
Waiting for deployment...
326-
AppAuth deployed to: 0xD4a546B1C7e63CD4CeD314b2C90108e49191A915
326+
DstackApp deployed to: 0xD4a546B1C7e63CD4CeD314b2C90108e49191A915
327327
Implementation deployed to: 0x5aC1671E1Df54994D023F0B05806821d6D84e086
328328
Deployment completed successfully
329329
Transaction hash: 0xceac2ac6d56a40fef903b947d3a05df42ccce66da7f356c5d54afda68277f9a9
@@ -348,7 +348,7 @@ If you need to upgrade the contract in the future, please backup the `.openzeppe
348348

349349
Build app-compose.json and calculate its sha256 to get compose-hash. The compose hash can also be previewed in the dstack-vmm UI.
350350

351-
Call the hardhat command to add it to the whitelist (using AppAuth as an example here; custom AppAuth follows its own custom permission control logic).
351+
Call the hardhat command to add it to the whitelist (using DstackApp as an example here; custom DstackApp follows its own custom permission control logic).
352352

353353
```bash
354354
export PRIVATE_KEY=<your eth private key here>
@@ -360,7 +360,7 @@ npx hardhat app:add-hash --network phala --app-id 0xA35b434eE853fdf9c2Bf48Fa1583
360360
![app deploy](assets/app-deploy.png)
361361
- Select image `dstack-0.4.2`
362362
- Fill in the AppId applied in the contract during deployment
363-
- Currently, test KmsAuth has set a whitelist for Base image, requiring instance memory to be `≥ 3G` or exactly `= 2G`
363+
- Currently, test DstackKms has set a whitelist for Base image, requiring instance memory to be `≥ 3G` or exactly `= 2G`
364364

365365
After the app starts normally, click [Board] to access.
366366

gateway/dstack-app/deploy-to-vmm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ else
5252
# Public IP address
5353
PUBLIC_IP=$(curl -s4 ifconfig.me)
5454
55-
# The dstack-gateway application ID. Register the app in KmsAuth first to get the app ID.
55+
# The dstack-gateway application ID. Register the app in DstackKms first to get the app ID.
5656
# GATEWAY_APP_ID=31884c4b7775affe4c99735f6c2aff7d7bc6cfcd
5757
5858
# Whether to use ACME staging (yes/no)

kms/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ CVMs running in dstack support three boot modes:
4646
2. App control contract check
4747

4848
3. **Authorization Contracts**
49-
- `KmsAuth.sol`
49+
- `DstackKms.sol`
5050
- Maintains a registry for all Applications
5151
- Maintains the allowed KMS Instance MRs
5252
- Maintains the allowed OS Images
5353
- Registers KMS root keys
54-
- `AppAuth.sol`
55-
- Apps can have either a dedicated `AppAuth` contract or share one with multiple apps
54+
- `DstackApp.sol`
55+
- Apps can have either a dedicated `DstackApp` contract or share one with multiple apps
5656
- Controls permissions for individual apps
5757
- Maintains the allowed compose hashes for each app
5858

@@ -93,19 +93,19 @@ During bootstrapping, the KMS node generates two root keys:
9393
1. CA root key: Used to issue x509 certificates for Apps, enabling HTTPS traffic
9494
2. K256 root key: Used to derive Ethereum-compatible keys for Apps
9595

96-
After generating the root keys, their public portions can be obtained along with the corresponding TDX quote and registered in the KmsAuth contract.
96+
After generating the root keys, their public portions can be obtained along with the corresponding TDX quote and registered in the DstackKms contract.
9797

9898
#### KMS Self Replication
9999
When deploying a new KMS instance (`B`) using an existing instance (`A`), the process follows these steps:
100100

101101
1. **Prerequisites**
102-
- Register allowed MRs of instance `B` in the KmsAuth contract
102+
- Register allowed MRs of instance `B` in the DstackKms contract
103103

104104
2. **Replication Flow**
105105
- Configure instance `B` with the URL of existing instance `A`
106106
- Instance `B` sends replication request to instance `A` via RA-TLS based RPC
107107
- Instance `A` validates instance `B`'s TDX quote
108-
- Instance `A` checks KmsAuth contract for permissions
108+
- Instance `A` checks DstackKms contract for permissions
109109
- If approved, instance `A` transfers root keys to instance `B`
110110

111111
After the replication is complete, the KMS node becomes a fully functional KMS node.
@@ -117,7 +117,7 @@ Once onboarded, the KMS node begins listening for app key provisioning requests.
117117

118118
When a KMS node receives a key provisioning request, it:
119119
1. Validates the TDX quote of the requesting App
120-
2. Queries the KmsAuth contract for provisioning allowance
120+
2. Queries the DstackKms contract for provisioning allowance
121121
3. If allowed, generates and sends the keys to the App
122122

123123
### Attestation
@@ -134,7 +134,7 @@ As a simpler approach, an App can verify the signature chain using the KMS root
134134

135135
For example, given a message `M` signed by an App with signature `Sm`, the chain of trust works as follows:
136136

137-
1. The KMS maintains the root key `sK0`, with its corresponding public key `pK0` registered in the KmsAuth contract
137+
1. The KMS maintains the root key `sK0`, with its corresponding public key `pK0` registered in the DstackKms contract
138138
2. The App receives an app-key `sK1` from the KMS, along with signature `S1` (signed by `sK0`)
139139
3. The App derives a purpose-specific key `sK2` from `sK1`, with signature `S2` (signed by `sK1`)
140140
4. The App uses `sK2` to sign message `M`, producing signature `Sm`
@@ -146,7 +146,7 @@ The verification process follows these steps:
146146
1. Recover `pK2` from `Sm` and `M`
147147
2. Recover `pK1` from `S2` and `pK2` + `<purpose-id>`
148148
3. Recover `pK0` from `S1` and `pK1` + `<app-id>`
149-
4. Compare the recovered `pK0` with the registered `pK0` in the KmsAuth contract
149+
4. Compare the recovered `pK0` with the registered `pK0` in the DstackKms contract
150150

151151
## The RPC Interface
152152

0 commit comments

Comments
 (0)