RGB v0.12 Third Phase Testing: Progress and Achievements
Introduction
As contributors to the Bitcoin RGB ecosystem, BitlightLabs has continued testing and validation work on RGB v0.12, with a particular focus on Layer 1 RGB20 asset functionality. This report details our latest test results, and documents our technical contributions to the RGB protocol implementation.
Test Execution Overview
Current Test Results (v0.12)
Test Type | Total | Passed | Failed | Ignored |
---|---|---|---|---|
issuance.rs | 10 | 8 | 0 | 2 |
stress.rs | 8 | 8 | 0 | 0 |
transfer.rs | 41 | 37 | 0 | 4 |
transfer_rgb21.rs | 2 | 0 | 0 | 2 |
Total | 61 | 53 | 0 | 8 |
It's important to note two key points:
- Due to the comprehensive protocol upgrade, we've removed several obsolete tests that no longer align with the v0.12 architecture
- While the overall test passing rate is 87%, we've achieved 100% passing rate for RGB20 assets on Layer 1, which was our primary focus for this phase. Additional test coverage will be continuously expanded as the ecosystem matures.
Ignored Test Cases Analysis
The 8 ignored test cases fall into specific categories that are either pending feature completion or outside our current testing scope:
-
RGB21-related (2 tests in
transfer_rgb21.rs
andissuance.rs
): Digital Collection functionality is still being refined and currently facesInner(Genesis(Named(TypeName('DigitalCollection')), ScriptUnspecified))
errors -
Advanced Network Integration (2 tests in
transfer.rs
):ln_transfers
: Will be implemented as Lightning Network documentation and ecosystem integration maturescollaborative_transfer
: To be completed as multi-wallet collaborative workflows and ecosystem integration matures
-
Mainnet Compatibility (2 tests in
transfer.rs
):mainnet_wlt_receiving_test_asset
: Requires interface adjustments for mainnet compatibilitysync_mainnet_wlt
: Requires interface adjustments for mainnet compatibility
These ignored tests represent future enhancement areas rather than protocol deficiencies, and will be addressed in subsequent testing phases as the protocol ecosystem matures.
Key Improvements in v0.12
1. Blockchain Reorganization Handling
RGB v0.12 introduces robust support for blockchain reorganization scenarios. All tests related to blockchain reorganization now pass successfully, demonstrating:
- Correct state archiving during chain reorganization
- Proper invalidation of dependent transactions
- Consistent state management during blockchain reorgs
- Accurate transaction status tracking before and after reorganization
- Proper handling of genesis transaction reversion
2. Enhanced State Transition Validation
RGB v0.12 demonstrates significant improvements in state transition validation, particularly in handling complex scenarios:
- Consistent handling of same-invoice reuse scenarios
- Proper state validation during witness updates
- Coherent tracking of state across multiple transfers
- Validation of unbroadcasted transfer states
3. Stress Testing Success
All stress tests now pass successfully, including:
back_and_forth::case_1
throughcase_8
: Tests that validate multiple sequential transfers between wallets
4. Asset Issuance Stability
All RGB20 and RGB25 asset issuance tests pass successfully, including:
- Non-Inflatable Asset (NIA) issuance
- Fractional Unique Asset (FUA) issuance
- Multiple UTXO allocation scenarios
Technical Contributions and PRs
During this testing phase, BitlightLabs identified and addressed several critical issues affecting RGB v0.12 stability:
BP-Node Blockchain Indexer Enhancements
BitlightLabs made significant contributions to the BP-Node blockchain indexer, which is a critical dependency for RGB v0.12. Our PR #11 (opens in a new tab) introduced substantial improvements to transaction data analysis and storage:
- Single-Chain Design Implementation: Optimized the node to work with a single blockchain network per instance, improving reliability and reducing complexity
- Transaction Tracking Mechanism: Implemented efficient transaction matching with BloomFilter32 integration
- Orphan Block Handling: Developed a robust mechanism for processing orphaned blocks and resolving dependencies
- Blockchain Reorganization Support: Implemented comprehensive chain reorganization detection and handling, including block rollback and application
- Database Structure Optimization: Redesigned the database structure to improve performance and maintainability
These enhancements to BP-Node provide the essential blockchain indexing foundation required for RGB v0.12's improved transaction tracking and reorganization handling capabilities.
RGB Core Fixes and Collaboration
Working closely with Dr. Maxim Orlovsky, we identified and fixed several critical issues affecting the RGB protocol implementation:
-
BP-Wallet Fixes (PR #86 (opens in a new tab)):
- Enhanced blockchain reorganization handling
- Improved transaction state management during chain restructuring
- Fixed issues with witness transaction status tracking
-
Sonic API Improvements:
- PR #18 (opens in a new tab): Fixed state handling during blockchain reorg scenarios
- PR #16 (opens in a new tab): Resolved error in
sonic/api/src/articles.rs
when attempting to overwrite existing Articles duringaccept_transfer
-
RGB-Std Enhancements (PR #309 (opens in a new tab)):
- Fixed contract memory consistency issues where the
issue
method wasn't updating the in-memory contract collection after contract issuance
- Fixed contract memory consistency issues where the
Layer 1 RGB20 Validation Focus
Our testing strategy for this phase focused on thoroughly validating RGB20 assets on Layer 1:
-
Asset Lifecycle Verification:
- Complete asset issuance verification for RGB20 (NIA types)
- Transfer validation across different wallet and transaction configurations
- State consistency verification after complex transaction sequences
-
Edge Case Handling:
- Blockchain reorganization scenarios
- Invoice reuse patterns
- Same-transfer witness update scenarios
- Unbroadcasted transaction acceptance
-
Stability Under Load:
- Back-and-forth transfer scenarios (stress testing)
- Complex transfer loops with multiple assets
This focused approach has established a solid foundation for RGB20 assets on Bitcoin's Layer 1.
Future Protocol Ecosystem Enhancements
As the RGB protocol ecosystem continues to evolve, we anticipate further expansion in the following areas:
-
RGB21 Support:
- Digital Collection (FAC) asset issuance currently faces
Inner(Genesis(Named(TypeName('DigitalCollection')), ScriptUnspecified))
errors - RGB21 transfer tests will be expanded as the schema stabilizes
- Digital Collection (FAC) asset issuance currently faces
-
Advanced Scenarios:
- Lightning Network integration (
ln_transfers
) - Multi-wallet collaborative workflows (
collaborative_transfer
) - Mainnet wallet compatibility (
mainnet_wlt_receiving_test_asset
,sync_mainnet_wlt
)
- Lightning Network integration (
-
Ecosystem Development:
- RGB21 schema refinements
- Lightning Network integration tests
- Multi-wallet collaborative workflows and coinjoin test scenarios
These enhancements will be incorporated as the protocol ecosystem matures, building upon the solid foundation we've established for Layer 1 RGB20 assets.
Conclusion
RGB v0.12 demonstrates comprehensive improvements in protocol design, particularly in handling complex Layer 1 scenarios like blockchain reorganization, state validation, and mixed descriptor types. The successful validation of these previously challenging scenarios reflects the protocol's enhanced stability and technical maturity.
BitlightLabs has established comprehensive test coverage for RGB20 assets on Layer 1, providing a solid foundation for the RGB ecosystem's continued growth and adoption.
Repository Links:
- Main Branch: RGB-WG/rgb-tests (opens in a new tab)
- Active Development Branch: feat/rgb-v12-enhanced-tests (opens in a new tab)