Skip to content

Commit fcffa41

Browse files
Merge remote-tracking branch 'origin/develop' into feat/add-instantMatch-example
# Conflicts: # acurast.json
2 parents 9838519 + 7f855e8 commit fcffa41

7 files changed

Lines changed: 325 additions & 9 deletions

File tree

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,47 @@ ACURAST_MNEMONIC=abandon abandon about ...
167167
- Second element: The address of the original deployer
168168
- Third element: The deployment ID
169169
- Example: `["Acurast", "5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL", 123456]`
170+
- `benchmarkFilters` (optional): Minimum benchmark requirements used to filter eligible processors.
171+
- `minMemoryBytes`: Minimum total RAM in bytes.
172+
- `minCpuSingleCoreScore`: Minimum single-core CPU score.
173+
- `minStorageBytes`: Minimum total storage in bytes.
174+
- `minStorageIoScore`: Minimum storage I/O score.
175+
- `poolIds` (advanced): Override compute-pallet benchmark pool IDs.
176+
177+
### Benchmark Filters
178+
179+
You can constrain deployments to processors that satisfy minimum benchmark values.
180+
Benchmark filters can be configured in `acurast.json` and/or passed via deploy flags.
181+
182+
Config example:
183+
184+
```json
185+
{
186+
"projects": {
187+
"example": {
188+
"benchmarkFilters": {
189+
"minMemoryBytes": 4000000000,
190+
"minCpuSingleCoreScore": 1000,
191+
"minStorageBytes": 64000000000,
192+
"minStorageIoScore": 500
193+
}
194+
}
195+
}
196+
}
197+
```
198+
199+
Deploy flag examples (can be combined):
200+
201+
```bash
202+
acurast deploy --min-memory 4GB --min-cpu-score 1000 --min-storage 64GB --min-io-score 500
203+
```
204+
205+
Notes:
206+
207+
- CLI flags merge with `benchmarkFilters` from `acurast.json`.
208+
- `--min-memory` and `--min-storage` accept human-readable byte sizes (for example `4GB`, `512MiB`).
209+
- During deploy, matcher `check` validates whether enough processors match at the current reward.
210+
- Per-processor address lists are shown from on-chain `acurastMarketplace.assignedProcessors` after match.
170211

171212
#### .env
172213

acurast.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,39 @@
293293
"maxCostPerExecution": 1000000000,
294294
"includeEnvironmentVariables": [],
295295
"processorWhitelist": []
296+
},
297+
"cargo-hello": {
298+
"projectName": "cargo-hello",
299+
"fileUrl": "examples/app",
300+
"entrypoint": "start.sh",
301+
"runtime": "Shell",
302+
"image": {
303+
"url": "https://github.com/termux/proot-distro/releases/download/v4.30.1/ubuntu-questing-aarch64-pd-v4.30.1.tar.xz",
304+
"sha256": "5ab35b90cd9a9f180656261ba400a135c4c01c2da4b74522118342f985c2d328"
305+
},
306+
"restartPolicy": "no",
307+
"network": "canary",
308+
"onlyAttestedDevices": true,
309+
"assignmentStrategy": {
310+
"type": "Single"
311+
},
312+
"execution": {
313+
"type": "interval",
314+
"intervalInMs": 3600000,
315+
"numberOfExecutions": 1
316+
},
317+
"maxAllowedStartDelayInMs": 10000,
318+
"usageLimit": {
319+
"maxMemory": 0,
320+
"maxNetworkRequests": 0,
321+
"maxStorage": 0
322+
},
323+
"numberOfReplicas": 2,
324+
"requiredModules": [],
325+
"minProcessorReputation": 0,
326+
"maxCostPerExecution": 200000000000,
327+
"includeEnvironmentVariables": ["WEBHOOK_URL"],
328+
"processorWhitelist": []
296329
}
297330
}
298331
}

examples/app/hello.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import json
2+
import os
3+
import socket
4+
import time
5+
6+
import requests
7+
8+
BRIDGE_SOCKET = os.environ["BRIDGE_SOCKET"]
9+
WEBHOOK_URL = os.environ["WEBHOOK_URL"]
10+
11+
12+
def get_public_key() -> str:
13+
request = json.dumps({
14+
"jsonrpc": "2.0",
15+
"method": "signer_publicKey",
16+
"params": [{"curve": "p256"}],
17+
"id": "1",
18+
}) + "\n"
19+
20+
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as sock:
21+
sock.connect("\0" + BRIDGE_SOCKET)
22+
sock.sendall(request.encode())
23+
response = b""
24+
while True:
25+
chunk = sock.recv(4096)
26+
if not chunk:
27+
break
28+
response += chunk
29+
if b"\n" in chunk:
30+
break
31+
32+
return json.loads(response)["result"]["publicKey"]
33+
34+
35+
def main():
36+
37+
time.sleep(3600) # Wait for the bridge to be ready
38+
39+
public_key = get_public_key()
40+
url = WEBHOOK_URL.rstrip("/") + "/hello"
41+
resp = requests.post(url, json={"publicKey": public_key})
42+
print(resp.status_code, resp.text)
43+
44+
45+
if __name__ == "__main__":
46+
main()

examples/app/start.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
3+
# This script is executed when the container starts. It sets up the environment and runs the main application.
4+
5+
# Set up environment variables and configurations - TODO: This should be part of the processor application and not be required in the future.
6+
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
7+
export HOME=/root
8+
9+
echo "nameserver 8.8.8.8" > /etc/resolv.conf
10+
11+
# Install necessary dependencies and run the main application
12+
apt-get update
13+
apt-get install -y python3-requests
14+
python3 "$(dirname "$0")/hello.py"

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@acurast/cli",
3-
"version": "0.8.1",
3+
"version": "0.8.2",
44
"description": "A cli to interact with the Acurast Cloud.",
55
"main": "dist/index.js",
66
"bin": {
@@ -33,7 +33,7 @@
3333
"dependencies": {
3434
"@acurast/dapp": "^1.0.1",
3535
"@acurast/devtools": "^1.0.1",
36-
"@acurast/sdk": "^1.1.0",
36+
"@acurast/sdk": "^1.2.0",
3737
"@inquirer/prompts": "^5.0.5",
3838
"@polkadot/api": "^16.1.2",
3939
"@polkadot/api-augment": "^16.1.2",

0 commit comments

Comments
 (0)