Replies: 6 comments 25 replies
-
Great write up! I'll provide more detailed comments later on - but this is very close to how I was thinking about it as well. There is one difference though - I imaged data flow to be somewhat different. Specifically, it could look something like this (for simplicity this is just for the plaintext state case): The flow is as follows:
Basically, in this approach, the account logic is fully responsible for ensuring that DA has the latest account state. The main advantage of this is that we don't need to add anything to the base protocol to support this. Potential disadvantages are:
There are also probably other advantages and disadvantages - so, we should try to think through them more. Also, dealing with the encrypted state adds a few more complications which I'll go over later. |
Beta Was this translation helpful? Give feedback.
-
A question here is what do you mean by public key? Are you imaging this being a simple multisig / data availability committe? If so, are we comfortable with the additional trust assumption this introduces? I would be strongly opposed to introducing multisig based DA into the protocol. An alternative would be to verify a consensus proof of the DA layer but then we introduce a honest majority assumption and verifying a consensus proof would be a highly complex and expensive task.
By design, DA layers do not compute on the data they make available, they simply commit to the data using some commitment scheme (merkle tree / kzg etc). I guess you are implying we introduce a custom data availability committee for Miden?
The biggest disadvantage in my opinion is the additional trust assumption on the data availability committee. I don't think this trust assumption should be introduced lightly. Another disadvantage is we make the transaction kernel interactive and as such the latency is constrained by the responsiveness of the data availability committee. Additionally, it makes offline transaction execution a bit more awkward. Its also worth crunching some numbers on this. Lets take an "extreme" case in which 2000 slots change across the account vault and storage for an account. In this case the account delta would be 2000 * 2 (key + value) * 256 = 125 kB. This is quite a large data blob to be posting to a DA layer. To put it into context Ethereum will support 1MB per block. |
Beta Was this translation helpful? Give feedback.
-
Good point, it does make sense to give the user the freedom to choose a solution that fits their requirements.
This makes sense.
I thin the cost of consensus proof verification is quite expensive inside a zk circuit. Here are some benchmarks from succinct labs for verification of Ethereum sync committee based protocol (not full consensus proof). An actual consensus proof with full validator set security would probably be orders of magnitude more expensive.
I think you made some very strong points about providing options for users which I agree with. I also think we should ensure that off-chain accounts can achieve full L1 security. As you say, encrypted on-chain accounts do in-deed provide a viable option for this. However, this being the only solution to achieve L1 security is not ideal as it is at odds with our goal of minimising state bloat. I would expect there to be some cost for storing account state on-chain (there must be or else it is an attack vector). So from a user perspective it will be cheaper to use L1 only for DA and store the account off-chain. We should also consider implications of this. If the user has encrypted on-chain account then they will have to post the full encrypted state after each transaction as the node operator will not be able to apply an encrypted account state diff (unless we use some form of homomorphic encryption? but this is likely out of scope anyway). Having to post the full encrypted account state every time increases bandwidth requirements on the network. If the account was stored locally then the user would fetch the new encrypted state diff, unencrypt it and apply it to their local plaintext account state.
I thin we can make a distinction between locally interactive and network based interaction. I also think it would be possible to sign messages ahead of time and load them into the advice provider instead of signing as requests are made by the the VM. |
Beta Was this translation helpful? Give feedback.
-
Some notes on this problem that occurred to me when chatting with @frisitano : The main point from the text below is that:
Protocol notesIn the above scenario we have two nodes sending valid transactions to the network, so we have race conditions that should be handled otherwise recovery is not guaranteed.
Trade-offs
Design spaceAbove I claimed that the protocol alone can not implement state recovery, because of account abstraction and nondeterministic inputs, what is the required state is not know by the VM. In that case, I think we can also leverage account abstraction and consider other design alternatives:
|
Beta Was this translation helpful? Give feedback.
-
One way we can try to figure out a comprehensive solution is to start with the simplest use case and see if we can expand from there. It seems to me that the simplest use case is:
I'll also narrow down the problem as follows: what changes do we need to make to the protocol to make sure that a user can place the following restriction on their account:
It seems to me that this functionality can be supported without any changes to the protocol. Here's how it would work. First, let's assume that account code has
While the above works, it has a couple of issues:
I'll leave the first issue for a different discussion. But the second issue should be pretty easy to solve: the user sends deltas for individual components (e.g., vault, storage, code) and the guardian applies them to the state they currently have. Then, everything else works as before. Privacy against state guardianNow, let's say the user doesn't want the state guardian to know the contents of their account. Assuming we have a way to efficiently perform encryption within the VM, the user could encrypt the state inside The state guardian has only the encrypted state, and thus, won't be able to tell if/when this state becomes committed. There are probably several ways to solve this problem, but as far as I can tell, all of them require some modifications to the core protocol. Two potential solutions which came to mind (and there probably more) are:
The first solution implies that we'd need to enshrine an encryption scheme in the protocol. It also is also much less flexible. It does however, provide more information to the protocol - and this could be useful in other contexts. But for now, let's say we go with solution 2. Now, the interaction would look as follows:
Encrypted state deltasAnother problem of dealing with the encrypted state is that we are back to sending the entire state to the guardian. The problem is that we cannot apply encrypted state deltas to an encrypted state to get a new state (unless we use homomorphic encryption - but this is probably prohibitively expensive). One potential solution is to encrypt the state in chunks. Let's take account vault as an example. The un-encrypted delta for the vault could look like so:
This obviously won't work for encrypted delta. But we may be able to do something like this: Let's say the initial account vault contains two fungible assets:
Now, let's say we execute a transaction which removes 90 MATIC from the vault. We could send the following delta to the guardian Now let's say we execute another transaction which adds 90 MATIC to the vault. The delta we'd send to the guardian is as follows: Note that even though both the first and the third state has |
Beta Was this translation helpful? Give feedback.
-
Not a full response but I wanted to table some questions / comments regarding state deltas.
Should it be What benefit is there in the state guardian reconstructing the current state? This proposal implies that the state guardian has the required business logic to construct the current state given the provided deltas. I.e. the business logic is enshrined into the state guardian. This provides an inherent coupling between the DA layer and the Miden protocol. This could potentially limit the number of viable state guardians that could be used. Would it be practical to convince Ethereum, Celestia, Avail, Google, Microsoft to encode our business logic? Maybe there would be some specialised services that do this but that could introduce some centralising forces. Additionally, orchestration of updates to the state delta logic could be challenging. An alternative solution is to treat the state guardian as a dumb bulletin board / append only log. It's only responsibility is to store and sign the state deltas that have been provided to it indefinitely. It would not be responsible for processing them or reconstructing the current state. To the state guardian, the deltas would look like random bits / data blobs. Lets now explore a potential implementation using this basis. During the |
Beta Was this translation helpful? Give feedback.
-
Overview
Polygon Miden has the unique property that node operators do not need to know the full state of an account to validate that a state transition was executed correctly against it. Node operators only need to know an initial commitment to the account state which allows them to verify a proof of a state transition to assert that it has been applied correctly before updating the commitment to reflect the new state of an account. We refer to accounts which only store a commitment to the account on-chain as off-chain accounts. It is the responsibility of the users to store their account data themselves. This is an effective approach at solving the state bloat problem which traditional blockchains struggle with. For more insight into this state model you can read through this blog post: https://polygon.technology/blog/polygon-miden-state-model. Off-chain accounts are also a foundational pillar of the privacy preserving capabilities that Polygon Miden can support. As only a commitment to an account is stored on-chain, no information can be extracted about the contents of the account.
Whilst this is a very powerful state model it does introduce some challenges. Namely, if a users account is compromised by a malicious actor and the actor executes a state transition then the original account owner will not be able to reconstruct the current state and will effectively be locked out of their account. This is the data withholding problem. A proposal was made suggesting that we should store the account data on-chain in an encrypted format. This solution enables private accounts however it reintroduces concerns around state bloat. Incase you are wondering why a user would want to recover a compromised account - it would be because they would be using account abstraction and may have (daily) spending limits in place so even if an account is compromised the attacker would not be able to drain all funds without the original owner realising and taking action.
We now propose an alternate solution that allows accounts to be stored off-chain, minimising state bloat, whilst also addressing the data withholding problem. The foundation of this solution is to leverage a data availability layer. When an off-chain account wants to transition the account to a new state they submit a transaction to the rollup, this transaction includes a commitment to the new account state, an account delta which encodes the changes to the account and a zero-knowledge proof attesting to the integrity of the state transition and state delta. The proof will be verified and the new account state commitment will be updated on-chain. The account delta will be posted to a data availability layer which will allow any user to fetch it to construct the new account state - in essence solving the data withholding problem. Whilst this solves the data withholding problem, we do not have privacy as anyone watching the data availability layer can reconstruct the current state of the account. To solve this problem we can encrypt the state delta that we are posting to the data availability layer. This means that only individuals with the encryption key will be able to decrypt the state delta and construct the new state.
This results in the following potential account models:
To simplify the protocol we may want to consider removing model 2, as model 5 is a suitable replacement for it (provided the DA layer has the same trust assumptions as the settlement layer - i.e. using ETH for both). We may also want to remove option 3 as this could lead to loss of accounts which we may want to prevent for our users. I also note that I think it is only required to encrypt the state delta for option 5, not the full account state. A leaner approach would be to support just models 1 and 5.
Data Flow
We will now describe the high level pipeline that I am envision around how the flow of account state diffs will work for off-chain accounts.
A user executes a transaction against an off-chain account producing a commitment to the new account state, an account state diff (optionally encrypted) and a zero-knowledge proof attesting to both the account commitment and the account state diff. The transaction is sent to the Miden rollup operator. The rollup operator includes this transaction in a new block, in doing so they verify the zkp, update the account state commitment on-chain and add a commitment to the account state diff to the block. This means that when a block is produced it will contain a commitment to all of the account state diffs it expects to exist on the data availability layer. The new block is then sent to the settlement smart contract on the settlement layer. The smart contract will verify that the block is valid and then assert that all of the account state diffs which have been committed to in the block have been made available on the data availability layer, after this the state in the smart contract will be updated. Below I have tried to illustrate this flow.
Beta Was this translation helpful? Give feedback.
All reactions