-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e8f8314
commit fc35e17
Showing
12 changed files
with
285 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,54 @@ | ||
# Miden block producer | ||
|
||
The **Block producer** receives transactions from the RPC component, processes them, creates block containing those transactions before sending created blocks to the store. | ||
Contains code definining the [Miden node's block-producer](/README.md#architecture) component. It is responsible for | ||
ordering transactions into blocks and submitting these for inclusion in the blockchain. | ||
|
||
**Block Producer** is one of components of the [Miden node](..). | ||
It serves a small [rRPC](htts://grpc.io) API which the node's RPC component uses to submit new transactions. In turn, | ||
the `block-producer` uses the store's gRPC API to submit blocks and query chain state. | ||
|
||
## Architecture | ||
For more information on the installation and operation of this component, please see the [node's readme](/README.md). | ||
|
||
`TODO` | ||
## API | ||
|
||
## Usage | ||
The full gRPC API can be found [here](../../proto/block_producer.proto). | ||
|
||
### Installing the Block Producer | ||
--- | ||
|
||
The Block Producer can be installed and run as part of [Miden node](../README.md#installing-the-node). | ||
### SubmitProvenTransaction | ||
|
||
## API | ||
Submits a proven transaction to the block-producer, returning the current chain height if successful. | ||
|
||
The **Block Producer** serves connections using the [gRPC protocol](https://grpc.io) on a port, set in the previously mentioned configuration file. | ||
Here is a brief description of supported methods. | ||
The block-producer does _not_ verify the transaction's proof as it assumes the RPC component has done so. This is done | ||
to minimize the performance impact of new transactions on the block-producer. | ||
|
||
### SubmitProvenTransaction | ||
Transactions are verified before being added to the block-producer's mempool. Transaction which fail verification are | ||
rejected and an error is returned. Possible reasons for verification failure include | ||
|
||
Submits proven transaction to the Miden network. | ||
- current account state does not match the transaction's initial account state | ||
- transaction attempts to consume non-existing, or already consumed notes | ||
- transaction attempts to create a duplicate note | ||
- invalid transaction proof (checked by the RPC component) | ||
|
||
**Parameters** | ||
Verified transactions are added to the mempool however they are still _not guaranteed_ to make it into a block. | ||
Transactions may be evicted from the mempool if their preconditions no longer hold. Currently the only precondition is | ||
transaction expiration height. Furthermore, as a defense against bugs the mempool may evict transactions it deems buggy | ||
e.g. cause block proofs to fail due to some bug in the VM, compiler, prover etc. | ||
|
||
* `transaction`: `bytes` - transaction encoded using [winter_utils::Serializable](https://github.com/facebook/winterfell/blob/main/utils/core/src/serde/mod.rs#L26) implementation for [miden_objects::transaction::proven_tx::ProvenTransaction](https://github.com/0xPolygonMiden/miden-base/blob/main/objects/src/transaction/proven_tx.rs#L22). | ||
Since transactions can depend on other transactions in the mempool this means a specific transaction may be evicted if: | ||
|
||
**Returns** | ||
- it's own expiration height is exceeded, or | ||
- it is deemed buggy by the mempool, or | ||
- any ancestor transaction in the mempool is evicted | ||
|
||
This method doesn't return any data. | ||
This list will be extended in the future e.g. eviction due to gas price fluctuations. | ||
|
||
Note that since the RPC response only indicates admission into the mempool, its not directly possible to know if the | ||
transaction was evicted. The best way to ensure this is to effectively add a timeout to the transaction by setting the | ||
transaction's expiration height. Once the blockchain advances beyond this point without including the transaction you | ||
can know for certain it was evicted. | ||
|
||
--- | ||
|
||
## License | ||
This project is [MIT licensed](../../LICENSE). | ||
|
||
This project is [MIT licensed](../../LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.