1

In the following post, Vitalik Buterin claimed that ETH2-Sharding will not break DeFi composablity: [1] https://ethresear.ch/t/cross-shard-defi-composability/6268

However, I am not at all convinced by his arguments. Let's look at the following example from Vitalik [1]:

Composability example 1: Uniswap <-> Tokens Nearly all DeFi applications are uses of composability, because tokens are a type of application and so any DeFi application that uses tokens is an application that interacts with another application. Let us look at Uniswap as an example. In Uniswap, a user sends some quantity of token A to a Uniswap contract, which sends some quantity of token token B back to the user. Uniswap requires strict dependency between all transactions that interact with it: the Nth transaction must be aware of the output of the N-1’th transaction, because this is how the price updating algorithm works.

Hence, the Uniswap contract would need to live on a single shard (there are designs for multi-shard Uniswap, but they are more complex). Users looking to trade would perform a 2-step procedure:

Send their token A to the shard that Uniswap is on. Perform a trade with Uniswap as before (the transaction doing this would be combined with the transaction “claiming” the receipt from step (1), so it’s a single step) [Optional] If desired, move the token B that Uniswap gave them to some other shard.

Now this is a very simple use case. Since Uniswap acts as an automated market maker, it seems pretty obvious that Uniswap wants to run on a single shard. However, sending token from one shard to another shard seems to be very tedious for DeFi users. If I want to trade with DeFi-assets, then I don't want to care about moving ETH between shards. I just want to invoke a smart contract, and I don't want to care about where a particular smart contract is sharded. For me, this seems like a lot of needless technical complexity for the average DeFi-trader.

But this is just one aspect that I am concerned about. The other aspect is that Vitalik's Uniswap example does not explain at all how atomic composability is still supposed to work. For example, let's consider the use case of flash loans. Flash loans are uncollaterized loans that succeed only if they are paid back within the same transaction. In contrast, with asynchronous messages between shards, flash loans would probably be infeasible. And flash loans are just one advanced example, I am pretty sure that we could find many more advanced DeFi use cases.

So what do you think, do you believe that Vitalik did not even realize what "atomic DeFi composability" actually means?

2
  • Hi there. Could you perhaps find a way to rephrase your final question? As it stands you're asking us to speculate on what someone else might have been thinking (which is likely to get flagged as "opinion based", and is off-topic). Unless Vitalik himself answers, any answers you get will be subjective guesses based on incomplete evidence :-) Feb 7, 2021 at 10:42
  • My question is about atomic composability in ETH2 shards. I am always trying to avoid strong opinions since my goal is to get a grasp of this topic.
    – Mike76
    Feb 7, 2021 at 16:56

1 Answer 1

1

Vitalik is pretty smart. I'm sure he realizes that Eth v1 style composability would be broken when sharding is added to Eth v2. However, he is not wrong in saying that composability is still possible in Eth v2.

In a general sense composability just means being able to have the inputs and outputs of independent contracts interact in a seamless way. A big part of what allows for composability are standards like ERC20. However, people have associated the word composability to mean that the interactions between the contracts must happen in a single transaction.

In the article you referenced Vitalik specifically says that atomic composability will not be possible. 'workflows of the form “do something here, then do something over there, then do more things here based on the results of things over there, all atomically within a single transaction” will not be supported'. What Vitalik describes in the article could be called "manual composability" or perhaps "linked composability" if the multiple steps are automated with a script. It clearly is not atomic composability where a single transaction links together multiple independent contracts.

Within atomic composability, there can be "synchronous composability" (like Eth v1) and "asynchronous composability" (like NEAR). With asynchronous composability "The full transaction is sent to the first shard, and once the transaction is included in the chunk, and is applied after the chunk is included in a block, it generates a receipt transaction that is routed to the next shard where the transaction continues execution in a future block. If more steps are required, the execution of the receipt transaction generates a new receipt transaction and so on." (from the NEAR whitepaper).

The only project that is working on and has demonstrated atomic synchronous composability is Shardeum; an EVM based sharded smart contract platform. You can see a demonstration of it in this video https://youtu.be/sKczslvXBd4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.