Upgradeable smart contracts in Ethereum
zohaib.me
zohaib.me
The article has full details on how to create a contract changeable by one party, then hand waving about "writing a contract that uses tokens and voting mechanism to allow the community to decide whether to update or not." No details on how that's supposed to work. Who's "the community", anyway? The parties to the agreement are the ones involved.
A mechanism where all parties to a contract could agree to replace it with a new contract would be useful. That's a normal contract activity. You do that whenever you renew a lease.
The Etherium promoters want this because they botched the design. Smart contracts as byte coded programs are too error prone. The DAO debacle, and this latest demand for a "state change" because someone botched a big contract, indicate that. Smart contracts should have been in some declarative form like decision logic tables, not Turing-complete programs with race conditions.
I know it's common, but please stop calling reentrancy bugs "race conditions". Smart contracts don't observe concurrent modification of state by other contracts and aren't internally concurrent. Solidity and the EVM object model have way too much implicit behavior, which can lead to unexpected control flows, but these unexpected flows aren't the result of other threads coming in and mucking up state.
Calling a simple reentrancy bug or spookily unexpected control flow a race condition lets the Solidity and EVM designers off too easily. Concurrency with shared mutable state is always difficult, but Solidity makes even simple single-threaded reentrancy difficult to get right. (On a side note, I'm a big fan of Actors/shared-nothing concurrency and think raw threads are almost always the wrong abstraction to expose to application-level developers.)
I also totally agree that Turing completeness is overkill for 99% of use cases, leading to bugs in simple contracts and makes analysis very difficult. If you really need Turing completeness, you could still explicitly construct it within a sufficiently expressive declarative non-Turing complete execution model via externally triggering repeated contract invocation. (For instance, a Brainfuck interpreter that advances one program step per contract execution.) The ecosystem would be Turing complete without contracts being Turing complete.
The possibilities are endless. You could have pre-chosen adjucators that can upgrade a contract on majority vote. You could use a decentralized prediction market like Augur to trigger a contract upgrade if it deems that certain events occurred, etc.
Upgradability is just one component of many that will be needed to create a durable/secure smart contracting system. It's not a silver bullet.
>>The Etherium promoters want this because they botched the design.
Do you misspell Ethereum deliberately? I only ask because I've seen you comment multiple times about Ethereum with this misspelling, which comes across as very petty.
>>The DAO debacle, and this latest demand for a "state change" because someone botched a big contract, indicate that.
The latest state change request is overwhelmingly rejected by the community and will not happen.
The request is only possible at all because of the temporary state of Ethereum having several hard forks planned that a state change can be snuck into.
Once this phase of its life cycle is over, even requests for a state change will not happen.
>>Smart contracts should have been in some declarative form like decision logic tables
The point of using byte coded programs and a Turing Complete execution environment is to make features like the smart contract programming language totally configurable, rather tied to a single base implementation.
Lots of people don't seem to appreciate this.
That's perhaps a too strong statement. Bitcoin's smart contracts are byte coded programs too, and have had none of these problems. Perhaps partly because a lot of the instructions were pruned early on, and only those deemed absolutely necessary for the kind of contracts that made sense were kept.
Why not? If you and I agree on something, and then agree to amend it, that's valid.
The reason all those things are so easy to do is down to years of work optimising the UI and handling errors well- we’ll get there with smart contracts too one day
This is probably a good case for natural language as a program. If smart contracts can be immutable natural language contracts that can be proven to compile to code in a repeatable manner then we're making progress.
https://consensys.github.io/smart-contract-best-practices/ge...
Decentralization and immutability are entirely separate subjects. The security benefits of decentralization are not lost just because pipeline components can be altered.
IMHO it violates basic guarantees of the blockchain that things underneath you won't change. The focus should be on designing correct contracts upfront, patterns, automatic provers etc. not "solving" the problem by allowing for arbitrary change.
Also "upgradable contracts" sounds nice but it's extremely difficult to actually upgrade more complex contracts, you can't just modify things the way you feel, the original storage can't be changed, this means you can't introduce/change/remove fields in existing structs etc.
Criteria to upgrade: like chrisshroba mentioned, one can use a decentralized algorithm to vote on upgrade, making it more fair. Altnerativley there are things like SageCoin in which a fair 3rd party can step in to settle a dispute. This is more centralized, but still blockchainers seem to appreciate this. Below is a quote from Vitalik that I think roughly applies here. (also im not trying to favor the latter method)
https://vitalik.ca/general/2017/12/17/voting.html "feelings in favor of completely algorithmic governance (emphasis on “completely”) are absolutely crazy"
So its more like the cofounder of Ethereum lost $91 million dollars in his own wallet, using his own smart contracts, using the language he wrote.
I am against the proposal to undo the deleted multisig wallet contract. Everyone makes mistakes, some are worse than others. You can never learn if every mistake can be undone.
The desire to sort out how to do updates is motivated by much more than just that particular incident.
This post describes a strategy for writing contracts that proxies the actual implementation of the contract to another contract. If the contract needs to be modified, a new contract is deployed and the original contract is set to point to the new contract.
Edit: I misread your comment. There has been a discussion over of a possible hard fork in order to recover lost funds, but that's not what the author is referring to in this post.
The danger here is that the user calling the contract is not aware of the proxy and the new contract does something unexpected.
It should be standard practice to have some governance model around the upgradeability (IE Multisig, Liquid Democracy, Aragon, etc...). Any contract that doesn't use some governance should be considered insecure and not used for financial transactions on the chain.