This document provides instructions for setting up a local development environment for the Lumino Contracts Client.
Before you begin, ensure you have the following:
- Python 3.11
- pip
- Git
- Foundry (for smart contract interactions)
- Access to the required repositories:
- contracts repository
- pipeline-zen repository
- this contracts-client repository
Clone the required repositories in the same parent directory:
mkdir lumino-dev
cd lumino-dev
git clone <contracts-repo-url> contracts
git clone <pipeline-zen-repo-url> pipeline-zen
git clone <contracts-client-repo-url> contracts-clientIf you have previously used the Lumino client, backup your existing configuration:
mv ~/.lumino ~/.lumino.bak- Start a local Ethereum node with Anvil:
anvil- Configure the contracts environment:
Create and populate ../contracts/.env from ../contracts/example.env
- Export the environment variables:
cd ../contracts
export $(grep -v '^#' .env | xargs)- Deploy the contracts:
./deploy.shThis creates a ../contracts/addresses.json file with the contract addresses.
Ensure the pipeline-zen repository has the correct configuration:
- Create and populate
../pipeline-zen/.env:
PZ_ENV=local
PZ_DEVICE=cpu
PZ_HUGGINGFACE_TOKEN=check 1password
- Create your local environment file:
cd ../contracts-client
cp example.env .env-
Edit
.envwith your specific configuration values. -
Install the client in editable mode:
pip install -Ue .Whitelist your test node address and transfer tokens to the node and client addresses:
export NODE_ADDRESS=...
export CLIENT_ADDRESS=...
export LUMINO_TOKEN_ADDRESS=get this from ../contracts/addresses.json
export WHITELIST_MANAGER_ADDRESS=get this from ../contracts/addresses.json
export RPC_URL=http://localhost:8545
export DEPLOYER_PRIVATE_KEY=...
cast send $LUMINO_TOKEN_ADDRESS "transfer(address,uint256)" $NODE_ADDRESS $TOKENS_50000 --private-key $DEPLOYER_PRIVATE_KEY --rpc-url $RPC_URL
cast send $LUMINO_TOKEN_ADDRESS "transfer(address,uint256)" $CLIENT_ADDRESS $TOKENS_50000 --private-key $DEPLOYER_PRIVATE_KEY --rpc-url $RPC_URL
cast send $WHITELIST_MANAGER_ADDRESS "addCP(address)" $NODE_ADDRESS --private-key $DEPLOYER_PRIVATE_KEY --rpc-url $RPC_URLlumino-nodeThis will start the node client, which will:
- Register with the network
- Participate in leader election
- Accept and execute jobs when assigned
Test the entire pipeline with a dummy job:
lumino-client create-job --args '{"shuffle": true, "use_lora": true, "use_qlora": false, "batch_size": 4, "dataset_id": "gs://lum-dev-pipeline-zen-datasets/0ca98b07-9366-4a31-8c83-569961c90294/2024-12-17_21-57-21_text2sql.jsonl", "num_epochs": 1, "job_config_name": "llm_dummy"}' --model llm_dummy --ft_type "LORA" --monitorRun the unit test suite:
pip install -r requirements-test.txt
pytestRun the end-to-end integration tests:
pytest tests_e2eThe client is organized into the following main components:
src/lumino/contracts_client/client.py- Base client functionalitysrc/lumino/contracts_client/node_client.py- Node-specific client logicsrc/lumino/contracts_client/user_client.py- User-specific client logicsrc/lumino/contracts_client/config.py- Configuration handlingsrc/lumino/contracts_client/utils.py- Utility functionssrc/lumino/contracts_client/compute_power.py- Compute resource pool detection
- Implement your changes in the appropriate module
- Add tests for your changes
- Verify that all tests pass
- Update documentation if necessary
- Submit a pull request