Commit 1097d82
committed
This commit removes the toEngine channel pattern from all VMs and adds an additional API:
```
SubscribeToEvents(ctx context.Context) Message)
```
Which returns when an event (pending transactions or state sync done Message) is sent by the VM.
Unlike the toEngine pattern which only notifies the consumer a single time until a block is built, successive calls to `SubscribeToEvents` will return that transactions are pending as long as the mem-pool is not empty and a block can be built, otherwise the calls block.
The API change is needed to support consensus protocols which facilitate censorship resistance as part of their protocol and therefore need information about whether a block should be built or not on demand, in contrast to the curren toEngine pattern which notifies the consensus when new transactions arrive only once, and then block building may even fail. Having such an API on the VM side (and not implementing the logic in consensus) forces the VM to handle any side effects of block building (such as re-introducing transactions into the mempool).
Signed-off-by: Yacov Manevich <yacov.manevich@avalabs.org>1 parent 7d555ea commit 1097d82
File tree
73 files changed
+1701
-507
lines changed- chains
- proto
- messenger
- pb/messenger
- snow
- engine
- avalanche/vertex
- vertexmock
- common
- enginetest
- snowman
- block/blockmock
- networking
- handler
- router
- sender
- vms
- avm
- block
- builder
- executor
- network
- txs/mempool
- example/xsvm
- builder
- metervm
- platformvm
- block
- builder
- executor
- network
- txs/mempool
- proposervm
- scheduler
- rpcchainvm
- messenger
- tracedvm
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
73 files changed
+1701
-507
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
| |||
47 | 50 | | |
48 | 51 | | |
49 | 52 | | |
50 | | - | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| |||
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
77 | | - | |
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
81 | | - | |
| 82 | + | |
82 | 83 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
727 | 727 | | |
728 | 728 | | |
729 | 729 | | |
730 | | - | |
731 | | - | |
732 | | - | |
733 | | - | |
734 | 730 | | |
735 | 731 | | |
736 | 732 | | |
| |||
742 | 738 | | |
743 | 739 | | |
744 | 740 | | |
745 | | - | |
746 | 741 | | |
747 | 742 | | |
748 | 743 | | |
| |||
823 | 818 | | |
824 | 819 | | |
825 | 820 | | |
826 | | - | |
827 | 821 | | |
828 | 822 | | |
829 | 823 | | |
| |||
885 | 879 | | |
886 | 880 | | |
887 | 881 | | |
| 882 | + | |
888 | 883 | | |
889 | | - | |
890 | 884 | | |
891 | 885 | | |
892 | 886 | | |
| |||
1202 | 1196 | | |
1203 | 1197 | | |
1204 | 1198 | | |
1205 | | - | |
1206 | | - | |
1207 | | - | |
1208 | | - | |
1209 | 1199 | | |
1210 | 1200 | | |
1211 | 1201 | | |
1212 | 1202 | | |
1213 | 1203 | | |
1214 | 1204 | | |
1215 | 1205 | | |
1216 | | - | |
1217 | 1206 | | |
1218 | 1207 | | |
1219 | 1208 | | |
| |||
1277 | 1266 | | |
1278 | 1267 | | |
1279 | 1268 | | |
| 1269 | + | |
1280 | 1270 | | |
1281 | | - | |
1282 | 1271 | | |
1283 | 1272 | | |
1284 | 1273 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
| 69 | + | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
74 | | - | |
| 73 | + | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments