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
Merge #6656: perf: use tiny cache for best chainlock in CbTx instead running heavy ReadBlockFromDisk
18044c9 perf: use tiny cache for best chainlock in CbTx instead running heavy ReadBlockFromDisk (Konstantin Akimov)
66c9592 refactor: use more strict scope v20 instead dip0003 (Konstantin Akimov)
Pull request description:
## Issue being fixed or feature implemented
Validation of chainlocks requires to read previous block from disk for every new block.
## What was done?
Added CL from CbTx of tip of the chain.
## How Has This Been Tested?
develop:
<img width="754" alt="image" src="https://github.com/user-attachments/assets/7e1a5ab4-9634-4fc7-910e-9124d2d742d0" />
```
2025-05-04T18:36:29Z [bench] - CheckCbTxBestChainlock: 3.34ms [18.68s]
2025-05-04T18:36:29Z [bench] - Connect total: 54.40ms [94.48s (16.14ms/blk)]
```
PR:
<img width="754" alt="image" src="https://github.com/user-attachments/assets/462df0f1-358d-46dd-8a08-f3a0324bb282" />
```
2025-05-04T18:53:18Z [bench] - CheckCbTxBestChainlock: 3.15ms [16.41s]
2025-05-04T18:53:18Z [bench] - Connect total: 52.89ms [90.75s (15.51ms/blk)]
```
`perf` looks a bit confusing (like cpu spent for CheckCbTxBestChainlock is close to zero which contradicts to logs time (16seconds vs 18seconds). It happened due to missing data for bls / gmp - somehow they are not attached to the caller, but shown as a root nodes without proper stacktrace). Detailed break-down is:
```
2025-05-04T19:50:37Z [bench] - CheckCbTxBestChainlock::payload: 0.22ms [1.34s]
2025-05-04T19:50:37Z [bench] - CheckCbTxBestChainlock::get-cb-cl: 0.52ms [2.50s]
2025-05-04T19:50:37Z [bench] - CheckCbTxBestChainlock::validate: 2.63ms [14.94s] <--- missing in perf
2025-05-04T19:50:37Z [bench] - CheckCbTxBestChainlock: 3.38ms [18.87s]
```
## Breaking Changes
N/A
## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone
ACKs for top commit:
UdjinM6:
utACK 18044c9
PastaPastaPasta:
utACK 18044c9
Tree-SHA512: 21508505e4b3cec9cba7f3835e2b73a81461d7b626f97efb15d442767fa0862f6ba92ed1101e00b04dbbddab1b7c56da796b15c89d80c95ce9b0246bbbbe02f2
0 commit comments