I'll start with explaining the confusing documentation.
BIP34 says it activates when 950 out of 1000 blocks signal for Version 2. It is not clear if this includes the current block or refers to previous blocks
It refers to previous blocks. To determine whether the rules are active for the block at height
n, we check whether 950 of the blocks from
n-1 signal version 2 or greater.
BIP66 says it activates when 950 of the previous 1000 blocks signal for Version 3. However, the client notes say 951 of the previous 1001 blocks. Then BIP66 says it activates using the protocol of BIP34. Now we have three possible methods. They do not match up.
There are only two possible methods, and they're actually the same thing. 950 of the previous 1000 block is the same as the BIP 34 method. And this is actually the same thing as the 951 out of the previous 1001 if you consider a slightly different perspective. Either way, BIP 66 uses the same mechanism as BIP 34. Specifically, they use a function called IsSuperMajority to determine whether they are active. So both use the same mechanism. The issue is with how we describe this mechanism.
The "950 out of the previous 1000 blocks" wording used in BIPs is as I described earlier. It is determining whether the rules are being enforced for block
n by looking at the 1000 blocks that precede it. So here
n is not included in the count or in the sequence.
The "951/1001" wording includes block
n. It looks at the blocks from
n-1001 to block
n (inclusive) and checks whether 951 of those blocks have the right version number. These two wordings are identical because the 1001 one includes the activation block while the 1000 one does not.
One way to think of the 950/1000 is: after seeing a sequence of 1000 blocks where 950 blocks signal the new version, the next block to be mined must follow the new rules. The new rules are about to begin enforcement.
One way to think of the 951/1001 is: after seeing a sequence of 1001 blocks where 951 blocks signal the new version, the 1001st block in that sequence already enforced the new rules and enforcement has already begun.
Basically humans suck at describing things with words. It's all much clearer when you look at the code.
Now onto the discrepancies. I've written a python script that does the IsSuperMajority check to verify these numbers.
I'm not sure where BitMex got their block height from. Checking that height, and ones before and after it do not result in activation. So I believe this is just incorrect.
Now for 277930 vs 277931, this is an interpretation issue. Like I talked about previously with the 950/100 vs 951/1001, this depends on inclusivity and perspective. At height 277930, a sequence of 1000 blocks was found where 950 had block version 2. So this means that at height 277930, the rules were not enforced for that block, but would be for the next one, i.e. 277931. Bitcoin Core uses 277931 because that is the first block that the BIP 34 rules are being enforced for so that is the value that is in the source code.
The 363724 vs 363725 discrepancy is the same thing as the 277930 vs 277931 in BIP 34.
BitMex's number is a little more confusing. The only way that this makes sense is if they are looking at the slightly difficult activation BIP 66 had. Due to miners spy mining, there was an inadvertent chain fork when BIP 66 activated. Block 363725 was the first block where the new rules were to be enforced. However a miner who had not upgraded found a block 363725. Because he was not upgraded, this block was invalid under the new rules and most of the network rejected it. But a many miners did not fully validate that block and mined on top of it. This turned out to be a significant portion of the hashrate and they ended up producing a fork 6 blocks in length before the valid main chain caught up and overtook them. This happened with block 363731. So one could say that is when BIP 66 activated.
But that's not the end of that story. The next day, there was a 3 block fork due to the same issue. So you could also say that BIP 66 activated a day later.
Either way, BIP 66 began being enforced with block 363725 being the first block under the new rules.
The 388380 vs 388381 discrepancy is the same thing as the 277930 vs 277931 in BIP 34.