Commit 9819d1b
authored
Track Soroban in-memory state size and store it in p23. (#4809)
# Description
This adds the state size tracking mechanism to InMemorySorobanState. The
size includes the size of the parsed Wasm modules and thus has to be
recomputed on the protocol and relevant setting upgrades. We'll start
tracking the state size as soon as we're in Soroban protocol, but will
only use it in p23. Because of that we can use p23 host to compute the
memory cost for contract code entries eagerly.
This does a few non-trivial things on upgrades:
- When we perform a memory cost settings upgrade (even in p22) we
recompute the contract code in-memory size. If we are in p23+, we also
fill the state size window with the current in-memory state size.
- When we upgrade to p23, we immediately fill the state size window with
the current in-memory state size, but don't recompute the contract code
size (it's already up to date)
- When we upgrade to p24+, we recompute the contract code size and fill
the state window with the current in-memory state size
All these cases are covered in the respective new tests.
There is also a bunch of test-related TODOs here that can be addressed
later - they shouldn't influence the change coverage significantly.
# Checklist
- [ ] Reviewed the
[contributing](https://github.com/stellar/stellar-core/blob/master/CONTRIBUTING.md#submitting-changes)
document
- [ ] Rebased on top of master (no merge commits)
- [ ] Ran `clang-format` v8.0.0 (via `make format` or the Visual Studio
extension)
- [ ] Compiles
- [ ] Ran all tests
- [ ] If change impacts performance, include supporting evidence per the
[performance
document](https://github.com/stellar/stellar-core/blob/master/performance-eval/performance-eval.md)File tree
40 files changed
+3062
-2138
lines changed- Builds/VisualStudio
- src
- bucket
- test
- herder
- test
- ledger
- test
- main
- rust
- soroban
- src/dep-trees
- simulation
- testdata
- test
- transactions
- test
- util
40 files changed
+3062
-2138
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1411 | 1411 | | |
1412 | 1412 | | |
1413 | 1413 | | |
1414 | | - | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
1415 | 1417 | | |
1416 | 1418 | | |
1417 | 1419 | | |
| |||
2504 | 2506 | | |
2505 | 2507 | | |
2506 | 2508 | | |
| 2509 | + | |
| 2510 | + | |
| 2511 | + | |
2507 | 2512 | | |
2508 | 2513 | | |
2509 | 2514 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1159 | 1159 | | |
1160 | 1160 | | |
1161 | 1161 | | |
1162 | | - | |
| 1162 | + | |
| 1163 | + | |
1163 | 1164 | | |
1164 | 1165 | | |
1165 | 1166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
878 | 878 | | |
879 | 879 | | |
880 | 880 | | |
881 | | - | |
| 881 | + | |
882 | 882 | | |
883 | 883 | | |
884 | | - | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
885 | 888 | | |
886 | 889 | | |
887 | 890 | | |
| |||
891 | 894 | | |
892 | 895 | | |
893 | 896 | | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
894 | 902 | | |
895 | 903 | | |
896 | 904 | | |
| |||
901 | 909 | | |
902 | 910 | | |
903 | 911 | | |
904 | | - | |
| 912 | + | |
905 | 913 | | |
906 | 914 | | |
907 | | - | |
| 915 | + | |
908 | 916 | | |
909 | | - | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
910 | 923 | | |
911 | 924 | | |
912 | 925 | | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
913 | 930 | | |
914 | 931 | | |
915 | | - | |
916 | | - | |
| 932 | + | |
| 933 | + | |
917 | 934 | | |
918 | 935 | | |
919 | 936 | | |
| |||
930 | 947 | | |
931 | 948 | | |
932 | 949 | | |
933 | | - | |
934 | | - | |
935 | | - | |
936 | | - | |
937 | | - | |
938 | | - | |
939 | | - | |
| 950 | + | |
940 | 951 | | |
941 | 952 | | |
942 | 953 | | |
| |||
945 | 956 | | |
946 | 957 | | |
947 | 958 | | |
| 959 | + | |
948 | 960 | | |
949 | 961 | | |
950 | 962 | | |
| |||
957 | 969 | | |
958 | 970 | | |
959 | 971 | | |
960 | | - | |
961 | | - | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
962 | 987 | | |
963 | 988 | | |
964 | | - | |
965 | | - | |
966 | | - | |
967 | | - | |
968 | | - | |
969 | | - | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
970 | 999 | | |
971 | 1000 | | |
972 | 1001 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | | - | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
279 | 282 | | |
280 | 283 | | |
281 | 284 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1182 | 1182 | | |
1183 | 1183 | | |
1184 | 1184 | | |
1185 | | - | |
1186 | | - | |
| 1185 | + | |
1187 | 1186 | | |
1188 | | - | |
| 1187 | + | |
1189 | 1188 | | |
1190 | 1189 | | |
| 1190 | + | |
1191 | 1191 | | |
1192 | 1192 | | |
1193 | | - | |
1194 | | - | |
| 1193 | + | |
| 1194 | + | |
1195 | 1195 | | |
1196 | 1196 | | |
1197 | 1197 | | |
| |||
1212 | 1212 | | |
1213 | 1213 | | |
1214 | 1214 | | |
| 1215 | + | |
1215 | 1216 | | |
1216 | 1217 | | |
1217 | 1218 | | |
| |||
1224 | 1225 | | |
1225 | 1226 | | |
1226 | 1227 | | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
1227 | 1237 | | |
1228 | 1238 | | |
1229 | 1239 | | |
| |||
1391 | 1401 | | |
1392 | 1402 | | |
1393 | 1403 | | |
| 1404 | + | |
1394 | 1405 | | |
1395 | 1406 | | |
1396 | 1407 | | |
1397 | 1408 | | |
1398 | 1409 | | |
1399 | 1410 | | |
1400 | | - | |
1401 | | - | |
| 1411 | + | |
1402 | 1412 | | |
1403 | 1413 | | |
1404 | 1414 | | |
1405 | 1415 | | |
1406 | 1416 | | |
1407 | 1417 | | |
1408 | 1418 | | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
1409 | 1424 | | |
1410 | 1425 | | |
1411 | | - | |
| 1426 | + | |
| 1427 | + | |
1412 | 1428 | | |
1413 | 1429 | | |
1414 | 1430 | | |
1415 | | - | |
1416 | | - | |
1417 | | - | |
1418 | | - | |
1419 | | - | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
1420 | 1440 | | |
1421 | 1441 | | |
1422 | 1442 | | |
| |||
0 commit comments