KasarLabs / barknet

https://kasar.io
MIT License
13 stars 0 forks source link

net/tests #5

Open antiyro opened 1 year ago

antiyro commented 1 year ago

Description:

Ensure that the integration of the Bitcoin-da functionality into the substrate node is robust, functional, and free of critical bugs.

Tasks:

  1. Design Unit Tests for BitcoinClient and Its Methods:

    • Initialize BitcoinClient:

      • Test the initialization of the BitcoinClient structure with different configurations.
      • Validate that it can successfully connect to a Bitcoin node using provided RPC credentials.
    • Data Handling Methods:

      • Test methods responsible for handling storage changes:

        • Ensure that changes are detected correctly.
        • Validate that large data sets are chunked appropriately using the chunk_slice utility.
      • Test the update_bitcoin_state method:

        • Ensure it fetches the correct state from the substrate system.
        • Validate its behavior for different DaMode settings.
    • Error Handling:

      • Use the BitcoinError enum to trigger different error scenarios.
      • Ensure that the BitcoinClient methods handle errors gracefully and provide meaningful error messages.
  2. Implement Integration Tests for Substrate Compatibility:

    • Integration with Substrate Storage:

      • Ensure that the BitcoinClient can listen to substrate storage changes seamlessly.
      • Validate that state updates in the substrate system are correctly processed by the BitcoinClient.
    • Transaction Broadcasting:

      • Simulate the broadcasting of Bitcoin transactions that contain data from the substrate system.
      • Check that these transactions are formed correctly, with data embedded as expected.
    • State Synchronization:

      • Modify the state in the substrate system and ensure that the BitcoinClient recognizes and processes these changes.
      • Validate that the state on the substrate system and the data on the Bitcoin network remain synchronized.
  3. Test on Bitcoin's Testnet:

    • Environment Setup:

      • Set up a local or remote Bitcoin node connected to the testnet.
      • Configure the BitcoinClient to interact with this testnet node.
    • Transaction Tests:

      • Broadcast transactions to the testnet that embed substrate data.
      • Ensure that these transactions are confirmed and can be viewed on Bitcoin testnet explorers.
    • Data Extraction:

      • After broadcasting transactions, attempt to extract the embedded data.
      • Ensure that the extracted data matches the original substrate data.
    • Performance and Stability:

      • Monitor the stability of the BitcoinClient over extended periods on the testnet.
      • Measure performance metrics like transaction confirmation times, data extraction times, etc.
    • Edge Cases:

      • Simulate edge cases like transaction rejections, chain reorganizations on testnet, etc.
      • Ensure that the BitcoinClient can handle these scenarios gracefully.
axelizsak commented 1 year ago

I start this one

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a 👍 Because this issue is marked as stale, it will be closed and locked in 7 days if no further activity occurs. Thank you for your contributions!