Commit c54223e
authored
Fix bugs in block polling logic and serialization (#84)
### TL;DR
Improved error handling and logging in the poller and serializer components.
### What changed?
- Enhanced logging in the poller to include the number of blocks being polled.
- Added a check to skip polling when the start block is greater than the latest block.
- Fixed a miscalculation issue in block range calculation due to pointer references.
- Improved error handling in the serializer for nil block results.
- Modified the serializer to use a dynamic slice instead of a fixed-size array for results.
### How to test?
1. Run the poller with various block ranges, including edge cases where the start block is greater than the latest block.
2. Simulate scenarios where the RPC returns nil block results and verify proper error handling.
3. Test the serializer with a large number of blocks to ensure dynamic slice allocation works correctly.
4. Verify that the new log messages appear correctly in the debug output.
### Why make this change?
These changes improve the robustness and reliability of the polling and serialization processes. By adding more detailed logging and error handling, it becomes easier to diagnose issues and prevent potential crashes. The modifications also optimize memory usage by using dynamic slices and fix a potential integer overflow bug in block range calculations.2 files changed
+17
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
134 | 138 | | |
135 | 139 | | |
136 | 140 | | |
137 | 141 | | |
138 | | - | |
| 142 | + | |
139 | 143 | | |
140 | 144 | | |
141 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | | - | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
29 | 36 | | |
30 | 37 | | |
31 | 38 | | |
32 | | - | |
| 39 | + | |
33 | 40 | | |
34 | 41 | | |
35 | 42 | | |
| |||
55 | 62 | | |
56 | 63 | | |
57 | 64 | | |
58 | | - | |
| 65 | + | |
59 | 66 | | |
60 | 67 | | |
61 | 68 | | |
| |||
0 commit comments