pull down to refresh
203 sats \ 3 replies \ @0xIlmari 12 Mar freebie \ on: What's the difference between a consensus rule and a bug in Bitcoin Core? bitcoin
It's a typical problem when there is no primary documentation of a protocol and all you have is a reference implementation (Bitcoin Core). This means that you have to embrace "it's not a bug, it's a feature".
Every "competing" implementation, as you point out, is just a rewrite, that has to replicate all the "bugs" and warts in itself.
It should be pointed out that one of the reasons why all the arithmetic operations in Script had to be disabled is because different compilers and platforms could behave differently in some edge cases (like integer overflow), and lead to exploits or undefined behaviour.
I dare say, if Bitcoin Core were written in something like Rust, those might still be available today (Rust is much more consistent across targets), but not so much in C. The consequence being, even if you rewrote it in Rust, you couldn't reenable them because that's no longer part of the consensus, it's just dead opcodes.
I would welcome with open arms an initiative to actually write down the consensus rules as a document (the white paper has very few details), followed by a complete test suite that is implementation-agnostic, which then could be applied to Bitcoin Core and others as a proof of their validity.
At this point it would be clear what is a bug and what isn't.
(Yes, Bitcoin Core has a lot of unit tests but they are tied to that implementation only. I'm talking about "end-to-end" tests - you input a blockchain state and a new block and test whether program accepts it or not.)
In fact, for something that wants to be the "money of the future" or the "operating system of value", I'm shocked something like that doesn't exist yet. We're really running on software engineering hopium here.
In modern software development this is how we do things now (Test-Driven Development) but unfortunately Satoshi gave us what we would now call "legacy software".
Not to mention that bitcoin being a protocol, it’s precisely the perfect use case for tdd. Define specs, implement tests, all nodes need to pass it.
Although I have no idea how such a spec could be drafted.
Also, as a nitpick, all software built today is the legacy software of tomorrow, so although I think bitcoin would benefit from this, I think that what was done so far was well done, in as much it was all fruit of free labor hahaha
reply
What do you think of the admittedly hack-ey solution of just running a bunch of versions?
Maybe it doesn't matter so much for humble node runners who only care about verifying a few transactions every once in a while, but I've often wondered if mining pools do this as a way of making sure that they don't waste resources.
reply
It's a non-solution for me, not because it's hacky (a comprehensive test suite would test a node release against multiple compilers and CPU architectures), but because it finds problems in production environment (instead of during development), which is unacceptable for the most important monetary network in the world.
reply