Skip to content

Commit

Permalink
debit undo (#423)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeyakovenko authored Jun 23, 2018
1 parent e4782b1 commit 8dba53e
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions rfcs/rfc-001-smart-contracts-engine.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,27 +132,28 @@ void reduce_r(
const uint8_t *reduce_data[],
int num,
uint8_t *reduce_data,
);
);
```

### Execution

Transactions are batched and processed in parallel at each stage.
```
+-----------+ +--------------+ +-----------+ +---------------+
| sigverify |-+->| debit verify |---+->| execution |-+->| memory commit |
| sigverify |-+->| debit commit |---+->| execution |-+->| memory commit |
+-----------+ | +--------------+ | +-----------+ | +---------------+
| | |
| +---------------+ | | +--------------+
|->| memory verify |->+ +->| debit commit |
+---------------+ | +--------------+
|
| +----=----------+
| | |
| +---------------+ | | +--------------+
|->| memory verify |->+ +->| debit undo |
+---------------+ | +--------------+
|
| +---------------+
+->| credit commit |
+---------------+
```
The `debit verify` stage is very similar to `memory verify`. Proof of key ownership is used to check if the callers key has some state allocated with the contract, then the memory is loaded and executed. After execution stage, the dirty pages are written back by the contract. Because know all the memory accesses during execution, we can batch transactions that do not interfere with each other. We can also apply the debit and credit stages of the transaction.
The `debit verify` stage is very similar to `memory verify`. Proof of key ownership is used to check if the callers key has some state allocated with the contract, then the memory is loaded and executed. After execution stage, the dirty pages are written back by the contract. Because know all the memory accesses during execution, we can batch transactions that do not interfere with each other. We can also apply the `debit undo` and `credit commit` stages of the transaction. `debit undo` is run in case of an exception during contract execution, only transfers may be reversed, fees are commited to solana.

### GPU execution

Expand Down

0 comments on commit 8dba53e

Please sign in to comment.