-
Notifications
You must be signed in to change notification settings - Fork 0
Testing Guide
This guide provides comprehensive information about testing the O Blockchain codebase, ensuring features are present, and validating performance.
- Test Suite Overview
- Quick Start
- Functional Tests
- Performance Tests
- Feature Verification
- Running Tests
The O Blockchain testing infrastructure includes:
-
test/functional/test_o_blockchain_sync.py- Tests blockchain-to-database synchronization
- Multi-node consistency
- Database persistence across restarts
- Measurement statistics sync
-
test/functional/test_o_databases.py- Database initialization and structure
- LevelDB file presence
- Database persistence
- Initialization logs verification
-
simulation/comprehensive_test.py- Basic functionality checks
- PoW/PoB system tests
- Measurement system tests
- Stabilization system tests
- Currency exchange tests
-
test/functional/test_o_features_and_performance.pyβ NEW- Feature Completeness: Verifies all O Blockchain features are present
- Currency Support: Tests 142 currency support
- Database Performance: Benchmarks database queries
- Blockchain Integration: Tests O features with block generation
- Measurement System: Validates measurement functionality
- Stabilization System: Tests stabilization mining
- Performance Benchmarks: RPC latency and block generation rates
-
test_o_performance.pyβ NEW- Standalone performance testing script
- RPC command benchmarking
- Database scalability tests
- Concurrent operation tests
- Performance reports
-
Build the O Blockchain:
cd /Users/o/bitcoin mkdir -p build && cd build cmake .. make -j$(nproc)
-
Start a regtest node (in one terminal):
./build/bin/bitcoind -regtest -daemon
-
Wait for node to be ready:
./build/bin/bitcoin-cli -regtest getblockchaininfo
# Run the comprehensive functional test
./build/test/functional/test_runner.py test_o_features_and_performance
# Or run the standalone performance test
python3 test_o_performance.py# Run database tests
./build/test/functional/test_runner.py test_o_databases
# Run blockchain sync tests
./build/test/functional/test_runner.py test_o_blockchain_sync
# Run features and performance tests
./build/test/functional/test_runner.py test_o_features_and_performance
# Run all O-specific tests
./build/test/functional/test_runner.py test_o_*Tests that all expected features are present:
-
β O Transaction Types (6 types)
- USER_VERIFY
- WATER_PRICE
- EXCHANGE_RATE
- BUSINESS_REGISTER
- MEASUREMENT_VALIDATION
- MEASUREMENT_INVITE
-
β Measurement System RPC Commands
getmeasurementstatisticsgetmeasurementreadinessstatisticsgetmeasurementvolatilitygetmeasurementtargetstatisticsgetmeasurementgapgetactiveinvitesgetaveragewaterpricewithconfidencegetmeasurementtrend
-
β Stabilization System RPC Commands
getstabilizationstatsgetstabilizationhistorygetstabilizationintegrationstatusgetstabilizationconsensusstatsgetstabilizationcoinstatsgetstabilizationconsensushash
-
β Currency Exchange RPC Commands
getsupportedpairsgetexchangeratelistocurrencies
-
β PoW/PoB System RPC Commands
getpowpobstatsgetbusinessratiogetbusinessminerstats
-
β Transaction Submission RPC Commands
submituserverificationtxsubmitwaterpricetxsubmitexchangeratetxsubmitvalidationtxsubmitinvitetx
-
β Database Presence
- BrightID User Registry database
- Measurement Database
- Business Miner Database
- Lists all supported currencies
- Verifies major currencies (USD, EUR, JPY, GBP, CNY)
- Tests exchange pair support
- Measures query latency (< 100ms target)
- Tests cache effectiveness
- Multiple rapid queries benchmark
- Block generation with O features
- Automatic invitation creation (every 10 blocks)
- Database-blockchain synchronization
- Multi-block consistency
- Measurement statistics availability
- Measurement readiness checking
- Invitation system functionality
- Stabilization statistics
- Integration status
- Consensus statistics
- RPC call latency (target: < 100ms)
- Block generation rate
- Cache performance
- Concurrent operation handling
The test_o_performance.py script provides detailed performance metrics:
# Basic usage
python3 test_o_performance.py
# With custom paths
python3 test_o_performance.py --cli-path ./build/bin/bitcoin-cli --datadir regtest-
Node Connectivity
- Verifies node is accessible
- Checks blockchain info
-
Core Operations
- Block generation rate
- Address generation
-
O RPC Performance
- Individual RPC command benchmarks
- Average, min, max latencies
- Success rates
-
Database Scalability
- Query performance
- Cache effectiveness
-
Concurrent Operations
- Multiple RPC calls in sequence
- Overall throughput
- RPC Calls: < 100ms average (excellent), < 500ms (acceptable)
- Block Generation: > 0.1 blocks/second
- Database Queries: < 100ms (cached), < 500ms (uncached)
- Cache Hit Rate: > 50% improvement on subsequent queries
You can manually verify features using RPC commands:
# Check if node is running
./build/bin/bitcoin-cli -regtest getblockchaininfo
# List all O currencies
./build/bin/bitcoin-cli -regtest listocurrencies
# Get measurement statistics
./build/bin/bitcoin-cli -regtest getmeasurementstatistics
# Get stabilization stats
./build/bin/bitcoin-cli -regtest getstabilizationstats
# Get PoW/PoB stats
./build/bin/bitcoin-cli -regtest getpowpobstats
# Check supported exchange pairs
./build/bin/bitcoin-cli -regtest getsupportedpairs
# Get active invitations
./build/bin/bitcoin-cli -regtest getactiveinvitesUse this checklist to verify all features are present:
- All 6 O transaction types are defined
- Measurement system RPC commands work
- Stabilization system RPC commands work
- Currency exchange RPC commands work
- PoW/PoB system RPC commands work
- Transaction submission RPC commands are available
- All 3 databases are initialized
- 142 currencies are supported
- Exchange pairs are available
- Block generation works with O features
- Automatic invitations are created
- Database queries are fast (< 500ms)
Run all O Blockchain tests:
cd /Users/o/bitcoin
./build/test/functional/test_runner.py test_o_*# Database tests only
./build/test/functional/test_runner.py test_o_databases
# Sync tests only
./build/test/functional/test_runner.py test_o_blockchain_sync
# Features and performance
./build/test/functional/test_runner.py test_o_features_and_performance./build/test/functional/test_runner.py --loglevel=DEBUG test_o_features_and_performance# Make sure node is running first
./build/bin/bitcoind -regtest -daemon
# Run performance test
python3 test_o_performance.pyTests provide clear indicators:
- β Green checkmark: Feature present and working
β οΈ Warning: Feature present but may have issues- β Red X: Feature missing or broken
- Excellent: < 50ms average
- Very Good: < 100ms average
- Good: < 500ms average
- Needs Improvement: > 500ms average
-
"Cannot connect to node"
- Make sure
bitcoindis running:./build/bin/bitcoind -regtest -daemon - Check with:
./build/bin/bitcoin-cli -regtest getblockchaininfo
- Make sure
-
"Database not initialized"
- Generate some blocks:
./build/bin/bitcoin-cli -regtest generatetoaddress 101 $(./build/bin/bitcoin-cli -regtest getnewaddress)
- Generate some blocks:
-
"RPC command not found"
- Check if command is registered in
src/rpc/register.h - Rebuild if needed:
cd build && make
- Check if command is registered in
-
"Performance slow"
- Check system resources
- Verify database files exist
- Consider using cached queries
# Start node with debug logging
./build/bin/bitcoind -regtest -debug=o -daemon
# Check logs
tail -f ~/.bitcoin/regtest/debug.log# Check node status
./build/bin/bitcoin-cli -regtest getblockchaininfo
# Check database files
ls -la ~/.bitcoin/regtest/brightid_users/
ls -la ~/.bitcoin/regtest/measurements/
ls -la ~/.bitcoin/regtest/business_miners/
# Check RPC help for a command
./build/bin/bitcoin-cli -regtest help getmeasurementstatisticsAfter running tests:
- Review Results: Check which features pass/fail
- Performance Analysis: Identify slow operations
- Fix Issues: Address any failing tests
- Re-run Tests: Verify fixes work
- Document Findings: Update this guide if needed
When adding new features, also add tests:
- Add functional test in
test/functional/test_o_*.py - Add unit tests in
src/test/if applicable - Update this guide with new test information
- Run full test suite to ensure nothing breaks
-
Bitcoin Core Test Framework: See
test/functional/test_framework/ -
Test README:
test/README.md -
Simulation Tests:
simulation/directory -
Build Results:
simulation/BUILD_AND_TEST_RESULTS.md
Last Updated: 2025-01-06
Test Coverage: Features, Performance, Integration, Databases
Β© O International
A Nonprofit Association Focused on the Creation of a Water Price-Based Stable Coin
Association de Loi 1901 β France NumΓ©ro de Siret (French SIREN): 924 014 467 00014
- Home
- Open Problems β want to help?
- Contributing
- Installation
- Testing Guide
- Architecture Overview
- Blockchain Architecture
- Stabilization System
- Transaction Types
- Database Architecture
- Currency Storage