Write the payload length into the header when serializing (#5329) * Write the payload length into the header when serializing asc_pull and vote_relay messages declare their payload length in the header extensions, which callers had to refresh with update_header () after every change to the payload. A missed call sent a stale length and broke the peer's framing. The four messages now compute the length from their payload in serialize, so update_header () is gone. message::payload_size () gives the size for the to_bytes () reserve, and asc_pull payloads sum their field sizes instead of being serialized twice to measure them. * Assert that a serialized message has the size its header declares to_bytes () now checks in debug builds that the bytes written match message_header::size plus payload_size (). A receiver reads exactly as many bytes as the header declares, so a mismatch breaks its framing. For asc_pull and vote_relay this checks the summed payload sizes; for the other messages it catches a header left stale by a change to the message after it was built. * Comment why asc_pull messages skip the end-of-stream check Like telemetry_ack and the vote relay messages, they declare their payload length in the header, so bytes left after their known fields come from newer versions and are ignored.
__________
Type: commit
Hash: cfd5625096b4aed7935770ac29c912bcc5b5a5c6
Created: yesterday
__________
gr0v1ty/nano-node:cfd5625096b4aed7935770ac29c912bcc5b5a5c6
| Test Case | Status | Duration | Median Deviation | Log | Graph |
|---|---|---|---|---|---|
| 5n4pr_conf_10k_bintree | PASS | 80 s | -105.0 s | GitHub job logs | Show |
| 5n4pr_conf_10k_change | PASS | 101 s | -151.0 s | GitHub job logs | Show |
| 5n4pr_conf_change_dependant | PASS | 95 s | -11.0 s | GitHub job logs | - |
| 5n4pr_conf_change_independant | PASS | 108 s | 0.0 s | GitHub job logs | - |
| 5n4pr_conf_send_dependant | PASS | 94 s | -15.0 s | GitHub job logs | - |
| 5n4pr_conf_send_independant | PASS | 102 s | -10.0 s | GitHub job logs | - |
| 5n4pr_rocks_10k_bintree | PASS | 83 s | -105.0 s | GitHub job logs | - |
| 5n4pr_rocks_10k_change | PASS | 139 s | -129.0 s | GitHub job logs | - |