Skip to content

Commit 3231bfa

Browse files
author
User
committed
docs(readme): expand EC2 instance selection, debug vs production enclave mode, troubleshooting
1 parent 57fec73 commit 3231bfa

1 file changed

Lines changed: 135 additions & 18 deletions

File tree

README.md

Lines changed: 135 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,21 @@ Go to the [AWS EC2 console](https://console.aws.amazon.com/ec2/v2/home#LaunchIns
4646

4747
**AMI:** Amazon Linux 2023 (recommended — has native Nitro support)
4848

49-
**Instance type:** `m7i.xlarge`
50-
> Do not use `t3` or free tier instances — they do not support Nitro Enclaves.
49+
**Instance type:** Choose from the table below. The enclave needs at least 2 dedicated vCPUs and 4 GB of RAM reserved for it, so the host must have at least 4 vCPUs and 8 GB total.
50+
51+
| Instance | vCPUs | RAM | Notes |
52+
|---|---|---|---|
53+
| `m5.xlarge` | 4 | 16 GB | ✅ Recommended — best price/performance |
54+
| `m5.2xlarge` | 8 | 32 GB | ✅ If you need more headroom |
55+
| `m7i.xlarge` | 4 | 16 GB | ✅ Latest gen, slightly faster |
56+
| `c5.xlarge` | 4 | 8 GB | ✅ Works — tight on memory |
57+
| `c5.2xlarge` | 8 | 16 GB | ✅ Comfortable |
58+
| `r5.xlarge` | 4 | 32 GB | ✅ If memory-heavy workloads |
59+
| `t3.*` / `t2.*` | any | any |**Not supported** — T-family instances have no Nitro Enclave support |
60+
| `t3a.*` / `t4g.*` | any | any |**Not supported** |
61+
| `m6g.*` / `c7g.*` (ARM) | any | any |**Not supported** — Nitro Enclaves require x86_64 |
62+
63+
> **Tip:** When in doubt, use `m5.xlarge`. It is the most widely tested instance type for Nitro Enclaves.
5164
5265
**Key pair:** Create a new key pair, download the `.pem` file, keep it safe.
5366

@@ -60,12 +73,26 @@ Go to the [AWS EC2 console](https://console.aws.amazon.com/ec2/v2/home#LaunchIns
6073
- Type: `gp3`
6174
- Encrypted: **Yes** — select your KMS key if you have one
6275

63-
**Advanced details:**
64-
- Nitro Enclave: **Enable** ← this is the critical one
76+
**Advanced details — critical settings:**
77+
78+
> ⚠️ **Nitro Enclave support cannot be enabled after launch.** You must check the box before clicking "Launch Instance". There is no way to add it to a running instance — you would need to terminate and relaunch.
79+
80+
- **Nitro Enclave: Enable** ← scroll down in Advanced details, it is a single checkbox
6581
- IAM instance profile: attach a role with `secretsmanager:GetSecretValue` if you plan to use AWS Secrets Manager for your wallet mnemonic (recommended)
6682

6783
Launch the instance.
6884

85+
### How to confirm Nitro Enclaves is enabled
86+
87+
After SSHing into the instance:
88+
89+
```bash
90+
nitro-cli describe-enclaves
91+
# Expected output: [] (empty list — no enclaves running yet, but CLI works)
92+
```
93+
94+
If you see `bash: nitro-cli: command not found` or `Failed to connect to NE socket`, the instance was launched **without** Nitro Enclave support. Terminate it and relaunch with the checkbox checked.
95+
6996
---
7097

7198
## Step 2 — Connect to your server
@@ -195,30 +222,72 @@ sudo journalctl -u vram-validator -f # watch logs
195222
196223
## Nitro Enclave setup
197224
198-
The Nitro Enclave is required to submit verified scores on mainnet. On testnet it runs in a compatibility mode — but to be production-ready, set it up now:
225+
The Nitro Enclave is required to submit verified scores. The enclave runs the `slcl-nautilus` binary inside the sealed hardware environment and signs every score with a key that never leaves it.
226+
227+
### Debug mode vs production mode
228+
229+
The enclave can run in two modes — **use production mode for everything except local development**:
230+
231+
| | Debug mode | Production mode |
232+
|---|---|---|
233+
| How to start | `--debug-console` flag | No extra flag |
234+
| PCR values | All zeros in attestation | Real SHA-384 measurements |
235+
| On-chain registration | **Will be rejected** — zeros fail PCR check | ✅ Accepted |
236+
| Enclave console | Readable via `nitro-cli console` | Not accessible |
237+
| Use for | Diagnosing crashes during setup | Everything else |
199238
239+
To check which mode your enclave is running:
200240
```bash
201-
# Install nitro-cli, download the enclave EIF, create systemd service
202-
curl -sSf https://raw.githubusercontent.com/VRAM-AI/VRAM-HUB/master/scripts/start-validator.sh | bash
241+
nitro-cli describe-enclaves | python3 -m json.tool
242+
# "Flags": "NONE" → production mode ✅
243+
# "Flags": "DEBUG_MODE" → debug mode — registration will be rejected
244+
```
245+
246+
### Start the enclave
247+
248+
```bash
249+
# Install nitro-cli, download the enclave EIF, create systemd services
250+
curl -sSf https://raw.githubusercontent.com/VRAM-AI/VRAM-HUB/master/scripts/enclave-setup.sh | bash
251+
```
252+
253+
The script starts the enclave in **production mode** and creates:
254+
- `slcl-nautilus.service` — runs the enclave
255+
- `vram-vsock-bridge.service` — socat bridge (TCP 3000 → vsock CID 16:3000)
256+
257+
Verify it started correctly:
258+
```bash
259+
nitro-cli describe-enclaves # Flags must be "NONE"
260+
curl http://localhost:3000/health_check # must return: ok
261+
```
262+
263+
### Register on-chain (one-time per enclave)
203264
204-
# Register the enclave on-chain (one-time — or after every enclave restart)
205-
cargo run --bin vramhub-cli -- register-enclave \
265+
```bash
266+
source ~/.env
267+
vram-cli register-validator # prints VRAMHUB_VALIDATOR_UID=N
268+
echo 'VRAMHUB_VALIDATOR_UID=N' >> ~/.env # replace N
269+
source ~/.env
270+
271+
vram-cli register-enclave \
206272
--enclave-url http://localhost:3000 \
207273
--validator-uid $VRAMHUB_VALIDATOR_UID
208274
```
209275
210-
After registration you'll see:
276+
After success:
211277
```
212-
INFO: Enclave registered successfully pubkey=a3f9...
278+
Enclave registered successfully.
279+
VRAMHUB_ENCLAVE_PUBKEY=42c3adc8...
213280
```
214281
215282
Add to `.env`:
216283
```bash
217-
VRAMHUB_NITRO_ENCLAVE=true
218-
VRAMHUB_ENCLAVE_PUBKEY=a3f9... # from the line above
219-
VRAMHUB_ENCLAVE_OBJECT_ID=0x... # printed after register-enclave
284+
VRAMHUB_ENCLAVE_PUBKEY=42c3adc8...
285+
VRAMHUB_ENCLAVE_URL=http://localhost:3000
286+
VRAMHUB_TEST_MODE=false
220287
```
221288
289+
> **Note:** You must re-run `register-enclave` any time the enclave EIF is rebuilt (PCR values change when code changes). The validator UID stays the same — only the enclave registration needs to be re-done.
290+
222291
---
223292
224293
## How rewards work
@@ -242,15 +311,63 @@ Current testnet: [VRAMScan Explorer](https://suiscan.xyz/testnet/object/0x48703e
242311
**"compile_error: must be built on Linux"**
243312
The validator only runs on Linux. Use an EC2 instance, not your local machine.
244313
245-
**"Nitro Enclave not available"**
246-
Your instance type doesn't support Nitro. Launch an `m7i.xlarge`, `c5.xlarge`, or any `m5`/`c5`/`r5` instance. `t3` instances do not support Nitro.
314+
**"Nitro Enclave not available" or `nitro-cli: command not found`**
315+
Your instance was launched without Nitro Enclave support enabled. This cannot be fixed on a running instance — terminate it and relaunch with **Nitro Enclave: Enable** checked in Advanced details. See the instance type table above; `t3`, `t4g`, and ARM instances do not support Nitro.
247316
248317
**"MissingEnvVar: VRAMHUB_WALLET_MNEMONIC"**
249318
Your `.env` file isn't loaded. Run `source .env` before `vram-validator`, or use the systemd service which loads it automatically.
250319
320+
**Enclave shows `Flags: DEBUG_MODE` instead of `NONE`**
321+
The enclave was started with `--debug-console`. Stop it and restart without that flag:
322+
```bash
323+
sudo nitro-cli terminate-enclave --enclave-name slcl-nautilus
324+
sudo nitro-cli run-enclave \
325+
--eif-path /opt/vram/slcl-nautilus.eif \
326+
--memory 4096 \
327+
--cpu-count 2 \
328+
--enclave-cid 16
329+
nitro-cli describe-enclaves # confirm Flags: NONE
330+
```
331+
332+
**`ArityMismatch in command 0` during register-validator**
333+
The CLI binary is out of date. Pull the latest and rebuild:
334+
```bash
335+
cd ~/vramhub-validator && git pull
336+
cargo build --release -p slcl-cli
337+
sudo cp target/release/slcl-cli /usr/local/bin/vram-cli
338+
```
339+
340+
**`InsufficientStake` during register-validator**
341+
The contract requires 10 SUI stake minimum. Make sure you have SUI in your wallet (`sui client balance`) and the latest `vram-cli` binary which passes the correct stake.
342+
343+
**`E_ALREADY_REGISTERED` during register-validator**
344+
Your address is already registered. Query your existing UID:
345+
```bash
346+
vram-cli status
347+
```
348+
349+
**Health check returns empty / connection refused**
350+
The vsock bridge is not running. Start it:
351+
```bash
352+
sudo systemctl start vram-vsock-bridge
353+
sudo systemctl status vram-vsock-bridge
354+
curl http://localhost:3000/health_check # should return: ok
355+
```
356+
If the bridge is running but curl still fails, the enclave may have crashed. Check:
357+
```bash
358+
nitro-cli describe-enclaves # confirm State: RUNNING
359+
sudo journalctl -u slcl-nautilus -n 50 --no-pager
360+
```
361+
251362
**Scores not submitting**
252-
Check that the enclave is running: `curl http://localhost:3000/health_check`
253-
If it returns nothing, restart the enclave service: `sudo systemctl restart slcl-nautilus`
363+
Check that the enclave is running and in production mode:
364+
```bash
365+
nitro-cli describe-enclaves # State: RUNNING, Flags: NONE
366+
curl http://localhost:3000/health_check # ok
367+
curl http://localhost:3000/get_attestation | python3 -m json.tool | grep test_mode
368+
# must show: "test_mode": false
369+
```
370+
If `test_mode` is true, set `VRAMHUB_TEST_MODE=false` in `.env` and restart the validator.
254371
255372
---
256373

0 commit comments

Comments
 (0)