Is the legacy C++ code inherited from Bitcoin very difficult to maintain? What are the benefits of using Rust?
Why use Rust instead of Bitcoin’s legacy C++?
What benefits does Zebrad have compared to Zcashd due to using Rust?
Is the legacy C++ code inherited from Bitcoin very difficult to maintain? What are the benefits of using Rust?
Why use Rust instead of Bitcoin’s legacy C++?
What benefits does Zebrad have compared to Zcashd due to using Rust?
You basically summed it up. Bitcoin codebase is antiquated and time consuming to maintain and upkeep.
Rust is a modern language that interfaces better with todays world.
Have a read though this thread, others asked the same question:
Kind of a nested question. Difficulty of maintenance can stem from previous development not having good enough insight into the codes’ future and setting it up accordingly. I would guess that not too many people had a hand in the original code construction and maybe the focus was other things besides easy development later on.
The benefits of using Rust are numerous but wrt to C/C++, the biggest benefit is probably memory management. VERY generally, Rust does it for you and C doesn’t. It’s a two-edged sword, however. Rust sort of relieves one from needing a good understanding of underlying computer memory and still write safe code, typically at the cost of *flexibility. An exceptionally good understanding of C still doesn’t guarantee one would write safe code, but they could basically do anything they wanted. Some programmers like the less obtrusive style, less pre-planning, can maybe go faster, and for things that maybe don’t matter, sure.
Beyond that, it’s about use case. Syntactically, the two langs (Rust C++) aren’t even that dissimilar and basically comparable in speed. You start to like get in the weeds with comparing compilers and package managers etc., you’d need to look up some articles.
Like mentioned, zebrad in Rust is memory-safe and thats the main benefit. Zebrad also has a more modular design which dev folks tend to enjoy more overall.
Due to the way computers work, code and data are usually indistinguishable.
C and C++ are not “memory safe” languages. This means that a bug in the program could lead to it overwrite code in memory, which is particularly dangerous if if the bug allows that to happen with attacker-controlled data. So it could be possible that, if a bug like that were to exist, an attacker could send some data to the Zcash node and that would cause it to execute some code chosen by the attacker. Which would mean that the attacker could inject code to extract data from the machine. If there was a Zcash wallet in the same machine, it could steal it for example.
Rust, on the other hand, is memory safe. In most situations it is simply not possible for a Rust program to overwrite code in memory, because it tracks the portions of memory that is using for data and doesn’t allow writing outside of them. This prevents this entire class of bugs and is a huge security win.
There are other advantages of Rust, in particular in comparison with other memory-safe languages, but that is the gist of it.