Live data from Hacker News

Missing line in a smart contract leads to $10M hack

rekt.news

291–300 of 333 posts

Re: Missing line in a smart contract leads to $10M hack

#291

Earlier quoted context omitted.

Does anyone else feel like replacing all the legacy finance infrastructure with decentralised code is going to produce a worrying number of stories like this? Most of the examples I've seen so far it's happening to someone who works in tech, has disposable income, and is generally a proponent of cryptocurrency. I haven't written a lot of decentralised code in production, but I get the impression there is generally mo…

It's worse than that. Contracts are not code. It's a complete misunderstanding to posit them as such. Contracts depend first and foremost upon the legal regime in which they are valid. Every jurisdiction has rules, precedence, language means specific things. There is quite a bit of variability in this stuff, which is why we have lawyers. And Judges. Putting a contract into a crypto ... is basically pointless. There's…

> Contracts depend first and foremost upon the legal regime in which they are valid. Every jurisdiction has rules, precedence, language means specific things.

One could counter that no code ever stands alone, but is executed in terms of some runtime.

But I think I can bolster your point with two further thoughts:

1. Contracts are not meant to be code. The process of drafting a contract helps people arrive at a common understanding - a shared consensus, a "meeting of the minds" - and once signed, it then documents that understanding along with relevant context sufficient for third parties to be able to recreate that common understanding.

The contract is not executable - it, at best, is a declarative description of some of the outcomes. The actual execution is handled independently by the parties that entered the contract. The contract only exists so that common understanding can be preserved through time and shared with other people - whether it's because some party forgot the details, or it needs to be modified, or third parties (like lawyers, judges or arbitrators) need to be involved in dispute resolution.

2. To the extent a contract contains anything resembling executable code - say, the aforementioned declarative descriptions of outcomes, or imperative descriptions of specific behavior, or some attachments with deliverable specifications, etc. - these are all expressed in a very high-level programming language, i.e. natural language. This "code" is ultimately "executed" by sapient human beings. In other words, the programming language and runtime in questions are GAI-complete: that is, coding them up from scratch, e.g. to enable "smart" contracts to be comparable in utility to regular ones, would be equivalent to creating a human-level general-purpose artificial intelligence. We're not anywhere close to achieve that, thus by definition, "smart" contracts are too dumb to make sense when we can use the normal ones.

Re: Missing line in a smart contract leads to $10M hack

#292

Earlier quoted context omitted.

Does anyone else feel like replacing all the legacy finance infrastructure with decentralised code is going to produce a worrying number of stories like this? Most of the examples I've seen so far it's happening to someone who works in tech, has disposable income, and is generally a proponent of cryptocurrency. I haven't written a lot of decentralised code in production, but I get the impression there is generally mo…

I think the big issue is using tools without verification infrastructure. Of course there are specification level bugs to deal with but hacks seem to be oh so often the simple "I forgot to initialise a variable" kind of attacks. I think we really need to be splitting up code for smart contracts into 3 classes: - Low Complexity, Automated Assurance: Non-turing complete DSLs that allow you to fully reason about their b…

There are some interesting projects on Tezos in this regard:

https://archetype-lang.org/ is a non-turing complete dsl that you can run http://why3.lri.fr/ proofs on.

Another way is to run proofs on the michelson that was generated by a higher level language (https://ligolang.org/, https://hackage.haskell.org/package/morley ...) with: https://gitlab.com/nomadic-labs/mi-cho-coq

The most interesting project (still alpha i think) to me is: https://juvix.org/ a rather elegant dependently typed language.

Re: Missing line in a smart contract leads to $10M hack

#293

Earlier quoted context omitted.

> The "victim" voluntarily gave that money away. This explanation, much like its sibling "voluntary transaction" defense of market failures and economic coercion, sounds to me like a bully who hits their victim with their own arm, and then exclaims, "stop punching yourself!".

If the person who lost the money had to use smart contracts, you've got a point. If they used them because they thought they were a good idea, I hope they learned their lesson.

Agreed, but the crypto crowd wants smart contracts to be ultimately used by everyone, which means (in their hypothetical world, which I hope never materializes) many if not most uses will be of the "had to use" kind.

Re: Missing line in a smart contract leads to $10M hack

#295
post #55

Many people are asking what happened, because the article does not go much into detail. The code is there (linked in the article): https://bscscan.com/address/0x7a8ac384d3a9086afcc13eb58e9091... After spending 2min on it and using this hint from the article: > The affected pool contract had an initialize() function that should have been activated after deployment. > The line: initialized = true; is missing from the f…

Why contracts don't have a test suite that verifies them?

Because the entire field is nonsense and pyramid schemes. Ethereum derives their smart contract langage from JavaScript for fuck’s sake. That alone should tell you that their interest was always to disregard everything in order to maximise adoption. And then they added pitfalls to JavaScript because it was not broken enough for their tastes.

Re: Missing line in a smart contract leads to $10M hack

#296
post #2

I wonder when people will realize that the complexity inherent in human financial transactions will not go away just because you write code instead of natural language and 'decentralized finance' will reinvent everything it tried to get rid off (but shoddily) because nobody likes to lose their live savings because they missed a semicolon.

At least a smart contract can be unit tested thoroughly, whereas a 20 page legal document cannot be.

That’s not actually useful, thorough unit testing can not prove the absence of bugs in the contract.

Re: Missing line in a smart contract leads to $10M hack

#297
post #253

Earlier quoted context omitted.

Are judges going to manage to identify and compel enough miners (or devs, i guess, assuming the miners adopt the compelled transaction revert version) to have enough hash power to win a fork?

this could easily be combined with legislation providing tools to make it harder and harder to participate in mining off-fork. US financial laws have been very useful for the gov't to be able to de facto give it worldwide jurisdiction in some areas, I think there would be relatively few qualms about continuing down this path. Especially if (for example) Robinhood and Coinbase were forced to follow along. At one point…

This would require an incredible amount of international cooperation. It might be possible, but I doubt it likely.

Re: Missing line in a smart contract leads to $10M hack

#298
post #94

Earlier quoted context omitted.

What is the purpose of Solidity? Why did there need to be a new language for interacting with the Ethereum Virtual Machine? This really couldn't be accomplished by a python SDK?

What's the benefit? These are all human errors, easily reproducible in any language.

So none? Because I’d expect a langage custom built for smart contract to prevent or at least mitigate issues like mixing unrelated objects or never updating variables.

Re: Missing line in a smart contract leads to $10M hack

#299

Earlier quoted context omitted.

Judges have tremendous amounts of discretionary power when carrying out the law, and a good judge certainly isn't going to just give up because the identity of one party isn't immediately known. The example already given of ordering that the transaction be reversed on the network (even if that involves compelling uninvolved people to cooperate with the process) is entirely plausible.

Are judges going to manage to identify and compel enough miners (or devs, i guess, assuming the miners adopt the compelled transaction revert version) to have enough hash power to win a fork?

For example, the court could declare that this transaction was illegal, and anything spent from it is also illegal forever. The ledger is open, so courts can compel exchanges to watch for such transactions and report anyone that can spend coins derived from them (exchanges have already been forced to comply with KYC).

This would destroy the real-world value of this block, basically making it a digital equivalent of dirty money.

Re: Missing line in a smart contract leads to $10M hack

#300
post #251

Earlier quoted context omitted.

100% code coverage isn't even close to a guarantee of correctness.

But is the easiest metric to guage test quality. What I’m saying is this code is probably not well tested

This code isn't tested at all. They messed up copying code from a previous implementation, that's how bad this is. If they had had a few basic tests in place they would've spotted this before it even had a chance to be a problem.
Post reply on HN