You are viewing a single comment's thread from:

RE: EOS.IO Transaction Structure - Developer's Log, Stardate 201707.9

in #eos7 years ago

What happens if sam is evil and implements a sam::apply_currency_transfer(data) that never returns?

Sort:  

That depends on how much EOS sam buys. If he bought the entire supply of EOS, he could freeze the network until all the witnesses abandoned him. The previous holders of EOS could all thank him for the massive piles of cash he gave them, and then fork the network with sam excluded.

If he only has a small stake in EOS, his code should execute briefly (proportional to his stake) on the witness nodes and then be abandoned with minimal inconvenience to anyone.

I was thinking more along the lines of that he could block any transfers involving him, but I reread that part and it seems the sender could just exclude him from the recipients list and still have the transfer go through?

No, currency contract requires both sender and receiver to be in recipients list. Sender or recipient could implement apply_currency_transfer to auto reject every transfer.

An exchange would only block transfers that exceed user's balance with exchange contract, meanwhile other contracts may block all incoming transfers that they do not expect.

Ok I think I got it, it would be up to the contract to make sure any required recipients hook cannot be abused by a third party and in the currency case it's not a problem if either of the parties would like to stop the transaction from happening.

That's really powerful! I can't wait to try this stuff out on the testnet :)

Very nice answer !

An transaction that cannot execute in a couple of milliseconds is abandoned and never included in a block.