tendermint-rs
tendermint-rs copied to clipboard
MBT: validators are wrongly re-sorted
From working on #686 , looks like MBT is wrongly re-arranging validators
in validator_set
after Testgen (correctly) generates it. Not sure yet where exactly this is happening. As a temporary solution, I'm re-sorting it locally (in light-client/tests/model_based.rs
) to get the correct validator set.
This was caught by comparing the hashes like below from a more detailed output of one of the tests:
> step 1, expecting Success
regen vals hash: Hash::Sha256(2B141A0A08B7EF0A65BC5F4D92F00BDEF0279124DEAC497BEF4C4336D0A3CE6F)
current resorted vals hash: Hash::Sha256(2B141A0A08B7EF0A65BC5F4D92F00BDEF0279124DEAC497BEF4C4336D0A3CE6F)
> lite: Invalid(InvalidValidatorSet { header_validators_hash: Hash::Sha256(2B141A0A08B7EF0A65BC5F4D92F00BDEF0279124DEAC497BEF4C4336D0A3CE6F),
validators_hash: Hash::Sha256(F85F593D2CBDCB7B0D45B6C17A708CAB7AF4C51256DAC7F9412FCACA0B1420F4) })
- "regen val hash" is the hash of validator set that was re-generated from
testgen_block
of the test using Testgen (testgen_block
is a raw, minimal data using which the Testgen produces aLigthBlock
) - "current resorted vals hash" is the hash of re-sorted validator set in LightBlock
- "header_validators_hash" is the hash of validator set in LightBlock's Header, and
- "validators_hash" is the hash of the validator set present in LightBlock
For better understanding, below is what a single MBT test contains: https://github.com/informalsystems/tendermint-rs/blob/91bc1f6170528c82fb1aacc370e9d75d7e571bd2/light-client/tests/model_based.rs#L60-L67