I always wonder how these "five conditions ANDed together in an if" make it past code review in general (i know thats not where the actual bug was). I don't care how brilliant a programmer you are, but mistakes in those are very difficult to grasp.
As convoluted as they can be, what alternatives are there other than nested conditions, which are equally convoluted? Surely if you need to logically compare five variable then you'll be doing it in some variation of 5 chained operations.
Zcoin implementation bug enabled attacker to create over 500K Zcoins
211–220 of 223 posts
Re: Zcoin implementation bug enabled attacker to create over 500K Zcoins
#212Earlier quoted context omitted.
I recently spoke at an event where we talked about the crossover of cryptocurrency and the law with a bunch of attorneys present. Many attorneys spoke up during the Q and A to remind everyone that at the end of the day the legality of anything will be decided by either a jury or a judge. It's going to come down to the arguments both sides make, and I think any defense would have a hard time explaining how what they d…
Is there a recording of this discussion available online?
Re: Zcoin implementation bug enabled attacker to create over 500K Zcoins
#213The point I'm about to make in this comment is so old and has been said so many times that we all are tired of hearing it. But why do we use a language like C++ to implement something where we don't wish to have bugs? C++ is not memory-safe (no GC or whatever Rust does), it's not type safe (in the ML sense), it relies on writing to memory a lot (instead of having pure functions). Had this program been written in Ocam…
You are looking at a 1k LOC function in a 7k LOC file with a bug that can be easily spotted by -Wall and you think it's the fault of the programming language? The only thing irresponsible is putting your hard-earned money into the 100th Bitcoin fork maintained by some guy with an Anime avatar. Once you stop trusting the developers it essentially becomes an underhanded ... contest and no language wins.
Bitcoin was also created by someone using a Japanese pseudonym, same place anime comes from.
Re: Zcoin implementation bug enabled attacker to create over 500K Zcoins
#214Is this displaying in a weird way for anyone else? I half thought that this was a bug or something, some attack(?).
Re: Zcoin implementation bug enabled attacker to create over 500K Zcoins
#215Earlier quoted context omitted.
Yep. I'd add that if it's a warning you're absolutely certain of, use the warning control pragmas to suppress them, and document why the warning's suppressed. Keep the compiler output clean so you can see where you need to examine.
Yup. I'm a big fan of -Wall -Wextra -Werror If these options are set before you write any code, then these problems don't arise.
-Weverything
Which does actually turn on all warnings (so you'll probably want to add things like -Wno-unused -Wno-padded).Under gcc, '-Wall -Wextra -Wpedantic' does not enable all warnings. There are still more than 40 flags you have to give if you really want all of them.
The reason why boggles my mind to this day.
Re: Zcoin implementation bug enabled attacker to create over 500K Zcoins
#216Earlier quoted context omitted.
Hello world in Rust is still 2.5MB if you statically compile all the libraries in since it doesn't strip unused functions. The tools and ecosystem are nowhere near what they are for C++
If this matters to you, it's not hard to get it down to something much smaller.
Re: Zcoin implementation bug enabled attacker to create over 500K Zcoins
#217Earlier quoted context omitted.
Hello world in Rust is still 2.5MB if you statically compile all the libraries in since it doesn't strip unused functions. The tools and ecosystem are nowhere near what they are for C++
> Hello world in Rust is still 2.5MB if you statically compile all the libraries in Still? Since when? Last I checked it was 661kB for Rust vs 829kB for C, and that was quite a while ago. http://stackoverflow.com/a/29461455/2343847
Re: Zcoin implementation bug enabled attacker to create over 500K Zcoins
#218Re: Zcoin implementation bug enabled attacker to create over 500K Zcoins
#219Earlier quoted context omitted.
Properly unmanaged code will probably always be faster than managed code. But the point still stands. Code in a managed language, identify the hot spots and inject highly performant unmanaged code there. There is no need to go full C++ for 99.999% of all projects.
Like this? http://benchmarksgame.alioth.debian.org/u64q/program.php?tes... How should /unsafe be set with .Net CORE csproj ?
"buildOptions": {
"allowUnsafe": true
}
I was able to fake something for dotnet migrate and find the needed setting:
true
Re: Zcoin implementation bug enabled attacker to create over 500K Zcoins
#220Earlier quoted context omitted.
Didn't try, but I could imagine that running -Wall over that codebase produces huge amounts of noise rendering it practically useless, until somebody gets to fix all warnings which are not bugs.
> -Wall over that codebase produces huge amounts of noise rendering it practically useless As a c++ developer I would nope the hell out of there or spend a month fixing the warnings - depending on pay. No way would I work with something in that state long term. > until somebody gets to fix all warnings which are not bugs. Code that is filled with ignored warnings generally gets worse, not better. Having little to no…
You can have code without any warnings in clang, gcc and msvc++ compilers and it is probably better than code tested with only one compiler.