Skip to content

Instantly share code, notes, and snippets.

@leto
Last active July 31, 2020 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leto/6ad4c03413ce2e68efe4055fe8049d38 to your computer and use it in GitHub Desktop.
Save leto/6ad4c03413ce2e68efe4055fe8049d38 to your computer and use it in GitHub Desktop.
Hush 3.5.0 testing

Hush 3.5.0 Testing

Most important things to test on Hush dev branch:

  • z2z, can be tested with -z2zheight param
  • Block time changing from 150s to 75s

Both of the above will happen at Block 340K on mainnet, but we can test things out by making a chain fork with the above CLI option.

The way the z2z transition code works is to forcibly make the mempool empty of all transactions, starting 10 blocks before the transition height.

To test things, we will need to set a block height via -z2zheight and then we should actually see it create a chain fork 10 blocks before that height, as it will not allow anything except mining transactions. If Hush mainnet blocks happen to be empty, we could see the chainfork less than 10 blocks before. Once we hit the test height T, any transaction with a transparent output on Hush mainnet will cause a chainfork of our dev branch, which is the desired behavior.

  • Test that only mining transactions are allowed during this 10 block transition

Once the test height T has been reached, we then need to make test transactions:

RPC test tx's

  • t=>t
  • z=>t
  • t=>(t,z)
  • z=>(t,z)

Since all of these have transparent outputs, they should all fail at the RPC level, i.e. the RPC's should give an error, versus allowing the transaction at RPC level and then being rejected at consensus layer.

Additional testing would be to use raw transactions to create these same transactions, without using normal RPCs:

Raw test tx's

  • t=>t
  • z=>t
  • t=>(t,z)
  • z=>(t,z)

We should see all these transactions rejected by the local mempool via consensus rules.

Block time testing

Our block time should go from 150s to 75s. -z2zheight CLI param also controls this consensus change, so whatever test height T is used, we should see the blocktime average down, over a few dozen/hundred blocks, to being 75s instead of 150s. If there is a re-organization across this block height, the internals know to change blocktime to the correct value. On mainnet, we will have notarizations and the first notarization transaction after block 340K will prevent any re-organizations across that height.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment