Skip to content

Commit b7b0847

Browse files
committed
Add comprehensive guide for managing app access control and pricing
- Introduced a new guide on app access control and pricing, detailing the creation and management of app orders using the iExec SDK CLI. - Removed outdated and underdeveloped pages related to managing iApps, orders, and emerging trends. - Updated the TDX experimental guide with detailed instructions on enabling TDX, its differences from SGX, and current limitations. - Enhanced the iApp Generator documentation with a complete overview of its features, quick start paths, and real-world examples of iApps. - Cleaned up various underdeveloped pages and added a new guide on monetizing protected data.
1 parent eaecd19 commit b7b0847

17 files changed

+1915
-130
lines changed

.vitepress/sidebar.ts

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -343,15 +343,10 @@ export function getSidebar() {
343343
{ text: '❓ What Is an iApp?', link: '/build-iapp/what-is-iapp' },
344344
{
345345
text: '📖 Guides',
346-
link: '/build-iapp/guides',
347346
items: [
348347
{
349348
text: 'Manage Your iApps',
350-
link: '/build-iapp/guides/manage-iapps',
351-
},
352-
{
353-
text: 'Orders (how they work, how to manage them)',
354-
link: '/build-iapp/guides/orders',
349+
link: '/build-iapp/guides/manage-iapp',
355350
},
356351
{
357352
text: 'Inputs and Outputs (types, differences, formats)',
@@ -369,20 +364,11 @@ export function getSidebar() {
369364
text: 'How to Get and Decrypt Results',
370365
link: '/build-iapp/guides/how-to-get-and-decrypt-results',
371366
},
372-
{
373-
text: 'AI Frameworks',
374-
link: '/build-iapp/guides/ai-frameworks',
375-
},
376-
{
377-
text: 'Other Emerging Trends',
378-
link: '/build-iapp/guides/other-emerging-trends',
379-
},
380367
],
381368
},
382369
{
383370
text: '🤖 iApp Generator',
384371
link: '/build-iapp/iapp-generator',
385-
collapsed: true,
386372
items: [
387373
{
388374
text: 'Getting Started',
@@ -392,20 +378,8 @@ export function getSidebar() {
392378
text: 'Building Your iApp',
393379
link: '/build-iapp/iapp-generator/building-your-iexec-app',
394380
},
395-
{
396-
text: 'References',
397-
link: '/build-iapp/iapp-generator/references',
398-
},
399-
{
400-
text: 'Advanced Creation',
401-
link: '/build-iapp/iapp-generator/advanced-creation',
402-
},
403381
],
404382
},
405-
{
406-
text: '🔧 Protocol-Level Guides',
407-
link: '/build-iapp/iapp-generator/protocol-level-guides',
408-
},
409383
],
410384
},
411385
],
Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +0,0 @@
1-
---
2-
title: AI Frameworks
3-
description: AI Frameworks for iApps
4-
---
5-
6-
# AI Frameworks
7-
8-
This page is under development.
9-
10-
<!-- TODO: Add the AI frameworks guide -->
Lines changed: 163 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,169 @@
11
---
22
title: Debugging Your iApp
3-
description: Debugging Your iApp
3+
description:
4+
Troubleshoot and optimize your iApp execution in the TEE environment
45
---
56

6-
# Debugging Your iApp
7+
# 🐛 Debugging Your iApp
78

8-
This page is under development.
9+
**When your iApp doesn't work as expected, debugging in the TEE environment
10+
requires specific techniques.** This guide helps you identify issues and
11+
optimize your iApp's performance.
912

10-
<!-- TODO: Add the debugging guide -->
13+
## Task Execution Lifecycle
14+
15+
Understanding how your task progresses through the iExec network:
16+
17+
### Key Stages
18+
19+
1. **Deal Creation** - Orders matched, funds locked
20+
2. **Task Initialization** - Workers selected for execution
21+
3. **iApp Execution** - Your code runs inside TEE
22+
4. **Result Processing** - Results encrypted and uploaded
23+
5. **Task Completion** - Results available for download
24+
25+
**Most failures happen during stages 2-4**
26+
27+
## Monitoring Your Tasks
28+
29+
### iExec Explorer
30+
31+
Track your tasks at [explorer.iex.ec](https://explorer.iex.ec):
32+
33+
- Search by `taskId` or deal ID
34+
- Check status: `PENDING``ACTIVE``COMPLETED/FAILED`
35+
- View error messages if execution fails
36+
37+
### Status in Code
38+
39+
```ts twoslash
40+
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
41+
42+
const web3Provider = getWeb3Provider('PRIVATE_KEY');
43+
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);
44+
// ---cut---
45+
const response = await dataProtectorCore.processProtectedData({
46+
protectedData: '0x123abc...',
47+
app: '0x456def...',
48+
onStatusUpdate: ({ title, isDone }) => {
49+
console.log(`Status: ${title} - Done: ${isDone}`);
50+
},
51+
});
52+
```
53+
54+
## Debug Commands
55+
56+
### Local Testing
57+
58+
```bash
59+
# Test your iApp locally
60+
iapp test --args "model=bert threshold=0.8"
61+
iapp test --secrets "key1=value1,key2=value2"
62+
63+
# Mock protected data for testing
64+
iapp mock protectedData
65+
iapp test --protectedData "mock_name"
66+
```
67+
68+
### Remote Debugging
69+
70+
```bash
71+
# Deploy and run
72+
iapp deploy
73+
iapp run <iapp-address>
74+
75+
# Debug failed executions
76+
iapp debug <taskId>
77+
```
78+
79+
### Task Information
80+
81+
```bash
82+
# View task details
83+
iexec task show <taskId>
84+
85+
# Download results (if completed)
86+
iexec task show <taskId> --download
87+
```
88+
89+
## Common Issues
90+
91+
### ⏱️ **Task Timeout**
92+
93+
- **Cause**: Code takes too long to execute
94+
- **Solution**: Optimize algorithms, reduce input sizes, use appropriate task
95+
category
96+
97+
### 💾 **Memory Issues**
98+
99+
- **Cause**: Loading large files, memory leaks, TEE constraints
100+
- **Solution**: Process data in chunks, use streaming, optimize memory usage
101+
102+
### 📁 **Input/Output Problems**
103+
104+
- **Cause**: Wrong file paths, missing `computed.json`
105+
- **Solution**: Always create `computed.json`, verify environment variables
106+
107+
```python
108+
# Always create computed.json
109+
import json, os
110+
computed = {"deterministic-output-path": f"{os.environ['IEXEC_OUT']}/result.json"}
111+
with open(f"{os.environ['IEXEC_OUT']}/computed.json", 'w') as f:
112+
json.dump(computed, f)
113+
```
114+
115+
## Best Practices
116+
117+
### 🔍 **Input Validation**
118+
119+
```python
120+
import os, sys
121+
122+
# Check required environment variables
123+
if not os.environ.get('IEXEC_IN') or not os.environ.get('IEXEC_OUT'):
124+
print("ERROR: Missing IEXEC_IN or IEXEC_OUT")
125+
sys.exit(1)
126+
127+
# Validate arguments
128+
if len(sys.argv) < 2:
129+
print("ERROR: Missing required arguments")
130+
sys.exit(1)
131+
```
132+
133+
### 📝 **Clear Error Messages**
134+
135+
```python
136+
try:
137+
# Your processing logic
138+
result = process_data(data)
139+
except Exception as e:
140+
print(f"ERROR: Processing failed: {str(e)}")
141+
sys.exit(1)
142+
```
143+
144+
### 🔒 **Safe File Operations**
145+
146+
```python
147+
import os, json
148+
149+
# Always ensure output directory exists
150+
iexec_out = os.environ['IEXEC_OUT']
151+
os.makedirs(iexec_out, exist_ok=True)
152+
153+
# Write results safely
154+
try:
155+
with open(f"{iexec_out}/result.json", 'w') as f:
156+
json.dump(result_data, f)
157+
except Exception as e:
158+
print(f"ERROR: Failed to write results: {e}")
159+
sys.exit(1)
160+
```
161+
162+
## What's Next?
163+
164+
Continue improving your iApps:
165+
166+
- **[Inputs and Outputs](/build_iapp/guides/inputs-and-outputs)** - Handle data
167+
in TEE
168+
- **[How to Get and Decrypt Results](/build_iapp/guides/how-to-get-and-decrypt-results)** -
169+
Retrieve results

0 commit comments

Comments
 (0)