mirror of
https://github.com/luxfi/node.git
synced 2026-10-30 15:24:05 +00:00
A vote binds the set it was cast under: the validator-set root is inside the signed message. Two nodes that compute it differently do not disagree about a block — they sign different bytes, so each drops the other's votes as unverifiable and neither can say why. It is the first thing a Go, a Rust and a C++ daemon have to agree on before they can be on one network at all. It is implemented four times: chains.SetRoot here, validators::root and Committee::root in the Rust node, validator_set_root in the C++ node. Every test each of them had compares an implementation to a restatement of the spec in the same language — Go's golden re-implements the encoding in Go, Rust's by_hand in Rust, and the C++ constants were computed by a Python script. Three self-consistent implementations is what the vote/v1-against-v2 fork looked like from the inside. conformance/setroot emits the corpus from the live chains.SetRoot and hands it to the two ports through the runner that already exists. The evaluators reach their node by path, the way this Makefile builds the daemons: an evaluator has to answer for the code this checkout would run. Neither restates the encoding; each calls the one function its node uses, so a program that agreed with itself could not be mistaken for agreement. Twelve vectors, each a place two readings of the same sentence part company: an empty set commits to zero and not to the hash of nothing; one set in two orders is one root; node ids either side of 0x80 sort unsigned; the weight is hashed and does not fit a double; the key is the uncompressed one, and the length prefix in front of it is what keeps two members from running together. The definition is exported for this. It is not private knowledge — every other implementation of a Lux validator has to produce the same 32 bytes or be ignored — and a corpus generated from a copy of it would prove nothing. The reply that publishes a set now says once what it means. The wire carries one weight per validator and the root hashes Light, and the reader here filled in Weight and left Light at zero: a set rebuilt from the document looked right and committed to different bytes than the network did. GetValidatorsAtReply.Set is that reading, in one place, and the corpus's own test holds the document to the set it was published from.