You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`blockstm` implements the [block-stm algorithm](https://arxiv.org/abs/2203.06871), it follows the paper pseudocode pretty closely.
2
+
3
+
The main API is a simple function call `ExecuteBlock`:
4
+
5
+
```golang
6
+
typeExecuteFnfunc(TxnIndex, MultiStore)
7
+
funcExecuteBlock(
8
+
ctx context.Context, // context for cancellation
9
+
blockSize int, // the number of the transactions to be executed
10
+
stores []storetypes.StoreKey, // the list of store keys to support
11
+
storage MultiStore, // the parent storage, after all transactions are executed, the whole change sets are written into parent storage at once
12
+
executors int, // how many concurrent executors to spawn
13
+
executeFn ExecuteFn, // callback function to actually execute a transaction with a wrapped `MultiStore`.
14
+
) error
15
+
```
16
+
17
+
The main deviations from the paper are:
18
+
19
+
### Optimisation
20
+
21
+
We applied the optimization described in section 4 of the paper:
22
+
23
+
```
24
+
Block-STM calls add_dependency from the VM itself, and can thus re-read and continue execution when false is returned.
25
+
```
26
+
27
+
When the VM execution reads an `ESTIMATE` mark, it'll hang on a `CondVar`, so it can resume execution after the dependency is resolved,
28
+
much more efficient than abortion and rerun.
29
+
30
+
### Support Deletion, Iteration, and MultiStore
31
+
32
+
These features are necessary for integration with cosmos-sdk.
33
+
34
+
The multi-version data structure is implemented with nested btree for easier iteration support,
35
+
the `WriteSet` is also implemented with a btree, and it takes advantage of ordered property to optimize some logic.
36
+
37
+
The internal data structures are also adapted with multiple stores in mind.
38
+
39
+
### Attribution
40
+
41
+
This package was originally authored in [go-block-stm](https://github.com/crypto-org-chain/go-block-stm). We have brought the full source tree into the SDK so that we can natively incorporate the library and required changes into the SDK. Over time we expect to incoporate optimizations and deviations from the upstream implementation.
0 commit comments