Serguey Asael Shinder: Two implementations must agree, or the contract must say they won't
On 13 November the go-ethereum team merged pull request 36132. Geth can be built with cgo, using the C library libsecp256k1 for signature recovery, or without it, using a pure-Go library. The two builds disagreed. For a signature recovery ID of 4 to 7, the cgo build returned an error, while the pure-Go build returned a public key, because its library reserves those values for another purpose. The EVM was protected by earlier checks, but the Clique consensus seal and the peer-to-peer handshake were not, so a node built without cgo could accept a block seal that every cgo node rejected.
The fix makes the pure-Go path reject the same inputs, and the test runs every recovery ID from 4 to 255 in both build modes. That is the right fix for consensus code. Two nodes that see the same bytes must reach the same verdict, so a second implementation is only acceptable if it is observably the same function.
Java has a long-standing example of the opposite decision, made deliberately and written down. The javadoc of java.lang.Math says that, unlike some of the numeric methods of StrictMath, "all implementations of the equivalent functions of class Math are not defined to return the bit-for-bit same results". The reason is given in the next sentence: the relaxation "permits better-performing implementations where strict reproducibility is not required". Code generators are encouraged to use platform-specific native libraries or processor instructions, as long as they still meet the accuracy specification for each method.
So Math.sin on one JVM and another may differ in the last bit, by design, and that is fine for most programs. If you need the same bits everywhere, StrictMath is the class whose contract promises that.

Put next to each other, the two cases show the only two honest options when a function has more than one implementation.
One is what Geth did: treat any difference as a bug, and enforce agreement with a test that covers the whole input domain, including the values nobody expects to see. The Geth test does not check a few recovery IDs; it checks every byte value above the valid range.
The other is what the JDK did: allow the implementations to differ, but say so in the contract and offer a second API for callers who cannot tolerate it. The disagreement is then a documented property instead of a surprise.
The option that causes incidents is the one in between, where two implementations are assumed to agree because they usually do. Geth's builds agreed on every valid signature. They only differed on inputs a well-behaved peer would never send, which is exactly the set of inputs an attacker or a corrupted message will.
In Java code, the same question comes up whenever a library offers a native and a pure-Java path, or a fast and a portable mode. Before relying on both, I would ask which of the two promises the project makes, and if neither is written down, write the test that runs both on the inputs nobody expects.