I am hoping that the recent events -- Theranos, out-smarted contracts, etc. -- will permit a return to maturity in this field. Money has poisoned this field.
[1]: wrote about (genetically) evolving cellular corporation back in '96 so this is not a case of I don't get it.
Maybe I spent too much time in functional languages and I've been doing too much React stuff lately but the way I see it, we have
Contract_method(state, parameters) => {new state, return value}
You could always run the program on a fake, mock state then test postconditions for sanity. So, if those postconditions pass and we haven't run out of gas, run the program for real, otherwise return an error.Eg transferring 30 eth from contractA to contractB you would have one of the postconditions asserting that ContractA balance is the old balance minus 30.
The notion of gas implies a stack or effort limit, so it's guaranteed that any operation will eventually fail once it runs out of resources. Thus you can specify a theoretical upper limit on resources used in pre-verification, which (AFAIK)is paid by the client contract that requests to withdraw money from the other contract.
I guess one could avoid this by using a DSL that is formally verifiable, but it's still an interesting option
What you described is basically abstract interpretation and if it was designed properly then the type system would have taken care of the simulation piece.
Actually, termination checkers often compare the size of the term being reduced before and after an evaluation step, and if it can prove that it's always smaller, then termination is assured. With the notion of finite amounts of gas, termination seems assured, so this termination analysis can (and should) be added to EVM.
Based on this termination property, all sorts of static analyses now become possible.
Many high-tech fintech digital contracts are written in languages like Haskell or Ocaml. Fintech people value strong types, declarative programs, immutability, etc.
You usually get that through a restricted subset of an otherwise turing-complete language. The standard approach is to impose a finite metric on the arguments of a function and demonstrate that, as the function recurses, that metric monotonically approaches zero.
>barely becoming practical in languages like Rust.
As far as I know, this cannot be done in Rust. Agda, Coq, and Idris are the primary languages supporting termination checking (because they are syntactically suited for it). Haskell supports it as well through Liquid Haskell.
> Dependent types aren't the easiest thing to pick up.
Look at liquid types. They're a lot easier to leverage in practice. Liquid Haskell is all just comments on top of a regular Haskell program.
While this implementation of The Dao has failed, Ethereum is the only blockchain where implementing The Dao is possible.
Given how hard it is to avoid accidentally introducing these three "simple" elements, Turing completeness often turns up without being planned for.
It is meant to be able to do more computation based stuff than Bitcoin, but without being Turing complete.
However, they seem to have confused the halting problem not being computable with Godel's second incompleteness theorem? (They might have corrected this since I saw when they published something with this.)
They seem to be related concepts. See http://www.scottaaronson.com/blog/?p=2725 for discussion of some interesting examples:
> [...] has explicitly constructed a one-tape, two-symbol Turing machine with 7,918 states, whose behavior (when run on a blank tape) can never be proven from the usual axioms of set theory, under reasonable consistency hypotheses. Adam has also constructed a 4,888-state Turing machine that halts iff there’s a counterexample to Goldbach’s Conjecture, and a 5,372-state machine that halts iff there’s a counterexample to the Riemann Hypothesis.
But yes, the two definitely are connected.
For example:
A program which could solve the halting problem would be able to determine whether a given system is consistent.
So, as a result, if a system could prove that a program solved the halting problem, and it could simulate programs running, then it could simulate the program that solves the halting problem being applied to a program that searches for inconsistencies in the system. This would allow it to prove whether it is itself consistent.
Therefore, by Godel's second incompleteness theorem, a system which can simulate programs for any number of steps, and which is consistent, and which can do arithmetic and such, cannot prove that any particular program solves the halting problem.
Admittedly, this is a lot weaker than "no program solves the halting problem", but I think it is a fairly clear connection.
So, yes, I agree that they are related.
But Ethereum's Turing completeness (or, Turing completeness except being limited by gas costs), does not mean that Ethereum is "inconsistent", because that is, uh, pretty much a nonsense claim. And that is the claim that I think the other group was making (Though they may have stopped making it since.)
Also, btw, wrt that blogpost, they got the number of states for a machine which ZFC cannot prove does not halt, but which does not halt, down to, iirc, like 2030 ? But you probably knew that already because it is the next blogpost on there.
But yeah that is a cool result!
The average programmer should not be writing multi-million-dollar contracts.
It's not that hard, some wants X and some wants Y in exchange.
I'm not a lawyer but I write contracts with my clients. If you keep things simple it should fit most people. making g smart contracts complicated you keep it in the area of a small elite who are knowledgeable of playing safe with it.
I wold go as far as make it as simple as HTML.
You heard wrong. Regex is specifically not turing complete. It corresponds to the class of machines called DFAs. Above regexes are CFGs, which correspond to pushdown automata. Above CFGs are CSGs, which correspond to linear bounded automata. Above CSGs are unrestricted grammars, which correspond to turing machines.
You may be thinking of PCREs, which aren't actually regular expressions, but are sometimes erroneously referred to as such. I don't know if those are turing complete or not.
Jesus what has this field come to.
There are an infinite number of non-Turing complete languages. Not-Turing complete != Bitcoin.
I think the idea vehind TC is that now you could write in certain styles that do guarantee termination without sacrificing readability.
For example if you're working with just primitively recursive functions you can always guarantee termination
So the prerequisite for people investing is for the contract to be in a certain style, or something
EDIT: besides, even without TC you still need to check the contract for logic bugs. TC is a bit of a red herring for "due diligence is always needed"