6 ms·
> I guess the current API is quite low level and doesn't include higher level abstractions to prevent this kind of attacks. A fundamental principle of Ethereum
by mannykannot 9y ago
> I guess the current API is quite low level and doesn't include higher level abstractions to prevent this kind of attacks.
A fundamental principle of Ethereum is that its smart contracts have Turing-complete computing power. Therefore, there is no possibility of 'higher level abstractions' that will permit only legitimate contracts to be written (even if the abstractions are limited in their power, an attacker can make use of the full power of the underlying system.)
Writing provably-secure smart contracts is as difficult as writing provably-secure software for any other Turing-complete platform: i.e. only a small percentage of developers can do it. Furthermore, the software that comprises the platform itself has not been stringently verified.
Of course, we are using lots of software in banking and finance that is not formally verified, but there are significant differences: it runs in secured environments with controlled and very limited external access, and there are out-of-band methods for correcting mistakes. In contrast, blockchain currencies are actually promoted as being immune to this sort of interference on account of transactions being irrevokable (and no, the hard fork that rescued the DAO participants is not a counter-example, as that will not be feasible in future.)
I cannot say these problems will not be resolved in the future, but why would anyone put any significant value at risk until they are?
- Nekorosu 9y agoThanks! That's really interesting and makes sense. I should definitely do some research on the topics you've mentioned. Your closing questions has a point I agree on.
- runeks 9y ago> Therefore, there is no possibility of 'higher level abstractions' that will permit only legitimate contracts to be written (even if the abstractions are limited in their power, an attacker can make use of the full power of the underlying system.) High level abstractions and Turing completeness are not in opposition. Haskell, for example, offers high level abstractions in the form of a functional language with abstract data types, strong typing and purity (unless you specify something else explicitly, functions only have access to their arguments). I think Safe Haskell would be a good Turing-complete, general purpose contract language. Untrusted code can be compiled to machine code and executed safely, by using a restricted IO monad that only allows specific input/output operations[1], so the contract logic can be executed safely without a sandbox. [1] https://downloads.haskell.org/~ghc/7.4.1/docs/html/users_guide/safe-haskell.html https://downloads.haskell.org/~ghc/7.4.1/docs/html/users_gui...
- mannykannot 9y agoI don't know if the abstractions of Safe Haskell, or something like it, will be sufficient. The link you gave seems to imply that the guarantee of trustworthiness is restricted to something less than every aspect of the code's semantics. One problem, as I see it, is that, from a computing point of view, a fraudulent contract may be indistinguishable from a valid one. You see this principle in the claim sometimes made that the DAO hack was not theft because a contract means exactly what its code does, nothing more and nothing less (that's not a view I hold, of course, or I would not be worrying that theft is possible.)
- tom_mellior 9y agoIt's nonsense to suggest that any two Turing-complete programming languages are equally safe or secure. C, Rust, and Haskell are all Turing-complete, and while of course it's possible to write buggy code in all of them, certain classes of bugs that are possible in C are not possible in Haskell. > there is no possibility of 'higher level abstractions' that will permit only legitimate contracts to be written True, but there is the possibility of trivial changes that would prohibit some exceptionally catastrophic bugs. The language features that allowed last weeks multisig walled bug (delegation to an unknown function, public initialization code, the possibility of calling initialization code after initialization) need not be like that. A much better language could still be Turing complete but exclude such things (forcing you to write explicit code that shoots you in the foot, if you so wish).
- mannykannot 9y ago> It's nonsense to suggest that any two Turing-complete programming languages are equally safe or secure. Well, I didn't suggest it - it seems you are inventing that notion because you are obliged to agree with everything I actually wrote. The point is not the relative safety of one language against another, but whether, in absolute terms, Ethereum will become safe enough for the sort of wide-ranging uses that its promoters envisage. If the sort of examples you present here are sufficient for that, then, given that security and correctness have been prized for long before Ethereum, one has to wonder why they have not already been used to create languages that are already secure and bug-resistant enough for Ethereum. There is certainly some basic changes that could make Ethereum more secure, but past experience in this field suggests there is a whole range of hills beyond this one. And in security matters, going part-way is not much of an advance at all; such defenses can, like the Maginot line, be outflanked.
- tom_mellior 9y ago>> It's nonsense to suggest that any two Turing-complete programming languages are equally safe or secure. > Well, I didn't suggest it - it seems you are inventing that notion You wrote: "Writing provably-secure smart contracts is as difficult as writing provably-secure software for any other Turing-complete platform". This is not true. Writing provably-secure smart contracts in something like C would be strictly harder than in Solidity because there are more classes of possible errors, and hence more properties to be proved. There are meaningful differences in the ease of proof even among Turing-complete languages. And some things you would have to prove explicitly for programs in one language are automagically "proved" for you by other languages' compilers. So yes, you did suggest that any two Turing-complete languages are equally safe and secure. > because you are obliged to agree with everything I actually wrote Haha. No.
- drdeca 9y ago> Therefore, there is no possibility of 'higher level abstractions' that will permit only legitimate contracts to be written (even if the abstractions are limited in their power, an attacker can make use of the full power of the underlying system.) What? Wouldn't "choose one of these 10 contracts which have been proven correct, and also choose the parameter for said contract" be using a higher level abstraction? And if the 10 contract are proven correct+secure, then this would be secure, right? I don't understand what you meant by "an attacker can make use of the full power of the underlying system" such that it is compatible with the security of the abstraction I described.
- mannykannot 9y agoThat is a fair point; I appear to have overstated the case there. However, at least two things remain to be seen: 1) to what extent the Ethereum foundation's vision of a vast web of concurrent, interacting contracts is feasible under such restrictions, and 2) an actual example of a formally-verified contract (which would, I believe, depend on the platform itself being formally verified as a prerequisite.) To expand on point 1, given that your technique should be generally applicable, why has it not taken over all the other applications of computing where security and correctness matter? The reason, I believe, is that it is, in practice, infeasible for many of the sort of things that are useful and that we actually want to do.
- drdeca 9y agoRight, I wasn't really proposing that people should restrict themselves to 10 proven correct ones. It was mainly meant as an existence proof. I believe that people have made formally verified (trivial?) contracts (based on the spec of the vm iirc? Not sure), but I don't remember anything about a formally verified contract being used in practice. People definitely are making progress on the formal verification front (building foundations/infrastructure/etc.) but they aren't really there yet. ("There" being, ready for widespread use, and in widespread use) I don't really understand why people buy into many of these ICOs. I mean, I'm somewhat enthusiastic about "smart contracts", but I don't actually own any cryptocurrency. I don't mean to say that I think all ICOs are bad, but given the number that are failing, I find it hard to imagine that the people buying into them are doing enough research into them before buying for it to make sense. Also, I don't understand why people aren't building contracts on top of a contract layer that handles arbitration for reversing fraudulent transactions yet? I thought that would have been built by now.