diff --git a/.github/workflows/run-unit-tests.yml b/.github/workflows/run-unit-tests.yml index 55d44142f..59d00855c 100644 --- a/.github/workflows/run-unit-tests.yml +++ b/.github/workflows/run-unit-tests.yml @@ -378,6 +378,8 @@ jobs: python3 -B test/test_cli_error_bounds.py -v python3 -B test/test_common_cli_argument_bounds.py -v python3 -B test/test_flood_retry_bucket_cli.py -v + python3 -B test/test_flood_advert_rtc.py -v + python3 -B test/test_flood_advert_iram.py -v python3 -B test/test_ota_security.py -v python3 -B test/test_companion_offline_delivery.py -v python3 -B test/test_room_receive_admission.py -v @@ -397,12 +399,15 @@ jobs: python3 -B test/test_room_access_policy.py -v python3 -B test/test_room_history_store.py -v python3 -B test/test_room_history_integration.py -v + python3 -B test/test_room_rtc_posts.py -v python3 -B test/test_room_board_store.py -v python3 -B test/test_room_board_protocol.py -v python3 -B test/test_room_mail_store.py -v python3 -B test/test_room_mail_protocol.py -v python3 -B test/test_room_web_mailbox.py -v python3 -B test/test_room_web_http.py -v + python3 -B test/test_room_web_gzip.py -v + python3 -B test/test_esp32_full_size.py -v python3 -B test/test_room_web_service.py -v python3 -B test/test_contact_clock_bootstrap.py -v python3 -B test/test_rtc_discovery.py -v @@ -481,6 +486,7 @@ jobs: python3 -B test/test_udp_bridge.py -v python3 -B test/test_udp_bridge_integration.py -v python3 -B test/test_indicator_repeater_profile.py -v + python3 -B test/test_companion_psram_mesh.py -v - name: Verify saved repeat-off trace exception and relay guards run: | @@ -545,6 +551,7 @@ jobs: python3 -B test/test_power_saving_diagnostics_buckets.py -v python3 -B test/test_power_saving_role_diagnostics.py -v python3 -B test/test_companion_power_diagnostics.py -v + python3 -B test/test_companion_rtc_queue.py -v python3 -B test/test_esp32_cpu_clock.py -v python3 -B test/test_esp32_cpu_clock_board.py -v python3 -B test/test_esp32_power_test_controls.py -v diff --git a/build_legacy.sh b/build_legacy.sh index 8dae4d269..42107fe8a 100755 --- a/build_legacy.sh +++ b/build_legacy.sh @@ -3859,6 +3859,25 @@ apply_esp32_constrained_companion_size_profile() { esac } +apply_esp32_iram_advert_storage_profile() { + local env_name=$1 + if [ "$ESP32_FULL_BUILD" != "1" ] || ! supports_esp32_full_build "$env_name"; then + return 0 + fi + # These measured classic ESP32 Full roles have genuine unused SRAM0 IRAM, + # distinct from byte-accessible D/IRAM heap. Keep all 128 advert records in + # its existing SDK NOLOAD section; the backend uses explicit word accesses. + case "${env_name,,}" in + lilygo_tlora_v2_1_1_6_repeater|lilygo_tlora_v2_1_1_6_repeater_|\ + lilygo_tlora_v2_1_1_6_repeater_observer_mqtt|lilygo_tlora_v2_1_1_6_repeater_observer_mqtt_|\ + lilygo_tlora_v2_1_1_6_room_server|lilygo_tlora_v2_1_1_6_room_server_|\ + lilygo_tlora_v2_1_1_6_room_server_observer_mqtt|lilygo_tlora_v2_1_1_6_room_server_observer_mqtt_|\ + tbeam_sx1262_repeater_observer_mqtt|tbeam_sx1276_repeater_observer_mqtt) + export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -DFLOOD_ADVERT_IRAM_WORD_STORAGE=1" + ;; + esac +} + apply_esp32_full_size_profile() { local env_name=$1 local max_neighbours=$ESP32_FULL_MAX_NEIGHBOURS @@ -3887,6 +3906,13 @@ apply_esp32_full_size_profile() { export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -DMAX_NEIGHBOURS=${max_neighbours}" case "${env_name,,}" in + lilygo_tlora_v2_1_1_6_room_server|lilygo_tlora_v2_1_1_6_room_server_|\ + lilygo_tlora_v2_1_1_6_room_server_observer_mqtt|lilygo_tlora_v2_1_1_6_room_server_observer_mqtt_) + # Preserve all 32 Room posts in genuine byte-accessible RTC SLOW memory. + # The bounded proof implementation serves the same maximum 4096 leaves + # without retaining the legacy 16 KiB leaf cache alongside Room services. + export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -DROOM_POSTS_RTC_SLOW_STORAGE=1 -DOTA_BOUNDED_SOURCE_PROOFS=1" + ;; tbeam_sx1262_repeater_observer_mqtt|tbeam_sx1276_repeater_observer_mqtt) # MQTT/TLS plus OTA left only 3.3 KiB of static-region headroom with # 63 rules. Retain the complete rule engine with a 31-entry table. @@ -3912,6 +3938,18 @@ apply_esp32_full_size_profile() { ;; esac + # Preserve all 128 advert-source records and complete Full settings. These + # exact S3 recipes use real retained RTC banks for part of the same table. + case "${env_name,,}" in + heltec_wireless_tracker_repeater|heltec_wireless_tracker_repeater_observer_mqtt|\ + heltec_tracker_v2_repeater|heltec_tracker_v2_repeater_observer_mqtt) + export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -DFLOOD_ADVERT_RTC_FAST_SLOTS=50 -DFLOOD_ADVERT_RTC_SLOW_SLOTS=50" + ;; + heltec_t190_repeater_|heltec_t190_repeater_observer_mqtt) + export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -DFLOOD_ADVERT_RTC_FAST_SLOTS=16" + ;; + esac + # Restore the full ElegantOTA implementation only when the target already # declares its dependency. Some ESP32-C6 targets intentionally have no # compatible ElegantOTA library and retain their target WiFi-OTA setting. @@ -4489,6 +4527,9 @@ apply_companion_radio_full_profile() { export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -DCOMPANION_EXCLUSIVE_WIFI_BLE=1 -DUI_WIFI_SETUP_HOME_PAGE=1 -DWEBCONFIG_AP_PREFIX='\"MC-Set\"'" if [ "${env_name,,}" = "sensecapindicator-espnow_companion_radio_full" ]; then export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -DINDICATOR_TRANSPORT_RENDER_PROFILE=1" + # Construct the complete mesh in real PSRAM after board startup; + # preserve all 350 contacts, 512 queue frames and 15 held DMs. + export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -DCOMPANION_MESH_PSRAM_STORAGE=1" fi ;; esac @@ -4544,6 +4585,10 @@ apply_companion_radio_full_profile() { # Reuse idle queue storage during explicit OTA; retain all 224 normal slots. if [[ "${env_name,,}" != generic_espnow_companion_radio_full ]]; then export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -DOTA_SHARED_COMPANION_QUEUE=1 -DONE_KEY_DM_COMPACT_HELD=1" + else + # Keep all 224 frames during OTA too; RTC FAST holds 32 existing + # slots without borrowing the queue or shrinking held-DM storage. + export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -DCOMPANION_RTC_FAST_OFFLINE_FRAMES=32" fi record_build_reduction \ "companion.capacity limited to 100 contacts for runtime RAM; 224 queued frames and all Full transports retained" @@ -4560,9 +4605,19 @@ apply_companion_radio_full_profile() { heltec_wireless_tracker_companion_radio_full) append_platformio_build_unflags "-DMAX_CONTACTS=350" export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -DMAX_CONTACTS=150" + # Retain all 256 frames, independent OTA workspace, held DMs, and the + # RGB565 display. Each RTC bank holds 32 existing CPU-only frames. + export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -DCOMPANION_RTC_FAST_OFFLINE_FRAMES=32 -DCOMPANION_RTC_SLOW_OFFLINE_FRAMES=32" record_build_reduction \ "companion.capacity limited to 150 contacts for runtime RAM; 256 queued frames and all Full transports retained" ;; + mke_s3_companion_radio_full|\ + thinknode_m2_companion_radio_full|\ + thinknode_m5_companion_radio_full) + # These S3 boards retain the complete 256-frame queue during OTA, with + # 32 existing frames in each RTC bank and all 350 contacts unchanged. + export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -DCOMPANION_RTC_FAST_OFFLINE_FRAMES=32 -DCOMPANION_RTC_SLOW_OFFLINE_FRAMES=32" + ;; sensecapindicator-lora_companion_radio_full|\ sensecapindicator-lora-n16r2_companion_radio_full) # Contacts and the 512-frame queue already live in PSRAM here. Use the @@ -5437,6 +5492,7 @@ build_firmware_one_profile() { apply_esp32_lora_ota_size_profile "$env_name" apply_esp32_constrained_companion_size_profile "$env_name" apply_esp32_full_size_profile "$env_name" + apply_esp32_iram_advert_storage_profile "$env_name" apply_esp32_full_shared_bridge_profile "$pio_env_name" apply_esp32_full_async_tcp_profile "$env_name" apply_repeater_neighbor_capacity "$env_name" @@ -5464,6 +5520,16 @@ build_firmware_one_profile() { "scripts/esp32_full_partition.py"; then append_platformio_extra_script "pre:scripts/esp32_full_partition.py" fi + # Some board recipes replace esp32_base.extra_scripts. Keep the final + # infrastructure object-size policy in those exact Full environments too. + if ! pio_env_option_contains "$pio_env_name" extra_scripts \ + "scripts/esp32_full_size.py"; then + append_platformio_extra_script "pre:scripts/esp32_full_size.py" + fi + if ! pio_env_option_contains "$pio_env_name" extra_scripts \ + "scripts/generate_room_web_html.py"; then + append_platformio_extra_script "pre:scripts/generate_room_web_html.py" + fi # PlatformIO appends PLATFORMIO_BUILD_FLAGS while resolving every extends # layer. Deep ESP32 Full profiles can therefore exceed Windows' process # command-line limit before GCC can launch cc1plus. Compact repeated macro diff --git a/examples/companion_radio/MyMesh.cpp b/examples/companion_radio/MyMesh.cpp index ccd3b606e..e3fd93c8d 100644 --- a/examples/companion_radio/MyMesh.cpp +++ b/examples/companion_radio/MyMesh.cpp @@ -518,6 +518,13 @@ bool MyMesh::updateContactFromFrame(ContactInfo &contact, uint32_t& last_mod, co return true; } +#if COMPANION_RTC_FAST_OFFLINE_FRAMES +alignas(4) RTC_FAST_ATTR MyMesh::Frame MyMesh::rtc_fast_offline_frames[COMPANION_RTC_FAST_OFFLINE_FRAMES]; +#endif +#if COMPANION_RTC_SLOW_OFFLINE_FRAMES +alignas(4) RTC_SLOW_ATTR MyMesh::Frame MyMesh::rtc_slow_offline_frames[COMPANION_RTC_SLOW_OFFLINE_FRAMES]; +#endif + bool MyMesh::Frame::isChannelMsg() const { return len > 0 && (buf[0] == RESP_CODE_CHANNEL_MSG_RECV || buf[0] == RESP_CODE_CHANNEL_MSG_RECV_V3 || buf[0] == RESP_CODE_CHANNEL_DATA_RECV); @@ -536,6 +543,8 @@ int MyMesh::getOfflineQueueCapacity() const { MyMesh::Frame& MyMesh::offlineQueueFrameAt(int logical_index) { #if defined(OTA_SHARED_COMPANION_QUEUE) return offline_queue.at((offline_queue_head + logical_index) % getOfflineQueueCapacity()); +#elif COMPANION_RTC_FAST_OFFLINE_FRAMES || COMPANION_RTC_SLOW_OFFLINE_FRAMES + return offline_queue.at((offline_queue_head + logical_index) % getOfflineQueueCapacity()); #elif ONE_KEY_DM_SHARED_OFFLINE_QUEUE return offline_queue[logical_index]; #else @@ -2808,7 +2817,11 @@ MyMesh::MyMesh(mesh::Radio &radio, mesh::RNG &rng, mesh::RTCClock &rtc, SimpleMe _prefs.airtime_factor), #endif _serial(NULL), _mota_source_control(NULL), - telemetry(MAX_PACKET_PAYLOAD - 4), _store(&store), _ui(ui), _iter(0) { + telemetry(MAX_PACKET_PAYLOAD - 4), +#if COMPANION_RTC_FAST_OFFLINE_FRAMES || COMPANION_RTC_SLOW_OFFLINE_FRAMES + offline_queue(rtcFastQueueBank(), rtcSlowQueueBank()), +#endif + _store(&store), _ui(ui), _iter(0) { _iter_started = false; _iter_reply_route = NULL; _iter_start_pending = false; @@ -11677,9 +11690,9 @@ mesh::powerdiag::Mask MyMesh::pendingWorkReason() const { #else const bool contact_write_needs_polling = isContactWriteDue(); #endif - if (_serial != NULL && _serial->hasPendingIO()) return mask(Reason::Serial); + if (_serial != NULL && _serial->hasPendingIO()) return mask(Reason::SerialIO); if (_iter_started && _serial != NULL - && _serial->isReplyRouteAvailable(_iter_reply_route)) return mask(Reason::Serial); + && _serial->isReplyRouteAvailable(_iter_reply_route)) return mask(Reason::SerialIO); if (hasPendingOtaApply()) return mask(Reason::Ota); if (command_radio_apply_pending || _scheduled_reboot_at != 0) return mask(Reason::Scheduled); if (hasPendingReqs() || _delayed_replies.hasBinaryTrace()) return mask(Reason::Mesh); diff --git a/examples/companion_radio/MyMesh.h b/examples/companion_radio/MyMesh.h index 6aedbab32..d5b3f5463 100644 --- a/examples/companion_radio/MyMesh.h +++ b/examples/companion_radio/MyMesh.h @@ -150,6 +150,8 @@ namespace mesh { class BeaconManager; } #endif #endif +#include + static_assert(OFFLINE_QUEUE_SIZE > 0, "OFFLINE_QUEUE_SIZE must be positive"); #if ONE_KEY_DM_SHARED_OFFLINE_QUEUE static_assert(OFFLINE_QUEUE_SIZE >= 15, "Shared DM queue needs 15 frame slots"); @@ -977,6 +979,30 @@ private: static mesh::ota::OtaContext* acquireOfflineQueueForOta(void* owner); static uint16_t drainOfflineQueueForOta(void* owner); static void releaseOfflineQueueFromOta(void* owner); +#elif COMPANION_RTC_FAST_OFFLINE_FRAMES || COMPANION_RTC_SLOW_OFFLINE_FRAMES + // Concrete definitions in MyMesh.cpp keep GCC from moving template-local + // statics back into ordinary .bss despite the requested RTC attribute. +#if COMPANION_RTC_FAST_OFFLINE_FRAMES + static Frame rtc_fast_offline_frames[COMPANION_RTC_FAST_OFFLINE_FRAMES]; +#endif +#if COMPANION_RTC_SLOW_OFFLINE_FRAMES + static Frame rtc_slow_offline_frames[COMPANION_RTC_SLOW_OFFLINE_FRAMES]; +#endif + static Frame* rtcFastQueueBank() { +#if COMPANION_RTC_FAST_OFFLINE_FRAMES + return rtc_fast_offline_frames; +#else + return nullptr; +#endif + } + static Frame* rtcSlowQueueBank() { +#if COMPANION_RTC_SLOW_OFFLINE_FRAMES + return rtc_slow_offline_frames; +#else + return nullptr; +#endif + } + mesh::CompanionRtcQueue offline_queue; #elif defined(ESP32_PLATFORM) && defined(BOARD_HAS_PSRAM) enum { OFFLINE_QUEUE_PSRAM_FALLBACK_SIZE = @@ -1117,4 +1143,11 @@ private: #endif }; +#include +#if COMPANION_MESH_PSRAM_STORAGE +MyMesh& companionMeshInstance(); +// Keep the shared UI/CLI lvalue interface; the accessor never allocates. +#define the_mesh companionMeshInstance() +#else extern MyMesh the_mesh; +#endif diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index 85c2ad208..8aa5203e9 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -268,11 +268,27 @@ static bool isNetworkTerminalActive(); StdRNG fast_rng; SimpleMeshTables tables; +#if COMPANION_MESH_PSRAM_STORAGE +static mesh::CompanionPsramMesh companion_mesh_storage; +MyMesh& companionMeshInstance() { return companion_mesh_storage.get(); } + +static bool initializeCompanionMeshStorage() { + const auto result = companion_mesh_storage.begin( + radio_driver, fast_rng, rtc_clock, tables, store, &ui_task); + using Result = mesh::CompanionPsramMesh::Result; + if (result == Result::Ready) return true; + mesh::usbLoggingPort().println(result == Result::MissingPsram + ? "ERROR: Full Companion requires working PSRAM; check the board/image" + : "ERROR: insufficient PSRAM for Full Companion; startup stopped"); + return false; +} +#else MyMesh the_mesh(radio_driver, fast_rng, rtc_clock, tables, store #ifdef DISPLAY_CLASS , &ui_task #endif ); +#endif #if defined(WIO_E5_MINI_HEADLESS_COMPANION_UI) && defined(PIN_USER_BTN) namespace { @@ -3583,6 +3599,13 @@ void setup() { board.setCompanionCpuClockPolicy(true); #endif board.begin(); +#if COMPANION_MESH_PSRAM_STORAGE + if (!initializeCompanionMeshStorage()) { + // No partial mesh, radio, display or network service may start without + // the required external storage. Keep USB available to report the error. + for (;;) delay(1000); + } +#endif #if defined(ESP32) && defined(WIFI_SSID) // MyMesh::begin can already read the power-save policy for MQTT/WebConfig. diff --git a/examples/simple_repeater/MyMesh.cpp b/examples/simple_repeater/MyMesh.cpp index ef9df3098..8c422f9ea 100644 --- a/examples/simple_repeater/MyMesh.cpp +++ b/examples/simple_repeater/MyMesh.cpp @@ -1,4 +1,29 @@ #include "MyMesh.h" + +#if FLOOD_ADVERT_RTC_FAST_SLOTS +alignas(4) RTC_FAST_ATTR static mesh::FloodAdvertLimiter::Entry + repeater_rtc_advert_fast[FLOOD_ADVERT_RTC_FAST_SLOTS]; +#endif +#if FLOOD_ADVERT_RTC_SLOW_SLOTS +alignas(4) RTC_SLOW_ATTR static mesh::FloodAdvertLimiter::Entry + repeater_rtc_advert_slow[FLOOD_ADVERT_RTC_SLOW_SLOTS]; +#endif +#if FLOOD_ADVERT_RTC_FAST_SLOTS || FLOOD_ADVERT_RTC_SLOW_SLOTS +mesh::FloodAdvertLimiter::Entry* repeaterRtcAdvertFastBank() { +#if FLOOD_ADVERT_RTC_FAST_SLOTS + return repeater_rtc_advert_fast; +#else + return nullptr; +#endif +} +mesh::FloodAdvertLimiter::Entry* repeaterRtcAdvertSlowBank() { +#if FLOOD_ADVERT_RTC_SLOW_SLOTS + return repeater_rtc_advert_slow; +#else + return nullptr; +#endif +} +#endif #include #if defined(HELTEC_V4_R8_TFT) && defined(HELTEC_TFT_RUNTIME_ROTATION) \ && HELTEC_TFT_RUNTIME_ROTATION == 1 @@ -1322,8 +1347,9 @@ void MyMesh::logTx(mesh::Packet *pkt, int len) { #endif #if defined(WITH_MQTT_NEIGHBORS) if (neighbor_discover_active && pkt == neighbor_discover_request - && neighbor_discover_next < neighbor_discover_count) { - NeighborDiscoverEntry& entry = neighbor_discover[neighbor_discover_next]; + && neighbor_discover_next < neighbor_discover_count + && (size_t)neighbor_discover_next < NEIGHBOR_SCOPE_RESULTS) { + auto& entry = neighbor_discover_metadata[neighbor_discover_next]; if (entry.status == ND_QUEUED) { entry.status = ND_PENDING; neighbor_discover_queried_count++; @@ -1379,8 +1405,9 @@ void MyMesh::logTx(mesh::Packet *pkt, int len) { void MyMesh::logTxFail(mesh::Packet *pkt, int len) { #if defined(WITH_MQTT_NEIGHBORS) if (neighbor_discover_active && pkt == neighbor_discover_request - && neighbor_discover_next < neighbor_discover_count) { - NeighborDiscoverEntry& entry = neighbor_discover[neighbor_discover_next]; + && neighbor_discover_next < neighbor_discover_count + && (size_t)neighbor_discover_next < NEIGHBOR_SCOPE_RESULTS) { + auto& entry = neighbor_discover_metadata[neighbor_discover_next]; if (entry.status == ND_QUEUED) { entry.status = ND_SEND_FAILED; neighbor_discover_request = NULL; @@ -2874,7 +2901,8 @@ int MyMesh::searchPeersByHash(const uint8_t *hash) { for (int i = 0; i < neighbor_discover_count && n < MAX_CLIENTS; i++) { auto& entry = neighbor_discover[i]; if (acl.getClient(entry.id.pub_key, PUB_KEY_SIZE) != nullptr) continue; - if (entry.heard_timestamp > 0 && entry.id.isHashMatch(hash)) { + // Every counted snapshot key was admitted with a positive heard time. + if (entry.id.isHashMatch(hash)) { matching_peer_indexes[n++] = NEIGHBOR_DISCOVER_PEER_BASE + i; } } @@ -3845,11 +3873,13 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc _prefs.rx_ps_preamble = DEFAULT_RXPS_PREAMBLE; _prefs.rx_ps_rx_us = RX_POWERSAVING_DEFAULT_RX_US; _prefs.rx_ps_sleep_us = RX_POWERSAVING_DEFAULT_SLEEP_US; +#ifdef WRAPPER_CLASS if (WRAPPER_CLASS::SupportsRxPowerSaving) { recalcRxPowerSavingFromLevel(_prefs.rx_ps_level, _prefs.sf, _prefs.bw, _prefs.rx_ps_preamble, &_prefs.rx_ps_rx_us, &_prefs.rx_ps_sleep_us); } +#endif // bridge defaults #if defined(WITH_RS232_BRIDGE) && defined(RS232_BRIDGE_MERGED) \ @@ -14082,9 +14112,10 @@ bool MyMesh::completeNeighborDiscoverEntry() { finishNeighborDiscover(); return false; } - NeighborDiscoverEntry& entry = neighbor_discover[neighbor_discover_next]; + auto& entry = neighbor_discover_metadata[neighbor_discover_next]; char pubkey_hex[65]; - mesh::Utils::toHex(pubkey_hex, entry.id.pub_key, PUB_KEY_SIZE); + mesh::Utils::toHex(pubkey_hex, + neighbor_discover[neighbor_discover_next].id.pub_key, PUB_KEY_SIZE); MQTTMessageBuilder::NeighborsMessageEntry measured = { pubkey_hex, @@ -14118,7 +14149,7 @@ bool MyMesh::handleNeighborDiscoverResponse(int overlay_idx, float snr, int16_t rssi) { if (overlay_idx < 0 || overlay_idx >= neighbor_discover_count || (size_t)overlay_idx >= NEIGHBOR_SCOPE_RESULTS) return false; - NeighborDiscoverEntry& entry = neighbor_discover[overlay_idx]; + auto& entry = neighbor_discover_metadata[overlay_idx]; if (entry.status != ND_PENDING || len < 8) return false; uint32_t tag; @@ -14139,7 +14170,7 @@ bool MyMesh::handleNeighborDiscoverResponse(int overlay_idx, entry.heard_timestamp = getRTCClock()->getCurrentTime(); entry.snr = (int8_t)(snr * 4); entry.rssi = rssi; - touchNeighbourHeard(entry.id, entry.heard_timestamp, snr, rssi); + touchNeighbourHeard(neighbor_discover[overlay_idx].id, entry.heard_timestamp, snr, rssi); return true; } @@ -14269,9 +14300,9 @@ void MyMesh::finishNeighborDiscover() { uint32_t now_secs = getRTCClock()->getCurrentTime(); for (int i = 0; i < publish_count; i++) { - auto& entry = neighbor_discover[i]; + auto& entry = neighbor_discover_metadata[i]; char* hex = &pubkey_hex[i * hex_size]; - mesh::Utils::toHex(hex, entry.id.pub_key, PUB_KEY_SIZE); + mesh::Utils::toHex(hex, neighbor_discover[i].id.pub_key, PUB_KEY_SIZE); entries[i].pubkey_hex = hex; entries[i].snr = entry.snr / 4.0f; entries[i].rssi = entry.rssi; @@ -14341,8 +14372,13 @@ void MyMesh::loopNeighborDiscover() { finishNeighborDiscover(); return; } + if ((size_t)neighbor_discover_next >= NEIGHBOR_SCOPE_RESULTS) { + neighbor_discover_truncated = true; + finishNeighborDiscover(); + return; + } - NeighborDiscoverEntry& entry = neighbor_discover[neighbor_discover_next]; + auto& entry = neighbor_discover_metadata[neighbor_discover_next]; if (entry.status == ND_QUEUED) { if (!millisHasNowPassed(neighbor_discover_until)) return; if (cancelNeighborDiscoverRequest()) { @@ -14376,7 +14412,8 @@ void MyMesh::loopNeighborDiscover() { } uint32_t tag; - mesh::Packet* request = sendAnonRegionsReq(entry.id, tag); + mesh::Packet* request = sendAnonRegionsReq( + neighbor_discover[neighbor_discover_next].id, tag); if (request) { entry.tag = tag; entry.status = ND_QUEUED; @@ -14411,35 +14448,46 @@ bool MyMesh::startNeighborDiscover(char* reply) { return false; // reply already set } + // Select in the exact original stable order without putting another full + // 254-entry table on the loop stack. The live cache is only mutated on this + // mesh task, so it remains stable during this synchronous snapshot step. + static_assert(MAX_NEIGHBOURS <= 255, "Snapshot indexes and count must fit one byte"); + uint8_t order[MAX_NEIGHBOURS]; neighbor_discover_count = 0; for (int i = 0; i < MAX_NEIGHBOURS; i++) { if (neighbours[i].heard_timestamp > 0) { - NeighborDiscoverEntry& entry = neighbor_discover[neighbor_discover_count]; - entry.id = neighbours[i].id; - entry.heard_timestamp = neighbours[i].heard_timestamp; - entry.snr = neighbours[i].snr; - entry.rssi = neighbours[i].rssi; - entry.tag = 0; - entry.status = ND_UNSENT; - neighbor_discover_count++; + order[neighbor_discover_count++] = (uint8_t)i; } } - // Query the freshest/strongest entries first; pubkey makes ties deterministic. for (int i = 1; i < neighbor_discover_count; i++) { - NeighborDiscoverEntry entry = neighbor_discover[i]; + const uint8_t entry_index = order[i]; + const auto& entry = neighbours[entry_index]; int j = i; while (j > 0) { - auto& rhs = neighbor_discover[j - 1]; + const auto& rhs = neighbours[order[j - 1]]; bool before = entry.heard_timestamp > rhs.heard_timestamp || (entry.heard_timestamp == rhs.heard_timestamp && entry.snr > rhs.snr) || (entry.heard_timestamp == rhs.heard_timestamp && entry.snr == rhs.snr && memcmp(entry.id.pub_key, rhs.id.pub_key, PUB_KEY_SIZE) < 0); if (!before) break; - neighbor_discover[j] = neighbor_discover[j - 1]; + order[j] = order[j - 1]; j--; } - neighbor_discover[j] = entry; + order[j] = entry_index; + } + + memset(neighbor_discover_metadata, 0, sizeof(neighbor_discover_metadata)); + for (int i = 0; i < neighbor_discover_count; i++) { + const auto& source = neighbours[order[i]]; + neighbor_discover[i].id = source.id; + if ((size_t)i < NEIGHBOR_SCOPE_RESULTS) { + auto& metadata = neighbor_discover_metadata[i]; + metadata.heard_timestamp = source.heard_timestamp; + metadata.snr = source.snr; + metadata.rssi = source.rssi; + metadata.status = ND_UNSENT; + } } memset(neighbor_discover_scopes, 0, sizeof(neighbor_discover_scopes)); @@ -14695,7 +14743,7 @@ mesh::powerdiag::Mask MyMesh::pendingWorkReason() const { if (esp_wifi_get_mode(&sdk_mode) != ESP_ERR_WIFI_NOT_INIT) return mask(Reason::Network); #endif #if defined(WITH_WEBCONFIG) || defined(ETHERNET_ENABLED) - if (_local_cli_output.busy()) return mask(Reason::Serial); + if (_local_cli_output.busy()) return mask(Reason::SerialIO); #endif if (deferred_cli_command.pending || pending_self_advert || _cli.hasActiveUserGpioTimer()) return mask(Reason::Scheduled); #if defined(WITH_BRIDGE) diff --git a/examples/simple_repeater/MyMesh.h b/examples/simple_repeater/MyMesh.h index 708ac056e..0ed34ea24 100644 --- a/examples/simple_repeater/MyMesh.h +++ b/examples/simple_repeater/MyMesh.h @@ -285,6 +285,11 @@ struct NeighbourInfo { #define RADIO_APPLY_RETRY_INTERVAL_MILLIS 1000UL #define SCHEDULED_RADIO_CLOCK_CHECKPOINT_SECS 60UL +#if FLOOD_ADVERT_RTC_FAST_SLOTS || FLOOD_ADVERT_RTC_SLOW_SLOTS +mesh::FloodAdvertLimiter::Entry* repeaterRtcAdvertFastBank(); +mesh::FloodAdvertLimiter::Entry* repeaterRtcAdvertSlowBank(); +#endif + class MyMesh : public mesh::Mesh, public CommonCLICallbacks #ifdef WITH_WEBCONFIG , public WebConfigServer::Callbacks @@ -311,7 +316,12 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks FILESYSTEM* _fs; #ifndef PORTABLE_MQTT_OBSERVER +#if FLOOD_ADVERT_RTC_FAST_SLOTS || FLOOD_ADVERT_RTC_SLOW_SLOTS + mesh::StaticFloodAdvertLimiter<> flood_advert_limiter{ + repeaterRtcAdvertFastBank(), repeaterRtcAdvertSlowBank()}; +#else mesh::StaticFloodAdvertLimiter<> flood_advert_limiter; +#endif mesh::FloodAdvertLimiter* getFloodAdvertLimiter() override { return &flood_advert_limiter; } #endif #if defined(WITH_WEBCONFIG) || defined(ETHERNET_ENABLED) @@ -768,13 +778,19 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks ND_SEND_FAILED = 5, }; struct NeighborDiscoverEntry { - mesh::Identity id; // immutable snapshot: neighbour table can change mid-pass - uint32_t heard_timestamp; - uint32_t tag; // anon-regions request tag we're waiting on - int16_t rssi; // dBm from the last packet heard from this neighbour - int8_t snr; // multiplied by 4 - uint8_t status; // NeighborDiscoverStatus + // Keep every full key in the immutable crypto overlay, even when the + // existing JSON/query budget cannot publish that neighbor this pass. + mesh::Identity id; }; + struct NeighborDiscoverMetadata { + uint32_t heard_timestamp; + uint32_t tag; + int16_t rssi; + int8_t snr; + uint8_t status; + }; + static_assert(sizeof(NeighborDiscoverMetadata) == 12, + "Discovery metadata must retain its complete compact layout"); NeighborDiscoverEntry neighbor_discover[MAX_NEIGHBOURS]; // Only the publishable prefix (plus the result that detects truncation) // receives scope queries. Keep every neighbor snapshot, without reserving @@ -782,6 +798,7 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks static constexpr size_t NEIGHBOR_SCOPE_RESULTS = MAX_NEIGHBOURS < MQTTBridge::NEIGHBORS_SCOPE_RESULT_CAPACITY ? MAX_NEIGHBOURS : MQTTBridge::NEIGHBORS_SCOPE_RESULT_CAPACITY; + NeighborDiscoverMetadata neighbor_discover_metadata[NEIGHBOR_SCOPE_RESULTS]; char neighbor_discover_scopes[NEIGHBOR_SCOPE_RESULTS][96]; uint8_t neighbor_discover_count; uint8_t neighbor_discover_next; // newest-first entry currently being queried diff --git a/examples/simple_room_server/MyMesh.cpp b/examples/simple_room_server/MyMesh.cpp index d4596f560..de5f71ac3 100644 --- a/examples/simple_room_server/MyMesh.cpp +++ b/examples/simple_room_server/MyMesh.cpp @@ -54,6 +54,7 @@ #include #include #include +#include #endif #include @@ -682,6 +683,11 @@ void MyMesh::processRoomWebBoardWrite(const char* operation, JsonObjectConst inp json.raw("}"); json.finish(); } +const uint8_t* MyMesh::roomPageGzip(size_t& length) const { + length = sizeof(ROOM_WEB_HTML_GZ); + return ROOM_WEB_HTML_GZ; +} + void MyMesh::processRoomRequest(const uint8_t* token, uint32_t sequence, char* request, char* response, size_t capacity) { room_web_request_authenticated = false; @@ -1505,8 +1511,9 @@ void MyMesh::logRx(mesh::Packet *pkt, int len, float score) { void MyMesh::logTx(mesh::Packet *pkt, int len) { #if defined(WITH_MQTT_NEIGHBORS) if (neighbor_discover_active && pkt == neighbor_discover_request - && neighbor_discover_next < neighbor_discover_count) { - NeighborDiscoverEntry& entry = neighbor_discover[neighbor_discover_next]; + && neighbor_discover_next < neighbor_discover_count + && (size_t)neighbor_discover_next < NEIGHBOR_SCOPE_RESULTS) { + auto& entry = neighbor_discover_metadata[neighbor_discover_next]; if (entry.status == ND_QUEUED) { entry.status = ND_PENDING; neighbor_discover_queried_count++; @@ -1546,8 +1553,9 @@ void MyMesh::logTx(mesh::Packet *pkt, int len) { void MyMesh::logTxFail(mesh::Packet *pkt, int len) { #if defined(WITH_MQTT_NEIGHBORS) if (neighbor_discover_active && pkt == neighbor_discover_request - && neighbor_discover_next < neighbor_discover_count) { - NeighborDiscoverEntry& entry = neighbor_discover[neighbor_discover_next]; + && neighbor_discover_next < neighbor_discover_count + && (size_t)neighbor_discover_next < NEIGHBOR_SCOPE_RESULTS) { + auto& entry = neighbor_discover_metadata[neighbor_discover_next]; if (entry.status == ND_QUEUED) { entry.status = ND_SEND_FAILED; neighbor_discover_request = NULL; @@ -1988,7 +1996,8 @@ int MyMesh::searchPeersByHash(const uint8_t *hash) { // a second overlay entry would decrypt first and intercept their normal // CLI/request traffic for the duration of discovery. if (acl.getClient(entry.id.pub_key, PUB_KEY_SIZE) != nullptr) continue; - if (entry.heard_timestamp > 0 && entry.id.isHashMatch(hash)) { + // Every counted snapshot key was admitted with a positive heard time. + if (entry.id.isHashMatch(hash)) { matching_peer_indexes[n++] = NEIGHBOR_DISCOVER_PEER_BASE + i; } } @@ -2523,12 +2532,44 @@ void MyMesh::sendNodeDiscoverReq() { #endif // WITH_MQTT_NEIGHBORS +#if ROOM_POSTS_RTC_SLOW_STORAGE +#include +#include +#include +#if !defined(CONFIG_IDF_TARGET_ESP32) +#error "Qualified RTC slow Room posts require classic ESP32" +#endif +static_assert(MAX_UNSYNCED_POSTS == 32 && sizeof(PostInfo) == 188, + "Keep the complete qualified Room post capacity and geometry"); +namespace { +const void* room_rtc_posts_owner = nullptr; + +PostInfo (&acquireRoomRtcPosts(const void* owner))[MAX_UNSYNCED_POSTS] { + // This bank belongs to one mesh object. NDEBUG cannot permit aliases. + if (!owner || room_rtc_posts_owner) abort(); + // A concrete non-template local static honors RTC placement and constructs + // Identity before MyMesh's reference is initialized, across translation units. + alignas(4) static RTC_SLOW_ATTR PostInfo storage[MAX_UNSYNCED_POSTS]; + room_rtc_posts_owner = owner; + return storage; +} + +void releaseRoomRtcPosts(const void* owner) { + if (!owner || room_rtc_posts_owner != owner) abort(); + room_rtc_posts_owner = nullptr; +} +} // namespace +#endif + MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondClock &ms, mesh::RNG &rng, mesh::RTCClock &rtc, mesh::MeshTables &tables) : mesh::Mesh(radio, ms, rng, rtc, *createObserverPacketManager(32), tables), region_map(key_store), temp_map(key_store), _cli(board, rtc, sensors, region_map, acl, &_prefs, this), _clock_sync(radio, ms, rtc, acl, sensors, _prefs.tx_delay_factor, this), +#if ROOM_POSTS_RTC_SLOW_STORAGE + posts(acquireRoomRtcPosts(this)), +#endif telemetry(MAX_PACKET_PAYLOAD - 4) #ifdef WITH_MQTT_BRIDGE , bridge(nullptr) @@ -2651,6 +2692,10 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc memset(default_scope.key, 0, sizeof(default_scope.key)); } +#if ROOM_POSTS_RTC_SLOW_STORAGE +MyMesh::~MyMesh() { releaseRoomRtcPosts(this); } +#endif + void MyMesh::begin(FILESYSTEM *fs) { mesh::Mesh::begin(); _fs = fs; @@ -4458,7 +4503,7 @@ mesh::powerdiag::Mask MyMesh::pendingWorkReason() const { if (esp_wifi_get_mode(&sdk_mode) != ESP_ERR_WIFI_NOT_INIT) return mask(Reason::Network); #endif #if defined(WITH_WEBCONFIG) || defined(ETHERNET_ENABLED) - if (_local_cli_output.busy()) return mask(Reason::Serial); + if (_local_cli_output.busy()) return mask(Reason::SerialIO); #endif #if defined(WITH_BRIDGE) #ifdef WITH_MQTT_BRIDGE @@ -4579,15 +4624,21 @@ void MyMesh::resetNeighborDiscoverJsonBudget() { // progress metadata; UINT32_MAX likewise reserves the widest heard-age value. // If this result cannot fit, stop before transmitting another scope request. bool MyMesh::completeNeighborDiscoverEntry() { - NeighborDiscoverEntry& entry = neighbor_discover[neighbor_discover_next]; + if ((size_t)neighbor_discover_next >= NEIGHBOR_SCOPE_RESULTS) { + neighbor_discover_truncated = true; + finishNeighborDiscover(); + return false; + } + auto& entry = neighbor_discover_metadata[neighbor_discover_next]; char pubkey_hex[65]; - mesh::Utils::toHex(pubkey_hex, entry.id.pub_key, PUB_KEY_SIZE); + mesh::Utils::toHex(pubkey_hex, + neighbor_discover[neighbor_discover_next].id.pub_key, PUB_KEY_SIZE); MQTTMessageBuilder::NeighborsMessageEntry measured = { pubkey_hex, entry.snr / 4.0f, UINT32_MAX, - entry.scopes, + neighbor_discover_scopes[neighbor_discover_next], entry.status == ND_RESPONDED ? "responded" : (entry.status == ND_SEND_FAILED ? "send_failed" : "timeout") }; @@ -4613,8 +4664,9 @@ bool MyMesh::completeNeighborDiscoverEntry() { bool MyMesh::handleNeighborDiscoverResponse(int overlay_idx, const uint8_t* data, size_t len, float snr, int16_t rssi) { - if (overlay_idx < 0 || overlay_idx >= neighbor_discover_count) return false; - NeighborDiscoverEntry& entry = neighbor_discover[overlay_idx]; + if (overlay_idx < 0 || overlay_idx >= neighbor_discover_count + || (size_t)overlay_idx >= NEIGHBOR_SCOPE_RESULTS) return false; + auto& entry = neighbor_discover_metadata[overlay_idx]; if (entry.status != ND_PENDING || len < 8) return false; uint32_t tag; @@ -4622,11 +4674,12 @@ bool MyMesh::handleNeighborDiscoverResponse(int overlay_idx, if (tag != entry.tag) return false; size_t scope_len = len - 8; - if (scope_len >= sizeof(entry.scopes)) { - scope_len = sizeof(entry.scopes) - 1; + auto& scopes = neighbor_discover_scopes[overlay_idx]; + if (scope_len >= sizeof(scopes)) { + scope_len = sizeof(scopes) - 1; } - memcpy(entry.scopes, &data[8], scope_len); - entry.scopes[scope_len] = 0; + memcpy(scopes, &data[8], scope_len); + scopes[scope_len] = 0; entry.status = ND_RESPONDED; // A zero-hop reply is proof we heard this neighbour now, so re-stamp both the // snapshot and live table with this packet's measurements. A stamp taken @@ -4634,7 +4687,7 @@ bool MyMesh::handleNeighborDiscoverResponse(int overlay_idx, entry.heard_timestamp = getRTCClock()->getCurrentTime(); entry.snr = (int8_t)(snr * 4); entry.rssi = rssi; - touchNeighbourHeard(entry.id, entry.heard_timestamp, snr, rssi); + touchNeighbourHeard(neighbor_discover[overlay_idx].id, entry.heard_timestamp, snr, rssi); return true; } @@ -4762,16 +4815,16 @@ void MyMesh::finishNeighborDiscover() { uint32_t now_secs = getRTCClock()->getCurrentTime(); for (int i = 0; i < publish_count; i++) { - auto& entry = neighbor_discover[i]; + auto& entry = neighbor_discover_metadata[i]; char* hex = &pubkey_hex[i * hex_size]; - mesh::Utils::toHex(hex, entry.id.pub_key, PUB_KEY_SIZE); + mesh::Utils::toHex(hex, neighbor_discover[i].id.pub_key, PUB_KEY_SIZE); entries[i].pubkey_hex = hex; entries[i].snr = entry.snr / 4.0f; entries[i].rssi = entry.rssi; bool heard_known = neighborHeardAgeUsable(entry.heard_timestamp, now_secs); entries[i].heard_unknown = !heard_known; entries[i].heard_secs_ago = heard_known ? (now_secs - entry.heard_timestamp) : 0; - entries[i].scopes = entry.scopes; + entries[i].scopes = neighbor_discover_scopes[i]; switch (entry.status) { case ND_RESPONDED: entries[i].status = "responded"; break; case ND_SEND_FAILED: entries[i].status = "send_failed"; break; @@ -4834,8 +4887,13 @@ void MyMesh::loopNeighborDiscover() { finishNeighborDiscover(); return; } + if ((size_t)neighbor_discover_next >= NEIGHBOR_SCOPE_RESULTS) { + neighbor_discover_truncated = true; + finishNeighborDiscover(); + return; + } - NeighborDiscoverEntry& entry = neighbor_discover[neighbor_discover_next]; + auto& entry = neighbor_discover_metadata[neighbor_discover_next]; if (entry.status == ND_QUEUED) { if (!millisHasNowPassed(neighbor_discover_until)) return; if (cancelNeighborDiscoverRequest()) { @@ -4869,7 +4927,8 @@ void MyMesh::loopNeighborDiscover() { } uint32_t tag; - mesh::Packet* request = sendAnonRegionsReq(entry.id, tag); + mesh::Packet* request = sendAnonRegionsReq( + neighbor_discover[neighbor_discover_next].id, tag); if (request) { entry.tag = tag; entry.status = ND_QUEUED; @@ -4904,38 +4963,49 @@ bool MyMesh::startNeighborDiscover(char* reply) { return false; // reply already set } + // Select in the exact original stable order without putting another full + // 254-entry table on the loop stack. The live cache is only mutated on this + // mesh task, so it remains stable during this synchronous snapshot step. + static_assert(MAX_NEIGHBOURS <= 255, "Snapshot indexes and count must fit one byte"); + uint8_t order[MAX_NEIGHBOURS]; neighbor_discover_count = 0; for (int i = 0; i < MAX_NEIGHBOURS; i++) { if (neighbours[i].heard_timestamp > 0) { - NeighborDiscoverEntry& entry = neighbor_discover[neighbor_discover_count]; - entry.id = neighbours[i].id; - entry.heard_timestamp = neighbours[i].heard_timestamp; - entry.snr = neighbours[i].snr; - entry.rssi = neighbours[i].rssi; - entry.scopes[0] = 0; - entry.tag = 0; - entry.status = ND_UNSENT; - neighbor_discover_count++; + order[neighbor_discover_count++] = (uint8_t)i; } } - // Query the freshest/strongest entries first; pubkey makes ties deterministic. for (int i = 1; i < neighbor_discover_count; i++) { - NeighborDiscoverEntry entry = neighbor_discover[i]; + const uint8_t entry_index = order[i]; + const auto& entry = neighbours[entry_index]; int j = i; while (j > 0) { - auto& rhs = neighbor_discover[j - 1]; + const auto& rhs = neighbours[order[j - 1]]; bool before = entry.heard_timestamp > rhs.heard_timestamp || (entry.heard_timestamp == rhs.heard_timestamp && entry.snr > rhs.snr) || (entry.heard_timestamp == rhs.heard_timestamp && entry.snr == rhs.snr && memcmp(entry.id.pub_key, rhs.id.pub_key, PUB_KEY_SIZE) < 0); if (!before) break; - neighbor_discover[j] = neighbor_discover[j - 1]; + order[j] = order[j - 1]; j--; } - neighbor_discover[j] = entry; + order[j] = entry_index; } + memset(neighbor_discover_metadata, 0, sizeof(neighbor_discover_metadata)); + for (int i = 0; i < neighbor_discover_count; i++) { + const auto& source = neighbours[order[i]]; + neighbor_discover[i].id = source.id; + if ((size_t)i < NEIGHBOR_SCOPE_RESULTS) { + auto& metadata = neighbor_discover_metadata[i]; + metadata.heard_timestamp = source.heard_timestamp; + metadata.snr = source.snr; + metadata.rssi = source.rssi; + metadata.status = ND_UNSENT; + } + } + + memset(neighbor_discover_scopes, 0, sizeof(neighbor_discover_scopes)); neighbor_discover_next = 0; resetNeighborDiscoverJsonBudget(); neighbor_discover_active = true; diff --git a/examples/simple_room_server/MyMesh.h b/examples/simple_room_server/MyMesh.h index 8782792e6..d6c6b499e 100644 --- a/examples/simple_room_server/MyMesh.h +++ b/examples/simple_room_server/MyMesh.h @@ -147,6 +147,17 @@ namespace mesh { class RoomJsonWriter; } #define MAX_POST_TEXT_LEN (160-9) +#ifndef ROOM_POSTS_RTC_SLOW_STORAGE +#define ROOM_POSTS_RTC_SLOW_STORAGE 0 +#endif +#if ROOM_POSTS_RTC_SLOW_STORAGE != 0 && ROOM_POSTS_RTC_SLOW_STORAGE != 1 +#error "ROOM_POSTS_RTC_SLOW_STORAGE must be 0 or 1" +#endif +#if ROOM_POSTS_RTC_SLOW_STORAGE && (!defined(ESP32_PLATFORM) || !defined(LILYGO_TLORA) \ + || !defined(MESHCORE_EXPANDED_PARTITION_PROFILE)) +#error "RTC slow Room posts require the qualified Full TLora ESP32 recipe" +#endif + struct PostInfo { mesh::Identity author; uint32_t post_timestamp; // by OUR clock @@ -230,7 +241,11 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks, uint16_t _num_posted, _num_post_pushes; int next_client_idx; // for round-robin polling int next_post_idx; +#if ROOM_POSTS_RTC_SLOW_STORAGE + PostInfo (&posts)[MAX_UNSYNCED_POSTS]; +#else PostInfo posts[MAX_UNSYNCED_POSTS]; // cyclic queue +#endif static_assert(MAX_UNSYNCED_POSTS <= 32, "Room readiness bitmap holds 32 posts"); uint32_t post_ready_at[MAX_UNSYNCED_POSTS] = {}; uint32_t post_ready_mask = UINT32_MAX; @@ -279,15 +294,28 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks, ND_SEND_FAILED = 5, }; struct NeighborDiscoverEntry { + // Keep every full key in the immutable crypto overlay, even when the + // existing JSON/query budget cannot publish that neighbor this pass. mesh::Identity id; + }; + struct NeighborDiscoverMetadata { uint32_t heard_timestamp; - int8_t snr; - int16_t rssi; uint32_t tag; - char scopes[96]; + int16_t rssi; + int8_t snr; uint8_t status; }; + static_assert(sizeof(NeighborDiscoverMetadata) == 12, + "Discovery metadata must retain its complete compact layout"); NeighborDiscoverEntry neighbor_discover[MAX_NEIGHBOURS]; + // Only the publishable prefix (plus the result that detects truncation) + // receives scope queries. Keep every neighbor snapshot, without reserving + // 96 response bytes for each entry that will never be queried. + static constexpr size_t NEIGHBOR_SCOPE_RESULTS = + MAX_NEIGHBOURS < MQTTBridge::NEIGHBORS_SCOPE_RESULT_CAPACITY + ? MAX_NEIGHBOURS : MQTTBridge::NEIGHBORS_SCOPE_RESULT_CAPACITY; + NeighborDiscoverMetadata neighbor_discover_metadata[NEIGHBOR_SCOPE_RESULTS]; + char neighbor_discover_scopes[NEIGHBOR_SCOPE_RESULTS][96]; uint8_t neighbor_discover_count; uint8_t neighbor_discover_next; uint8_t neighbor_discover_publish_count; @@ -504,6 +532,13 @@ public: bool getFleetLocation(int32_t& latitude_e6, int32_t& longitude_e6) const override; #endif MyMesh(mesh::MainBoard& board, mesh::Radio& radio, mesh::MillisecondClock& ms, mesh::RNG& rng, mesh::RTCClock& rtc, mesh::MeshTables& tables); +#if ROOM_POSTS_RTC_SLOW_STORAGE + ~MyMesh(); + MyMesh(const MyMesh&) = delete; + MyMesh& operator=(const MyMesh&) = delete; + MyMesh(MyMesh&&) = delete; + MyMesh& operator=(MyMesh&&) = delete; +#endif void begin(FILESYSTEM* fs); bool addSystemPost(const char* postData); @@ -1041,6 +1076,7 @@ public: void getNodeSnapshot(WebConfigServer::NodeSnapshot& snapshot) override; void execCommand(char* cmd, char* reply) override { handleCommand(0, cmd, reply); } bool supportsRoomService() const override { return true; } + const uint8_t* roomPageGzip(size_t& length) const override; bool roomRequestAuthenticated() const override { return room_web_request_authenticated; } void processRoomRequest(const uint8_t* token, uint32_t sequence, char* request, char* response, size_t capacity) override; diff --git a/platformio.ini b/platformio.ini index d9e160982..476c96ab0 100644 --- a/platformio.ini +++ b/platformio.ini @@ -93,6 +93,8 @@ extra_scripts = pre:scripts/micronmea_time_fix.py pre:scripts/rtttl_rollover_fix.py pre:scripts/generate_webconfig_html.py + pre:scripts/generate_room_web_html.py + pre:scripts/esp32_full_size.py pre:scripts/meshcore_image_identity.py pre:scripts/ota_device_deflate_role.py pre:scripts/portable_esp32_link.py diff --git a/scripts/esp32_full_size.py b/scripts/esp32_full_size.py new file mode 100644 index 000000000..7ff2ce455 --- /dev/null +++ b/scripts/esp32_full_size.py @@ -0,0 +1,128 @@ +"""Keep complete ESP32 infrastructure firmware inside physical dual-OTA slots. + +No source-built MeshCore/framework/dependency code uses C++ exception handlers. +Arduino otherwise forces unwinding metadata into each linked function. Apply +this policy after framework flags are populated, including library clones. +Constrained 4 MiB infrastructure images also share the already-qualified +compact Ed25519 arithmetic/hash and lossless OTA target-name table. +""" +from __future__ import annotations + +import importlib.util +import os +from pathlib import Path + +SCRIPT_DIR = Path(__file__).resolve().parent if "__file__" in globals() else Path("scripts").resolve() +SPEC = importlib.util.spec_from_file_location( + "esp32_full_size_source_policy", SCRIPT_DIR / "nrf52_flash_trim.py") +SOURCE_POLICY = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(SOURCE_POLICY) + +ROLES = ( + "../examples/simple_repeater/main.cpp", + "../examples/simple_room_server/main.cpp", + "../examples/simple_sensor/main.cpp", +) +EXCLUDED_ROLES = ( + "../examples/companion_radio/main.cpp", + "../examples/companion_radio/MyMesh.cpp", + "../examples/simple_secure_chat/main.cpp", + "../examples/kiss_modem/main.cpp", + "../examples/partition_expander/main.cpp", + "../examples/esp32_partition_migrator/main.cpp", + "../examples/esp32_partition_legacy_seed/main.cpp", +) +COMPACT_DEFINES = { + # SMALL_BASE uses the existing 960-byte table, not a RAM-built table. + "ED25519_SMALL_BASE": 1, + "ED25519_COMPACT_SCALAR": 1, + "ED25519_COMPACT_FIELD": 1, + "ED25519_USE_CRYPTO_SHA512": 1, + "OTA_TARGET_NAME_FRONT_CODED": 1, +} +POSITIVE_FLAGS = {"-fexceptions", "-funwind-tables", "-fasynchronous-unwind-tables"} +UNWIND_FLAGS = ["-fno-unwind-tables", "-fno-asynchronous-unwind-tables"] + + +def infrastructure_policy(platform, mcu, src_filter, *, full=False, companion=False): + selected = SOURCE_POLICY.source_selected + return bool( + full and not companion and platform == "espressif32" + and str(mcu).lower().startswith("esp32") + and sum(selected(src_filter, source) for source in ROLES) == 1 + and not any(selected(src_filter, source) for source in EXCLUDED_ROLES) + ) + + +def compact_definitions(flash_bytes, flags=(), cppdefines=()): + if flash_bytes > 4 * 1024 * 1024: + return {} + values = SOURCE_POLICY.flag_defines(flags, cppdefines) + definitions = {name: value for name, value in COMPACT_DEFINES.items() if name not in values} + # An explicitly chosen base implementation remains authoritative. + if "ED25519_COMPACT_BASE" in values: + definitions.pop("ED25519_SMALL_BASE", None) + return definitions + + +def flag_values(values): + return values.split() if isinstance(values, str) else list(values) + + +def apply_final_flags(build_env): + """Runs per object after SDK defaults and library-clone flags exist.""" + updates = {} + for name in ("CCFLAGS", "CFLAGS", "CXXFLAGS", "LINKFLAGS"): + values = [value for value in flag_values(build_env.get(name, [])) + if value not in POSITIVE_FLAGS] + additions = UNWIND_FLAGS + (["-fno-exceptions"] if name in ("CXXFLAGS", "LINKFLAGS") else []) + updates[name] = values + [flag for flag in additions if flag not in values] + build_env.Replace(**updates) + + +def prepare_source(build_env, node): + # Earlier middleware may already have substituted a private patched source. + # Change flags in the actual clone, preserving that substituted node. + apply_final_flags(build_env) + return node + + +def flash_size_bytes(value): + text = str(value).strip().upper() + for suffix, multiplier in (("MB", 1024 * 1024), ("KB", 1024)): + if text.endswith(suffix): + return int(text[:-len(suffix)]) * multiplier + return int(text, 0) + + +def install(build_env, process_environment=None): + settings = os.environ if process_environment is None else process_environment + board = build_env.BoardConfig() + source_filter = build_env.get("SRC_FILTER") + if source_filter is None: + source_filter = build_env.GetProjectOption("build_src_filter", "") + if not infrastructure_policy( + build_env.PioPlatform().name, board.get("build.mcu", ""), source_filter, + full=settings.get("MESHCORE_ESP32_FULL_BUILD") == "1", + companion=settings.get("MESHCORE_COMPANION_RADIO_FULL") == "1", + ): + return False + definitions = compact_definitions( + flash_size_bytes(board.get("upload.flash_size", "4MB")), + build_env.get("BUILD_FLAGS", ()), build_env.get("CPPDEFINES", ()), + ) + if definitions: + build_env.AppendUnique(CPPDEFINES=list(definitions.items())) + # Pre-script flags may be followed by SDK -fexceptions. Middleware sees + # the populated environment for each framework/library/application object. + build_env.AddBuildMiddleware(prepare_source) + # LINKFLAGS belong to this final application environment, not lib clones. + # This also covers objects emitted by a custom builder with no source hook. + apply_final_flags(build_env) + print("ESP32 Full infrastructure: no exception/unwind metadata; capacities and dual OTA retained") + return True + + +if "Import" in globals(): + Import("env") + install(env) diff --git a/scripts/generate_room_web_html.py b/scripts/generate_room_web_html.py new file mode 100644 index 000000000..bc1a74f92 --- /dev/null +++ b/scripts/generate_room_web_html.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python3 +"""Losslessly package the Room Server page for browser gzip decoding. + +RoomWebHtml.h remains the reviewed page source and native UI fixture. Only +Room Server's ESP32 WebConfig callback references the compressed asset. Other +roles and nRF52 builds do not include either page in their firmware. +""" +from __future__ import annotations + +import argparse +import gzip +import hashlib +from pathlib import Path +import re +import zlib + +SOURCE = "src/helpers/esp32/RoomWebHtml.h" +OUTPUT = "src/helpers/esp32/RoomWebHtmlGzip.h" +MARKER = "// room-page-source-sha256: " + + +def source_page(header: str) -> bytes: + matches = re.findall( + r'static const char ROOM_WEB_HTML\[\] PROGMEM = R"roomhtml\(([\s\S]*?)\)roomhtml";', + header, + ) + if len(matches) != 1: + raise ValueError("expected one RoomWebHtml.h page source") + return matches[0].encode("ascii") + + +def page_bytes(header: str) -> bytes: + matches = re.findall( + r"static const uint8_t ROOM_WEB_HTML_GZ\[\] PROGMEM = \{([\s\S]*?)\};", header + ) + if len(matches) != 1: + raise ValueError("expected one compressed Room page") + return bytes(int(value, 16) for value in re.findall(r"0x([0-9a-f]{2})", matches[0])) + + +def render(raw: bytes, encoded: bytes) -> str: + if gzip.decompress(encoded) != raw: + raise ValueError("compressed Room page differs from source") + digest = hashlib.sha256(raw).hexdigest() + lines = [ + "// Auto-generated by scripts/generate_room_web_html.py; DO NOT EDIT.", + "// Lossless gzip of RoomWebHtml.h, decoded by the browser.", + MARKER + digest, + "#pragma once", + "#include ", + "#include ", + "", + "static const uint8_t ROOM_WEB_HTML_GZ[] PROGMEM = {", + ] + for index in range(0, len(encoded), 16): + lines.append(" " + "".join("0x%02x," % value for value in encoded[index:index + 16])) + lines.extend(["};", ""]) + return "\n".join(lines) + + +def generate(root: Path, *, check: bool = False) -> bool: + raw = source_page((root / SOURCE).read_text(encoding="ascii")) + destination = root / OUTPUT + existing = destination.read_text(encoding="ascii") if destination.exists() else "" + # Validate the actual bytes rather than trusting a marker or file mtime. + try: + encoded = page_bytes(existing) + intact = gzip.decompress(encoded) == raw and render(raw, encoded) == existing + except (ValueError, OSError, EOFError, zlib.error): + intact = False + if intact: + return False + if check: + raise ValueError("compressed Room page is missing, stale or invalid; regenerate it") + from zopfli_compress import gzip_compress + encoded = gzip_compress(raw) + destination.write_text(render(raw, encoded), encoding="ascii") + print("Room Web HTML: %d source bytes -> %d gzip bytes" % (len(raw), len(encoded))) + return True + + +def main() -> None: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--check", action="store_true") + arguments = parser.parse_args() + root = Path(__file__).resolve().parents[1] if "__file__" in globals() else Path.cwd() + generate(root, check=arguments.check) + + +if __name__ == "__main__": + main() +elif "Import" in globals(): + generate(Path.cwd()) diff --git a/src/helpers/CompanionPsramMesh.h b/src/helpers/CompanionPsramMesh.h new file mode 100644 index 000000000..4f4ce093a --- /dev/null +++ b/src/helpers/CompanionPsramMesh.h @@ -0,0 +1,74 @@ +#pragma once + +#ifndef COMPANION_MESH_PSRAM_STORAGE +#define COMPANION_MESH_PSRAM_STORAGE 0 +#endif +#if COMPANION_MESH_PSRAM_STORAGE != 0 && COMPANION_MESH_PSRAM_STORAGE != 1 +#error "COMPANION_MESH_PSRAM_STORAGE must be 0 or 1" +#endif + +#if COMPANION_MESH_PSRAM_STORAGE +#if !defined(ESP32_PLATFORM) || !defined(BOARD_HAS_PSRAM) \ + || !defined(COMPANION_RADIO_FULL) || !defined(INDICATOR_TRANSPORT_RENDER_PROFILE) \ + || !defined(MESH_PRIMARY_ESPNOW) || !MESH_PRIMARY_ESPNOW +#error "Late PSRAM mesh storage requires the qualified Indicator ESP-NOW Full recipe" +#endif +#if defined(OTA_SHARED_COMPANION_QUEUE) +#error "Late PSRAM mesh storage retains the independent full-capacity queue" +#endif +#include +#if !defined(CONFIG_IDF_TARGET_ESP32S3) || !CONFIG_SPIRAM +#error "Late PSRAM mesh storage requires configured ESP32-S3 PSRAM" +#endif +#include +#include +#include +#include +#include +#include + +namespace mesh { + +// This object owns only a pointer during global construction. setup() calls +// begin() explicitly once the board/Arduino PSRAM initialization has finished. +// get() never performs hidden allocation or permits access before that point. +template class CompanionPsramMesh { + T* value_ = nullptr; + bool constructing_ = false; +public: + enum class Result { Ready, MissingPsram, AllocationFailed }; + CompanionPsramMesh() = default; + ~CompanionPsramMesh() { + if (value_) { + value_->~T(); + heap_caps_free(value_); + } + } + CompanionPsramMesh(const CompanionPsramMesh&) = delete; + CompanionPsramMesh& operator=(const CompanionPsramMesh&) = delete; + CompanionPsramMesh(CompanionPsramMesh&&) = delete; + CompanionPsramMesh& operator=(CompanionPsramMesh&&) = delete; + + template Result begin(Args&&... args) { + if (constructing_) abort(); + if (value_) return Result::Ready; + if (!psramFound()) return Result::MissingPsram; + // Match the old global object's zero initialization before invoking its + // constructor. Several mesh members intentionally rely on that state. + void* storage = heap_caps_calloc(1, sizeof(T), MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT); + if (!storage) return Result::AllocationFailed; + constructing_ = true; + T* constructed = new (storage) T(std::forward(args)...); + value_ = constructed; + constructing_ = false; + return Result::Ready; + } + T& get() const { + // NDEBUG must not turn a bad startup order into a null/partial mesh. + if (constructing_ || !value_) abort(); + return *value_; + } +}; + +} // namespace mesh +#endif diff --git a/src/helpers/CompanionRtcQueue.h b/src/helpers/CompanionRtcQueue.h new file mode 100644 index 000000000..4ac374675 --- /dev/null +++ b/src/helpers/CompanionRtcQueue.h @@ -0,0 +1,115 @@ +#pragma once + +// Explicit Full recipes can move existing frame slots, never borrow or remove +// them. Unselected boards retain their original storage and capacity policy. +#ifndef COMPANION_RTC_FAST_OFFLINE_FRAMES +#define COMPANION_RTC_FAST_OFFLINE_FRAMES 0 +#endif +#ifndef COMPANION_RTC_SLOW_OFFLINE_FRAMES +#define COMPANION_RTC_SLOW_OFFLINE_FRAMES 0 +#endif +#if COMPANION_RTC_FAST_OFFLINE_FRAMES < 0 || COMPANION_RTC_SLOW_OFFLINE_FRAMES < 0 +#error "RTC offline-frame counts must not be negative" +#endif + +#if COMPANION_RTC_FAST_OFFLINE_FRAMES || COMPANION_RTC_SLOW_OFFLINE_FRAMES +#if !defined(ESP32_PLATFORM) || !defined(COMPANION_RADIO_FULL) +#error "RTC offline frames require a qualified ESP32 Full Companion recipe" +#endif +#if defined(BOARD_HAS_PSRAM) || defined(OTA_SHARED_COMPANION_QUEUE) \ + || ONE_KEY_DM_SHARED_OFFLINE_QUEUE +#error "RTC offline frames require the independent fixed-capacity queue" +#endif +#include +#include +#include +#include +#include +#include +#include +#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) +#error "RTC offline frames are qualified only on ESP32-C3 and ESP32-S3" +#endif +#if !CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP +#error "RTC offline frames require the qualified byte-accessible retained RTC configuration" +#endif +#if COMPANION_RTC_SLOW_OFFLINE_FRAMES && !defined(CONFIG_IDF_TARGET_ESP32S3) +#error "The separate RTC SLOW offline-frame bank requires ESP32-S3" +#endif + +namespace mesh { +namespace companion_rtc { + +template struct Lease { + static const void*& owner() { + static const void* value = nullptr; + return value; + } +}; +} // namespace companion_rtc + +// CPU-only backing for the ordinary FIFO. SDK transports copy frames into +// their own buffers; these banks are not handed to a DMA engine. The linker +// excludes both banks from its RTC heap and rejects physical-bank overflow. +// No retained message/session state is adopted after reboot or destruction. +template class CompanionRtcQueue { + static constexpr size_t FastCount = COMPANION_RTC_FAST_OFFLINE_FRAMES; + static constexpr size_t SlowCount = COMPANION_RTC_SLOW_OFFLINE_FRAMES; + static_assert(Count > FastCount + SlowCount, + "RTC frames must leave a nonempty ordinary DRAM bank"); + static_assert(std::is_trivial::value && std::is_standard_layout::value, + "RTC frame banks require trivial plain-data frames"); + static constexpr size_t MainCount = Count - FastCount - SlowCount; + static_assert(sizeof(Frame) * FastCount <= 6144 && sizeof(Frame) * SlowCount <= 6144, + "Leave RTC bank space for the SDK and retained board state"); + Frame* fast_frames; + Frame* slow_frames; + Frame main_frames[MainCount]; + + static const void*& owner() { + // Ordinary BSS resets on every boot, unlike the RTC byte arrays. + return companion_rtc::Lease::owner(); + } + void requireOwner() const { + if (owner() != this) abort(); + } + +public: + CompanionRtcQueue(Frame* fast, Frame* slow) : fast_frames(fast), slow_frames(slow) { + if ((FastCount && (!fast || reinterpret_cast(fast) % 4)) + || (SlowCount && (!slow || reinterpret_cast(slow) % 4))) abort(); + // Release builds define NDEBUG. Never let a second object silently share + // the first object's unread messages or rely on an assert for ownership. + if (owner() != nullptr) abort(); + owner() = this; + reset(); + } + ~CompanionRtcQueue() { + requireOwner(); + owner() = nullptr; + } + CompanionRtcQueue(const CompanionRtcQueue&) = delete; + CompanionRtcQueue& operator=(const CompanionRtcQueue&) = delete; + CompanionRtcQueue(CompanionRtcQueue&&) = delete; + CompanionRtcQueue& operator=(CompanionRtcQueue&&) = delete; + + void reset() { + requireOwner(); + // Clear in place. An aggregate assignment here would put the complete + // queue on the loop/startup stack as a temporary. + memset(main_frames, 0, sizeof(main_frames)); + if (FastCount) memset(fast_frames, 0, sizeof(Frame) * FastCount); + if (SlowCount) memset(slow_frames, 0, sizeof(Frame) * SlowCount); + } + Frame& at(size_t physical_index) { + requireOwner(); + if (physical_index >= Count) abort(); + if (physical_index < MainCount) return main_frames[physical_index]; + physical_index -= MainCount; + if (physical_index < FastCount) return fast_frames[physical_index]; + return slow_frames[physical_index - FastCount]; + } +}; + +} // namespace mesh +#endif diff --git a/src/helpers/ESP32Board.h b/src/helpers/ESP32Board.h index f395f7a88..a29e79ed1 100644 --- a/src/helpers/ESP32Board.h +++ b/src/helpers/ESP32Board.h @@ -428,7 +428,7 @@ public: // sleep loses their first input bytes; UART wake loses the wake character // too. HardwareSerial's bool reports an installed driver, not a USB host. // Keep an enabled console available even before its first command. - keep_awake = keep_awake || hold(static_cast(Serial), Reason::Serial); + keep_awake = keep_awake || hold(static_cast(Serial), Reason::SerialIO); #endif #if MESH_USB_LOGGING_AVAILABLE // A live logging stream must also remain available before a host opens diff --git a/src/helpers/FloodAdvertIramPolicy.h b/src/helpers/FloodAdvertIramPolicy.h new file mode 100644 index 000000000..0c97e7658 --- /dev/null +++ b/src/helpers/FloodAdvertIramPolicy.h @@ -0,0 +1,21 @@ +#pragma once +#ifndef FLOOD_ADVERT_IRAM_WORD_STORAGE +#define FLOOD_ADVERT_IRAM_WORD_STORAGE 0 +#endif +#if FLOOD_ADVERT_IRAM_WORD_STORAGE != 0 && FLOOD_ADVERT_IRAM_WORD_STORAGE != 1 +#error "IRAM advert storage must be zero or one" +#endif +#if FLOOD_ADVERT_IRAM_WORD_STORAGE +#if !defined(ESP32_PLATFORM) || !defined(MESHCORE_EXPANDED_PARTITION_PROFILE) +#error "IRAM advert storage requires the qualified ESP32 Full recipe" +#endif +#include +#if !defined(CONFIG_IDF_TARGET_ESP32) || CONFIG_ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY +#error "IRAM advert storage requires the classic ESP32 word-only physical memory pool" +#endif +#if FLOOD_ADVERT_RTC_FAST_SLOTS || FLOOD_ADVERT_RTC_SLOW_SLOTS +#error "IRAM and RTC advert backends cannot share one table" +#endif +#include +#include +#endif diff --git a/src/helpers/FloodAdvertLimiter.cpp b/src/helpers/FloodAdvertLimiter.cpp index 022ba0187..6a7aab54e 100644 --- a/src/helpers/FloodAdvertLimiter.cpp +++ b/src/helpers/FloodAdvertLimiter.cpp @@ -7,8 +7,13 @@ uint8_t FloodAdvertLimiter::allowance(uint8_t hops) { return limits[hops < 8 ? hops : 8]; } +#if !FLOOD_ADVERT_IRAM_WORD_STORAGE void FloodAdvertLimiter::reset() { +#if FLOOD_ADVERT_RTC_FAST_SLOTS || FLOOD_ADVERT_RTC_SLOW_SLOTS + _entries.reset(); +#else for (size_t i = 0; i < _capacity; ++i) _entries[i].flags = 0; +#endif _last_sweep = 0; } @@ -26,6 +31,8 @@ void FloodAdvertLimiter::clear(const uint8_t* full_key) { if (entry) entry->flags = 0; } +#endif + int FloodAdvertLimiter::hashIndex(const Entry& entry, const uint8_t* hash) { for (uint8_t i = 0; i < entry.count; ++i) { if (memcmp(entry.hashes[i], hash, MAX_HASH_SIZE) == 0) return i; @@ -62,11 +69,14 @@ void FloodAdvertLimiter::advance(Entry& entry, uint32_t now) { } } +#if !FLOOD_ADVERT_IRAM_WORD_STORAGE void FloodAdvertLimiter::refresh(uint32_t now) { for (size_t i = 0; i < _capacity; ++i) advance(_entries[i], now); _last_sweep = now; } +#endif + void FloodAdvertLimiter::tick(uint32_t now) { // Periodic expiry prevents stale history resurrecting after a millis wrap, // even when no adverts arrive for weeks. Receive operations also expire it @@ -74,6 +84,7 @@ void FloodAdvertLimiter::tick(uint32_t now) { if (uint32_t(now - _last_sweep) >= 60000UL) refresh(now); } +#if !FLOOD_ADVERT_IRAM_WORD_STORAGE bool FloodAdvertLimiter::needsShorterPath(const uint8_t* key, uint8_t hops, uint32_t now) { refresh(now); Entry* entry = find(key); @@ -233,4 +244,6 @@ size_t FloodAdvertLimiter::listLimited(uint32_t now, size_t offset, return total; } +#endif + } // namespace mesh diff --git a/src/helpers/FloodAdvertLimiter.h b/src/helpers/FloodAdvertLimiter.h index c392853ef..eafd65722 100644 --- a/src/helpers/FloodAdvertLimiter.h +++ b/src/helpers/FloodAdvertLimiter.h @@ -2,6 +2,8 @@ #include #include +#include "FloodAdvertRtcPolicy.h" +#include "FloodAdvertIramPolicy.h" #ifndef FLOOD_ADVERT_SOURCE_SLOTS #if defined(STM32_PLATFORM) @@ -15,6 +17,9 @@ #endif namespace mesh { +#if FLOOD_ADVERT_IRAM_WORD_STORAGE +volatile uint32_t* floodAdvertIramBank(); +#endif // Volatile, bounded receive history. Only forwarding roles own this table. // All times are uint32_t uptime milliseconds, never advert timestamps or RTC. @@ -74,7 +79,17 @@ public: size_t listLimited(uint32_t now, size_t offset, LimitedEntry* dest, size_t count); protected: +#if FLOOD_ADVERT_IRAM_WORD_STORAGE + FloodAdvertLimiter(volatile uint32_t* entries, size_t capacity); + ~FloodAdvertLimiter(); +#elif FLOOD_ADVERT_RTC_FAST_SLOTS || FLOOD_ADVERT_RTC_SLOW_SLOTS + FloodAdvertLimiter(Entry* entries, size_t capacity, Entry* fast, Entry* slow) + : _entries(entries, fast, slow), _capacity(capacity) { + if (capacity != FLOOD_ADVERT_SOURCE_SLOTS) abort(); + } +#else FloodAdvertLimiter(Entry* entries, size_t capacity) : _entries(entries), _capacity(capacity) {} +#endif FloodAdvertLimiter(const FloodAdvertLimiter&) = delete; FloodAdvertLimiter& operator=(const FloodAdvertLimiter&) = delete; @@ -82,10 +97,85 @@ private: enum : uint8_t { ACTIVE = 1, PREVIOUS_OVER = 2, BAD = 4, HAS_FORWARDED = 8 }; static_assert((ACTIVE | PREVIOUS_OVER | BAD | HAS_FORWARDED) <= 15, "Advert flags must fit their four-bit field"); +#if FLOOD_ADVERT_IRAM_WORD_STORAGE + volatile uint32_t* _entries; + static const void*& iramOwner(); + void requireIramOwner(size_t index) const; + struct EntryTail { + uint16_t forwarded; + uint8_t min_hops; + uint8_t count : 4; + uint8_t flags : 4; + }; + static_assert(sizeof(Entry) == 140 && sizeof(EntryTail) == 4 + && offsetof(Entry, forwarded) == 136 && offsetof(Entry, min_hops) == 138, + "Qualified IRAM codec must preserve the original record ABI"); + static constexpr size_t EntryWords = sizeof(Entry) / sizeof(uint32_t); + void loadEntry(size_t index, Entry& dest) const; + void storeEntry(size_t index, const Entry& source); + EntryTail readTail(size_t index) const; + void writeTail(size_t index, EntryTail tail); + uint32_t readStamp(size_t index, size_t offset) const; + bool keyMatches(size_t index, const uint8_t* key, size_t length) const; + size_t findIndex(const uint8_t* key) const; +#elif FLOOD_ADVERT_RTC_FAST_SLOTS || FLOOD_ADVERT_RTC_SLOW_SLOTS + // CPU-only banks. No transport or DMA engine receives these addresses. + class EntryStorage { + static constexpr size_t FastCount = FLOOD_ADVERT_RTC_FAST_SLOTS; + static constexpr size_t SlowCount = FLOOD_ADVERT_RTC_SLOW_SLOTS; + static constexpr size_t MainCount = FLOOD_ADVERT_SOURCE_SLOTS - FastCount - SlowCount; + static_assert(FLOOD_ADVERT_SOURCE_SLOTS > FastCount + SlowCount, + "Advert history must retain an ordinary main bank"); + static_assert(sizeof(Entry) == 140 && std::is_trivial::value, + "Qualified advert records must retain every original field"); + static_assert(sizeof(Entry) * FastCount <= 7168 && sizeof(Entry) * SlowCount <= 7168, + "Advert banks must leave SDK RTC storage headroom"); + Entry* main_; + Entry* fast_; + Entry* slow_; + static const void*& owner() { + // This lease lives in ordinary BSS and resets on every boot/deep wake. + static const void* value = nullptr; + return value; + } + void requireOwner() const { if (owner() != this) abort(); } + public: + EntryStorage(Entry* main, Entry* fast, Entry* slow) + : main_(main), fast_(fast), slow_(slow) { + if (!main || reinterpret_cast(main) % alignof(Entry) + || (FastCount && (!fast || reinterpret_cast(fast) % 4)) + || (SlowCount && (!slow || reinterpret_cast(slow) % 4)) + || owner() != nullptr) abort(); + owner() = this; + } + ~EntryStorage() { requireOwner(); owner() = nullptr; } + EntryStorage(const EntryStorage&) = delete; + EntryStorage& operator=(const EntryStorage&) = delete; + Entry& operator[](size_t index) { + requireOwner(); + if (index >= FLOOD_ADVERT_SOURCE_SLOTS) abort(); + if (index < MainCount) return main_[index]; + index -= MainCount; + if (index < FastCount) return fast_[index]; + return slow_[index - FastCount]; + } + void reset() { + requireOwner(); + // Clear in place, including retained bytes after reboot/deep wake. + memset(main_, 0, sizeof(Entry) * MainCount); + if (FastCount) memset(fast_, 0, sizeof(Entry) * FastCount); + if (SlowCount) memset(slow_, 0, sizeof(Entry) * SlowCount); + } + }; + EntryStorage _entries; +#else Entry* _entries; +#endif size_t _capacity; uint32_t _last_sweep = 0; +#if !FLOOD_ADVERT_IRAM_WORD_STORAGE Entry* find(const uint8_t* key); +#endif static int hashIndex(const Entry& entry, const uint8_t* hash); static void advance(Entry& entry, uint32_t now); void refresh(uint32_t now); @@ -94,9 +184,23 @@ private: template class StaticFloodAdvertLimiter : public FloodAdvertLimiter { static_assert(Capacity > 0, "Advert limiter needs at least one source slot"); +#if FLOOD_ADVERT_IRAM_WORD_STORAGE + static_assert(Capacity == FLOOD_ADVERT_SOURCE_SLOTS, + "IRAM advert storage retains the exact full source capacity"); +public: + StaticFloodAdvertLimiter() : FloodAdvertLimiter(floodAdvertIramBank(), Capacity) { reset(); } +#elif FLOOD_ADVERT_RTC_FAST_SLOTS || FLOOD_ADVERT_RTC_SLOW_SLOTS + static_assert(Capacity == FLOOD_ADVERT_SOURCE_SLOTS, + "RTC advert storage requires the exact fixed source capacity"); + Entry _storage[Capacity - FLOOD_ADVERT_RTC_FAST_SLOTS - FLOOD_ADVERT_RTC_SLOW_SLOTS]; +public: + StaticFloodAdvertLimiter(Entry* fast, Entry* slow) + : FloodAdvertLimiter(_storage, Capacity, fast, slow) { reset(); } +#else Entry _storage[Capacity]; public: StaticFloodAdvertLimiter() : FloodAdvertLimiter(_storage, Capacity) { reset(); } +#endif }; } // namespace mesh diff --git a/src/helpers/FloodAdvertLimiterIram.cpp b/src/helpers/FloodAdvertLimiterIram.cpp new file mode 100644 index 000000000..54f317062 --- /dev/null +++ b/src/helpers/FloodAdvertLimiterIram.cpp @@ -0,0 +1,281 @@ +#include "FloodAdvertLimiter.h" + +#if FLOOD_ADVERT_IRAM_WORD_STORAGE +namespace mesh { + +// The pinned SDK collects .iram.bss.* in its existing NOLOAD IRAM section, +// then reserves it through _iram_end. These are distinct SRAM0 words, not a +// D/IRAM alias already counted as byte-accessible heap. Never expose a byte +// pointer into this bank to memcpy, crypto, a transport or a DMA engine. +static_assert(FLOOD_ADVERT_SOURCE_SLOTS == 128, "Retain every advert-source record"); +alignas(4) static uint32_t iram_advert_words[128 * 35] + __attribute__((section(".iram.bss.mesh_flood_advert"))); + +volatile uint32_t* floodAdvertIramBank() { return iram_advert_words; } + +const void*& FloodAdvertLimiter::iramOwner() { + // Ordinary BSS clears this on every boot, including deep-sleep wake. The + // NOLOAD word bank is explicitly reset before any record is consumed. + static const void* owner = nullptr; + return owner; +} + +FloodAdvertLimiter::FloodAdvertLimiter(volatile uint32_t* entries, size_t capacity) + : _entries(entries), _capacity(capacity) { + if (!entries || reinterpret_cast(entries) % 4 + || capacity != FLOOD_ADVERT_SOURCE_SLOTS || iramOwner()) abort(); + iramOwner() = this; +} + +FloodAdvertLimiter::~FloodAdvertLimiter() { + if (iramOwner() != this) abort(); + iramOwner() = nullptr; +} + +void FloodAdvertLimiter::requireIramOwner(size_t index) const { + if (iramOwner() != this || index >= _capacity) abort(); +} + +void FloodAdvertLimiter::loadEntry(size_t index, Entry& dest) const { + requireIramOwner(index); + for (size_t word = 0; word < EntryWords; ++word) { + const uint32_t value = _entries[index * EntryWords + word]; + memcpy(reinterpret_cast(&dest) + word * 4, &value, 4); + } +} + +void FloodAdvertLimiter::storeEntry(size_t index, const Entry& source) { + requireIramOwner(index); + for (size_t word = 0; word < EntryWords; ++word) { + uint32_t value; + memcpy(&value, reinterpret_cast(&source) + word * 4, 4); + _entries[index * EntryWords + word] = value; + } +} + +FloodAdvertLimiter::EntryTail FloodAdvertLimiter::readTail(size_t index) const { + requireIramOwner(index); + const uint32_t value = _entries[index * EntryWords + offsetof(Entry, forwarded) / 4]; + EntryTail tail; + memcpy(&tail, &value, sizeof(tail)); + return tail; +} + +void FloodAdvertLimiter::writeTail(size_t index, EntryTail tail) { + requireIramOwner(index); + uint32_t value; + memcpy(&value, &tail, sizeof(value)); + _entries[index * EntryWords + offsetof(Entry, forwarded) / 4] = value; +} + +uint32_t FloodAdvertLimiter::readStamp(size_t index, size_t offset) const { + requireIramOwner(index); + if (offset % 4 || offset >= sizeof(Entry)) abort(); + return _entries[index * EntryWords + offset / 4]; +} + +bool FloodAdvertLimiter::keyMatches(size_t index, const uint8_t* key, size_t length) const { + requireIramOwner(index); + if (length != PREFIX_BYTES && length != PUB_KEY_SIZE) abort(); + uint32_t scratch[PUB_KEY_SIZE / 4]; + for (size_t word = 0; word < (length + 3) / 4; ++word) + scratch[word] = _entries[index * EntryWords + word]; + return memcmp(scratch, key, length) == 0; +} + +size_t FloodAdvertLimiter::findIndex(const uint8_t* key) const { + for (size_t i = 0; i < _capacity; ++i) + if ((readTail(i).flags & ACTIVE) && keyMatches(i, key, PUB_KEY_SIZE)) return i; + return _capacity; +} + +void FloodAdvertLimiter::reset() { + if (iramOwner() != this) abort(); + // Volatile uint32_t stores are essential: a byte memset is invalid in IRAM. + for (size_t word = 0; word < _capacity * EntryWords; ++word) _entries[word] = 0; + _last_sweep = 0; +} + +void FloodAdvertLimiter::clear(const uint8_t* key) { + const size_t i = findIndex(key); + if (i == _capacity) return; + EntryTail tail = readTail(i); + tail.flags = 0; + writeTail(i, tail); +} + +void FloodAdvertLimiter::refresh(uint32_t now) { + Entry entry; + for (size_t i = 0; i < _capacity; ++i) { + if (!(readTail(i).flags & ACTIVE)) continue; + loadEntry(i, entry); + advance(entry, now); + storeEntry(i, entry); + } + _last_sweep = now; +} + +bool FloodAdvertLimiter::needsShorterPath(const uint8_t* key, uint8_t hops, uint32_t now) { + refresh(now); + const size_t i = findIndex(key); + return i != _capacity && hops < readTail(i).min_hops; +} + +void FloodAdvertLimiter::noteKnownCopy(const uint8_t* key, const uint8_t* hash, uint32_t now) { + refresh(now); + const size_t i = findIndex(key); + if (i == _capacity) return; + Entry entry; + loadEntry(i, entry); + if (hashIndex(entry, hash) >= 0) { + entry.last_heard = now; + storeEntry(i, entry); + } +} + +void FloodAdvertLimiter::observe(const uint8_t* key, const uint8_t* hash, uint8_t hops, + uint32_t now, bool previously_seen) { + refresh(now); + size_t index = findIndex(key); + Entry entry; + if (index == _capacity) { + if (previously_seen) return; + uint32_t start = now; + for (size_t i = 0; i < _capacity; ++i) { + EntryTail tail = readTail(i); + if ((tail.flags & ACTIVE) && keyMatches(i, key, PREFIX_BYTES)) { + start = readStamp(i, offsetof(Entry, window_start)); + if (tail.min_hops < hops) hops = tail.min_hops; + break; + } + } + size_t oldest = _capacity; + uint32_t oldest_heard = 0; + for (size_t i = 0; i < _capacity; ++i) { + EntryTail tail = readTail(i); + if (!(tail.flags & ACTIVE)) { index = i; break; } + const uint32_t heard = readStamp(i, offsetof(Entry, last_heard)); + if (!(tail.flags & (BAD | PREVIOUS_OVER)) && tail.count <= allowance(tail.min_hops) + && (oldest == _capacity || uint32_t(now - heard) > uint32_t(now - oldest_heard))) { + oldest = i; + oldest_heard = heard; + } + } + if (index == _capacity) index = oldest; + if (index == _capacity) return; + memset(&entry, 0, sizeof(entry)); + memcpy(entry.key, key, PUB_KEY_SIZE); + entry.window_start = start; + entry.min_hops = hops; + entry.flags = ACTIVE; + } else { + loadEntry(index, entry); + } + entry.last_heard = now; + if (hops < entry.min_hops) entry.min_hops = hops; + storeEntry(index, entry); + for (size_t i = 0; i < _capacity; ++i) { + EntryTail tail = readTail(i); + if ((tail.flags & ACTIVE) && keyMatches(i, key, PREFIX_BYTES) && hops < tail.min_hops) { + tail.min_hops = hops; + writeTail(i, tail); + } + } + loadEntry(index, entry); + if (previously_seen || hashIndex(entry, hash) >= 0 || entry.count == HASH_SLOTS) return; + memcpy(entry.hashes[entry.count++], hash, MAX_HASH_SIZE); + if (entry.count > allowance(entry.min_hops)) { + entry.last_violation = now; + if (entry.flags & PREVIOUS_OVER) entry.flags |= BAD; + } + storeEntry(index, entry); +} + +FloodAdvertLimiter::Decision FloodAdvertLimiter::check(const uint8_t* key, const uint8_t* hash, + uint32_t now) { + refresh(now); + const size_t index = findIndex(key); + if (index == _capacity) return Decision::Capacity; + Entry entry; + loadEntry(index, entry); + const int idx = hashIndex(entry, hash); + if (idx < 0) return Decision::Quota; + if (entry.forwarded & (1U << idx)) return Decision::Duplicate; + if ((entry.flags & (BAD | HAS_FORWARDED)) == (BAD | HAS_FORWARDED) + && uint32_t(now - entry.last_forwarded) < BAD_INTERVAL_MS) return Decision::BadList; + uint8_t hops = entry.min_hops; + unsigned forwarded = 0; + for (size_t i = 0; i < _capacity; ++i) { + EntryTail other = readTail(i); + if (!(other.flags & ACTIVE) || !keyMatches(i, key, PREFIX_BYTES)) continue; + if (other.min_hops < hops) hops = other.min_hops; + for (uint16_t bits = other.forwarded; bits; bits &= bits - 1) ++forwarded; + } + return forwarded < allowance(hops) ? Decision::Allow : Decision::Quota; +} + +void FloodAdvertLimiter::commit(const uint8_t* key, const uint8_t* hash, uint32_t now) { + const size_t i = findIndex(key); + if (i == _capacity) return; + Entry entry; + loadEntry(i, entry); + const int idx = hashIndex(entry, hash); + if (idx < 0) return; + entry.forwarded |= uint16_t(1U << idx); + entry.last_forwarded = now; + entry.flags |= HAS_FORWARDED; + storeEntry(i, entry); +} + +bool FloodAdvertLimiter::isBad(const uint8_t* key, uint32_t now) { + refresh(now); + const size_t i = findIndex(key); + return i != _capacity && (readTail(i).flags & BAD); +} + +size_t FloodAdvertLimiter::listLimited(uint32_t now, size_t offset, LimitedEntry* dest, size_t count) { + refresh(now); + size_t total = 0; + Entry entry; + for (size_t i = 0; i < _capacity; ++i) { + if (!(readTail(i).flags & ACTIVE)) continue; + loadEntry(i, entry); + unsigned forwarded = 0; + uint8_t hops = entry.min_hops; + for (size_t j = 0; j < _capacity; ++j) { + EntryTail other = readTail(j); + if (!(other.flags & ACTIVE) || !keyMatches(j, entry.key, PREFIX_BYTES)) continue; + if (other.min_hops < hops) hops = other.min_hops; + for (uint16_t bits = other.forwarded; bits; bits &= bits - 1) ++forwarded; + } + const uint8_t quota = allowance(hops); + uint8_t reasons = 0; + if (forwarded >= quota) reasons |= WindowQuota; + if (entry.count == HASH_SLOTS) reasons |= ReceiveHistory; + if (entry.flags & BAD) reasons |= BadListRule; + if (!reasons) continue; + if (dest && total >= offset && total - offset < count) { + LimitedEntry& out = dest[total - offset]; + memcpy(out.key, entry.key, PUB_KEY_SIZE); + out.forwarded = forwarded; + out.quota = quota; + out.hops = hops; + out.reasons = reasons; + out.wait_ms = reasons & (WindowQuota | ReceiveHistory) + ? WINDOW_MS - uint32_t(now - entry.window_start) : 0; + out.recovery_ms = 0; + if (reasons & BadListRule) { + out.recovery_ms = RECOVERY_MS - uint32_t(now - entry.last_violation); + if (entry.flags & HAS_FORWARDED) { + const uint32_t bad_wait = BAD_INTERVAL_MS - uint32_t(now - entry.last_forwarded); + if (bad_wait > out.wait_ms) out.wait_ms = bad_wait; + } + } + } + ++total; + } + return total; +} + +} // namespace mesh +#endif diff --git a/src/helpers/FloodAdvertRtcPolicy.h b/src/helpers/FloodAdvertRtcPolicy.h new file mode 100644 index 000000000..8f89be8ba --- /dev/null +++ b/src/helpers/FloodAdvertRtcPolicy.h @@ -0,0 +1,25 @@ +#pragma once + +#ifndef FLOOD_ADVERT_RTC_FAST_SLOTS +#define FLOOD_ADVERT_RTC_FAST_SLOTS 0 +#endif +#ifndef FLOOD_ADVERT_RTC_SLOW_SLOTS +#define FLOOD_ADVERT_RTC_SLOW_SLOTS 0 +#endif +#if FLOOD_ADVERT_RTC_FAST_SLOTS < 0 || FLOOD_ADVERT_RTC_SLOW_SLOTS < 0 +#error "RTC advert-slot counts must not be negative" +#endif + +#if FLOOD_ADVERT_RTC_FAST_SLOTS || FLOOD_ADVERT_RTC_SLOW_SLOTS +#if !defined(ESP32_PLATFORM) || !defined(MESHCORE_EXPANDED_PARTITION_PROFILE) +#error "RTC advert history requires a qualified ESP32 Full recipe" +#endif +#include +#if !defined(CONFIG_IDF_TARGET_ESP32S3) || !CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP +#error "RTC advert history requires byte-accessible retained ESP32-S3 RTC memory" +#endif +#include +#include +#include +#include +#endif diff --git a/src/helpers/PowerSavingDiagnostics.h b/src/helpers/PowerSavingDiagnostics.h index adcc864dd..3f72a9dd8 100644 --- a/src/helpers/PowerSavingDiagnostics.h +++ b/src/helpers/PowerSavingDiagnostics.h @@ -13,7 +13,7 @@ namespace powerdiag { enum class Reason : uint8_t { PolicyOff, Startup, UsbSession, UsbLogging, UsbRecovery, Wireless, Button, Morse, DualRadio, Ota, Calibration, RadioWatchdog, Queue, Retry, Scheduled, - Serial, Bridge, BridgeCleanup, BridgeWake, Network, Mesh, Tracker, Board, + SerialIO, Bridge, BridgeCleanup, BridgeWake, Network, Mesh, Tracker, Board, NoWake, Count }; using Mask = uint32_t; diff --git a/src/helpers/esp32/RoomWebHtmlGzip.h b/src/helpers/esp32/RoomWebHtmlGzip.h new file mode 100644 index 000000000..86069b48b --- /dev/null +++ b/src/helpers/esp32/RoomWebHtmlGzip.h @@ -0,0 +1,988 @@ +// Auto-generated by scripts/generate_room_web_html.py; DO NOT EDIT. +// Lossless gzip of RoomWebHtml.h, decoded by the browser. +// room-page-source-sha256: d481a1710a5983318a38dfca654fd490e727c71f4406552acf62317422985894 +#pragma once +#include +#include + +static const uint8_t ROOM_WEB_HTML_GZ[] PROGMEM = { + 0x1f,0x8b,0x08,0x00,0x00,0x00,0x00,0x00,0x02,0xff,0xa4,0x57,0x67,0x9b,0xea,0xba, + 0x11,0xfe,0xbe,0xbf,0x42,0xd7,0x9b,0x72,0x0a,0x66,0x81,0xed,0x06,0x6e,0xbf,0xe7, + 0x53,0x7a,0xef,0x89,0x6c,0x8d,0xb1,0xb2,0xb2,0xe4,0x47,0x92,0x61,0x09,0x0f,0xff, + 0x3d,0x23,0xc9,0x32,0x5e,0x6f,0x49,0xb9,0xed,0x00,0x23,0xcd,0xcc,0xab,0x77,0xea, + 0x59,0x7d,0xc6,0x54,0x61,0xf7,0x0d,0x90,0xca,0xd6,0xe2,0xf3,0xb3,0x95,0xfb,0x20, + 0x82,0xca,0xcd,0x3a,0x01,0x99,0x7c,0xbe,0xaa,0x80,0xb2,0xcf,0x57,0x35,0x58,0x4a, + 0x8a,0x8a,0x6a,0x03,0x76,0x9d,0xb4,0xb6,0x4c,0xef,0x92,0x4e,0x2a,0x69,0x0d,0xeb, + 0x64,0xcb,0x61,0xd7,0x28,0x6d,0x13,0x52,0x28,0x69,0x41,0xe2,0xad,0x1d,0x67,0xb6, + 0x5a,0x33,0xd8,0xf2,0x02,0x52,0xff,0x63,0xc2,0x25,0xb7,0x9c,0x8a,0xd4,0x14,0x54, + 0xc0,0x7a,0x9e,0xa0,0x3f,0xcb,0xad,0x80,0xcf,0x7f,0x0a,0xa6,0xfa,0x46,0x69,0x20, + 0xbf,0x52,0xaa,0x5e,0x5d,0x04,0xe1,0xca,0xd8,0x3d,0x7e,0x9c,0x65,0x5a,0x29,0x7b, + 0x28,0x94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0xd2,0xd0,0x0d,0x10,0x2a,0x8c,0x22,0x3b,0xa5,0x1f,0x0c,0xd9,0x71, + 0x5b,0xa9,0xd6,0x12,0xdf,0x74,0x25,0x58,0x42,0x7d,0x2e,0x4e,0x57,0x17,0x0d,0x7a, + 0x77,0x4f,0xf5,0x28,0xff,0xa9,0xb8,0xdb,0x8b,0x7c,0xf8,0x08,0x4a,0xd7,0x49,0x83, + 0xa8,0xd0,0x04,0x42,0x72,0x68,0x49,0xfc,0x49,0xde,0x09,0xa0,0x5b,0x20,0x50,0x37, + 0x76,0xef,0x6e,0x92,0xa6,0xcd,0x05,0x2f,0x88,0x06,0xca,0x52,0x25,0xc5,0xbe,0xf3, + 0xf0,0x7e,0x75,0xe1,0xad,0xa1,0x17,0x1f,0x77,0xef,0xa6,0x37,0x4a,0xdc,0x76,0x36, + 0xfc,0xed,0xf2,0xa1,0x50,0x98,0xfc,0x60,0x51,0x5e,0xb4,0x5a,0x03,0x06,0xef,0x74, + 0x8e,0xe9,0x2a,0x40,0x6e,0x6c,0xb5,0x4e,0x6e,0xae,0x70,0xc5,0x1a,0x42,0x0d,0xec, + 0xfe,0x51,0xb5,0x9a,0x74,0x99,0x47,0x9c,0x28,0x02,0x18,0xf8,0x77,0xe2,0xb1,0x2f, + 0xc9,0x8b,0x87,0x20,0xdf,0x52,0xd1,0xa2,0xe0,0xf7,0x90,0x3b,0x07,0x61,0x39,0xe8, + 0x80,0x9a,0x36,0xaf,0xb9,0xc5,0xf0,0x28,0x29,0xa1,0xb0,0xab,0x8b,0x70,0x8a,0x31, + 0x77,0x14,0xfa,0x38,0x3a,0xfb,0x7e,0xf6,0x27,0x44,0x2b,0x81,0x3a,0x54,0x80,0x46, + 0x15,0xc7,0x74,0x77,0x6c,0x2c,0xb5,0x90,0x3c,0x89,0x78,0xbc,0xec,0x8e,0x5a,0xe3, + 0x6f,0xa3,0x35,0x83,0x3e,0xb8,0x92,0x7d,0x02,0x25,0x24,0x4c,0xc0,0x68,0xc8,0x2f, + 0x0e,0xf1,0x72,0x37,0x76,0x3f,0x5f,0x75,0x93,0xf6,0xf3,0xaf,0x7c,0x00,0x7c,0xda, + 0x54,0xdc,0x58,0xa5,0xf7,0xab,0x8b,0x78,0xd6,0x19,0xe8,0xe4,0xd1,0x44,0x13,0xd8, + 0xcb,0xb5,0xda,0x19,0xd0,0x78,0x03,0xa4,0xe5,0x5d,0x7c,0x9d,0x7f,0x52,0x2b,0x06, + 0x9a,0x3a,0x4c,0x19,0x59,0xb9,0xd1,0xed,0xad,0xec,0x20,0x4f,0x1f,0xc0,0x5b,0x71, + 0xb2,0x68,0x6c,0x94,0xd2,0x3e,0x2f,0x9f,0x99,0x46,0x99,0x81,0x86,0xa2,0x51,0x20, + 0xa5,0x46,0x17,0x94,0xb8,0xe2,0x56,0x3f,0x36,0x31,0xa3,0xd0,0xb2,0x4b,0x6a,0x38, + 0xe5,0x9e,0xb1,0x74,0x6f,0x08,0x97,0xa4,0x86,0x5a,0xe9,0x00,0xcf,0x56,0xde,0x92, + 0x31,0x88,0x6d,0xea,0xb9,0xbe,0x88,0x84,0x84,0x18,0x46,0x1a,0xa1,0xd4,0x60,0xaa, + 0x98,0x79,0xe1,0x04,0x93,0x3b,0x88,0x49,0x51,0xd1,0x53,0x54,0x87,0x7a,0x8c,0x9b, + 0x22,0x04,0x7d,0xac,0xfa,0x6d,0x3c,0x19,0x28,0x32,0xbe,0x0d,0x89,0xae,0x8c,0x35, + 0x09,0xa1,0x9a,0xd3,0x54,0xf0,0x2d,0x38,0x89,0xe0,0x16,0x1c,0x55,0x78,0xe7,0x14, + 0x35,0x7f,0xbb,0x23,0x27,0x2d,0xa8,0x2d,0xaa,0xb6,0x49,0x4e,0xa1,0xfc,0xa6,0x52, + 0xca,0x80,0x47,0x47,0x4c,0xa5,0x76,0xd2,0xbd,0xde,0x0e,0x08,0x3d,0x45,0xf6,0x39, + 0xf1,0x9f,0xb8,0xb0,0xe0,0x18,0x02,0x1f,0x44,0x64,0x56,0x3b,0xa7,0x12,0xfa,0xbc, + 0x18,0x5b,0x0b,0x4d,0xc4,0xb9,0x93,0x1b,0x30,0xc4,0x97,0xf3,0x5e,0xb5,0xb1,0xd1, + 0x6c,0x39,0xec,0x7c,0x5a,0x31,0x05,0xc6,0x75,0x22,0xc2,0xc0,0x15,0x51,0x6f,0x4e, + 0xe9,0x4e,0x77,0x10,0x4d,0x06,0x8e,0x00,0x3c,0x0c,0x0b,0xe0,0xb8,0xf3,0x8c,0xde, + 0x9e,0xba,0x83,0xbe,0x44,0x5c,0x3f,0x4e,0x3c,0xab,0xc3,0xde,0xd4,0xeb,0x98,0x07, + 0xde,0xa4,0x8c,0x3a,0x5a,0x7f,0x8d,0xe4,0x90,0x1a,0x8c,0xa1,0x0e,0xb8,0x4f,0x28, + 0xff,0x30,0x77,0xea,0x21,0x5b,0x5e,0x03,0x79,0xe7,0xdf,0xe1,0xbf,0xbf,0x7f,0xde, + 0x1e,0x9e,0xdb,0x8d,0x21,0x77,0xdf,0x9d,0x52,0xea,0xf5,0x93,0x98,0x20,0xcf,0x95, + 0x72,0x40,0x80,0x30,0xce,0x14,0x0f,0xce,0x63,0x72,0x86,0x62,0xb6,0xc4,0x54,0x78, + 0xfb,0x79,0x85,0x6a,0xa5,0x0d,0x26,0x7c,0x24,0x25,0xec,0xc0,0x58,0x22,0xdb,0x3a, + 0x07,0x4d,0x54,0xd9,0xc7,0xb4,0x7f,0xfd,0x9b,0x0f,0x8b,0x16,0x23,0xc4,0x60,0x27, + 0x21,0x35,0x97,0xeb,0x64,0xee,0xfb,0xec,0x3a,0xb9,0x5c,0xf4,0xcd,0x70,0x3e,0x7b, + 0xe3,0xb5,0x51,0xf9,0xf9,0x6b,0x23,0xcc,0x88,0x69,0xf4,0xe6,0x51,0xdb,0x1c,0xe7, + 0x80,0x06,0xd3,0x0a,0xfb,0x76,0xa3,0x1c,0x97,0x7a,0x9f,0x50,0xae,0xb3,0x2b,0x03, + 0x4f,0xa7,0x59,0xc0,0xe1,0x67,0xb0,0xff,0xd2,0x73,0x14,0xff,0x1e,0xe9,0x55,0xe3, + 0x2d,0x34,0x1c,0xe5,0x27,0x8c,0x2d,0xdb,0xc0,0x18,0x93,0x47,0x31,0xa4,0xc7,0x80, + 0x64,0xc9,0x68,0x66,0xfc,0x1a,0x65,0xe3,0x81,0xd1,0xb7,0xf8,0x68,0xcf,0x6f,0x17, + 0xb1,0x61,0x38,0x68,0x02,0x58,0xbe,0x5f,0x27,0x7e,0xf5,0xa8,0x80,0xba,0xe5,0x06, + 0xdd,0x55,0x0b,0x74,0x33,0x96,0xfe,0x62,0xb8,0x2d,0xe4,0xea,0x11,0x57,0x8b,0xc5, + 0x0b,0xed,0xe0,0xa7,0x78,0x4a,0x76,0x94,0x5b,0x43,0x54,0x28,0xfb,0xd0,0xdb,0x5b, + 0x69,0xb9,0x70,0x65,0x4e,0x0a,0x85,0x6e,0x0b,0x4b,0xb8,0x9d,0x92,0xe1,0x40,0x88, + 0x86,0x49,0x6b,0xc0,0x10,0x6f,0x60,0x27,0xfb,0x56,0x3e,0x19,0x35,0x72,0xdf,0x30, + 0x7c,0xf5,0x77,0xb5,0xde,0x9c,0x30,0x77,0xcd,0xaa,0xa7,0x31,0x6c,0x33,0xfd,0x78, + 0x0b,0xf7,0x23,0x9f,0x51,0x49,0x35,0x20,0xc7,0x49,0xf6,0x73,0x94,0x91,0x7a,0x1f, + 0x91,0x45,0x7e,0x47,0xb3,0xf3,0xb4,0xb8,0xf5,0x2e,0xe2,0xac,0x8b,0x0b,0x40,0xff, + 0x36,0xca,0x98,0x06,0x63,0xe2,0x7c,0xeb,0xd5,0x1f,0xe0,0x04,0x77,0x38,0xec,0xc8, + 0x33,0x9c,0x85,0x6a,0xf6,0x63,0x9c,0xdf,0xa0,0x2c,0x9a,0xee,0x41,0x3e,0xa7,0xc5, + 0x52,0x0b,0x63,0x52,0x9e,0x27,0x7c,0xe8,0x15,0xa3,0xe6,0x18,0x12,0xbf,0x7f,0xac, + 0x12,0xbc,0x70,0x20,0xe3,0x82,0x8b,0x65,0x00,0x1b,0x90,0xec,0xf3,0xdf,0x57,0x8a, + 0x14,0x54,0x12,0x97,0xa2,0x3e,0xda,0xee,0xfe,0xea,0xa2,0x3b,0x1d,0x2e,0x54,0xc1, + 0x52,0xad,0x98,0xab,0x97,0xc8,0x8e,0xdf,0x29,0xfa,0xb2,0x09,0xeb,0x68,0x74,0x1b, + 0x2f,0xaf,0x54,0xe3,0xa8,0x8f,0xbd,0xa3,0x10,0xca,0xf8,0x9d,0xd6,0x7f,0x92,0x94, + 0x68,0x28,0x80,0x6f,0x81,0x48,0xe5,0xfa,0x43,0x07,0x20,0xe8,0x8c,0x75,0xc3,0x0e, + 0x80,0xb9,0xed,0x3f,0x49,0x1a,0x52,0x75,0xa7,0xb9,0x05,0x6d,0x50,0x73,0xef,0xdf, + 0xf1,0xaa,0xb6,0xe6,0x5b,0x6a,0x01,0xd5,0xc3,0x17,0xd4,0xa7,0x4d,0xa3,0xd5,0x16, + 0x98,0xd7,0x03,0x1d,0x86,0xdb,0x49,0xff,0x22,0xbc,0xe8,0x05,0x1e,0xa8,0x10,0x6a, + 0x27,0xb8,0xc1,0x4a,0xfe,0xea,0xa9,0x8d,0x18,0x57,0x30,0xe4,0x5d,0xdb,0x10,0xab, + 0xc8,0x5d,0x9f,0x56,0x83,0x25,0xc6,0x4c,0xd0,0x17,0x0a,0x50,0x41,0x70,0x09,0xef, + 0x5f,0xec,0x3d,0x63,0x5f,0xc3,0x8c,0x23,0xa6,0x01,0x21,0x8a,0x0a,0x8a,0x87,0x75, + 0x52,0x52,0x61,0x9e,0xed,0xb0,0xaa,0x2c,0x47,0x4d,0xcb,0xbb,0x88,0x46,0xc2,0xdf, + 0xbf,0x92,0x7e,0x22,0xf4,0x85,0x25,0x45,0x9f,0xb0,0xde,0x3c,0x46,0x3a,0xf9,0x9c, + 0xc4,0x98,0xbb,0xe3,0x8c,0x34,0xb4,0x35,0xe0,0xfd,0xd5,0xd4,0xf2,0x22,0xec,0x22, + 0x4c,0xed,0xa4,0x50,0xf4,0xdf,0xbc,0x5b,0x87,0x92,0xdb,0x48,0x0e,0xfd,0x95,0xbe, + 0xec,0xa4,0xc9,0x33,0x9b,0xc3,0x84,0xcb,0xd9,0xe1,0x03,0x38,0x23,0xda,0x62,0x15, + 0x2d,0xf1,0x48,0xc9,0x65,0xff,0xfd,0x01,0xaf,0xf9,0x4a,0x58,0x82,0x10,0xa5,0x72, + 0xb8,0xb0,0xe2,0x74,0x40,0x27,0xa0,0xf1,0xf0,0x1a,0x3b,0xa7,0x46,0xb8,0xeb,0x26, + 0xf3,0x45,0xb2,0x65,0x29,0x6b,0x01,0xcd,0x4c,0x70,0x1f,0xdc,0x58,0xcf,0xab,0x1d, + 0xa5,0xe7,0xf9,0x16,0x43,0x7d,0xd2,0xd8,0x02,0x37,0x4c,0xfa,0xdf,0xa6,0xdc,0x94, + 0xf3,0xef,0x94,0x78,0x7d,0x5d,0x89,0x82,0x43,0x75,0x1a,0x09,0x5f,0x5e,0xaf,0x75, + 0xe3,0xb7,0xfb,0xcc,0x99,0xe8,0xf6,0xb7,0xe5,0x5b,0x39,0x1e,0xe9,0x4e,0x00,0x50, + 0xca,0x49,0xb5,0x02,0x3e,0x8e,0xc6,0x2e,0x16,0x1a,0xcb,0xac,0x93,0x41,0xdd,0xa5, + 0x2d,0x65,0x9c,0xb3,0x08,0x59,0xaf,0x65,0x8e,0xc6,0x80,0x03,0x49,0x6d,0xa9,0x53, + 0x71,0x18,0x13,0xa5,0x23,0x52,0x1a,0x27,0x80,0x9e,0x6f,0xcc,0xd7,0x6d,0x2d,0xba, + 0xf7,0x21,0x03,0xd3,0xa7,0xe3,0xf3,0xb6,0x0f,0x17,0x64,0x82,0x4a,0x6b,0xf8,0x4e, + 0xdf,0x65,0xa7,0xab,0xa6,0x2a,0x15,0x74,0x3c,0xe7,0xe7,0x1f,0xba,0xe8,0xbe,0xf4, + 0x68,0xc3,0x89,0xb1,0xaa,0x3c,0x88,0xe3,0xf6,0xd4,0x6c,0x6f,0x94,0xaa,0xe9,0x74, + 0xe6,0x25,0xad,0xef,0xf2,0xf4,0x2c,0xbd,0x7a,0xf9,0xa7,0xd9,0xd7,0xe9,0xfe,0xc3, + 0xba,0xec,0x42,0x43,0x63,0x7f,0x6b,0x31,0xf6,0x2c,0x62,0x57,0xef,0x55,0x28,0x72, + 0xf8,0xd8,0x26,0x77,0xd2,0xec,0x71,0xd0,0x39,0x13,0x26,0x2e,0xce,0x7f,0xfc,0xeb, + 0x32,0xbb,0xf7,0x73,0xaf,0x81,0x41,0x7c,0x73,0xab,0x7b,0x0b,0x00,0xdc,0x37,0x48, + 0x55,0x96,0xe1,0x67,0x46,0x60,0x38,0xe1,0x76,0xb6,0x1c,0xa3,0x54,0xe2,0x0f,0xf9, + 0xc9,0xcc,0xc7,0xba,0xd5,0xcf,0x24,0x61,0x11,0x6e,0x94,0x55,0x9d,0xf7,0x42,0xa3, + 0x94,0xf5,0x62,0xac,0x6a,0x3d,0x5a,0xf1,0x1c,0xb6,0x3e,0x5a,0xc7,0x23,0xcf,0x75, + 0xc7,0x3a,0xe0,0x31,0x07,0x57,0xde,0xc5,0xec,0x87,0x20,0x17,0x9d,0x3d,0x8a,0xe5, + 0x17,0x33,0xb5,0x90,0xdb,0x5d,0x8e,0xce,0xa6,0x5b,0x79,0xe5,0x59,0x6d,0xba,0xc1, + 0x96,0x26,0x3e,0x17,0x88,0x73,0xc9,0x0d,0x06,0x67,0x3d,0x94,0xb3,0x14,0x1d,0x0b, + 0x65,0xfc,0x4b,0x2a,0x07,0xfd,0x85,0xf2,0xb4,0xb3,0x90,0xd5,0x7a,0x55,0xd4,0x36, + 0x5c,0x8c,0x47,0x3c,0x24,0x8b,0xb6,0xa0,0x47,0x34,0xe6,0x45,0x2e,0xa4,0x66,0xaa, + 0x0e,0x35,0xbe,0xcb,0x4c,0x9f,0xbf,0xac,0xc9,0x92,0xc0,0x68,0x0d,0x24,0x92,0x2d, + 0xf5,0x10,0x4e,0x49,0x30,0x59,0xe1,0x01,0xcf,0x17,0x10,0xdd,0x96,0xbf,0x84,0x42, + 0xca,0x23,0x11,0x0f,0x79,0x4d,0x1c,0x51,0x7b,0x81,0x94,0x2e,0xe0,0x52,0xa7,0xa2, + 0xc1,0x28,0x6a,0xb7,0x3e,0x22,0x3e,0x23,0xa1,0x77,0xc3,0x23,0xba,0xb5,0x2e,0x48, + 0xbd,0x3f,0xac,0x09,0xae,0x26,0x16,0x98,0x03,0x63,0x47,0x19,0xa0,0x14,0xd8,0x7b, + 0x70,0xe8,0xc7,0x38,0xc4,0xe0,0x4b,0x6c,0xff,0x4c,0x6c,0x5f,0x6f,0x83,0x02,0x27, + 0x7d,0xbf,0x2a,0xda,0x39,0x60,0xfe,0x08,0xc5,0x31,0x43,0x6d,0x40,0x74,0x90,0x3f, + 0x34,0x80,0x99,0x9c,0x45,0x5f,0x43,0x8a,0x42,0x74,0x06,0xc5,0xfd,0x13,0xd3,0x0c, + 0xcf,0x97,0x06,0xa9,0x43,0x81,0xda,0xd2,0xb4,0xb1,0xb5,0x52,0x33,0xd0,0xcc,0x72, + 0x5e,0x09,0x47,0x60,0x55,0x32,0x83,0xbb,0x6e,0xa1,0x27,0xa5,0xb5,0xa9,0xe8,0x67, + 0xa7,0xc2,0x0d,0xb0,0x6d,0x72,0xb3,0x81,0x1f,0xe0,0xbc,0x14,0x04,0x5f,0xe7,0xef, + 0xd4,0xd5,0xc2,0x49,0x3c,0x3a,0x9d,0x7d,0xfd,0xd8,0x23,0x55,0xdb,0x43,0x45,0xf5, + 0xc8,0xef,0x74,0x88,0x21,0x7f,0x3c,0x73,0x25,0xe7,0xae,0xe4,0xc2,0x95,0x5c,0xba, + 0x92,0x2b,0x57,0xf2,0x95,0x2b,0xf9,0x7a,0x02,0x81,0x62,0xd3,0x85,0x42,0xd3,0x1f, + 0xba,0xb9,0xab,0x73,0xe7,0xe5,0x06,0x0e,0x18,0xbd,0x06,0xdb,0x05,0x9b,0xe5,0x46, + 0x51,0xd4,0xd9,0xb3,0x93,0x8b,0xaf,0x27,0x7d,0x26,0x3b,0x5b,0x80,0x49,0xbd,0xf3, + 0xa8,0x89,0x67,0x38,0x66,0x1a,0xbb,0xac,0x62,0x48,0x71,0x0f,0x43,0x66,0x6b,0x0e, + 0x56,0xaf,0x8a,0xb9,0x70,0x17,0x0c,0xf2,0x6c,0x34,0x6d,0x54,0xed,0x2c,0x93,0xd8, + 0x68,0x2a,0xe8,0x3a,0x33,0x99,0x61,0x98,0xbc,0x54,0x4c,0x81,0x00,0x56,0x03,0xde, + 0xb6,0x7b,0xa6,0x48,0xb2,0xca,0x4c,0xe8,0x4c,0x5e,0x90,0xb4,0x50,0xfe,0x90,0xe6, + 0x52,0xa5,0x97,0x01,0x20,0x31,0x79,0xae,0xa3,0x74,0x2d,0x93,0x7b,0x27,0x81,0x31, + 0xea,0x58,0x9c,0x48,0xf8,0xc9,0xfe,0xa5,0xe2,0x9d,0x7c,0xea,0xed,0x02,0x8c,0x0d, + 0x92,0x3e,0x4f,0xce,0xd2,0xf3,0x96,0x23,0xe4,0x32,0xf5,0xd2,0x30,0xf4,0x20,0x91, + 0xba,0xdc,0x6f,0x32,0x4f,0x33,0x9e,0xa5,0x7c,0xdd,0x0a,0x9f,0x97,0x20,0xf2,0x08, + 0xe4,0x00,0x3d,0xab,0x32,0x77,0x07,0x06,0xe8,0x8e,0x12,0x03,0xa7,0x9e,0x12,0x49, + 0xa2,0x01,0x68,0xe2,0x27,0xbf,0x5e,0x71,0x7b,0x88,0xf8,0x30,0x7d,0x9e,0xfb,0x60, + 0xf2,0x11,0x4e,0xf9,0x87,0x22,0xe4,0xb7,0x76,0x39,0x0e,0x27,0x1b,0x21,0xa1,0x7f, + 0xb0,0x2a,0x6f,0x3b,0x40,0x22,0xcf,0x96,0xe4,0x64,0x5a,0x39,0x86,0x43,0xac,0x00, + 0xfc,0xc6,0x48,0x18,0xe7,0xed,0xcc,0x0f,0xf0,0xf1,0x50,0x37,0xd8,0x35,0xf5,0x5e, + 0x1c,0x63,0xc7,0xc6,0xdd,0x7b,0xae,0x21,0x8c,0xcb,0x24,0x02,0x67,0x63,0x25,0xd6, + 0x5b,0x5d,0x35,0x42,0xb5,0xa3,0x04,0x33,0xd6,0x6d,0x80,0x6a,0xe0,0x88,0x1f,0xc4, + 0xea,0xe1,0xb9,0x4a,0x0e,0x76,0xf4,0x91,0xc8,0xf0,0x96,0x5b,0x8c,0x65,0x71,0x2a, + 0xa3,0xa0,0x4f,0x1e,0x34,0x82,0x2a,0x58,0x40,0x50,0xb1,0x9c,0xc0,0x89,0xdc,0xdf, + 0x8f,0x46,0x8b,0x94,0x73,0x08,0x66,0xe4,0x2e,0x1a,0x4f,0x1c,0x88,0x9c,0x86,0x8f, + 0x5e,0x14,0x31,0x24,0x05,0xed,0x89,0x24,0xe1,0x72,0x5d,0x37,0xe8,0x00,0x2f,0xd3, + 0xd1,0xe0,0x92,0xc0,0xd2,0x5e,0x28,0x1f,0x18,0x61,0x7a,0xf3,0xf5,0x94,0x9a,0xaa, + 0x92,0xb7,0xdc,0x83,0x68,0x28,0x76,0xd9,0x8f,0x8c,0xda,0x8f,0x76,0xda,0x97,0x5e, + 0x0a,0x9d,0xb8,0x5b,0x4d,0x4c,0x26,0x7d,0x3c,0x87,0xc4,0x81,0xbe,0x30,0x93,0xc4, + 0x41,0xf7,0xe3,0x93,0x38,0xf1,0x40,0xd9,0x43,0x2a,0x86,0xe0,0x80,0xca,0x35,0x61, + 0x34,0x13,0x44,0xcc,0x41,0xb2,0x90,0x6b,0x33,0x14,0x75,0xa3,0x85,0xf9,0xea,0x62, + 0xff,0xe0,0xd0,0x19,0x0b,0x00,0x76,0x92,0xb1,0xf8,0xeb,0x9d,0x1e,0x75,0xae,0x08, + 0x1c,0x8b,0xeb,0xbc,0xeb,0xc5,0xe6,0xe2,0xec,0x9b,0x8b,0x6f,0xae,0xbe,0x3a,0xfb, + 0xe6,0x32,0xb8,0x9a,0x82,0x88,0x84,0x58,0x80,0x6e,0x1e,0x8d,0x44,0x93,0xa7,0xf6, + 0xa4,0xd9,0xb4,0x6f,0x22,0x59,0x20,0x18,0x12,0x5a,0xc4,0x2e,0xfc,0x50,0x06,0x24, + 0x23,0xa1,0x3d,0xef,0xe2,0x9d,0x20,0x63,0xd3,0x79,0xa8,0xc4,0x59,0x06,0x07,0xa1, + 0xcd,0x46,0xf4,0x9a,0x21,0x55,0x09,0x7c,0x77,0x7a,0x29,0x8a,0x25,0x74,0xe5,0x96, + 0x13,0xe5,0xad,0x6a,0xd7,0x3e,0x82,0x5c,0x06,0x77,0xb2,0x9d,0xa5,0xe8,0xc8,0x7d, + 0x29,0x59,0x2e,0x5b,0x5f,0x6b,0x44,0x69,0x5e,0xd8,0xb6,0x33,0xfe,0xe2,0x2d,0xcd, + 0xa1,0x77,0x7b,0x67,0x23,0x4b,0x87,0x33,0xbd,0x63,0xaf,0xfd,0x4a,0x1a,0x1e,0xea, + 0xa3,0x89,0x87,0x47,0x2b,0x5f,0x2d,0x35,0xe2,0x4f,0x7c,0xc5,0x1c,0x6d,0x73,0xc7, + 0x83,0xfa,0x18,0x47,0x8f,0x35,0x7e,0x0a,0x47,0xbf,0xbf,0x8f,0xc7,0xae,0xc6,0xa6, + 0x34,0xed,0xda,0x29,0x21,0x70,0xeb,0x87,0x70,0x43,0xec,0xb4,0x9b,0x1c,0x32,0x61, + 0x0f,0x29,0x22,0xdf,0x33,0xf0,0xdf,0x5c,0x9e,0x6f,0x6f,0xcd,0x31,0xbe,0x8e,0x31, + 0xaa,0x49,0xa5,0xa8,0x8d,0xa8,0xde,0xfe,0xc1,0x4d,0xd4,0xe1,0x33,0x98,0xe9,0x20, + 0xd1,0x59,0x53,0xac,0x17,0x63,0x64,0xb8,0x38,0x6d,0x8d,0x8b,0x72,0x04,0x97,0x1e, + 0xf5,0x2d,0x1f,0x8f,0x30,0xe2,0x46,0x58,0x0f,0x2a,0x9e,0xa3,0x8f,0x7e,0x7b,0x0c, + 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50,0x22,0x0c,0x1d,0xff,0xd0,0xc1, + 0xf7,0x1f,0xa5,0x6c,0x90,0x48,0xc4,0x18,0xa8,0x72,0x02,0x76,0x57,0x69,0xad,0x4c, + 0xaf,0x2f,0x43,0x1a,0x1a,0xe8,0x25,0xdb,0xd3,0x6d,0x01,0xdd,0x47,0xa7,0x95,0x83, + 0x73,0xff,0x4e,0x40,0x8f,0x6b,0x5f,0x75,0x28,0x9d,0xcf,0x2b,0x55,0x85,0xa2,0x46, + 0xcb,0x67,0x58,0x49,0x81,0xfe,0x96,0xc2,0xc2,0xa3,0x2c,0x13,0xb8,0x9c,0xe9,0xcc, + 0xdf,0x15,0xcb,0x87,0x4c,0x6e,0x73,0xa9,0x20,0xc6,0x90,0xd5,0x33,0xdb,0x34,0x26, + 0x20,0xe4,0x29,0xf4,0x09,0xd3,0x72,0x9c,0x92,0x4e,0xd4,0x98,0x1c,0x26,0xe5,0xd7, + 0x8b,0x0a,0xd9,0x6e,0x38,0x02,0x26,0x98,0xc9,0x01,0x0b,0x5b,0x56,0xd7,0x32,0xc1, + 0x54,0xaf,0x64,0x63,0x5b,0x01,0x48,0x9c,0xa0,0x52,0xf3,0x32,0x34,0x00,0x05,0x86, + 0x1e,0x1c,0xd9,0xbf,0x65,0x4f,0x5a,0xe2,0xbf,0xb6,0x94,0x96,0xf9,0x70,0xe6,0x03, + 0x2a,0x23,0x4a,0x3c,0xa3,0x8e,0xdb,0xb4,0x33,0xf9,0xcc,0x43,0xe5,0xcc,0xaf,0xc3, + 0x93,0xce,0x28,0xf3,0x90,0x94,0x33,0xd3,0x05,0xc3,0x46,0x48,0x1c,0xf3,0xd0,0x66, + 0xc3,0xf4,0xab,0x78,0x5d,0xcc,0x37,0xfb,0x7b,0x59,0x36,0xa3,0xf9,0x66,0xdc,0x5f, + 0x97,0x76,0x96,0x1e,0x9d,0x60,0xac,0x4e,0xf5,0x37,0x5e,0xe8,0x44,0x0a,0xda,0xc9, + 0x64,0x0a,0x9a,0x95,0xc3,0xae,0xa3,0xab,0xc7,0x9d,0x32,0xcb,0xd3,0x1b,0xdd,0x06, + 0xfe,0x93,0xaa,0x3c,0xa2,0xd5,0xc0,0xbb,0xb4,0x66,0x39,0x51,0x93,0x08,0x4b,0x75, + 0x0e,0x18,0x36,0xdc,0x50,0x73,0x76,0x45,0xe2,0x14,0x74,0x63,0x24,0xb8,0x3f,0x4a, + 0x88,0x26,0xc5,0x10,0x72,0xe6,0xb6,0xa8,0x7a,0x03,0xb3,0x2c,0xdf,0x8b,0xda,0x6b, + 0x31,0x6c,0x80,0x49,0xae,0xe9,0x3f,0x7d,0x3e,0xec,0xec,0xbe,0xe8,0x38,0x04,0x2d, + 0xc6,0x67,0xd5,0x66,0x9f,0x7f,0x7d,0xfb,0x8f,0x7c,0xf1,0x04,0x2c,0x69,0x16,0x32, + 0xd3,0x26,0x9c,0xba,0x7e,0x7b,0x3f,0xe6,0x3b,0x78,0x57,0x76,0xa2,0x67,0x80,0x54, + 0x8c,0xce,0x6c,0x42,0xe4,0xa7,0x4e,0xf9,0x5e,0x27,0xf4,0x40,0xd4,0xe6,0x2c,0xb7, + 0xc1,0x11,0x20,0x09,0x28,0x6a,0x78,0x2e,0xe1,0x86,0xce,0xcf,0x3b,0x37,0xaa,0x90, + 0x5b,0x82,0xce,0x31,0x50,0x21,0xb4,0x60,0x3e,0x6c,0x0c,0xe4,0xe5,0x20,0x2c,0xae, + 0x1e,0x63,0x0a,0x02,0x90,0x6b,0x75,0xcf,0x42,0xed,0x38,0x3a,0xb6,0xcf,0x20,0x2e, + 0xf3,0x1b,0xaf,0x1c,0xcc,0x33,0xc1,0x66,0x81,0xbc,0x28,0xe7,0x4c,0xd6,0xab,0x94, + 0x24,0x64,0x6b,0xbf,0x0e,0x76,0x05,0xdf,0x3c,0x1a,0x3d,0xb7,0x76,0x84,0x20,0xeb, + 0x6e,0x20,0x6b,0xf0,0x18,0x33,0x09,0xdd,0x99,0xdc,0xee,0x74,0x14,0x15,0x84,0x23, + 0x58,0x2a,0x4a,0x48,0x9c,0x9d,0x5e,0x9e,0x4e,0x3f,0x65,0x79,0x51,0x96,0xee,0xda, + 0x05,0x36,0xd0,0xc5,0xe7,0x71,0xca,0x72,0x42,0xde,0xa0,0xf7,0x5a,0xb3,0x72,0x89, + 0x90,0x6e,0x84,0x42,0x18,0x5e,0xb3,0xe7,0x67,0xd9,0x9b,0x20,0x7f,0x5c,0xd4,0xaf, + 0x5d,0xc1,0xb2,0xef,0x57,0xab,0x75,0x17,0x52,0x67,0x1c,0x67,0x54,0x93,0x31,0xf7, + 0xbe,0x01,0x0f,0x6e,0xea,0x71,0xe0,0xe5,0x06,0x6e,0x39,0x5f,0x58,0x82,0xd2,0xe4, + 0x92,0x2a,0x1b,0x40,0x8a,0xed,0x95,0x54,0xb4,0x0f,0x0b,0x71,0xba,0xdf,0xa5,0x6a, + 0xbd,0x05,0x3f,0x65,0x2b,0x37,0x12,0x3d,0x02,0x9e,0x81,0x22,0x6a,0x59,0x6f,0xa8, + 0x6e,0xec,0x90,0x75,0xe5,0x52,0x0b,0x76,0x15,0x9b,0xd0,0xf4,0x3e,0x1b,0x1f,0xd2, + 0x02,0xb0,0xfc,0xc4,0x02,0x1d,0x99,0x64,0x5d,0xc9,0x41,0x79,0xa7,0xe3,0x85,0xee, + 0xf2,0x39,0x57,0x97,0x97,0xe7,0x97,0xe3,0x73,0xaa,0x6b,0xce,0x49,0x3e,0x3f,0x7e, + 0x4e,0x14,0xba,0xff,0x9c,0x62,0xbd,0x54,0x11,0x79,0xac,0x6e,0xa0,0x9d,0x74,0x70, + 0xcd,0x98,0x55,0xee,0x75,0xc3,0x38,0x7f,0x48,0xde,0x53,0x96,0xbf,0xc4,0xd5,0x62, + 0x53,0xf1,0x98,0x10,0x1c,0xc4,0x4a,0xbc,0x28,0xc1,0x18,0x3c,0x1f,0x3c,0xc0,0xd1, + 0x1d,0x52,0x46,0x7a,0x74,0x75,0x91,0x16,0xe5,0xfb,0x62,0x2e,0xaf,0x8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0x60,0xf8,0xa5,0x2f,0x3f,0xf1,0x02,0xcf,0xaa,0xd9,0xa5, + 0xa1,0xb9,0xd4,0x11,0x2e,0x23,0x08,0x68,0xdf,0x04,0x05,0x0b,0xb6,0xf6,0xb1,0x2d, + 0x2c,0x1b,0x65,0x26,0x2c,0x14,0x42,0x08,0x96,0xd6,0x1b,0x28,0x8b,0xb2,0xda,0xc6, + 0xe0,0xd0,0x32,0xff,0xd7,0x4a,0xa5,0xfd,0x37,0x31,0xa4,0xec,0xcb,0x74,0x83,0xa4, + 0x06,0xb6,0x71,0xf5,0xca,0x56,0x81,0xc8,0x9a,0xd3,0xdb,0x9a,0x20,0x8f,0xbe,0x5b, + 0x79,0xba,0x34,0x17,0xf9,0xea,0x27,0x18,0x30,0x10,0x48,0xb3,0x87,0x69,0x33,0xa8, + 0xeb,0x49,0x81,0x87,0xa3,0xdd,0xdb,0xd6,0xbb,0x33,0x84,0xfb,0x74,0x5c,0xc6,0x4c, + 0x5c,0x13,0x1f,0x07,0x9a,0x62,0x9b,0xe7,0xae,0xfd,0x06,0x11,0xd6,0xfc,0xfe,0x27, + 0x4b,0xf2,0xe5,0xc5,0x73,0xbb,0x23,0xe7,0xf9,0x36,0x96,0xaf,0xc3,0x51,0x73,0xb7, + 0xfc,0x89,0x46,0x43,0xe9,0xad,0xdd,0x1b,0x7a,0x11,0xc2,0x1d,0xb1,0x0d,0x0f,0x16, + 0x1a,0xaf,0x0d,0xb6,0x49,0xb9,0xd0,0xf4,0xaa,0x51,0x23,0x28,0x86,0x2d,0xaf,0x16, + 0x35,0x9e,0x36,0x76,0x3d,0x70,0x20,0xd1,0x8e,0xf6,0x1d,0x4b,0x74,0xff,0x04,0x32, + 0xb0,0x1a,0x4e,0x20,0x11,0x20,0x65,0xbe,0x2e,0xf2,0xa1,0x22,0xf3,0x22,0xdd,0xc0, + 0xb1,0xa8,0xe6,0x8c,0xc3,0x5f,0x9e,0x33,0xc8,0x13,0x87,0x56,0x05,0x62,0x30,0xcd, + 0xd3,0x82,0x7d,0x81,0x12,0x8c,0x74,0xa4,0x60,0x69,0xa0,0x04,0x6d,0xfc,0x42,0xa1, + 0x3d,0x36,0x8b,0x6d,0xdd,0x73,0xc6,0xc4,0xc9,0xca,0x07,0xad,0x4e,0x53,0xc7,0x7b, + 0x90,0x3c,0x21,0x96,0x6d,0xe8,0x2b,0x04,0x77,0xa4,0xcb,0x6e,0x7a,0xb0,0xda,0x16, + 0x14,0xdb,0x5c,0x57,0x4b,0xc0,0x37,0x0d,0x0c,0x72,0x3c,0x9d,0xac,0xda,0xa6,0xda, + 0xb5,0x95,0x6d,0x20,0x77,0xf3,0x71,0xad,0x39,0xa4,0x7c,0xd0,0x11,0x97,0x27,0x4e, + 0x04,0xf6,0x56,0xa7,0xa7,0xbe,0x7f,0x47,0xdb,0x72,0x69,0x95,0x1f,0xd3,0xdf,0xe8, + 0x82,0x18,0x80,0x2c,0x8b,0x49,0x89,0x24,0x51,0xb5,0xc4,0x62,0xce,0xf0,0xaf,0x03, + 0x7f,0x3d,0x6f,0x2a,0x08,0x2f,0xc9,0x5d,0x55,0x90,0x31,0x64,0xba,0x4e,0x4f,0xec, + 0x53,0x07,0xf3,0x52,0xb5,0x07,0x91,0x43,0x03,0xb6,0x49,0xac,0x17,0x23,0xfa,0xd0, + 0x86,0x88,0x42,0x0b,0xa1,0xa6,0xd0,0x25,0x5b,0xc9,0x0b,0xe3,0xbf,0x7e,0x9f,0x8c, + 0x6e,0xa6,0xa3,0xd5,0x9f,0xed,0xb5,0x2b,0xdd,0x77,0xe3,0xb8,0xb1,0x75,0x23,0xa9, + 0x1f,0x18,0x36,0xfe,0x6b,0x72,0x78,0x96,0x46,0xbc,0xa3,0x88,0xa7,0x82,0x6a,0x42, + 0x8a,0xb9,0x1f,0xb3,0xa2,0xb9,0x71,0xb7,0xaa,0xd2,0x9d,0xbc,0x7c,0x49,0x4d,0x17, + 0xd5,0x6e,0xd3,0x94,0xe8,0xa5,0x77,0x50,0x30,0x97,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x5e,0xb3,0x95,0x85,0x70,0xbd,0x87,0xa7,0xfc,0xc1,0xe9,0xdb,0x2a,0xd7, + 0xbc,0x87,0xac,0xb5,0xff,0xf4,0x53,0x37,0xcc,0x86,0x22,0x8b,0x45,0xc3,0x9f,0x0d, + 0xa4,0xa8,0xdc,0xe5,0xba,0xbb,0x70,0x50,0x9d,0x6c,0x60,0x1a,0xa5,0x12,0x18,0x53, + 0x99,0x81,0x0e,0x52,0x99,0x59,0x18,0x16,0xa7,0x38,0x44,0x2a,0xcf,0x9b,0x66,0x15, + 0x16,0xd9,0x30,0x78,0x41,0xeb,0x0d,0x5c,0x58,0x93,0xe2,0xf9,0x2d,0xd6,0x93,0x14, + 0x7c,0xfd,0xfe,0x23,0x7a,0x18,0xf2,0x66,0x76,0x5c,0xc8,0xb6,0xeb,0x35,0x6e,0x91, + 0x90,0xe6,0xc9,0x40,0x0e,0x53,0xf4,0x22,0x85,0x62,0x28,0x11,0x45,0x39,0xa2,0x99, + 0x13,0x9d,0x72,0x51,0xee,0x8d,0x94,0x5e,0x9a,0xa3,0x8f,0xc7,0xd1,0x83,0x0a,0x32, + 0x27,0xa1,0x2b,0x3d,0x82,0x80,0xac,0xcb,0x59,0x90,0xb7,0x98,0x80,0xa0,0x30,0x78, + 0x93,0x67,0x58,0xf9,0x96,0x25,0x1f,0xda,0x5d,0xda,0x74,0x49,0xa7,0xfe,0xe9,0xb1, + 0x25,0x6d,0x1e,0x3c,0x37,0x7c,0xf5,0xa6,0x23,0x7a,0xd0,0x01,0x98,0x83,0xb1,0x03, + 0x7d,0x6b,0x3c,0x9c,0x04,0x89,0x98,0xf6,0x1a,0x51,0x3a,0x48,0xe4,0x51,0xe9,0xce, + 0xb0,0x62,0x38,0xd6,0x9c,0xc6,0x81,0x08,0x2a,0xc4,0xc4,0x11,0x81,0x9f,0xab,0x23, + 0xd2,0x97,0x7c,0xc7,0x6d,0x72,0x57,0xf0,0x5e,0xfc,0xb1,0x2e,0x0b,0x39,0x40,0x25, + 0xea,0x4e,0x4b,0x68,0xcf,0x4d,0x3c,0x2b,0x76,0xa9,0x78,0x65,0x58,0x66,0xed,0xe7, + 0x83,0x02,0xd0,0xf0,0x72,0x11,0x4f,0x0b,0x80,0xbb,0x6c,0xd9,0x8b,0x99,0xfa,0x4f, + 0xed,0x71,0x15,0x50,0xe1,0xe9,0x1e,0x0e,0x02,0x1d,0x74,0x03,0xb7,0xc5,0x00,0x08, + 0x1c,0xd2,0x19,0x8f,0x7d,0xe7,0xe7,0xb7,0xa9,0xb6,0x76,0xca,0x22,0xa9,0x03,0x8b, + 0xed,0xe8,0x4f,0x87,0xd3,0x6d,0x79,0x92,0xf4,0x16,0x95,0x27,0x9a,0x4b,0xc1,0x40, + 0xe2,0xb6,0x66,0x0f,0x24,0xfc,0xd3,0x79,0x7c,0x59,0x65,0x60,0x5b,0xbe,0x6b,0xe9, + 0x0d,0x80,0x8f,0x47,0x0a,0x50,0xd5,0x0d,0xd7,0x68,0xba,0xc9,0x64,0xb9,0x61,0xc8, + 0xaf,0x4d,0xdb,0x0d,0x02,0x3e,0xe3,0xf5,0xb9,0x17,0x79,0xdc,0x57,0xb7,0x58,0xb7, + 0x25,0xf8,0x47,0xa7,0xf4,0x71,0x48,0xe1,0x5f,0x2a,0xcc,0x34,0x14,0xa6,0x60,0x95, + 0xf1,0x75,0xdf,0xb4,0x17,0x52,0x6d,0x0b,0x83,0xcb,0xc4,0xcd,0x39,0xea,0xc2,0x72, + 0x03,0x4b,0x3f,0x5a,0x69,0x37,0xfb,0x86,0x02,0x23,0x86,0x50,0x29,0x24,0x8c,0xd7, + 0xf0,0x3f,0x45,0x30,0x91,0x0d,0xf7,0x89,0x79,0xee,0x91,0x35,0x18,0x35,0x75,0x2e, + 0xf5,0xd1,0xd3,0x9d,0x07,0x84,0x20,0xde,0x9b,0xb7,0x2f,0xbe,0x65,0x10,0x0e,0x37, + 0x2e,0x98,0x2f,0x1a,0xab,0x86,0x18,0x2b,0xe8,0xf1,0xc5,0x20,0xc6,0xfd,0x93,0xe8, + 0xe8,0x9d,0x87,0x4d,0x1f,0x34,0x1c,0x32,0x51,0x7a,0x8c,0xc6,0xf5,0xc9,0xf0,0xf0, + 0xb0,0x07,0xf2,0x80,0xe3,0x67,0x45,0x7c,0x1d,0xc6,0x1d,0x9b,0xfd,0x9c,0x14,0xf2, + 0x8b,0xbf,0x52,0x61,0x4e,0xf0,0xad,0x3a,0xd6,0x6d,0xad,0x70,0x18,0x3d,0x3a,0x82, + 0x9d,0x8c,0x48,0x44,0xba,0xc1,0x77,0x56,0x64,0xe4,0x18,0x97,0x98,0xd0,0xe2,0x97, + 0x11,0x1a,0x38,0x3a,0xa2,0x1c,0x97,0x50,0x8e,0xeb,0x89,0x73,0xfb,0x49,0x24,0x0e, + 0xd8,0x7b,0x31,0x5d,0x90,0x83,0xf0,0x60,0x9e,0xcd,0x5f,0xbf,0x8a,0x6b,0xea,0x94, + 0xad,0x76,0xf2,0xab,0xd1,0x56,0x6e,0x12,0x98,0x1c,0x1f,0x40,0x09,0xcf,0x49,0xd7, + 0xa7,0x46,0xb7,0x0d,0x89,0xf9,0x57,0x22,0x6b,0x15,0xf3,0x46,0x6f,0x76,0x65,0x72, + 0xf3,0x9a,0x3a,0x93,0xf8,0xde,0xf1,0x74,0x83,0xa3,0x16,0xd6,0x2e,0x09,0xb3,0xfa, + 0x63,0xec,0x57,0xa2,0xe7,0xf7,0x78,0x9b,0x4d,0xf9,0xcc,0x2b,0xeb,0x61,0xce,0x3c, + 0x48,0x1b,0x1b,0x17,0xe5,0x67,0xa9,0x0e,0x2f,0x4d,0xe0,0x1f,0xec,0x92,0x5b,0x7e, + 0x13,0xb4,0x69,0xfc,0x06,0x00,0xa9,0x80,0x80,0x77,0x0b,0x5a,0x46,0x55,0xb5,0xc5, + 0x5b,0x11,0xed,0xe7,0x09,0x59,0x09,0x22,0x32,0xcb,0xa2,0x39,0x9b,0x42,0xa5,0x15, + 0xa6,0x90,0xf0,0x16,0x8c,0x88,0xa3,0xd7,0xd0,0x24,0x66,0x04,0xcb,0x0d,0xb0,0xd1, + 0xf4,0x04,0x95,0x36,0x44,0xf4,0xf1,0xa6,0x8b,0xf8,0xe8,0x95,0x05,0x00,0x86,0x6c, + 0x9d,0x03,0x37,0xb8,0x0f,0x64,0x00,0x6f,0xf7,0xcd,0x31,0x7d,0x05,0xea,0xb3,0x36, + 0xc2,0xe9,0xe7,0x0f,0xd0,0x4f,0x06,0x63,0x6e,0x79,0x03,0x29,0xce,0xff,0xf7,0x48, + 0x27,0x1f,0x06,0x64,0x0d,0xf8,0xbe,0x97,0x10,0x43,0xe2,0xf6,0x1e,0xbf,0x2d,0xc6, + 0x00,0x63,0x63,0x0c,0xec,0x31,0xfb,0x42,0x24,0x81,0x24,0xb4,0x43,0xf4,0x76,0x6d, + 0x9b,0x0f,0xe5,0x32,0x11,0x6f,0x5e,0xcf,0x8f,0x84,0x76,0x51,0x9e,0xb8,0x5f,0x8d, + 0xde,0x4e,0x7a,0x96,0x28,0x61,0x85,0xdb,0xcf,0x04,0xe9,0x9d,0xe7,0xd1,0xab,0x33, + 0x6b,0xc1,0x41,0xe7,0xa0,0xd8,0x18,0x73,0x69,0x72,0x49,0x79,0x1e,0x84,0xf1,0x9d, + 0x7e,0x09,0x45,0x7d,0x0c,0x1b,0x07,0x79,0x15,0x82,0x45,0x7b,0x2f,0x8f,0x82,0xe7, + 0x95,0x62,0xd8,0xef,0xb3,0x15,0x86,0xf3,0xf9,0x84,0xd1,0xa7,0x27,0xf2,0x03,0xd7, + 0x41,0xf2,0xca,0x64,0xa2,0xa6,0x98,0xd1,0xb2,0x02,0x24,0xf9,0x69,0xbb,0xe0,0x15, + 0xf8,0xe1,0x87,0x7d,0x05,0x01,0x43,0x54,0x3b,0xe4,0x71,0x75,0x9f,0xc7,0x57,0x2d, + 0x6b,0xff,0x2b,0xee,0x3a,0xb8,0xdb,0xc8,0x91,0xf4,0x5f,0x91,0x2f,0x10,0xec,0x63, + 0x9b,0x96,0x3d,0xe1,0xcd,0x35,0x45,0xf3,0xd9,0x9e,0xcd,0x3b,0xe1,0x72,0xf0,0xf8, + 0xf9,0xd1,0x96,0x3c,0xd6,0xb3,0x2c,0xeb,0x44,0x69,0x93,0xa8,0xff,0x7e,0x55,0x85, + 0xaf,0x8b,0x85,0x6a,0x80,0x20,0x57,0x9a,0xd9,0x64,0xb1,0x1b,0xe8,0x42,0x2a,0x14, + 0x2a,0xc3,0x0e,0x2d,0xed,0xca,0x93,0x2f,0x3c,0x18,0xec,0x1b,0x90,0x6c,0x05,0x08, + 0x12,0xfc,0xb3,0xe3,0x98,0xce,0x8e,0x39,0x52,0xd7,0x6b,0x6c,0x9d,0xc8,0x67,0xda, + 0x96,0x6c,0xc1,0x7a,0x8d,0x86,0x71,0x4a,0x90,0x04,0x75,0xca,0xdc,0xcc,0x38,0x4c, + 0xdc,0x3c,0x4d,0x42,0x43,0x6d,0xa1,0xb1,0xf4,0xcc,0xc1,0xb9,0x9c,0x8c,0xe6,0x5b, + 0x28,0x65,0x10,0xed,0xa3,0x8c,0xd9,0x54,0x3d,0xce,0x98,0x0c,0x08,0x67,0xa1,0x46, + 0x6a,0x37,0x3e,0x7e,0xfd,0xe9,0x02,0x73,0x65,0x46,0x6b,0x8e,0xf8,0xeb,0x0b,0x36, + 0x0f,0x3e,0x97,0x58,0xc7,0xb1,0x39,0xdf,0x39,0x61,0xd2,0xdc,0xd1,0x4d,0xe2,0xd1, + 0x39,0x45,0x0e,0x0d,0x43,0xe8,0xee,0x24,0x74,0x07,0x61,0x42,0x2f,0x23,0x47,0xae, + 0xef,0x7b,0xd2,0xca,0xa3,0xa2,0xd2,0x18,0x47,0xe9,0xf8,0x7a,0x06,0x3f,0x09,0x07, + 0x8f,0xbc,0xba,0xfe,0x60,0x7c,0x7a,0xfe,0xf6,0xec,0x5a,0xb8,0x4a,0xc9,0x20,0xc0, + 0x0d,0x36,0x01,0xa0,0x98,0x64,0x11,0xa0,0xde,0x39,0x6a,0x0e,0x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0xf9,0x71,0x20,0x1b, + 0x50,0x68,0x5a,0x69,0xa2,0x58,0x47,0x0c,0x7f,0x54,0x8b,0x51,0x74,0x3b,0x20,0xb4, + 0xcb,0x2d,0x4e,0xc5,0xcc,0xf2,0x2d,0xa7,0xca,0x95,0xe9,0x0a,0x33,0x69,0x24,0xc1, + 0x73,0xe6,0x2f,0x99,0xa7,0x71,0x83,0xff,0x27,0xce,0x52,0xdb,0xd0,0x5e,0xff,0x3d, + 0x6b,0x12,0x4f,0x20,0x0d,0x34,0x74,0x30,0x3c,0xa4,0x93,0x45,0xea,0xd2,0xc2,0xbe, + 0xa7,0x91,0xae,0xce,0x88,0x08,0x8e,0x0f,0xdb,0xc7,0x4f,0xb4,0x69,0x86,0x9f,0x34, + 0xc2,0xf5,0xe5,0xc5,0x8c,0x7b,0xb5,0xbc,0x60,0xed,0xc4,0x58,0xda,0x91,0x01,0x35, + 0x96,0xf2,0xa2,0x94,0x2a,0x2a,0xbc,0xc8,0xf3,0x9a,0x3a,0x6f,0x99,0x2c,0x63,0xd8, + 0x2f,0xd8,0x55,0xe5,0x29,0x29,0x0a,0x4d,0x39,0x1d,0xcd,0xab,0xab,0xbe,0x9c,0xeb, + 0x4e,0xa3,0x6d,0x67,0xac,0x20,0x23,0xc9,0x4f,0xc7,0xbc,0x91,0xe5,0x6f,0x7b,0x31, + 0x3c,0x31,0x5e,0xdc,0x16,0xf7,0xd1,0x73,0x0e,0xe8,0x8d,0x87,0x91,0xd8,0x31,0x7a, + 0xf5,0x34,0xfb,0x19,0x47,0x7b,0x43,0xcb,0xae,0xc4,0xd6,0x54,0xa1,0x58,0x2f,0x19, + 0x01,0x09,0xf1,0xf9,0xcf,0xd1,0x57,0xf2,0x07,0xd8,0x5f,0xc6,0x7d,0x09,0x20,0x9e, + 0x9e,0x12,0xaf,0xfb,0x27,0xda,0x01,0x7d,0x2b,0x5d,0xff,0xa3,0x45,0x2a,0xd7,0xf8, + 0xe7,0x76,0xb3,0x17,0xfb,0x0a,0xa3,0x11,0x76,0x08,0x5e,0x30,0x13,0x87,0x9f,0x8e, + 0x71,0x93,0x91,0xf5,0xec,0xda,0x46,0x71,0x82,0xa3,0x4f,0xd1,0x5c,0x07,0x9a,0xc2, + 0x35,0xfb,0x3b,0x0e,0x85,0x73,0x53,0xb2,0x8f,0x12,0xaa,0x21,0xe0,0x77,0xd5,0xf0, + 0xec,0xb0,0x9e,0x7a,0xcc,0x15,0xa6,0xa7,0xc7,0x2d,0xff,0xb5,0xfd,0x96,0xea,0x5c, + 0x8b,0x69,0xef,0x17,0x5f,0x34,0x37,0x6a,0x12,0x12,0xac,0x92,0x08,0x9d,0x6f,0xe3, + 0xab,0x71,0xaf,0x36,0xe0,0x95,0xcc,0xef,0x74,0x0b,0x90,0xb6,0xb9,0x79,0x3a,0x9a, + 0xc7,0x49,0x4b,0x5e,0x3e,0xfd,0x2a,0xbf,0xe7,0x65,0x19,0xfc,0x8e,0xc7,0xe2,0x9b, + 0xcf,0x0d,0x0f,0xe9,0x27,0x56,0x96,0x90,0xcc,0xd2,0x12,0x53,0xcb,0xca,0x1f,0x0a, + 0xa3,0xf6,0x7c,0xa0,0x1b,0xdc,0x4d,0x3c,0x4d,0x30,0xfe,0x2c,0xab,0x02,0xad,0x73, + 0xbf,0x48,0xcc,0x62,0x35,0x37,0xc9,0x37,0x76,0x73,0x32,0x3b,0x8b,0x92,0x03,0x44, + 0x72,0xb3,0x06,0x42,0x27,0x31,0xb7,0x7e,0x3d,0xe8,0x28,0xe5,0x8f,0x9d,0x26,0x5f, + 0xce,0xa1,0x22,0x95,0x8a,0xc5,0x34,0xc8,0xf8,0x63,0x2a,0xe6,0xd6,0xfe,0xad,0xbe, + 0x34,0x1d,0x14,0x9c,0x90,0x90,0xe9,0x38,0xc3,0xa8,0x42,0xc6,0xde,0x5f,0xfc,0x81, + 0xca,0x7f,0x2f,0x8c,0x03,0x6b,0x49,0xde,0x12,0x29,0xfa,0x10,0x5a,0x56,0x1e,0xb1, + 0xf6,0x11,0xb1,0xd4,0x82,0x53,0x0d,0x14,0x4b,0x20,0xd3,0xc4,0xeb,0xeb,0x7c,0x18, + 0xa2,0x13,0x21,0x43,0xd9,0x6f,0x97,0x00,0xbe,0x74,0x42,0x6b,0xc6,0x84,0x9e,0x1c, + 0xa6,0xfc,0xf1,0xfa,0xe3,0xfc,0xb1,0x61,0x40,0xa3,0x83,0xd3,0x3f,0x50,0x31,0xb8, + 0xd7,0x8d,0x59,0xe4,0x87,0x63,0xb5,0x7c,0x48,0x09,0xe1,0x5c,0x44,0x49,0x3c,0x1e, + 0x01,0x9e,0x7b,0xcd,0x54,0x2d,0x41,0x1a,0x64,0x1b,0x5c,0xc2,0xdb,0x2f,0x7a,0x90, + 0x85,0x09,0xbe,0x9e,0x04,0x56,0x68,0x12,0x77,0xe4,0x5c,0xff,0xb0,0x4f,0x55,0xb2, + 0xb1,0x6d,0xa4,0xa8,0xc6,0x5c,0xc3,0xbf,0xc5,0x18,0x19,0x1e,0xc6,0x96,0xb1,0xb5, + 0x08,0xa5,0x99,0x8b,0x98,0xcc,0x7e,0xee,0x97,0x63,0x3d,0x4a,0x20,0x6b,0xfc,0x18, + 0x35,0xea,0xe3,0xe6,0x11,0x1f,0x26,0x8a,0x96,0x52,0xba,0x5e,0x0f,0x37,0x25,0x40, + 0xd2,0xe4,0xe0,0xd7,0xd1,0x63,0xfd,0x59,0x54,0xa2,0xe9,0x94,0xc8,0x96,0x4c,0x3d, + 0x3b,0xd3,0x61,0x03,0x52,0x86,0x1b,0x82,0x8b,0xc3,0x8b,0x98,0xdd,0x6e,0x4c,0x2e, + 0x84,0xca,0x05,0x81,0xf9,0x71,0x6d,0x42,0x64,0xa5,0xd9,0x56,0xf1,0x4e,0x8e,0x1c, + 0x69,0xd0,0x72,0x4f,0xbe,0xaf,0xcb,0x2b,0x66,0x43,0x41,0x45,0xa9,0x9c,0x54,0xf1, + 0xc4,0xa7,0x8a,0xf8,0x47,0xa7,0xdc,0x09,0x69,0x9d,0x7a,0x2a,0x80,0x45,0xc3,0x02, + 0x40,0x7a,0x9c,0x73,0xd7,0x88,0x02,0x86,0xf8,0x18,0x16,0x76,0xc1,0xc2,0x20,0x3b, + 0x62,0x68,0xba,0x43,0x05,0x11,0x23,0xc7,0x15,0x02,0x6b,0xf1,0xc3,0x22,0x41,0x6c, + 0x07,0x41,0xea,0x13,0x08,0xe2,0xc7,0x70,0xae,0xad,0xa2,0x13,0xf0,0xfc,0xb0,0xc4, + 0x04,0xa2,0x29,0xb8,0xa0,0xb2,0xf1,0xdb,0x1e,0x87,0x8e,0xd9,0x63,0xd2,0x47,0x2f, + 0xe5,0x2f,0x33,0x7d,0xf2,0x63,0x5f,0xc6,0x4f,0xcf,0xb8,0x76,0xc0,0xf8,0x01,0xcc, + 0x7d,0xf2,0x7f,0xd2,0xd8,0x3e,0x0c,0x20,0x9a,0x72,0xcb,0x36,0x1a,0xa5,0x80,0x9f, + 0xce,0x63,0x81,0xed,0xa2,0x68,0x0e,0xe1,0xb2,0xad,0x71,0xfc,0x4b,0x96,0x43,0xae, + 0xae,0x97,0x67,0x83,0x2d,0x4e,0xfe,0xee,0x84,0xcf,0x84,0xe7,0x27,0x71,0x0b,0x7c, + 0x24,0x3d,0x32,0x53,0x69,0x85,0x25,0x56,0xdd,0x24,0x97,0xe8,0x01,0xab,0x34,0x21, + 0x49,0x5d,0x31,0x66,0x2e,0x2f,0x2f,0x39,0xf9,0x9b,0xcc,0x6b,0xac,0x09,0xc5,0xc9, + 0x14,0x50,0xe2,0xb2,0x4e,0x2f,0xae,0x57,0xef,0xfd,0x5c,0x21,0x1d,0x7f,0x91,0xa3, + 0x3a,0x50,0xe4,0x49,0x11,0x50,0xc8,0x07,0x27,0xd0,0x3e,0x6c,0x23,0x74,0x68,0x28, + 0x22,0xf6,0x35,0x5d,0xf2,0x52,0xc0,0x81,0x75,0x03,0xb8,0x45,0xac,0xf0,0x12,0x8f, + 0x0f,0x1f,0xbf,0xea,0x80,0x67,0x5b,0x85,0x79,0x2a,0xcc,0xe7,0xb4,0xf4,0x67,0xe3, + 0xaf,0x45,0x14,0x23,0x1a,0x8b,0x06,0x26,0x21,0xba,0x2d,0x0f,0x16,0x20,0x4c,0xc6, + 0xa8,0x42,0x83,0x7b,0xbc,0x08,0xa1,0x0b,0xd4,0xf4,0x24,0xf8,0x0c,0xae,0x92,0xa3, + 0x95,0x25,0xcf,0x32,0x97,0x09,0x51,0x2a,0x11,0xd2,0x1c,0x4b,0x40,0xeb,0x42,0xa1, + 0x25,0x90,0x01,0x59,0xf1,0xa8,0x6a,0x16,0x95,0x12,0x13,0x24,0x95,0x9a,0xec,0x0c, + 0xc7,0x6b,0x6e,0x20,0x58,0x0d,0x5c,0xd4,0x38,0x2b,0x41,0x13,0x91,0x54,0x3d,0x7e, + 0x18,0x9f,0x4d,0x07,0x8c,0x08,0xca,0xfb,0xd5,0x3c,0xab,0x3e,0x63,0xe8,0x5c,0x33, + 0x4b,0xdc,0x66,0x66,0xa9,0xd7,0xcc,0x2c,0x75,0x9a,0x49,0xfd,0x65,0x66,0x03,0x77, + 0x99,0x59,0xce,0x5b,0xe6,0xc0,0xf8,0x73,0x4c,0xe1,0xa2,0x81,0xa6,0x4d,0xc1,0xf2, + 0xcc,0x17,0xa8,0x63,0x87,0x7e,0x14,0x42,0x5a,0xa0,0x1f,0x85,0x5e,0x9a,0x77,0x21, + 0x8b,0x25,0x2c,0xb3,0xd1,0x71,0xe5,0x4a,0x1a,0x2e,0x9a,0xad,0xa2,0x2d,0xfa,0x18, + 0x3f,0x8f,0xac,0x61,0x96,0x74,0x6c,0xa5,0xaa,0x84,0x48,0xa7,0x07,0x30,0x7c,0xb9, + 0xef,0x89,0x2d,0xd4,0x3e,0x20,0xdc,0x96,0x8a,0x45,0xc1,0xa9,0x8b,0xab,0xa5,0x39, + 0x6d,0x4a,0xc8,0xc5,0xcc,0x9a,0xee,0xb2,0xd4,0x53,0x1e,0x4d,0x76,0x6f,0xba,0xa5, + 0xd0,0xd0,0x36,0x55,0x1e,0x26,0x10,0x96,0x67,0xe5,0x52,0xef,0x0a,0x5d,0x1e,0x39, + 0xdc,0x92,0xcb,0x80,0xe0,0xe0,0xb8,0xbd,0x91,0xdc,0x68,0x3c,0x94,0x52,0xa5,0x8c, + 0xbe,0xc7,0xd1,0x06,0x26,0x00,0x2c,0xf2,0x83,0x0b,0x83,0xf7,0xd0,0xf8,0xe6,0xb0, + 0x0b,0xbf,0x62,0x62,0x1e,0xda,0xc7,0x5d,0x50,0x7f,0xfe,0xd0,0x3e,0xe9,0x9c,0x26, + 0x2b,0xb4,0x9f,0x75,0x91,0x60,0x84,0xf6,0x73,0x2e,0xfc,0x51,0x9c,0x42,0x24,0x8a, + 0xf7,0x32,0xb4,0x5f,0x74,0x21,0xe6,0xad,0xd6,0x57,0xb7,0xcd,0x4b,0x69,0xeb,0x95, + 0x28,0xdc,0xa9,0x79,0x22,0x97,0xf2,0x22,0x21,0x19,0x54,0x15,0x5d,0x02,0x6b,0x15, + 0x67,0x68,0x2e,0x7b,0x77,0xbd,0xee,0x9f,0xd4,0x80,0xd3,0x80,0x6d,0x23,0xf1,0x84, + 0x4d,0x9b,0x84,0x92,0xa0,0xa3,0xa4,0xb9,0x0b,0x33,0x03,0xe2,0xe8,0xcb,0xc3,0xbe, + 0x2e,0x94,0xdf,0x3d,0xab,0x47,0x6d,0x7e,0x0a,0x33,0xad,0xf7,0xd9,0x97,0x87,0x5a, + 0xd3,0xb0,0xad,0x52,0xf8,0x88,0x80,0x4c,0x02,0x5c,0x85,0xf1,0x21,0xb5,0x51,0xaa, + 0xcd,0xa0,0xb8,0xfe,0x7b,0x52,0x84,0xa3,0xb6,0x5d,0x03,0x39,0xfc,0x74,0x01,0x4c, + 0xdf,0x16,0x29,0x8f,0x5c,0xd0,0xb2,0x74,0x34,0xe6,0xf3,0x93,0x60,0x66,0x4f,0x43, + 0xbc,0x64,0x65,0x79,0x1f,0x61,0x16,0xe5,0xf7,0x94,0x10,0xc6,0xce,0xd8,0xf3,0x18, + 0x53,0x10,0x66,0x7d,0x39,0x1b,0x3e,0xae,0x09,0xa3,0x9e,0xce,0x3f,0xd3,0x4a,0xdf, + 0xb3,0xfd,0xe7,0x18,0xa7,0x7d,0x5f,0x21,0xcc,0x0c,0x54,0xb4,0xc9,0x4a,0x65,0xe8, + 0x83,0xf5,0xe3,0xff,0x5a,0x9e,0x32,0x2e,0x4b,0x82,0x77,0x29,0xa2,0xf8,0x95,0xdf, + 0xa1,0x3d,0xf7,0x25,0x1f,0xc2,0xf9,0x0f,0xb9,0x84,0xbf,0xb3,0x33,0x2d,0x9f,0xc3, + 0x79,0xe5,0xb5,0xf0,0x00,0x51,0xd1,0x2a,0xec,0x0f,0xc0,0x86,0x2e,0xbc,0x58,0x5e, + 0xd3,0x85,0x42,0x64,0x22,0x49,0xe7,0x3d,0xb3,0x39,0x8c,0x10,0x13,0x67,0x65,0xae, + 0xde,0x9c,0xeb,0xb5,0x75,0xf6,0xdc,0x1c,0x9d,0xbd,0x72,0xc6,0x4a,0xb3,0x2c,0xf4, + 0x0e,0xf4,0xb4,0xff,0x77,0x4d,0x63,0x8c,0x7e,0x91,0x9f,0x2e,0x9f,0x9d,0x9d,0x6d, + 0x64,0xdb,0x26,0xfe,0xd8,0xd8,0x43,0x62,0xdb,0x96,0x96,0x68,0x98,0x7a,0x68,0x7c, + 0x35,0x12,0x8e,0x36,0xa7,0x61,0xcf,0xfb,0xe8,0x77,0xac,0x52,0xc8,0x7d,0xa3,0xe7, + 0x29,0xf6,0x54,0x3a,0x0c,0x71,0xc5,0xde,0x71,0x14,0x52,0x17,0x17,0x4e,0xe9,0x25, + 0x50,0x34,0x28,0x5a,0x5e,0x29,0x22,0x05,0x0d,0xcd,0x53,0x72,0x18,0xc8,0x7b,0xdf, + 0xa7,0xb4,0x07,0x34,0xde,0x77,0xa7,0x7f,0xe2,0x2e,0xbc,0xdc,0x90,0xec,0xd0,0x6e, + 0x08,0x74,0x78,0x45,0x3a,0xbc,0x58,0x6b,0x12,0x40,0x64,0x33,0xe3,0x34,0x75,0x88, + 0x97,0x54,0x3a,0xcc,0x3d,0xe2,0x23,0x5a,0xb0,0x69,0x63,0xff,0xc8,0x13,0x49,0x66, + 0xd9,0x99,0xb7,0x60,0x9f,0x48,0xdd,0xa1,0xac,0x88,0xa0,0xde,0xd1,0x2b,0xc6,0xdb, + 0xe8,0xdb,0x40,0xbc,0xba,0x7a,0x35,0x3e,0x7b,0xf8,0x4b,0xeb,0xd8,0x28,0xdf,0x8e, + 0x46,0x0f,0xd4,0xaf,0x11,0xaf,0x66,0x03,0xdd,0x8d,0x20,0xe4,0x0b,0x3e,0x54,0xa1, + 0x78,0x12,0xa4,0xac,0x1f,0xfc,0xe9,0xfc,0xbd,0x14,0xa7,0xfa,0x36,0x92,0x5a,0x99, + 0xc6,0x97,0x81,0xf9,0xa1,0x55,0x68,0xd5,0x32,0x43,0xfe,0x5a,0xaf,0xda,0x97,0xe1, + 0xd7,0x29,0xb9,0xd4,0x0a,0x24,0x3c,0xd0,0x6a,0x71,0x0d,0x97,0xd5,0x41,0x6b,0xb0, + 0x83,0xe9,0xd9,0xa7,0x1f,0xb9,0xca,0xb3,0x3f,0x62,0xaf,0xf2,0x16,0x45,0x39,0xb6, + 0x26,0x95,0xa3,0x6d,0x61,0x1a,0x95,0x7c,0x68,0xb5,0x68,0x69,0x7d,0xf5,0x2a,0xd1, + 0x0b,0xf1,0x38,0x2b,0x4a,0xf0,0xa8,0xd7,0x28,0x56,0x8a,0x97,0x2c,0x51,0x3d,0xd1, + 0x06,0x95,0xab,0x11,0x6a,0x43,0xfe,0x92,0x46,0xad,0x1e,0x9c,0x9f,0xc3,0x2c,0xb6, + 0x93,0x9c,0xad,0x89,0x67,0xec,0x4c,0x1a,0x48,0xca,0x65,0xf6,0x67,0x02,0x0e,0xda, + 0xa2,0x08,0x24,0xf6,0x25,0xc3,0xc7,0xa1,0x16,0x3f,0xaa,0xfb,0x68,0x81,0xc5,0x02, + 0x0b,0x35,0xd4,0x4c,0x70,0x98,0x57,0x64,0xb3,0x21,0x5f,0x19,0x16,0x9a,0xe7,0xd6, + 0x49,0x02,0x4c,0x80,0x53,0x9a,0xa6,0xc4,0xae,0x37,0xb8,0x68,0xb1,0x8a,0xef,0x39, + 0xa2,0xa9,0x32,0x7d,0x59,0x10,0xc7,0x48,0xa6,0x91,0xd3,0x6c,0x6f,0xbc,0xce,0xd9, + 0xf5,0xcc,0xa9,0x72,0x61,0x86,0xe5,0x3f,0xce,0x53,0x00,0x56,0x3f,0xc9,0x78,0x66, + 0x55,0xce,0xde,0x90,0x2e,0xdc,0x07,0xa3,0xa7,0x74,0x20,0x71,0x15,0x88,0x8e,0xc0, + 0xa7,0x2b,0xf9,0xdb,0xb7,0xc8,0xd5,0x58,0xb7,0x64,0x1f,0x7b,0x4f,0xa3,0x27,0xee, + 0xf5,0xea,0x13,0x4e,0xd9,0xf9,0xd3,0x07,0x4a,0x2a,0xe4,0x68,0xe2,0x0d,0xde,0x40, + 0x1c,0x5e,0xaf,0xad,0x1e,0xf9,0x41,0xa4,0xba,0xa3,0xd1,0xdd,0xd5,0xcd,0x12,0x53, + 0xd4,0x34,0x79,0x3d,0x03,0x77,0x43,0x6c,0x06,0x3a,0x64,0x83,0x13,0x00,0x67,0x64, + 0x2b,0x03,0x77,0xb3,0xf6,0xbd,0x27,0x48,0x89,0x3c,0xcd,0x76,0x13,0x70,0xbc,0x76, + 0x9f,0x2b,0x33,0x61,0x4a,0x66,0xfc,0x66,0x67,0x3b,0xd8,0xd5,0x25,0x46,0x94,0x00, + 0xe5,0x3d,0x28,0xd4,0xae,0x9f,0x7f,0x6b,0x71,0x9a,0xc4,0x55,0xe9,0xc9,0xd8,0x22, + 0x1c,0x44,0x8f,0xec,0x26,0x74,0x21,0x34,0xad,0xf2,0xc2,0x52,0x8b,0x9f,0x9a,0x96, + 0x66,0x2e,0x3e,0x0a,0x4f,0xf9,0x9a,0x78,0xb7,0xa6,0xf7,0x8a,0x1f,0x32,0x1f,0x4d, + 0x3b,0x64,0xbc,0x7a,0xa2,0x66,0x08,0x1b,0x05,0x30,0x95,0x47,0x75,0x4c,0xa3,0xe2, + 0x1a,0x09,0x35,0xf1,0xc6,0x30,0xae,0x80,0xc1,0x33,0xa5,0xd8,0x0b,0x7a,0x7b,0xdf, + 0x0a,0xf7,0x10,0xb9,0x01,0x39,0x49,0x77,0x55,0xb8,0x47,0x6e,0x41,0x50,0x89,0x0f, + 0x06,0xdd,0x2d,0x2d,0x23,0x9a,0xd7,0xbe,0x63,0x42,0x9c,0xd6,0xdd,0x4f,0x47,0x1e, + 0x0b,0xbd,0x7d,0x10,0xb3,0x95,0xd4,0xf5,0x94,0x75,0xbb,0xa0,0xc9,0x6c,0x16,0x89, + 0x2c,0xe3,0x01,0xcf,0x35,0x79,0x8c,0x26,0xb6,0xca,0xb6,0x19,0x82,0xb2,0x08,0xff, + 0x21,0x44,0xf5,0x98,0xc0,0x2a,0xc7,0xbf,0xe1,0xf3,0x49,0x2b,0x6e,0x2c,0xaa,0xd3, + 0x03,0x77,0x5c,0x93,0x4a,0x89,0x5c,0x4d,0xc4,0x3f,0xff,0x92,0xb6,0x2a,0xd4,0x31, + 0xc8,0xd1,0xd4,0xc6,0x24,0x16,0xd7,0x14,0x6c,0x47,0xcd,0x53,0x29,0xae,0xe2,0x42, + 0x62,0x20,0x5a,0x79,0x32,0xd6,0xbd,0x39,0x3d,0x63,0x77,0xc1,0xc0,0x82,0x84,0x4d, + 0x94,0xaa,0xe7,0x3d,0xbb,0x6c,0x43,0xed,0xc3,0xb6,0x1e,0x25,0x9d,0x46,0xed,0xd2, + 0x44,0x4a,0xef,0xd6,0xd5,0xd6,0x68,0xa3,0xbf,0x40,0xa2,0xca,0x1a,0x84,0x4f,0x65, + 0xcf,0x17,0xe7,0xcb,0x7c,0x7c,0xfc,0xb5,0x28,0x48,0xc6,0x86,0xc3,0x69,0x6e,0xb0, + 0xfd,0x49,0x67,0x55,0x66,0x1a,0xae,0x02,0xef,0x50,0x09,0x85,0x63,0x50,0xe5,0x8a, + 0xbc,0x09,0x19,0x54,0xe6,0x48,0x37,0xdf,0x97,0x19,0x02,0xaf,0xcb,0x31,0x98,0xc8, + 0x60,0x6d,0x27,0x2c,0x03,0x18,0x15,0x52,0xbf,0x10,0xcf,0x8f,0x31,0x99,0xb1,0xdf, + 0xbe,0x8f,0xa3,0x6b,0x89,0xbe,0xbd,0x8d,0x92,0xb0,0x65,0x8e,0xe7,0x52,0x85,0xb9, + 0x4f,0x28,0xa2,0xc2,0xc2,0xb0,0xca,0x9d,0xb2,0xca,0x2a,0x00,0x6f,0xd4,0x5a,0x2f, + 0xe5,0xd3,0x57,0xc4,0x8f,0x6e,0x40,0x6b,0x15,0xd5,0x63,0xa1,0x16,0x9d,0x55,0x71, + 0x58,0x15,0x0d,0x4b,0x9a,0x43,0x85,0x35,0x06,0x1b,0x97,0x5b,0xdc,0x40,0x73,0x7c, + 0xb9,0x7c,0xc7,0x46,0x0d,0x1e,0x01,0xe7,0x61,0x71,0x47,0x76,0x1a,0x57,0xaf,0x7e, + 0xf6,0x72,0x92,0xf0,0xe1,0x4d,0xde,0xba,0xc1,0xba,0xdd,0x09,0x32,0xe9,0xac,0x88, + 0xae,0xb8,0xd7,0x0c,0x84,0x98,0x55,0x27,0x2c,0xfa,0x1f,0x9d,0x96,0x48,0x9e,0xa5, + 0xb0,0x18,0xeb,0xf4,0x41,0x5d,0x47,0x75,0x45,0x33,0x19,0x3a,0x54,0x69,0x36,0xdf, + 0x5c,0x9f,0x7f,0x20,0x37,0xce,0xf3,0xb0,0x51,0x3d,0xc4,0xba,0xe6,0x1b,0x15,0x27, + 0x0a,0x22,0x87,0xe8,0xb2,0x67,0x5e,0x66,0xb1,0xa5,0x02,0x36,0xf6,0x44,0xde,0x75, + 0x21,0xcc,0xb6,0xc9,0x38,0xfc,0x89,0x0a,0x32,0x86,0x7b,0xe3,0x4e,0xe4,0x16,0x32, + 0x4e,0xce,0x6c,0x80,0x06,0x45,0x86,0xd2,0x6f,0x67,0xa6,0xd0,0x82,0x30,0xf1,0x8b, + 0x02,0x4f,0xf9,0xc0,0xca,0x4b,0x29,0x5f,0x82,0xb3,0xc2,0x86,0x19,0x0b,0x7a,0xd8, + 0xf4,0x19,0xd6,0x90,0xd5,0x4b,0xbd,0x73,0x43,0x48,0x12,0x6d,0x2f,0x7d,0xb0,0x27, + 0xf7,0x49,0xcc,0x27,0x7d,0xd4,0xd1,0xff,0x87,0x6c,0x67,0x4a,0xd3,0x68,0x6a,0x79, + 0x00,0x40,0xb5,0x32,0x4b,0x4a,0x02,0xb8,0xa1,0xea,0xca,0x9c,0xe1,0x4c,0x03,0x98, + 0x74,0x1a,0x78,0x36,0x75,0x9f,0x70,0x66,0xfb,0x02,0x1f,0xeb,0xd8,0xd5,0x44,0xb1, + 0x6d,0x9a,0x99,0xed,0xa2,0xf0,0xa5,0x37,0xc3,0x7a,0xf9,0xa3,0xaf,0xa2,0x84,0x36, + 0x33,0x2d,0x6c,0xaf,0xed,0x16,0x17,0xd6,0xe4,0xd0,0x98,0x5c,0x30,0x64,0x18,0xae, + 0x3c,0x8b,0x86,0x8c,0x27,0x4d,0xe8,0xe8,0x11,0x79,0x53,0x44,0x1f,0xd9,0x84,0x46, + 0x64,0x4f,0x9c,0x76,0xa1,0xe5,0x8f,0x21,0xb7,0x2e,0xbc,0x5c,0x1b,0xcf,0x37,0xc9, + 0xc6,0xe4,0x8f,0x49,0x53,0x89,0xe1,0xfd,0x7e,0xb9,0xba,0xd2,0xb2,0x90,0xe3,0x01, + 0xb9,0x56,0x9f,0xc6,0x30,0x64,0xb8,0xbe,0x8c,0xd0,0x7c,0x00,0x4b,0xe4,0x90,0x6d, + 0xe4,0xca,0x6c,0xb6,0x81,0x31,0x30,0x44,0xe7,0xae,0xd8,0x24,0xef,0xc7,0xd7,0xab, + 0x53,0x8e,0xa9,0xe0,0x6a,0xdf,0xc7,0xef,0x04,0x96,0xad,0xa7,0x00,0xb9,0x40,0x6a, +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x17,0x65,0x75,0x48,0xdd,0x12,0x85, + 0x13,0x0b,0xe7,0x93,0xf4,0x63,0xec,0x0f,0xa3,0x0a,0x14,0xa8,0x1f,0xd1,0x7b,0x61, + 0x6b,0x30,0xcc,0xb0,0xc0,0xcb,0x71,0xd3,0xe1,0xd7,0xcc,0x06,0x0b,0xea,0x08,0x2a, + 0x1c,0xb7,0x9b,0x3c,0x26,0xc3,0x52,0x49,0xd2,0x22,0x46,0xe6,0x49,0xfd,0x5e,0xec, + 0x4a,0xe5,0x0f,0x7c,0x23,0x58,0x18,0xef,0x97,0xbf,0x96,0xa1,0x6d,0x85,0x5b,0x2a, + 0x30,0x5a,0x1b,0xb0,0x39,0xce,0xca,0x31,0x54,0x3e,0x7a,0xa0,0xe3,0xda,0xe0,0x97, + 0x93,0x0f,0x47,0x23,0x75,0x46,0x8a,0xf5,0xa1,0x0d,0x7a,0xfc,0xcf,0x1c,0x8d,0x60, + 0xd5,0xbe,0xed,0xc1,0x0f,0x57,0xaf,0x9c,0x0b,0x57,0x33,0x38,0xff,0x69,0x4a,0x6c, + 0x42,0x94,0x4b,0x9b,0x8f,0x51,0xb3,0x7e,0x91,0xd7,0x20,0x67,0xfb,0x23,0xa7,0x7c, + 0xc9,0x3e,0xc8,0xf7,0xf0,0x38,0x57,0x1f,0xd6,0x3f,0x5b,0x29,0xeb,0xe4,0x4f,0x17, + 0xf2,0x7b,0x9e,0x63,0x00,0x67,0xea,0x2d,0xe0,0xb6,0x02,0x2f,0xb5,0x44,0x51,0x0e, + 0x58,0x26,0x01,0xb3,0xe1,0x99,0x5a,0x01,0xd4,0x19,0xe1,0x24,0xf2,0xc8,0xda,0x6e, + 0xd7,0xff,0x50,0x47,0xd2,0xcc,0xce,0x6f,0x6e,0x4a,0x3c,0x68,0x5e,0x8c,0xfc,0xb0, + 0x11,0x1f,0x6f,0x6f,0xdb,0x10,0x13,0x9a,0x85,0x89,0x7c,0x39,0x09,0xcc,0x6d,0xd0, + 0x93,0x57,0xf6,0x04,0x9e,0xa7,0x02,0x11,0xf0,0xce,0x5b,0x7e,0xe7,0xdf,0x07,0x4e, + 0xfb,0x95,0x41,0xf4,0xad,0xce,0x24,0xb7,0x2d,0xd8,0xa6,0x73,0xf7,0x9a,0x7b,0xda, + 0x99,0x76,0xed,0xf9,0x7f,0xdb,0xfb,0x55,0x51,0xed,0xb3,0xe5,0xb9,0x2c,0x1c,0xbf, + 0x1a,0x3a,0x0c,0x35,0x37,0xb1,0xa9,0x29,0xdc,0xc0,0x12,0xb7,0x2f,0x97,0x9f,0x90, + 0x3a,0x6c,0xe0,0x91,0x2e,0x87,0x0a,0x92,0x9c,0x8b,0x11,0x86,0xd5,0x4c,0x58,0xe0, + 0x25,0x9b,0xa4,0x10,0x9c,0x13,0x5a,0xb0,0xbe,0x2b,0xd1,0x9d,0xcc,0x39,0x90,0xf9, + 0x14,0x82,0xa1,0x3d,0x4c,0xbb,0x63,0x3f,0xa6,0x01,0x1e,0x2e,0xa4,0x7f,0xcc,0xc3, + 0xf9,0xbc,0x85,0xd2,0x59,0xf5,0x60,0x0c,0x5d,0x90,0x54,0x5c,0xcc,0x23,0xda,0x7c, + 0x5c,0x61,0x62,0x21,0x4e,0x42,0x39,0xfb,0x21,0xdb,0xb7,0xb9,0x63,0xfc,0x35,0x7c, + 0x78,0x60,0xec,0x08,0x32,0x36,0x46,0x10,0x44,0x75,0x8d,0x4d,0x8f,0x23,0x32,0x02, + 0x2f,0x04,0x25,0x27,0x61,0xf1,0xc3,0xb9,0x5c,0xc3,0xbc,0x8c,0xee,0x59,0xb8,0x87, + 0x59,0x13,0x59,0x66,0x6f,0x60,0xb6,0x59,0x32,0x09,0xa9,0x70,0xf8,0xd4,0xb7,0xef, + 0x76,0xf1,0x07,0xce,0x4b,0x01,0xa8,0xd8,0xcc,0xb2,0x7b,0xb3,0xba,0x05,0xeb,0x4a, + 0xae,0xd0,0x27,0x00,0x0d,0x13,0x48,0x29,0xea,0x10,0x95,0x99,0xeb,0xe2,0x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0xdb,0xda,0xe7,0x0f,0x35,0xf5,0x9c,0x4f,0x52, + 0x87,0x5e,0xdb,0xed,0x37,0x86,0x5c,0x04,0xf9,0x27,0x74,0x2a,0x20,0x85,0x86,0x77, + 0x11,0xf6,0x15,0x93,0x6b,0xec,0x4f,0xbb,0xab,0xf6,0x66,0xb6,0xa8,0x35,0xb3,0x59, + 0x62,0xdb,0x1d,0xff,0xa9,0xb0,0x53,0x75,0xae,0xa9,0xed,0x07,0xd2,0xa7,0x6a,0x42, + 0x2a,0x51,0x59,0x3c,0x7d,0x87,0xb4,0x75,0xba,0x80,0x75,0x1f,0xb3,0x7d,0xc1,0x96, + 0xad,0xd6,0xea,0x9f,0x99,0x27,0xdc,0xdb,0x09,0xcd,0x0a,0x9f,0x86,0x9c,0x25,0xf9, + 0xfe,0xec,0xc8,0xd0,0x6d,0xb3,0x32,0x01,0x2d,0x82,0x19,0x77,0xe9,0xd8,0x10,0x0d, + 0xbe,0xd5,0x11,0xd0,0xc6,0xc7,0x6a,0x4d,0x9f,0x63,0xd4,0xf8,0x4d,0x16,0x63,0x5f, + 0xb1,0x50,0x2e,0x35,0xa6,0x6f,0x87,0x0b,0x5e,0x73,0x01,0xda,0xb2,0x29,0x2b,0x7d, + 0x5d,0x2e,0x40,0xdd,0x9a,0xcf,0xa3,0x6a,0x8e,0x75,0x39,0xf9,0x3b,0x49,0xba,0x25, + 0x31,0x21,0xa5,0x60,0x97,0xdd,0x22,0x5d,0x60,0xdb,0x76,0x4b,0xa5,0x09,0x32,0xc5, + 0x6f,0x9d,0x56,0x86,0x48,0x12,0x11,0x76,0x84,0xb9,0x20,0xdd,0xfb,0x21,0x1f,0x94, + 0xf2,0x39,0xaf,0x50,0x36,0x96,0xa5,0xcc,0x40,0x60,0x21,0x21,0xe4,0x16,0x88,0x4f, + 0xb2,0xe4,0x69,0x1f,0x87,0xb9,0x75,0x81,0x3f,0x92,0x56,0x10,0x29,0x83,0x70,0xe8, + 0x46,0x5e,0x0c,0x78,0x2a,0x0d,0x1a,0x0f,0x3a,0x6e,0xda,0x47,0xd5,0x94,0x71,0x8a, + 0x81,0xe4,0xf2,0xa4,0x24,0xd1,0xfc,0x1c,0x3e,0x9f,0xf6,0x96,0xf3,0x3b,0x09,0xb4, + 0x38,0x9f,0xef,0x98,0xb4,0x9f,0xfb,0x80,0x7e,0xd5,0x41,0xf7,0x62,0x4c,0x56,0xf8, + 0x4b,0xe6,0x24,0xe2,0x76,0x4c,0x56,0x24,0x07,0x95,0x1d,0xa0,0x06,0x78,0xf7,0xf0, + 0x80,0xf1,0x5d,0x7d,0x2b,0x14,0x9a,0xcb,0x6c,0x0d,0x69,0x9b,0x9b,0xd6,0x5e,0xeb, + 0x36,0xe8,0x14,0x4f,0x33,0x5b,0xa7,0xc5,0x0e,0x70,0xd5,0xfc,0xae,0xb9,0xfd,0x2b, + 0x48,0x3c,0xa4,0x56,0x65,0xc1,0xa5,0x42,0x86,0x06,0x32,0xcd,0x8e,0xf9,0x28,0x54, + 0xce,0x65,0xfc,0x74,0xa4,0xb9,0xee,0x28,0xcc,0x07,0x3d,0x27,0x7a,0x63,0xba,0x85, + 0x1b,0x1f,0x71,0xb8,0x89,0x72,0xc1,0x58,0xe8,0x52,0xe7,0x48,0x93,0x6e,0x80,0x91, + 0x30,0xcd,0xe0,0x38,0x99,0x70,0x17,0x7c,0x12,0xc7,0x52,0x22,0x01,0x9f,0x93,0x72, + 0xe6,0x72,0x52,0xca,0xb3,0x3a,0xfa,0x6b,0x12,0x4a,0xad,0xaa,0x6e,0xfe,0x2e,0x47, + 0xa4,0xe6,0xa4,0xd4,0x9c,0x0a,0x36,0x23,0xa5,0x79,0xeb,0xf3,0x51,0x62,0xfe,0xf8, + 0x7d,0xd6,0x87,0x1b,0x65,0x8e,0xf5,0xf3,0xc5,0x65,0x47,0x17,0x54,0x28,0x72,0x84, + 0x7a,0xeb,0x72,0xa9,0xd4,0x5d,0xe0,0x3c,0xa8,0xe6,0x9c,0x35,0x8f,0xa3,0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x8a,0x39,0xf4,0x60,0xc7,0xc0,0x6d,0x3d,0xf3,0x89, + 0x02,0xc1,0xc0,0x99,0xcc,0x7f,0xe9,0x49,0x00,0xce,0x2a,0xcd,0x30,0xd8,0x20,0x6b, + 0x9f,0xac,0x23,0x1d,0x82,0xc9,0x92,0xcc,0x5c,0x3e,0x28,0x07,0x30,0x59,0x0d,0x1d, + 0x32,0x8c,0xbe,0x9a,0x5a,0x40,0xd6,0x22,0x26,0x16,0xc2,0x14,0x69,0x56,0x24,0x97, + 0x05,0xf0,0x36,0x59,0xa7,0xb8,0x79,0x62,0x4e,0x58,0xd8,0x01,0x8c,0x5b,0x8d,0x33, + 0x2a,0x58,0x7a,0xd6,0x5e,0x2e,0xff,0x68,0x8a,0xfc,0xfe,0xd0,0xdc,0x43,0x0a,0x4b, + 0x6b,0xcc,0xe9,0xcb,0x05,0xfd,0x7f,0xba,0xba,0x20,0x37,0xab,0xf1,0xa3,0x97,0x3f, + 0xac,0xda,0x57,0x93,0x47,0x0d,0xc5,0x31,0x5e,0x8c,0x59,0x95,0xf4,0x94,0xfe,0x11, + 0x05,0xea,0x1f,0x39,0xa8,0x98,0xb2,0x6c,0x35,0x4d,0x47,0x34,0x03,0x92,0xe8,0xcb, + 0x9e,0x90,0xb6,0x21,0x8a,0xab,0xf4,0x03,0x17,0x96,0x06,0x83,0xc9,0xd4,0x57,0xe6, + 0x9e,0xb5,0xd5,0x9e,0xd9,0xfb,0xca,0xbe,0x13,0x47,0x55,0x69,0xd2,0x49,0xce,0xeb, + 0x35,0x6b,0x77,0x89,0xf7,0x18,0x6b,0xe5,0x46,0x12,0x01,0xd0,0xf2,0x78,0x90,0xd9, + 0x80,0xea,0xfe,0xae,0xd3,0xe3,0xd3,0x77,0x74,0xf4,0x12,0xe6,0x7a,0xc9,0xdb,0x7a, + 0x78,0xb8,0x00,0xf3,0x9b,0x8d,0x22,0xdc,0x26,0x27,0xea,0x36,0xb3,0x9d,0x9e,0x0e, + 0xad,0xf6,0xa8,0xd3,0x5f,0xb7,0x09,0x09,0x40,0xc5,0x0d,0x45,0x07,0x2a,0xb6,0x42, + 0xf5,0xd4,0x68,0x15,0x5f,0xae,0xd7,0x3a,0x19,0xa8,0x36,0x8d,0xd5,0xc8,0x61,0x57, + 0x7e,0x8c,0x46,0xf6,0x75,0xba,0x52,0x34,0x3f,0x99,0xb7,0x4d,0x2e,0x5e,0xdd,0xe5, + 0xba,0xa0,0x3a,0xee,0xcd,0xd1,0xa1,0x7a,0x0a,0xef,0xba,0xea,0x80,0x80,0xc5,0xcf, + 0x7b,0x32,0xeb,0x1c,0x6d,0x5a,0xcc,0x61,0x09,0x8a,0xaa,0xc8,0x52,0x72,0x34,0xc6, + 0xd2,0xa9,0xc0,0xc3,0x22,0x34,0x13,0x9b,0xac,0xe0,0xe3,0xb3,0xa6,0x65,0x29,0x69, + 0x39,0x26,0x47,0x29,0x7a,0x9f,0xcc,0xbc,0x95,0x50,0xb4,0xcb,0xf9,0x30,0x67,0x58, + 0x9b,0xcf,0x7f,0xe6,0x78,0x07,0x9f,0xec,0x0c,0xe5,0xdb,0x33,0x9e,0x7d,0xf1,0xf8, + 0x89,0x15,0x90,0x48,0x29,0x1b,0x7b,0xc1,0xd1,0xbc,0x9c,0xf8,0xe6,0x32,0xcd,0xec, + 0xa4,0x19,0x71,0x99,0xff,0x92,0xe9,0x0a,0xcd,0x96,0xd8,0x21,0xae,0x70,0xc7,0xd0, + 0x21,0x00,0x61,0x52,0xa9,0x5e,0x63,0xb9,0xd9,0xd3,0x33,0x88,0x7b,0x96,0x8d,0x2f, + 0x8a,0x03,0xb3,0x3b,0xc5,0xf3,0x66,0x9e,0x10,0xf6,0xb9,0xda,0x68,0x92,0xe8,0x33, + 0x33,0xe1,0xbe,0xa2,0xed,0xe9,0xd6,0x18,0x27,0xae,0xe1,0x43,0x9c,0xf8,0x5d,0x31, + 0xc2,0x89,0x0b,0x5d,0x80,0x13,0x9c,0x44,0x21,0x21,0xcc,0xad,0x60,0x30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f,0x4e, + 0xa7,0xea,0xe0,0x58,0x45,0x48,0x28,0xb3,0x54,0x1b,0xee,0xe7,0xbe,0x9e,0x39,0x1a, + 0x93,0x5a,0xc4,0x60,0x1e,0xe3,0x8e,0x03,0xfa,0xc6,0x8d,0x44,0xb0,0x23,0xa6,0xba, + 0x50,0x95,0xf9,0x34,0xba,0xff,0x24,0xbe,0xad,0xbb,0x00,0xdf,0x76,0xf3,0x89,0xbd, + 0x21,0x42,0xa0,0xdf,0x11,0xa7,0x69,0x26,0xb8,0x52,0x01,0x9b,0xc1,0xce,0x3d,0x19, + 0x8d,0xb2,0xc9,0x7f,0x7c,0xa2,0x5a,0x63,0xda,0x66,0xb2,0x0a,0x70,0xc7,0x2c,0xee, + 0xab,0x20,0x53,0xc3,0x73,0x15,0x12,0xe6,0x35,0xb1,0x21,0x91,0xa3,0x91,0xbf,0x34, + 0x27,0x3c,0x30,0xec,0xc4,0x01,0x40,0x01,0xb2,0x1c,0xcc,0x35,0x23,0x40,0x7a,0x72, + 0xb2,0x1f,0x97,0xa9,0x29,0x8c,0xa4,0x93,0xad,0x5e,0x03,0x0a,0x95,0xa3,0xce,0x2e, + 0x71,0x69,0x2c,0x55,0xc0,0x02,0x42,0xed,0x41,0x50,0x9c,0xa5,0x6c,0xbf,0x5d,0xc6, + 0xf3,0x58,0x40,0x49,0x9b,0x00,0x43,0x8f,0x3a,0x6e,0x93,0x51,0x73,0x43,0x7a,0xf6, + 0xda,0x73,0xdc,0x5c,0x68,0x6f,0x74,0x6c,0x9d,0xfe,0x92,0xf9,0xee,0xf8,0x9f,0x5b, + 0xbf,0x15,0x5d,0xf4,0xcb,0xa7,0x0f,0x0f,0x22,0xbf,0x57,0xd6,0x74,0xb0,0xc0,0xb4, + 0x5e,0xeb,0xef,0xa3,0xc7,0x43,0xcd,0x1e,0x85,0x1a,0x44,0xaf,0x37,0xdd,0x5e,0xb3, + 0xe2,0x0d,0x2b,0xda,0x83,0xac,0xe2,0x7f,0x3e,0x97,0x75,0x2d,0x19,0x05,0xea,0x33, + 0x1d,0xfb,0x13,0x26,0xda,0xdf,0xde,0xdc,0x06,0xef,0x34,0x9d,0xa3,0x49,0x28,0x92, + 0x00,0x34,0xf0,0x33,0x13,0x80,0x9c,0xe2,0x0b,0x86,0x31,0xc9,0x65,0xa9,0xea,0x2e, + 0x7e,0xc8,0x2d,0x17,0xbf,0x8f,0x8b,0xc5,0xbf,0x64,0xa9,0xac,0xa4,0x2f,0x2f,0x57, + 0x42,0x5d,0x9b,0xd2,0xe7,0x08,0xa0,0x54,0x18,0x78,0x3c,0x3a,0x2c,0x7d,0x80,0x0d, + 0x88,0xfa,0x78,0xe2,0x76,0xf1,0xe8,0x76,0xa7,0xd3,0x35,0x9d,0x9e,0x33,0x99,0x3e, + 0x39,0x27,0xe4,0x50,0x4f,0x0d,0x10,0x22,0xab,0x5d,0x62,0x58,0x19,0xd6,0xc5,0x32, + 0x10,0xc8,0x93,0xb0,0x31,0x40,0x66,0x68,0xa6,0xcd,0x87,0x98,0xdb,0x4f,0x32,0xe9, + 0x21,0xb3,0x61,0xb2,0x59,0x03,0x19,0x0e,0x72,0x6f,0x98,0xe9,0xf4,0xe5,0xd1,0x2f, + 0xb5,0xa2,0x6a,0x93,0xaa,0x2b,0xb5,0x07,0x1b,0x53,0x9e,0xc3,0x3d,0x03,0x93,0xf1, + 0xfa,0x8f,0x86,0xa8,0xc8,0x65,0x04,0x17,0x57,0x33,0x42,0x71,0xd3,0x33,0xaa,0x24, + 0x97,0xc3,0xdb,0x9c,0xa0,0x3b,0x31,0x98,0x2c,0x4c,0xf8,0xec,0x0e,0x9a,0xd7,0x18, + 0xcf,0x0b,0x6b,0xc6,0xed,0x0e,0x6f,0xab,0x33,0xb7,0xbb,0x02,0xb5,0xa4,0x03,0xed, + 0x47,0xa1,0xdf,0xe8,0x1b,0x75,0x8a,0xf8,0xf2,0x1e,0xf3,0x33,0x34,0xcd,0x36,0xbc, + 0x45,0x36,0x06,0x8c,0x33,0x7e,0x91,0x4b,0xb1,0x6c,0xa7,0x29,0x6f,0x15,0x81,0x1c, + 0x04,0xa2,0xc9,0x67,0x93,0xf5,0x5b,0x42,0x73,0x20,0xa5,0xb8,0xb5,0x63,0x43,0x4c, + 0x37,0x29,0x7a,0x57,0x73,0x3f,0x29,0x6c,0x9a,0x70,0xb4,0xa4,0x31,0x56,0x7a,0x0c, + 0x53,0xde,0x0c,0xd2,0x46,0xd8,0x6e,0x0f,0x12,0x3c,0x0f,0xaf,0x91,0xe4,0x0e,0x50, + 0x83,0xf8,0x35,0x7f,0xfa,0xd2,0xe6,0x74,0x7e,0xd5,0x34,0x75,0x6b,0xbb,0x21,0x6f, + 0xfd,0x72,0x36,0x37,0xbb,0xe5,0x8f,0x68,0x77,0xcc,0xc5,0xf0,0xf6,0xd3,0xd9,0xbf, + 0x91,0x4a,0x62,0xfe,0x79,0x7c,0xf4,0xf9,0x90,0xb9,0x7f,0x51,0x18,0x3d,0x5d,0x61, + 0x79,0xb3,0xe9,0x09,0xb8,0x5e,0x2e,0x31,0x41,0x3e,0x6b,0xb2,0x0c,0x68,0xd7,0x91, + 0xf0,0x2c,0x64,0xf3,0x60,0x18,0xf2,0xdd,0xaa,0x0b,0xbf,0x25,0xd2,0x05,0x0f,0xfe, + 0x96,0x79,0x0f,0x4f,0x26,0x02,0x65,0xb3,0xb8,0x5b,0x12,0x0b,0x5a,0xa9,0xab,0xa8, + 0xd8,0xb2,0xe7,0x0a,0xd7,0xb5,0x69,0x77,0x58,0x4b,0xe4,0x67,0x90,0xa7,0xe9,0x6f, + 0x9a,0xe6,0x42,0x18,0xe3,0x30,0x91,0x7e,0x0b,0x7f,0x30,0xc6,0x03,0xd2,0x3f,0x04, + 0x5c,0x54,0xae,0x5f,0x57,0x53,0x4e,0x0b,0xc1,0x63,0x10,0xfb,0x67,0xbc,0xd8,0x05, + 0xa5,0x50,0xbc,0x35,0x8b,0x05,0x57,0xf0,0x49,0x2c,0x76,0xd3,0x86,0x24,0x03,0x48, + 0xb4,0xd9,0x99,0x33,0x34,0xcb,0x98,0xd4,0xb5,0x04,0x16,0xaa,0x20,0x4c,0xc1,0x35, + 0xc7,0xeb,0x08,0xeb,0x2e,0x34,0xdf,0x80,0x83,0xb7,0xeb,0x89,0xfc,0xd8,0x06,0x31, + 0x71,0x81,0xc1,0x3e,0xfb,0xa6,0xe2,0xdf,0x03,0xa7,0x3f,0x6b,0x82,0x70,0x46,0x07, + 0xf4,0x47,0xe9,0xda,0xd0,0x82,0x80,0xce,0x3d,0xb0,0x7b,0xc8,0x16,0xa3,0x83,0x28, + 0xef,0x1f,0x4d,0x05,0xc1,0x53,0x2c,0x38,0x6a,0x29,0xe1,0xd4,0x9e,0xdd,0x44,0xb8, + 0x9d,0x25,0x20,0x00,0xd5,0x59,0xb8,0x72,0x57,0x41,0x77,0xd8,0x0a,0xd0,0xce,0xdd, + 0xc8,0x6a,0x41,0xb7,0xbd,0x58,0x85,0x5b,0x72,0x9d,0xb7,0x96,0xcd,0xe7,0xdf,0x77, + 0x22,0xe2,0xf1,0x16,0x5d,0x51,0xbc,0xeb,0x21,0x31,0xad,0x1c,0x25,0xc3,0x41,0xac, + 0x8a,0xf7,0x66,0xf2,0x0b,0xf3,0x35,0x34,0xb7,0x12,0xb2,0x92,0x80,0x13,0x53,0x5f, + 0x76,0xa3,0xb3,0x77,0x85,0x50,0xc5,0x83,0xf7,0x10,0x63,0xde,0x9c,0x9c,0x9c,0x27, + 0xaa,0x02,0x6e,0xbd,0xce,0x34,0x71,0xb7,0x88,0x69,0x3a,0xc5,0xbc,0xd2,0xf8,0xe9, + 0x0e,0x73,0x9a,0x8e,0xce,0x74,0x24,0x2b,0x92,0xb9,0xdb,0x70,0x31,0xef,0x7a,0xad, + 0xed,0xf2,0xea,0xd3,0x9b,0x9e,0x59,0xa1,0x19,0x5c,0x7e,0xf9,0x39,0xad,0x01,0xdd, + 0x55,0x3a,0x65,0x0f,0xf8,0x17,0x24,0x0c,0x3f,0xbb,0x1a,0x1f,0x36,0x4e,0xb6,0x43, + 0xba,0x3e,0xf4,0x44,0xd9,0x9b,0x2c,0xca,0xa1,0xb0,0x88,0x70,0x28,0xce,0x21,0x9a, + 0x16,0xc6,0xa1,0x52,0x61,0x32,0x58,0x2d,0x66,0xa6,0x94,0x4b,0x2d,0xca,0x4a,0x7f, + 0x61,0x28,0xc7,0x7b,0xc0,0xc4,0x13,0x58,0xba,0x27,0x5f,0x25,0xdc,0x99,0x6f,0x63, + 0x62,0x6b,0xa7,0x29,0xb5,0x4c,0x47,0x87,0x9c,0x97,0xcd,0xdb,0x40,0x4e,0xc8,0xaa, + 0xf5,0x67,0xf5,0x08,0xee,0x73,0x9b,0x0d,0xf9,0x30,0x15,0x61,0xdd,0x2e,0x64,0xb4, + 0x97,0x5f,0x6d,0xd2,0xb9,0x66,0x96,0x3c,0xe6,0x2e,0x88,0xd8,0x1c,0xf4,0x7a,0x2d, + 0xfb,0xd7,0x27,0xf1,0x5a,0xf6,0x70,0x7d,0xf5,0xee,0xe1,0x57,0x84,0x53,0xef,0x68, + 0xd9,0xcf,0x3a,0x09,0x8d,0x26,0x83,0x93,0x94,0x8e,0xd3,0x0e,0x98,0x86,0xf4,0x0e, + 0x7d,0xae,0xbf,0x8d,0x8e,0x5d,0xa1,0x17,0xf5,0x7d,0xf5,0x02,0x20,0xc9,0x01,0x35, + 0x6e,0x0b,0x70,0x12,0xe2,0x5f,0x15,0x6f,0x59,0x91,0x29,0x12,0x55,0x3d,0x27,0x19, + 0xba,0xf8,0x73,0xcb,0xf3,0xca,0x81,0x28,0x34,0xb9,0x90,0x42,0x84,0x05,0x39,0xe3, + 0xe8,0xd8,0x69,0x18,0x86,0x96,0xff,0x54,0xbb,0x3b,0x4c,0xb6,0xc9,0xec,0x54,0xef, + 0x05,0x9f,0xe6,0x07,0xcc,0x16,0x70,0x97,0xa3,0x71,0x56,0xb1,0x81,0x07,0x08,0x9e, + 0x9b,0xd9,0xc1,0x7b,0x55,0xf1,0x61,0xe6,0x84,0x0e,0xf4,0xb7,0xc9,0xe5,0x95,0x7d, + 0xce,0x1c,0xed,0x4f,0x5b,0x30,0x9c,0xfe,0x00,0x6f,0x77,0x3e,0x9e,0xb4,0xf9,0xd1, + 0xc8,0x9c,0x54,0x19,0x33,0x76,0x93,0x51,0x32,0xf2,0xc2,0xf7,0xe5,0xaa,0x52,0x83, + 0xb8,0x02,0x2a,0xca,0xfc,0x27,0x30,0x26,0x13,0x9d,0xa3,0xad,0x2f,0x82,0x43,0x2f, + 0x96,0x85,0x30,0x4b,0xa1,0xe3,0x94,0x14,0xdc,0x04,0xdb,0x52,0x28,0xa0,0x2a,0x03, + 0x3b,0xf4,0x01,0x72,0x1f,0x3d,0x5b,0xe0,0xc3,0xe4,0xea,0x5a,0xbd,0xba,0x1a,0x4e, + 0x7b,0x1d,0xc9,0x3f,0x7b,0x12,0x74,0xf1,0x27,0x0c,0xf6,0xf6,0x2c,0x18,0x90,0xfd, + 0x8c,0x12,0x2e,0x43,0xa3,0x64,0xec,0xcb,0x8c,0x86,0x4d,0xe9,0x50,0xb2,0xb4,0x68, + 0x59,0x57,0x77,0xe8,0x33,0x5d,0xe1,0x6b,0x2a,0x2e,0xd3,0xd6,0x8d,0x3b,0x63,0xc7, + 0x39,0x44,0x9f,0xb6,0x28,0x31,0x26,0x73,0x33,0x6f,0x38,0x79,0xed,0xb0,0xd8,0xe7, + 0xa6,0x67,0xea,0x64,0x30,0x32,0xd4,0x7b,0xd8,0x6b,0xea,0x9a,0x6f,0x15,0x46,0x6a, + 0xa5,0xaf,0x27,0xd7,0xfc,0xc6,0xed,0x39,0xf3,0xb2,0x8e,0x46,0x95,0xf8,0xca,0xdd, + 0x75,0x2e,0xda,0xaa,0x57,0xbc,0xb8,0x58,0xa9,0xfb,0xd7,0xbd,0x40,0x5b,0x05,0xe5, + 0x8b,0x7d,0xf5,0xf3,0x6a,0x5f,0x54,0x6d,0x26,0x9e,0x06,0x56,0x0b,0x53,0xd1,0xc3, + 0x0c,0xa6,0xce,0x6f,0x37,0x0c,0x46,0xd5,0x31,0x8c,0x32,0xae,0xb9,0x55,0x74,0x4f, + 0x2d,0x2a,0x63,0xd4,0x07,0xdd,0xab,0x58,0xf4,0xb5,0xd7,0xb3,0x68,0x49,0x59,0xd9, + 0xb2,0x9b,0x7b,0xb9,0xd7,0x1c,0x70,0x7f,0x91,0x97,0xd3,0xad,0xdf,0x4d,0x62,0x71, + 0x91,0x7a,0x70,0x95,0xdc,0x3e,0xe1,0x36,0xbe,0xf2,0xce,0x79,0x3d,0x4d,0xb3,0x2d, + 0xfa,0x80,0xe0,0x42,0x04,0x69,0xf2,0x02,0x48,0x3e,0xcf,0x89,0x94,0xc2,0x09,0xe4, + 0x60,0x6c,0x1c,0x2f,0xa4,0xc0,0xf8,0x5d,0x34,0xa1,0x8d,0xaf,0x54,0x45,0x8a,0xbc, + 0x00,0x8f,0xb4,0x72,0xaa,0x16,0xbd,0x4f,0x3d,0x88,0x0e,0x68,0x2f,0x3d,0xc8,0xdf, + 0x54,0x13,0xf2,0x8d,0xa4,0xf2,0x87,0x33,0x35,0xaa,0xec,0x9a,0xf0,0x13,0x74,0xd4, + 0x8e,0xfa,0x8e,0xe9,0x3e,0xb7,0xa9,0x40,0x9c,0x03,0x57,0x3d,0xa1,0xe7,0x37,0x03, + 0x7d,0x88,0x6b,0x29,0xcb,0x61,0x16,0xe8,0x9a,0xba,0xec,0xc7,0xa9,0x3a,0x8d,0x79, + 0x25,0xa0,0xb7,0x17,0x2a,0xc1,0x3e,0xfa,0xac,0x40,0xc4,0xc1,0x45,0x67,0x2b,0x57, + 0x22,0x03,0xe8,0x86,0x91,0x94,0xb3,0x4d,0x2f,0x11,0xfe,0xf1,0x9a,0x8d,0xaf,0xda, + 0x90,0xbb,0x1a,0x46,0x87,0xb0,0xff,0x31,0x97,0x5d,0xa0,0xbd,0x92,0xfd,0xc9,0x17, + 0xdb,0xa3,0xb0,0x13,0x9a,0x68,0x92,0xfd,0x99,0xb3,0xb2,0xec,0x28,0xc3,0xec,0x22, + 0xfc,0x64,0xd0,0xdb,0xcd,0x4c,0x00,0x17,0xab,0xee,0x30,0xfe,0xec,0x54,0x87,0x98, + 0xf6,0x46,0xfa,0xd4,0xc9,0xbf,0xc3,0x93,0xd1,0x47,0x08,0x55,0x3c,0xcc,0xf3,0xc1, + 0x43,0xde,0x9d,0xb0,0xee,0x0c,0x87,0xca,0x35,0x37,0x2f,0x54,0xdb,0xdf,0xd9,0xcb, + 0x7d,0x5b,0x77,0xf9,0x1a,0x8e,0x41,0x88,0x6f,0x7e,0x14,0x52,0x64,0x93,0x8a,0xf1, + 0xb0,0x34,0x99,0x18,0x9e,0xea,0x51,0x45,0xbe,0x4a,0xde,0x7e,0x1b,0x73,0x0c,0x00, + 0x0f,0x2a,0x5e,0x76,0x95,0x88,0xaa,0xd2,0xbe,0xd9,0x9a,0x73,0xc4,0xa0,0x42,0x69, + 0xa7,0x38,0x24,0x5a,0xaf,0xb3,0xfc,0xa1,0x39,0x85,0xe7,0xee,0x0b,0x1c,0x7b,0x75, + 0xb7,0x21,0x3b,0xba,0xd0,0x24,0xb8,0xdd,0x0e,0x1d,0x89,0x4c,0x2b,0xce,0x9b,0x68, + 0x98,0x8d,0x84,0x86,0xab,0x59,0x74,0x70,0xb4,0xba,0x3d,0x08,0x83,0xb9,0x34,0xe6, + 0xa5,0xa7,0x7b,0xe7,0x7d,0xb3,0xfe,0x43,0xf7,0xbf,0x6d,0x81,0xf4,0x15,0x14,0x8c, + 0x20,0x87,0x5e,0x43,0xfc,0x74,0x55,0x41,0x49,0xe8,0xc2,0xd1,0x2d,0x72,0x19,0x74, + 0x8b,0xde,0x33,0x0a,0x4d,0xc1,0xcf,0xa9,0xc9,0xf8,0x24,0xb8,0x2e,0xdf,0xd9,0x29, + 0xe1,0xee,0x87,0x4c,0xdc,0xdd,0x9b,0x43,0x86,0xe0,0x45,0x00,0x3f,0xcb,0x96,0x99, + 0x57,0x48,0x4d,0x7b,0x7a,0xcc,0xd1,0x4e,0x8b,0xc3,0xce,0xe6,0x09,0xd0,0x4d,0xb0, + 0x64,0x81,0xa4,0x90,0xb5,0x60,0x28,0xa6,0x88,0x43,0x05,0xfb,0x52,0xf0,0xbf,0xe6, + 0x3e,0x4a,0x77,0x40,0xfe,0x82,0xaa,0x5f,0xea,0x7d,0x94,0x3d,0x1f,0xf0,0x9b,0xaf, + 0x73,0xda,0x0e,0xee,0x5b,0xf8,0xfe,0xfa,0x92,0x2a,0x9c,0x70,0x06,0x4b,0x67,0xa3, + 0x57,0x45,0x07,0xde,0x5b,0x65,0xc6,0xb1,0x2a,0x38,0xb0,0x57,0x75,0x83,0x22,0x3b, + 0x95,0xdc,0xf6,0xb6,0x3c,0x27,0xa4,0x38,0xfb,0x33,0x14,0x27,0x2b,0xa3,0x95,0x63, + 0xae,0xa4,0xac,0x3e,0x99,0xfe,0xb4,0x9b,0x5c,0xb5,0x22,0x96,0x8c,0xb1,0x86,0xe4, + 0x78,0x78,0x50,0xd7,0xb5,0x23,0x98,0x00,0x06,0xca,0x38,0x99,0xd7,0x90,0xec,0xb0, + 0x77,0x64,0x35,0x7e,0x13,0x2d,0xfa,0xb2,0x26,0x56,0x17,0xa1,0xf6,0x25,0x34,0x93, + 0x31,0x0b,0xec,0xba,0xe1,0x6f,0xf2,0x41,0xed,0xf7,0xab,0xa0,0xc9,0xeb,0x64,0x6e, + 0xff,0xba,0x6d,0x8f,0x9c,0x08,0x4e,0x73,0x92,0x3b,0x3d,0x85,0x2d,0xd0,0x2a,0x3f, + 0xf5,0xc1,0x89,0x1c,0x38,0x73,0x0f,0xaf,0x67,0x54,0xf6,0x4a,0xfe,0x23,0x10,0x7d, + 0xfa,0x1f,0x38,0x08,0x2a,0x9b,0x7b,0x01,0x27,0xd5,0xd5,0x1d,0x8e,0xc1,0x6d,0x59, + 0x82,0x30,0x2c,0x97,0x27,0xc8,0xcd,0x60,0x61,0xb4,0x48,0xdd,0x33,0xab,0xb2,0x73, + 0xa8,0xb8,0x0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5,0xdc,0x97,0x28,0xbf,0xd3, + 0x07,0x65,0x37,0x37,0x5a,0xd7,0xf2,0xdf,0x10,0x47,0x94,0xc8,0x31,0x44,0xb4,0x84, + 0x0a,0x69,0x5f,0x99,0xd1,0xd1,0x22,0xe9,0x22,0x07,0x99,0xff,0xe6,0x78,0x0e,0x00, + 0xf2,0xf8,0x9f,0x11,0x13,0x13,0xb4,0x8c,0x93,0x0c,0xf6,0x78,0x1c,0x42,0x92,0xaf, + 0x9c,0xb6,0x22,0xee,0xc0,0x86,0xf1,0x5a,0x92,0xcb,0xd2,0xfd,0x1f,0x2b,0xbe,0xa8, + 0x93,0x82,0xb9,0xff,0x40,0x87,0x08,0x47,0xf6,0xc5,0xfc,0x88,0xb4,0xd1,0xdf,0x13, + 0x4e,0x88,0xaa,0x13,0xd7,0x63,0x2e,0xe9,0xc0,0xe1,0x60,0xf5,0xd3,0xf3,0x0f,0xd3, + 0x1e,0xd6,0xb3,0x03,0xb4,0xcd,0xf7,0x68,0x7f,0xe4,0x96,0x28,0x43,0xc4,0x1f,0x97, + 0x7f,0x16,0xa0,0x97,0x84,0x5d,0x4b,0xce,0x51,0xab,0x58,0x04,0x48,0x04,0x3a,0xde, + 0x7c,0xde,0xd3,0x95,0x69,0xd2,0xf3,0x13,0x15,0xd2,0x64,0x00,0x74,0xac,0xd1,0xac, + 0xb0,0x76,0x27,0x34,0x19,0x6d,0xec,0xea,0xfa,0x0d,0x9d,0x31,0xa1,0x8d,0x47,0xdf, + 0x09,0x17,0xce,0x9f,0xf2,0x60,0xe5,0xe7,0xf4,0xe2,0x92,0xff,0x12,0x9e,0xbd,0x5b, + 0x12,0x4a,0xd2,0x29,0xe9,0xe6,0xc7,0x07,0xdf,0x20,0x0f,0x14,0x37,0xa7,0x19,0x7b, + 0x64,0x81,0x0f,0x67,0xf6,0xbe,0x67,0x5e,0xa8,0x13,0xc9,0x7e,0x5f,0x4a,0x59,0x53, + 0xc8,0xc0,0xc4,0x3c,0x81,0x7d,0xab,0x4c,0xd2,0x73,0x89,0xca,0x17,0xfe,0xc8,0x64, + 0xa9,0x52,0x76,0x89,0x6f,0x2e,0xef,0x33,0x0f,0xd2,0xdb,0xfe,0x4a,0x6a,0x16,0xfe, + 0xfa,0xdf,0x1a,0x45,0xe2,0xde,0x41,0xdf,0x04,0x66,0x98,0x15,0xbd,0xd7,0xcc,0x48, + 0x60,0x88,0xd9,0x8e,0x61,0xe0,0xae,0x67,0xc3,0x1b,0xb9,0xf9,0x63,0xf7,0xfe,0x39, + 0x93,0xf4,0xb1,0x9c,0x0f,0x8a,0x7a,0xba,0xb2,0xf4,0x9a,0x29,0x36,0x35,0x77,0x4e, + 0x96,0x00,0xed,0x9c,0xe8,0x16,0x88,0x93,0x7f,0xfb,0x90,0x7b,0xf1,0x50,0xca,0xc8, + 0x53,0xf3,0xe4,0x4d,0x48,0x2a,0xfb,0xc5,0x47,0xf4,0x73,0x54,0xc5,0xdf,0x90,0x78, + 0x77,0xc2,0x5c,0x8d,0x87,0xe3,0x1a,0x6b,0xdc,0xa8,0xd0,0x1f,0x74,0x71,0x5b,0x2b, + 0xf6,0xbb,0xf8,0x11,0x6b,0x80,0x29,0x9f,0xc5,0xbd,0xe0,0x65,0x8c,0x01,0x71,0xb9, + 0x0a,0xc0,0x5d,0x27,0x48,0xbb,0x8a,0xa9,0x4e,0x4b,0xb8,0x63,0x88,0xac,0x0e,0x4b, + 0x07,0x9f,0x61,0xbe,0xe3,0x9d,0x1b,0x37,0x3c,0x45,0x9d,0x9b,0x2a,0x13,0x38,0x83, + 0xfe,0x39,0x78,0x36,0x42,0xc5,0x97,0x84,0x90,0xc1,0x97,0x12,0x5a,0xa8,0xaa,0x1f, + 0x83,0xcb,0xe2,0x9f,0xe2,0x0e,0x20,0x86,0x66,0xbb,0x71,0xc6,0x36,0xec,0xad,0x31, + 0x11,0x10,0x4d,0x33,0xf6,0x7f,0x0d,0xd6,0xcd,0x7e,0xa4,0x42,0xb7,0x67,0x08,0x9e, + 0x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x03,0x04,0x5f,0xb2,0xd7,0x9e,0x18,0x26,0x0a,0x55,0x4d,0x65,0x69,0x1f, + 0xf8,0xa6,0xf8,0x03,0x4d,0xe6,0xb9,0x97,0x07,0x4e,0x39,0x1f,0x68,0x3e,0x18,0xbf, + 0x32,0xea,0xdd,0x37,0x66,0x2e,0xc3,0x51,0x5e,0xa5,0xef,0xb7,0xa8,0xf3,0x91,0x9b, + 0xe1,0x39,0xbf,0x59,0xdd,0x5c,0xa2,0x6e,0x7e,0xcf,0xa2,0x70,0xef,0x8d,0xeb,0x16, + 0x64,0xef,0xed,0x9b,0x75,0x39,0xda,0x3a,0x17,0xd8,0xc8,0xd9,0x0e,0xe7,0x3c,0x55, + 0xf3,0x23,0xbd,0xdb,0xa6,0x2e,0x67,0x78,0x55,0x26,0xc1,0x7b,0x95,0xe8,0x9b,0xfd, + 0x18,0x06,0xfd,0xa6,0xca,0x36,0xe8,0xc8,0x3c,0xef,0xa0,0xab,0x73,0x8f,0xe7,0xbb, + 0x77,0xf8,0xa8,0x6f,0x53,0x7f,0xc6,0xd7,0x77,0x07,0x60,0x37,0x7e,0xdb,0xe6,0x2d, + 0x5b,0x3c,0xda,0x7a,0x2f,0x76,0x23,0x77,0xde,0x48,0xbf,0x1b,0xcd,0x63,0x1b,0xe8, + 0xde,0xa0,0xcb,0xe4,0xd9,0x9b,0xa4,0x6a,0x90,0xbd,0x25,0x31,0x0b,0xf4,0x0d,0xf1, + 0xe7,0x7c,0x37,0x38,0xee,0x41,0x7a,0x48,0x88,0xfc,0x71,0x17,0x5c,0xc8,0xa2,0x82, + 0x83,0x29,0xb7,0x58,0x45,0xf7,0xde,0x5a,0x5f,0xf1,0x49,0x7f,0x07,0x59,0xd0,0xaf, + 0xca,0x7d,0x06,0xfc,0x78,0xc3,0xc1,0xbe,0xf0,0x39,0x98,0x26,0x6c,0x9b,0xe6,0x1d, + 0xcf,0x2b,0x73,0x73,0x4b,0x19,0xd8,0x6e,0xc7,0x80,0xf1,0xf9,0x33,0xa7,0xc0,0x36, + 0xb2,0x6f,0x49,0x7e,0x96,0xdc,0x13,0x48,0xed,0x20,0x20,0x97,0x28,0x7d,0x95,0xca, + 0xbb,0xcb,0x10,0x09,0xb8,0xdd,0x4c,0xbb,0xd3,0x78,0x58,0xe9,0x06,0x57,0xc5,0x67, + 0x69,0xba,0xeb,0x9a,0x1b,0xd1,0x16,0x72,0x9e,0x27,0xe5,0xfb,0x8e,0x4a,0x3d,0x03, + 0x1c,0x3a,0xd4,0x46,0x37,0x1e,0xde,0x5e,0xb4,0x5e,0x0f,0x2f,0x2e,0x6a,0x6a,0x2e, + 0x9d,0xf2,0x49,0xcc,0xdf,0x56,0x4c,0x7b,0x26,0x75,0x9c,0x31,0x7d,0xcb,0x95,0xf3, + 0x59,0xb2,0x38,0x73,0x22,0x6e,0xbc,0x7f,0xb0,0x8d,0xb9,0x86,0xfb,0x1b,0x8a,0x31, + 0x10,0x3d,0xb6,0xe8,0x59,0x2e,0xb7,0xc5,0x60,0xf4,0x3d,0x3d,0x87,0x57,0xaf,0xc4, + 0x64,0xe0,0xef,0x95,0xac,0xab,0x61,0xfd,0x15,0x88,0x7a,0x66,0xf9,0x2b,0xc4,0xf3, + 0xb0,0xf4,0xf4,0x2b,0x03,0xcb,0x2f,0x3c,0x5a,0x28,0x5f,0xb6,0x89,0xe7,0x0e,0xcf, + 0x18,0xf4,0x9d,0x4f,0x4d,0x77,0x79,0x68,0xee,0xbc,0xba,0x55,0x74,0xdc,0x87,0xa0, + 0xca,0x07,0x75,0x72,0xea,0x60,0x2b,0x31,0xad,0xc3,0xae,0x93,0x52,0x77,0xdd,0x1b, + 0x8f,0xb7,0x06,0xd9,0x5f,0x57,0x57,0x06,0xeb,0xaf,0xef,0xad,0x73,0x11,0xc9,0x15, + 0x77,0xf6,0x4e,0x2d,0xbb,0x3b,0x1e,0xd8,0x5a,0xb8,0x01,0x78,0xb8,0x28,0xae,0x17, + 0xd4,0x74,0x75,0x60,0xa6,0x3d,0x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0x41, + 0x00,0xf2,0xac,0x92,0xd1,0x75,0x7e,0x6a,0xda,0xd8,0xd5,0x2e,0xfe,0xb9,0x45,0xc3, + 0x80,0xe2,0x5c,0x18,0x52,0x57,0x1b,0xcd,0x26,0xe0,0x22,0x78,0x8f,0xf3,0x66,0x66, + 0x8f,0x2e,0xb7,0xdb,0x6c,0xce,0x11,0xd6,0x8e,0x76,0xa9,0x9d,0x31,0x4e,0x12,0xb6, + 0xcd,0xe1,0x19,0x25,0xee,0x6c,0xc6,0x93,0x4d,0x0a,0x09,0x77,0x94,0x47,0x84,0x2f, + 0x73,0x98,0x48,0x49,0xf4,0xfa,0xf0,0xf1,0x04,0x8c,0xf3,0x83,0x75,0x41,0xe7,0xfd, + 0xca,0x44,0x30,0x78,0xa2,0x71,0xee,0x3e,0x73,0x9b,0xe1,0x38,0xc3,0xa2,0xf3,0x88, + 0x71,0xc5,0x5b,0x0d,0xfb,0x74,0xc0,0xb0,0x47,0xe1,0x25,0x4d,0xcd,0xb8,0x3f,0xb4, + 0xa3,0x7d,0xb4,0xb1,0xd6,0xd8,0x2c,0x03,0xab,0x55,0x47,0xa3,0xde,0xa3,0x66,0x34, + 0xd2,0x84,0xec,0xfc,0x5a,0x89,0xf2,0x19,0xc5,0x4b,0x6f,0x22,0x7a,0x9a,0xb2,0x04, + 0x77,0xdb,0x3e,0xfe,0x82,0xf2,0xd9,0x50,0xcf,0xbc,0x1d,0x34,0x7f,0xbf,0xff,0xd1, + 0xa3,0xd5,0xdb,0x4b,0x72,0xfd,0x7e,0x7a,0xf4,0x88,0x51,0x97,0xfe,0xbc,0xbf,0xfa, + 0x78,0xf6,0xf4,0xff,0x01,0xa1,0x87,0x83,0x22,0xab,0xff,0x00,0x00, +}; diff --git a/src/helpers/esp32/WebConfigServer.cpp b/src/helpers/esp32/WebConfigServer.cpp index 7951ca817..185eb2014 100644 --- a/src/helpers/esp32/WebConfigServer.cpp +++ b/src/helpers/esp32/WebConfigServer.cpp @@ -33,7 +33,6 @@ static_assert(sizeof(WEBCONFIG_AP_PREFIX) <= 28, #endif #include "WebConfigHtml.h" -#include "RoomWebHtml.h" #include #include #include "WebTerminalStream.h" @@ -1947,16 +1946,35 @@ static bool roomRequestIdentity(AsyncWebServerRequest* req, uint8_t (&token)[32] && sequence != 0; } +static bool webConfigClientAcceptsGzip(AsyncWebServerRequest* req) { + return req && mesh::http::acceptsGzip(req->hasHeader("Accept-Encoding") + ? req->getHeader("Accept-Encoding")->value().c_str() : nullptr); +} + +static void webConfigRejectEncoding(AsyncWebServerRequest* req) { + AsyncWebServerResponse* res = req->beginResponse( + 406, "text/plain", "WebConfig requires gzip support"); + res->addHeader("Vary", "Accept-Encoding"); + res->addHeader("Cache-Control", "no-store"); + req->send(res); +} + void WebConfigServer::handleRoomPage(AsyncWebServerRequest* req) { if (_mode == MODE_OFF || !_cb || !_cb->supportsRoomService()) { req->send(404); return; } _last_activity = millis(); noteNetworkActivity(); + if (!webConfigClientAcceptsGzip(req)) { webConfigRejectEncoding(req); return; } + size_t page_length = 0; + const uint8_t* page = _cb->roomPageGzip(page_length); + if (!page || !page_length) { req->send(503); return; } auto* response = new (std::nothrow) WebConfigPacedProgmemResponse( - "text/html; charset=utf-8", reinterpret_cast(ROOM_WEB_HTML), sizeof(ROOM_WEB_HTML) - 1); + "text/html; charset=utf-8", page, page_length); if (!response) { req->send(503); return; } response->addHeader("Cache-Control", "no-store"); response->addHeader("X-Content-Type-Options", "nosniff"); response->addHeader("Referrer-Policy", "no-referrer"); + response->addHeader("Content-Encoding", "gzip"); + response->addHeader("Vary", "Accept-Encoding"); req->send(response); } @@ -2139,19 +2157,6 @@ bool WebConfigServer::resultReceiptAllowedLocked(AsyncWebServerRequest* req, // Handlers (async_tcp task - no CLI/prefs writes, no radio access) // --------------------------------------------------------------------------- -static bool webConfigClientAcceptsGzip(AsyncWebServerRequest* req) { - return req && mesh::http::acceptsGzip(req->hasHeader("Accept-Encoding") - ? req->getHeader("Accept-Encoding")->value().c_str() : nullptr); -} - -static void webConfigRejectEncoding(AsyncWebServerRequest* req) { - AsyncWebServerResponse* res = req->beginResponse( - 406, "text/plain", "WebConfig requires gzip support"); - res->addHeader("Vary", "Accept-Encoding"); - res->addHeader("Cache-Control", "no-store"); - req->send(res); -} - void WebConfigServer::handleRoot(AsyncWebServerRequest* req) { if (_mode == MODE_OFF) { req->send(503); return; } _last_activity = millis(); diff --git a/src/helpers/esp32/WebConfigServer.h b/src/helpers/esp32/WebConfigServer.h index 2bb30cad0..5a25a82d2 100644 --- a/src/helpers/esp32/WebConfigServer.h +++ b/src/helpers/esp32/WebConfigServer.h @@ -175,6 +175,12 @@ public: // Teardown finished (server + DNS freed, WiFi mode restored). virtual void onWebConfigStopped() {} virtual bool supportsRoomService() const { return false; } + // The role owns its page resource. Keeping it out of this shared server + // lets repeaters/companions omit the Room UI without disabling a feature. + virtual const uint8_t* roomPageGzip(size_t& length) const { + length = 0; + return nullptr; + } // Input may be parsed in place. Authentication, storage and radio work // happen only on tick(), never on async_tcp. virtual void processRoomRequest(const uint8_t* token, uint32_t sequence, diff --git a/test/fixtures/neighbor_scope_lifecycle.cpp b/test/fixtures/neighbor_scope_lifecycle.cpp new file mode 100644 index 000000000..d9de220f0 --- /dev/null +++ b/test/fixtures/neighbor_scope_lifecycle.cpp @@ -0,0 +1,282 @@ +#ifdef TEST_PSRAM +#define BOARD_HAS_PSRAM 1 +#endif +#define MAX_NEIGHBOURS 254 +#define PUB_KEY_SIZE 32 +#define MAX_CLIENTS 32 +#define PATH_HASH_SIZE 1 +#define WITH_MQTT_NEIGHBORS 1 +#define MESH_DEBUG_PRINTLN(...) ((void)0) +#define PERM_ACL_ROLE_MASK 3 +#define PERM_ACL_GUEST 0 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +namespace mesh { +struct Identity { + uint8_t pub_key[32]; +@HASH_MATCH@ +}; +struct LocalIdentity : Identity { + mutable unsigned derivations=0; + // A deterministic crypto dependency records which immutable key the real + // getPeerSharedSecret body selected; this is a routing test, not an ECDH test. + void calcSharedSecret(uint8_t* out,const Identity& other) const { + ++derivations; + for(size_t i=0;i<32;++i) out[i]=uint8_t(other.pub_key[i]^0xA5); + } +}; +struct Packet {}; +struct Utils { + static void toHex(char* out, const uint8_t* key, size_t size) { + for (size_t i=0;i clients; + ClientInfo* getClient(const uint8_t* key,size_t size) { + for(auto& client:clients) if(!memcmp(key,client.id.pub_key,size)) return &client; + return nullptr; + } + int getNumClients() const { return int(clients.size()); } + ClientInfo* getClientByIdx(int i) { return &clients.at(size_t(i)); } +}; +struct GuestLogin { bool value=false; bool enabled() const { return value; } }; +struct NeighbourInfo { mesh::Identity id; uint32_t heard_timestamp; int8_t snr; int16_t rssi; }; +static bool fail_scratch=false, fail_json=false; +static unsigned allocation=0; +static void* neighborsAlloc(size_t size) { + ++allocation; + if (!size || (allocation==1 && fail_scratch) || (allocation==2 && fail_json)) return nullptr; + return malloc(size); +} +static void neighborsFree(void* ptr) { free(ptr); } +static uint32_t futureMillis(uint32_t value) { return value+10; } +static bool millisHasNowPassed(uint32_t) { return true; } +static const uint32_t NEIGHBOR_DISCOVER_QUEUE_TIMEOUT_MS=100; +@HELPERS@ +struct MyMesh { + enum { ND_UNSENT, ND_QUEUED, ND_PENDING, ND_RESPONDED, ND_TIMEOUT, ND_SEND_FAILED }; +@LAYOUT@ +@STATE@ +}; +struct LegacyMesh { + enum { ND_UNSENT, ND_QUEUED, ND_PENDING, ND_RESPONDED, ND_TIMEOUT, ND_SEND_FAILED }; +@LEGACY_LAYOUT@ +@STATE@ +}; +@METHODS@ +@LEGACY_METHODS@ +template std::string runPass(Mesh& m,int count,int result,size_t scope,bool admission=true) { + m.admit=admission; + m.requested=0; + m.touched=0; + m.mock_bridge.last_json.clear(); + memset(m.neighbours,0,sizeof(m.neighbours)); + for (int i=0;i(m.neighbor_discover_scopes)[i]==0); + } + int steps=0; + while(m.neighbor_discover_active) { + assert(++steps<1024); + auto& entry=m.neighbor_discover_metadata[m.neighbor_discover_next]; + if(entry.status==Mesh::ND_QUEUED) { + // The real TX hook starts the reply timeout, not queue admission. + if(result==Mesh::ND_SEND_FAILED) m.markFailed(); + else m.markTransmitted(); + if(result==Mesh::ND_RESPONDED) { + std::vector response(8+scope,'x'); + memcpy(response.data(),&entry.tag,4); + assert(m.handleNeighborDiscoverResponse(m.neighbor_discover_next, + response.data(),response.size(),5.0f,-99)); + } + } + m.loopNeighborDiscover(); + } + assert(m.neighbor_discover_count==0 && m.neighbor_discover_next==0); + assert(m.neighbor_discover_publish_count==0 && m.neighbor_discover_queried_count==0); + assert(!m.neighbor_discover_request && m.neighbor_discover_until==0); + assert(m.next_neighbors_publish==60010); + assert(m.mock_bridge.publishes==old_publishes+1); + JsonDocument document; + assert(!deserializeJson(document,m.mock_bridge.last_json)); + assert(document["total_neighbors"].template as()==count); + if(count>0) assert(document["neighbors"][0]["pubkey"].template as()!=nullptr); + assert(document["neighbors"].template as().size()<=size_t(count)); + if(count>MQTTBridge::NEIGHBORS_MAX_PUBLISH_ENTRIES) + assert(document["truncated"].template as()); + return m.mock_bridge.last_json; +} + +struct Snapshot { + mesh::Identity id; uint32_t heard; int8_t snr; int16_t rssi; +}; +// The old full-entry model snapshots every admitted row, then stable-sorts the +// complete rows. Compare the new indexed snapshot against an independent +// standard-library implementation rather than a second copy of its loop. +template void checkOverlay(bool collision,bool guests) { + Mesh m={}; + m.guest_login.value=guests; + std::vector previous; + for(int i=0;i<254;++i) { + auto& row=m.neighbours[i]; + for(size_t j=0;j<32;++j) row.id.pub_key[j]=uint8_t(i+j*13); + row.id.pub_key[0]=collision ? 0x42 : uint8_t(i%16); + row.heard_timestamp=1799999900+uint32_t((i*37)%11); + row.snr=int8_t((i*7)%8); + row.rssi=int16_t(-80-i%20); + previous.push_back({row.id,row.heard_timestamp,row.snr,row.rssi}); + } + // Add unheard rows too: only the positive-time source rows enter discovery. + if(collision) { + m.neighbours[42].heard_timestamp=0; + previous.erase(previous.begin()+42); + } + std::stable_sort(previous.begin(),previous.end(),[](const Snapshot& lhs,const Snapshot& rhs) { + if(lhs.heard!=rhs.heard) return lhs.heard>rhs.heard; + if(lhs.snr!=rhs.snr) return lhs.snr>rhs.snr; + return memcmp(lhs.id.pub_key,rhs.id.pub_key,32)<0; + }); + for(size_t i : {size_t(0),size_t(17),size_t(73),size_t(200),size_t(252)}) { + ClientInfo client={};client.id=previous[i].id; + client.permissions=i%2 ? PERM_ACL_GUEST : 1; + memset(client.shared_secret,uint8_t(0x30+i%16),32); + m.acl.clients.push_back(client); + } + char reply[160]={};allocation=0; + assert(m.startNeighborDiscover(reply)); + assert(m.neighbor_discover_count==previous.size()); +#ifdef TEST_LOST_KEY_TAIL + for(size_t i=Mesh::NEIGHBOR_SCOPE_RESULTS;i old_matches; + if(active) for(size_t i=0;i=Mesh::NEIGHBOR_DISCOVER_PEER_BASE) { + const auto& id=previous[size_t(match-Mesh::NEIGHBOR_DISCOVER_PEER_BASE)].id; + for(size_t b=0;b<32;++b) expected[b]=uint8_t(id.pub_key[b]^0xA5); + } else memcpy(expected,m.acl.clients[size_t(match)].shared_secret,32); + assert(!memcmp(actual,expected,32)); + } + } + } + m.neighbor_discover_active=true; + // Exercise every sorted identity directly, including keys beyond the + // publishable/query prefix and keys hidden behind the collision-result cap. + const unsigned before=m.self_id.derivations; + for(size_t i=0;i(collision,guests); + checkOverlay(collision,guests); + } + for(int count : {0,1,19,20,21,30,71,72,73,253,254}) + for(int result : {MyMesh::ND_RESPONDED,MyMesh::ND_TIMEOUT,MyMesh::ND_SEND_FAILED}) + for(size_t scope : {size_t(0),size_t(95),size_t(180)}) { + MyMesh current={}; LegacyMesh baseline={}; + for(bool admitted : {true,false}) { + auto actual=runPass(current,count,result,scope,admitted); + auto previous=runPass(baseline,count,result,scope,admitted); + assert(actual==previous && current.requested==baseline.requested); + assert(current.touched==baseline.touched); + } + } + // Failed publish allocation still resets the complete discovery lifetime; + // the next pass starts with empty scopes and cannot retain stale replies. + for(bool scratch : {true,false}) { + MyMesh current={}; + current.neighbours[0].heard_timestamp=1799999999; + fail_scratch=scratch; fail_json=!scratch; allocation=0; + char reply[160]={}; assert(current.startNeighborDiscover(reply)); + current.markTransmitted(); + for (int i=0; current.neighbor_discover_active && i<4; ++i) current.loopNeighborDiscover(); + assert(!current.neighbor_discover_active && current.mock_bridge.publishes==0); + assert(current.neighbor_discover_count==0 && !current.neighbor_discover_request); + fail_scratch=fail_json=false; + runPass(current,1,MyMesh::ND_TIMEOUT,0); + } + puts("real neighbor serialization and lifecycle checks passed"); +} diff --git a/test/fixtures/neighbor_scope_storage.cpp b/test/fixtures/neighbor_scope_storage.cpp index 1c07e2e3e..a5899d923 100644 --- a/test/fixtures/neighbor_scope_storage.cpp +++ b/test/fixtures/neighbor_scope_storage.cpp @@ -72,8 +72,9 @@ template std::string collect(Mesh& mesh,size_t scope_bytes,int state std::vector keys; keys.reserve(254); std::vector entries; for(int i=0;i<254;++i) { - auto& row=mesh.neighbor_discover[i]; - memset(row.id.pub_key,uint8_t(i),sizeof(row.id.pub_key)); + auto& row=mesh.neighbor_discover_metadata[i]; + auto& id=mesh.neighbor_discover[i].id; + memset(id.pub_key,uint8_t(i),sizeof(id.pub_key)); row.status=uint8_t(state); row.snr=int8_t(snr*4); row.rssi=int16_t(rssi); if(state==Mesh::ND_RESPONDED) { row.status=Mesh::ND_PENDING; row.tag=123; @@ -82,7 +83,7 @@ template std::string collect(Mesh& mesh,size_t scope_bytes,int state assert(mesh.handleNeighborDiscoverResponse(i,response.data(),response.size(),snr,int16_t(rssi))); } if(!mesh.completeNeighborDiscoverEntry())break; - char key[65]; mesh::Utils::toHex(key,row.id.pub_key,32); keys.emplace_back(key); + char key[65]; mesh::Utils::toHex(key,id.pub_key,32); keys.emplace_back(key); entries.push_back({keys.back().c_str(),row.snr/4.0f,UINT32_MAX, mesh.neighbor_discover_scopes[i],state==Mesh::ND_RESPONDED ? "responded" : (state==Mesh::ND_SEND_FAILED ? "send_failed" : "timeout"),rssi,false}); @@ -104,11 +105,28 @@ int main() { static_assert(sizeof(memory.neighbor_discover)/sizeof(memory.neighbor_discover[0])==254, "keep the complete neighbor snapshot capacity"); #ifndef TEST_PUBLICATION_NEGATIVE_CONTROL - assert(sizeof(MyMesh::NeighborDiscoverEntry)==44); - assert(sizeof(LegacyMesh::NeighborDiscoverEntry)==48); + assert(sizeof(MyMesh::NeighborDiscoverEntry)==32); + assert(sizeof(LegacyMesh::NeighborDiscoverEntry)==32); + assert(sizeof(MyMesh::NeighborDiscoverMetadata)==12); + assert(sizeof(LegacyMesh::NeighborDiscoverMetadata)==16); + assert(sizeof(legacy_memory.neighbor_discover_metadata)==254*16); + assert(sizeof(memory.neighbor_discover_metadata)==MyMesh::NEIGHBOR_SCOPE_RESULTS*12); +#if defined(BOARD_HAS_PSRAM) assert(sizeof(memory.neighbor_discover_scopes)==72*96); assert(sizeof(legacy_memory.neighbor_discover_scopes)-sizeof(memory.neighbor_discover_scopes)==17472); - assert(sizeof(legacy_memory.neighbor_discover)-sizeof(memory.neighbor_discover)==1016); +#else + assert(sizeof(memory.neighbor_discover_scopes)==21*96); + assert(sizeof(legacy_memory.neighbor_discover_scopes)-sizeof(memory.neighbor_discover_scopes)==22368); +#endif + const size_t old_storage=sizeof(legacy_memory.neighbor_discover) + +sizeof(legacy_memory.neighbor_discover_metadata)+sizeof(legacy_memory.neighbor_discover_scopes); + const size_t new_storage=sizeof(memory.neighbor_discover) + +sizeof(memory.neighbor_discover_metadata)+sizeof(memory.neighbor_discover_scopes); +#if defined(BOARD_HAS_PSRAM) + assert(old_storage-new_storage==20672); +#else + assert(old_storage-new_storage==26180); +#endif #else (void)legacy_memory; #endif diff --git a/test/fixtures/power_saving_diagnostics.cpp b/test/fixtures/power_saving_diagnostics.cpp index abe46c5d5..0914089d6 100644 --- a/test/fixtures/power_saving_diagnostics.cpp +++ b/test/fixtures/power_saving_diagnostics.cpp @@ -52,7 +52,7 @@ int main(int argc, char** argv) { assert(!state().observed && !state().current && !state().seen); assert(!state().union_blocked_ms && !state().eligible_ms); } else if (!strcmp(test, "reset")) { - setEnabled(true, 0); decision(mask(Reason::Serial), 1); + setEnabled(true, 0); decision(mask(Reason::SerialIO), 1); sleepBegin(1); sleepEnd(20); reset(10); assert(enabled() && !state().observed && !state().calls && !state().seen); decision(0, 11); assert(snapshot(20).eligible_ms == 9); diff --git a/test/test_companion_psram_mesh.py b/test/test_companion_psram_mesh.py new file mode 100644 index 000000000..aa322d3fd --- /dev/null +++ b/test/test_companion_psram_mesh.py @@ -0,0 +1,340 @@ +#!/usr/bin/env python3 +"""Check late external ownership through the real startup and storage methods.""" +from pathlib import Path +import importlib.util +import os +import re +import resource +import shlex +import signal +import subprocess +import tempfile +import unittest + +ROOT = Path(__file__).resolve().parents[1] + + +def block(text, signature): + start = text.index(signature) + end = text.index('{', start) + 1 + depth = 1 + while depth: + depth += (text[end] == '{') - (text[end] == '}') + end += 1 + return text[start:end] + + +PREAMBLE = r''' +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define MESH_DEBUG_PRINTLN(...) ((void)0) +#define MAX_CONTACTS 350 +#define MAX_ANON_CONTACTS 8 +#define ONE_KEY_DM_COMPACT_HELD 0 +#define ONE_KEY_DM_SHARED_OFFLINE_QUEUE 0 +#define MAX_HELD_ONE_KEY_DMS 15 +#define ONE_KEY_DM_ID_SIZE 8 +#define PUB_KEY_SIZE 32 +#define MAX_TEXT_LEN 160 +#define MESH_CONTACT_CACHE 0 +static void check(bool value) { if (!value) std::abort(); } +static bool board_ready = false, present = true; +static int fail_calloc = 0, allocated = 0, constructed = 0, destroyed = 0; +static int construct_action = 0; +static std::vector sizes; +static std::string diagnostic; +bool psramFound() { return present; } +void* heap_caps_calloc(size_t count, size_t size, unsigned caps) { + check(board_ready && caps == (MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT)); + ++allocated; sizes.push_back(count * size); + if (fail_calloc) { --fail_calloc; return nullptr; } + return std::calloc(count, size); +} +void* heap_caps_malloc(size_t size, unsigned caps) { + check(board_ready && caps == (MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT)); + ++allocated; sizes.push_back(size); + return std::malloc(size); +} +void heap_caps_free(void* value) { std::free(value); } +namespace mesh { +struct Packet { uint8_t bytes[280]; }; +struct Log { + void println(const char* text) { diagnostic += text; diagnostic += '\n'; } +}; +static Log logger; +Log& usbLoggingPort() { return logger; } +} +struct Board { void begin() { board_ready = true; } } board; +void delay(unsigned) { + std::printf("halted allocations=%d constructors=%d %s", allocated, constructed, + diagnostic.c_str()); + std::exit(77); +} +using ContactIndex = uint16_t; +struct ContactInfo { uint8_t bytes[184]; }; +struct BaseChatMesh { + ContactInfo* contacts; + ContactInfo contacts_fallback[24]; + ContactIndex* sort_array; + ContactIndex sort_array_fallback[24]; + int contact_capacity, num_contacts; + BaseChatMesh() : contacts(contacts_fallback), sort_array(sort_array_fallback), + contact_capacity(24), num_contacts(8) {} + ~BaseChatMesh() { + if (contacts != contacts_fallback) heap_caps_free(contacts); + if (sort_array != sort_array_fallback) heap_caps_free(sort_array); + } + void onContactReferenceChanged(ContactInfo*, ContactInfo*) {} + bool initializeContactStorage(); +}; +struct Dummy {}; +Dummy radio_driver, fast_rng, rtc_clock, tables, store, ui_task; +struct MyMesh; +MyMesh& companionMeshInstance(); +static bool initializeCompanionMeshStorage(); +struct MyMesh : BaseChatMesh { +@FRAME@; + Frame* offline_queue; + Frame offline_queue_fallback[16]; + int offline_queue_capacity, offline_queue_head, offline_queue_len; +@HELD@; + HeldOneKeyDM held_dms[MAX_HELD_ONE_KEY_DMS]; + uint8_t untouched[128]; + MyMesh(Dummy&, Dummy&, Dummy&, Dummy&, Dummy&, Dummy*) { + check(board_ready); ++constructed; + // These deliberately uninitialized fields used to receive static-zero + // initialization. The real late owner must preserve that guarantee. + for (uint8_t byte : untouched) check(byte == 0); + for (const auto& held : held_dms) + for (uint8_t byte : held.packet.bytes) check(byte == 0); + offline_queue = offline_queue_fallback; + offline_queue_capacity = 16; + offline_queue_head = offline_queue_len = 0; + if (construct_action == 1) (void)companionMeshInstance(); + if (construct_action == 2) (void)initializeCompanionMeshStorage(); + } + ~MyMesh() { + ++destroyed; + if (offline_queue != offline_queue_fallback) heap_caps_free(offline_queue); + } + int getOfflineQueueCapacity() const; + Frame& offlineQueueFrameAt(int); + void initializeOfflineQueue(); + bool addToOfflineQueue(const uint8_t*, int); + int peekOfflineQueue(uint8_t*); + void popOfflineQueue(); +}; +@CONSTANTS@ +@CONTACT_METHOD@ +@METHODS@ +#define the_mesh companionMeshInstance() +@FACTORY@ +static void setupStorage() { +@SETUP@ +} +static_assert(!std::is_copy_constructible>::value, + "A singleton owner must not be copied"); +static_assert(!std::is_move_constructible>::value, + "A published mesh must not move"); +int main(int argc, char** argv) { + check(allocated == 0 && constructed == 0 && !board_ready); + std::string mode = argc > 1 ? argv[1] : "success"; + if (mode == "preinit") { (void)the_mesh; return 0; } + if (mode == "missing") present = false; + if (mode == "allocation-failure") fail_calloc = 1; + if (mode == "partial-access") construct_action = 1; + if (mode == "recursive-begin") construct_action = 2; + setupStorage(); + MyMesh* address = &the_mesh; + check(constructed == 1 && allocated == 1 && sizes[0] == sizeof(MyMesh)); + check(the_mesh.initializeContactStorage()); + the_mesh.initializeOfflineQueue(); + check(the_mesh.contact_capacity == 358); + check(the_mesh.getOfflineQueueCapacity() == 512); + for (int i = 0; i < 350; ++i) the_mesh.contacts[i + 8].bytes[0] = uint8_t(i); + for (int i = 0; i < 15; ++i) { + std::memset(the_mesh.held_dms[i].sender_key, i + 1, PUB_KEY_SIZE); + std::memset(the_mesh.held_dms[i].packet.bytes, i + 1, 280); + } + for (int i = 0; i < 512; ++i) { + uint8_t bytes[MAX_FRAME_SIZE]; std::memset(bytes, i, sizeof(bytes)); + bytes[0] = 0xFE; + check(the_mesh.addToOfflineQueue(bytes, sizeof(bytes))); + } + uint8_t extra[MAX_FRAME_SIZE] = {0xFE}; + check(!the_mesh.addToOfflineQueue(extra, sizeof(extra))); + int before = allocated; + check(initializeCompanionMeshStorage()); + check(&the_mesh == address && allocated == before && constructed == 1); + for (int i = 0; i < 350; ++i) check(the_mesh.contacts[i + 8].bytes[0] == uint8_t(i)); + for (int i = 0; i < 15; ++i) { + check(the_mesh.held_dms[i].sender_key[31] == i + 1); + check(the_mesh.held_dms[i].packet.bytes[279] == i + 1); + } + for (int i = 0; i < 512; ++i) { + uint8_t bytes[MAX_FRAME_SIZE]; + check(the_mesh.peekOfflineQueue(bytes) == MAX_FRAME_SIZE && bytes[0] == 0xFE); + for (int j = 1; j < MAX_FRAME_SIZE; ++j) check(bytes[j] == uint8_t(i)); + the_mesh.popOfflineQueue(); + } + check(the_mesh.offline_queue_len == 0 && the_mesh.offline_queue_head == 0); + std::printf("512 frames, 15 held DMs, 350 contacts; one complete external object; zero state retained\n"); +} +''' + + +class CompanionPsramMeshTests(unittest.TestCase): + def setUp(self): + self.temp = tempfile.TemporaryDirectory(prefix='companion-psram-mesh-') + self.addCleanup(self.temp.cleanup) + self.work = Path(self.temp.name) + (self.work / 'sdkconfig.h').write_text('#pragma once\n') + (self.work / 'esp_heap_caps.h').write_text( + '#pragma once\n#include \n#define MALLOC_CAP_SPIRAM 0x400\n' + '#define MALLOC_CAP_8BIT 0x4\nvoid* heap_caps_calloc(size_t,size_t,unsigned);\n' + 'void* heap_caps_malloc(size_t,unsigned);\nvoid heap_caps_free(void*);\n') + (self.work / 'esp32-hal-psram.h').write_text('#pragma once\nbool psramFound();\n') + self.compiler = shlex.split(os.environ.get('CXX', 'g++')) + self.defines = ['COMPANION_MESH_PSRAM_STORAGE=1', 'ESP32_PLATFORM=1', 'BOARD_HAS_PSRAM=1', + 'COMPANION_RADIO_FULL=1', 'INDICATOR_TRANSPORT_RENDER_PROFILE=1', + 'MESH_PRIMARY_ESPNOW=1', 'CONFIG_IDF_TARGET_ESP32S3=1', 'CONFIG_SPIRAM=1'] + + def fixture(self): + header = (ROOT / 'examples/companion_radio/MyMesh.h').read_text() + source = (ROOT / 'examples/companion_radio/MyMesh.cpp').read_text() + main = (ROOT / 'examples/companion_radio/main.cpp').read_text() + start = main.index('#if COMPANION_MESH_PSRAM_STORAGE\nstatic mesh::') + factory = main[start:main.index('\n#else', start)] + '\n#endif\n' + start = main.index(' board.begin();\n', main.index('void setup()')) + setup = main[start:main.index('\n#endif', start)] + '\n#endif\n' + methods = '\n'.join(block(source, name) for name in ( + 'bool MyMesh::Frame::isChannelMsg()', 'int MyMesh::getOfflineQueueCapacity()', + 'MyMesh::Frame& MyMesh::offlineQueueFrameAt(', 'void MyMesh::initializeOfflineQueue()', + 'bool MyMesh::addToOfflineQueue(', 'int MyMesh::peekOfflineQueue(', 'void MyMesh::popOfflineQueue()')) + constants = '\n'.join(re.search(r'^#define ' + name + r'\s+.*$', source, re.M).group() + for name in ('RESP_CODE_CHANNEL_MSG_RECV', 'RESP_CODE_CHANNEL_MSG_RECV_V3', 'RESP_CODE_CHANNEL_DATA_RECV')) + defaults = header[header.index('#ifndef OFFLINE_QUEUE_SIZE'):header.index('\nstatic_assert(OFFLINE_QUEUE_SIZE')] + contact = block((ROOT / 'src/helpers/BaseChatMesh.cpp').read_text(), 'bool BaseChatMesh::initializeContactStorage()') + return (PREAMBLE.replace('@FRAME@', block(header, ' struct Frame {')) + .replace('@HELD@', block(header, ' struct HeldOneKeyDM {')) + .replace('@CONSTANTS@', constants).replace('@CONTACT_METHOD@', contact) + .replace('@METHODS@', methods).replace('@FACTORY@', factory).replace('@SETUP@', setup) + .replace('#define MESH_DEBUG_PRINTLN(...) ((void)0)', + '#define MESH_DEBUG_PRINTLN(...) ((void)0)\n' + defaults)) + + def compile_fixture(self): + source = self.work / 'test.cpp'; source.write_text(self.fixture()) + binary = self.work / 'test' + result = subprocess.run(self.compiler + ['-std=c++17', '-Os', '-DNDEBUG', + '-Wall', '-Wextra', '-Werror', '-fsanitize=address,undefined', '-fno-sanitize-recover=all', + '-fno-pie', '-no-pie', *['-D' + d for d in self.defines], + '-I', str(self.work), '-I', str(ROOT / 'src'), str(source), '-o', str(binary)], + capture_output=True, text=True, timeout=30) + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + return binary + + @staticmethod + def no_core_dump(): + resource.setrlimit(resource.RLIMIT_CORE, (0, 0)) + + def test_real_factory_zero_state_full_storage_and_repeat_initialization(self): + result = subprocess.run([str(self.compile_fixture())], capture_output=True, text=True, timeout=15) + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + self.assertIn('512 frames, 15 held DMs, 350 contacts', result.stdout) + + def test_absent_psram_and_allocation_failure_halt_before_partial_startup(self): + binary = self.compile_fixture() + for mode, allocations, diagnostic in ( + ('missing', 0, 'requires working PSRAM'), + ('allocation-failure', 1, 'insufficient PSRAM')): + with self.subTest(mode=mode): + result = subprocess.run([str(binary), mode], capture_output=True, text=True, timeout=15) + self.assertEqual(result.returncode, 77, result.stdout + result.stderr) + self.assertIn('halted allocations=%d constructors=0' % allocations, result.stdout) + self.assertIn(diagnostic, result.stdout) + + def test_access_before_or_during_construction_and_recursive_begin_abort_with_ndebug(self): + binary = self.compile_fixture() + for mode in ('preinit', 'partial-access', 'recursive-begin'): + with self.subTest(mode=mode): + result = subprocess.run([str(binary), mode], capture_output=True, text=True, + preexec_fn=self.no_core_dump, timeout=15) + self.assertEqual(result.returncode, -signal.SIGABRT, result.stdout + result.stderr) + + def test_default_header_and_global_constructor_have_no_code_or_sdk_change(self): + source = self.work / 'default.cpp' + source.write_text('#include \nint main() {}\n') + for defines in ([], ['-DCOMPANION_MESH_PSRAM_STORAGE=0']): + result = subprocess.run(self.compiler + ['-std=c++11', '-E', '-P', *defines, + '-I', str(ROOT / 'src'), str(source)], capture_output=True, text=True, timeout=15) + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual(result.stdout.strip(), 'int main() {}') + main = (ROOT / 'examples/companion_radio/main.cpp').read_text() + start = main.index('#if COMPANION_MESH_PSRAM_STORAGE\nstatic mesh::') + fallback = main[main.index('\n#else\n', start) + len('\n#else\n'):] + expected = ('MyMesh the_mesh(radio_driver, fast_rng, rtc_clock, tables, store\n' + ' #ifdef DISPLAY_CLASS\n , &ui_task\n #endif\n);') + self.assertTrue(fallback.startswith(expected + '\n#endif')) + setup = main[main.index('void setup()'):] + ordered = [' board.begin();', 'initializeCompanionMeshStorage()', 'display.begin()', 'radio_init()', 'the_mesh.begin('] + positions = [setup.index(token) for token in ordered] + self.assertEqual(positions, sorted(positions)) + self.assertLess(setup.index('initializeCompanionMeshStorage()'), setup.index('loadStationProtocolForBoot()')) + + def test_nonqualified_or_unconfigured_storage_combinations_fail_closed(self): + source = self.work / 'policy.cpp'; source.write_text('#include \n') + for excluded in ('BOARD_HAS_PSRAM', 'COMPANION_RADIO_FULL', 'INDICATOR_TRANSPORT_RENDER_PROFILE', + 'MESH_PRIMARY_ESPNOW', 'CONFIG_IDF_TARGET_ESP32S3', 'CONFIG_SPIRAM'): + with self.subTest(excluded=excluded): + defines = [d for d in self.defines if not d.startswith(excluded + '=')] + result = subprocess.run(self.compiler + ['-std=c++11', '-fsyntax-only', + *['-D' + d for d in defines], '-I', str(self.work), '-I', str(ROOT / 'src'), str(source)], + capture_output=True, text=True, timeout=15) + self.assertNotEqual(result.returncode, 0) + result = subprocess.run(self.compiler + ['-std=c++11', '-fsyntax-only', + *['-D' + d for d in self.defines], '-DOTA_SHARED_COMPANION_QUEUE=1', + '-I', str(self.work), '-I', str(ROOT / 'src'), str(source)], capture_output=True, text=True, timeout=15) + self.assertNotEqual(result.returncode, 0) + + def test_exact_memory_guard_and_indicator_only_recipe_are_unchanged(self): + spec = importlib.util.spec_from_file_location('indicator_ram_guard', ROOT / 'scripts/check_firmware_ram.py') + module = importlib.util.module_from_spec(spec); spec.loader.exec_module(module) + defines = dict(COMPANION_RADIO_FULL=1, DISPLAY_CLASS='SCIndicatorDisplay', UI_BUFFER_COLOR_DEPTH=4, + INDICATOR_TRANSPORT_RENDER_PROFILE=1, BOARD_HAS_PSRAM=1, + COMPANION_EXCLUSIVE_WIFI_BLE=1, WIFI_SSID='placeholder', BLE_PIN_CODE=123456, + ENABLE_OTA=1, WIFI_OTA_SEEDER=1, COMPANION_FEATURE_NETWORK_TERMINAL=1, + MAX_CONTACTS=350, MAX_GROUP_CHANNELS=40, UI_MSG_PREVIEW_SIZE=161, OTA_SEEDER_ONLY=1) + baseline = module.requirements('ESP32_PLATFORM', defines, 'SenseCapIndicator-ESPNow_comp_radio_usb') + candidate = module.requirements('ESP32_PLATFORM', {**defines, 'COMPANION_MESH_PSRAM_STORAGE': 1}, + 'SenseCapIndicator-ESPNow_comp_radio_usb') + self.assertEqual(candidate, baseline) + self.assertEqual(candidate['required_heap_bytes'], 251168) + self.assertEqual(candidate['required_contiguous_bytes'], 116224) + script = (ROOT / 'build_legacy.sh').read_text() + marker = script.index(' -DCOMPANION_MESH_PSRAM_STORAGE=1') + case_start = script.rfind(' case "${env_name,,}" in', 0, marker) + case_end = script.index('\n esac', marker) + len('\n esac') + case = script[case_start:case_end] + self.assertEqual(script.count('-DCOMPANION_MESH_PSRAM_STORAGE=1'), 1) + for target, expected in (('SenseCapIndicator-ESPNow_companion_radio_full', True), + ('SenseCapIndicator-LoRa_companion_radio_full', False), + ('SenseCapIndicator-LoRa-N16R2_companion_radio_full', False), + ('Generic_ESPNOW_companion_radio_full', False), + ('RAK_4631_companion_radio_full', False)): + with self.subTest(target=target): + program = 'env_name=' + shlex.quote(target) + '\nPLATFORMIO_BUILD_FLAGS=""\n' + case + '\nprintf "%s" "$PLATFORMIO_BUILD_FLAGS"\n' + result = subprocess.run(['bash', '-c', program], capture_output=True, text=True, timeout=15) + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual('-DCOMPANION_MESH_PSRAM_STORAGE=1' in result.stdout, expected) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_companion_rtc_queue.py b/test/test_companion_rtc_queue.py new file mode 100644 index 000000000..100918bf0 --- /dev/null +++ b/test/test_companion_rtc_queue.py @@ -0,0 +1,335 @@ +#!/usr/bin/env python3 +"""Run the real fixed-capacity FIFO across RTC banks, ownership and active OTA.""" +from pathlib import Path +import os +import re +import resource +import shlex +import shutil +import signal +import subprocess +import tempfile +import unittest +from test_replay_reset_integration import extract_braced + +ROOT = Path(__file__).resolve().parents[1] + +HARNESS = r''' +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mota_vectors.h" +#define MESH_DEBUG_PRINTLN(...) ((void)0) +@CONSTANTS@ +static void check(bool value) { if (!value) std::abort(); } +struct MyMesh { +@FRAME@; + int offline_queue_len = 0, offline_queue_head = 0; +@STORAGE@ + MyMesh() : offline_queue(rtcFastQueueBank(), rtcSlowQueueBank()) {} + int getOfflineQueueCapacity() const; + Frame& offlineQueueFrameAt(int); + bool addToOfflineQueue(const uint8_t*, int); + int peekOfflineQueue(uint8_t*); + void popOfflineQueue(); + void reset() { offline_queue.reset(); offline_queue_len = 0; offline_queue_head = 0; } +}; +@BANKS@ +@METHODS@ +static_assert(sizeof(MyMesh::Frame) == 177, "Keep the original complete frame"); +static_assert(std::is_trivial::value, "No constructors in retained bytes"); +static_assert(!std::is_copy_constructible::value, + "A queue lease must not be duplicated"); +static_assert(!std::is_move_constructible::value, + "Moving a queue lease would invalidate its owner"); +static_assert(sizeof(decltype(MyMesh::offline_queue)) == + 177 * (OFFLINE_QUEUE_SIZE - COMPANION_RTC_FAST_OFFLINE_FRAMES - + COMPANION_RTC_SLOW_OFFLINE_FRAMES) + 2 * sizeof(void*), + "The complete remaining frames, and only bank pointers, occupy ordinary DRAM"); +#ifdef OTA_SHARED_COMPANION_QUEUE +#error "This FIFO must retain its complete capacity while OTA is active" +#endif +using Bytes = std::vector; +static Bytes frame(uint32_t id, bool channel = false) { + Bytes bytes(MAX_FRAME_SIZE, 0); + bytes[0] = channel ? RESP_CODE_CHANNEL_MSG_RECV : 0xFE; + std::memcpy(bytes.data() + 1, &id, sizeof(id)); + for (size_t i = 5; i < bytes.size(); ++i) bytes[i] = uint8_t(id + i); + return bytes; +} +static void enqueue(MyMesh& mesh, const Bytes& bytes) { + check(mesh.addToOfflineQueue(bytes.data(), bytes.size())); +} +static void expectFront(MyMesh& mesh, const Bytes& bytes) { + uint8_t actual[MAX_FRAME_SIZE]; + check(mesh.peekOfflineQueue(actual) == int(bytes.size())); + check(!std::memcmp(actual, bytes.data(), bytes.size())); +} +static void expectAll(MyMesh& mesh, std::deque expected) { + check(mesh.offline_queue_len == int(expected.size())); + while (!expected.empty()) { + expectFront(mesh, expected.front()); mesh.popOfflineQueue(); expected.pop_front(); + } + uint8_t ignored[MAX_FRAME_SIZE]; + check(mesh.offline_queue_len == 0 && mesh.offline_queue_head == 0); + check(mesh.peekOfflineQueue(ignored) == 0); +} +static void fill(MyMesh& mesh, std::deque& expected, int channel = -1) { + mesh.reset(); expected.clear(); + for (int i = 0; i < OFFLINE_QUEUE_SIZE; ++i) { + Bytes value = frame(i, i == channel); enqueue(mesh, value); expected.push_back(value); + } + check(mesh.getOfflineQueueCapacity() == OFFLINE_QUEUE_SIZE); + check(!mesh.addToOfflineQueue(nullptr, 0)); +} +struct WirePacket { bool to_source; Bytes bytes; }; +static std::deque packets; +static bool send(void* to_source, const uint8_t* bytes, uint16_t length, bool) { + packets.push_back({to_source != nullptr, {bytes, bytes + length}}); return true; +} +static void transferWithFullQueue(MyMesh& mesh, const std::deque& expected) { + using namespace mesh::ota; + OtaManager source, receiver; + OtaStoreRam<8192> destination; + source.begin(EXP_TARGET_ID, send, nullptr); + receiver.begin(EXP_TARGET_ID, send, reinterpret_cast(1)); + receiver.set_fetch_store(&destination); + check(source.serve(MOTA_VEC, MOTA_VEC_LEN)); + check(receiver.pull(EXP_MERKLE_ROOT, EXP_TARGET_ID) == OtaManager::PULL_STARTED); + bool active = false; + for (uint32_t time = 100; time < 300000 && receiver.fetchState() != OtaManager::COMPLETE; + time += 100) { + active = true; + check(mesh.getOfflineQueueCapacity() == OFFLINE_QUEUE_SIZE); + check(mesh.offline_queue_len == OFFLINE_QUEUE_SIZE); + expectFront(mesh, expected.front()); + source.set_clock(time); receiver.set_clock(time); + source.serviceEgress(); receiver.serviceEgress(); + if (time % 1000 == 0) { source.loop(); receiver.loop(); } + while (!packets.empty()) { + WirePacket packet = packets.front(); packets.pop_front(); + (packet.to_source ? source : receiver).on_message(packet.bytes.data(), packet.bytes.size()); + } + } + check(active && receiver.fetchState() == OtaManager::COMPLETE); + check(destination.staged_size() == MOTA_VEC_LEN); + check(!std::memcmp(destination.data(), MOTA_VEC, MOTA_VEC_LEN)); + check(mesh.getOfflineQueueCapacity() == OFFLINE_QUEUE_SIZE); +} +int main(int argc, char** argv) { + auto mesh = std::unique_ptr(new MyMesh); + if (argc == 2 && !std::strcmp(argv[1], "second-owner")) { + auto second = std::unique_ptr(new MyMesh); return 0; + } + if (argc == 2 && !std::strcmp(argv[1], "different-count-owner")) { + mesh::CompanionRtcQueue second( + mesh->rtcFastQueueBank(), mesh->rtcSlowQueueBank()); return 0; + } + check(reinterpret_cast(mesh->rtcFastQueueBank()) % 4 == 0); + check(reinterpret_cast(mesh->rtcSlowQueueBank()) % 4 == 0); + std::set addresses; + const int main_count = OFFLINE_QUEUE_SIZE - COMPANION_RTC_FAST_OFFLINE_FRAMES - + COMPANION_RTC_SLOW_OFFLINE_FRAMES; + for (int i = 0; i < OFFLINE_QUEUE_SIZE; ++i) { + auto& slot = mesh->offlineQueueFrameAt(i); check(slot.len == 0); + check(addresses.insert(&slot).second); + if (i >= main_count && i < main_count + COMPANION_RTC_FAST_OFFLINE_FRAMES) + check(&slot == mesh->rtcFastQueueBank() + i - main_count); + if (i >= main_count + COMPANION_RTC_FAST_OFFLINE_FRAMES) + check(&slot == mesh->rtcSlowQueueBank() + i - main_count - COMPANION_RTC_FAST_OFFLINE_FRAMES); + } + std::deque expected; + fill(*mesh, expected); + Bytes extra = frame(0xABCDEF); check(!mesh->addToOfflineQueue(extra.data(), extra.size())); + transferWithFullQueue(*mesh, expected); expectAll(*mesh, expected); + fill(*mesh, expected); + for (int i = 0; i < OFFLINE_QUEUE_SIZE * 2 + 17; ++i) { + expectFront(*mesh, expected.front()); mesh->popOfflineQueue(); expected.pop_front(); + Bytes value = frame(OFFLINE_QUEUE_SIZE + i); enqueue(*mesh, value); expected.push_back(value); + } + expectAll(*mesh, expected); + // Removal shifts complete personal-message frames across every bank boundary. + for (int channel : {main_count - 1, main_count, main_count + 31, OFFLINE_QUEUE_SIZE - 1}) { + fill(*mesh, expected, channel); + for (int i = 0; i < 19; ++i) { + mesh->popOfflineQueue(); expected.pop_front(); + Bytes value = frame(OFFLINE_QUEUE_SIZE + i); enqueue(*mesh, value); expected.push_back(value); + } + enqueue(*mesh, extra); expected.erase(expected.begin() + channel - 19); expected.push_back(extra); + expectAll(*mesh, expected); + } + fill(*mesh, expected); mesh->reset(); + uint8_t ignored[MAX_FRAME_SIZE]; check(mesh->peekOfflineQueue(ignored) == 0); + for (int i = 0; i < OFFLINE_QUEUE_SIZE; ++i) check(mesh->offlineQueueFrameAt(i).len == 0); + fill(*mesh, expected); mesh.reset(); + // RTC bytes outlive a C++ owner. A new owner must not resurrect its frames. + mesh.reset(new MyMesh); check(mesh->peekOfflineQueue(ignored) == 0); + for (int i = 0; i < OFFLINE_QUEUE_SIZE; ++i) { + const auto& slot = mesh->offlineQueueFrameAt(i); check(slot.len == 0); + for (uint8_t byte : slot.buf) check(byte == 0); + } +} +''' + + +class CompanionRtcQueueTests(unittest.TestCase): + def setUp(self): + self.temp = tempfile.TemporaryDirectory(prefix='companion-rtc-queue-') + self.addCleanup(self.temp.cleanup) + self.work = Path(self.temp.name) + (self.work / 'sdkconfig.h').write_text('#pragma once\n', encoding='ascii') + (self.work / 'esp_attr.h').write_text( + '#pragma once\n#define RTC_FAST_ATTR __attribute__((section(".rtc.force_fast.test")))\n' + '#define RTC_SLOW_ATTR __attribute__((section(".rtc.force_slow.test")))\n', encoding='ascii') + self.compiler = shlex.split(os.environ.get('CXX', 'g++')) + + def fixture(self): + header = (ROOT / 'examples/companion_radio/MyMesh.h').read_text() + source = (ROOT / 'examples/companion_radio/MyMesh.cpp').read_text() + start = header.index('#elif COMPANION_RTC_FAST_OFFLINE_FRAMES || COMPANION_RTC_SLOW_OFFLINE_FRAMES', header.index('static constexpr unsigned OTA_RETAINED_OFFLINE_FRAMES')) + end = header.index('#elif defined(ESP32_PLATFORM) && defined(BOARD_HAS_PSRAM)', start) + storage = header[start:].split('\n', 1)[1][:end - start - len(header[start:].split('\n', 1)[0]) - 1] + banks_start = source.index('#if COMPANION_RTC_FAST_OFFLINE_FRAMES\n') + banks_end = source.index('bool MyMesh::Frame::isChannelMsg()', banks_start) + methods = '\n'.join(extract_braced(source, name) for name in ( + 'bool MyMesh::Frame::isChannelMsg()', 'int MyMesh::getOfflineQueueCapacity()', + 'MyMesh::Frame& MyMesh::offlineQueueFrameAt(', 'bool MyMesh::addToOfflineQueue(', + 'int MyMesh::peekOfflineQueue(', 'void MyMesh::popOfflineQueue()')) + constants = '\n'.join(re.search(r'^#define ' + name + r'\s+.*$', source, re.M).group() + for name in ('RESP_CODE_CHANNEL_MSG_RECV', 'RESP_CODE_CHANNEL_MSG_RECV_V3', 'RESP_CODE_CHANNEL_DATA_RECV')) + return (HARNESS.replace('@FRAME@', extract_braced(header, ' struct Frame {')) + .replace('@STORAGE@', storage).replace('@BANKS@', source[banks_start:banks_end]) + .replace('@METHODS@', methods).replace('@CONSTANTS@', constants)) + + @staticmethod + def no_core_dump(): + resource.setrlimit(resource.RLIMIT_CORE, (0, 0)) + + def check_fifo(self, count, slow, chip): + source = self.work / 'test.cpp'; source.write_text(self.fixture(), encoding='ascii') + binary = self.work / 'test' + sources = [ROOT / 'src/helpers/ota' / name for name in ( + 'OtaManager.cpp', 'OtaProtocol.cpp', 'MotaContainer.cpp', 'MerkleTree.cpp')] + sources.append(ROOT / 'src/Utils.cpp') + result = subprocess.run(self.compiler + ['-std=c++17', '-Os', '-DNDEBUG', + '-Wall', '-Wextra', '-Werror', '-Wno-unused-parameter', '-Wno-sign-compare', + '-fsanitize=address,undefined', '-fno-sanitize-recover=all', '-fno-pie', '-no-pie', + '-DESP32_PLATFORM=1', '-DCOMPANION_RADIO_FULL=1', '-DENABLE_OTA=1', + '-DCONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP=1', '-DCONFIG_IDF_TARGET_' + chip + '=1', + '-DOFFLINE_QUEUE_SIZE=' + str(count), '-DCOMPANION_RTC_FAST_OFFLINE_FRAMES=32', + '-DCOMPANION_RTC_SLOW_OFFLINE_FRAMES=' + str(slow), + '-I', str(self.work), '-I', str(ROOT / 'src'), '-I', str(ROOT / 'test/mocks'), + '-I', str(ROOT / 'test/test_ota'), + str(source), *map(str, sources), '-o', str(binary)], capture_output=True, text=True, timeout=90) + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + result = subprocess.run([str(binary)], capture_output=True, text=True, timeout=20) + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + for command in ('second-owner', 'different-count-owner'): + result = subprocess.run([str(binary), command], capture_output=True, text=True, + preexec_fn=self.no_core_dump, timeout=10) + self.assertEqual(result.returncode, -signal.SIGABRT, result.stdout + result.stderr) + + def test_generic_c3_retains_all_224_frames_during_real_ota(self): + self.check_fifo(224, 0, 'ESP32C3') + + def test_tracker_and_mke_s3_retain_all_256_frames_during_real_ota(self): + self.check_fifo(256, 32, 'ESP32S3') + + def test_concrete_banks_use_rtc_sections_and_reset_has_no_large_stack_temporary(self): + objdump = shutil.which('objdump') + if not objdump: + self.skipTest('host objdump required for section-placement check') + source = self.work / 'sections.cpp' + source.write_text(self.fixture(), encoding='ascii') + obj = self.work / 'sections.o' + result = subprocess.run(self.compiler + ['-std=c++17', '-O0', '-DNDEBUG', + '-fno-inline', '-fstack-usage', '-ffunction-sections', '-fdata-sections', + '-DESP32_PLATFORM=1', '-DCOMPANION_RADIO_FULL=1', '-DENABLE_OTA=1', + '-DCONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP=1', '-DCONFIG_IDF_TARGET_ESP32S3=1', + '-DOFFLINE_QUEUE_SIZE=256', '-DCOMPANION_RTC_FAST_OFFLINE_FRAMES=32', + '-DCOMPANION_RTC_SLOW_OFFLINE_FRAMES=32', + '-I', str(self.work), '-I', str(ROOT / 'src'), '-I', str(ROOT / 'test/mocks'), + '-I', str(ROOT / 'test/test_ota'), '-c', str(source), '-o', str(obj)], + capture_output=True, text=True, timeout=30) + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + sections = subprocess.check_output([objdump, '-h', str(obj)], text=True) + for bank in ('fast', 'slow'): + match = re.search(r'\.rtc\.force_' + bank + r'\.test\s+([0-9a-fA-F]+)', sections) + self.assertIsNotNone(match, sections) + self.assertEqual(int(match[1], 16), 32 * 177) + stack = obj.with_suffix('.su').read_text() + selected = [line for line in stack.splitlines() + if 'CompanionRtcQueue' in line + and any(method in line for method in ('::reset(', '::at(', '::CompanionRtcQueue('))] + self.assertGreaterEqual(len(selected), 3, stack) + for line in selected: + self.assertLessEqual(int(line.split('\t')[1]), 256, line) + + def test_unselected_header_adds_no_sdk_dependency_or_storage(self): + source = self.work / 'default.cpp' + source.write_text('#include \nint main() {}\n', encoding='ascii') + result = subprocess.run(self.compiler + ['-std=c++11', '-E', '-P', '-I', str(ROOT / 'src'), str(source)], + capture_output=True, text=True, timeout=15) + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual(result.stdout.strip(), 'int main() {}') + + def test_incompatible_chip_storage_and_retention_settings_fail_closed(self): + source = self.work / 'policy.cpp' + source.write_text('#include \n', encoding='ascii') + base = ['ESP32_PLATFORM=1', 'COMPANION_RADIO_FULL=1', 'CONFIG_IDF_TARGET_ESP32C3=1', + 'CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP=1', 'COMPANION_RTC_FAST_OFFLINE_FRAMES=32'] + cases = ([value for value in base if not value.startswith('CONFIG_IDF_TARGET_')], + base + ['BOARD_HAS_PSRAM=1'], base + ['OTA_SHARED_COMPANION_QUEUE=1'], + base + ['ONE_KEY_DM_SHARED_OFFLINE_QUEUE=1'], + base + ['COMPANION_RTC_SLOW_OFFLINE_FRAMES=32'], + [value for value in base if not value.startswith('COMPANION_RADIO_FULL')], + [value for value in base if not value.startswith('CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP')]) + for defines in cases: + with self.subTest(defines=defines): + result = subprocess.run(self.compiler + ['-std=c++11', '-fsyntax-only', + *['-D' + value for value in defines], '-I', str(self.work), '-I', str(ROOT / 'src'), str(source)], + capture_output=True, text=True, timeout=15) + self.assertNotEqual(result.returncode, 0) + + def test_only_five_named_full_policies_select_banks_without_capacity_reductions(self): + source = (ROOT / 'build_legacy.sh').read_text() + start = source.index(' # BLE + WiFi exhaust internal DRAM') + start = source.index(' case "${env_name,,}" in', start) + end = source.index('\n esac', start) + len('\n esac') + case = source[start:end] + prefix = source[:start] + self.assertNotIn('COMPANION_RTC_FAST_OFFLINE_FRAMES', prefix) + self.assertNotIn('COMPANION_RTC_SLOW_OFFLINE_FRAMES', prefix) + for target, fast, slow, contacts, queue in ( + ('Generic_ESPNOW_companion_radio_full', 32, 0, 100, 224), + ('Heltec_Wireless_Tracker_companion_radio_full', 32, 32, 150, 256), + ('MKE_s3_companion_radio_full', 32, 32, 350, 256), + ('ThinkNode_M2_companion_radio_full', 32, 32, 350, 256), + ('ThinkNode_M5_companion_radio_full', 32, 32, 350, 256), + ('SenseCapIndicator-ESPNow_companion_radio_full', 0, 0, 350, 256), + ('RAK_4631_companion_radio_full', 0, 0, 350, 256)): + with self.subTest(target=target): + program = ('env_name=' + shlex.quote(target) + '\nPLATFORMIO_BUILD_FLAGS=""\n' + 'append_platformio_build_unflags() { :; }\nrecord_build_reduction() { :; }\n' + 'requires_esp32_companion_full_ota_fallback() { return 1; }\n' + case + + '\nprintf "%s" "$PLATFORMIO_BUILD_FLAGS"\n') + result = subprocess.run(['bash', '-c', program], capture_output=True, text=True, timeout=15) + self.assertEqual(result.returncode, 0, result.stderr) + flags = dict(re.findall(r'-D([A-Z0-9_]+)=(\d+)', result.stdout)) + self.assertEqual(int(flags.get('COMPANION_RTC_FAST_OFFLINE_FRAMES', 0)), fast) + self.assertEqual(int(flags.get('COMPANION_RTC_SLOW_OFFLINE_FRAMES', 0)), slow) + self.assertEqual(int(flags.get('MAX_CONTACTS', 350)), contacts) + self.assertEqual(int(flags.get('OFFLINE_QUEUE_SIZE', 256)), queue) + self.assertNotIn('OTA_SHARED_COMPANION_QUEUE', flags) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_esp32_full_size.py b/test/test_esp32_full_size.py new file mode 100644 index 000000000..ca427feed --- /dev/null +++ b/test/test_esp32_full_size.py @@ -0,0 +1,126 @@ +#!/usr/bin/env python3 +"""Exercise Full infrastructure selection and final compiler flag precedence.""" +import copy +import importlib.util +from pathlib import Path +import shutil +import subprocess +import tempfile +import unittest + +ROOT = Path(__file__).resolve().parents[1] +SPEC = importlib.util.spec_from_file_location("esp32_full_size", ROOT / "scripts/esp32_full_size.py") +POLICY = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(POLICY) + + +class Board(dict): + pass + + +class FakeEnvironment(dict): + def __init__(self, *, flash="4MB", mcu="esp32s3", role="simple_repeater"): + super().__init__(SRC_FILTER="+<../examples/%s>" % role, + BUILD_FLAGS=[], CPPDEFINES=[], CCFLAGS=["-Os"], + CXXFLAGS=["-std=c++11", "-fexceptions"], CFLAGS=[], LINKFLAGS=["-Wl,--gc-sections"]) + self.board = Board({"build.mcu": mcu, "upload.flash_size": flash}) + self.middleware = [] + + def BoardConfig(self): + return self.board + + def PioPlatform(self): + return type("Platform", (), {"name": "espressif32"})() + + def Replace(self, **values): + self.update(values) + + def AppendUnique(self, **values): + for key, items in values.items(): + self.setdefault(key, []).extend(item for item in items if item not in self.get(key, [])) + + def AddBuildMiddleware(self, callback): + self.middleware.append(callback) + + +class FullEsp32SizeTests(unittest.TestCase): + def test_only_one_full_esp32_infrastructure_role_is_selected(self): + for role in POLICY.ROLES: + self.assertTrue(POLICY.infrastructure_policy("espressif32", "esp32s3", "+<%s>" % role, full=True)) + self.assertFalse(POLICY.infrastructure_policy("espressif32", "esp32s3", "+<%s>" % role)) + self.assertFalse(POLICY.infrastructure_policy("nordicnrf52", "nrf52840", "+<%s>" % role, full=True)) + self.assertFalse(POLICY.infrastructure_policy("espressif32", "esp32", "+<%s>" % role, full=True, companion=True)) + self.assertFalse(POLICY.infrastructure_policy("espressif32", "esp32", "+<../examples/simple_repeater> +<../examples/simple_room_server>", full=True)) + for role in POLICY.EXCLUDED_ROLES: + self.assertFalse(POLICY.infrastructure_policy("espressif32", "esp32", "+<../examples/simple_repeater> +<%s>" % role, full=True)) + self.assertFalse(POLICY.infrastructure_policy("espressif32", "esp32", "+<../examples/simple_repeater> -<../examples/simple_repeater/main.cpp>", full=True)) + + def test_compact_crypto_scopes_small_flash_and_preserves_explicit_options(self): + self.assertEqual(POLICY.compact_definitions(8 * 1024 * 1024), {}) + values = POLICY.compact_definitions(4 * 1024 * 1024) + self.assertEqual(values, POLICY.COMPACT_DEFINES) + self.assertNotIn("ED25519_COMPACT_BASE", values) + self.assertNotIn("MAX_NEIGHBOURS", values) + explicit = POLICY.compact_definitions(4 * 1024 * 1024, + "-DED25519_SMALL_BASE=0 -UED25519_COMPACT_FIELD -DED25519_USE_CRYPTO_SHA512=0") + for name in ("ED25519_SMALL_BASE", "ED25519_COMPACT_FIELD", "ED25519_USE_CRYPTO_SHA512"): + self.assertNotIn(name, explicit) + self.assertNotIn("ED25519_SMALL_BASE", POLICY.compact_definitions(4 * 1024 * 1024, "-DED25519_COMPACT_BASE=1")) + + def test_framework_and_library_flags_are_corrected_after_defaults(self): + env = FakeEnvironment() + self.assertTrue(POLICY.install(env, {"MESHCORE_ESP32_FULL_BUILD": "1"})) + self.assertEqual(dict(env["CPPDEFINES"]), POLICY.COMPACT_DEFINES) + self.assertEqual(len(env.middleware), 1) + # Emulate Arduino appending its flags after pre-scripts and then + # PlatformIO cloning environments for framework and dependency code. + for label in ("framework", "dependency", "application"): + clone = copy.deepcopy(env) + clone["CCFLAGS"] += ["-funwind-tables", "-fasynchronous-unwind-tables", "-fexceptions"] + clone["CXXFLAGS"] += ["-fexceptions", "-funwind-tables"] + clone["LINKFLAGS"] += ["-fexceptions", "-fasynchronous-unwind-tables"] + node = object() + self.assertIs(env.middleware[0](clone, node), node, label) + for key in ("CCFLAGS", "CFLAGS", "CXXFLAGS", "LINKFLAGS"): + self.assertFalse(POLICY.POSITIVE_FLAGS.intersection(clone[key])) + self.assertTrue(set(POLICY.UNWIND_FLAGS).issubset(clone[key])) + self.assertIn("-fno-exceptions", clone["CXXFLAGS"]) + self.assertIn("-Wl,--gc-sections", clone["LINKFLAGS"]) + self.assertIn("-Os", clone["CCFLAGS"]) + first = copy.deepcopy(dict(clone)) + POLICY.apply_final_flags(clone) + self.assertEqual(dict(clone), first) + + def test_companion_standard_and_nrf52_environment_remain_unchanged(self): + for args, process in (({}, {}), ({}, {"MESHCORE_ESP32_FULL_BUILD": "1", "MESHCORE_COMPANION_RADIO_FULL": "1"}), + ({"mcu": "nrf52840"}, {"MESHCORE_ESP32_FULL_BUILD": "1"}), + ({"role": "companion_radio"}, {"MESHCORE_ESP32_FULL_BUILD": "1"})): + env = FakeEnvironment(**args) + original = copy.deepcopy(dict(env)) + self.assertFalse(POLICY.install(env, process)) + self.assertEqual(dict(env), original) + self.assertEqual(env.middleware, []) + large = FakeEnvironment(flash="16MB") + self.assertTrue(POLICY.install(large, {"MESHCORE_ESP32_FULL_BUILD": "1"})) + self.assertEqual(large["CPPDEFINES"], []) + + def test_final_flags_remove_unwinding_without_changing_object_functions(self): + compiler = shutil.which("g++") + readelf = shutil.which("readelf") + self.assertTrue(compiler and readelf) + env = FakeEnvironment() + env["CCFLAGS"] = ["-Os", "-funwind-tables", "-fasynchronous-unwind-tables"] + POLICY.apply_final_flags(env) + with tempfile.TemporaryDirectory() as directory: + source = Path(directory) / "policy.cpp" + source.write_text('struct Radio { virtual int receive() = 0; };\nint receive_packet(Radio* r) { return r->receive(); }\n') + obj = source.with_suffix(".o") + subprocess.run([compiler, *env["CCFLAGS"], *env["CXXFLAGS"], "-c", str(source), "-o", str(obj)], check=True) + sections = subprocess.check_output([readelf, "-SW", str(obj)], text=True) + symbols = subprocess.check_output(["nm", "-C", str(obj)], text=True) + self.assertNotIn(".eh_frame", sections) + self.assertIn("receive_packet(Radio*)", symbols) + + +if __name__ == "__main__": + unittest.main() diff --git a/test/test_esp32_uart_quiet_session.py b/test/test_esp32_uart_quiet_session.py index 00c82f3a4..28898f161 100644 --- a/test/test_esp32_uart_quiet_session.py +++ b/test/test_esp32_uart_quiet_session.py @@ -190,7 +190,7 @@ int main(int argc,char**) { // still-assumed-connected interface. A real RX queues MSG_WAITING forever. assert(usb_serial_interface.isEnabled());receive(0); assert(the_mesh.offline_queue_len==1&&interface_manager.hasPendingIO()); - assert(the_mesh.serialVeto()==mesh::powerdiag::mask(mesh::powerdiag::Reason::Serial)); + assert(the_mesh.serialVeto()==mesh::powerdiag::mask(mesh::powerdiag::Reason::SerialIO)); puts("old UART quiet retained MSG_WAITING serial veto");return 42; } assert(!usb_serial_interface.isEnabled()&&!interface_manager.isConnected()); @@ -214,7 +214,7 @@ int main(int argc,char**) { the_mesh.pending_route=the_mesh.stream_route=&other_interface; assert(interface_manager.writeFrameToRoute(&other_interface,&ack,1)==1); assert(interface_manager.hasPendingIO()); - assert(the_mesh.serialVeto()==mesh::powerdiag::mask(mesh::powerdiag::Reason::Serial)); + assert(the_mesh.serialVeto()==mesh::powerdiag::mask(mesh::powerdiag::Reason::SerialIO)); assert(!transitionCompanionUartQuietSession(nullptr,UartQuietSessionAction::Resume)); assert(!usb_serial_interface.isEnabled()&&the_mesh.pending_route==&other_interface); other_stream.write_capacity=4096;interface_manager.loop(); @@ -297,7 +297,7 @@ def harness(legacy=False): park = " if (!mesh::esp32::transitionUartQuietSession(\n mesh::esp32::UartQuietSessionAction::Park)) return;\n" assert board.count(park) == 1 board = board.replace(park, "", 1) - guard = re.search(r" if \(_serial != NULL && _serial->hasPendingIO\(\)\) return mask\(Reason::Serial\);", source) + guard = re.search(r" if \(_serial != NULL && _serial->hasPendingIO\(\)\) return mask\(Reason::SerialIO\);", source) assert guard is not None result = PRELUDE for marker, value in {"@CONSTANTS@": constants, "@BUFFER@": extract_braced(native, "class BufferStream") + ";", diff --git a/test/test_flood_advert_iram.py b/test/test_flood_advert_iram.py new file mode 100644 index 000000000..5efb58e31 --- /dev/null +++ b/test/test_flood_advert_iram.py @@ -0,0 +1,150 @@ +"""Preserve the complete limiter using explicit word-only SRAM0 storage.""" +from pathlib import Path +import os +import resource +import re +import signal +import subprocess +import tempfile +import unittest + +from test_flood_advert_rtc import HARNESS + +ROOT=Path(__file__).resolve().parents[1] + + +class FloodAdvertIramTests(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.temp=tempfile.TemporaryDirectory(prefix='advert-iram-') + cls.work=Path(cls.temp.name) + (cls.work/'sdkconfig.h').write_text('#define CONFIG_IDF_TARGET_ESP32 1\n') + cls.compiler=[os.environ.get('CXX','g++')] + + @classmethod + def tearDownClass(cls): cls.temp.cleanup() + + def build(self,enabled,mutate=False): + name='probe-'+str(enabled)+('-mutated' if mutate else '') + cpp=self.work/(name+'.cpp');binary=self.work/name + code=HARNESS.replace('@BANKS@','') + code=code.replace('if(!std::strcmp(mode,"lifetime")) {', + 'if(!std::strcmp(mode,"lifetime")) {\n' + '#if FLOOD_ADVERT_IRAM_WORD_STORAGE\n' + ' for(unsigned i=0;i<128*35;++i) mesh::floodAdvertIramBank()[i]=0xffffffffU;\n' + '#endif\n') + code=code.replace('CHECK(limiter.listLimited(0,0,nullptr,0)==0);', + 'CHECK(limiter.listLimited(0,0,nullptr,0)==0);\n' + '#if FLOOD_ADVERT_IRAM_WORD_STORAGE\n' + ' for(unsigned i=0;i<128*35;++i) CHECK(mesh::floodAdvertIramBank()[i]==0);\n' + '#endif\n') + # Repeat the original full-capacity trace with colliding prefixes, whose + # distinct complete keys must still share quota and retain own strikes. + code=code.replace('key[0] = uint8_t(i); key[1] = uint8_t(i >> 8);', + 'key[0] = uint8_t(i / 2); key[1] = uint8_t(i >> 8);') + cpp.write_text(code) + source=ROOT/'src/helpers/FloodAdvertLimiterIram.cpp' + if mutate: + text=source.read_text() + begin=text.index('void FloodAdvertLimiter::storeEntry(') + body=text.index('{',begin)+1 + text=text[:body]+'\n (void)index; (void)source; return;\n'+text[body:] + source=self.work/'mutated.cpp';source.write_text(text) + args=['-std=c++11','-Os','-DNDEBUG','-Wall','-Wextra','-Werror', + '-fsanitize=address,undefined','-fno-sanitize-recover=all','-fno-pie','-no-pie', + '-DESP32_PLATFORM=1','-DMESHCORE_EXPANDED_PARTITION_PROFILE=1', + '-DFLOOD_ADVERT_IRAM_WORD_STORAGE='+str(enabled), + '-I',str(self.work),'-I',str(ROOT/'src/helpers'),'-isystem',str(ROOT/'src'),'-isystem',str(ROOT/'test/mocks')] + r=subprocess.run(self.compiler+args+[str(cpp),str(ROOT/'src/helpers/FloodAdvertLimiter.cpp'),str(source),'-o',str(binary)],capture_output=True,text=True,timeout=30) + self.assertEqual(r.returncode,0,r.stdout+r.stderr) + return binary + + def test_complete_contiguous_and_word_only_traces_are_identical(self): + baseline=subprocess.run([str(self.build(0))],capture_output=True,text=True,check=True,timeout=20).stdout + result=subprocess.run([str(self.build(1))],capture_output=True,text=True,timeout=20) + self.assertEqual(result.returncode,0,result.stderr) + self.assertEqual(result.stdout,baseline) + self.assertIn('limited=128',result.stdout) + + def test_noload_dirty_records_are_cleared_on_owner_recreation(self): + r=subprocess.run([str(self.build(1)),'lifetime'],capture_output=True,text=True,timeout=20) + self.assertEqual(r.returncode,0,r.stdout+r.stderr) + + def test_ndebug_still_rejects_a_second_owner(self): + def no_core(): resource.setrlimit(resource.RLIMIT_CORE,(0,0)) + r=subprocess.run([str(self.build(1)),'owners'],capture_output=True,text=True,preexec_fn=no_core,timeout=20) + self.assertEqual(r.returncode,-signal.SIGABRT,r.stdout+r.stderr) + + def test_missing_word_writeback_is_detected(self): + baseline=subprocess.run([str(self.build(0))],capture_output=True,text=True,check=True,timeout=20).stdout + result=subprocess.run([str(self.build(1,mutate=True))],capture_output=True,text=True,timeout=20) + self.assertNotEqual(result.stdout,baseline) + + def test_unselected_backend_produces_no_code_or_storage(self): + obj=self.work/'unselected.o' + built=subprocess.run(self.compiler+['-std=c++11','-Os','-DNDEBUG', + '-DFLOOD_ADVERT_IRAM_WORD_STORAGE=0','-isystem',str(ROOT/'src'), + '-isystem',str(ROOT/'test/mocks'),'-c',str(ROOT/'src/helpers/FloodAdvertLimiterIram.cpp'), + '-o',str(obj)],capture_output=True,text=True,timeout=20) + self.assertEqual(built.returncode,0,built.stdout+built.stderr) + symbols=subprocess.run(['nm','-C',str(obj)],capture_output=True,text=True,check=True).stdout + self.assertEqual(symbols.strip(),'') + sections=subprocess.run(['objdump','-h',str(obj)],capture_output=True,text=True,check=True).stdout + for section,size in re.findall(r'^\s*\d+\s+(\S+)\s+([0-9a-f]+)',sections,re.M): + if section.startswith(('.text','.data','.bss','.rodata','.literal')): + self.assertEqual(int(size,16),0,section) + + def test_only_qualified_classic_full_recipes_select_word_storage(self): + text=(ROOT/'build_legacy.sh').read_text() + start=text.index('apply_esp32_iram_advert_storage_profile() {') + end=text.index('\n}\n',start)+2 + function=text[start:end] + fixtures=( + ('LilyGo_TLora_V2_1_1_6_repeater_',True), + ('LilyGo_TLora_V2_1_1_6_repeater_observer_mqtt_',True), + ('LilyGo_TLora_V2_1_1_6_room_server_',True), + ('LilyGo_TLora_V2_1_1_6_room_server_observer_mqtt_',True), + ('Tbeam_SX1262_repeater_observer_mqtt',True), + ('Tbeam_SX1276_repeater_observer_mqtt',True), + ('Tbeam_SX1262_room_server_observer_mqtt',False), + ('Tbeam_SX1276_companion_radio_ble',False), + ('LilyGo_TLora_V2_1_1_6_companion_radio_ble',False), + ('Heltec_Wireless_Tracker_repeater',False), + ('RAK_4631_repeater',False)) + for full in ('0','1'): + for supported in ('0','1'): + for target,qualified in fixtures: + with self.subTest(full=full,supported=supported,target=target): + code=('ESP32_FULL_BUILD="$1"\nQUALIFIED="$2"\n' + 'PLATFORMIO_BUILD_FLAGS="-DEXISTING=1"\n' + 'supports_esp32_full_build() { [ "$QUALIFIED" = 1 ]; }\n' + +function+'\napply_esp32_iram_advert_storage_profile "$3"\n' + 'printf "%s" "$PLATFORMIO_BUILD_FLAGS"\n') + result=subprocess.run(['bash','-c',code,'bash',full,supported,target], + capture_output=True,text=True,check=True,timeout=10) + expected='-DEXISTING=1' + if full=='1' and supported=='1' and qualified: + expected+=' -DFLOOD_ADVERT_IRAM_WORD_STORAGE=1' + self.assertEqual(result.stdout,expected) + body=text[text.index('build_firmware() {'):] + self.assertEqual(body.count('apply_esp32_iram_advert_storage_profile "$env_name"'),1) + self.assertLess(body.index('apply_esp32_full_size_profile "$env_name"'), + body.index('apply_esp32_iram_advert_storage_profile "$env_name"')) + + def test_unsupported_soc_byte_emulation_and_mixed_backends_are_rejected(self): + src=self.work/'invalid.cpp';src.write_text('#include \n') + isolated=self.work/'bad';isolated.mkdir(exist_ok=True) + for config,extra in ( + ('#define CONFIG_IDF_TARGET_ESP32S3 1\n',[]), + ('#define CONFIG_IDF_TARGET_ESP32 1\n#define CONFIG_ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY 1\n',[]), + ('#define CONFIG_IDF_TARGET_ESP32 1\n',['-DFLOOD_ADVERT_RTC_FAST_SLOTS=16'])): + with self.subTest(config=config,extra=extra): + (isolated/'sdkconfig.h').write_text(config) + r=subprocess.run(self.compiler+['-std=c++11','-fsyntax-only', + '-DESP32_PLATFORM=1','-DMESHCORE_EXPANDED_PARTITION_PROFILE=1','-DFLOOD_ADVERT_IRAM_WORD_STORAGE=1', + '-I',str(isolated),'-I',str(self.work),'-isystem',str(ROOT/'src'),'-isystem',str(ROOT/'test/mocks'), + *extra,str(src)],capture_output=True,text=True,timeout=15) + self.assertNotEqual(r.returncode,0) + + +if __name__=='__main__': unittest.main() diff --git a/test/test_flood_advert_rtc.py b/test/test_flood_advert_rtc.py new file mode 100644 index 000000000..440b8da21 --- /dev/null +++ b/test/test_flood_advert_rtc.py @@ -0,0 +1,257 @@ +"""Preserve every advert record across real RTC banks and owner lifecycles.""" +from pathlib import Path +import os +import re +import resource +import signal +import subprocess +import tempfile +import unittest + +ROOT = Path(__file__).resolve().parents[1] + +HARNESS = r''' +#include +#include +#include +#include +#include +#include +#include +@BANKS@ +#if FLOOD_ADVERT_RTC_FAST_SLOTS || FLOOD_ADVERT_RTC_SLOW_SLOTS +#define MAKE_LIMITER(name) mesh::StaticFloodAdvertLimiter<> name(repeaterRtcAdvertFastBank(), repeaterRtcAdvertSlowBank()) +#else +#define MAKE_LIMITER(name) mesh::StaticFloodAdvertLimiter<> name +#endif +#define CHECK(value) do { if (!(value)) std::abort(); } while (0) +static void keyFor(unsigned i, uint8_t key[PUB_KEY_SIZE]) { + memset(key, 0, PUB_KEY_SIZE); + key[0] = uint8_t(i); key[1] = uint8_t(i >> 8); + key[31] = uint8_t(i ^ 0xa5); +} +static void show(mesh::FloodAdvertLimiter& limiter, uint32_t now) { + mesh::FloodAdvertLimiter::LimitedEntry rows[128]; + size_t count = limiter.listLimited(now, 0, rows, 128); + std::printf("limited=%u\n", unsigned(count)); + for (size_t i = 0; i < count; ++i) + std::printf("%u %u %u %u %u %u %u %u\n", rows[i].key[0],rows[i].key[1], + rows[i].wait_ms,rows[i].recovery_ms,rows[i].forwarded,rows[i].quota,rows[i].hops,rows[i].reasons); +} +static void populate(mesh::FloodAdvertLimiter& limiter, uint32_t now) { + for (unsigned i = 0; i < 128; ++i) { + uint8_t key[PUB_KEY_SIZE],hash[MAX_HASH_SIZE] = {}; + keyFor(i,key); + for (unsigned h=0; h < 11; ++h) { + hash[0]=uint8_t(h);hash[7]=uint8_t(i); + limiter.observe(key,hash,8,now+h); + auto d=limiter.check(key,hash,now+h); + std::printf("%u:%u:%u ",i,h,unsigned(d)); + if(d==mesh::FloodAdvertLimiter::Decision::Allow) limiter.commit(key,hash,now+h); + limiter.noteKnownCopy(key,hash,now+h+1); + } + } + std::puts(""); +} +int main(int argc,char**argv) { + const char* mode=argc>1?argv[1]:"trace"; +#if FLOOD_ADVERT_RTC_FAST_SLOTS + if(!std::strcmp(mode,"misaligned")) { + mesh::StaticFloodAdvertLimiter<> invalid( + reinterpret_cast( + reinterpret_cast(repeaterRtcAdvertFastBank())+1), + repeaterRtcAdvertSlowBank()); + return 0; + } +#endif + if(!std::strcmp(mode,"owners")) { + MAKE_LIMITER(first); + MAKE_LIMITER(second); + return 0; + } + if(!std::strcmp(mode,"lifetime")) { +#if FLOOD_ADVERT_RTC_FAST_SLOTS + std::memset(repeater_rtc_advert_fast,0xff,sizeof(repeater_rtc_advert_fast)); +#endif +#if FLOOD_ADVERT_RTC_SLOW_SLOTS + std::memset(repeater_rtc_advert_slow,0xff,sizeof(repeater_rtc_advert_slow)); +#endif + for(unsigned restart=0;restart<3;++restart) { + MAKE_LIMITER(limiter); + CHECK(limiter.listLimited(0,0,nullptr,0)==0); +#if FLOOD_ADVERT_RTC_FAST_SLOTS + for(unsigned char b: reinterpret_cast(repeater_rtc_advert_fast)) CHECK(b==0); +#endif +#if FLOOD_ADVERT_RTC_SLOW_SLOTS + for(unsigned char b: reinterpret_cast(repeater_rtc_advert_slow)) CHECK(b==0); +#endif + populate(limiter,1000); + CHECK(limiter.listLimited(1011,0,nullptr,0)==128); +#if FLOOD_ADVERT_RTC_FAST_SLOTS + CHECK(repeater_rtc_advert_fast[0].key[0] == 128-FLOOD_ADVERT_RTC_FAST_SLOTS-FLOOD_ADVERT_RTC_SLOW_SLOTS); + CHECK(repeater_rtc_advert_fast[FLOOD_ADVERT_RTC_FAST_SLOTS-1].key[0] == 127-FLOOD_ADVERT_RTC_SLOW_SLOTS); +#endif +#if FLOOD_ADVERT_RTC_SLOW_SLOTS + CHECK(repeater_rtc_advert_slow[0].key[0] == 128-FLOOD_ADVERT_RTC_SLOW_SLOTS); + CHECK(repeater_rtc_advert_slow[FLOOD_ADVERT_RTC_SLOW_SLOTS-1].key[0] == 127); +#endif + limiter.reset(); + CHECK(limiter.listLimited(1011,0,nullptr,0)==0); + populate(limiter,2000); + } + return 0; + } + MAKE_LIMITER(limiter); + for(unsigned epoch=0;epoch<2;++epoch) { + uint32_t now=epoch?0xfffff000U:1000U; + limiter.reset();populate(limiter,now);show(limiter,now+20); + now+=mesh::FloodAdvertLimiter::WINDOW_MS+1; + populate(limiter,now);show(limiter,now+20); + uint8_t extra[PUB_KEY_SIZE],hash[MAX_HASH_SIZE]={};keyFor(511,extra); + limiter.observe(extra,hash,8,now+30); + std::printf("capacity=%u\n",unsigned(limiter.check(extra,hash,now+30))); + uint8_t first[PUB_KEY_SIZE];keyFor(0,first);limiter.clear(first); + limiter.observe(extra,hash,8,now+31); + std::printf("cleared=%u\n",unsigned(limiter.check(extra,hash,now+31))); + show(limiter,now+mesh::FloodAdvertLimiter::BAD_INTERVAL_MS); + limiter.tick(now+mesh::FloodAdvertLimiter::RECOVERY_MS+100); + show(limiter,now+mesh::FloodAdvertLimiter::RECOVERY_MS+100); + } +} +''' + + +class FloodAdvertRtcTests(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.temp=tempfile.TemporaryDirectory(prefix='advert-rtc-') + cls.work=Path(cls.temp.name) + (cls.work/'sdkconfig.h').write_text('#define CONFIG_IDF_TARGET_ESP32S3 1\n#define CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP 1\n') + (cls.work/'esp_attr.h').write_text('#define RTC_FAST_ATTR __attribute__((section(".rtc.force_fast")))\n#define RTC_SLOW_ATTR __attribute__((section(".rtc.force_slow")))\n') + src=(ROOT/'examples/simple_repeater/MyMesh.cpp').read_text() + start=src.index('#if FLOOD_ADVERT_RTC_FAST_SLOTS\n') + end=src.index('\n#endif',src.index('mesh::FloodAdvertLimiter::Entry* repeaterRtcAdvertSlowBank()',start))+len('\n#endif') + end=src.index('\n#endif',end)+len('\n#endif') + cls.banks=src[start:end] + cls.compiler=[os.environ.get('CXX','g++')] + + @classmethod + def tearDownClass(cls): cls.temp.cleanup() + + def build(self,fast,slow): + name='probe-%d-%d'%(fast,slow) + cpp=self.work/(name+'.cpp');binary=self.work/name + cpp.write_text(HARNESS.replace('@BANKS@',self.banks)) + flags=['-std=c++11','-Os','-DNDEBUG','-Wall','-Wextra','-Werror', + '-fsanitize=address,undefined','-fno-sanitize-recover=all','-fno-pie','-no-pie', + '-DFLOOD_ADVERT_RTC_FAST_SLOTS='+str(fast),'-DFLOOD_ADVERT_RTC_SLOW_SLOTS='+str(slow), + '-DESP32_PLATFORM=1','-DMESHCORE_EXPANDED_PARTITION_PROFILE=1', + '-I',str(self.work),'-isystem',str(ROOT/'src'),'-isystem',str(ROOT/'test/mocks')] + r=subprocess.run(self.compiler+flags+[str(cpp),str(ROOT/'src/helpers/FloodAdvertLimiter.cpp'),'-o',str(binary)],capture_output=True,text=True,timeout=30) + self.assertEqual(r.returncode,0,r.stdout+r.stderr) + return binary + + def test_all_records_and_decisions_match_original_contiguous_table(self): + baseline=subprocess.run([str(self.build(0,0))],capture_output=True,text=True,check=True,timeout=15).stdout + self.assertIn('limited=128',baseline) + for fast,slow in ((50,50),(16,0)): + with self.subTest(fast=fast,slow=slow): + r=subprocess.run([str(self.build(fast,slow))],capture_output=True,text=True,timeout=15) + self.assertEqual(r.returncode,0,r.stderr) + self.assertEqual(r.stdout,baseline) + + def test_retained_bytes_reset_and_all_bank_boundaries_survive_recreation(self): + for fast,slow in ((50,50),(16,0)): + with self.subTest(fast=fast,slow=slow): + r=subprocess.run([str(self.build(fast,slow)),'lifetime'],capture_output=True,text=True,timeout=15) + self.assertEqual(r.returncode,0,r.stdout+r.stderr) + + def test_release_build_rejects_a_second_owner(self): + def no_core(): resource.setrlimit(resource.RLIMIT_CORE,(0,0)) + r=subprocess.run([str(self.build(50,50)),'owners'],capture_output=True,text=True,preexec_fn=no_core,timeout=15) + self.assertEqual(r.returncode,-signal.SIGABRT,r.stdout+r.stderr) + + def test_concrete_sections_and_small_constructor_stack(self): + source=self.work/'sections.cpp' + source.write_text('#include \n'+self.banks+ + '\nmesh::StaticFloodAdvertLimiter<> limiter(repeaterRtcAdvertFastBank(),repeaterRtcAdvertSlowBank());\n' + 'void reset_limiter() { limiter.reset(); }\n') + obj=self.work/'sections.o' + r=subprocess.run(self.compiler+['-std=c++11','-Os','-DNDEBUG','-fstack-usage', + '-DFLOOD_ADVERT_RTC_FAST_SLOTS=50','-DFLOOD_ADVERT_RTC_SLOW_SLOTS=50', + '-DESP32_PLATFORM=1','-DMESHCORE_EXPANDED_PARTITION_PROFILE=1', + '-I',str(self.work),'-isystem',str(ROOT/'src'),'-isystem',str(ROOT/'test/mocks'), + '-c',str(source),'-o',str(obj)],capture_output=True,text=True,timeout=30) + self.assertEqual(r.returncode,0,r.stdout+r.stderr) + table=subprocess.run(['objdump','-h',str(obj)],capture_output=True,text=True,check=True).stdout + for bank in ('fast','slow'): + row=next(line for line in table.splitlines() if '.rtc.force_'+bank in line) + self.assertEqual(int(row.split()[2],16),7000) + self.assertGreaterEqual(int(row.split()[-1].split('**')[-1]),2) + stack=(self.work/'sections.su').read_text() + for line in stack.splitlines(): + self.assertLessEqual(int(line.split('\t')[1]),256,line) + + def test_default_layout_has_no_rtc_owner_or_sdk_dependency(self): + source=self.work/'default.cpp' + source.write_text('#include \n' + '#include \n' + 'constexpr size_t base = ((2*sizeof(void*)+sizeof(uint32_t)+alignof(void*)-1)/alignof(void*))*alignof(void*);\n' + 'static_assert(sizeof(mesh::StaticFloodAdvertLimiter<>)==base+128*140,"original default layout");\n' + 'mesh::StaticFloodAdvertLimiter<> limiter;\n') + obj=self.work/'default.o' + r=subprocess.run(self.compiler+['-std=c++11','-Os','-DNDEBUG', + '-isystem',str(ROOT/'src'),'-isystem',str(ROOT/'test/mocks'), + '-c',str(source),'-o',str(obj)],capture_output=True,text=True,timeout=30) + self.assertEqual(r.returncode,0,r.stdout+r.stderr) + symbols=subprocess.run(['nm','-C',str(obj)],capture_output=True,text=True,check=True).stdout + self.assertNotIn('EntryStorage',symbols) + self.assertNotIn('repeaterRtcAdvert',symbols) + + def test_release_build_rejects_unaligned_bank(self): + def no_core(): resource.setrlimit(resource.RLIMIT_CORE,(0,0)) + r=subprocess.run([str(self.build(50,50)),'misaligned'],capture_output=True,text=True,preexec_fn=no_core,timeout=15) + self.assertEqual(r.returncode,-signal.SIGABRT,r.stdout+r.stderr) + + def test_invalid_hardware_and_capacity_policies_fail_compilation(self): + source=self.work/'invalid.cpp' + source.write_text('#include \n' + 'mesh::StaticFloodAdvertLimiter<>* pointer;\n') + common=['-std=c++11','-fsyntax-only','-DFLOOD_ADVERT_RTC_FAST_SLOTS=50', + '-I',str(self.work),'-isystem',str(ROOT/'src'),'-isystem',str(ROOT/'test/mocks')] + for flags in ([],['-DESP32_PLATFORM=1'], + ['-DESP32_PLATFORM=1','-DMESHCORE_EXPANDED_PARTITION_PROFILE=1','-DFLOOD_ADVERT_RTC_SLOW_SLOTS=80'], + ['-DESP32_PLATFORM=1','-DMESHCORE_EXPANDED_PARTITION_PROFILE=1','-DFLOOD_ADVERT_RTC_SLOW_SLOTS=-1']): + with self.subTest(flags=flags): + r=subprocess.run(self.compiler+common+flags+[str(source)],capture_output=True,text=True,timeout=15) + self.assertNotEqual(r.returncode,0) + isolated=self.work/'unsupported';isolated.mkdir(exist_ok=True) + for config in ('#define CONFIG_IDF_TARGET_ESP32 1\n', + '#define CONFIG_IDF_TARGET_ESP32S3 1\n#define CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP 0\n'): + (isolated/'sdkconfig.h').write_text(config) + r=subprocess.run(self.compiler+['-I',str(isolated)]+common+ + ['-DESP32_PLATFORM=1','-DMESHCORE_EXPANDED_PARTITION_PROFILE=1',str(source)],capture_output=True,text=True,timeout=15) + self.assertNotEqual(r.returncode,0) + + def test_only_exact_full_recipes_select_physical_banks(self): + text=(ROOT/'build_legacy.sh').read_text() + start=text.index(' case "${env_name,,}" in',text.index(' # Preserve all 128 advert-source records')) + end=text.index('\n esac',start)+len('\n esac') + case=text[start:end] + for target,fast,slow in ( + ('Heltec_Wireless_Tracker_repeater',50,50), + ('Heltec_Wireless_Tracker_repeater_observer_mqtt',50,50), + ('heltec_tracker_v2_repeater',50,50), + ('Heltec_T190_repeater_',16,0), + ('Heltec_T190_repeater_observer_mqtt',16,0), + ('Heltec_T190_room_server_',0,0), + ('RAK_4631_repeater',0,0), + ('heltec_tracker_v2_companion_radio_full_femon',0,0)): + with self.subTest(target=target): + r=subprocess.run(['bash','-c','env_name="$1"\nPLATFORMIO_BUILD_FLAGS=""\n'+case+'\nprintf "%s" "$PLATFORMIO_BUILD_FLAGS"','bash',target],capture_output=True,text=True,check=True,timeout=10) + flags=dict(re.findall(r'-D([A-Z0-9_]+)=(\d+)',r.stdout)) + self.assertEqual(int(flags.get('FLOOD_ADVERT_RTC_FAST_SLOTS',0)),fast) + self.assertEqual(int(flags.get('FLOOD_ADVERT_RTC_SLOW_SLOTS',0)),slow) + + +if __name__=='__main__': unittest.main() diff --git a/test/test_neighbor_scope_storage.py b/test/test_neighbor_scope_storage.py index c69bc1881..eb9886331 100644 --- a/test/test_neighbor_scope_storage.py +++ b/test/test_neighbor_scope_storage.py @@ -12,14 +12,16 @@ ROOT = Path(__file__).resolve().parents[1] class NeighborScopeStorageTest(unittest.TestCase): + role = "simple_repeater" + def bridge_constants(self): source = (ROOT / "src/helpers/bridges/MQTTBridge.h").read_text() start = source.index(" #if defined(BOARD_HAS_PSRAM)", source.index("// Single source of truth for the neighbors JSON size")) return source[start:source.index(" // Called by the mesh", start)] def test_response_bounds_and_publish_prefix(self): - header = (ROOT / "examples/simple_repeater/MyMesh.h").read_text() - source = (ROOT / "examples/simple_repeater/MyMesh.cpp").read_text() + header = (ROOT / "examples" / self.role / "MyMesh.h").read_text() + source = (ROOT / "examples" / self.role / "MyMesh.cpp").read_text() layout = header[header.index(" struct NeighborDiscoverEntry {"): header.index(" uint8_t neighbor_discover_count;")] methods = "\n".join(extract_braced(source, signature) for signature in ( @@ -72,7 +74,7 @@ int main() { memcpy(response, &tag, 4); memset(response + 8, 'x', sizeof(response) - 8); for (int i = 0; i <= 20; ++i) { - auto& entry = m.neighbor_discover[i]; + auto& entry = m.neighbor_discover_metadata[i]; entry.status = MyMesh::ND_PENDING; entry.tag = tag; assert(m.handleNeighborDiscoverResponse(i, response, sizeof(response), 5, -100)); @@ -92,9 +94,9 @@ int main() { str(path / "test.cpp"), "-o", str(path / "test")], check=True) subprocess.run([str(path / "test")], check=True) - def real_serializer_fixture(self): - header = (ROOT / "examples/simple_repeater/MyMesh.h").read_text() - source = (ROOT / "examples/simple_repeater/MyMesh.cpp").read_text() + def real_serializer_fixture(self, psram=True): + header = (ROOT / "examples" / self.role / "MyMesh.h").read_text() + source = (ROOT / "examples" / self.role / "MyMesh.cpp").read_text() layout = header[header.index(" struct NeighborDiscoverEntry {"): header.index(" uint8_t neighbor_discover_count;")] methods = "\n".join(extract_braced(source, signature) for signature in ( @@ -106,14 +108,21 @@ int main() { " ? MAX_NEIGHBOURS : MQTTBridge::NEIGHBORS_SCOPE_RESULT_CAPACITY;", " static constexpr size_t NEIGHBOR_SCOPE_RESULTS = MAX_NEIGHBOURS;") legacy_layout = legacy_layout.replace( - " uint32_t tag; // anon-regions request tag we're waiting on\n" - " int16_t rssi; // dBm from the last packet heard from this neighbour\n" - " int8_t snr; // multiplied by 4\n", - " int8_t snr; // multiplied by 4\n" - " int16_t rssi; // dBm from the last packet heard from this neighbour\n" - " uint32_t tag; // anon-regions request tag we're waiting on\n") + " uint32_t heard_timestamp;\n" + " uint32_t tag;\n" + " int16_t rssi;\n" + " int8_t snr;\n", + " uint32_t heard_timestamp;\n" + " int8_t snr;\n" + " int16_t rssi;\n" + " uint32_t tag;\n") + legacy_layout = legacy_layout.replace( + 'sizeof(NeighborDiscoverMetadata) == 12', + 'sizeof(NeighborDiscoverMetadata) == 16') self.assertNotEqual(layout, legacy_layout) fixture = (ROOT / "test/fixtures/neighbor_scope_storage.cpp").read_text() + if not psram: + fixture = fixture.replace("#define BOARD_HAS_PSRAM 1\n", "") return (fixture.replace("@BRIDGE_CONSTANTS@", self.bridge_constants()) .replace("@LAYOUT@", layout).replace("@METHODS@", methods) .replace("@LEGACY_LAYOUT@", legacy_layout) @@ -147,8 +156,100 @@ int main() { self.assertEqual(checked.returncode, 0, checked.stdout + checked.stderr) self.assertIn("real neighbor serialization", checked.stdout) + def lifecycle_fixture(self): + header = (ROOT / "examples" / self.role / "MyMesh.h").read_text() + source = (ROOT / "examples" / self.role / "MyMesh.cpp").read_text() + layout = header[header.index(" struct NeighborDiscoverEntry {"): + header.index(" uint8_t neighbor_discover_count;")] + legacy = layout.replace( + " static constexpr size_t NEIGHBOR_SCOPE_RESULTS =\n" + " MAX_NEIGHBOURS < MQTTBridge::NEIGHBORS_SCOPE_RESULT_CAPACITY\n" + " ? MAX_NEIGHBOURS : MQTTBridge::NEIGHBORS_SCOPE_RESULT_CAPACITY;", + " static constexpr size_t NEIGHBOR_SCOPE_RESULTS = MAX_NEIGHBOURS;") + start = header.index(" uint8_t neighbor_discover_count;") + end = header.index(" char neighbor_discover_origin[32];", start) + fields = header[start:end] + " char neighbor_discover_origin[32];\n" + hooks = extract_braced(extract_braced(source, "void MyMesh::logTx("), + "if (neighbor_discover_active") + fail_hook = extract_braced(extract_braced(source, "void MyMesh::logTxFail("), + "if (neighbor_discover_active") + state = fields + r''' + NeighbourInfo neighbours[MAX_NEIGHBOURS] = {}; + mesh::LocalIdentity self_id = {}; + Cli _cli; Clock clock; MQTTBridge mock_bridge; MQTTBridge* bridge = &mock_bridge; + mesh::Packet packet; + bool admit=true; + int requested=0, touched=0; + ACL acl; GuestLogin guest_login; int matching_peer_indexes[MAX_CLIENTS] = {}; + static const int NEIGHBOR_DISCOVER_PEER_BASE=1000; + Clock* getRTCClock() { return &clock; } + uint32_t neighborDiscoverQueryTimeoutMs() const { return 100; } + bool cancelNeighborDiscoverRequest() { return false; } + bool isCurrentOutbound(mesh::Packet*) { return false; } + bool neighborDiscoverReady(char*) { return true; } + mesh::Packet* sendAnonRegionsReq(const mesh::Identity&,uint32_t& tag) { + ++requested; tag=uint32_t(requested); return admit ? &packet : nullptr; + } + void touchNeighbourHeard(const mesh::Identity&,uint32_t,float,int16_t) { ++touched; } + void resetNeighborDiscoverJsonBudget() { + strcpy(self_scopes_buf,"sea;pdx"); strcpy(self_default_scope_buf,"sea"); + strcpy(neighbor_discover_origin,"Seattle"); + char key[65]; mesh::Utils::toHex(key,self_id.pub_key,32); + neighbor_discover_publish_count=neighbor_discover_queried_count=0; + neighbor_discover_truncated=false; + neighbor_discover_json_size=MQTTMessageBuilder::measureNeighborsMessageBase( + neighbor_discover_origin,key,"2026-10-10T01:23:45Z",self_scopes_buf, + self_default_scope_buf,neighbor_discover_count); + } + void markTransmitted() { mesh::Packet* pkt=&packet; +''' + hooks + r''' + } + void markFailed() { mesh::Packet* pkt=&packet; +''' + fail_hook + r''' + } + int searchPeersByHash(const uint8_t*); + void getPeerSharedSecret(uint8_t*,int); + bool startNeighborDiscover(char*); + void loopNeighborDiscover(); + void finishNeighborDiscover(); + bool completeNeighborDiscoverEntry(); + bool handleNeighborDiscoverResponse(int,const uint8_t*,size_t,float,int16_t); +''' + methods = "\n".join(extract_braced(source, signature) for signature in ( + "bool MyMesh::startNeighborDiscover(", "void MyMesh::loopNeighborDiscover()", + "void MyMesh::finishNeighborDiscover()", "bool MyMesh::completeNeighborDiscoverEntry()", + "bool MyMesh::handleNeighborDiscoverResponse(", "int MyMesh::searchPeersByHash(", + "void MyMesh::getPeerSharedSecret(")) + methods = methods.replace("mqtt_bridge", "bridge") + helpers = "\n".join(extract_braced(source, signature) for signature in ( + "static bool neighborHeardAgeUsable(", "static bool neighborPublishEntryComesBefore(")) + fixture = (ROOT / "test/fixtures/neighbor_scope_lifecycle.cpp").read_text() + identity = (ROOT / "src/Identity.h").read_text() + fixture = fixture.replace("@HASH_MATCH@", extract_braced(identity, + "bool isHashMatch(const uint8_t* hash) const")) + if self.role == "simple_repeater": + fixture = "#define TEST_REPEATER_ROLE 1\n" + fixture + code = (fixture.replace("@BRIDGE_CONSTANTS@", self.bridge_constants()) + .replace("@HELPERS@", helpers).replace("@LAYOUT@", layout) + .replace("@LEGACY_LAYOUT@", legacy).replace("@STATE@", state) + .replace("@METHODS@", methods) + .replace("@LEGACY_METHODS@", methods.replace("MyMesh::", "LegacyMesh::"))) + return code + + def test_actual_discovery_lifecycle_and_repeated_passes(self): + code = self.lifecycle_fixture() + for psram in (False, True): + with self.subTest(role=self.role, psram=psram): + self.compile_real_serializer(("#define TEST_PSRAM 1\n" if psram else "") + code) + + def test_dropping_unqueried_crypto_keys_fails_overlay_regression(self): + self.compile_real_serializer("#define TEST_LOST_KEY_TAIL 1\n" + self.lifecycle_fixture(), + expect_rejection=True) + def test_full_254_neighbors_keep_every_publishable_entry_and_json(self): - self.compile_real_serializer(self.real_serializer_fixture()) + for psram in (False, True): + with self.subTest(role=self.role, psram=psram): + self.compile_real_serializer(self.real_serializer_fixture(psram)) def test_reintroduced_full_scope_array_fails_runtime_memory_regression(self): fixture = self.real_serializer_fixture() @@ -176,5 +277,9 @@ int main() { self.compile_real_serializer(old, expect_rejection=True) +class RoomNeighborScopeStorageTest(NeighborScopeStorageTest): + role = "simple_room_server" + + if __name__ == "__main__": unittest.main() diff --git a/test/test_official_web_console.py b/test/test_official_web_console.py index e54b6e2ca..56f7da68c 100644 --- a/test/test_official_web_console.py +++ b/test/test_official_web_console.py @@ -60,7 +60,7 @@ def firmware_harness(*, lose_sleep_guard=False, lose_crlf=False, "bool isUsbDataConnected() override", "bool isUsbHostConnected() override")) + "\n" + sleep_held if lose_raw_uart_guard: - expression = "keep_awake = keep_awake || hold(static_cast(Serial), Reason::Serial);" + expression = "keep_awake = keep_awake || hold(static_cast(Serial), Reason::SerialIO);" assert expression in methods, "Missing raw UART negative-control boundary" methods = methods.replace(expression, "keep_awake = keep_awake || false;") source = source.replace("@METHODS@", methods) diff --git a/test/test_ota_source_proofs.py b/test/test_ota_source_proofs.py index 066992fbf..6fa61a288 100644 --- a/test/test_ota_source_proofs.py +++ b/test/test_ota_source_proofs.py @@ -129,6 +129,60 @@ int main() { f"-DENV_INCLUDE_BME680_BSEC={sensors}", ]) + def test_tlora_full_room_preserves_maximum_source_and_bounded_ownership(self): + self.check_grouped_equivalence([ + "-DESP32_PLATFORM=1", "-DLILYGO_TLORA=1", "-DOTA_BOUNDED_SOURCE_PROOFS=1", + ]) + + def test_tlora_room_budget_changes_only_actual_source_workspace(self): + import sys + sys.path.insert(0, str(ROOT / "scripts")) + from check_firmware_ram import requirements + flags = dict(ENABLE_OTA=1, OTA_HEAP_CONTEXT=1, WITH_MQTT_BRIDGE=1, + ADMIN_PASSWORD="password", MQTT_TASK_STACK_SIZE=16384, + DISPLAY_CLASS="SSD1306Display", MESH_ENABLE_ROOM_FLOOD_RULE_ENGINE=1, + MESHCORE_OTA_DEVICE_DEFLATE=1) + target = "LilyGo_TLora_V2_1_1_6_room_server_observer_mqtt_" + before = requirements("ESP32_PLATFORM", flags, target) + after = requirements("ESP32_PLATFORM", dict(flags, OTA_BOUNDED_SOURCE_PROOFS=1), target) + self.assertEqual(before["required_heap_bytes"], 225072) + self.assertEqual(after["required_heap_bytes"], 210224) + self.assertEqual(before["required_contiguous_bytes"], 18464) + self.assertEqual(after["required_contiguous_bytes"], 16400) + self.assertEqual(before["components"]["ota_generic_source_buffers"], 18464) + self.assertEqual(after["components"]["ota_generic_source_buffers"], 3616) + before_parts = dict(before["components"]) + after_parts = dict(after["components"]) + before_parts.pop("ota_generic_source_buffers") + after_parts.pop("ota_generic_source_buffers") + self.assertEqual(before_parts, after_parts) + self.assertEqual(before["mqtt"], after["mqtt"]) + self.assertEqual(after_parts["allocation_and_transient_margin"], 16384) + + def test_tlora_legacy_source_reference_retains_same_maximum_geometry(self): + # Keep the real old all-leaf cache path as the independent comparison: + # actual allocation, all Merkle proofs, maximum leaf count and last DATA + # tail still execute under the exact same ESP32/TLora geometry. + from test_ota_cold_buffers import HOST_MARKERS + with tempfile.TemporaryDirectory(prefix="tlora-legacy-proofs-") as folder: + binary = Path(folder) / "legacy" + files = ("OtaManager.cpp", "OtaProtocol.cpp", "MotaContainer.cpp", "MerkleTree.cpp") + built = subprocess.run([ + os.environ.get("CXX", "g++"), "-std=c++17", "-O1", "-Wall", "-Wextra", "-Werror", + "-Wno-unused-parameter", "-Wno-sign-compare", "-fsanitize=address,undefined", + "-fno-sanitize-recover=all", "-fno-pie", "-no-pie", "-DESP32_PLATFORM=1", + "-DLILYGO_TLORA=1", "-DOTA_BOUNDED_SOURCE_PROOFS=0", + "-I", str(ROOT / "src"), "-I", str(ROOT / "test/mocks"), + str(ROOT / "test/fixtures/ota_cold_buffers/test.cpp"), + *[str(ROOT / "src/helpers/ota" / name) for name in files], str(ROOT / "src/Utils.cpp"), + "-Wl,--wrap=malloc", "-Wl,--wrap=free", "-o", str(binary), + ], capture_output=True, text=True, timeout=90) + self.assertEqual(built.returncode, 0, built.stdout + built.stderr) + ran = subprocess.run([str(binary)], capture_output=True, text=True, timeout=90) + self.assertEqual(ran.returncode, 0, ran.stdout + ran.stderr) + for marker in HOST_MARKERS: + self.assertIn("PASS: " + marker, ran.stdout) + def check_grouped_equivalence(self, flags): # Reuse the existing source/wire/allocator harness, retaining its legacy # tests unchanged in their own suite. Only its helpers precede this point. diff --git a/test/test_power_saving_diagnostics.py b/test/test_power_saving_diagnostics.py index 631813c20..a791a3fea 100644 --- a/test/test_power_saving_diagnostics.py +++ b/test/test_power_saving_diagnostics.py @@ -72,6 +72,63 @@ class PowerSavingDiagnosticsTests(unittest.TestCase): def test_unknown_mask_bits_are_not_exposed_as_real_reasons(self): self.run_case("unknown_mask") + def test_serial_reason_survives_board_alias_include_order_without_changing_protocol(self): + # WM1110 maps Serial to Serial1 in its board header, which may be seen + # before or after this shared diagnostic header in different sources. + header = '#include \n' + alias = '#define Serial Serial1\n' + code = r""" +#include +#include +@CONTEXT@ +using namespace mesh::powerdiag; +static_assert(static_cast(Reason::SerialIO) == 15, + "Serial diagnostics retain their published bit position"); +static_assert(mask(Reason::SerialIO) == 0x008000UL, "Serial mask changed"); +static_assert(static_cast(Reason::Bridge) == 16, "Following reasons moved"); +static_assert(static_cast(Reason::NoWake) == 23, "Final reason moved"); +static_assert(ReasonCount == 24 && ValidMask == 0xffffffUL, "Reason inventory changed"); +int main() { +#ifdef EXPECT_SERIAL_ALIAS + // The diagnostic header must not undefine or retarget the actual UART. + int Serial1 = 7; + assert(Serial == 7); +#endif + assert(!strcmp(reasonName(Reason::SerialIO), "serial")); + setEnabled(true, 100); + decision(mask(Reason::SerialIO), 101); + const Snapshot value = snapshot(111); + assert(value.current == 0x008000UL && value.seen == 0x008000UL); + assert(value.blocked_ms[15] == 10 && value.transitions[15] == 1); + char reply[160]; + assert(handleCommand("get powersaving.diag serial", reply, sizeof(reply), 111)); + assert(!strcmp(reply, + "> serial active=1 seen=1 transitions=1 blocked_ms=10 age_ms=10")); + assert(handleCommand("get powersaving.diag state", reply, sizeof(reply), 111)); + assert(strstr(reply, "why=serial mask=008000 seen=008000")); + assert(handleCommand("get powersaving.diag 6", reply, sizeof(reply), 111)); + assert(strstr(reply, " serial=1/10")); +} +""" + for name, context in ( + ("normal", header), + ("board_before_diagnostics", alias + header), + ("board_after_diagnostics", header + alias)): + with self.subTest(include_order=name): + source = Path(self.temp.name) / (name + '.cpp') + binary = source.with_suffix('') + source.write_text(code.replace('@CONTEXT@', context), encoding='ascii') + result = subprocess.run( + shlex.split(os.environ.get('CXX', 'g++')) + + ['-std=c++11', '-Wall', '-Wextra', '-Werror', '-pedantic', + *(['-DEXPECT_SERIAL_ALIAS=1'] if name != 'normal' else []), + '-I', str(ROOT / 'src'), str(source), '-o', str(binary)], + capture_output=True, text=True, timeout=30) + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + result = subprocess.run([str(binary)], capture_output=True, + text=True, timeout=10) + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + def test_common_cli_routes_without_persisting_preferences(self): source = (ROOT / "src/helpers/CommonCLI.cpp").read_text(encoding="ascii") self.assertIn('#include "PowerSavingDiagnostics.h"', source) diff --git a/test/test_power_saving_role_diagnostics.py b/test/test_power_saving_role_diagnostics.py index 8919427d4..9c74afb12 100644 --- a/test/test_power_saving_role_diagnostics.py +++ b/test/test_power_saving_role_diagnostics.py @@ -238,7 +238,7 @@ int main() { check(node.ota, Reason::Ota); // An idle scanner does not bypass other role guards. check(node.queue, Reason::Queue); check(node.retry, Reason::Retry); node.dual = node.profile_idle = false; - check(node._local_cli_output.busy_value, Reason::Serial); + check(node._local_cli_output.busy_value, Reason::SerialIO); check(node.deferred_cli_command.pending, Reason::Scheduled); check(node.uart.running, Reason::Bridge); node.active_rs232_bridge_uart = 1; diff --git a/test/test_release_ota_policy.sh b/test/test_release_ota_policy.sh index c6561685b..21690fd4c 100644 --- a/test/test_release_ota_policy.sh +++ b/test/test_release_ota_policy.sh @@ -117,4 +117,30 @@ for target in heltec_tracker_v1_1_repeater_observer_mqtt \ fi done +# The exact Full TLora Room recipes keep their complete 32-post bank and +# maximum source geometry while moving cold bytes to real RTC SLOW storage. +for full in 0 1; do + ESP32_FULL_BUILD=$full + for target in LilyGo_TLora_V2_1_1_6_room_server \ + LilyGo_TLora_V2_1_1_6_room_server_ \ + LilyGo_TLora_V2_1_1_6_room_server_observer_mqtt \ + LilyGo_TLora_V2_1_1_6_room_server_observer_mqtt_ \ + LilyGo_TLora_V2_1_1_6_repeater_observer_mqtt_ \ + LilyGo_TLora_V2_1_1_6_companion_radio_usb \ + Heltec_v4_room_server; do + PIO_ENV_PLATFORM_BY_NAME[$target]=ESP32_PLATFORM + PIO_ENV_FULL_BUILD_BY_NAME[$target]=1 + PLATFORMIO_BUILD_FLAGS="" + PLATFORMIO_BUILD_UNFLAGS="" + apply_esp32_full_size_profile "$target" + expected=0 + if [ "$full" = 1 ] && [[ "${target,,}" == lilygo_tlora_v2_1_1_6_room_server* ]]; then expected=1; fi + for flag in ROOM_POSTS_RTC_SLOW_STORAGE OTA_BOUNDED_SOURCE_PROOFS; do + found=0 + [[ " $PLATFORMIO_BUILD_FLAGS " == *" -D$flag=1 "* ]] && found=1 + [ "$found" = "$expected" ] || fail "$target Full=$full wrong $flag policy" + done + done +done + echo "test_release_ota_policy: OK" diff --git a/test/test_room_rtc_posts.py b/test/test_room_rtc_posts.py new file mode 100644 index 000000000..e492b018b --- /dev/null +++ b/test/test_room_rtc_posts.py @@ -0,0 +1,220 @@ +#!/usr/bin/env python3 +"""Exercise the real qualified RTC post bank, post/history methods and lifetime.""" +from pathlib import Path +import re +import shutil +import subprocess +import sys +import tempfile +import unittest + +from test_replay_reset_integration import extract_braced +from test_room_history_store import STAT_MOCK + +ROOT = Path(__file__).resolve().parents[1] + + +class RoomRtcPostsTests(unittest.TestCase): + def sources(self): + source = (ROOT / "examples/simple_room_server/MyMesh.cpp").read_text() + header = (ROOT / "examples/simple_room_server/MyMesh.h").read_text() + start = source.index("#if ROOM_POSTS_RTC_SLOW_STORAGE\n#include ") + bank = source[start:source.index("MyMesh::MyMesh(", start)] + constructor = extract_braced(source, "MyMesh::MyMesh(") + initializer = re.search(r"posts\(acquireRoomRtcPosts\(this\)\)", constructor)[0] + clear = re.search(r"memset\(posts, 0, sizeof\(posts\)\);", constructor)[0] + destructor = extract_braced(source, "MyMesh::~MyMesh()") + post = extract_braced(header, "struct PostInfo") + ";\n" + return source, header, bank, initializer, clear, destructor, post + + def compile(self, directory, source, *, ndebug=False, name="posts"): + directory = Path(directory) + (directory / "esp_attr.h").write_text('#define RTC_SLOW_ATTR __attribute__((section(".rtc.force_slow.0")))\n') + (directory / "sdkconfig.h").write_text("#define CONFIG_IDF_TARGET_ESP32 1\n") + path = directory / (name + ".cpp") + path.write_text(source) + binary = directory / name + flags = ["-DNDEBUG"] if ndebug else [] + sanitized = (["-fsanitize=address,undefined", "-fno-sanitize-recover=all", "-fno-pie", "-no-pie"] + if sys.platform.startswith("linux") else []) + built = subprocess.run([shutil.which("g++") or "clang++", "-std=c++17", "-Wall", "-Wextra", "-Werror", + "-Wno-unused-function", "-Wno-unused-parameter", "-Wno-class-memaccess", *sanitized, *flags, + "-DROOM_POSTS_RTC_SLOW_STORAGE=1", "-DESP32_PLATFORM=1", + "-I" + str(directory), "-I" + str(ROOT / "src"), + "-I" + str(ROOT / "test/mocks"), str(path), "-o", str(binary)], + text=True, capture_output=True, timeout=60) + self.assertEqual(built.returncode, 0, built.stdout + built.stderr) + return binary + + def minimal_fixture(self): + _, _, bank, initializer, clear, destructor, post = self.sources() + _, header, _, _, _, _, _ = self.sources() + deleted = "\n".join(line for line in header.splitlines() if "MyMesh" in line and "= delete;" in line) + return r''' +#include +#include +#include +#include +#include +#define MAX_UNSYNCED_POSTS 32 +#define MAX_POST_TEXT_LEN 151 +#define CHECK(value) do { if (!(value)) abort(); } while (0) +namespace mesh { struct Identity { uint8_t pub_key[32]; Identity() { memset(pub_key,0,32); } }; } +''' + post + bank + r''' +struct MyMesh { + PostInfo (&posts)[MAX_UNSYNCED_POSTS]; + MyMesh() : ''' + initializer + " { " + clear + r''' } + ~MyMesh(); +''' + deleted + r''' +}; +static_assert(!std::is_copy_constructible::value && !std::is_move_constructible::value, "RTC owner cannot be copied or moved"); +''' + destructor + r''' +int main(int argc,char** argv) { + int mode=argc>1 ? atoi(argv[1]) : 0; + if(mode==1) { MyMesh first; MyMesh second; return 1; } + if(mode==2) { MyMesh first; releaseRoomRtcPosts(&mode); return 1; } + if(mode==3) { acquireRoomRtcPosts(nullptr); return 1; } + PostInfo* address=nullptr; + { + MyMesh first; address=first.posts; + CHECK(sizeof(first.posts)==6016); + for(size_t i=0;i(first.posts)[i]==0); + for(unsigned i=0;i<32;++i) { + memset(first.posts[i].author.pub_key,int(i+1),32); + first.posts[i].post_timestamp=0xF0000000+i; + memset(first.posts[i].text,int('A'+i%26),151);first.posts[i].text[151]=0; + } + for(unsigned i=0;i<32;++i) { + CHECK(first.posts[i].author.pub_key[31]==i+1); + CHECK(first.posts[i].post_timestamp==0xF0000000+i); + CHECK(strlen(first.posts[i].text)==151); + } + } + { MyMesh second; CHECK(second.posts==address); + for(size_t i=0;i(second.posts)[i]==0); } + CHECK(room_rtc_posts_owner==nullptr); + puts("RTC post ownership, complete capacity and boot reset passed"); +} +''' + + def test_actual_bank_ownership_capacity_and_reset_with_ndebug(self): + with tempfile.TemporaryDirectory(prefix="room-rtc-owner-") as directory: + binary = self.compile(directory, self.minimal_fixture(), ndebug=True) + okay = subprocess.run([str(binary)], capture_output=True, text=True, timeout=20) + self.assertEqual(okay.returncode, 0, okay.stdout + okay.stderr) + for mode in (1, 2, 3): + with self.subTest(mode=mode): + failed = subprocess.run([str(binary), str(mode)], capture_output=True, text=True, timeout=20) + self.assertEqual(failed.returncode, -6, failed.stdout + failed.stderr) + + def test_physical_bank_size_and_ordinary_disabled_source(self): + with tempfile.TemporaryDirectory(prefix="room-rtc-section-") as directory: + binary = self.compile(directory, self.minimal_fixture()) + sections = subprocess.check_output(["readelf", "-SW", str(binary)], text=True) + section = next(line for line in sections.splitlines() if ".rtc.force_slow.0" in line) + self.assertRegex(section, r"\b001780\b") # All 32 complete 188-byte records. + _, _, bank, _, _, _, _ = self.sources() + # The default path must not include any SDK headers, owner or bank. + source = Path(directory) / "disabled.cpp" + source.write_text(bank + "\nint main() {}\n") + output = subprocess.run([shutil.which("g++") or "clang++", "-E", "-P", "-x", "c++", str(source)], + capture_output=True, text=True, timeout=20) + self.assertEqual(output.returncode, 0, output.stderr) + self.assertEqual(output.stdout.strip(), "int main() {}") + + def test_storage_flag_rejects_unqualified_boards_and_invalid_values(self): + _, header, _, _, _, _, _ = self.sources() + start = header.index("#ifndef ROOM_POSTS_RTC_SLOW_STORAGE") + policy = header[start:header.index("struct PostInfo", start)] + cases = (([], True), (["-DROOM_POSTS_RTC_SLOW_STORAGE=0"], True), + (["-DROOM_POSTS_RTC_SLOW_STORAGE=2"], False), + (["-DROOM_POSTS_RTC_SLOW_STORAGE=1", "-DNRF52_PLATFORM=1"], False), + (["-DROOM_POSTS_RTC_SLOW_STORAGE=1", "-DESP32_PLATFORM=1"], False), + (["-DROOM_POSTS_RTC_SLOW_STORAGE=1", "-DESP32_PLATFORM=1", "-DLILYGO_TLORA=1", + "-DMESHCORE_EXPANDED_PARTITION_PROFILE=1"], True)) + for flags, valid in cases: + with self.subTest(flags=flags): + result = subprocess.run([shutil.which("g++") or "clang++", "-std=c++17", "-x", "c++", + "-fsyntax-only", *flags, "-"], input=policy + "\nint main() {}\n", + capture_output=True, text=True, timeout=20) + self.assertEqual(result.returncode == 0, valid, result.stderr) + + def test_real_post_fifo_history_reload_maximum_text_and_catchup(self): + source, header, bank, initializer, clear, destructor, post = self.sources() + fixture = (ROOT / "test/fixtures/room_history_integration/test.cpp").read_text().split("int main()", 1)[0] + # Keep the actual persistence/admission methods and existing FS fault + # boundary, but simulate boots sequentially because this bank has one owner. + fixture = fixture[:fixture.index("static void compareBoot(")] + fixture = fixture.replace("struct Identity { uint8_t pub_key[32] = {}; };", "struct Identity { uint8_t pub_key[32] = {}; bool matches(const Identity& other) const { return !memcmp(pub_key,other.pub_key,32); } };") + fixture = fixture.replace("struct MyMesh {", bank + "\nstruct MyMesh {") + fixture = fixture.replace(" PostInfo posts[MAX_UNSYNCED_POSTS] = {};", " PostInfo (&posts)[MAX_UNSYNCED_POSTS];") + fixture = fixture.replace("explicit MyMesh(MemoryFS* fs) : _fs(fs) {", "explicit MyMesh(MemoryFS* fs) : _fs(fs), " + initializer + " { " + clear) + fixture = fixture.replace(" Clock* getRTCClock()", " ~MyMesh();\n Clock* getRTCClock()") + fixture = fixture.replace('#include "../room_history_store/filesystem.h"', '#include "' + str(ROOT / 'test/fixtures/room_history_store/filesystem.h') + '"') + fixture += destructor + r''' +#include +struct SyncClient { + mesh::Identity id; + struct { struct { uint32_t sync_since=0,pending_ack=0,pending_topic_revision=0,push_post_timestamp=0; } room; } extra; +}; +int main() { + MemoryFS fs; std::vector expected; + for(int utf8=0;utf8<2;++utf8) { + std::string full(151,'A'); + if(utf8) { full="x";for(int i=0;i<50;++i)full+="\xe2\x98\x83"; } + { + MyMesh m(&fs);m.loadRoomHistory(); + assert(m.command("room.history.clear").find("cleared")!=std::string::npos); + assert(m.command("set room.history on").find("enabled")!=std::string::npos); + assert(full.size()==151 && m.addSystemPost(full.c_str())); + assert(m.retained().back()==full && m.posts[0].text[151]==0); + assert(!m.addSystemPost((full+"!").c_str())); + for(int i=0;i<70;++i) assert(m.addSystemPost(("post-"+std::to_string(i)).c_str())); + assert(m.retained().size()==32 && m.retained().front()=="post-38"); + assert(m.post_ready_mask==0 && m.snapshotRoomHistory()); + expected=m.retained(); + PostInfo ordinary[32];memcpy(ordinary,m.posts,sizeof(ordinary)); + SyncClient client; + for(auto mode : {mesh::RoomCatchUpMode::Before,mesh::RoomCatchUpMode::SkipNext,mesh::RoomCatchUpMode::KeepNewest}) + for(uint32_t value : {0u,1u,16u,31u,32u,100u,UINT32_MAX}) { + auto rtc=mesh::planRoomCatchUp(client,m.posts,32,mode,value); + auto old=mesh::planRoomCatchUp(client,ordinary,32,mode,value); + assert(rtc.candidate_cursor==old.candidate_cursor && rtc.skipped==old.skipped); + assert(rtc.backlog_remaining==old.backlog_remaining && rtc.pending_post_cancelled==old.pending_post_cancelled); + } + } + { + MyMesh reboot(&fs); + assert(reboot.retained().empty()); // Always clear retained RTC bytes first. + reboot.loadRoomHistory();assert(reboot.retained()==expected); + uint32_t floor=reboot.last_room_timestamp; + assert(reboot.addSystemPost(full.c_str()) && reboot.last_room_timestamp>floor); + assert(reboot.retained().back()==full && reboot.snapshotRoomHistory()); + } + } + puts("RTC Room FIFO, maximum text, durable reload and catch-up passed"); +} +''' + acl = (ROOT / "src/helpers/ClientACL.h").read_text() + state = "\n".join(line for line in acl.splitlines() if line.startswith("#define PERM_ACL_")) + state += "\n" + post + definitions = "\n".join(extract_braced(source, signature) for signature in ( + "bool MyMesh::addPost(", "bool MyMesh::addSystemPost(", "bool MyMesh::storePost(", + "bool MyMesh::snapshotRoomHistory(", "void MyMesh::loadRoomHistory(", + "bool MyMesh::handleRoomHistoryCommand(")) + definitions += "\n" + extract_braced((ROOT / "src/helpers/TxtDataHelpers.cpp").read_text(), "void StrHelper::strncpy(") + gate = extract_braced(extract_braced(source, "void MyMesh::onPeerDataRecv("), "if (flags == TXT_TYPE_PLAIN)") + with tempfile.TemporaryDirectory(prefix="room-rtc-history-") as directory: + work = Path(directory);(work / "sys").mkdir() + (work / "sys/stat.h").write_text(STAT_MOCK) + (work / "state.inc").write_text(state) + (work / "production.inc").write_text(definitions) + (work / "post_gate.inc").write_text(gate) + binary = self.compile(work, fixture) + ran = subprocess.run([str(binary)], capture_output=True, text=True, timeout=30) + self.assertEqual(ran.returncode, 0, ran.stdout + ran.stderr) + self.assertIn("durable reload and catch-up passed", ran.stdout) + + +if __name__ == "__main__": + unittest.main() diff --git a/test/test_room_web_gzip.py b/test/test_room_web_gzip.py new file mode 100644 index 000000000..5d65e485d --- /dev/null +++ b/test/test_room_web_gzip.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python3 +"""Verify exact page identity, generation recovery and role-owned resources.""" +import gzip +import importlib.util +from pathlib import Path +import shutil +import subprocess +import sys +import tempfile +import unittest + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / "scripts")) +from generate_room_web_html import generate, page_bytes, render, source_page, SOURCE, OUTPUT +from test_replay_reset_integration import extract_braced + + +class RoomWebGzipTests(unittest.TestCase): + def test_checked_in_page_preserves_every_source_byte(self): + raw = source_page((ROOT / SOURCE).read_text(encoding="ascii")) + packed = page_bytes((ROOT / OUTPUT).read_text(encoding="ascii")) + self.assertEqual(gzip.decompress(packed), raw) + self.assertLess(len(packed), len(raw) // 3) + self.assertFalse(generate(ROOT, check=True)) + + def test_stale_and_corrupt_assets_fail_check_and_regenerate_idempotently(self): + with tempfile.TemporaryDirectory() as name: + root = Path(name) + (root / SOURCE).parent.mkdir(parents=True) + (root / SOURCE).write_text('static const char ROOM_WEB_HTML[] PROGMEM = R"roomhtml(Room test)roomhtml";\n') + with self.assertRaises(ValueError): + generate(root, check=True) + self.assertTrue(generate(root)) + first = (root / OUTPUT).read_bytes() + self.assertFalse(generate(root)) + self.assertEqual((root / OUTPUT).read_bytes(), first) + (root / OUTPUT).write_bytes(first.replace(b"0x1f,", b"0x00,", 1)) + with self.assertRaises(ValueError): + generate(root, check=True) + self.assertTrue(generate(root)) + self.assertEqual((root / OUTPUT).read_bytes(), first) + (root / SOURCE).write_text((root / SOURCE).read_text().replace("Room test", "Room changed")) + with self.assertRaises(ValueError): + generate(root, check=True) + self.assertTrue(generate(root)) + self.assertIn(b"Room changed", gzip.decompress(page_bytes((root / OUTPUT).read_text()))) + + def test_renderer_refuses_a_different_page(self): + with self.assertRaises(ValueError): + render(b"expected", gzip.compress(b"different", mtime=0)) + with self.assertRaises(ValueError): + source_page("missing constant") + + def test_only_room_role_owns_page_and_default_callback_links_without_it(self): + shared = (ROOT / "src/helpers/esp32/WebConfigServer.cpp").read_text() + self.assertNotIn('#include "RoomWebHtml', shared) + header = (ROOT / "src/helpers/esp32/WebConfigServer.h").read_text() + callback = extract_braced(header, "virtual const uint8_t* roomPageGzip(") + room = (ROOT / "examples/simple_room_server/MyMesh.cpp").read_text() + provider = extract_braced(room, "const uint8_t* MyMesh::roomPageGzip(") + self.assertIn('sizeof(ROOM_WEB_HTML_GZ)', provider) + # Compile the real default callback and prove that a non-Room role + # needs no page header or storage while still answering safely. + compiler = shutil.which("g++") + self.assertIsNotNone(compiler) + with tempfile.TemporaryDirectory() as directory: + source = Path(directory) / "default.cpp" + source.write_text('#include \n#include \n#include \nstruct Callback {\n' + + callback + '\n};\nint main() { Callback c; size_t n=99; assert(c.roomPageGzip(n)==nullptr && n==0); }\n') + binary = source.with_suffix("") + subprocess.run([compiler, "-std=c++11", "-Os", str(source), "-o", str(binary)], check=True) + subprocess.run([str(binary)], check=True) + symbols = subprocess.check_output(["nm", "-C", str(binary)], text=True) + self.assertNotIn("ROOM_WEB_HTML", symbols) + + +if __name__ == "__main__": + unittest.main() diff --git a/test/test_room_web_http.py b/test/test_room_web_http.py index 990c7936e..974588247 100644 --- a/test/test_room_web_http.py +++ b/test/test_room_web_http.py @@ -29,6 +29,7 @@ HARNESS = r''' #include #include #include +#include using String = std::string; #define PROGMEM @HTML@ @@ -132,7 +133,7 @@ struct AsyncWebServer { }; struct DNS { unsigned stops = 0; void stop() { ++stops; } }; struct Callbacks { - bool supported = true, authenticated = true; + bool supported = true, authenticated = true, page_available = true; bool roomRequestAuthenticated() const { return authenticated; } unsigned calls = 0, stops = 0; String last_body; @@ -141,6 +142,10 @@ struct Callbacks { size_t last_capacity = 0; std::function in_callback; bool supportsRoomService() const { return supported; } + const uint8_t* roomPageGzip(size_t& length) const { + length = page_available ? sizeof(ROOM_WEB_HTML_GZ) : 0; + return page_available ? ROOM_WEB_HTML_GZ : nullptr; + } void processRoomRequest(const uint8_t* token, uint32_t sequence, char* body, char* result, size_t capacity) { assert(lock_depth == 0); // Mutating callback runs only on the loop, outside the HTTP mutex. ++calls; last_body = body; memcpy(last_token, token, 32); @@ -362,7 +367,19 @@ static void pagesAndAvailability() { server.host.invoke("/room", HTTP_GET, page); assert(page.status == 200); assert(server.isNetworkForegroundActive(ticks)); assert(mesh::wifi::networkPower().foregroundActive()); - assert(page.reply.find("MeshCore Room") != String::npos && page.response_type == "text/html; charset=utf-8"); + assert(page.reply.size() == sizeof(ROOM_WEB_HTML_GZ) && page.response_type == "text/html; charset=utf-8"); + assert(memcmp(page.reply.data(), ROOM_WEB_HTML_GZ, sizeof(ROOM_WEB_HTML_GZ)) == 0); + assert(page.response_headers["Content-Encoding"] == "gzip" && page.response_headers["Vary"] == "Accept-Encoding"); + AsyncWebServerRequest no_encoding; + no_encoding.headers["Accept-Encoding"].text = "gzip;q=0, identity"; + server.host.invoke("/room", HTTP_GET, no_encoding); + assert(no_encoding.status == 406 && no_encoding.response_headers["Vary"] == "Accept-Encoding"); + no_encoding.headers["Accept-Encoding"].text = "br, GZip;q=0.5"; + server.host.invoke("/room", HTTP_GET, no_encoding); + assert(no_encoding.status == 200); + cb.page_available = false; + server.host.invoke("/room", HTTP_GET, no_encoding); assert(no_encoding.status == 503); + cb.page_available = true; assert(page.response_headers["Cache-Control"] == "no-store"); assert(page.response_headers["X-Content-Type-Options"] == "nosniff" && page.response_headers["Referrer-Policy"] == "no-referrer"); assert(cb.calls == 0); @@ -447,11 +464,12 @@ class RoomWebHttpTests(unittest.TestCase): raise AssertionError("a host C++ compiler is required") source = (ROOT / "src/helpers/esp32/WebConfigServer.cpp").read_text() header = (ROOT / "src/helpers/esp32/WebConfigServer.h").read_text() - html = (ROOT / "src/helpers/esp32/RoomWebHtml.h").read_text() - html_constant = re.search(r'static const char ROOM_WEB_HTML\[\] PROGMEM = R"roomhtml\([\s\S]*?\)roomhtml";', html) + html = (ROOT / "src/helpers/esp32/RoomWebHtmlGzip.h").read_text() + html_constant = re.search(r'static const uint8_t ROOM_WEB_HTML_GZ\[\] PROGMEM = \{[\s\S]*?\};', html) if html_constant is None: raise AssertionError("production room HTML constant not found") methods = [extract_braced(source, signature) for signature in ( + "static bool webConfigClientAcceptsGzip(", "static void webConfigRejectEncoding(", "void WebConfigServer::serviceRoom(", "static bool roomRequestIdentity(", "void WebConfigServer::handleRoomPage(", "void WebConfigServer::handleRoomPost(", "void WebConfigServer::handleRoomResult(", "void WebConfigServer::collectBody(", diff --git a/test/test_rxps_hardware_capability.py b/test/test_rxps_hardware_capability.py index 1c9e4b50e..234d93ade 100644 --- a/test/test_rxps_hardware_capability.py +++ b/test/test_rxps_hardware_capability.py @@ -87,6 +87,92 @@ int main(){ class RxpsHardwareCapabilityTests(unittest.TestCase): + def probe_repeater_constructor(self, standard, capability, remove_guard=False): + source = (ROOT / 'examples/simple_repeater/MyMesh.cpp').read_text() + start = source.index(' _prefs.rx_powersaving_enabled = DEFAULT_RXPS_ENABLED ? 1 : 0;') + end = source.index('\n // bridge defaults', start) + initialization = source[start:end] + if remove_guard: + initialization = initialization.replace('#ifdef WRAPPER_CLASS\n', '', 1) + initialization = initialization.replace('#endif\n', '', 1) + if capability is None: + radio = '#include \n' + self.assertIn('extern ESPNOWRadio radio_driver;', + (ROOT / 'variants/generic_espnow/target.h').read_text()) + self.assertNotIn('WRAPPER_CLASS', + (ROOT / 'variants/generic_espnow/platformio.ini').read_text()) + else: + radio = 'long random(long,long);\n#include \n' + if capability: + radio += ('struct SupportedWrapper : RadioLibWrapper {\n' + ' static constexpr bool SupportsRxPowerSaving = true;\n};\n' + '#define WRAPPER_CLASS SupportedWrapper\n') + else: + radio += '#define WRAPPER_CLASS RadioLibWrapper\n' + code = radio + r''' +#include +#include +struct Prefs { + uint8_t rx_powersaving_enabled, rx_ps_level, rx_ps_preamble, sf; + uint32_t rx_ps_rx_us, rx_ps_sleep_us; + float bw; +}; +struct Repeater { + Prefs _prefs = {}; + Repeater() { + _prefs.sf = 7; + _prefs.bw = 62.5f; +@INITIALIZATION@ + } +}; +#define CHECK(value) do { if (!(value)) return 1; } while (0) +int main() { + Repeater repeater; + const Prefs& prefs = repeater._prefs; + CHECK(prefs.rx_powersaving_enabled == 1 && prefs.rx_ps_level == 5); + CHECK(prefs.rx_ps_preamble == 16 && prefs.sf == 7 && prefs.bw == 62.5f); +@CHECK_TIMINGS@ +} +''' + if capability: + timing_check = (' CHECK(prefs.rx_ps_rx_us != RX_POWERSAVING_DEFAULT_RX_US\n' + ' || prefs.rx_ps_sleep_us != RX_POWERSAVING_DEFAULT_SLEEP_US);\n' + ' CHECK(isValidRxPowerSavingPeriod(prefs.rx_ps_rx_us));\n' + ' CHECK(isValidRxPowerSavingPeriod(prefs.rx_ps_sleep_us));') + else: + timing_check = (' CHECK(prefs.rx_ps_rx_us == RX_POWERSAVING_DEFAULT_RX_US);\n' + ' CHECK(prefs.rx_ps_sleep_us == RX_POWERSAVING_DEFAULT_SLEEP_US);') + code = code.replace('@INITIALIZATION@', initialization).replace('@CHECK_TIMINGS@', timing_check) + with tempfile.TemporaryDirectory(prefix='repeater-rxps-constructor-') as folder: + work = Path(folder) + (work / 'RadioLib.h').write_text(RADIO_STUB) + cpp, binary = work / 'test.cpp', work / 'test' + cpp.write_text(code) + built = subprocess.run([os.environ.get('CXX', 'g++'), '-std=' + standard, + '-pedantic-errors', '-Os', '-DNDEBUG', '-ffunction-sections', '-fdata-sections', + '-fsanitize=address,undefined', '-fno-sanitize-recover=all', '-fno-pie', '-no-pie', + '-DDEFAULT_RXPS_ENABLED=1', '-DDEFAULT_RXPS_LEVEL=5', '-DDEFAULT_RXPS_PREAMBLE=16', + '-DLORA_SF=7', '-DLORA_BW=125', '-I' + str(work), + '-isystem', str(ROOT / 'src'), '-isystem', str(ROOT / 'test/mocks'), + str(cpp), '-Wl,--gc-sections', '-o', str(binary)], + capture_output=True, text=True, timeout=30) + if remove_guard: + self.assertNotEqual(built.returncode, 0) + self.assertIn('WRAPPER_CLASS', built.stderr) + return + self.assertEqual(built.returncode, 0, built.stdout + built.stderr) + result = subprocess.run([str(binary)], capture_output=True, text=True, timeout=15) + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + + def test_repeater_constructor_keeps_wrapperless_and_lora_capabilities(self): + for standard in ('c++11', 'c++17'): + for capability in (None, False, True): + with self.subTest(standard=standard, capability=capability): + self.probe_repeater_constructor(standard, capability) + + def test_missing_constructor_guard_reproduces_espnow_compile_failure(self): + self.probe_repeater_constructor('c++11', None, remove_guard=True) + def probe(self, standard, mutate=False): common = (ROOT / 'src/helpers/CommonCLI.cpp').read_text() setter = body(common, 'if (memcmp(config, "radio.rxps ", 11) == 0)')