Address review: trace request size and contact-share translation

- Manual path trace validates the request that will actually be sent
  (round trips become 2n-1 hops, 3-byte hops go out as 4-byte prefixes)
  against the 172-byte frame and 64-hop firmware limits, and disables Run
  with an explanation when it does not fit. PathTraceMapScreen also refuses
  to send an oversized request.
- Contact-share tokens are never passed through message translation, so
  the share cannot be mangled before sending.
This commit is contained in:
zjs81 committed 2026-11-07 22:53:42 -07:00
1 parent c939f7a29c
commit 80ead2fc2d
45 files changed
+210 -2

No files matched your search

+6 -2
View File
@@ -137,9 +137,13 @@ class _ManualPathTraceScreenState extends State<ManualPathTraceScreen> {
connector.pathHashByteWidth,
);
final input = result.input;
final errorText = result.error == null ? null : _errorText(result.error!);
final fits =
input == null || traceFitsInRequest(input, roundTrip: _returnPath);
final errorText = result.error != null
? _errorText(result.error!)
: (fits ? null : l10n.manualTrace_errorTraceTooLong);
final exampleWidth = input?.hopWidth ?? connector.pathHashByteWidth;
final canRun = input != null && connector.isConnected;
final canRun = input != null && fits && connector.isConnected;
const buttonSize = Size(48, 48);
return Scaffold(
+14
View File
@@ -444,6 +444,20 @@ class _PathTraceMapScreenState extends State<PathTraceMapScreen>
flags, // flag
payload: tracePayload,
);
if (frame.length > maxFrameSize) {
// Too many hops for one request (round trips double them); the radio
// would reject or truncate it.
appLogger.warn(
'Path trace request too large: ${frame.length} bytes',
tag: 'PathTraceMapScreen',
);
if (!mounted) return;
setState(() {
_isLoading = false;
_failed2Loaded = true;
});
return;
}
_awaitingTraceSent = true;
_timeoutTimer?.cancel();
// Fallback in case RESP_CODE_SENT / RESP_CODE_ERR never arrives; the