-
Notifications
You must be signed in to change notification settings - Fork 719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make message retryable and not spendable on gas #443
Make message retryable and not spendable on gas #443
Conversation
src/protocol/tx_validity.md
Outdated
@@ -83,39 +85,49 @@ If this check passes, the UTXO ID `(txID, outputIndex)` fields of each contract | |||
For each asset ID `asset_id` in the input and output set: | |||
|
|||
```py | |||
def sum_messages(tx, asset_id) -> int: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also provide type hints
for the parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good.
src/protocol/tx_format/input.md
Outdated
| `predicateData` | `byte[]` | Predicate input data (parameters). | | ||
| name | type | description | | ||
|-----------------------|----------------------------------------|------------------------------------------------------------------------| | ||
| `txID` | `byte[32]` | Hash of transaction or ID of originating message ID. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So in the case of a retried message, this is the tx id from the initial attempt to spend/use the message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this scenario (message had no data and just has an amount) there isn't really a concept of retry. The amount would just move along to whatever outputs were specified. A retried message is just the same InputMessage
until it is successfully spent.
Updated this design to keep messages separate from coins, while still allowing messages with non-zero dataLength to be retryable |
Honestly, I don't understand why we need The same question I have for It seems to me like we decided to optimize the verification on the L1 side with the usage of other primitives, but we stopped at some point and kept both variants. Also, maybe we can improve something in the design of fraud proofs after our last updates regarding bridging. I'm not against the |
My understanding is that the "pointers" are supposed to make the fault proofs easier (potentially single step fault proofs). It lets someone directly challenge where the proposed block is claiming its data is from (as opposed to having to challenge for this data from the proposer first). However, even if we can prove fault in a single step in this case, proving fault in VM execution will almost certainly have to be proposer/challenger interactive. So you're right, I'm not sure what we're really gaining... IMO, we should be optimizing for the optimistic case where faults proofs will never even be initiated. So I'd vote we eventually remove the pointers altogether and save on data. Embracing the optimistic case at the cost of increased fault proof complexity seems to be the winning OR design currently.
I'd vote we drop the |
I also vote for removing it if we can achieve all functionality that we need without it=) Do we need to wait for comments from @Voxelot and @adlerjohn before doing that? |
src/protocol/tx_format/input.md
Outdated
| `predicateData` | `byte[]` | Predicate input data (parameters). | | ||
| name | type | description | | ||
|-----------------------|----------------------------------------|--------------------------------------------------------------| | ||
| `messageID` | `byte[32]` | The messageID as described [here](../id/utxo.md#message-id). | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it was here before, but why must we duplicate the message_id
field if we can compute it based on the other fields?
I have only one assumption: because we want to put it into the memory of the vm
to be able to read it, instead of each time calculation.
But does this optimization worth 32 bytes per input?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm it does seem like we could omit the message id on inputs, since we have to re-compute the hash to validate it before spending anyways.
I'm also not sure how fraud-proofs would verify the messages. Since we can't lookup old events / logs, unless we put the message id into L1 contract storage I'm not sure which fields are actually needed. cc @pixelcircuits
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, we may end up putting the messageIds into storage for simplicity, but it's actually possible to prove emitted events given a starting block hash (you navigate down the chain and provide the necessary merkle proofs and hash preimages as necessary to show the log that occurred). I know Optimism intends to use this approach with Bedrock (essential complicate the fault proving, but optimizing for the optimistic case). This can also potentially be done in a zkProof via something like Herodotus (their main focus is to provide proofs of other chain history, but it could be used to prove Ethereum history on Ethereum itself). It would actually be really cool to use zkProofs like Herodotus to prove output messages in our Fuel chain instead of having a list of output messages always copied into the block header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pixelcircuits So, what is final conclusion?=) Do we need to keep the message id in the transaction, or it is okay to compute it during fraud proofs because we have access to all fields?
I think I agree. It's kinda funny because earlier in the comments of this PR, the idea of dropping the I'm also starting to think that we should update I'm also confused about where the actual output message data is getting stored/logged. It's not on the |
This also seems redundant, as it's storing data that should be derived from the existence of the output on the tx. If all we need is an output for the purpose of burning coins and all the data really comes from the receipt anyways, then we maybe we could reduce the output to only contain an amount? That way we can easily verify sum of inputs >= sum of outputs, and we don't include data unrelated to block validity? Or do we need some malleable (unsigned) field that can completely commit to the message output receipt for fraud proving (i.e. message id)? |
If we only have Also, where is the message data stored? The receipt only has a hash of the data. It feels kinda weird for the message data to not be returned after executing a transaction and instead we have to make a separate graphQL query to actually get it. But maybe not since a user will always have to make a separate graphQL to get the message proof anyway. |
Actually, I'm not sure why we need And we don't process it in the When we added this output, it participated in the But now, we don't do that(because the user does not sign it, I think), and this output seems partially useless to me. It only helps on the UI side to show that transaction has withdrawals. It may be worth considering removing this output. @adlerjohn |
This follow-up PR removes the `MessageId` from the receipt. Previously we removed it from the `Input` in the #443
Input messages are retryable until included in a script transaction that doesn't revert. The
amount
on an input message can no longer be spent on gas. Messages with no data are now spendable as an input coin (and only spendable as an input coin).