mirror of
https://github.com/luxfi/consensus.git
synced 2026-09-24 00:26:58 +00:00
Add GPU orchestrator to quasar protocol for hardware-accelerated consensus: GPU Orchestrator (protocol/quasar/gpu*.go): - gpu.go: Pure Go stub implementation (default, !cgo build tag) - gpu_cgo.go: CGO implementation integrating crypto/gpu and corona/gpu - gpu_test.go: Comprehensive test suite for GPU operations Features: - BLS batch verification and signature aggregation - ML-DSA post-quantum signature operations - Threshold signature context (keygen, partial sign, combine) - Batch hashing (SHA3-256, SHA3-512, BLAKE3) - Corona GPU operations (NTT, polynomial ops, sampling) - Block verification combining BLS and threshold signatures The GPU orchestrator follows the composable architecture: - gpu.go (pure Go default) / gpu_cgo.go (CGO opt-in) - Integrates with corona/gpu for post-quantum threshold signatures - Works seamlessly with and without CGO enabled Also includes dependency updates and minor fixes.
Example 01: Simple Bridge Integration
This example demonstrates basic integration with the Lux DEX cross-chain bridge.
What It Shows
- Creating a cross-chain bridge connection
- Adding supported chains
- Initiating transfers between chains
- Monitoring transfer status
Run the Example
cd examples/01-simple-bridge
go run main.go
Run the Tests
go test -v
Expected Output
=== Bridge Setup ===
✓ Created bridge with 2 chains
✓ Exchange rate ETH → LUX: 1500
=== Transfer Test ===
→ Initiating transfer: 1.5 ETH from Ethereum to Lux
✓ Transfer initiated: tx_abc123...
✓ Waiting for confirmations...
✓ Transfer completed in 3.2s
=== Verification ===
✓ Transfer verified
✓ Amount: 1.5 ETH = 2250 LUX
✓ Status: Completed
Key Files
main.go- Interactive example demonstrating bridge usagebridge_test.go- Comprehensive tests you can rungo.mod- Dependencies (DEX bridge package)
Play With It
Try modifying:
- Transfer amounts
- Add more chains
- Change exchange rates
- Test error scenarios
Integration Pattern
This shows the basic pattern for using the production DEX bridge:
// 1. Create bridge
bridge := lx.NewCrossChainBridge(config)
// 2. Add supported chains
bridge.AddAsset(asset)
// 3. Initiate transfer
transferID, err := bridge.InitiateTransfer(ctx, transfer)
// 4. Monitor status
transfer, err := bridge.GetTransfer(transferID)