Transactions – What are all the consensus rules?
(1) If a policy is defined as “everything that is not a consensus” but a confirmation of that policy is included in the consensus file… what exactly are they doing? Deprecated?
No, it is no longer used. In the Bitcoin Core file system, there is no clear dividing line between one file checking only policy rules and another file checking only consensus rules. (See Suhas Daftuar’s StackExchange post discussing consensus and policy subdirectories.) This is for several reasons. One is the inheritance of Satoshi’s codebase, which the core contributors have refactored and cleaned up over a decade, but still end up with a large bundle of code similar to what they inherited from Satoshi. Perhaps more importantly, it’s really difficult to outline what all the consensus rules actually are, because there are edge cases where you think the code you’re touching has nothing to do with consensus, but turns out to have introduced a consensus bug with potential consequences. . Chain split. Pieter Wuille discussed this on the 2020 Chaincode Labs podcast.
One of the things I learned from that is that it’s really hard to specify what the consensus rules are. That doesn’t mean you can’t try, but who would have thought that the configuration settings of the database layer you’re using actually leak semantically into Bitcoin’s implicitly defined consensus rules? Of course, it can be said that it is due to human failure. We had to read the document and know that.
There may be a bug in the C library. There may be a bug in the kernel. There may be a bug in your CPU.
We can talk about the boundaries of trying to intentionally abstract away the parts of the codebase that contribute to consensus, but it’s very difficult to say unequivocally that this code doesn’t affect the consensus code, because it might leak bugs. One of the things to learn here is that you really want your software to be used in a consensus system where there is a requirement that if everyone behaves correctly, not only will everyone accept the correct answer, but also that not everyone will agree on what is what . There is an invalid piece of data in lockstep.
(2) Are all consensus rules included somewhere in this consensus file? I’m assuming that’s not the case. So I ask…
no. There have been attempts in the past to create a consensus library (libbitcoinconsensus) and more recently libbitcoinkernel, discussed and contributed by Carl Dong, but they are really difficult. Consensus is a really slippery concept in Bitcoin.
(3) Can you make a list of everything (that isn’t already included somewhere in this consensus file) that is needed for a valid block to be accepted as valid?
If you mean a complete list in English, you’ll have a hard time. You can try it and probably include most of the obvious things, but what you won’t find missing are the edge cases and things that don’t seem to have anything to do with the agreement at all.