Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/toploc-integration #127

Merged
merged 29 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c1a8b45
add latest changes from smart contracts to include work submission logic
JannikSt Feb 25, 2025
7baa6a2
start local setup with deployed work validation contract
JannikSt Feb 26, 2025
aa8e5f4
sample work submission with contract call on worker
JannikSt Feb 26, 2025
ee19612
ability to submit sample work via python example file and regularly q…
JannikSt Feb 26, 2025
a75ef9f
add proper hex to binary conversion, cleanup
JannikSt Feb 26, 2025
2bf504f
clippy
JannikSt Feb 26, 2025
935bf67
remove print statements
JannikSt Feb 26, 2025
ca43a4f
Merge branch 'develop' into feature/toploc-work-submission
JannikSt Feb 26, 2025
e8856d7
fix makefile docker
JannikSt Feb 26, 2025
0389ddf
add additional functions to get work keys, and work keys since timestamp
JannikSt Feb 28, 2025
69aee73
support e2e flow on worker side with genesys image
JannikSt Feb 28, 2025
9006398
restructure validator and improve general logging
JannikSt Feb 28, 2025
95372a8
clippy
JannikSt Feb 28, 2025
29948a7
fix deprecated fn usage
JannikSt Feb 28, 2025
b86d1ab
use log
mattdf Mar 3, 2025
bea279a
add state persistence, check at most last 24h
mattdf Mar 3, 2025
a9cd738
Merge pull request #133 from PrimeIntellect-ai/fix/optimize-validator
mattdf Mar 3, 2025
38add69
integrate leviticus workers and secure file upload
JannikSt Mar 6, 2025
1e0edf4
allow validator to reject work
JannikSt Mar 6, 2025
e34126d
remove temp. replacement of timestamp
JannikSt Mar 6, 2025
df8e142
fmt
JannikSt Mar 6, 2025
01fb5c2
clippy
JannikSt Mar 6, 2025
d4e037e
change runner, remove logs
JannikSt Mar 7, 2025
fdc599a
improve task bridge setup, remove hardcoded endpoint
JannikSt Mar 7, 2025
0dfb994
Merge branch 'develop' into feature/toploc-work-submission
JannikSt Mar 7, 2025
ef530ad
Merge branch 'develop' into feature/toploc-work-submission
JannikSt Mar 7, 2025
868c99a
remove print
JannikSt Mar 7, 2025
3522132
remove debug
JannikSt Mar 7, 2025
6ae1b7c
clippy
JannikSt Mar 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .tmuxinator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ windows:
- services:
layout: even-horizontal
panes:
- bash -c 'tmux select-pane -T "Worker" && sleep 5 && cd smart-contracts && sh deploy.sh && cd .. && make setup && clear'
- bash -c 'tmux select-pane -T "Worker" && sleep 5 && cd smart-contracts && sh deploy.sh && sh deploy_work_validation.sh && cd .. && make setup && clear'
- bash -c 'tmux select-pane -T "Discovery" && sleep 10 && make watch-discovery'
- bash -c 'tmux select-pane -T "Validator" && sleep 15 && make watch-validator'
- bash -c 'tmux select-pane -T "Orchestrator" && sleep 20 && make watch-orchestrator'
- background:
layout: even-horizontal
layout: even-horizontal
panes:
- bash -c 'tmux rename-window "Prime Dev Services" && docker-compose up'
- bash -c 'while true; do make whitelist-provider; sleep 10; done'
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ transfer-eth-to-pool-owner:

create-domain:
set -a; source ${ENV_FILE}; set +a; \
cargo run -p dev-utils --example create_domain -- --domain-name "$${DOMAIN_NAME:-default_domain}" --domain-uri "$${DOMAIN_URI:-http://default.uri}" --key $${PRIVATE_KEY_FEDERATOR} --rpc-url $${RPC_URL}
cargo run -p dev-utils --example create_domain -- --domain-name "$${DOMAIN_NAME:-default_domain}" --domain-uri "$${DOMAIN_URI:-http://default.uri}" --key $${PRIVATE_KEY_FEDERATOR} --validation-logic $${WORK_VALIDATION_CONTRACT} --rpc-url $${RPC_URL}

create-training-domain:
set -a; source ${ENV_FILE}; set +a; \
Expand Down Expand Up @@ -77,7 +77,7 @@ watch-worker:

watch-validator:
set -a; source ${ENV_FILE}; set +a; \
cargo watch -w validator/src -x "run --bin validator -- --validator-key $${PRIVATE_KEY_VALIDATOR} --rpc-url $${RPC_URL} "
cargo watch -w validator/src -x "run --bin validator -- --validator-key $${PRIVATE_KEY_VALIDATOR} --rpc-url $${RPC_URL} --pool-id 0 --work-validation-contract $${WORK_VALIDATION_CONTRACT}"

watch-orchestrator:
set -a; source ${ENV_FILE}; set +a; \
Expand Down
2 changes: 2 additions & 0 deletions dev-utils/examples/create_domain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ async fn main() -> Result<()> {
.unwrap();

let domain_name = args.domain_name.clone();

let validation_logic = Address::from_str(&args.validation_logic).unwrap();
let domain_uri = args.domain_uri.clone();

Expand All @@ -56,6 +57,7 @@ async fn main() -> Result<()> {
.create_domain(domain_name, validation_logic, domain_uri)
.await;
println!("Creating domain: {}", args.domain_name);
println!("Validation logic: {}", args.validation_logic);
println!("Transaction: {:?}", tx);

// TODO: Should print actual domain id here
Expand Down
32 changes: 32 additions & 0 deletions examples/python/work_validation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import socket
import time
import json
import os
import platform

def get_default_socket_path() -> str:
"""Returns the default socket path based on the operating system."""
return "/tmp/com.prime.worker/metrics.sock" if platform.system() == "Darwin" else "/var/run/com.prime.worker/metrics.sock"

def send_message(metric: dict, socket_path: str = None) -> bool:
socket_path = socket_path or os.getenv("PRIME_TASK_BRIDGE_SOCKET", get_default_socket_path())
print("Sending message to socket: ", socket_path)

try:
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as sock:
sock.connect(socket_path)
message = json.dumps(metric) + "\n"
sock.sendall(message.encode())
return True
except Exception as e:
print(f"Failed to send message: {e}")
return False

if __name__ == "__main__":
file_sha = "b59ef2af5837d44a670ec6731cca834a533033c83a81dd308f1a55c5a45e4453"
file_name = "out_7bcd49e0-1e99-45a8-b9bb-ffb58f0f1f12.jsonl"

if send_message({"file_sha": file_sha, "file_name": file_name}):
print(f"Sent: {file_sha} {file_name}")
else:
print(f"Failed to send: {file_sha} {file_name}")
52 changes: 52 additions & 0 deletions shared/artifacts/abi/compute_pool.json
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,35 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "invalidateWork",
"inputs": [
{
"name": "poolId",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "data",
"type": "bytes",
"internalType": "bytes"
}
],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
},
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "isNodeBlacklistedFromPool",
Expand Down Expand Up @@ -988,6 +1017,29 @@
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "submitWork",
"inputs": [
{
"name": "poolId",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "node",
"type": "address",
"internalType": "address"
},
{
"name": "data",
"type": "bytes",
"internalType": "bytes"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "supportsInterface",
Expand Down
12 changes: 6 additions & 6 deletions shared/artifacts/abi/deployments.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"AIToken": "0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1",
"ComputePool": "0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1",
"ComputeRegistry": "0x68B1D87F95878fE05B998F19b66F4baba5De1aed",
"DomainRegistry": "0x3Aa5ebB10DC797CAC828524e59A333d0A371443c",
"PrimeNetwork": "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE",
"StakeManager": "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d"
"AIToken": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
"ComputePool": "0x0165878A594ca255338adfa4d48449f69242Eb8F",
"ComputeRegistry": "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
"DomainRegistry": "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
"PrimeNetwork": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
"StakeManager": "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9"
}
23 changes: 23 additions & 0 deletions shared/artifacts/abi/prime_network.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,29 @@
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "invalidateWork",
"inputs": [
{
"name": "poolId",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "penalty",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "data",
"type": "bytes",
"internalType": "bytes"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "registerProvider",
Expand Down
Loading
Loading