News for hackers. Stuff that matters.
Re:153k Ether Stolen in Parity Multi-Sig Attack by vog on Thursday July 20, 2017 @12:56AM (#14810090)
I never understood why they chose such a hacky language (an a VM model that encourages these kinds of languages), and expect people to write supposedly secure (in the sense of: obviously correct!) code with it.

Any remotely popular functional programming language created over the last years shows a better design (and taste) than this one.

And if that only attracts a certain type of programmers? (pun intended) That is, programmers valuing languages like Haskell/OCaml/F#/Kotlin/Rust, who would only ever touch C with verified compilers and 5 different static analysis tools?

Well, that's exactly kind of people you to attract to write your security-sensitive code.

Re:153k Ether Stolen in Parity Multi-Sig Attack by avaer on Thursday July 20, 2017 @01:04AM (#14810119)
99 out of 100 questions.

Solidity is ostensibly designed to let people write smart contracts for Ethereum.

More realistically, it is a marketing tool for enabling and onboarding people onto the Ethereum platform, which Ethereum benefits monetarily (enormously so) from. Security and design are secondary goals to the extent that they help prevent disasters which hurt adoption or churn developers away.

Through this lens it's not a mystery why the language is "hacky". Perhaps being a good language is not even the driving goal.

Re:153k Ether Stolen in Parity Multi-Sig Attack by vog on Thursday July 20, 2017 @04:28AM (#14810860)
> 99 out of 100 questions.

Curious question of a non-native speaker: What does this phrase mean? (in general, and in this context)

Re:153k Ether Stolen in Parity Multi-Sig Attack by brian_cloutier on Thursday July 20, 2017 @07:55AM (#14811642)
Don't feel too bad, I am a native speaker and I didn't recognize this phrase either.
Re:153k Ether Stolen in Parity Multi-Sig Attack by jaytagdamian on Thursday July 20, 2017 @05:02AM (#14810967)
Re:153k Ether Stolen in Parity Multi-Sig Attack by boycaught on Friday July 21, 2017 @06:56PM (#14824341)
Brilliant... and so true!
Re:153k Ether Stolen in Parity Multi-Sig Attack by thegavsie on Thursday July 20, 2017 @04:59AM (#14810958)
The answer to why most things are done is... Money !
Re:153k Ether Stolen in Parity Multi-Sig Attack by samblr on Thursday July 20, 2017 @04:21AM (#14810833)
>> it is a marketing tool for enabling and onboarding people onto the Ethereum platform

+1 : My feelings after going thru basics of ethereum.

Re:153k Ether Stolen in Parity Multi-Sig Attack by jes5199 on Thursday July 20, 2017 @10:08AM (#14812539)
a marketing tool that gets your money stolen is probably counterproductive in the long run
Re:153k Ether Stolen in Parity Multi-Sig Attack by erikpukinskis on Friday July 21, 2017 @03:00PM (#14822992)
From a Hegelian perspective, the best thing for Ethereum is for it to race back and forth across dialectics as quickly as it can. There will be many money stealing events as we discover how to do cryptocomputing safely. Better to get them over with now while the market cap is small and people know not to rely on it for anything too serious.

If they were to be as safe as possible, there would be less news, and they would push the traversal of those dialectics further into the history, when more people are using Ethereum and these kinds of events can do more damage.

It's beta. Don't worry about it. Come back in 10 years when the Heroku of Ethereum is released. Buy a couple Ethers now so you'll be rich then.

Re:153k Ether Stolen in Parity Multi-Sig Attack by user5994461 on Friday July 21, 2017 @12:17PM (#14821683)
The guys who just stole $30M and $70M beg to disagree.
Re:153k Ether Stolen in Parity Multi-Sig Attack by beaconstudios on Friday July 21, 2017 @05:02AM (#14819061)
but so is making developers write smart contracts in haskell, severely limiting the number of developers who can jump in and start coding, leading to a lack of adoption.
Re:153k Ether Stolen in Parity Multi-Sig Attack by federicobond on Thursday July 20, 2017 @10:22AM (#14812674)
Being a good, secure language for writing smart contracts is absolutely one of the most important goals for Solidity. I can say so because I have been involved as a regular contributor to the compiler for more than a year. If onboarding a lot of people to the platform quickly were the goal instead, they would have ported some crippled version of Java or JS and called it a day.

The problem is that it's just not easy to get all those details right from day 1, and interest in Ethereum has grown way faster than its capacity to produce a reliable, mature set of tools around it.

Re:153k Ether Stolen in Parity Multi-Sig Attack by mrkgnao on Thursday July 20, 2017 @11:58AM (#14813604)
To pick just one: mutable state by default is very difficult to justify as being a decision intended to promote security in a tool that is literally meant to construct financial/contractual instruments.
Re:153k Ether Stolen in Parity Multi-Sig Attack by federicobond on Saturday July 22, 2017 @01:33AM (#14825579)
Not that difficult. There is not much point in creating immutable contracts since they act like singletons.

This is different from the kinds of objects that you would instantiate in a language like Java, where best practices suggest defining as immutable unless you have a good reason not to.

Re:153k Ether Stolen in Parity Multi-Sig Attack by int_19h on Saturday July 22, 2017 @05:05AM (#14826139)
Just because a contract is mutable doesn't mean that everything needs to be.

For starters, not all functions on the contract are supposed to be mutating. Marking those that are as such would catch accidental mistakes when unnecessary mutations happen.

Then there's the issue with structs, collections etc all also being mutable by default, which is separate of contracts.

Finally, none of this actually requires any mutability at all. A contract could treated as a pure function that takes initial state as input, and returns the new state as output. Such a function can be written without any mutations at all, by constructing the new state piece by piece from the old one.

Sure, it would be a more verbose (although functional languages usually offer shortcuts like "give me a copy of this object, but with these fields set to different values", making it not so verbose after all). But on the other hand, it means that you have to explicitly consider the effect of every operation of the contract on every bit of state. "Don't repeat yourself" is not always a good thing - when it comes to security, you often do actually want to make people do redundant things, e.g.: http://www.atlasobscura.com/articles/pointing-and-calling-ja....

Re:153k Ether Stolen in Parity Multi-Sig Attack by twblalock on Thursday July 20, 2017 @12:36PM (#14813988)
These things are not just details. Things like scope, mutability, and operator precedence are core language design decisions.
Re:153k Ether Stolen in Parity Multi-Sig Attack by LeonidasXIV on Thursday July 20, 2017 @04:46AM (#14810909)
> Well, that's exactly kind of people you to attract to write your security-sensitive code.

Unsurprisingly, Tezos is actually written by OCaml people who seem to value the correctness of the contract language.

Re:153k Ether Stolen in Parity Multi-Sig Attack by cvsh on Thursday July 20, 2017 @07:44AM (#14811580)
>Well, that's exactly kind of people you to attract to write your security-sensitive code.

But not the kind of people you want to focus on to get traction for your venture-backed startup if you want a relatively quick and profitable exit

Re:153k Ether Stolen in Parity Multi-Sig Attack by federicobond on Thursday July 20, 2017 @10:10AM (#14812562)
None of the languages that you mention target the EVM, and the changes required to do so would turn them into restricted versions that look kind of like the original ones but have several differences that you need to keep in mind while programming in them. It makes quite a lot of sense to create a new language that takes advantage of the particular features provided by the EVM.

It's also quite hard for programmers to reason about performance or complexity in most functional languages. In the EVM, all functions should either be O(1) or bounded O(n) and should strive to use the most economical bytecode available to perform each task.

Disclaimer: I am a regular contributor to Solidity.

Re:153k Ether Stolen in Parity Multi-Sig Attack by vog on Friday July 21, 2017 @06:45AM (#14819395)
> should strive to use the most economical bytecode available to perform each task.

This is why I criticized the VM design as well as the language.

Yes, much effort went into making "cycle counting" as simple and straight forward as possible.

But I don't see any comparable effort doing the same for safety and correctness. (Apart from providing crypto primitives by the VM, which is neat, but only the tip of the iceberg in terms of language design.)

> It's also quite hard for programmers to reason about performance or complexity in most functional languages

This is true for Haskell, but "most" other functional languages don't suffer this issue: SML, OCaml, F#, Rust, etc.

Also note that lots of effort already went into creating lambda calculus variants where performance is especially easy to reason about. However, dismissing functional langauges as a whole already demonstrates that none that the research played any role in the design of EVM and Solidity.

In case you are interested, here is a nice starting point about the state of the art of 2014: "Structure and Efficiency of Computer Programs" https://www.cs.cmu.edu/~rwh/papers/secp/secp.pdf

Re:153k Ether Stolen in Parity Multi-Sig Attack by federicobond on Saturday July 22, 2017 @01:15AM (#14825520)
> This is true for Haskell, but "most" other functional languages don't suffer this issue: SML, OCaml, F#, Rust, etc.

I don't have much experience with the ML family of languages, so I may have jumped to conclusions based on my previous experience with Haskell/Elm, but I did not intend it to sound as a dismissal of functional languages at all.

In fact, there is a growing community of researchers working on functional language design for the EVM, but I would wager that it's way more complex to build such a compiler than something a bit more "close to the metal", especially since no one had much experience with the implications of the memory/storage/execution model of Ethereum at the time work started on Solidity, let alone the kinds of vulnerabilities these contracts would be exposed to.

Hindsight is 20/20.

Re:153k Ether Stolen in Parity Multi-Sig Attack by naasking on Monday July 24, 2017 @09:53AM (#14838451)
> especially since no one had much experience with the implications of the memory/storage/execution model of Ethereum at the time work started on Solidity, let alone the kinds of vulnerabilities these contracts would be exposed to.

Perhaps the Ethereum devs didn't have this experience, but this experience and knowledge was out there. The E programming language has been a vehicle for smart contract and security research for over 20 years. How many Ethereum and/or Solidity devs read the E research, learned the E language and played around with it?

There is also decades of research on formalized smart contract languages. Nick Szabo is well known in this space, and he wrote a draft paper on a great contract language back in 2002:

http://nakamotoinstitute.org/contract-language/

How many of the devs have read this paper?

Re:153k Ether Stolen in Parity Multi-Sig Attack by federicobond on Friday July 28, 2017 @05:09PM (#14877595)
I mentioned that no one had much experience with the implications of Ethereum's model and you point me to a bunch of articles but I fail to see how they apply to the case of Solidity.

What are the big ideas from E that Solidity is missing?

Also, the article by Nick Szabo has some interesting ideas, but as far as I understand, it does not describe a language for programming arbitrary smart contracts, just some notation for common financial contracts.

Re:153k Ether Stolen in Parity Multi-Sig Attack by eternalban on Thursday July 20, 2017 @05:55PM (#14816632)
> It's also quite hard for programmers to reason about performance or complexity in most functional languages

Yet another data point for 'why a TC language is a bad choice for smart contracts'.

Re:153k Ether Stolen in Parity Multi-Sig Attack by cel1ne on Thursday July 20, 2017 @05:26AM (#14811058)
Maybe they should have restricted their memory access model by using a stackbased language like Postscript.
Re:153k Ether Stolen in Parity Multi-Sig Attack by TeMPOraL on Thursday July 20, 2017 @07:06AM (#14811426)
> like Postscript

That would be cool. Even cooler would be if they created a code style culture around small contracts such that a contract should print out a legal-looking document with its own source code, when echoed to a printer.

Re:153k Ether Stolen in Parity Multi-Sig Attack by kaputsmack on Thursday July 20, 2017 @09:30AM (#14812246)
Why did you bundle an equally experimental language like kotlin amid those other well established and widely used languages?
Re:153k Ether Stolen in Parity Multi-Sig Attack by vog on Friday July 21, 2017 @04:42AM (#14819003)
I just wanted to also add a JVM-based language to the list, and Kotlin is the only one I'm aware of that plays remotely in the league (in terms of language design/quality) of the ML languages.
Re:153k Ether Stolen in Parity Multi-Sig Attack by masklinn on Monday July 24, 2017 @09:10AM (#14838108)
Kotlin is young rather than experimental, AFAIK there's no novel feature in Kotlin.