diff --git a/assets/OFA-example-flow.svg b/assets/OFA-example-flow.svg index 39a176d..9c0577e 100644 --- a/assets/OFA-example-flow.svg +++ b/assets/OFA-example-flow.svg @@ -14,4 +14,4 @@ - Userssends newBid asconfidential compute requestKettleSearchersends back run as confidential compute requestSUAVE PoA ChainMEV ApplicationsnewBidlog emittedConfidential Data StoreMEVMBlock BuilderbundleDomain-SpecificServicessimulate bundle against L1 chainpublish confidential computeresult onchain \ No newline at end of file + Userssends newDataRecord asconfidential compute requestKettleSearchersends back run as confidential compute requestSUAVE PoA ChainMEV ApplicationsnewBidlog emittedConfidential Data StoreMEVMBlock BuilderbundleDomain-SpecificServicessimulate bundle against L1 chainpublish confidential computeresult onchain \ No newline at end of file diff --git a/specs/rigil/README.md b/specs/rigil/README.md index dcef02a..cf1d966 100644 --- a/specs/rigil/README.md +++ b/specs/rigil/README.md @@ -189,23 +189,23 @@ If we consider a specific use case, like an order flow auction, the high-level s ![OFA example flow](/assets/OFA-example-flow.svg) -1. The user sends a Confidential Compute Request interacting with a SUAPP by calling its `newBid` function. Included in this request is also the user's L1 transaction as a confidential Input. -2. The Kettle will receive the transaction and process it. To do so it first runs the offchain logic associated with `newBid` which will extract the transaction's data and then return a callback: +1. The user sends a Confidential Compute Request interacting with a SUAPP by calling its `newTransaction` function. Included in this request is also the user's L1 transaction as a confidential Input. +2. The Kettle will receive the transaction and process it. To do so it first runs the offchain logic associated with `newTransaction` which will extract the transaction's data and then return a callback: ```go -return bytes.concat(this.emitHint.selector, abi.encode(hint)); +return bytes.concat(this.emitDataRecord.selector, abi.encode(dataRecord)); ``` which points to another function: ```go -function emitHint(Suave.Bid calldata bid, bytes memory hint) public { - emit HintEvent(bid.id, hint); +function emitDataRecord(Suave.DataRecord calldata dataRecord) public { + emit DataRecordEvent(dataRecord.id, dataRecord.decryptionCondition, dataRecord.allowedPeekers); } ``` 3. The callback is inserted into the calldata of a SUAVE transaction and then shipped off to the SUAVE mempool. 4. The transaction will get picked up, inserted in a SUAVE block, and propagated to SUAVE Kettles. 5. From here a searcher monitoring the chain and this specific OFA will see the log emitted and begin processing. 6. Once the searcher has a backrun crafted for the opportunity it will send it to the Kettle as a Confidential Compute Request with the backrun transaction in the confidential inputs. -7. The Kettle will receive and process the searcher's Confidential Compute Request based on the contracts logic. In this case, it will: - - Grab referenced User Transaction to be placed behind +7. The Kettle will receive and process the searcher's Confidential Compute Request based on the contract's logic. In this case, it will: + - Grab the referenced User Transaction to be placed behind - Construct a bundle object with the two transactions - Submit to domain-specific service for simulation and validation 8. From there, in this example, the MEVM will then forward the bundle to pre-configured off-SUAVE block builders, but could as easily also forward to onchain block builders. diff --git a/specs/rigil/confidential-data-store.md b/specs/rigil/confidential-data-store.md index 4de199d..d50be28 100644 --- a/specs/rigil/confidential-data-store.md +++ b/specs/rigil/confidential-data-store.md @@ -81,13 +81,12 @@ type ConfidentialStoreEngine struct { `ConfidentialStorageBackend` is the interface that a storage backend for the Confidential Storage Engine must implement. ```go - type ConfidentialStorageBackend interface { - InitializeBid(bid suave.Bid) error - Store(bid suave.Bid, caller common.Address, key string, value []byte) (suave.Bid, error) - Retrieve(bid suave.Bid, caller common.Address, key string) ([]byte, error) - FetchBidById(suave.BidId) (suave.Bid, error) - FetchBidsByProtocolAndBlock(blockNumber uint64, namespace string) []suave.Bid + InitRecord(record suave.DataRecord) error + Store(record suave.DataRecord, caller common.Address, key string, value []byte) (suave.DataRecord, error) + Retrieve(record suave.DataRecord, caller common.Address, key string) ([]byte, error) + FetchRecordByID(suave.DataId) (suave.DataRecord, error) + FetchRecordsByProtocolAndBlock(blockNumber uint64, namespace string) []suave.DataRecord Stop() error } ``` diff --git a/specs/rigil/mevm.md b/specs/rigil/mevm.md index 4b87a38..900d034 100644 --- a/specs/rigil/mevm.md +++ b/specs/rigil/mevm.md @@ -77,12 +77,13 @@ type SuaveExecutionBackend struct { For more information on the capabilities exposed by the Confidential Data Store, see its related [🔗 spec](./confidential-data-store.md). The interface exposed to precompiles: ```go -type ConfidentialStore interface { - InitializeBid(bid types.Bid) (types.Bid, error) - Store(bidId suave.BidId, caller common.Address, key string, value []byte) (suave.Bid, error) - Retrieve(bid types.BidId, caller common.Address, key string) ([]byte, error) - FetchBidById(suave.BidId) (suave.Bid, error) - FetchBidsByProtocolAndBlock(blockNumber uint64, namespace string) []suave.Bid +type ConfidentialStorageBackend interface { + InitRecord(record suave.DataRecord) error + Store(record suave.DataRecord, caller common.Address, key string, value []byte) (suave.DataRecord, error) + Retrieve(record suave.DataRecord, caller common.Address, key string) ([]byte, error) + FetchRecordByID(suave.DataId) (suave.DataRecord, error) + FetchRecordsByProtocolAndBlock(blockNumber uint64, namespace string) []suave.DataRecord + Stop() error } ``` @@ -111,7 +112,7 @@ Domain specific services which seek to be used by SUAVE must implement the metho 1. **Universal Access**: If a `ConfidentialComputeRequest` allows "any peeker", the function searches the `CallerStack` for a caller different from the precompile, granting access upon finding one. 2. **Restricted Access and Validation**: - - The function checks if the precompile is explicitly authorized to access bid data. + - The function checks if the precompile is explicitly authorized to access the data record. - It then validates each caller in the `CallerStack` against the `AllowedPeekers` list. If an authorized caller is found, access is granted. 3. **Error Handling**: diff --git a/specs/rigil/precompiles.md b/specs/rigil/precompiles.md index d73d339..33dee42 100644 --- a/specs/rigil/precompiles.md +++ b/specs/rigil/precompiles.md @@ -17,8 +17,8 @@ custom_edit_url: "https://github.com/flashbots/suave-specs/edit/main/specs/rigil - [`ConfidentialInputs`](#confidentialinputs) - [`ConfidentialStore`](#confidentialstore) - [`ConfidentialRetrieve`](#confidentialretrieve) - - [`NewBid`](#newbid) - - [`FetchBids`](#fetchbids) + - [`NewDataRecord`](#newdatarecord) + - [`FetchDataRecords`](#fetchdatarecords) - [`EthCall`](#ethcall) - [`SimulateBundle`](#simulatebundle) - [`ExtractHint`](#extracthint) @@ -82,7 +82,7 @@ Address: `0x0000000000000000000000000000000042020000` Handles the storage of data in the confidential store. Requires the caller to be part of the `AllowedPeekers` for the associated bid. ```solidity -function confidentialStore(BidId bidId, string memory key, bytes memory data1) internal view +function confidentialStore(DataId dataId, string memory key, bytes memory data1) internal view ``` ### `ConfidentialRetrieve` @@ -94,33 +94,31 @@ Address: `0x0000000000000000000000000000000042020001` Retrieves data from the confidential store. Also mandates the caller's presence in the `AllowedPeekers` list. ```solidity -function confidentialRetrieve(BidId bidId, string memory key) internal view returns (bytes memory) +function confidentialRetrieve(DataId dataId, string memory key) internal view returns (bytes memory) ``` -### `NewBid` +### `NewDataRecord` [🔗 Implementation](https://github.com/flashbots/suave-geth/blob/b328d64689930a40eae0a6e834805f3feab6b58f/core/vm/contracts_suave.go#L237) Address: `0x0000000000000000000000000000000042030000` -Initializes bids within the ConfidentialStore. `AllowedPeekers` specifies which addresses can "get" data. `AllowedStores` specifies which addresses can "set" data. Prior to storing data, all bids should undergo initialization via this precompile. +Initializes data records within the ConfidentialStore. `AllowedPeekers` specifies which addresses can "get" data. `AllowedStores` specifies which addresses can "set" data. Prior to storing data, all bids should undergo initialization via this precompile. ```solidity -function newBid(uint64 decryptionCondition, address[] memory allowedPeekers, address[] memory allowedStores, string memory bidType) +function newDataRecord(uint64 decryptionCondition, address[] memory allowedPeekers, address[] memory allowedStores, string memory dataType) ``` -*Note: The name "Bid" is an artefact from early development. Bids represent a "Data Identifier" used when operating on confidential data and no longer have any relation to a bid in an auction. They are useful for coordinating confidential data without revealing it. For instance, a SUAVE transaction can emit logs on chain which reference the `bidId` from a Confidential Compute Request which future transactions can reference.* - -### `FetchBids` +### `FetchDataRecords` [🔗 Implementation](https://github.com/flashbots/suave-geth/blob/b328d64689930a40eae0a6e834805f3feab6b58f/core/vm/contracts_suave.go#L291) Address: `0x0000000000000000000000000000000042030001` -Retrieves all bids correlating with a specified decryption condition. +Retrieves all data records correlating with a specified decryption condition. ```solidity -function fetchBids(uint64 cond, string memory namespace) internal view returns (Bid[] memory) +function fetchDataRecords(uint64 cond, string memory namespace) internal view returns (DataRecord[] memory) ``` ### `EthCall` @@ -181,7 +179,7 @@ Address: `0x0000000000000000000000000000000043200001` Joins the user's transaction and with the backrun, and returns encoded mev-share bundle. The bundle is ready to be sent via `SubmitBundleJsonRPC`. ```solidity -function fillMevShareBundle(BidId bidId) internal view returns (bytes memory) +function fillMevShareBundle(DataId dataId) internal view returns (bytes memory) ``` ### `BuildEthBlock` @@ -193,7 +191,7 @@ Address: `0x0000000000000000000000000000000042100001` Constructs an Ethereum block based on the provided `bidIds`. The construction follows the order of `bidId`s are given . ```solidity -function buildEthBlock(BuildBlockArgs memory blockArgs, BidId bidId, string memory namespace) +function buildEthBlock(BuildBlockArgs memory blockArgs, DataId dataId, string memory namespace) ``` ### `SubmitEthBlockBidToRelay`