Skip to content

Commit c673798

Browse files
feat: Add comprehensive federated learning, LLM inference, and IPFS storage infrastructure (#16)
* Update client configuration * feat: add llm command to CLI * feat: enhance README and add LLM model listing command to CLI * refactor: update configuration for Filecoin integration - Change Ethereum references to Filecoin in .env.sample and related CLI files - Adjust server settings and API endpoints accordingly * feat: add federated learning commands and client - Implement federated learning session management commands in CLI - Create a new FederatedLearningClient for session operations - Add storage management commands for IPFS/Filecoin integration - Update configuration structure for Filecoin settings * feat: update .env.sample for IPFS/Filecoin and Federated Learning configurations - Add new environment variables for IPFS storage settings and federated learning parameters * feat: update README with detailed configuration for Filecoin and Federated Learning - Reorganize environment variables and clarify settings for Filecoin network and federated learning parameters * feat: Standardize federated learning commands and add comprehensive API docs - Standardized all FL command structures with consistent patterns - Added GetTrainedModel client method for model retrieval - Enhanced configuration with proper FederatedLearning section - Fixed URL construction in federated learning client - Added comprehensive API reference documentation - Implemented consistent help text and examples across all FL commands - Added proper flag validation and error handling * refactor: remove emoji from print statements in federated learning, llm, and storage commands for consistency * feat: add comprehensive federated learning CLI commands - Implement complete FL session lifecycle management (create, start, get, list) - Add federated learning commands with extensive configuration options - Support for dataset upload with IPFS/Filecoin integration - Add model update submission with gradients file support - Implement trained model retrieval and export functionality - Add differential privacy configuration options - Support for custom model configuration files - Add comprehensive parameter validation and error handling - Include detailed CLI examples and usage documentation - Integrate with wallet authentication system for FL operations * feat: add comprehensive data partitioning for truly distributed federated learning - Implement 5 partitioning strategies: random, stratified, sequential, non-IID (Dirichlet), and label skew - Add PartitionConfig struct with configurable parameters (alpha, min_samples, overlap_ratio) - Update TrainingDataInfo to include metadata for partition configuration - Enhance CLI commands with partitioning flags (--alpha, --min-samples, --overlap-ratio) - Add LoadPartitionedData method to support distributed data loading - Create comprehensive test script for all partitioning strategies - Add detailed documentation for data partitioning functionality This enables truly distributed federated learning where each participant trains on different subsets of data, simulating realistic FL scenarios with data heterogeneity and privacy-preserving data separation. * docs: add comprehensive documentation for data partitioning functionality * docs: add comprehensive documentation for FL weights fix - Document the root cause of empty weights issue - Explain the technical solution across all three repositories - Provide code examples showing before/after states - Include testing instructions and benefits achieved - Add technical notes for future reference * docs: update README and federated learning commands for enhanced clarity and required parameters - Revise README to include detailed federated learning features and usage instructions - Add model configuration examples and clarify required parameters for session creation - Update CLI commands to enforce required flags for aggregation method, learning rate, batch size, and local epochs - Improve error handling for missing model configuration - Enhance documentation for differential privacy and data partitioning strategies * chore: update .env.sample and CLI commands to reflect USDFC token usage - Revise .env.sample to include new server and blockchain identity configurations - Update CLI commands to replace PRTY with USDFC for token balance and stake operations - Add new configuration options for logging, caching, and security settings - Introduce GetReputationCommand in command structure * chore: clean up .env.sample by removing unnecessary comments - Removed comments regarding the importance of the client and private key requirements - Streamlined the configuration options for better clarity * feat: implement gologger improvements and cleanup - Add DisableTimestamp support to gologger - Remove outdated documentation and test files - Clean up repository structure - Enhance logging configuration options * fix: update gologger submodule to latest main commit - Point gologger to commit 768e1ca (latest main) - Ensure consistency across all repositories * feat: update gologger with LOG_DISABLE_TIMESTAMP support - Update gologger submodule to commit 2e729e3 - Add environment variable support for disabling timestamps - Enable runtime control of timestamp display * fix: update gologger with ConfigForMode environment variable support - Update gologger submodule to commit 3a60352 - Fix LOG_DISABLE_TIMESTAMP being ignored when using InitWithMode - Ensure environment variables are respected across all logging modes * fix: update gologger to resolve infinite recursion - Update gologger submodule to commit 032e8ba - Fix stack overflow caused by recursive DefaultConfig/ConfigForMode calls - Ensure LOG_DISABLE_TIMESTAMP works properly without crashes * fix: update API endpoint paths in proxy and task handlers - Modify target URL in proxy handler to include '/api/' prefix - Update upload URL in task handler to use '/api/v1/tasks' path * fix: update repository clone URL in README.md * refactor: update configuration and service references from Filecoin to Blockchain - Rename FilecoinNetwork to BlockchainNetwork in config and related files - Update environment variables in .env.sample and README.md - Refactor wallet adapter initialization to use BlockchainNetwork settings - Modify storage service references to reflect the change from Filecoin to Blockchain - Clean up related comments and documentation for clarity * refactor: improve resource cleanup and logging in client and service files - Update response body and file closure handling to log errors on close - Remove unnecessary linter configurations in .golangci.yml - Simplify lint command in Makefile - Ensure proper error handling for port listener closure in network.go - Enhance error handling for JSON body reading in http.go * chore: update golangci-lint action version in workflow - Upgrade golangci-lint-action from v3 to v4 - Specify golangci-lint version as v2.2.2 for consistency * chore: simplify golangci-lint arguments in workflow - Remove unnecessary output format argument from golangci-lint action configuration * chore: remove timeout argument from golangci-lint action in workflow * chore: update golangci-lint configuration and workflow - Disable all linters by default and selectively enable necessary ones in .golangci.yml - Update local-prefixes for goimports to reflect new repository structure - Downgrade golangci-lint-action from v4 to v3 and update version to v1.54.2 in workflow - Adjust golangci-lint arguments for improved output formatting and timeout settings * chore: remove golangci-lint configuration file * chore: update golangci-lint configuration to enable additional linters - Add govet, ineffassign, and unused linters to .golangci.yml for improved code quality checks * chore: update golangci-lint configuration to remove unnecessary linters and adjust local-prefixes - Remove govet, ineffassign, and unused linters from .golangci.yml - Update local-prefixes for goimports to reflect new repository structure * chore: update Go version in code quality workflow to 1.22 * chore: update golangci-lint configuration and workflow - Add new linter for handling internal import errors in .golangci-ci.yml - Upgrade Go toolchain version to 1.24.5 in go.mod - Update Go version to 1.23 and golangci-lint version to latest in code quality workflow
1 parent c413c62 commit c673798

27 files changed

Lines changed: 3741 additions & 150 deletions

.env.sample

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
1-
# Runner config
2-
RUNNER_WEBHOOK_PORT=
3-
RUNNER_API_PREFIX=
4-
RUNNER_SERVER_URL=
5-
6-
# Server config
7-
SERVER_HOST=
8-
SERVER_PORT=
9-
SERVER_ENDPOINT=
10-
11-
# Ethereum config
12-
ETHEREUM_TOKEN_ADDRESS=
13-
ETHEREUM_STAKE_WALLET_ADDRESS=
14-
ETHEREUM_CHAIN_ID=
15-
ETHEREUM_RPC=
1+
# PLGenesis Server Configuration
2+
SERVER_URL="http://localhost:8080"
3+
SERVER_HOST="localhost"
4+
SERVER_PORT=8080
5+
SERVER_ENDPOINT="/api/v1"
6+
7+
# Blockchain Network Configuration
8+
BLOCKCHAIN_RPC="https://your-blockchain-node.com"
9+
BLOCKCHAIN_CHAIN_ID=1
10+
TOKEN_ADDRESS="0xYourTokenAddressHere"
11+
TOKEN_SYMBOL=PRTY
12+
STAKE_WALLET_ADDRESS="0xYourStakeWalletAddressHere"
13+
14+
# Smart Contract Addresses
15+
REPUTATION_CONTRACT_ADDRESS="0x..."
16+
17+
# Blockchain Identity Configuration
18+
PRIVATE_KEY=""
19+
20+
# IPFS Storage Configuration
21+
IPFS_ENDPOINT="https://api.web3.storage"
22+
GATEWAY_URL="https://gateway.ipfs.io"
23+
24+
# Task Configuration
25+
TASK_MAX_REWARD=100.0 # Token reward
26+
27+
# Logging Configuration
28+
LOG_FILE_PATH="./logs/client.log"

.github/workflows/code-quality.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,24 @@ jobs:
1010
lint:
1111
name: Linting
1212
runs-on: ubuntu-latest
13+
env:
14+
GOTOOLCHAIN: local
1315
steps:
1416
- uses: actions/checkout@v3
1517
with:
1618
submodules: recursive
1719
- name: Set up Go
1820
uses: actions/setup-go@v4
1921
with:
20-
go-version: "1.21"
22+
go-version: "1.23"
2123
cache: true
2224
- name: Run golangci-lint
2325
uses: golangci/golangci-lint-action@v3
26+
env:
27+
GOTOOLCHAIN: local
2428
with:
2529
version: latest
26-
args: --timeout=5m --out-format=colored-line-number
30+
args: --timeout=5m --out-format=colored-line-number --config=.golangci-ci.yml
2731
skip-cache: true
2832
skip-pkg-cache: true
2933
skip-build-cache: true

.golangci-ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
linters:
2+
disable-all: true
3+
enable:
4+
- govet
5+
- ineffassign
6+
- unused
7+
8+
run:
9+
timeout: 5m
10+
concurrency: 4
11+
tests: true
12+
13+
issues:
14+
exclude-dirs:
15+
- vendor
16+
- node_modules
17+
- tmp
18+
max-issues-per-linter: 0
19+
max-same-issues: 0
20+
exclude-use-default: false
21+
exclude-rules:
22+
- path: _test\.go
23+
linters:
24+
- errcheck
25+
- text: "could not import sync/atomic"
26+
linters:
27+
- typecheck
28+
- text: "unsupported version: 2"
29+
linters:
30+
- typecheck
31+
- text: "could not load export data: internal error in importing"
32+
linters:
33+
- goanalysis_metalinter
34+
35+
output:
36+
sort-results: true
37+
38+
linters-settings:
39+
gofmt:
40+
simplify: true
41+
goimports:
42+
local-prefixes: "github.com/theblitlabs/parity-runner"

.golangci.yml

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,40 @@
11
linters:
2+
disable-all: true
23
enable:
3-
- errcheck
4-
- gosimple
54
- govet
65
- ineffassign
7-
- staticcheck
8-
- typecheck
96
- unused
107
disable:
11-
- exhaustruct # Can be noisy
12-
- wsl # Whitespace linting can be too strict
13-
- gofmt # Temporarily disabled
14-
- goimports # Temporarily disabled
8+
- errcheck
9+
- staticcheck
1510

1611
run:
1712
timeout: 5m
1813
concurrency: 4
19-
issues-exit-code: 1
2014
tests: true
2115

22-
# Default is 3 lines of context, which is often insufficient
23-
output:
24-
sort-results: true
25-
2616
issues:
2717
exclude-dirs:
2818
- vendor
2919
- node_modules
3020
- tmp
31-
# Maximum issues count per one linter
3221
max-issues-per-linter: 0
33-
# Maximum count of issues with the same text
3422
max-same-issues: 0
3523
exclude-use-default: false
3624
exclude-rules:
3725
- path: _test\.go
38-
linters:
39-
- errcheck # Allow unchecked errors in tests
40-
- text: "Error return value of `.*(Close|Flush)` is not checked"
4126
linters:
4227
- errcheck
43-
- text: "shadow: declaration of"
44-
linters:
45-
- govet
28+
29+
# Default is 3 lines of context, which is often insufficient
30+
output:
31+
sort-results: true
4632

4733
# Settings for specific linters
4834
linters-settings:
4935
gofmt:
5036
simplify: true
5137
goimports:
52-
local-prefixes: "github.com/theblitlabs/parity-protocol"
38+
local-prefixes: "github.com/theblitlabs/parity-runner"
39+
40+
version: "2"

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,14 @@ lint: ## Run linting with options (make lint VERBOSE=true CONFIG=custom.yml OUTP
112112
@if [ -n "$(CONFIG)" ]; then \
113113
FINAL_LINT_FLAGS="$(FINAL_LINT_FLAGS) --config=$(CONFIG)"; \
114114
else \
115-
FINAL_LINT_FLAGS="$(FINAL_LINT_FLAGS) --config=$(LINT_CONFIG)"; \
115+
FINAL_LINT_FLAGS="$(FINAL_LINT_FLAGS)"; \
116116
fi
117117
@if [ -n "$(OUTPUT)" ]; then \
118118
FINAL_LINT_FLAGS="$(FINAL_LINT_FLAGS) --out-format=$(OUTPUT)"; \
119119
else \
120120
FINAL_LINT_FLAGS="$(FINAL_LINT_FLAGS) --out-format=$(LINT_OUTPUT_FORMAT)"; \
121121
fi
122-
$(GOLANGCI_LINT) run $(FINAL_LINT_FLAGS)
122+
golangci-lint run $(FINAL_LINT_FLAGS)
123123

124124
format-lint: format lint ## Format code and run linters in one step
125125

0 commit comments

Comments
 (0)