Hacker News new | ask | show | jobs
by 5pl1n73r 310 days ago
Ah, blockchains, where people realize all those "it doesn't matter bugs" with 3 layers of indirection due to shaky primitives, actually matter. Other bugs like this could be used to execute arbitrary code on the computer that compiles the software, calling random "important looking" stuff into memory (xz backdoor style) to be decoded and executed by the backdoor. Of course, there will never be a day where you can compile untrusted code in Solidity.

> The lesson? Always test critical software under multiple compilers and library versions — especially when enabling a new language standard.

Don't have giga-complicated language jockey stuff backing software that can't afford to even have one bug.

3 comments

This is why I quit using eth. They were just way too comfortable with insane complexity.
I'm not sure how blockchain is relevant here.

The only one that needs to compile Solidity is the person who wrote the Solidity, right? Same with non-blockchain software. So a bug in a Solidity compiler will have the same impact as a bug in any other compiler. At least with regard to executing untrusted code.

Unfortunately, Solidity itself is a poorly designed language, especially for something as mission critical as contracts.

Back in 2017, I wrote a comment on HN listing the various WTFs and gotchas I found just from skimming the Solidity docs: https://news.ycombinator.com/item?id=14810008. I went and looked at the current docs, and most of what I wrote back then is still applicable (they did make arithmetic checked by default, and fixed scoping for local variables). There's some other stuff that I missed then that is frankly even more insane - e.g. mappings use solely the hash to look things up (i.e. if you get a hash collision, it will just silently return the wrong value!).

This alone is, to me, a good reason to not trust the ecosystem, given that it's run by people who believe this to be a sensible design for something that handles massive amounts of money.

compiling untrusted code via the wasm builds of solc is quite reasonable and is done at scale by several providers (e.g. etherscan, remix).