Skip to content

Commit

Permalink
Updates readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruteri committed Oct 4, 2023
1 parent 94de7e9 commit 42dc985
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 22 deletions.
71 changes: 49 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,44 +180,71 @@ Other than ability to access new precompiles, the contracts aiming to be execute
### Confidential compute requests
We introduce two new transaction types: `ConfidentialComputeRequest`, serving as a request of confidential computation, and `SuaveTransaction` which is the result of a confidential computation. The new confidential computation transactions track the usage of gas during confidential computation, and contain (or reference) the result of the computation in a chain-friendly manner.
We introduce a few new transaction types.
![image](suave/docs/conf_comp_request_flow.png)
* `ConfidentialComputeRecord`
confidential compute requests (`ConfidentialComputeRequest`) are only intermediary messages between the user requesting confidential computation and the execution node, and are not currently propagated through the mempool or included in blocks. The results of those computations (`SuaveTransaction`) are treated as regular transactions.
This type serves as an onchain record of computation. It's a part of both the [Confidential Compute Request](#confidential-compute-request) and [Suave Transaction](#suave-transaction).

```go
```go
type ConfidentialComputeRecord struct {
ExecutionNode common.Address
ConfidentialInputsHash common.Hash
// LegacyTx fields
Nonce uint64
GasPrice *big.Int
Gas uint64
To *common.Address `rlp:"nil"`
Value *big.Int
Data []byte
// Signature fields
}
```

* `ConfidentialComputeRequest`

This type facilitates users in interacting with the MEVM through the `eth_sendRawTransaction` method. After processing, the request's `ConfidentialComputeRecord` is embedded into `SuaveTransaction.ConfidentialComputeRequest` and serves as an onchain record of computation.
```go
type ConfidentialComputeRequest struct {
ExecutionNode common.Address
Wrapped Transaction
ExecutionNode: address,
Wrapped Transaction,
ConfidentialComputeRecord
ConfidentialInputs []byte
}
```
```
`SuaveTransaction` transactions are propagated through the mempool and inserted into blocks as expected, unifying confidential computation with regular on-chain execution.
* `SuaveTransaction`
```go
A specialized transaction type that encapsulates the result of a confidential computation request. It includes the `ConfidentialComputeRequest`, signed by the user, which ensures that the result comes from the expected computor, as the `SuaveTransaction`'s signer must match the `ExecutionNode`.

```go
type SuaveTransaction struct {
ExecutionNode common.Address
ConfidentialComputeRequest Transaction
ConfidentialComputeRequest ConfidentialComputeRecord
ConfidentialComputeResult []byte
/* Execution node's signature fields */
}
```
```

![image](suave/docs/conf_comp_request_flow.png)

The confidential computation result is placed in the `ConfidentialComputeResult` field, which is further used instead of the original transaction's calldata for on-chain execution.

The basic flow is as follows:

1. User crafts a usual legacy/dynamic transaction, which calls the contract of their liking
2. User crafts the confidential computation request (`ConfidentialComputeRequest`):
1. User choses an execution node of their liking, that is an address whose signature over the confidential computation result will be trusted
2. User embeds the transaction from (1.) into an `ConfidentialComputeRequest` together with the desired execution node's address
3. User signs and sends the confidential computation request to an execution node via `eth_sendRawTransaction` (possibly passing in additional confidential data)
3. The execution node executes the transaction in the confidential mode, providing access to the usual confidential APIs
4. The execution node creates a `SuaveTransaction` using the confidential computation request and the result of its execution, the node then signs and submits the transaction into the mempool
5. The transaction makes its way into a block, by executing the `ConfidentialComputeResult` as calldata, as long as the execution node's signature matches the requested executor node in (2.1.)

The user passes in any confidential data through the new `confidential_data` parameter of the `eth_sendRawTransaction` RPC method. The initial confidential computation has access to both the public and confidential data, but only the public data becomes part of the transaction propagated through the mempool. Any confidential data passed in by the user is discarded after the execution.
1. User crafts a confidential computation request (`ConfidentialComputeRequest`):
1. Sets their GasPrice, GasLimit, To address and calldata as they would for a `LegacyTx`
2. Choses an execution node of their liking, that is an address whose signature over the confidential computation result will be trusted
3. The above becomes the `ConfidentialComputeRecord` that will eventually make its way onto the chain
4. Sets the `ConfidentialInputs` of the request (if any)
5. Signs and sends the confidential computation request (consisting of (3 and 4) to an execution node via `eth_sendRawTransaction`
2. The execution node executes the transaction in the confidential mode, providing access to the usual confidential APIs
3. The execution node creates a `SuaveTransaction` using the confidential computation request and the result of its execution, the node then signs and submits the transaction into the mempool
4. The transaction makes its way into a block, by executing the `ConfidentialComputeResult` as calldata, as long as the execution node's signature matches the requested executor node in (1.2.)
The initial confidential computation has access to both the public and confidential data, but only the public data becomes part of the transaction propagated through the mempool. Any confidential data passed in by the user is discarded after the execution.
Architecture reference
![image](suave/docs/execution_node_architecture.png)
Expand Down
Binary file modified suave/docs/conf_comp_request_flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 42dc985

Please sign in to comment.