• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Chia-Network / chia-blockchain / 14864736553
91%

Build:
DEFAULT BRANCH: main
Ran 06 May 2025 05:10PM UTC
Jobs 1
Files 838
Run time 3min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

06 May 2025 04:23PM UTC coverage: 91.227% (+0.03%) from 91.193%
14864736553

push

github

web-flow
Improve the serialisation of AddressManager (#19467)

<!-- Merging Requirements:
- Please give your PR a title that is release-note friendly
- In order to be merged, you must add the most appropriate category
Label (Added, Changed, Fixed) to your PR
-->
<!-- Explain why this is an improvement (Does this add missing
functionality, improve performance, or reduce complexity?) -->

### Purpose:
This PR is an optimisation for the way that AddressManager and
ExtendedPeerInfo are serialized, which happens periodically in a task
called from node_discovery.py

As well as the format of the serialization, the serialization algorithm
itself has had a multitude of speedups, including removing redundant
loops, minimising allocations, and so on.

<!-- Does this PR introduce a breaking change? -->

### Current Behavior:

Previously we were serialising ExtendedPeerInfo as a string and
AddressManager as an `@streamable` `.to_bytes()`.
Copying all the data to this class was taking a deal of time.

The serialising function also had a lot of complicated pieces of
redundant code, looping over data multiple times when 1 pass might do.

### New Behavior:

This PR instead serialises AddressManager directly using a bytearray,
and refactors the code to reduce the complexity and number of loops.

More comments have been added in this area of the codebase as well.

### Testing Notes:

This PR includes a new benchmark file for the AddressManager's
serialisation.
Here are my personal results comparing this PR with `main`:

On main: `Average serialize time:   1.544302 seconds`
Sum of my optimisations: `Average serialize time:   0.468669 seconds`

Feel free to run `benchmarks/address_manager_store.py` to see for
yourself.

I have also added in a migration test in
`chia/_tests/core/full_node/test_address_manager.py` which creates an
old serialisation, loads it using the current loading code, then
serialises it using the new serialization, and then loads that.
It is also checked at eac... (continued)

10403 of 11516 branches covered (90.34%)

Branch coverage included in aggregate %.

331 of 334 new or added lines in 3 files covered. (99.1%)

55 existing lines in 10 files now uncovered.

100999 of 110599 relevant lines covered (91.32%)

1.83 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
94.01
2.09% chia/server/address_manager.py
2
82.11
-0.33% chia/server/node_discovery.py

Uncovered Existing Lines

Lines Coverage ∆ File
1
83.46
-0.08% chia/daemon/server.py
1
82.11
-0.33% chia/server/node_discovery.py
1
87.82
0.36% chia/wallet/wallet_node.py
2
85.3
0.0% chia/full_node/full_node_api.py
2
81.42
-0.22% chia/timelord/timelord.py
3
88.54
-0.62% chia/rpc/rpc_server.py
3
96.96
-0.23% chia/wallet/wallet_state_manager.py
7
98.98
0.03% chia/_tests/pools/test_pool_rpc.py
17
90.81
0.05% chia/rpc/wallet_rpc_api.py
18
86.32
0.45% chia/cmds/plotnft_funcs.py
Jobs
ID Job ID Ran Files Coverage
1 14864736553.1 06 May 2025 05:10PM UTC 1676
91.23
GitHub Action Run
Source Files on build 14864736553
  • Tree
  • List 838
  • Changed 23
  • Source Changed 9
  • Coverage Changed 23
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #14864736553
  • 8f0e8e4b on github
  • Prev Build on main (#14670885217)
  • Next Build on main (#14915221585)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc