Testing ABCI and ABCI++ by mocking Tendermint.
To install Tendermock, first make sure you have a compatible version of python (e.g. 3.10). You can install python requirements by running
pip install -r requirements.txt
You can skip this section if you cloned the repository from github - it should include the generated code already.
The code was generated by running, in https://github.com/tendermint/tendermint/tree/0.35x/proto, the command:
python3 -m grpc_tools.protoc -I. -I../third_party/proto --python_out=../../tendermock/src/proto --grpc_python_out=../../tendermock/src/proto $(find . -iname "*.proto")
To run this, grpc_tools need to be installed
Start a docker container (I think this command could be different. I just wanted a command to keep the container alive while I manipulate the file system):
docker run -p 23456:26658 simapp simd start --with-tendermint=false --transport=grpc --trace
Initialize the node:
docker exec b9 simd init node --chain-id tendermock
Create keys for users (could provide more things on the command line, right now it's interactive and one needs to press enter some times and enter a pw):
docker exec -it b16 simd keys add node1 -i
docker exec -it b16 simd keys add node2 -i
This will return some addresses, which can be worth saving. For example,
address: cosmos1true75k5hh0s94hxa7s8w29ys65s4u9n8g5fh5
name: node1
pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Ay4/Hi8fX+CIVqSIHBE9n9k0TfzdtFtTwcrKJc1qo2w3"}'
type: local
**Important** write this mnemonic phrase in a safe place.
It is the only way to recover your account if you ever forget your password.
neither fatigue grass yellow wash magic purity test achieve bridge february lecture pipe cover notable kitchen success bulk ten stable leave cushion joke square
Next, add genesis accounts (stake is the name of the coin on the simd app):
docker exec -it b9 simd add-genesis-account cosmos134r9s82qv8fprz3y7fw5lv40yuvsh285vxev02 5000000000stake
Add a genesis transaction that sets up a validator:
docker exec -it 21 simd gentx node1 --chain-id=tendermock 5000000000stake
Add the genesis transaction to genesis.json:
docker exec b9 simd collect-gentxs
Now, pull genesis.json
from the container:
docker exec b9 cat /root/.simapp/config/genesis.json > genesis.json
Commit a new image with the modified filesystem:
sudo docker commit b9 imgs/testnet
Run abci in the new image:
docker run -ti -p 23456:26658 imgs/testnet simd start --transport=grpc --with-tendermint=false