How to test out or simulate slashing

I have read a fair bit about slashing but have not actually experienced it. Nor do I want to, at least on a production network!

I have my own application chain on a single machine to play with, but want to actually intentionally create a slashing situation so I can see for myself how it works, in terms of changes to all the different accounts and pools in the system.

How would I do that?

You could set up a validator on the current testnet and have it slashed by either double signing or being offline.

How would I “make” it double sign?

The easiest way is to bring up two validators using the same key.

If you are familiar with Docker, you could also play around with the docker-compose network that is included in the gaia repo: https://github.com/cosmos/gaia/blob/master/docker-compose.yml

It starts 4 nodes and makes it possible to test out all sorts of scenarios in a “lab setting”.

1 Like

Thanks, @haasted.

So by two validators using the same key, you mean two nodes, both which have the same contents of “priv_validator_key.json”, but where the actual cosmos user accounts for each of the two validators is different?

My understanding is not super clear on how user accounts relate to the priv_validator_key. But I assume the latter is the key that each validator signs with. So if two different validator nodes signed with the same key, that would be the doublespend we are trying to simulate?

I am trying to do this on my own custom application chain, but certainly will keep in mind that I can do that with the docker-compose network in the gaia repo.

A separate question – where do the slashed funds go?