Developers Forum for XinFin XDC Network


Posted on

[XDPoS2.0] Test Report: protocol upgrade test from V1 to V2

Here we try to test a few scenarios on XDPoS2.0 to see if the protocol can be seamlessly upgraded from v1 without any downtime.

In brief summary: we ran 3 different tests and successfully prove that the upgrade process is seamless and the upgraded protocol is functional.

Test Setup

Environment Setting

  • Network: Devnet
  • Number of Master nodes: 11
  • Blocks per Epoch: 900
  • V1 mining time: 2s
  • V2 mining time: 5s
  • V2 mining vote thresholds: 6
  • V2 first block: 7060500

Test 1: continuously mining from v1 to v2

Test target: XDC consensus protocol can be upgraded from V1 to V2 without downtime

The screenshot below comes from our server display. As we can see after block-7060500, the mining time changed from 2 seconds to 5 seconds as configured, and there is no downtime:
Image description

Another evidence is that vote information (specific to XDPoS2.0) started to show up as well:
Image description

Test 2: Synchronization

Test target: Correct synchronization: When bootstrapping a new node, the new node can correctly synchronize all the V1 blocks and then V2 blocks, then run V2 consensus.

Start a new node that required sync from v1 stage:
Image description

Finish Sync:
Image description

From log, the showing-up of the initial V2 log is also an evidence of that the node has started synchronizing V2 blocks:
Image description

Test 3: Penalty Test

Test target: The protocol should penalize inactive nodes and then add it back properly.

Steps and Expected Behaviours:

  • Stop node A and observe the delay of blockchain
  • Wait until it passes the next Epoch, observe
    • node A gets excluded (penalty list) from miner list
    • blockchain is fully functional, no delay on produce block
  • Restart node A and wait a few Epochs, observe
    • node A is added back to miner list
    • blockchain is still fully functional
Step 1 - Stop one node and observe the delay of blockchain

The log screenshot below shows that time-out information was reported from other nodes after node A went offline:
Image description

Image description

We can observe from log the delay of new block generation:
Image description

Step 2 - Observe the functionality of blockchain for one epoch

epoch time (4500s) = block mine time (5s) * blocks of epoch (900)
After around 3 hours, the current epoch was finished without an issue. Also We can observe the blockchain became fully functional:
Image description

Also we can see the node A got added to the penalty list:
Image description

Timeout message Period:
Image description

Step 3 - Restart node A and wait a few Epochs to see

Restart node A and observe the subsequence epochs
Image description

Image description

Also Node get removed from penalty list
Image description

Blockchain should still functions
Image description

In Conclusion

We are committed to continuously test XDPoS2.0 under various test cases and will do more report.
Do you have any good test case in mind? Please share it here!

Discussion (1)

akhekade profile image
Atul Khekade

Thanks for sharing. Will get some devs to test this and get more feedback