Compare commits

...

2 commits

17 changed files with 4686 additions and 0 deletions

View file

@ -0,0 +1,273 @@
Gate 2A task: BLEProtocolSession / PeerSessionManager design
Context:
We are working in /usr/local/src/ble-reticulum.
Phase 1 is frozen and field accepted. The C++ protocol core already includes:
- BLEFragmenter
- BLEReassembler
- HDLCFramer
- identity helper equivalents for:
- BLEInterface._get_fragmenter_key
- BLEInterface._compute_identity_hash
Phase 1 evidence:
- C++ equivalence tests passed.
- backend shim tests passed.
- identity helper equivalence tests passed.
- ARM tests passed on zerodev1 and zerodev2.
- bilateral US Constitution transfer field test succeeded using the C++ backend.
- Phase 1 was documented and tagged.
Final goal:
The final target is not “Python forever.” The final target is a C++ BLE protocol/session layer usable by microReticulum on ESP32-S3 / LilyGO T-Beam SUPREME. Python is currently a Linux test adapter and field-test harness.
Important comparative project:
I have also had you inspect torlando-tech/pyxis:
https://github.com/torlando-tech/pyxis
Use Pyxis as comparative prior art because it is C++ firmware built on microReticulum. However, do not assume Pyxiss BLE implementation is complete or correct. Treat it as an architectural reference for how C++ microReticulum interfaces are organized, not as behavior to copy blindly.
Gate 2A objective:
Design, but do not implement, a C++ BLEProtocolSession or PeerSessionManager.
Target reference behavior:
src/ble_reticulum/BLEInterface.py
BLEInterface._handle_identity_handshake
Important:
Do not port _handle_identity_handshake line-for-line.
Do not modify BLEInterface.py.
Do not modify any source files.
This is a design/report gate only.
The design should move the authoritative BLE peer/session model toward C++, while leaving Linux/Python and ESP32/microReticulum as adapters.
Please produce a Markdown report under:
migration/phase2/Gate2A_BLEProtocolSession_design_YYYYMMDD_HHMM.md
Use the current date/time in the filename.
Report requirements:
1. Executive summary
- State whether Phase 2 should proceed.
- State whether the correct C++ unit is BLEProtocolSession, PeerSessionManager, or another name.
- State why _handle_identity_handshake should not be ported literally.
2. Reference behavior map
Inspect BLEInterface._handle_identity_handshake and related functions:
- _data_received_callback
- _check_duplicate_identity
- _spawn_peer_interface
- _get_fragmenter_key
- _compute_identity_hash
- handle_peripheral_data, if it contains parallel/legacy handshake behavior
For each relevant behavior, identify:
- pure protocol/session decision
- Linux/Python/Reticulum adapter action
- ESP32/microReticulum adapter equivalent
- state read
- state mutated
- risk if changed
3. Pyxis comparison
Inspect the Pyxis C++ Reticulum/microReticulum interface structure.
Identify:
- relevant C++ interface/session classes
- how Pyxis organizes transport/interface state
- what design ideas can be reused
- what should not be reused
- whether Pyxis gives a useful pattern for ESP32-side adapter code
- whether Pyxis has BLE-specific code and whether it is mature enough to guide us
4. Proposed C++ header
Propose a header for the C++ session manager.
Include:
- namespace
- types
- enums
- result structs
- event/action structs
- class declaration
- methods
- comments explaining ownership
This header is only a proposal; do not create the actual .hpp file yet unless explicitly instructed later.
5. State ownership model
Clearly define which state should move to C++:
- address to identity mapping
- identity to active session mapping
- MTU per peer
- pending identity state
- last real data / zombie timing, if appropriate
- fragmenter/reassembler ownership, if appropriate
- peer-ready state
Clearly define which state should stay in adapters:
- RNS.Transport.interfaces
- BLEPeerInterface Python object
- BlueZ/Bleak/DBus objects
- ESP32 NimBLE connection handles
- logging mechanism
- actual disconnect calls
6. Result/action model
The C++ core should return explicit decisions and adapter actions, not directly call platform code.
Include actions such as:
- consume input
- pass to reassembler
- accept new identity
- reject duplicate identity
- disconnect current peer
- disconnect old peer
- create fragmentation state
- mark peer ready
- update peer address
- remove pending identity
- mark real data
7. Python adapter boundary
Describe how current BLEInterface.py would use the C++ session manager during transition:
- build ConnectionState from current Python dictionaries and driver state
- call C++ session manager
- mirror C++ state into Python dictionaries, initially
- perform RNS.log
- call driver.disconnect when requested
- call _spawn_peer_interface when requested
8. ESP32/microReticulum adapter boundary
Describe how the same session manager would be used on T-Beam Supreme / ESP32-S3:
- BLE callback receives bytes
- connection handle/address mapped into adapter state
- call C++ session manager
- create/use C++ fragmenter/reassembler
- register peer/session with microReticulum interface abstraction
- disconnect via ESP32 BLE stack when requested
9. Test matrix
Provide a table of tests for Gate 2B and Gate 2C.
Include at minimum:
- non-16-byte payload
- new 16-byte identity
- known identity duplicate same
- known identity duplicate mismatch
- duplicate identity active elsewhere
- duplicate identity with stale/pending detach
- duplicate identity with zombie old connection
- MTU provided
- MTU missing fallback to 23
- pending identity timeout
- peer address update
- consumed packet behavior
- pass-to-reassembler behavior
- exception/invalid state compatibility if applicable
10. Migration plan
Give a staged plan:
Gate 2A: design only
Gate 2B: C++ session manager skeleton + pure unit tests
Gate 2C: pybind11 binding + Python tests
Gate 2D: Python equivalence harness with fake driver/state
Gate 2E: optional Python integration behind environment flag
Gate 2F: bilateral Constitution field test
Gate 2G: ESP32/microReticulum adapter design
11. Risk register
Include risks:
- accidentally changing current BLE behavior
- duplicate handshake logic in handle_peripheral_data
- MAC rotation assumptions
- identity collision/truncation assumptions
- consuming 16-byte real data
- Python and C++ state divergence during transition
- ESP32 memory constraints
- concurrency differences between Linux/BlueZ and ESP32 BLE callbacks
12. SQL output
Generate SQL insert/update statements for the migration tracking database.
Tracking database context:
The SQLite database is:
/usr/local/src/ble-reticulum/migration/ble_migration.sqlite
Tables known to exist:
symbols
reviews
The symbols table includes at least these columns:
symbol_id
source_file
symbol_name
symbol_type
class_name
line_number
tag
phase
status
cpp_candidate
confidence
rationale
callers
callees
notes
first_seen_at
updated_at
The reviews table includes at least these columns:
review_id
symbol_id
reviewed_at
reviewer
old_tag
new_tag
old_status
new_status
note
Current Phase 1 state:
- 16 CORE symbols are FIELD_ACCEPTED.
- Remaining CORE symbols not accepted: none.
- Unknown or needs-review symbols: none.
- Candidate next tasks: none.
For Gate 2A, please generate SQL in the report, and also write it to:
migration/sql/start_gate2a_protocol_session_design_YYYYMMDD_HHMM.sql
SQL intent:
- Do not destroy Phase 1 records.
- Do not mark implementation as complete.
- Start Gate 2A as DESIGN only.
- Add or update a tracking record for:
source_file = 'src/ble_reticulum/BLEInterface.py'
class_name = 'BLEInterface'
symbol_name = '_handle_identity_handshake'
phase = '2_ble_protocol_session_manager'
status = 'DESIGN'
tag should remain GLUE unless you justify changing it.
cpp_candidate should be 1 only if you define it as “reference behavior for C++ session manager,” not literal function port.
- Insert a review note explaining:
Gate 2A opened as design-only.
_handle_identity_handshake is reference behavior.
Final target is C++ BLEProtocolSession usable from Python adapter and ESP32/microReticulum adapter.
Pyxis was reviewed as C++ microReticulum prior art.
- Include a SELECT verification query at the end.
Preferred SQL style:
- Use BEGIN; ... COMMIT;
- Use UPDATE where the symbol already exists.
- Use INSERT INTO reviews SELECT ... FROM symbols WHERE ...
- Include comments and example command lines.
- Do not assume new tables exist.
- Do not modify Phase 1 FIELD_ACCEPTED rows.
Also provide a short suggested commit message for the Gate 2A report and SQL.

View file

@ -123,3 +123,118 @@ Your chronyc tracking output helps bound this error, but it is not a substitute
(rnsenv) jlpoole@jp /usr/local/src/ble-reticulum/scripts $
```
May 17, 2026 1:21 PM Identities CPP works and tested in field with bilateral Constitution test. Report: migration/reports/identities_20260517_report.md
May 17, 2026 2:22 PM Codex & I went round and found, even with a reboot of zerodev1 documented in run16 (now preserved) and Codex concluded:
The end of run16 is very useful.
On `zerodev2`, the harness definitely used the C++ backend:
```text
BLEInterface[BLE Interface] fragmentation backend: cpp
(fragmenter=ble_protocol_core_cpp.BLEFragmenter, reassembler=ble_protocol_core_cpp.BLEReassembler)
```
It also successfully advertised:
```text
Advertisement registered
```
Then `zerodev1`s standalone Bleak probe saw that advertisement:
```text
B8:27:EB:54:BF:0E zerodev2 zerodev2 ['37145b00-442d-4a94-917f-8f42c5da28e3']
callbacks: 1
```
So `zerodev1` scanner callbacks are not fundamentally broken. They work when there is a known advertiser.
The confusing part is on `zerodev2`: while advertising successfully, its own scanner loop reports:
```text
Scanner callback failure detected (0 callbacks for 3...13 consecutive scans)
```
That may be a false-positive in quiet RF conditions or while the other Pi is not advertising. The current detector treats “zero callbacks” as a Bluetooth stack failure, but your evidence now shows zero callbacks can happen even while the node is otherwise healthy enough to register advertisements, and `btmgmt find` is not reliable on this platform.
My updated interpretation:
- `btmgmt find` should be removed from the health criteria for these Pis.
- “0 Bleak callbacks” should not automatically mean “Bluetooth stack requires reboot” unless there is a known advertiser expected during that scan window.
- The scanner callback critical log in `linux_bluetooth_driver.py` is likely too aggressive for this environment.
- The C++ backend is confirmed active in this run and is not implicated by these scanner warnings.
For the next code improvement, I would change the scanner diagnostic severity/message. Something like: after repeated zero-callback scans, log a warning that no BLE advertisements were observed, but do not call it “requires reboot” unless there is additional evidence such as scanner start failure, adapter not powered, HCI timeout, or known peer advertisement missed repeatedly.
That is separate from the protocol-core migration and should probably be handled as a BLE platform robustness fix.
Codex's carry-over summary for a new chat, Phase 2:
Yes, start a new chat for Phase 2. This one has a lot of forensic context mixed with migration work. Seed the new chat with this:
```text
Project: ble-reticulum migration to C++, Phase 2
Repo: /usr/local/src/ble-reticulum
Branch: c++migration
Current date context: May 17, 2026
Reticulum env on workstation: /home/jlpoole/rnsenv/bin/activate
On Pi Zero 2Ws I use system python3, not a venv.
Important current state:
- C++ protocol-core module exists under migration/protocol_core:
- migration/protocol_core/ble_protocol_core.cpp
- migration/protocol_core/setup.py
- pybind11 module name: ble_protocol_core_cpp
- Implemented/bound:
- BLEFragmenter
- BLEReassembler
- HDLCFramer
- compute_identity_hash(peer_identity)
- get_fragmenter_key(peer_identity, peer_address)
- Tests exist under migration/tests:
- test_fragmentation_cpp_equivalence.py
- test_fragmentation_backend_shim.py
- test_identity_helpers_cpp_equivalence.py
- In rnsenv, latest verification:
- identity helper tests: 20 passed, 1 skipped; real BLEInterface path used, source fallback skipped.
- fragmentation/backend tests: 36 passed.
- BLEFragmentationBackend.py shim exists and supports:
- BLE_RETICULUM_FRAGMENTATION_BACKEND=auto|cpp|python
- BLE_RETICULUM_FRAGMENTATION_BACKEND_REPORT=1
- BLEInterface.py was modified only to import fragmentation classes through the shim and report selected backend. Do not port BLEInterface wholesale.
- External Reticulum interface files on the Pis should be symlinked to repo files in ~/.reticulum/interfaces, especially:
- BLEInterface.py
- BLEFragmentation.py
- BLEFragmentationBackend.py
- linux_bluetooth_driver.py
- Live field test:
- bilateral U.S. Constitution transfer succeeded after symlinks and C++ backend.
- logs confirmed C++ backend line:
BLEInterface[BLE Interface] fragmentation backend: cpp
- Important forensic conclusion:
- `sudo btmgmt find` returns `0x0b Rejected` even after clean reboot on Pi Zero 2W, so it is not a valid health baseline on this platform.
- Standalone Bleak scanner probe can see zerodev2 advertisement from zerodev1.
- Scanner “0 callbacks requires reboot” diagnostic in linux_bluetooth_driver.py appears too aggressive in quiet RF/known-advertiser-absent conditions.
- This is platform robustness work, not evidence against the C++ protocol core.
Phase 2 intent:
- Continue conservative C++ extraction.
- Do not change live BLE behavior unless explicitly requested.
- Prefer tests first.
- Treat BLEInterface.py as Python integration/glue/platform unless extracting very small pure helper logic.
- Avoid porting _handle_identity_handshake unless explicitly asked.
```
Also mention what you want Phase 2 to mean. Good candidates are:
```text
For Phase 2, I want to extract the next small protocol-only unit, with tests first, and avoid BLEInterface behavioral changes.
```
or:
```text
For Phase 2, I want to address the scanner false-positive diagnostic separately as a platform robustness fix.
```
May 18, 2026 2:36 PM - saved a copy of the SQLite database under sql/archive. Memorialized prompt for Phase 2A from ChatGPT in Codex_prompt_State2A_20250518_1433.md.

View file

@ -0,0 +1,437 @@
# Gate 2A: BLE Protocol Session Manager Design
Date: 2026-05-18 14:34 America/Los_Angeles
Scope: design only. No source implementation is included in this gate.
## 1. Executive Summary
Phase 2 should proceed, but not by porting `BLEInterface._handle_identity_handshake()` line-for-line. The correct C++ unit is best named `BLEPeerSessionManager`: it should own BLE peer/session protocol state, identity decisions, pending-handshake state, MTU/session metadata, and adapter action decisions. `BLEProtocolSession` is a reasonable internal type name for one peer, but the migrated unit needs to manage multiple peers and address/identity mappings, so `BLEPeerSessionManager` is the clearer top-level name.
`_handle_identity_handshake()` should not be ported literally because it mixes several layers:
- pure protocol/session decisions: 16-byte identity detection, duplicate identity classification, identity key derivation, consumed/not-consumed routing;
- Linux/Python adapter actions: `RNS.log`, `driver.disconnect`, Python dict mutation, Python lock use, `BLEPeerInterface` creation;
- Reticulum integration: `RNS.Transport.interfaces` mutation through `_spawn_peer_interface`;
- fragmentation allocation using the current backend shim.
The C++ target should return explicit decisions and adapter actions. Python and ESP32 code should perform platform effects.
## 2. Reference Behavior Map
Reference source: `src/ble_reticulum/BLEInterface.py`.
| Function / behavior | Pure protocol/session decision | Linux/Python/Reticulum adapter action | ESP32/microReticulum adapter equivalent | State read | State mutated | Risk if changed |
|---|---|---|---|---|---|---|
| `_data_received_callback` lines 1309-1321 | Identity handshakes are checked before normal data routing. | Calls `_handle_identity_handshake`; if false, calls `_handle_ble_data`. | BLE callback calls session manager first; if not consumed, pass bytes to C++ reassembler/data path. | none directly | none directly | Reordering can pass identity bytes into reassembler or drop real data. |
| `_handle_identity_handshake`: `len(data) != 16` | Non-16-byte payload is not a handshake. | Return `False`, normal data path continues. | Return `PassToReassembler` / `consume=false`. | incoming data length | none | Misclassifying normal payloads breaks data transfer. |
| Known identity, 16-byte payload matches | Duplicate identity data is consumed silently. | Log debug; return `True`; do not reassemble. | Return `ConsumeInput` with duplicate-same decision. | `address_to_identity[address]` | none | Pyxis currently diverges here; passing this to reassembler may create false fragment errors. |
| Known identity, 16-byte payload differs | Identity-like 16-byte data is consumed with warning. | Log warning; return `True`. | Return `ConsumeInput` plus warning event. | `address_to_identity[address]` | none | Could consume legitimate 16-byte Reticulum payload; preserving current behavior avoids behavior drift during migration. |
| New 16-byte identity | Identity accepted if duplicate policy allows. | Convert to `bytes`; compute identity hash. | Store identity as 16-byte stable peer identity. | incoming data | local result state | Incorrect identity size or hash handling breaks peer keying. |
| `_compute_identity_hash` lines 1899-1918 | Short key is first 8 bytes rendered as 16 hex chars. | Used for Python map keys. | Use as compact display/session key where collision risk is acceptable; keep full identity as authoritative key. | peer identity | none | Truncation collision is unlikely but not impossible; full identity should be primary in C++ state. |
| `_get_fragmenter_key` lines 1886-1897 | Fragmentation key is full identity hex; address is ignored. | Python dict key for fragmenters/reassemblers. | Use 16-byte identity or full hex as fragmenter key; avoid MAC keying. | peer identity | none | Address-keyed fragmentation would break MAC rotation recovery. |
| `_check_duplicate_identity`: invalid/missing identity | Invalid identity does not trigger duplicate rejection. | Return false. | Return no rejection. | identity length | none | Over-strict rejection can disconnect peers before handshake completes. |
| `_check_duplicate_identity`: same identity, different address, pending detach | Allow reconnection; stale old address can be cleaned. | Logs; calls `_cleanup_stale_address`; return false. | Return `AcceptNewIdentity`, `UpdatePeerAddress`, maybe `CleanupOldAddress`. | `identity_to_address`, `_pending_detach` | stale address maps through adapter | Rejecting this breaks MAC rotation and reconnect-after-disconnect. |
| `_check_duplicate_identity`: old address not connected and not in `peers` | Allow reconnection; cleanup stale old address. | Logs; calls `_cleanup_stale_address`; return false. | Return `AcceptNewIdentity`, `UpdatePeerAddress`, `CleanupOldAddress`. | `driver.connected_peers`, `peers` | stale address maps through adapter | False duplicate rejection after stale cleanup race. |
| `_check_duplicate_identity`: old connection zombie | Allow new connection and disconnect old one. | Logs; cleanup stale address; `driver.disconnect(existing_address)`; return false. | Return `DisconnectOldPeer` and accept new peer. | `_last_real_data`, `_zombie_timeout` | stale mapping cleanup through adapter | Keeping zombie can block recovery; disconnecting wrong peer can flap stable links. |
| `_check_duplicate_identity`: old connection alive | Reject new duplicate. | Logs; return true. `_handle_identity_handshake` disconnects current address. | Return `RejectDuplicateIdentity`, `DisconnectCurrentPeer`. | `identity_to_address`, driver/peer liveness | none in core; adapter disconnects current | Allowing both creates duplicate interfaces and routing ambiguity. |
| Accept identity mappings | New identity becomes authoritative for address and identity key. | Mutates `address_to_identity`, `identity_to_address`. | C++ manager owns address-to-identity and identity-to-session maps. Python mirrors during transition. | identity hash | maps | Divergent Python/C++ maps are a transition risk. |
| MTU lookup | Use negotiated MTU if available, else BLE minimum 23. | Calls `driver.get_peer_mtu(address)`. | Adapter supplies MTU from connection handle; core falls back to `23`. | driver MTU | result MTU | Wrong MTU causes fragmentation failures or throughput regression. |
| Fragmentation state | Accepted identity needs fragmenter and reassembler. | Creates `BLEFragmenter(mtu)` and `BLEReassembler()`. | C++ session manager owns/requests creation of C++ fragmenter/reassembler keyed by identity. | MTU, identity | fragmenter/reassembler pools | Missing reassembler races early data. |
| Peer interface ready | Accepted identity should make peer routable. | Calls `_spawn_peer_interface` or updates existing interface address. | Register/update microReticulum peer/session object. | `spawned_interfaces` | `RNS.Transport.interfaces` indirectly, `address_to_interface` | Creating duplicate peer objects causes routing ambiguity. |
| Mark real data | Identity handshake counts as real data for zombie tracking. | Mutates `_last_real_data[identity_hash]`. | C++ session liveness timestamp updated. | time | liveness state | Zombie replacement decisions become inaccurate. |
| Remove pending identity | Successful handshake clears pending timeout. | Deletes `_pending_identity_connections[address]`. | C++ pending identity table clears connection/address. | pending map | pending map | Timeout may later disconnect a valid peer. |
| Exception path | Any exception during handshake processing still consumes the packet. | Logs error; returns `True`. | Return `ErrorConsumed` if adapter/core detects invalid transition. | exception | none or partial adapter state | Changing to pass-through can feed malformed identity into data path. |
| `handle_peripheral_data` lines 2113-2178 | Parallel/legacy peripheral handshake path: if no identity and len 16, accept; otherwise if no identity, drop. | Mutates maps, creates fragmenter/reassembler, spawns peer interface; lacks duplicate policy nuance from `_handle_identity_handshake`. | Should be retired or routed through same C++ session manager. | `address_to_identity`, `connection_timeout` | maps, fragmentation, interface | Divergent handshake paths are a major behavior-drift risk. |
## 3. Pyxis Comparison
Comparative project inspected: `/usr/local/src/pyxis/lib/ble_interface`.
Relevant C++ structure:
- `BLETypes.h`: UUIDs, MTU constants, timing constants, roles, connection state, peer state, `BLEAddress`, `ConnectionHandle`.
- `BLEPlatform.h`: BLE hardware abstraction for scanning, advertising, connection management, GATT reads/writes, notification callbacks.
- `BLEIdentityManager.h/.cpp`: local identity, identity handshake, address-to-identity mapping, MAC rotation callback, fixed-size handshake pools.
- `BLEPeerManager.h/.cpp`: discovered/connected peer state, identity-keyed peer storage, MAC-only peer storage, handle lookup, MTU, scoring, blacklist, zombie cleanup.
- `BLEInterface.h/.cpp`: orchestration layer that wires platform callbacks, identity manager callbacks, peer manager, fragmenters, reassembler, and microReticulum interface calls.
- `BLEFragmenter` and `BLEReassembler`: portable packet protocol components.
Pyxis organizes transport/interface state with a useful layered split: platform callback layer, identity manager, peer manager, fragmentation components, and a top-level microReticulum `InterfaceImpl`. It also uses fixed-size pools in several places, which is a strong ESP32-S3 design prior.
Ideas to reuse:
- Centralize BLE protocol constants and connection/session structs.
- Use a platform abstraction rather than embedding NimBLE or BlueZ calls in protocol logic.
- Key peers and reassembly by stable 16-byte identity, not MAC.
- Use fixed-size pools or bounded containers for ESP32 builds.
- Defer heavy work out of BLE stack callbacks when stack safety requires it.
- Keep microReticulum interface registration outside the pure identity/session manager.
Ideas not to reuse blindly:
- Pyxis `BLEIdentityManager::isHandshakeData()` treats a 16-byte payload as handshake only if no identity mapping exists. Current Python also consumes matching or mismatching 16-byte identity-like data when identity is already known.
- Pyxis duplicate connected identity handling is simpler than current Python. Current Python allows replacement for pending detach, stale disconnected address, and zombie old connection.
- Pyxis uses `std::function`, `std::vector`, `std::shared_ptr`, `std::string`, and dynamic `Bytes` in some interfaces. These may be acceptable, but ESP32 memory behavior should be measured before adopting the exact style.
Pyxis gives a useful ESP32-side adapter pattern, especially `ConnectionHandle`, `IBLEPlatform`, and the separation between identity/peer managers and `BLEInterface`. Its BLE code is early enough that it should guide architecture, not define behavior.
## 4. Proposed C++ Header
This is a proposal only; no header should be created in Gate 2A.
```cpp
#pragma once
#include <array>
#include <cstdint>
#include <optional>
#include <string>
#include <vector>
namespace ble_reticulum {
using PeerIdentity = std::array<uint8_t, 16>;
enum class LocalRole : uint8_t {
Unknown,
Central,
Peripheral,
};
enum class InputDecision : uint8_t {
PassToReassembler,
ConsumedDuplicateSameIdentity,
ConsumedDuplicateMismatchedIdentity,
AcceptedNewIdentity,
RejectedDuplicateIdentity,
ErrorConsumed,
};
enum class SessionActionType : uint8_t {
ConsumeInput,
PassToReassembler,
AcceptNewIdentity,
RejectDuplicateIdentity,
DisconnectCurrentPeer,
DisconnectOldPeer,
CreateFragmentationState,
MarkPeerReady,
UpdatePeerAddress,
RemovePendingIdentity,
MarkRealData,
CleanupOldAddress,
Warn,
};
struct ConnectionId {
// Linux adapter may use address string. ESP32 adapter may use handle.
// The core stores both when supplied but does not call platform APIs.
std::string address;
uint16_t handle = 0xffff;
};
struct ConnectionSnapshot {
ConnectionId current;
LocalRole local_role = LocalRole::Unknown;
std::optional<PeerIdentity> known_identity_for_address;
std::optional<uint16_t> negotiated_mtu;
// Adapter-supplied liveness facts needed to preserve current Python
// duplicate identity behavior without letting C++ call BlueZ/NimBLE.
std::optional<std::string> existing_address_for_identity;
bool identity_has_pending_detach = false;
bool existing_address_connected = false;
bool existing_address_in_peer_table = false;
bool existing_connection_is_zombie = false;
double existing_last_real_data = 0.0;
};
struct SessionAction {
SessionActionType type = SessionActionType::ConsumeInput;
ConnectionId target;
std::string old_address;
std::string new_address;
std::string message;
};
struct HandshakeResult {
InputDecision decision = InputDecision::PassToReassembler;
std::vector<SessionAction> actions;
bool consumed = false;
bool accepted = false;
bool should_disconnect_current = false;
bool should_disconnect_old = false;
std::optional<PeerIdentity> peer_identity;
std::string identity_key; // Compatibility key: first 8 identity bytes as 16 hex chars.
std::string fragmenter_key; // Compatibility key: full identity as 32 hex chars.
uint16_t mtu = 23;
};
struct PeerSessionView {
PeerIdentity identity;
std::string identity_key;
std::string current_address;
uint16_t current_handle = 0xffff;
uint16_t mtu = 23;
bool has_fragmentation_state = false;
bool peer_ready = false;
double pending_identity_since = 0.0;
double last_real_data = 0.0;
};
class BLEPeerSessionManager {
public:
explicit BLEPeerSessionManager(double pending_identity_timeout = 30.0,
double zombie_timeout = 45.0);
HandshakeResult handleIdentityHandshake(const ConnectionSnapshot& connection,
const uint8_t* data,
size_t data_size,
double now_seconds);
void markConnected(const ConnectionSnapshot& connection, double now_seconds);
void markDisconnected(const ConnectionId& connection, double now_seconds);
void markMtu(const ConnectionId& connection, uint16_t mtu);
void markPendingIdentity(const ConnectionId& connection, double now_seconds);
std::vector<ConnectionId> expiredPendingIdentities(double now_seconds) const;
std::optional<PeerSessionView> sessionByAddress(const std::string& address) const;
std::optional<PeerSessionView> sessionByIdentity(const PeerIdentity& identity) const;
static bool isIdentityHandshakePayload(const uint8_t* data, size_t data_size);
static PeerIdentity identityFromPayload(const uint8_t* data, size_t data_size);
static std::string computeIdentityKey(const PeerIdentity& identity);
static std::string computeFragmenterKey(const PeerIdentity& identity);
private:
// Ownership: this manager owns protocol/session truth. Adapters may mirror it
// during migration, but RNS objects, BLE stack objects, and actual I/O remain
// outside this class.
double pending_identity_timeout_;
double zombie_timeout_;
// Implementation may use std containers for native/Linux tests and fixed pools
// for embedded builds. The public behavior should not depend on allocation model.
};
} // namespace ble_reticulum
```
## 5. State Ownership Model
Move to C++:
- address-to-identity mapping;
- identity-to-active-session mapping;
- current address/connection metadata per identity;
- MTU per peer/session;
- pending identity state and timeout age;
- last real data / zombie timing if duplicate replacement policy remains;
- peer-ready state;
- fragmentation state ownership or at minimum authoritative requests to create/update it;
- reassembler ownership once the Python adapter can stop owning `reassemblers`.
Keep in adapters:
- `RNS.Transport.interfaces`;
- Python `BLEPeerInterface` instances;
- BlueZ/Bleak/DBus objects;
- ESP32 NimBLE/Bluedroid connection handles as platform resources, although handle values can be stored as opaque IDs in session state;
- logging mechanism;
- actual disconnect calls;
- actual GATT reads/writes/notifies;
- thread/mutex policy specific to Python runtime or ESP32 BLE stack callbacks.
## 6. Result / Action Model
The core should return decisions and adapter actions. Required actions:
- `ConsumeInput`;
- `PassToReassembler`;
- `AcceptNewIdentity`;
- `RejectDuplicateIdentity`;
- `DisconnectCurrentPeer`;
- `DisconnectOldPeer`;
- `CreateFragmentationState`;
- `MarkPeerReady`;
- `UpdatePeerAddress`;
- `RemovePendingIdentity`;
- `MarkRealData`;
- `CleanupOldAddress`;
- `Warn`.
The adapter executes these actions in platform order. For example, a zombie replacement result can include `CleanupOldAddress`, `DisconnectOldPeer`, `AcceptNewIdentity`, `CreateFragmentationState`, `MarkPeerReady`, `RemovePendingIdentity`, and `MarkRealData`.
## 7. Python Adapter Boundary
During transition, `BLEInterface.py` would:
1. Build `ConnectionSnapshot` from current Python dictionaries and driver state:
- `address_to_identity`;
- `identity_to_address`;
- `_pending_detach`;
- `driver.connected_peers`;
- `peers`;
- `_last_real_data`;
- `driver.get_peer_mtu(address)`.
2. Call `BLEPeerSessionManager.handleIdentityHandshake(...)`.
3. If `consumed` is false, call `_handle_ble_data(address, data)`.
4. Mirror accepted C++ session state into Python dictionaries initially.
5. Execute adapter actions:
- `RNS.log` for messages/warnings;
- `driver.disconnect(address)` for current/old peer disconnect;
- create/update Python `BLEFragmenter` and `BLEReassembler` until owned by C++;
- call `_spawn_peer_interface(...)` or update existing `BLEPeerInterface.peer_address`;
- delete `_pending_identity_connections[address]`.
The Python dictionaries should become mirrors, not the authoritative state.
## 8. ESP32 / microReticulum Adapter Boundary
On T-Beam SUPREME / ESP32-S3:
1. BLE stack callback receives bytes and a connection handle/address.
2. Adapter maps handle/address/role/MTU into `ConnectionSnapshot`.
3. Adapter calls `BLEPeerSessionManager.handleIdentityHandshake(...)`.
4. If result says `PassToReassembler`, pass payload to C++ `BLEReassembler`.
5. If result says `CreateFragmentationState`, initialize or update C++ fragmenter/reassembler pools keyed by identity.
6. If result says `MarkPeerReady`, register or update the peer/session with the microReticulum interface abstraction.
7. If result says disconnect, call NimBLE/Bluedroid disconnect through the ESP32 BLE platform layer.
8. Logging goes through the firmware logging mechanism, not the session core.
The adapter should prefer BLE connection handles for platform operations and stable 16-byte identity for Reticulum/session routing. MAC address should remain metadata because rotation is expected.
## 9. Test Matrix
| Gate | Test | Expected decision/action |
|---|---|---|
| 2B | non-16-byte payload | `PassToReassembler`, `consumed=false` |
| 2B | new 16-byte identity | `AcceptedNewIdentity`, `ConsumeInput`, identity key and fragmenter key set |
| 2B | known identity duplicate same | `ConsumedDuplicateSameIdentity`, `consumed=true` |
| 2B | known identity duplicate mismatch | `ConsumedDuplicateMismatchedIdentity`, `consumed=true`, warning action |
| 2B | duplicate identity active elsewhere | `RejectedDuplicateIdentity`, `DisconnectCurrentPeer` |
| 2B | duplicate identity with stale/pending detach | accept new identity, `CleanupOldAddress`, `UpdatePeerAddress` |
| 2B | duplicate identity with zombie old connection | accept new identity, `DisconnectOldPeer`, `CleanupOldAddress` |
| 2B | MTU provided | result MTU equals provided MTU |
| 2B | MTU missing | result MTU falls back to `23` |
| 2B | pending identity timeout | expired connection IDs are returned without platform calls |
| 2B | peer address update | identity session current address changes; fragmenter key unchanged |
| 2C | pybind11 identity key equivalence | C++ `computeIdentityKey` equals Python `_compute_identity_hash` |
| 2C | pybind11 fragmenter key equivalence | C++ `computeFragmenterKey` equals Python `_get_fragmenter_key` |
| 2D | consumed packet behavior | fake Python harness sees same return/consume behavior as `_handle_identity_handshake` |
| 2D | pass-to-reassembler behavior | non-handshake calls `_handle_ble_data` path in harness |
| 2D | duplicate active elsewhere | fake driver records disconnect current peer |
| 2D | zombie old connection | fake driver records disconnect old peer and accepts new peer |
| 2D | invalid/exception compatibility | invalid transition returns `ErrorConsumed` where current Python would consume after exception |
## 10. Migration Plan
- Gate 2A: design only; this report and SQL tracking only.
- Gate 2B: C++ session manager skeleton plus pure native unit tests.
- Gate 2C: pybind11 binding plus Python tests for result structs and helper equivalence.
- Gate 2D: Python equivalence harness with fake driver/state, no live BLE changes.
- Gate 2E: optional Python integration behind environment flag; mirror C++ state into Python dictionaries.
- Gate 2F: bilateral US Constitution field test with C++ session manager enabled.
- Gate 2G: ESP32/microReticulum adapter design using Pyxis as architectural prior art, not as behavior authority.
## 11. Risk Register
| Risk | Mitigation |
|---|---|
| Accidentally changing current BLE behavior | Tests must encode current Python decisions before integration. |
| Duplicate handshake logic in `handle_peripheral_data` | Route both paths through one C++ session manager or retire legacy path deliberately. |
| MAC rotation assumptions | Keep identity as primary key; model address changes as session metadata. |
| Identity collision/truncation assumptions | Use full 16-byte identity internally; keep 16-hex short key for compatibility/display only. |
| Consuming legitimate 16-byte real data | Preserve current behavior initially; document and test it before any protocol change. |
| Python and C++ state divergence | Make C++ authoritative and Python dictionaries mirrors during transition. |
| ESP32 memory constraints | Use fixed pools or bounded containers for embedded builds; avoid unbounded allocation in hot paths. |
| Linux/BlueZ vs ESP32 callback concurrency | Core returns actions only; adapters own locking, deferral, and stack-safe execution. |
| Fragmenter/reassembler ownership transition | Move ownership in stages with equivalence tests and field transfer tests. |
## 12. SQL Output
Companion SQL file:
`migration/sql/start_gate2a_protocol_session_design_20260518_1434.sql`
```sql
BEGIN TRANSACTION;
INSERT INTO symbols (
source_file,
symbol_name,
symbol_type,
class_name,
line_number,
tag,
phase,
status,
cpp_candidate,
confidence,
rationale,
callers,
callees,
notes,
first_seen_at,
updated_at
)
VALUES (
'src/ble_reticulum/BLEInterface.py',
'_handle_identity_handshake',
'method',
'BLEInterface',
1202,
'GLUE',
'2_ble_protocol_session_manager',
'DESIGN',
1,
'high',
'Gate 2A treats this method as reference behavior for a C++ BLEPeerSessionManager, not as a literal function port. The method mixes protocol decisions with Python, Linux driver, and Reticulum adapter side effects.',
'_data_received_callback',
'_compute_identity_hash; _check_duplicate_identity; driver.disconnect; driver.get_peer_mtu; _get_fragmenter_key; BLEFragmenter; BLEReassembler; _spawn_peer_interface',
'Gate 2A opened as design-only. Preserve tag GLUE because BLEInterface remains adapter/glue; cpp_candidate=1 means reference behavior for C++ session ownership, not direct port.',
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP
)
ON CONFLICT(source_file, class_name, symbol_name, line_number) DO UPDATE SET
tag = 'GLUE',
phase = '2_ble_protocol_session_manager',
status = 'DESIGN',
cpp_candidate = 1,
confidence = 'high',
rationale = excluded.rationale,
callers = excluded.callers,
callees = excluded.callees,
notes = excluded.notes,
updated_at = CURRENT_TIMESTAMP;
INSERT INTO reviews (
symbol_id,
reviewed_at,
reviewer,
old_tag,
new_tag,
old_status,
new_status,
note
)
SELECT
symbol_id,
CURRENT_TIMESTAMP,
'Codex',
'GLUE',
'GLUE',
'REVIEWED',
'DESIGN',
'Gate 2A opened as design-only. _handle_identity_handshake is reference behavior for a future C++ BLEPeerSessionManager, not a literal function port. Phase 1 records remain untouched.'
FROM symbols
WHERE source_file = 'src/ble_reticulum/BLEInterface.py'
AND class_name = 'BLEInterface'
AND symbol_name = '_handle_identity_handshake'
AND line_number = 1202;
COMMIT;
```

View file

@ -0,0 +1,107 @@
# Gate 2B: BLEPeerSessionManager Native Tests
Date: 2026-05-18 14:45 America/Los_Angeles
Scope: C++ native skeleton and pure native unit tests only.
## Summary
Gate 2B implemented a standalone C++ `BLEPeerSessionManager` skeleton under `migration/protocol_core` with no pybind11 bindings and no integration into live Python BLE behavior.
Files added:
- `migration/protocol_core/BLEPeerSessionManager.h`
- `migration/protocol_core/BLEPeerSessionManager.cpp`
- `migration/tests/native/test_ble_peer_session_manager.cpp`
- `migration/sql/mark_gate2b_protocol_session_native_tests_20260518_1445.sql`
`BLEInterface.py` was not modified. No BlueZ, Bleak, DBus, `RNS.Transport`, `BLEPeerInterface`, ESP32 BLE APIs, or live BLE tests were used.
## Implemented C++ Surface
Implemented types and enums:
- `PeerIdentity`
- `LocalRole`
- `InputDecision`
- `SessionActionType`
- `ConnectionId`
- `ConnectionSnapshot`
- `SessionAction`
- `HandshakeResult`
- `PeerSessionView`
- `BLEPeerSessionManager`
Implemented helpers:
- `isIdentityHandshakePayload`
- `identityFromPayload`
- `computeIdentityKey`
- `computeFragmenterKey`
Implemented session methods:
- `handleIdentityHandshake`
- `markConnected`
- `markDisconnected`
- `markMtu`
- `markPendingIdentity`
- `removePendingIdentity`
- `expiredPendingIdentities`
- `sessionByAddress`
- `sessionByIdentity`
## Behavior Covered
The C++ skeleton covers the Gate 2B reference cases:
| Case | Result |
|---|---|
| non-16-byte payload | `PassToReassembler`, `consumed=false` |
| new 16-byte identity | `AcceptedNewIdentity`, `consumed=true`, `accepted=true`, keys set |
| known identity duplicate same | `ConsumedDuplicateSameIdentity`, `consumed=true` |
| known identity duplicate mismatch | `ConsumedDuplicateMismatchedIdentity`, `Warn`, `consumed=true` |
| duplicate identity active elsewhere | `RejectedDuplicateIdentity`, `DisconnectCurrentPeer` |
| duplicate identity with stale/pending detach | accept new identity, `CleanupOldAddress`, `UpdatePeerAddress` |
| duplicate identity with zombie old connection | accept new identity, `DisconnectOldPeer`, `CleanupOldAddress` |
| MTU provided | result/session MTU equals provided value |
| MTU missing | MTU falls back to `23` |
| pending identity timeout | expired connection IDs returned without platform calls |
| peer address update | session address changes, fragmenter key is unchanged |
| identity key helper | first 8 bytes as 16 lowercase hex chars |
| fragmenter key helper | full 16 bytes as 32 lowercase hex chars |
| invalid identity payload | `identityFromPayload` throws `std::invalid_argument` |
## Build And Test Instructions
Build:
```sh
g++ -std=c++17 -Wall -Wextra -Werror -Imigration/protocol_core migration/protocol_core/BLEPeerSessionManager.cpp migration/tests/native/test_ble_peer_session_manager.cpp -o /tmp/test_ble_peer_session_manager
```
Run:
```sh
/tmp/test_ble_peer_session_manager
```
Observed result:
```text
BLEPeerSessionManager native tests passed
```
## Notes
The manager currently uses standard containers for native/Linux development. Gate 2G should decide whether the ESP32/microReticulum build uses the same public API with fixed-size pools internally.
The core returns adapter actions only. It does not log, disconnect peers, create Python interfaces, touch Reticulum transport state, or call BLE platform APIs.
## SQL
Companion SQL:
`migration/sql/mark_gate2b_protocol_session_native_tests_20260518_1445.sql`
The SQL marks `_handle_identity_handshake` as `NATIVE_TESTED` for phase `2_ble_protocol_session_manager` because the native tests passed. It does not mark anything `FIELD_ACCEPTED` and does not alter Phase 1 field-accepted rows.

View file

@ -0,0 +1,612 @@
jlpoole@zerodev1:/usr/local/src/ble-reticulum $ # zerodev1 CPP Command clump START
date
cd /usr/local/src/ble-reticulum/
chronyc tracking
chronyc sources -v
echo .
PYTHONPATH=src:migration/protocol_core \
BLE_RETICULUM_FRAGMENTATION_BACKEND=cpp \
BLE_RETICULUM_FRAGMENTATION_BACKEND_REPORT=1 \
timeout 90 python3 examples/ble_dual_node_echo.py \
--ble-role peripheral \
--message-file /home/jlpoole/US_Constitution.txt \
--message-chunk-size 900 \
--announce-only-when-disconnected \
--verbosity "critical"
echo .
chronyc tracking
chronyc sources -v
# zerodev1 Command clump END
Sun May 17 13:14:42 PDT 2026
Reference ID : C0A80167 (rpi5.salemdata.net)
Stratum : 2
Ref time (UTC) : Sun May 17 20:06:28 2026
System time : 0.000601033 seconds slow of NTP time
Last offset : -0.001022354 seconds
RMS offset : 0.001050475 seconds
Frequency : 1.320 ppm slow
Residual freq : -0.115 ppm
Skew : 1.403 ppm
Root delay : 0.006679162 seconds
Root dispersion : 0.003194763 seconds
Update interval : 1039.6 seconds
Leap status : Normal
.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current best, '+' = combined, '-' = not combined,
| / 'x' = may be in error, '~' = too variable, '?' = unusable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* rpi5.salemdata.net 1 10 377 493 -250us[-1272us] +/- 4530us
.
[13:14:43.949] Starting node zerodev1
[13:14:43.950] Reticulum config: ~/.reticulum
[13:14:43.950] Runtime config: /tmp/ble_reticulum_poc_zerodev1_xsx7ahix
BLEInterface[BLE Interface] fragmentation backend: cpp (fragmenter=ble_protocol_core_cpp.BLEFragmenter, reassembler=ble_protocol_core_cpp.BLEReassembler)
[13:14:47.100] Loaded identity: /home/jlpoole/.reticulum/ble_reticulum_poc_zerodev1.identity
[13:14:47.101] Destination hash: <926e6d3b35b7d5940be7edeb47c41b78>
[13:14:47.101] Use this hash as --peer on the other node.
[13:14:47.102] Message file mode: /home/jlpoole/US_Constitution.txt (44225 bytes)
[13:14:47.102] Periodic heartbeats are disabled in message file mode.
[13:14:47.106] Announced <926e6d3b35b7d5940be7edeb47c41b78> as zerodev1
Advertisement registered
[13:15:09.418] Inbound link established: <5f903eef7be6a15c489b541805fb6be0>
[13:15:09.530] RX link=<5f903eef7be6a15c489b541805fb6be0>: hello from zerodev2 send_epoch=1779048909.360302
[13:15:09.608] Requested message chunk size 900 exceeds Reticulum link budget; using 316 data bytes per chunk
[13:15:09.608] Sending file /home/jlpoole/US_Constitution.txt as 140 chunk(s), 44225 bytes
[13:15:09.804] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 1/148 from zerodev2 bytes=300 file=US_Constitution.txt data=The United States Constitution
We the People of the United States, in Order to form a more perfect Union, establish Justice, insure domestic Tranquility, provide for the common defence, promote the general Welfare, and secure the Blessings of Liberty to ourselves and our Posterity, do ordain and es send_epoch=1779048909.556366
[13:15:10.047] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 2/148 from zerodev2 bytes=300 file=US_Constitution.txt data=tablish this Constitution for the United States of America.
The Constitutional Convention
Article I
Section 1: Congress
All legislative Powers herein granted shall be vested in a Congress of the United States, which shall consist of a Senate and House of Representatives.
Section 2: The House of Rep send_epoch=1779048909.677054
[13:15:10.244] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 3/148 from zerodev2 bytes=300 file=US_Constitution.txt data=resentatives
The House of Representatives shall be composed of Members chosen every second Year by the People of the several States, and the Electors in each State shall have the Qualifications requisite for Electors of the most numerous Branch of the State Legislature.
No Person shall be a Repres send_epoch=1779048909.781239
[13:15:10.487] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 4/148 from zerodev2 bytes=300 file=US_Constitution.txt data=entative who shall not have attained to the Age of twenty five Years, and been seven Years a Citizen of the United States, and who shall not, when elected, be an Inhabitant of that State in which he shall be chosen.
Representatives and direct Taxes shall be apportioned among the several States whic send_epoch=1779048909.885172
[13:15:10.730] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 5/148 from zerodev2 bytes=300 file=US_Constitution.txt data=h may be included within this Union, according to their respective Numbers, which shall be determined by adding to the whole Number of free Persons, including those bound to Service for a Term of Years, and excluding Indians not taxed, three fifths of all other Persons. The actual Enumeration shall send_epoch=1779048909.989093
[13:15:10.973] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 6/148 from zerodev2 bytes=300 file=US_Constitution.txt data=be made within three Years after the first Meeting of the Congress of the United States, and within every subsequent Term of ten Years, in such Manner as they shall by Law direct.The Number of Representatives shall not exceed one for every thirty Thousand, but each State shall have at Least one Repr send_epoch=1779048910.092973
[13:15:11.171] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 7/148 from zerodev2 bytes=300 file=US_Constitution.txt data=esentative; and until such enumeration shall be made, the State of New Hampshire shall be entitled to chuse three, Massachusetts eight, Rhode-Island and Providence Plantations one, Connecticut five, New-York six, New Jersey four, Pennsylvania eight, Delaware one, Maryland six, Virginia ten, North Ca send_epoch=1779048910.198961
[13:15:11.414] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 8/148 from zerodev2 bytes=300 file=US_Constitution.txt data=rolina five, South Carolina five, and Georgia three.
When vacancies happen in the Representation from any State, the Executive Authority thereof shall issue Writs of Election to fill such Vacancies.
The House of Representatives shall chuse their Speaker and other Officers;and shall have the sole P send_epoch=1779048910.302899
[13:15:11.658] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 9/148 from zerodev2 bytes=300 file=US_Constitution.txt data=ower of Impeachment.
Section 3: The Senate
The Senate of the United States shall be composed of two Senators from each State, chosen by the Legislature thereof, for six Years; and each Senator shall have one Vote.
Immediately after they shall be assembled in Consequence of the first Election, they send_epoch=1779048910.407038
[13:15:11.899] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 10/148 from zerodev2 bytes=300 file=US_Constitution.txt data= shall be divided as equally as may be into three Classes. The Seats of the Senators of the first Class shall be vacated at the Expiration of the second Year, of the second Class at the Expiration of the fourth Year, and of the third Class at the Expiration of the sixth Year, so that one third may b send_epoch=1779048910.512344
[13:15:12.097] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 11/148 from zerodev2 bytes=300 file=US_Constitution.txt data=e chosen every second Year; and if Vacancies happen by Resignation, or otherwise, during the Recess of the Legislature of any State, the Executive thereof may make temporary Appointments until the next Meeting of the Legislature, which shall then fill such Vacancies.
No Person shall be a Senator wh send_epoch=1779048910.616230
[13:15:12.340] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 12/148 from zerodev2 bytes=300 file=US_Constitution.txt data=o shall not have attained to the Age of thirty Years, and been nine Years a Citizen of the United States, and who shall not, when elected, be an Inhabitant of that State for which he shall be chosen.
The Vice President of the United States shall be President of the Senate, but shall have no Vote, u send_epoch=1779048910.720089
[13:15:12.583] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 13/148 from zerodev2 bytes=300 file=US_Constitution.txt data=nless they be equally divided.
The Senate shall chuse their other Officers, and also a President pro tempore, in the Absence of the Vice President, or when he shall exercise the Office of President of the United States.
The Senate shall have the sole Power to try all Impeachments. When sitting for send_epoch=1779048910.824040
[13:15:12.874] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 14/148 from zerodev2 bytes=300 file=US_Constitution.txt data= that Purpose, they shall be on Oath or Affirmation. When the President of the United States is tried, the Chief Justice shall preside: And no Person shall be convicted without the Concurrence of two thirds of the Members present.
Judgment in Cases of Impeachment shall not extend further than to re send_epoch=1779048910.931457
[13:15:13.072] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 15/148 from zerodev2 bytes=300 file=US_Constitution.txt data=moval from Office, and disqualification to hold and enjoy any Office of honor, Trust or Profit under the United States: but the Party convicted shall nevertheless be liable and subject to Indictment, Trial, Judgment and Punishment, according to Law.
Section 4: Elections
The Times, Places and Manner send_epoch=1779048911.035240
[13:15:13.315] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 16/148 from zerodev2 bytes=300 file=US_Constitution.txt data= of holding Elections for Senators and Representatives, shall be prescribed in each State by the Legislature thereof; but the Congress may at any time by Law make or alter such Regulations, except as to the Places of chusing Senators.
The Congress shall assemble at least once in every Year, and suc send_epoch=1779048911.139148
[13:15:13.558] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 17/148 from zerodev2 bytes=300 file=US_Constitution.txt data=h Meeting shall be on the first Monday in December, unless they shall by Law appoint a different Day.
Section 5: Powers and Duties of Congress
Each House shall be the Judge of the Elections, Returns and Qualifications of its own Members,and a Majority of each shall constitute a Quorum to do Busines send_epoch=1779048911.259735
[13:15:13.802] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 18/148 from zerodev2 bytes=300 file=US_Constitution.txt data=s; but a smaller Number may adjourn from day to day, and may be authorized to compel the Attendance of absent Members, in such Manner, and under such Penalties as each House may provide.
Each House may determine the Rules of its Proceedings, punish its Members for disorderly Behaviour, and, with th send_epoch=1779048911.364752
[13:15:13.998] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 19/148 from zerodev2 bytes=300 file=US_Constitution.txt data=e Concurrence of two thirds, expel a Member.
Each House shall keep a Journal of its Proceedings, and from time to time publish the same, excepting such Parts as may in their Judgment require Secrecy; and the Yeas and Nays of the Members of either House on any question shall, at the Desire of one fi send_epoch=1779048911.469038
[13:15:14.241] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 20/148 from zerodev2 bytes=300 file=US_Constitution.txt data=fth of those Present, be entered on the Journal.
Neither House, during the Session of Congress, shall, without the Consent of the other, adjourn for more than three days, nor to any other Place than that in which the two Houses shall be sitting.
Section 6: Rights and Disabilities of Members
The Se send_epoch=1779048911.572861
[13:15:14.484] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 21/148 from zerodev2 bytes=300 file=US_Constitution.txt data=nators and Representatives shall receive a Compensation for their Services, to be ascertained by Law, and paid out of the Treasury of the United States.They shall in all Cases, except Treason, Felony and Breach of the Peace, be privileged from Arrest during their Attendance at the Session of their r send_epoch=1779048911.676684
[13:15:14.730] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 22/148 from zerodev2 bytes=300 file=US_Constitution.txt data=espective Houses, and in going to and returning from the same; and for any Speech or Debate in either House, they shall not be questioned in any other Place.
No Senator or Representative shall, during the Time for which he was elected, be appointed to any civil Office under the Authority of the Uni send_epoch=1779048911.780587
[13:15:14.927] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 23/148 from zerodev2 bytes=300 file=US_Constitution.txt data=ted States, which shall have been created, or the Emoluments whereof shall have been encreased during such time; and no Person holding any Office under the United States, shall be a Member of either House during his Continuance in Office.
Section 7: Legislative Process
All Bills for raising Revenue send_epoch=1779048911.884432
[13:15:15.170] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 24/148 from zerodev2 bytes=300 file=US_Constitution.txt data= shall originate in the House of Representatives; but the Senate may propose or concur with Amendments as on other Bills.
Every Bill which shall have passed the House of Representatives and the Senate, shall, before it become a Law, be presented to the President of the United States; If he approve send_epoch=1779048911.988241
[13:15:15.413] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 25/148 from zerodev2 bytes=300 file=US_Constitution.txt data=he shall sign it, but if not he shall return it, with his Objections to that House in which it shall have originated, who shall enter the Objections at large on their Journal, and proceed to reconsider it. If after such Reconsideration two thirds of that House shall agree to pass the Bill, it shall send_epoch=1779048912.092087
[13:15:15.656] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 26/148 from zerodev2 bytes=300 file=US_Constitution.txt data=be sent, together with the Objections, to the other House, by which it shall likewise be reconsidered, and if approved by two thirds of that House, it shall become a Law. But in all such Cases the Votes of both Houses shall be determined by yeas and Nays, and the Names of the Persons voting for and send_epoch=1779048912.196062
[13:15:15.854] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 27/148 from zerodev2 bytes=300 file=US_Constitution.txt data=against the Bill shall be entered on the Journal of each House respectively. If any Bill shall not be returned by the President within ten Days (Sundays excepted) after it shall have been presented to him, the Same shall be a Law, in like Manner as if he had signed it, unless the Congress by their A send_epoch=1779048912.299909
[13:15:16.097] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 28/148 from zerodev2 bytes=300 file=US_Constitution.txt data=djournment prevent its Return, in which Case it shall not be a Law.
Every Order, Resolution, or Vote to which the Concurrence of the Senate and House of Representatives may be necessary (except on a question of Adjournment) shall be presented to the President of the United States; and before the Sa send_epoch=1779048912.403770
[13:15:16.339] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 29/148 from zerodev2 bytes=300 file=US_Constitution.txt data=me shall take Effect, shall be approved by him, or being disapproved by him, shall be repassed by two thirds of the Senate and House of Representatives, according to the Rules and Limitations prescribed in the Case of a Bill.
Section 8: Powers of Congress
The Congress shall have Power To lay and co send_epoch=1779048912.510313
[13:15:16.582] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 30/148 from zerodev2 bytes=300 file=US_Constitution.txt data=llect Taxes, Duties, Imposts and Excises, to pay the Debts and provide for the common Defence and general Welfare of the United States; but all Duties, Imposts and Excises shall be uniform throughout the United States;
To borrow Money on the credit of the United States;
To regulate Commerce with f send_epoch=1779048912.615580
[13:15:16.878] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 31/148 from zerodev2 bytes=300 file=US_Constitution.txt data=oreign Nations, and among the several States, and with the Indian Tribes;
To establish a uniform Rule of Naturalization, and uniform Laws on the subject of Bankruptcies throughout the United States;
To coin Money, regulate the Value thereof, and of foreign Coin, and fix the Standard of Weights and send_epoch=1779048912.719524
[13:15:17.110] Skipped announce because an active Reticulum link exists
[13:15:17.121] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 32/148 from zerodev2 bytes=300 file=US_Constitution.txt data= Measures;
To provide for the Punishment of counterfeiting the Securities and current Coin of the United States;
To establish Post Offices and post Roads;
To promote the Progress of Science and useful Arts, by securing for limited Times to Authors and Inventors the exclusive Right to their respec send_epoch=1779048912.823463
[13:15:17.364] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 33/148 from zerodev2 bytes=300 file=US_Constitution.txt data=tive Writings and Discoveries;
To constitute Tribunals inferior to the supreme Court;
To define and punish Piracies and Felonies committed on the high Seas, and Offences against the Law of Nations;
To declare War, grant Letters of Marque and Reprisal, and make Rules concerning Captures on Land an send_epoch=1779048912.927582
[13:15:17.607] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 34/148 from zerodev2 bytes=300 file=US_Constitution.txt data=d Water;
To raise and support Armies, but no Appropriation of Money to that Use shall be for a longer Term than two Years;
To provide and maintain a Navy;
To make Rules for the Government and Regulation of the land and naval Forces;
To provide for calling forth the Militia to execute the Laws of send_epoch=1779048913.031448
[13:15:17.850] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 35/148 from zerodev2 bytes=300 file=US_Constitution.txt data= the Union, suppress Insurrections and repel Invasions;
To provide for organizing, arming, and disciplining, the Militia, and for governing such Part of them as may be employed in the Service of the United States, reserving to the States respectively, the Appointment of the Officers, and the Author send_epoch=1779048913.135356
[13:15:18.145] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 36/148 from zerodev2 bytes=300 file=US_Constitution.txt data=ity of training the Militia according to the discipline prescribed by Congress;
To exercise exclusive Legislation in all Cases whatsoever, over such District (not exceeding ten Miles square) as may, by Cession of particular States, and the Acceptance of Congress, become the Seat of the Government o send_epoch=1779048913.239281
[13:15:18.388] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 37/148 from zerodev2 bytes=300 file=US_Constitution.txt data=f the United States, and to exercise like Authority over all Places purchased by the Consent of the Legislature of the State in which the Same shall be, for the Erection of Forts, Magazines, Arsenals, dock-Yards and other needful Buildings;-And
To make all Laws which shall be necessary and proper f send_epoch=1779048913.343177
[13:15:18.631] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 38/148 from zerodev2 bytes=300 file=US_Constitution.txt data=or carrying into Execution the foregoing Powers, and all other Powers vested by this Constitution in the Government of the United States, or in any Department or Officer thereof.
Section 9: Powers Denied Congress
The Migration or Importation of such Persons as any of the States now existing shall t send_epoch=1779048913.447075
[13:15:18.874] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 39/148 from zerodev2 bytes=300 file=US_Constitution.txt data=hink proper to admit, shall not be prohibited by the Congress prior to the Year one thousand eight hundred and eight, but a Tax or duty may be imposed on such Importation, not exceeding ten dollars for each Person.
The Privilege of the Writ of Habeas Corpus shall not be suspended, unless when in Ca send_epoch=1779048913.550930
[13:15:19.072] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 40/148 from zerodev2 bytes=300 file=US_Constitution.txt data=ses of Rebellion or Invasion the public Safety may require it.
No Bill of Attainder or ex post facto Law shall be passed.
No Capitation, or other direct, Tax shall be laid, unless in Proportion to the Census or enumeration herein before directed to be taken.
No Tax or Duty shall be laid on Articl send_epoch=1779048913.655065
[13:15:19.314] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 41/148 from zerodev2 bytes=300 file=US_Constitution.txt data=es exported from any State.
No Preference shall be given by any Regulation of Commerce or Revenue to the Ports of one State over those of another: nor shall Vessels bound to, or from, one State, be obliged to enter, clear, or pay Duties in another.
No Money shall be drawn from the Treasury, but in send_epoch=1779048913.763095
[13:15:19.557] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 42/148 from zerodev2 bytes=300 file=US_Constitution.txt data= Consequence of Appropriations made by Law; and a regular Statement and Account of the Receipts and Expenditures of all public Money shall be published from time to time.
No Title of Nobility shall be granted by the United States: And no Person holding any Office of Profit or Trust under them, shal send_epoch=1779048913.868619
[13:15:19.800] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 43/148 from zerodev2 bytes=300 file=US_Constitution.txt data=l, without the Consent of the Congress, accept of any present, Emolument, Office, or Title, of any kind whatever, from any King, Prince, or foreign State.
Section 10: Powers Denied to the States
No State shall enter into any Treaty, Alliance, or Confederation; grant Letters of Marque and Reprisal; send_epoch=1779048913.972515
[13:15:20.000] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 44/148 from zerodev2 bytes=300 file=US_Constitution.txt data=coin Money; emit Bills of Credit; make any Thing but gold and silver Coin a Tender in Payment of Debts; pass any Bill of Attainder, ex post facto Law, or Law impairing the Obligation of Contracts, or grant any Title of Nobility.
No State shall, without the Consent of the Congress, lay any Imposts o send_epoch=1779048914.076398
[13:15:20.240] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 45/148 from zerodev2 bytes=300 file=US_Constitution.txt data=r Duties on Imports or Exports, except what may be absolutely necessary for executing it's inspection Laws: and the net Produce of all Duties and Imposts, laid by any State on Imports or Exports, shall be for the Use of the Treasury of the United States; and all such Laws shall be subject to the Rev send_epoch=1779048914.180324
[13:15:20.484] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 46/148 from zerodev2 bytes=300 file=US_Constitution.txt data=ision and Controul of the Congress.
No State shall, without the Consent of Congress, lay any Duty of Tonnage, keep Troops, or Ships of War in time of Peace, enter into any Agreement or Compact with another State, or with a foreign Power, or engage in War, unless actually invaded, or in such imminen send_epoch=1779048914.284197
[13:15:20.727] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 47/148 from zerodev2 bytes=300 file=US_Constitution.txt data=t Danger as will not admit of delay.
Article II
Section 1
The executive Power shall be vested in a President of the United States of America.
He shall hold his Office during the Term of four Years, and, together with the Vice President, chosen for the same Term, be elected, as follows:
Each State send_epoch=1779048914.391908
[13:15:20.970] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 48/148 from zerodev2 bytes=300 file=US_Constitution.txt data= shall appoint, in such Manner as the Legislature thereof may direct, a Number of Electors, equal to the whole Number of Senators and Representatives to which the State may be entitled in the Congress: but no Senator or Representative, or Person holding an Office of Trust or Profit under the United send_epoch=1779048914.495870
[13:15:21.167] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 49/148 from zerodev2 bytes=300 file=US_Constitution.txt data=States, shall be appointed an Elector.
The Electors shall meet in their respective States, and vote by Ballot for two Persons, of whom one at least shall not be an Inhabitant of the same State with themselves. And they shall make a List of all the Persons voted for, and of the Number of Votes for e send_epoch=1779048914.599837
[13:15:21.410] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 50/148 from zerodev2 bytes=300 file=US_Constitution.txt data=ach; which List they shall sign and certify, and transmit sealed to the Seat of the Government of the United States, directed to the President of the Senate. The President of the Senate shall, in the Presence of the Senate and House of Representatives, open all the Certificates, and the Votes shall send_epoch=1779048914.703833
[13:15:21.653] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 51/148 from zerodev2 bytes=300 file=US_Constitution.txt data=then be counted. The Person having the greatest Number of Votes shall be the President, if such Number be a Majority of the whole Number of Electors appointed; and if there be more than one who have such Majority, and have an equal Number of Votes, then the House of Representatives shall immediately send_epoch=1779048914.807848
[13:15:21.896] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 52/148 from zerodev2 bytes=300 file=US_Constitution.txt data= chuse by Ballot one of them for President; and if no Person have a Majority, then from the five highest on the List the said House shall in like Manner chuse the President. But in chusing the President, the Votes shall be taken by States, the Representation from each State having one Vote; A quorum send_epoch=1779048914.911877
[13:15:22.094] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 53/148 from zerodev2 bytes=300 file=US_Constitution.txt data= for this Purpose shall consist of a Member or Members from two thirds of the States, and a Majority of all the States shall be necessary to a Choice. In every Case, after the Choice of the President, the Person having the greatest Number of Votes of the Electors shall be the Vice President. But if send_epoch=1779048915.017695
[13:15:22.337] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 54/148 from zerodev2 bytes=300 file=US_Constitution.txt data=there should remain two or more who have equal Votes, the Senate shall chuse from them by Ballot the Vice President.
The Congress may determine the Time of chusing the Electors, and the Day on which they shall give their Votes; which Day shall be the same throughout the United States.
No Person ex send_epoch=1779048915.126401
[13:15:22.580] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 55/148 from zerodev2 bytes=300 file=US_Constitution.txt data=cept a natural born Citizen, or a Citizen of the United States, at the time of the Adoption of this Constitution, shall be eligible to the Office of President; neither shall any Person be eligible to that Office who shall not have attained to the Age of thirty five Years, and been fourteen Years a R send_epoch=1779048915.230270
[13:15:22.822] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 56/148 from zerodev2 bytes=300 file=US_Constitution.txt data=esident within the United States.
In Case of the Removal of the President from Office, or of his Death, Resignation, or Inability to discharge the Powers and Duties of the said Office, the Same shall devolve on the Vice President, and the Congress may by Law provide for the Case of Removal, Death, send_epoch=1779048915.334136
[13:15:23.020] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 57/148 from zerodev2 bytes=300 file=US_Constitution.txt data=Resignation or Inability, both of the President and Vice President, declaring what Officer shall then act as President, and such Officer shall act accordingly, until the Disability be removed, or a President shall be elected.
The President shall, at stated Times, receive for his Services, a Compens send_epoch=1779048915.438076
[13:15:23.263] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 58/148 from zerodev2 bytes=300 file=US_Constitution.txt data=ation, which shall neither be encreased nor diminished during the Period for which he shall have been elected, and he shall not receive within that Period any other Emolument from the United States, or any of them.
Before he enter on the Execution of his Office, he shall take the following Oath or send_epoch=1779048915.544617
[13:15:23.604] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 59/148 from zerodev2 bytes=300 file=US_Constitution.txt data=Affirmation:--"I do solemnly swear (or affirm) that I will faithfully execute the Office of President of the United States, and will to the best of my Ability, preserve, protect and defend the Constitution of the United States."
Section 2
The President shall be Commander in Chief of the Army and Na send_epoch=1779048915.648503
[13:15:23.846] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 60/148 from zerodev2 bytes=300 file=US_Constitution.txt data=vy of the United States, and of the Militia of the several States, when called into the actual Service of the United States; he may require the Opinion, in writing, of the principal Officer in each of the executive Departments, upon any Subject relating to the Duties of their respective Offices, and send_epoch=1779048915.752661
[13:15:24.044] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 61/148 from zerodev2 bytes=300 file=US_Constitution.txt data= he shall have Power to grant Reprieves and Pardons for Offences against the United States, except in Cases of Impeachment.
He shall have Power, by and with the Advice and Consent of the Senate, to make Treaties, provided two thirds of the Senators present concur; and he shall nominate, and by and send_epoch=1779048915.856494
[13:15:24.286] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 62/148 from zerodev2 bytes=300 file=US_Constitution.txt data=with the Advice and Consent of the Senate, shall appoint Ambassadors, other public Ministers and Consuls, Judges of the supreme Court, and all other Officers of the United States, whose Appointments are not herein otherwise provided for, and which shall be established by Law: but the Congress may by send_epoch=1779048915.960321
[13:15:24.529] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 63/148 from zerodev2 bytes=300 file=US_Constitution.txt data= Law vest the Appointment of such inferior Officers, as they think proper, in the President alone, in the Courts of Law, or in the Heads of Departments.
The President shall have Power to fill up all Vacancies that may happen during the Recess of the Senate, by granting Commissions which shall expir send_epoch=1779048916.064154
[13:15:24.772] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 64/148 from zerodev2 bytes=300 file=US_Constitution.txt data=e at the End of their next Session.
Section 3
He shall from time to time give to the Congress Information of the State of the Union, and recommend to their Consideration such Measures as he shall judge necessary and expedient; he may, on extraordinary Occasions, convene both Houses, or either of th send_epoch=1779048916.168020
[13:15:24.970] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 65/148 from zerodev2 bytes=300 file=US_Constitution.txt data=em, and in Case of Disagreement between them, with Respect to the Time of Adjournment, he may adjourn them to such Time as he shall think proper; he shall receive Ambassadors and other public Ministers; he shall take Care that the Laws be faithfully executed, and shall Commission all the Officers of send_epoch=1779048916.271864
[13:15:25.262] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 66/148 from zerodev2 bytes=300 file=US_Constitution.txt data= the United States.
Section 4
The President, Vice President and all civil Officers of the United States, shall be removed from Office on Impeachment for, and Conviction of, Treason, Bribery, or other high Crimes and Misdemeanors.
Article III
Section 1
The judicial Power of the United States, shall send_epoch=1779048916.375675
[13:15:25.504] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 67/148 from zerodev2 bytes=300 file=US_Constitution.txt data= be vested in one supreme Court, and in such inferior Courts as the Congress may from time to time ordain and establish. The Judges, both of the supreme and inferior Courts, shall hold their Offices during good Behaviour, and shall, at stated Times, receive for their Services, a Compensation, which send_epoch=1779048916.479545
[13:15:25.747] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 68/148 from zerodev2 bytes=300 file=US_Constitution.txt data=shall not be diminished during their Continuance in Office.
Section 2
The judicial Power shall extend to all Cases, in Law and Equity, arising under this Constitution, the Laws of the United States, and Treaties made, or which shall be made, under their Authority;--to all Cases affecting Ambassador send_epoch=1779048916.583691
[13:15:25.945] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 69/148 from zerodev2 bytes=300 file=US_Constitution.txt data=s, other public Ministers and Consuls;--to all Cases of admiralty and maritime Jurisdiction;--to Controversies to which the United States shall be a Party;--to Controversies between two or more States;--between a State and Citizens of another State;--between Citizens of different States;--between Ci send_epoch=1779048916.687607
[13:15:26.188] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 70/148 from zerodev2 bytes=300 file=US_Constitution.txt data=tizens of the same State claiming Lands under Grants of different States, and between a State, or the Citizens thereof, and foreign States, Citizens or Subjects.
In all Cases affecting Ambassadors, other public Ministers and Consuls, and those in which a State shall be Party, the supreme Court shal send_epoch=1779048916.791353
[13:15:26.431] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 71/148 from zerodev2 bytes=300 file=US_Constitution.txt data=l have original Jurisdiction. In all the other Cases before mentioned, the supreme Court shall have appellate Jurisdiction, both as to Law and Fact, with such Exceptions, and under such Regulations as the Congress shall make.
The Trial of all Crimes, except in Cases of Impeachment; shall be by Jury send_epoch=1779048916.895169
[13:15:26.674] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 72/148 from zerodev2 bytes=300 file=US_Constitution.txt data=; and such Trial shall be held in the State where the said Crimes shall have been committed; but when not committed within any State, the Trial shall be at such Place or Places as the Congress may by Law have directed.
Section 3
Treason against the United States, shall consist only in levying War a send_epoch=1779048916.999081
[13:15:26.871] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 73/148 from zerodev2 bytes=300 file=US_Constitution.txt data=gainst them, or in adhering to their Enemies, giving them Aid and Comfort. No Person shall be convicted of Treason unless on the Testimony of two Witnesses to the same overt Act, or on Confession in open Court.
The Congress shall have Power to declare the Punishment of Treason, but no Attainder of send_epoch=1779048917.103013
[13:15:27.114] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 74/148 from zerodev2 bytes=300 file=US_Constitution.txt data=Treason shall work Corruption of Blood, or Forfeiture except during the Life of the Person attainted.
Article IV
Section 1
Full Faith and Credit shall be given in each State to the public Acts, Records, and judicial Proceedings of every other State. And the Congress may by general Laws prescribe th send_epoch=1779048917.206928
[13:15:27.357] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 75/148 from zerodev2 bytes=300 file=US_Constitution.txt data=e Manner in which such Acts, Records and Proceedings shall be proved, and the Effect thereof.
Section 2
The Citizens of each State shall be entitled to all Privileges and Immunities of Citizens in the several States.
A Person charged in any State with Treason, Felony, or other Crime, who shall fle send_epoch=1779048917.310908
[13:15:27.600] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 76/148 from zerodev2 bytes=300 file=US_Constitution.txt data=e from Justice, and be found in another State, shall on Demand of the executive Authority of the State from which he fled, be delivered up, to be removed to the State having Jurisdiction of the Crime.
No Person held to Service or Labour in one State, under the Laws thereof, escaping into another, s send_epoch=1779048917.414732
[13:15:27.798] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 77/148 from zerodev2 bytes=300 file=US_Constitution.txt data=hall, in Consequence of any Law or Regulation therein, be discharged from such Service or Labour, but shall be delivered up on Claim of the Party to whom such Service or Labour may be due.
Section 3
New States may be admitted by the Congress into this Union; but no new State shall be formed or erec send_epoch=1779048917.518674
[13:15:28.089] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 78/148 from zerodev2 bytes=300 file=US_Constitution.txt data=ted within the Jurisdiction of any other State; nor any State be formed by the Junction of two or more States, or Parts of States, without the Consent of the Legislatures of the States concerned as well as of the Congress.
The Congress shall have Power to dispose of and make all needful Rules and R send_epoch=1779048917.624122
[13:15:28.332] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 79/148 from zerodev2 bytes=300 file=US_Constitution.txt data=egulations respecting the Territory or other Property belonging to the United States; and nothing in this Constitution shall be so construed as to Prejudice any Claims of the United States, or of any particular State.
Section 4
The United States shall guarantee to every State in this Union a Republ send_epoch=1779048917.729865
[13:15:28.575] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 80/148 from zerodev2 bytes=300 file=US_Constitution.txt data=ican Form of Government, and shall protect each of them against Invasion; and on Application of the Legislature, or of the Executive (when the Legislature cannot be convened) against domestic Violence.
Article V
The Congress, whenever two thirds of both Houses shall deem it necessary, shall propose send_epoch=1779048917.835552
[13:15:28.773] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 81/148 from zerodev2 bytes=300 file=US_Constitution.txt data= Amendments to this Constitution, or, on the Application of the Legislatures of two thirds of the several States, shall call a Convention for proposing Amendments, which, in either Case, shall be valid to all Intents and Purposes, as Part of this Constitution, when ratified by the Legislatures of th send_epoch=1779048917.941311
[13:15:29.015] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 82/148 from zerodev2 bytes=300 file=US_Constitution.txt data=ree fourths of the several States, or by Conventions in three fourths thereof, as the one or the other Mode of Ratification may be proposed by the Congress; Provided that no Amendment which may be made prior to the Year One thousand eight hundred and eight shall in any Manner affect the first and fo send_epoch=1779048918.056589
[13:15:29.259] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 83/148 from zerodev2 bytes=300 file=US_Constitution.txt data=urth Clauses in the Ninth Section of the first Article; and that no State, without its Consent, shall be deprived of its equal Suffrage in the Senate.
Article VI
All Debts contracted and Engagements entered into, before the Adoption of this Constitution, shall be as valid against the United States send_epoch=1779048918.163450
[13:15:29.501] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 84/148 from zerodev2 bytes=300 file=US_Constitution.txt data=under this Constitution, as under the Confederation.
This Constitution, and the Laws of the United States which shall be made in Pursuance thereof; and all Treaties made, or which shall be made, under the Authority of the United States, shall be the supreme Law of the Land; and the Judges in every send_epoch=1779048918.267315
[13:15:29.699] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 85/148 from zerodev2 bytes=300 file=US_Constitution.txt data=State shall be bound thereby, any Thing in the Constitution or Laws of any State to the Contrary notwithstanding.
The Senators and Representatives before mentioned, and the Members of the several State Legislatures, and all executive and judicial Officers, both of the United States and of the sever send_epoch=1779048918.371150
[13:15:29.941] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 86/148 from zerodev2 bytes=300 file=US_Constitution.txt data=al States, shall be bound by Oath or Affirmation, to support this Constitution; but no religious Test shall ever be required as a Qualification to any Office or public Trust under the United States.
Article VII
The Ratification of the Conventions of nine States, shall be sufficient for the Establis send_epoch=1779048918.484191
[13:15:30.185] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 87/148 from zerodev2 bytes=300 file=US_Constitution.txt data=hment of this Constitution between the States so ratifying the Same.
First Amendment
Congress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof; or abridging the freedom of speech, or of the press; or the right of the people peaceably to assemble, a send_epoch=1779048918.589392
[13:15:30.427] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 88/148 from zerodev2 bytes=300 file=US_Constitution.txt data=nd to petition the Government for a redress of grievances.
Second Amendment
A well regulated Militia, being necessary to the security of a free State, the right of the people to keep and bear Arms, shall not be infringed.
Third Amendment
No Soldier shall, in time of peace be quartered in any house send_epoch=1779048918.693389
[13:15:30.674] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 89/148 from zerodev2 bytes=300 file=US_Constitution.txt data=, without the consent of the Owner, nor in time of war, but in a manner to be prescribed by law.
Fourth Amendment
The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no Warrants shall issue, but u send_epoch=1779048918.797252
[13:15:31.014] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 90/148 from zerodev2 bytes=300 file=US_Constitution.txt data=pon probable cause, supported by Oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.
Fifth Amendment
No person shall be held to answer for a capital, or otherwise infamous crime, unless on a presentment or indictment of a Grand Jury, ex send_epoch=1779048918.901155
[13:15:31.257] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 91/148 from zerodev2 bytes=300 file=US_Constitution.txt data=cept in cases arising in the land or naval forces, or in the Militia, when in actual service in time of War or public danger; nor shall any person be subject for the same offence to be twice put in jeopardy of life or limb; nor shall be compelled in any criminal case to be a witness against himself, send_epoch=1779048919.005086
[13:15:31.500] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 92/148 from zerodev2 bytes=300 file=US_Constitution.txt data= nor be deprived of life, liberty, or property, without due process of law; nor shall private property be taken for public use, without just compensation.
Sixth Amendment
In all criminal prosecutions, the accused shall enjoy the right to a speedy and public trial, by an impartial jury of the State send_epoch=1779048919.109058
[13:15:31.697] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 93/148 from zerodev2 bytes=300 file=US_Constitution.txt data=and district wherein the crime shall have been committed, which district shall have been previously ascertained by law, and to be informed of the nature and cause of the accusation; to be confronted with the witnesses against him; to have compulsory process for obtaining witnesses in his favor, and send_epoch=1779048919.213286
[13:15:31.940] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 94/148 from zerodev2 bytes=300 file=US_Constitution.txt data=to have the Assistance of Counsel for his defence.
Seventh Amendment
In Suits at common law, where the value in controversy shall exceed twenty dollars, the right of trial by jury shall be preserved, and no fact tried by a jury, shall be otherwise re-examined in any Court of the United States, than send_epoch=1779048919.317233
[13:15:32.183] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 95/148 from zerodev2 bytes=300 file=US_Constitution.txt data= according to the rules of the common law.
Eighth Amendment
Excessive bail shall not be required, nor excessive fines imposed, nor cruel and unusual punishments inflicted.
Ninth Amendment
The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others ret send_epoch=1779048919.421135
[13:15:32.426] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 96/148 from zerodev2 bytes=300 file=US_Constitution.txt data=ained by the people.
10th Amendment
The powers not delegated to the United States by the Constitution, nor prohibited by it to the States, are reserved to the States respectively, or to the people.
11th Amendment
The Judicial power of the United States shall not be construed to extend to any suit send_epoch=1779048919.525011
[13:15:32.624] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 97/148 from zerodev2 bytes=300 file=US_Constitution.txt data=in law or equity, commenced or prosecuted against one of the United States by Citizens of another State, or by Citizens or Subjects of any Foreign State.
12th Amendment
The Electors shall meet in their respective states and vote by ballot for President and Vice-President, one of whom, at least, sha send_epoch=1779048919.628976
[13:15:32.866] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 98/148 from zerodev2 bytes=300 file=US_Constitution.txt data=ll not be an inhabitant of the same state with themselves; they shall name in their ballots the person voted for as President, and in distinct ballots the person voted for as Vice-President, and they shall make distinct lists of all persons voted for as President, and of all persons voted for as Vic send_epoch=1779048919.732917
[13:15:33.159] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 99/148 from zerodev2 bytes=300 file=US_Constitution.txt data=e-President, and of the number of votes for each, which lists they shall sign and certify, and transmit sealed to the seat of the government of the United States, directed to the President of the Senate; -- the President of the Senate shall, in the presence of the Senate and House of Representatives send_epoch=1779048919.836854
[13:15:33.402] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 100/148 from zerodev2 bytes=300 file=US_Constitution.txt data=, open all the certificates and the votes shall then be counted; -- The person having the greatest number of votes for President, shall be the President, if such number be a majority of the whole number of Electors appointed; and if no person have such majority, then from the persons having the high send_epoch=1779048919.940683
[13:15:33.599] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 101/148 from zerodev2 bytes=300 file=US_Constitution.txt data=est numbers not exceeding three on the list of those voted for as President, the House of Representatives shall choose immediately, by ballot, the President. But in choosing the President, the votes shall be taken by states, the representation from each state having one vote; a quorum for this purpo send_epoch=1779048920.045830
[13:15:33.842] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 102/148 from zerodev2 bytes=300 file=US_Constitution.txt data=se shall consist of a member or members from two-thirds of the states, and a majority of all the states shall be necessary to a choice. And if the House of Representatives shall not choose a President whenever the right of choice shall devolve upon them, before the fourth day of March next following send_epoch=1779048920.149772
[13:15:34.085] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 103/148 from zerodev2 bytes=300 file=US_Constitution.txt data=, then the Vice-President shall act as President, as in the case of the death or other constitutional disability of the President.-- The person having the greatest number of votes as Vice-President, shall be the Vice-President, if such number be a majority of the whole number of Electors appointed, send_epoch=1779048920.253801
[13:15:34.376] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 104/148 from zerodev2 bytes=300 file=US_Constitution.txt data=and if no person have a majority, then from the two highest numbers on the list, the Senate shall choose the Vice-President; a quorum for the purpose shall consist of two-thirds of the whole number of Senators, and a majority of the whole number shall be necessary to a choice. But no person constitu send_epoch=1779048920.357838
[13:15:34.574] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 105/148 from zerodev2 bytes=300 file=US_Constitution.txt data=tionally ineligible to the office of President shall be eligible to that of Vice-President of the United States.
13th Amendment
Section 1
Neither slavery nor involuntary servitude, except as a punishment for crime whereof the party shall have been duly convicted, shall exist within the United State send_epoch=1779048920.478961
[13:15:34.817] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 106/148 from zerodev2 bytes=300 file=US_Constitution.txt data=s, or any place subject to their jurisdiction.
Section 2
Congress shall have power to enforce this article by appropriate legislation.
14th Amendment
Section 1
All persons born or naturalized in the United States, and subject to the jurisdiction thereof, are citizens of the United States and of th send_epoch=1779048920.582938
[13:15:35.060] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 107/148 from zerodev2 bytes=300 file=US_Constitution.txt data=e State wherein they reside. No State shall make or enforce any law which shall abridge the privileges or immunities of citizens of the United States; nor shall any State deprive any person of life, liberty, or property, without due process of law; nor deny to any person within its jurisdiction the send_epoch=1779048920.686776
[13:15:35.303] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 108/148 from zerodev2 bytes=300 file=US_Constitution.txt data=equal protection of the laws.
Section 2
Representatives shall be apportioned among the several States according to their respective numbers, counting the whole number of persons in each State, excluding Indians not taxed. But when the right to vote at any election for the choice of electors for Pre send_epoch=1779048920.790633
[13:15:35.500] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 109/148 from zerodev2 bytes=300 file=US_Constitution.txt data=sident and Vice-President of the United States, Representatives in Congress, the Executive and Judicial officers of a State, or the members of the Legislature thereof, is denied to any of the male inhabitants of such State, being twenty-one years of age, and citizens of the United States, or in any send_epoch=1779048920.894542
[13:15:35.743] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 110/148 from zerodev2 bytes=300 file=US_Constitution.txt data=way abridged, except for participation in rebellion, or other crime, the basis of representation therein shall be reduced in the proportion which the number of such male citizens shall bear to the whole number of male citizens twenty-one years of age in such State.
Section 3
No person shall be a Se send_epoch=1779048920.998458
[13:15:35.986] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 111/148 from zerodev2 bytes=300 file=US_Constitution.txt data=nator or Representative in Congress, or elector of President and Vice-President, or hold any office, civil or military, under the United States, or under any State, who, having previously taken an oath, as a member of Congress, or as an officer of the United States, or as a member of any State legis send_epoch=1779048921.102410
[13:15:36.229] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 112/148 from zerodev2 bytes=300 file=US_Constitution.txt data=lature, or as an executive or judicial officer of any State, to support the Constitution of the United States, shall have engaged in insurrection or rebellion against the same, or given aid or comfort to the enemies thereof. But Congress may by a vote of two-thirds of each House, remove such disabil send_epoch=1779048921.206315
[13:15:36.426] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 113/148 from zerodev2 bytes=300 file=US_Constitution.txt data=ity.
Section 4
The validity of the public debt of the United States, authorized by law, including debts incurred for payment of pensions and bounties for services in suppressing insurrection or rebellion, shall not be questioned. But neither the United States nor any State shall assume or pay any d send_epoch=1779048921.310414
[13:15:36.718] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 114/148 from zerodev2 bytes=300 file=US_Constitution.txt data=ebt or obligation incurred in aid of insurrection or rebellion against the United States, or any claim for the loss or emancipation of any slave; but all such debts, obligations and claims shall be held illegal and void.
Section 5
The Congress shall have power to enforce, by appropriate legislation send_epoch=1779048921.414958
[13:15:36.961] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 115/148 from zerodev2 bytes=300 file=US_Constitution.txt data=, the provisions of this article.
15th Amendment
Section 1
The right of citizens of the United States to vote shall not be denied or abridged by the United States or by any State on account of race, color, or previous condition of servitude.
Section 2
The Congress shall have power to enforce this send_epoch=1779048921.538327
[13:15:37.204] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 116/148 from zerodev2 bytes=300 file=US_Constitution.txt data=article by appropriate legislation.
16th Amendment
The Congress shall have power to lay and collect taxes on incomes, from whatever source derived, without apportionment among the several States, and without regard to any census or enumeration.
17th Amendment
The Senate of the United States shall send_epoch=1779048921.643162
[13:15:37.401] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 117/148 from zerodev2 bytes=300 file=US_Constitution.txt data=be composed of two Senators from each State, elected by the people thereof, for six years; and each Senator shall have one vote. The electors in each State shall have the qualifications requisite for electors of the most numerous branch of the State legislatures.
When vacancies happen in the repres send_epoch=1779048921.747396
[13:15:37.644] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 118/148 from zerodev2 bytes=300 file=US_Constitution.txt data=entation of any State in the Senate, the executive authority of such State shall issue writs of election to fill such vacancies: Provided, That the legislature of any State may empower the executive thereof to make temporary appointments until the people fill the vacancies by election as the legisla send_epoch=1779048921.852263
[13:15:37.936] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 119/148 from zerodev2 bytes=300 file=US_Constitution.txt data=ture may direct.
This amendment shall not be so construed as to affect the election or term of any Senator chosen before it becomes valid as part of the Constitution.
18th Amendment
Section 1
After one year from the ratification of this article the manufacture, sale, or transportation of intoxicat send_epoch=1779048921.956292
[13:15:38.179] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 120/148 from zerodev2 bytes=300 file=US_Constitution.txt data=ing liquors within, the importation thereof into, or the exportation thereof from the United States and all territory subject to the jurisdiction thereof for beverage purposes is hereby prohibited.
Section 2
The Congress and the several States shall have concurrent power to enforce this article by send_epoch=1779048922.060268
[13:15:38.376] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 121/148 from zerodev2 bytes=300 file=US_Constitution.txt data=appropriate legislation.
Section 3
This article shall be inoperative unless it shall have been ratified as an amendment to the Constitution by the legislatures of the several States, as provided in the Constitution, within seven years from the date of the submission hereof to the States by the Cong send_epoch=1779048922.164186
[13:15:38.619] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 122/148 from zerodev2 bytes=300 file=US_Constitution.txt data=ress.
19th Amendment
The right of citizens of the United States to vote shall not be denied or abridged by the United States or by any State on account of sex.
Congress shall have power to enforce this article by appropriate legislation.
20th Amendment
Section 1
The terms of the President and the send_epoch=1779048922.268165
[13:15:38.862] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 123/148 from zerodev2 bytes=300 file=US_Constitution.txt data= Vice President shall end at noon on the 20th day of January, and the terms of Senators and Representatives at noon on the 3d day of January, of the years in which such terms would have ended if this article had not been ratified; and the terms of their successors shall then begin.
Section 2
The Co send_epoch=1779048922.372084
[13:15:39.105] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 124/148 from zerodev2 bytes=300 file=US_Constitution.txt data=ngress shall assemble at least once in every year, and such meeting shall begin at noon on the 3d day of January, unless they shall by law appoint a different day.
Section 3
If, at the time fixed for the beginning of the term of the President, the President elect shall have died, the Vice President send_epoch=1779048922.476020
[13:15:39.302] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 125/148 from zerodev2 bytes=300 file=US_Constitution.txt data= elect shall become President. If a President shall not have been chosen before the time fixed for the beginning of his term, or if the President elect shall have failed to qualify, then the Vice President elect shall act as President until a President shall have qualified; and the Congress may by l send_epoch=1779048922.580114
[13:15:39.594] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 126/148 from zerodev2 bytes=300 file=US_Constitution.txt data=aw provide for the case wherein neither a President elect nor a Vice President elect shall have qualified, declaring who shall then act as President, or the manner in which one who is to act shall be selected, and such person shall act accordingly until a President or Vice President shall have quali send_epoch=1779048922.684039
[13:15:39.886] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 127/148 from zerodev2 bytes=300 file=US_Constitution.txt data=fied.
Section 4
The Congress may by law provide for the case of the death of any of the persons from whom the House of Representatives may choose a President whenever the right of choice shall have devolved upon them, and for the case of the death of any of the persons from whom the Senate may choo send_epoch=1779048922.787936
[13:15:40.129] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 128/148 from zerodev2 bytes=300 file=US_Constitution.txt data=se a Vice President whenever the right of choice shall have devolved upon them.
Section 5
Sections 1 and 2 shall take effect on the 15th day of October following the ratification of this article.
Section 6
This article shall be inoperative unless it shall have been ratified as an amendment to the send_epoch=1779048922.898026
[13:15:40.326] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 129/148 from zerodev2 bytes=300 file=US_Constitution.txt data=Constitution by the legislatures of three-fourths of the several States within seven years from the date of its submission.
21st Amendment
Section 1
The eighteenth article of amendment to the Constitution of the United States is hereby repealed.
Section 2
The transportation or importation into any send_epoch=1779048923.003102
[13:15:40.569] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 130/148 from zerodev2 bytes=300 file=US_Constitution.txt data= State, Territory, or possession of the United States for delivery or use therein of intoxicating liquors, in violation of the laws thereof, is hereby prohibited.
Section 3
This article shall be inoperative unless it shall have been ratified as an amendment to the Constitution by conventions in the send_epoch=1779048923.107091
[13:15:40.812] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 131/148 from zerodev2 bytes=300 file=US_Constitution.txt data= several States, as provided in the Constitution, within seven years from the date of the submission hereof to the States by the Congress.
22nd Amendment
Section 1
No person shall be elected to the office of the President more than twice, and no person who has held the office of President, or acted send_epoch=1779048923.211463
[13:15:41.055] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 132/148 from zerodev2 bytes=300 file=US_Constitution.txt data= as President, for more than two years of a term to which some other person was elected President shall be elected to the office of the President more than once. But this Article shall not apply to any person holding the office of President when this Article was proposed by the Congress, and shall n send_epoch=1779048923.317168
[13:15:41.253] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 133/148 from zerodev2 bytes=300 file=US_Constitution.txt data=ot prevent any person who may be holding the office of President, or acting as President, during the term within which this Article becomes operative from holding the office of President or acting as President during the remainder of such term.
Section 2
This article shall be inoperative unless it send_epoch=1779048923.422906
[13:15:41.495] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 134/148 from zerodev2 bytes=300 file=US_Constitution.txt data=shall have been ratified as an amendment to the Constitution by the legislatures of three-fourths of the several States within seven years from the date of its submission to the States by the Congress.
23rd Amendment
Section 1
The District constituting the seat of Government of the United States sh send_epoch=1779048923.528590
[13:15:41.738] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 135/148 from zerodev2 bytes=300 file=US_Constitution.txt data=all appoint in such manner as Congress may direct:
A number of electors of President and Vice President equal to the whole number of Senators and Representatives in Congress to which the District would be entitled if it were a State, but in no event more than the least populous State; they shall be send_epoch=1779048923.634203
[13:15:41.982] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 136/148 from zerodev2 bytes=300 file=US_Constitution.txt data= in addition to those appointed by the States, but they shall be considered, for the purposes of the election of President and Vice President, to be electors appointed by a State; and they shall meet in the District and perform such duties as provided by the twelfth article of amendment.
Section 2
send_epoch=1779048923.739893
[13:15:42.225] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 137/148 from zerodev2 bytes=300 file=US_Constitution.txt data=The Congress shall have power to enforce this article by appropriate legislation.
24th Amendment
Section 1
The right of citizens of the United States to vote in any primary or other election for President or Vice President, for electors for President or Vice President, or for Senator or Representat send_epoch=1779048923.845952
[13:15:42.423] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 138/148 from zerodev2 bytes=300 file=US_Constitution.txt data=ive in Congress, shall not be denied or abridged by the United States or any State by reason of failure to pay poll tax or other tax.
Section 2
The Congress shall have power to enforce this article by appropriate legislation.
25th Amendment
Section 1
In case of the removal of the President from of send_epoch=1779048923.951618
[13:15:42.665] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 139/148 from zerodev2 bytes=300 file=US_Constitution.txt data=fice or of his death or resignation, the Vice President shall become President.
Section 2
Whenever there is a vacancy in the office of the Vice President, the President shall nominate a Vice President who shall take office upon confirmation by a majority vote of both Houses of Congress.
Section 3
send_epoch=1779048924.057411
[13:15:42.957] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 140/148 from zerodev2 bytes=300 file=US_Constitution.txt data=Whenever the President transmits to the President pro tempore of the Senate and the Speaker of the House of Representatives his written declaration that he is unable to discharge the powers and duties of his office, and until he transmits to them a written declaration to the contrary, such powers an send_epoch=1779048924.163121
[13:15:43.200] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 141/148 from zerodev2 bytes=300 file=US_Constitution.txt data=d duties shall be discharged by the Vice President as Acting President.
Section 4
Whenever the Vice President and a majority of either the principal officers of the executive departments or of such other body as Congress may by law provide, transmit to the President pro tempore of the Senate and th send_epoch=1779048924.269169
[13:15:43.398] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 142/148 from zerodev2 bytes=300 file=US_Constitution.txt data=e Speaker of the House of Representatives their written declaration that the President is unable to discharge the powers and duties of his office, the Vice President shall immediately assume the powers and duties of the office as Acting President.
Thereafter, when the President transmits to th send_epoch=1779048924.375298
[13:15:43.640] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 143/148 from zerodev2 bytes=300 file=US_Constitution.txt data=e President pro tempore of the Senate and the Speaker of the House of Representatives his written declaration that no inability exists, he shall resume the powers and duties of his office unless the Vice President and a majority of either the principal officers of the executive department or of such send_epoch=1779048924.481510
[13:15:43.883] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 144/148 from zerodev2 bytes=300 file=US_Constitution.txt data= other body as Congress may by law provide, transmit within four days to the President pro tempore of the Senate and the Speaker of the House of Representatives their written declaration that the President is unable to discharge the powers and duties of his office. Thereupon Congress shall decide th send_epoch=1779048924.587321
[13:15:44.126] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 145/148 from zerodev2 bytes=300 file=US_Constitution.txt data=e issue, assembling within forty-eight hours for that purpose if not in session. If the Congress, within twenty-one days after receipt of the latter written declaration, or, if Congress is not in session, within twenty-one days after Congress is required to assemble, determines by two-thirds vote of send_epoch=1779048924.696362
[13:15:44.324] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 146/148 from zerodev2 bytes=300 file=US_Constitution.txt data= both Houses that the President is unable to discharge the powers and duties of his office, the Vice President shall continue to discharge the same as Acting President; otherwise, the President shall resume the powers and duties of his office.
26th Amendment
Section 1
The right of citizens of the U send_epoch=1779048924.800293
[13:15:44.566] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 147/148 from zerodev2 bytes=300 file=US_Constitution.txt data=nited States, who are eighteen years of age or older, to vote shall not be denied or abridged by the United States or by any State on account of age.
Section 2
The Congress shall have power to enforce this article by appropriate legislation.
27th Amendment
No law, varying the compensation for the send_epoch=1779048924.904207
[13:15:44.712] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 148/148 from zerodev2 bytes=125 file=US_Constitution.txt data=services of the Senators and Representatives, shall take effect, until an election of Representatives shall have intervened.
send_epoch=1779048925.008132
[13:15:47.117] Skipped announce because an active Reticulum link exists
[13:16:12.920] Link closed: <5f903eef7be6a15c489b541805fb6be0>
[13:16:17.125] Announced <926e6d3b35b7d5940be7edeb47c41b78> as zerodev1
.
Reference ID : C0A80167 (rpi5.salemdata.net)
Stratum : 2
Ref time (UTC) : Sun May 17 20:06:28 2026
System time : 0.000489284 seconds slow of NTP time
Last offset : -0.001022354 seconds
RMS offset : 0.001050475 seconds
Frequency : 1.320 ppm slow
Residual freq : -0.115 ppm
Skew : 1.403 ppm
Root delay : 0.006679162 seconds
Root dispersion : 0.003435722 seconds
Update interval : 1039.6 seconds
Leap status : Normal
.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current best, '+' = combined, '-' = not combined,
| / 'x' = may be in error, '~' = too variable, '?' = unusable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* rpi5.salemdata.net 1 10 377 589 -250us[-1272us] +/- 4530us
jlpoole@zerodev1:/usr/local/src/ble-reticulum $

View file

@ -0,0 +1,607 @@
jlpoole@zerodev2:/usr/local/src/ble-reticulum $ # zerodev2 CPP Command clump START
date
cd /usr/local/src/ble-reticulum/
chronyc tracking
chronyc sources -v
echo .
PYTHONPATH=src:migration/protocol_core \
BLE_RETICULUM_FRAGMENTATION_BACKEND=cpp \
BLE_RETICULUM_FRAGMENTATION_BACKEND_REPORT=1 \
timeout 90 python3 examples/ble_dual_node_echo.py \
--ble-role both \
--message-file /home/jlpoole/US_Constitution.txt \
--peer 926e6d3b35b7d5940be7edeb47c41b78 \
--announce-only-when-disconnected
echo .
chronyc tracking
chronyc sources -v
# zerodev2 Command clump END
Sun May 17 01:14:44 PM PDT 2026
Reference ID : C0A80167 (rpi5.salemdata.net)
Stratum : 2
Ref time (UTC) : Sun May 17 20:00:31 2026
System time : 0.000179263 seconds slow of NTP time
Last offset : -0.000068146 seconds
RMS offset : 0.000485469 seconds
Frequency : 1.427 ppm slow
Residual freq : -0.003 ppm
Skew : 0.332 ppm
Root delay : 0.002358504 seconds
Root dispersion : 0.004645325 seconds
Update interval : 1028.7 seconds
Leap status : Normal
.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current best, '+' = combined, '-' = not combined,
| / 'x' = may be in error, '~' = too variable, '?' = unusable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* rpi5.salemdata.net 1 10 377 853 -244us[ -312us] +/- 4426us
.
[13:14:45.805] Starting node zerodev2
[13:14:45.805] Reticulum config: ~/.reticulum
[13:14:45.805] Runtime config: /tmp/ble_reticulum_poc_zerodev2_sezi_0p2
BLEInterface[BLE Interface] fragmentation backend: cpp (fragmenter=ble_protocol_core_cpp.BLEFragmenter, reassembler=ble_protocol_core_cpp.BLEReassembler)
[13:14:48.977] Loaded identity: /home/jlpoole/.reticulum/ble_reticulum_poc_zerodev2.identity
[13:14:48.978] Destination hash: <e20458bdfdf39ea9c5481bf746543539>
[13:14:48.978] Use this hash as --peer on the other node.
[13:14:48.978] Message file mode: /home/jlpoole/US_Constitution.txt (44225 bytes)
[13:14:48.978] Periodic heartbeats are disabled in message file mode.
[13:14:48.982] Announced <e20458bdfdf39ea9c5481bf746543539> as zerodev2
[13:14:48.983] Requesting path to <926e6d3b35b7d5940be7edeb47c41b78>
Advertisement registered
[13:14:53.990] Requesting path to <926e6d3b35b7d5940be7edeb47c41b78>
[13:14:58.995] Requesting path to <926e6d3b35b7d5940be7edeb47c41b78>
[13:15:03.999] Requesting path to <926e6d3b35b7d5940be7edeb47c41b78>
[13:15:04.257] Establishing link to <926e6d3b35b7d5940be7edeb47c41b78>
[13:15:09.359] Outbound link established: <5f903eef7be6a15c489b541805fb6be0>
[13:15:09.537] RX link=<5f903eef7be6a15c489b541805fb6be0>: hello back from zerodev1 send_epoch=1779048909.418571
[13:15:09.555] Sending file /home/jlpoole/US_Constitution.txt as 148 chunk(s), 44225 bytes
[13:15:09.853] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 1/140 from zerodev1 bytes=316 file=US_Constitution.txt data=The United States Constitution
We the People of the United States, in Order to form a more perfect Union, establish Justice, insure domestic Tranquility, provide for the common defence, promote the general Welfare, and secure the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this Con send_epoch=1779048909.609021
[13:15:10.097] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 2/140 from zerodev1 bytes=316 file=US_Constitution.txt data=stitution for the United States of America.
The Constitutional Convention
Article I
Section 1: Congress
All legislative Powers herein granted shall be vested in a Congress of the United States, which shall consist of a Senate and House of Representatives.
Section 2: The House of Representatives
The House of Repre send_epoch=1779048909.711726
[13:15:10.388] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 3/140 from zerodev1 bytes=316 file=US_Constitution.txt data=sentatives shall be composed of Members chosen every second Year by the People of the several States, and the Electors in each State shall have the Qualifications requisite for Electors of the most numerous Branch of the State Legislature.
No Person shall be a Representative who shall not have attained to the Age send_epoch=1779048909.813790
[13:15:10.631] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 4/140 from zerodev1 bytes=316 file=US_Constitution.txt data=of twenty five Years, and been seven Years a Citizen of the United States, and who shall not, when elected, be an Inhabitant of that State in which he shall be chosen.
Representatives and direct Taxes shall be apportioned among the several States which may be included within this Union, according to their respecti send_epoch=1779048909.915750
[13:15:10.830] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 5/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ve Numbers, which shall be determined by adding to the whole Number of free Persons, including those bound to Service for a Term of Years, and excluding Indians not taxed, three fifths of all other Persons. The actual Enumeration shall be made within three Years after the first Meeting of the Congress of the United send_epoch=1779048910.017802
[13:15:11.121] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 6/140 from zerodev1 bytes=316 file=US_Constitution.txt data= States, and within every subsequent Term of ten Years, in such Manner as they shall by Law direct.The Number of Representatives shall not exceed one for every thirty Thousand, but each State shall have at Least one Representative; and until such enumeration shall be made, the State of New Hampshire shall be entitl send_epoch=1779048910.119760
[13:15:11.364] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 7/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ed to chuse three, Massachusetts eight, Rhode-Island and Providence Plantations one, Connecticut five, New-York six, New Jersey four, Pennsylvania eight, Delaware one, Maryland six, Virginia ten, North Carolina five, South Carolina five, and Georgia three.
When vacancies happen in the Representation from any State send_epoch=1779048910.221824
[13:15:11.657] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 8/140 from zerodev1 bytes=316 file=US_Constitution.txt data=, the Executive Authority thereof shall issue Writs of Election to fill such Vacancies.
The House of Representatives shall chuse their Speaker and other Officers;and shall have the sole Power of Impeachment.
Section 3: The Senate
The Senate of the United States shall be composed of two Senators from each State, c send_epoch=1779048910.323813
[13:15:11.899] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 9/140 from zerodev1 bytes=316 file=US_Constitution.txt data=hosen by the Legislature thereof, for six Years; and each Senator shall have one Vote.
Immediately after they shall be assembled in Consequence of the first Election, they shall be divided as equally as may be into three Classes. The Seats of the Senators of the first Class shall be vacated at the Expiration of th send_epoch=1779048910.425982
[13:15:12.192] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 10/140 from zerodev1 bytes=316 file=US_Constitution.txt data=e second Year, of the second Class at the Expiration of the fourth Year, and of the third Class at the Expiration of the sixth Year, so that one third may be chosen every second Year; and if Vacancies happen by Resignation, or otherwise, during the Recess of the Legislature of any State, the Executive thereof may m send_epoch=1779048910.527970
[13:15:12.442] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 11/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ake temporary Appointments until the next Meeting of the Legislature, which shall then fill such Vacancies.
No Person shall be a Senator who shall not have attained to the Age of thirty Years, and been nine Years a Citizen of the United States, and who shall not, when elected, be an Inhabitant of that State for wh send_epoch=1779048910.630022
[13:15:12.727] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 12/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ich he shall be chosen.
The Vice President of the United States shall be President of the Senate, but shall have no Vote, unless they be equally divided.
The Senate shall chuse their other Officers, and also a President pro tempore, in the Absence of the Vice President, or when he shall exercise the Office of Pre send_epoch=1779048910.732671
[13:15:12.974] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 13/140 from zerodev1 bytes=316 file=US_Constitution.txt data=sident of the United States.
The Senate shall have the sole Power to try all Impeachments. When sitting for that Purpose, they shall be on Oath or Affirmation. When the President of the United States is tried, the Chief Justice shall preside: And no Person shall be convicted without the Concurrence of two thirds o send_epoch=1779048910.836152
[13:15:13.217] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 14/140 from zerodev1 bytes=316 file=US_Constitution.txt data=f the Members present.
Judgment in Cases of Impeachment shall not extend further than to removal from Office, and disqualification to hold and enjoy any Office of honor, Trust or Profit under the United States: but the Party convicted shall nevertheless be liable and subject to Indictment, Trial, Judgment and Puni send_epoch=1779048910.938182
[13:15:13.509] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 15/140 from zerodev1 bytes=316 file=US_Constitution.txt data=shment, according to Law.
Section 4: Elections
The Times, Places and Manner of holding Elections for Senators and Representatives, shall be prescribed in each State by the Legislature thereof; but the Congress may at any time by Law make or alter such Regulations, except as to the Places of chusing Senators.
The send_epoch=1779048911.040144
[13:15:13.760] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 16/140 from zerodev1 bytes=316 file=US_Constitution.txt data=Congress shall assemble at least once in every Year, and such Meeting shall be on the first Monday in December, unless they shall by Law appoint a different Day.
Section 5: Powers and Duties of Congress
Each House shall be the Judge of the Elections, Returns and Qualifications of its own Members,and a Majority of send_epoch=1779048911.142181
[13:15:14.045] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 17/140 from zerodev1 bytes=316 file=US_Constitution.txt data=each shall constitute a Quorum to do Business; but a smaller Number may adjourn from day to day, and may be authorized to compel the Attendance of absent Members, in such Manner, and under such Penalties as each House may provide.
Each House may determine the Rules of its Proceedings, punish its Members for disord send_epoch=1779048911.244136
[13:15:14.288] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 18/140 from zerodev1 bytes=316 file=US_Constitution.txt data=erly Behaviour, and, with the Concurrence of two thirds, expel a Member.
Each House shall keep a Journal of its Proceedings, and from time to time publish the same, excepting such Parts as may in their Judgment require Secrecy; and the Yeas and Nays of the Members of either House on any question shall, at the Desi send_epoch=1779048911.346155
[13:15:14.580] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 19/140 from zerodev1 bytes=316 file=US_Constitution.txt data=re of one fifth of those Present, be entered on the Journal.
Neither House, during the Session of Congress, shall, without the Consent of the other, adjourn for more than three days, nor to any other Place than that in which the two Houses shall be sitting.
Section 6: Rights and Disabilities of Members
The Senato send_epoch=1779048911.448105
[13:15:14.778] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 20/140 from zerodev1 bytes=316 file=US_Constitution.txt data=rs and Representatives shall receive a Compensation for their Services, to be ascertained by Law, and paid out of the Treasury of the United States.They shall in all Cases, except Treason, Felony and Breach of the Peace, be privileged from Arrest during their Attendance at the Session of their respective Houses, an send_epoch=1779048911.550165
[13:15:15.022] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 21/140 from zerodev1 bytes=316 file=US_Constitution.txt data=d in going to and returning from the same; and for any Speech or Debate in either House, they shall not be questioned in any other Place.
No Senator or Representative shall, during the Time for which he was elected, be appointed to any civil Office under the Authority of the United States, which shall have been cr send_epoch=1779048911.652135
[13:15:15.313] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 22/140 from zerodev1 bytes=316 file=US_Constitution.txt data=eated, or the Emoluments whereof shall have been encreased during such time; and no Person holding any Office under the United States, shall be a Member of either House during his Continuance in Office.
Section 7: Legislative Process
All Bills for raising Revenue shall originate in the House of Representatives; bu send_epoch=1779048911.754359
[13:15:15.556] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 23/140 from zerodev1 bytes=316 file=US_Constitution.txt data=t the Senate may propose or concur with Amendments as on other Bills.
Every Bill which shall have passed the House of Representatives and the Senate, shall, before it become a Law, be presented to the President of the United States; If he approve he shall sign it, but if not he shall return it, with his Objections send_epoch=1779048911.856330
[13:15:15.849] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 24/140 from zerodev1 bytes=316 file=US_Constitution.txt data= to that House in which it shall have originated, who shall enter the Objections at large on their Journal, and proceed to reconsider it. If after such Reconsideration two thirds of that House shall agree to pass the Bill, it shall be sent, together with the Objections, to the other House, by which it shall likewis send_epoch=1779048911.958415
[13:15:16.091] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 25/140 from zerodev1 bytes=316 file=US_Constitution.txt data=e be reconsidered, and if approved by two thirds of that House, it shall become a Law. But in all such Cases the Votes of both Houses shall be determined by yeas and Nays, and the Names of the Persons voting for and against the Bill shall be entered on the Journal of each House respectively. If any Bill shall not b send_epoch=1779048912.060387
[13:15:16.384] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 26/140 from zerodev1 bytes=316 file=US_Constitution.txt data=e returned by the President within ten Days (Sundays excepted) after it shall have been presented to him, the Same shall be a Law, in like Manner as if he had signed it, unless the Congress by their Adjournment prevent its Return, in which Case it shall not be a Law.
Every Order, Resolution, or Vote to which the C send_epoch=1779048912.162411
[13:15:16.581] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 27/140 from zerodev1 bytes=316 file=US_Constitution.txt data=oncurrence of the Senate and House of Representatives may be necessary (except on a question of Adjournment) shall be presented to the President of the United States; and before the Same shall take Effect, shall be approved by him, or being disapproved by him, shall be repassed by two thirds of the Senate and House send_epoch=1779048912.264393
[13:15:16.972] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 28/140 from zerodev1 bytes=316 file=US_Constitution.txt data= of Representatives, according to the Rules and Limitations prescribed in the Case of a Bill.
Section 8: Powers of Congress
The Congress shall have Power To lay and collect Taxes, Duties, Imposts and Excises, to pay the Debts and provide for the common Defence and general Welfare of the United States; but all Duti send_epoch=1779048912.366421
[13:15:17.216] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 29/140 from zerodev1 bytes=316 file=US_Constitution.txt data=es, Imposts and Excises shall be uniform throughout the United States;
To borrow Money on the credit of the United States;
To regulate Commerce with foreign Nations, and among the several States, and with the Indian Tribes;
To establish a uniform Rule of Naturalization, and uniform Laws on the subject of Bankrup send_epoch=1779048912.468393
[13:15:17.458] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 30/140 from zerodev1 bytes=316 file=US_Constitution.txt data=tcies throughout the United States;
To coin Money, regulate the Value thereof, and of foreign Coin, and fix the Standard of Weights and Measures;
To provide for the Punishment of counterfeiting the Securities and current Coin of the United States;
To establish Post Offices and post Roads;
To promote the Progres send_epoch=1779048912.570427
[13:15:17.752] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 31/140 from zerodev1 bytes=316 file=US_Constitution.txt data=s of Science and useful Arts, by securing for limited Times to Authors and Inventors the exclusive Right to their respective Writings and Discoveries;
To constitute Tribunals inferior to the supreme Court;
To define and punish Piracies and Felonies committed on the high Seas, and Offences against the Law of Natio send_epoch=1779048912.672400
[13:15:17.996] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 32/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ns;
To declare War, grant Letters of Marque and Reprisal, and make Rules concerning Captures on Land and Water;
To raise and support Armies, but no Appropriation of Money to that Use shall be for a longer Term than two Years;
To provide and maintain a Navy;
To make Rules for the Government and Regulation of the send_epoch=1779048912.774446
[13:15:18.384] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 33/140 from zerodev1 bytes=316 file=US_Constitution.txt data= land and naval Forces;
To provide for calling forth the Militia to execute the Laws of the Union, suppress Insurrections and repel Invasions;
To provide for organizing, arming, and disciplining, the Militia, and for governing such Part of them as may be employed in the Service of the United States, reserving to send_epoch=1779048912.876413
[13:15:18.627] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 34/140 from zerodev1 bytes=316 file=US_Constitution.txt data=the States respectively, the Appointment of the Officers, and the Authority of training the Militia according to the discipline prescribed by Congress;
To exercise exclusive Legislation in all Cases whatsoever, over such District (not exceeding ten Miles square) as may, by Cession of particular States, and the Acc send_epoch=1779048912.979984
[13:15:18.919] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 35/140 from zerodev1 bytes=316 file=US_Constitution.txt data=eptance of Congress, become the Seat of the Government of the United States, and to exercise like Authority over all Places purchased by the Consent of the Legislature of the State in which the Same shall be, for the Erection of Forts, Magazines, Arsenals, dock-Yards and other needful Buildings;-And
To make all La send_epoch=1779048913.082048
[13:15:19.019] Skipped announce because an active Reticulum link exists
[13:15:19.116] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 36/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ws which shall be necessary and proper for carrying into Execution the foregoing Powers, and all other Powers vested by this Constitution in the Government of the United States, or in any Department or Officer thereof.
Section 9: Powers Denied Congress
The Migration or Importation of such Persons as any of the Sta send_epoch=1779048913.184022
[13:15:19.359] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 37/140 from zerodev1 bytes=316 file=US_Constitution.txt data=tes now existing shall think proper to admit, shall not be prohibited by the Congress prior to the Year one thousand eight hundred and eight, but a Tax or duty may be imposed on such Importation, not exceeding ten dollars for each Person.
The Privilege of the Writ of Habeas Corpus shall not be suspended, unless wh send_epoch=1779048913.286075
[13:15:19.652] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 38/140 from zerodev1 bytes=316 file=US_Constitution.txt data=en in Cases of Rebellion or Invasion the public Safety may require it.
No Bill of Attainder or ex post facto Law shall be passed.
No Capitation, or other direct, Tax shall be laid, unless in Proportion to the Census or enumeration herein before directed to be taken.
No Tax or Duty shall be laid on Articles expor send_epoch=1779048913.388051
[13:15:19.895] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 39/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ted from any State.
No Preference shall be given by any Regulation of Commerce or Revenue to the Ports of one State over those of another: nor shall Vessels bound to, or from, one State, be obliged to enter, clear, or pay Duties in another.
No Money shall be drawn from the Treasury, but in Consequence of Appropri send_epoch=1779048913.490105
[13:15:20.187] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 40/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ations made by Law; and a regular Statement and Account of the Receipts and Expenditures of all public Money shall be published from time to time.
No Title of Nobility shall be granted by the United States: And no Person holding any Office of Profit or Trust under them, shall, without the Consent of the Congress, send_epoch=1779048913.592063
[13:15:20.431] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 41/140 from zerodev1 bytes=316 file=US_Constitution.txt data=accept of any present, Emolument, Office, or Title, of any kind whatever, from any King, Prince, or foreign State.
Section 10: Powers Denied to the States
No State shall enter into any Treaty, Alliance, or Confederation; grant Letters of Marque and Reprisal; coin Money; emit Bills of Credit; make any Thing but gol send_epoch=1779048913.694105
[13:15:20.674] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 42/140 from zerodev1 bytes=316 file=US_Constitution.txt data=d and silver Coin a Tender in Payment of Debts; pass any Bill of Attainder, ex post facto Law, or Law impairing the Obligation of Contracts, or grant any Title of Nobility.
No State shall, without the Consent of the Congress, lay any Imposts or Duties on Imports or Exports, except what may be absolutely necessary send_epoch=1779048913.796074
[13:15:20.966] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 43/140 from zerodev1 bytes=316 file=US_Constitution.txt data=for executing it's inspection Laws: and the net Produce of all Duties and Imposts, laid by any State on Imports or Exports, shall be for the Use of the Treasury of the United States; and all such Laws shall be subject to the Revision and Controul of the Congress.
No State shall, without the Consent of Congress, la send_epoch=1779048913.898393
[13:15:21.259] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 44/140 from zerodev1 bytes=316 file=US_Constitution.txt data=y any Duty of Tonnage, keep Troops, or Ships of War in time of Peace, enter into any Agreement or Compact with another State, or with a foreign Power, or engage in War, unless actually invaded, or in such imminent Danger as will not admit of delay.
Article II
Section 1
The executive Power shall be vested in a Pres send_epoch=1779048914.001990
[13:15:21.460] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 45/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ident of the United States of America.
He shall hold his Office during the Term of four Years, and, together with the Vice President, chosen for the same Term, be elected, as follows:
Each State shall appoint, in such Manner as the Legislature thereof may direct, a Number of Electors, equal to the whole Number of send_epoch=1779048914.104124
[13:15:21.699] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 46/140 from zerodev1 bytes=316 file=US_Constitution.txt data= Senators and Representatives to which the State may be entitled in the Congress: but no Senator or Representative, or Person holding an Office of Trust or Profit under the United States, shall be appointed an Elector.
The Electors shall meet in their respective States, and vote by Ballot for two Persons, of whom send_epoch=1779048914.206187
[13:15:21.992] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 47/140 from zerodev1 bytes=316 file=US_Constitution.txt data=one at least shall not be an Inhabitant of the same State with themselves. And they shall make a List of all the Persons voted for, and of the Number of Votes for each; which List they shall sign and certify, and transmit sealed to the Seat of the Government of the United States, directed to the President of the Se send_epoch=1779048914.308183
[13:15:22.234] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 48/140 from zerodev1 bytes=316 file=US_Constitution.txt data=nate. The President of the Senate shall, in the Presence of the Senate and House of Representatives, open all the Certificates, and the Votes shall then be counted. The Person having the greatest Number of Votes shall be the President, if such Number be a Majority of the whole Number of Electors appointed; and if t send_epoch=1779048914.410224
[13:15:22.527] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 49/140 from zerodev1 bytes=316 file=US_Constitution.txt data=here be more than one who have such Majority, and have an equal Number of Votes, then the House of Representatives shall immediately chuse by Ballot one of them for President; and if no Person have a Majority, then from the five highest on the List the said House shall in like Manner chuse the President. But in chu send_epoch=1779048914.512195
[13:15:22.770] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 50/140 from zerodev1 bytes=316 file=US_Constitution.txt data=sing the President, the Votes shall be taken by States, the Representation from each State having one Vote; A quorum for this Purpose shall consist of a Member or Members from two thirds of the States, and a Majority of all the States shall be necessary to a Choice. In every Case, after the Choice of the President, send_epoch=1779048914.614251
[13:15:22.976] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 51/140 from zerodev1 bytes=316 file=US_Constitution.txt data= the Person having the greatest Number of Votes of the Electors shall be the Vice President. But if there should remain two or more who have equal Votes, the Senate shall chuse from them by Ballot the Vice President.
The Congress may determine the Time of chusing the Electors, and the Day on which they shall give send_epoch=1779048914.717180
[13:15:23.262] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 52/140 from zerodev1 bytes=316 file=US_Constitution.txt data=their Votes; which Day shall be the same throughout the United States.
No Person except a natural born Citizen, or a Citizen of the United States, at the time of the Adoption of this Constitution, shall be eligible to the Office of President; neither shall any Person be eligible to that Office who shall not have a send_epoch=1779048914.820124
[13:15:23.602] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 53/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ttained to the Age of thirty five Years, and been fourteen Years a Resident within the United States.
In Case of the Removal of the President from Office, or of his Death, Resignation, or Inability to discharge the Powers and Duties of the said Office, the Same shall devolve on the Vice President, and the Congress send_epoch=1779048914.928052
[13:15:23.895] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 54/140 from zerodev1 bytes=316 file=US_Constitution.txt data= may by Law provide for the Case of Removal, Death, Resignation or Inability, both of the President and Vice President, declaring what Officer shall then act as President, and such Officer shall act accordingly, until the Disability be removed, or a President shall be elected.
The President shall, at stated Times, send_epoch=1779048915.036625
[13:15:24.138] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 55/140 from zerodev1 bytes=316 file=US_Constitution.txt data= receive for his Services, a Compensation, which shall neither be encreased nor diminished during the Period for which he shall have been elected, and he shall not receive within that Period any other Emolument from the United States, or any of them.
Before he enter on the Execution of his Office, he shall take th send_epoch=1779048915.139792
[13:15:24.430] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 56/140 from zerodev1 bytes=316 file=US_Constitution.txt data=e following Oath or Affirmation:--"I do solemnly swear (or affirm) that I will faithfully execute the Office of President of the United States, and will to the best of my Ability, preserve, protect and defend the Constitution of the United States."
Section 2
The President shall be Commander in Chief of the Army an send_epoch=1779048915.242835
[13:15:24.672] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 57/140 from zerodev1 bytes=316 file=US_Constitution.txt data=d Navy of the United States, and of the Militia of the several States, when called into the actual Service of the United States; he may require the Opinion, in writing, of the principal Officer in each of the executive Departments, upon any Subject relating to the Duties of their respective Offices, and he shall ha send_epoch=1779048915.345910
[13:15:24.965] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 58/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ve Power to grant Reprieves and Pardons for Offences against the United States, except in Cases of Impeachment.
He shall have Power, by and with the Advice and Consent of the Senate, to make Treaties, provided two thirds of the Senators present concur; and he shall nominate, and by and with the Advice and Consent send_epoch=1779048915.448842
[13:15:25.162] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 59/140 from zerodev1 bytes=316 file=US_Constitution.txt data=of the Senate, shall appoint Ambassadors, other public Ministers and Consuls, Judges of the supreme Court, and all other Officers of the United States, whose Appointments are not herein otherwise provided for, and which shall be established by Law: but the Congress may by Law vest the Appointment of such inferior O send_epoch=1779048915.551812
[13:15:25.453] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 60/140 from zerodev1 bytes=316 file=US_Constitution.txt data=fficers, as they think proper, in the President alone, in the Courts of Law, or in the Heads of Departments.
The President shall have Power to fill up all Vacancies that may happen during the Recess of the Senate, by granting Commissions which shall expire at the End of their next Session.
Section 3
He shall from send_epoch=1779048915.656835
[13:15:25.745] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 61/140 from zerodev1 bytes=316 file=US_Constitution.txt data= time to time give to the Congress Information of the State of the Union, and recommend to their Consideration such Measures as he shall judge necessary and expedient; he may, on extraordinary Occasions, convene both Houses, or either of them, and in Case of Disagreement between them, with Respect to the Time of Ad send_epoch=1779048915.762600
[13:15:26.038] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 62/140 from zerodev1 bytes=316 file=US_Constitution.txt data=journment, he may adjourn them to such Time as he shall think proper; he shall receive Ambassadors and other public Ministers; he shall take Care that the Laws be faithfully executed, and shall Commission all the Officers of the United States.
Section 4
The President, Vice President and all civil Officers of the U send_epoch=1779048915.865626
[13:15:26.281] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 63/140 from zerodev1 bytes=316 file=US_Constitution.txt data=nited States, shall be removed from Office on Impeachment for, and Conviction of, Treason, Bribery, or other high Crimes and Misdemeanors.
Article III
Section 1
The judicial Power of the United States, shall be vested in one supreme Court, and in such inferior Courts as the Congress may from time to time ordain an send_epoch=1779048915.968557
[13:15:26.539] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 64/140 from zerodev1 bytes=316 file=US_Constitution.txt data=d establish. The Judges, both of the supreme and inferior Courts, shall hold their Offices during good Behaviour, and shall, at stated Times, receive for their Services, a Compensation, which shall not be diminished during their Continuance in Office.
Section 2
The judicial Power shall extend to all Cases, in Law send_epoch=1779048916.071574
[13:15:26.816] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 65/140 from zerodev1 bytes=316 file=US_Constitution.txt data=and Equity, arising under this Constitution, the Laws of the United States, and Treaties made, or which shall be made, under their Authority;--to all Cases affecting Ambassadors, other public Ministers and Consuls;--to all Cases of admiralty and maritime Jurisdiction;--to Controversies to which the United States sh send_epoch=1779048916.174578
[13:15:27.014] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 66/140 from zerodev1 bytes=316 file=US_Constitution.txt data=all be a Party;--to Controversies between two or more States;--between a State and Citizens of another State;--between Citizens of different States;--between Citizens of the same State claiming Lands under Grants of different States, and between a State, or the Citizens thereof, and foreign States, Citizens or Subj send_epoch=1779048916.277632
[13:15:27.307] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 67/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ects.
In all Cases affecting Ambassadors, other public Ministers and Consuls, and those in which a State shall be Party, the supreme Court shall have original Jurisdiction. In all the other Cases before mentioned, the supreme Court shall have appellate Jurisdiction, both as to Law and Fact, with such Exceptions, a send_epoch=1779048916.380594
[13:15:27.554] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 68/140 from zerodev1 bytes=316 file=US_Constitution.txt data=nd under such Regulations as the Congress shall make.
The Trial of all Crimes, except in Cases of Impeachment; shall be by Jury; and such Trial shall be held in the State where the said Crimes shall have been committed; but when not committed within any State, the Trial shall be at such Place or Places as the Cong send_epoch=1779048916.483754
[13:15:27.842] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 69/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ress may by Law have directed.
Section 3
Treason against the United States, shall consist only in levying War against them, or in adhering to their Enemies, giving them Aid and Comfort. No Person shall be convicted of Treason unless on the Testimony of two Witnesses to the same overt Act, or on Confession in open send_epoch=1779048916.587920
[13:15:28.134] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 70/140 from zerodev1 bytes=316 file=US_Constitution.txt data=Court.
The Congress shall have Power to declare the Punishment of Treason, but no Attainder of Treason shall work Corruption of Blood, or Forfeiture except during the Life of the Person attainted.
Article IV
Section 1
Full Faith and Credit shall be given in each State to the public Acts, Records, and judicial Pro send_epoch=1779048916.691224
[13:15:28.376] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 71/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ceedings of every other State. And the Congress may by general Laws prescribe the Manner in which such Acts, Records and Proceedings shall be proved, and the Effect thereof.
Section 2
The Citizens of each State shall be entitled to all Privileges and Immunities of Citizens in the several States.
A Person charged send_epoch=1779048916.794202
[13:15:28.669] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 72/140 from zerodev1 bytes=316 file=US_Constitution.txt data=in any State with Treason, Felony, or other Crime, who shall flee from Justice, and be found in another State, shall on Demand of the executive Authority of the State from which he fled, be delivered up, to be removed to the State having Jurisdiction of the Crime.
No Person held to Service or Labour in one State, send_epoch=1779048916.897105
[13:15:28.867] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 73/140 from zerodev1 bytes=316 file=US_Constitution.txt data=under the Laws thereof, escaping into another, shall, in Consequence of any Law or Regulation therein, be discharged from such Service or Labour, but shall be delivered up on Claim of the Party to whom such Service or Labour may be due.
Section 3
New States may be admitted by the Congress into this Union; but no n send_epoch=1779048917.000008
[13:15:29.109] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 74/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ew State shall be formed or erected within the Jurisdiction of any other State; nor any State be formed by the Junction of two or more States, or Parts of States, without the Consent of the Legislatures of the States concerned as well as of the Congress.
The Congress shall have Power to dispose of and make all nee send_epoch=1779048917.103012
[13:15:29.402] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 75/140 from zerodev1 bytes=316 file=US_Constitution.txt data=dful Rules and Regulations respecting the Territory or other Property belonging to the United States; and nothing in this Constitution shall be so construed as to Prejudice any Claims of the United States, or of any particular State.
Section 4
The United States shall guarantee to every State in this Union a Republ send_epoch=1779048917.206038
[13:15:29.646] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 76/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ican Form of Government, and shall protect each of them against Invasion; and on Application of the Legislature, or of the Executive (when the Legislature cannot be convened) against domestic Violence.
Article V
The Congress, whenever two thirds of both Houses shall deem it necessary, shall propose Amendments to t send_epoch=1779048917.309165
[13:15:29.938] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 77/140 from zerodev1 bytes=316 file=US_Constitution.txt data=his Constitution, or, on the Application of the Legislatures of two thirds of the several States, shall call a Convention for proposing Amendments, which, in either Case, shall be valid to all Intents and Purposes, as Part of this Constitution, when ratified by the Legislatures of three fourths of the several State send_epoch=1779048917.412096
[13:15:30.181] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 78/140 from zerodev1 bytes=316 file=US_Constitution.txt data=s, or by Conventions in three fourths thereof, as the one or the other Mode of Ratification may be proposed by the Congress; Provided that no Amendment which may be made prior to the Year One thousand eight hundred and eight shall in any Manner affect the first and fourth Clauses in the Ninth Section of the first A send_epoch=1779048917.515126
[13:15:30.483] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 79/140 from zerodev1 bytes=316 file=US_Constitution.txt data=rticle; and that no State, without its Consent, shall be deprived of its equal Suffrage in the Senate.
Article VI
All Debts contracted and Engagements entered into, before the Adoption of this Constitution, shall be as valid against the United States under this Constitution, as under the Confederation.
This Const send_epoch=1779048917.618162
[13:15:30.719] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 80/140 from zerodev1 bytes=316 file=US_Constitution.txt data=itution, and the Laws of the United States which shall be made in Pursuance thereof; and all Treaties made, or which shall be made, under the Authority of the United States, shall be the supreme Law of the Land; and the Judges in every State shall be bound thereby, any Thing in the Constitution or Laws of any State send_epoch=1779048917.722070
[13:15:31.059] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 81/140 from zerodev1 bytes=316 file=US_Constitution.txt data= to the Contrary notwithstanding.
The Senators and Representatives before mentioned, and the Members of the several State Legislatures, and all executive and judicial Officers, both of the United States and of the several States, shall be bound by Oath or Affirmation, to support this Constitution; but no religious send_epoch=1779048917.825025
[13:15:31.352] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 82/140 from zerodev1 bytes=316 file=US_Constitution.txt data= Test shall ever be required as a Qualification to any Office or public Trust under the United States.
Article VII
The Ratification of the Conventions of nine States, shall be sufficient for the Establishment of this Constitution between the States so ratifying the Same.
First Amendment
Congress shall make no law send_epoch=1779048917.928040
[13:15:31.595] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 83/140 from zerodev1 bytes=316 file=US_Constitution.txt data= respecting an establishment of religion, or prohibiting the free exercise thereof; or abridging the freedom of speech, or of the press; or the right of the people peaceably to assemble, and to petition the Government for a redress of grievances.
Second Amendment
A well regulated Militia, being necessary to the se send_epoch=1779048918.031068
[13:15:31.838] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 84/140 from zerodev1 bytes=316 file=US_Constitution.txt data=curity of a free State, the right of the people to keep and bear Arms, shall not be infringed.
Third Amendment
No Soldier shall, in time of peace be quartered in any house, without the consent of the Owner, nor in time of war, but in a manner to be prescribed by law.
Fourth Amendment
The right of the people to be send_epoch=1779048918.134159
[13:15:32.130] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 85/140 from zerodev1 bytes=316 file=US_Constitution.txt data= secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no Warrants shall issue, but upon probable cause, supported by Oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.
Fifth Amendm send_epoch=1779048918.237629
[13:15:32.328] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 86/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ent
No person shall be held to answer for a capital, or otherwise infamous crime, unless on a presentment or indictment of a Grand Jury, except in cases arising in the land or naval forces, or in the Militia, when in actual service in time of War or public danger; nor shall any person be subject for the same offen send_epoch=1779048918.340225
[13:15:32.620] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 87/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ce to be twice put in jeopardy of life or limb; nor shall be compelled in any criminal case to be a witness against himself, nor be deprived of life, liberty, or property, without due process of law; nor shall private property be taken for public use, without just compensation.
Sixth Amendment
In all criminal pros send_epoch=1779048918.443247
[13:15:32.863] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 88/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ecutions, the accused shall enjoy the right to a speedy and public trial, by an impartial jury of the State and district wherein the crime shall have been committed, which district shall have been previously ascertained by law, and to be informed of the nature and cause of the accusation; to be confronted with the send_epoch=1779048918.546284
[13:15:33.204] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 89/140 from zerodev1 bytes=316 file=US_Constitution.txt data=witnesses against him; to have compulsory process for obtaining witnesses in his favor, and to have the Assistance of Counsel for his defence.
Seventh Amendment
In Suits at common law, where the value in controversy shall exceed twenty dollars, the right of trial by jury shall be preserved, and no fact tried by a send_epoch=1779048918.649240
[13:15:33.447] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 90/140 from zerodev1 bytes=316 file=US_Constitution.txt data=jury, shall be otherwise re-examined in any Court of the United States, than according to the rules of the common law.
Eighth Amendment
Excessive bail shall not be required, nor excessive fines imposed, nor cruel and unusual punishments inflicted.
Ninth Amendment
The enumeration in the Constitution, of certain ri send_epoch=1779048918.752190
[13:15:33.690] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 91/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ghts, shall not be construed to deny or disparage others retained by the people.
10th Amendment
The powers not delegated to the United States by the Constitution, nor prohibited by it to the States, are reserved to the States respectively, or to the people.
11th Amendment
The Judicial power of the United States s send_epoch=1779048918.855181
[13:15:33.982] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 92/140 from zerodev1 bytes=316 file=US_Constitution.txt data=hall not be construed to extend to any suit in law or equity, commenced or prosecuted against one of the United States by Citizens of another State, or by Citizens or Subjects of any Foreign State.
12th Amendment
The Electors shall meet in their respective states and vote by ballot for President and Vice-President send_epoch=1779048918.958268
[13:15:34.180] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 93/140 from zerodev1 bytes=316 file=US_Constitution.txt data=, one of whom, at least, shall not be an inhabitant of the same state with themselves; they shall name in their ballots the person voted for as President, and in distinct ballots the person voted for as Vice-President, and they shall make distinct lists of all persons voted for as President, and of all persons vote send_epoch=1779048919.061211
[13:15:34.521] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 94/140 from zerodev1 bytes=316 file=US_Constitution.txt data=d for as Vice-President, and of the number of votes for each, which lists they shall sign and certify, and transmit sealed to the seat of the government of the United States, directed to the President of the Senate; -- the President of the Senate shall, in the presence of the Senate and House of Representatives, op send_epoch=1779048919.164240
[13:15:34.764] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 95/140 from zerodev1 bytes=316 file=US_Constitution.txt data=en all the certificates and the votes shall then be counted; -- The person having the greatest number of votes for President, shall be the President, if such number be a majority of the whole number of Electors appointed; and if no person have such majority, then from the persons having the highest numbers not exce send_epoch=1779048919.267273
[13:15:35.056] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 96/140 from zerodev1 bytes=316 file=US_Constitution.txt data=eding three on the list of those voted for as President, the House of Representatives shall choose immediately, by ballot, the President. But in choosing the President, the votes shall be taken by states, the representation from each state having one vote; a quorum for this purpose shall consist of a member or memb send_epoch=1779048919.370338
[13:15:35.299] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 97/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ers from two-thirds of the states, and a majority of all the states shall be necessary to a choice. And if the House of Representatives shall not choose a President whenever the right of choice shall devolve upon them, before the fourth day of March next following, then the Vice-President shall act as President, as send_epoch=1779048919.473363
[13:15:35.604] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 98/140 from zerodev1 bytes=316 file=US_Constitution.txt data= in the case of the death or other constitutional disability of the President.-- The person having the greatest number of votes as Vice-President, shall be the Vice-President, if such number be a majority of the whole number of Electors appointed, and if no person have a majority, then from the two highest numbers send_epoch=1779048919.576307
[13:15:35.835] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 99/140 from zerodev1 bytes=316 file=US_Constitution.txt data=on the list, the Senate shall choose the Vice-President; a quorum for the purpose shall consist of two-thirds of the whole number of Senators, and a majority of the whole number shall be necessary to a choice. But no person constitutionally ineligible to the office of President shall be eligible to that of Vice-Pre send_epoch=1779048919.679323
[13:15:36.033] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 100/140 from zerodev1 bytes=316 file=US_Constitution.txt data=sident of the United States.
13th Amendment
Section 1
Neither slavery nor involuntary servitude, except as a punishment for crime whereof the party shall have been duly convicted, shall exist within the United States, or any place subject to their jurisdiction.
Section 2
Congress shall have power to enforce this send_epoch=1779048919.782368
[13:15:36.325] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 101/140 from zerodev1 bytes=316 file=US_Constitution.txt data=article by appropriate legislation.
14th Amendment
Section 1
All persons born or naturalized in the United States, and subject to the jurisdiction thereof, are citizens of the United States and of the State wherein they reside. No State shall make or enforce any law which shall abridge the privileges or immunities send_epoch=1779048919.885430
[13:15:36.618] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 102/140 from zerodev1 bytes=316 file=US_Constitution.txt data= of citizens of the United States; nor shall any State deprive any person of life, liberty, or property, without due process of law; nor deny to any person within its jurisdiction the equal protection of the laws.
Section 2
Representatives shall be apportioned among the several States according to their respective send_epoch=1779048919.988349
[13:15:36.909] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 103/140 from zerodev1 bytes=316 file=US_Constitution.txt data= numbers, counting the whole number of persons in each State, excluding Indians not taxed. But when the right to vote at any election for the choice of electors for President and Vice-President of the United States, Representatives in Congress, the Executive and Judicial officers of a State, or the members of the L send_epoch=1779048920.091384
[13:15:37.152] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 104/140 from zerodev1 bytes=316 file=US_Constitution.txt data=egislature thereof, is denied to any of the male inhabitants of such State, being twenty-one years of age, and citizens of the United States, or in any way abridged, except for participation in rebellion, or other crime, the basis of representation therein shall be reduced in the proportion which the number of such send_epoch=1779048920.194060
[13:15:37.445] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 105/140 from zerodev1 bytes=316 file=US_Constitution.txt data= male citizens shall bear to the whole number of male citizens twenty-one years of age in such State.
Section 3
No person shall be a Senator or Representative in Congress, or elector of President and Vice-President, or hold any office, civil or military, under the United States, or under any State, who, having pre send_epoch=1779048920.297137
[13:15:37.687] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 106/140 from zerodev1 bytes=316 file=US_Constitution.txt data=viously taken an oath, as a member of Congress, or as an officer of the United States, or as a member of any State legislature, or as an executive or judicial officer of any State, to support the Constitution of the United States, shall have engaged in insurrection or rebellion against the same, or given aid or com send_epoch=1779048920.400044
[13:15:38.029] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 107/140 from zerodev1 bytes=316 file=US_Constitution.txt data=fort to the enemies thereof. But Congress may by a vote of two-thirds of each House, remove such disability.
Section 4
The validity of the public debt of the United States, authorized by law, including debts incurred for payment of pensions and bounties for services in suppressing insurrection or rebellion, shall send_epoch=1779048920.503028
[13:15:38.227] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 108/140 from zerodev1 bytes=316 file=US_Constitution.txt data=not be questioned. But neither the United States nor any State shall assume or pay any debt or obligation incurred in aid of insurrection or rebellion against the United States, or any claim for the loss or emancipation of any slave; but all such debts, obligations and claims shall be held illegal and void.
Section send_epoch=1779048920.606081
[13:15:38.469] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 109/140 from zerodev1 bytes=316 file=US_Constitution.txt data= 5
The Congress shall have power to enforce, by appropriate legislation, the provisions of this article.
15th Amendment
Section 1
The right of citizens of the United States to vote shall not be denied or abridged by the United States or by any State on account of race, color, or previous condition of servitude.
S send_epoch=1779048920.708996
[13:15:38.762] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 110/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ection 2
The Congress shall have power to enforce this article by appropriate legislation.
16th Amendment
The Congress shall have power to lay and collect taxes on incomes, from whatever source derived, without apportionment among the several States, and without regard to any census or enumeration.
17th Amendment send_epoch=1779048920.812019
[13:15:39.005] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 111/140 from zerodev1 bytes=316 file=US_Constitution.txt data=
The Senate of the United States shall be composed of two Senators from each State, elected by the people thereof, for six years; and each Senator shall have one vote. The electors in each State shall have the qualifications requisite for electors of the most numerous branch of the State legislatures.
When vacanc send_epoch=1779048920.915019
[13:15:39.297] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 112/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ies happen in the representation of any State in the Senate, the executive authority of such State shall issue writs of election to fill such vacancies: Provided, That the legislature of any State may empower the executive thereof to make temporary appointments until the people fill the vacancies by election as the send_epoch=1779048921.018269
[13:15:39.589] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 113/140 from zerodev1 bytes=316 file=US_Constitution.txt data= legislature may direct.
This amendment shall not be so construed as to affect the election or term of any Senator chosen before it becomes valid as part of the Constitution.
18th Amendment
Section 1
After one year from the ratification of this article the manufacture, sale, or transportation of intoxicating liqu send_epoch=1779048921.121209
[13:15:39.930] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 114/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ors within, the importation thereof into, or the exportation thereof from the United States and all territory subject to the jurisdiction thereof for beverage purposes is hereby prohibited.
Section 2
The Congress and the several States shall have concurrent power to enforce this article by appropriate legislation. send_epoch=1779048921.224168
[13:15:40.128] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 115/140 from zerodev1 bytes=316 file=US_Constitution.txt data=
Section 3
This article shall be inoperative unless it shall have been ratified as an amendment to the Constitution by the legislatures of the several States, as provided in the Constitution, within seven years from the date of the submission hereof to the States by the Congress.
19th Amendment
The right of citiz send_epoch=1779048921.327217
[13:15:40.420] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 116/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ens of the United States to vote shall not be denied or abridged by the United States or by any State on account of sex.
Congress shall have power to enforce this article by appropriate legislation.
20th Amendment
Section 1
The terms of the President and the Vice President shall end at noon on the 20th day of Jan send_epoch=1779048921.430257
[13:15:40.665] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 117/140 from zerodev1 bytes=316 file=US_Constitution.txt data=uary, and the terms of Senators and Representatives at noon on the 3d day of January, of the years in which such terms would have ended if this article had not been ratified; and the terms of their successors shall then begin.
Section 2
The Congress shall assemble at least once in every year, and such meeting shal send_epoch=1779048921.533218
[13:15:40.908] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 118/140 from zerodev1 bytes=316 file=US_Constitution.txt data=l begin at noon on the 3d day of January, unless they shall by law appoint a different day.
Section 3
If, at the time fixed for the beginning of the term of the President, the President elect shall have died, the Vice President elect shall become President. If a President shall not have been chosen before the time send_epoch=1779048921.636170
[13:15:41.200] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 119/140 from zerodev1 bytes=316 file=US_Constitution.txt data= fixed for the beginning of his term, or if the President elect shall have failed to qualify, then the Vice President elect shall act as President until a President shall have qualified; and the Congress may by law provide for the case wherein neither a President elect nor a Vice President elect shall have qualifie send_epoch=1779048921.739188
[13:15:41.443] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 120/140 from zerodev1 bytes=316 file=US_Constitution.txt data=d, declaring who shall then act as President, or the manner in which one who is to act shall be selected, and such person shall act accordingly until a President or Vice President shall have qualified.
Section 4
The Congress may by law provide for the case of the death of any of the persons from whom the House of send_epoch=1779048921.842230
[13:15:41.735] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 121/140 from zerodev1 bytes=316 file=US_Constitution.txt data=Representatives may choose a President whenever the right of choice shall have devolved upon them, and for the case of the death of any of the persons from whom the Senate may choose a Vice President whenever the right of choice shall have devolved upon them.
Section 5
Sections 1 and 2 shall take effect on the 15t send_epoch=1779048921.946573
[13:15:41.986] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 122/140 from zerodev1 bytes=316 file=US_Constitution.txt data=h day of October following the ratification of this article.
Section 6
This article shall be inoperative unless it shall have been ratified as an amendment to the Constitution by the legislatures of three-fourths of the several States within seven years from the date of its submission.
21st Amendment
Section 1
Th send_epoch=1779048922.049580
[13:15:42.270] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 123/140 from zerodev1 bytes=316 file=US_Constitution.txt data=e eighteenth article of amendment to the Constitution of the United States is hereby repealed.
Section 2
The transportation or importation into any State, Territory, or possession of the United States for delivery or use therein of intoxicating liquors, in violation of the laws thereof, is hereby prohibited.
Secti send_epoch=1779048922.152518
[13:15:42.468] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 124/140 from zerodev1 bytes=316 file=US_Constitution.txt data=on 3
This article shall be inoperative unless it shall have been ratified as an amendment to the Constitution by conventions in the several States, as provided in the Constitution, within seven years from the date of the submission hereof to the States by the Congress.
22nd Amendment
Section 1
No person shall be send_epoch=1779048922.255545
[13:15:42.760] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 125/140 from zerodev1 bytes=316 file=US_Constitution.txt data=elected to the office of the President more than twice, and no person who has held the office of President, or acted as President, for more than two years of a term to which some other person was elected President shall be elected to the office of the President more than once. But this Article shall not apply to an send_epoch=1779048922.358575
[13:15:43.052] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 126/140 from zerodev1 bytes=316 file=US_Constitution.txt data=y person holding the office of President when this Article was proposed by the Congress, and shall not prevent any person who may be holding the office of President, or acting as President, during the term within which this Article becomes operative from holding the office of President or acting as President during send_epoch=1779048922.461610
[13:15:43.295] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 127/140 from zerodev1 bytes=316 file=US_Constitution.txt data= the remainder of such term.
Section 2
This article shall be inoperative unless it shall have been ratified as an amendment to the Constitution by the legislatures of three-fourths of the several States within seven years from the date of its submission to the States by the Congress.
23rd Amendment
Section 1
The send_epoch=1779048922.564536
[13:15:43.587] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 128/140 from zerodev1 bytes=316 file=US_Constitution.txt data=District constituting the seat of Government of the United States shall appoint in such manner as Congress may direct:
A number of electors of President and Vice President equal to the whole number of Senators and Representatives in Congress to which the District would be entitled if it were a State, but in no eve send_epoch=1779048922.667632
[13:15:43.830] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 129/140 from zerodev1 bytes=316 file=US_Constitution.txt data=nt more than the least populous State; they shall be in addition to those appointed by the States, but they shall be considered, for the purposes of the election of President and Vice President, to be electors appointed by a State; and they shall meet in the District and perform such duties as provided by the twelf send_epoch=1779048922.770848
[13:15:44.122] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 130/140 from zerodev1 bytes=316 file=US_Constitution.txt data=th article of amendment.
Section 2
The Congress shall have power to enforce this article by appropriate legislation.
24th Amendment
Section 1
The right of citizens of the United States to vote in any primary or other election for President or Vice President, for electors for President or Vice President, or for Se send_epoch=1779048922.873878
[13:15:44.320] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 131/140 from zerodev1 bytes=316 file=US_Constitution.txt data=nator or Representative in Congress, shall not be denied or abridged by the United States or any State by reason of failure to pay poll tax or other tax.
Section 2
The Congress shall have power to enforce this article by appropriate legislation.
25th Amendment
Section 1
In case of the removal of the President fro send_epoch=1779048922.976824
[13:15:44.613] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 132/140 from zerodev1 bytes=316 file=US_Constitution.txt data=m office or of his death or resignation, the Vice President shall become President.
Section 2
Whenever there is a vacancy in the office of the Vice President, the President shall nominate a Vice President who shall take office upon confirmation by a majority vote of both Houses of Congress.
Section 3
Whenever the send_epoch=1779048923.079942
[13:15:44.854] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 133/140 from zerodev1 bytes=316 file=US_Constitution.txt data= President transmits to the President pro tempore of the Senate and the Speaker of the House of Representatives his written declaration that he is unable to discharge the powers and duties of his office, and until he transmits to them a written declaration to the contrary, such powers and duties shall be discharged send_epoch=1779048923.182975
[13:15:45.051] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 134/140 from zerodev1 bytes=316 file=US_Constitution.txt data= by the Vice President as Acting President.
Section 4
Whenever the Vice President and a majority of either the principal officers of the executive departments or of such other body as Congress may by law provide, transmit to the President pro tempore of the Senate and the Speaker of the House of Representatives th send_epoch=1779048923.286105
[13:15:45.255] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 135/140 from zerodev1 bytes=316 file=US_Constitution.txt data=eir written declaration that the President is unable to discharge the powers and duties of his office, the Vice President shall immediately assume the powers and duties of the office as Acting President.
Thereafter, when the President transmits to the President pro tempore of the Senate and the Speaker of the send_epoch=1779048923.389038
[13:15:45.440] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 136/140 from zerodev1 bytes=316 file=US_Constitution.txt data= House of Representatives his written declaration that no inability exists, he shall resume the powers and duties of his office unless the Vice President and a majority of either the principal officers of the executive department or of such other body as Congress may by law provide, transmit within four days to the send_epoch=1779048923.491999
[13:15:45.634] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 137/140 from zerodev1 bytes=316 file=US_Constitution.txt data= President pro tempore of the Senate and the Speaker of the House of Representatives their written declaration that the President is unable to discharge the powers and duties of his office. Thereupon Congress shall decide the issue, assembling within forty-eight hours for that purpose if not in session. If the Cong send_epoch=1779048923.595000
[13:15:45.878] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 138/140 from zerodev1 bytes=316 file=US_Constitution.txt data=ress, within twenty-one days after receipt of the latter written declaration, or, if Congress is not in session, within twenty-one days after Congress is required to assemble, determines by two-thirds vote of both Houses that the President is unable to discharge the powers and duties of his office, the Vice Preside send_epoch=1779048923.703537
[13:15:46.027] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 139/140 from zerodev1 bytes=316 file=US_Constitution.txt data=nt shall continue to discharge the same as Acting President; otherwise, the President shall resume the powers and duties of his office.
26th Amendment
Section 1
The right of citizens of the United States, who are eighteen years of age or older, to vote shall not be denied or abridged by the United States or by any send_epoch=1779048923.806726
[13:15:46.269] RX link=<5f903eef7be6a15c489b541805fb6be0>: file_chunk 140/140 from zerodev1 bytes=301 file=US_Constitution.txt data= State on account of age.
Section 2
The Congress shall have power to enforce this article by appropriate legislation.
27th Amendment
No law, varying the compensation for the services of the Senators and Representatives, shall take effect, until an election of Representatives shall have intervened.
send_epoch=1779048923.909806
[13:15:49.034] Skipped announce because an active Reticulum link exists
[13:16:12.985] Link closed: <5f903eef7be6a15c489b541805fb6be0>
[13:16:19.064] Announced <e20458bdfdf39ea9c5481bf746543539> as zerodev2
.
Reference ID : C0A80167 (rpi5.salemdata.net)
Stratum : 2
Ref time (UTC) : Sun May 17 20:00:31 2026
System time : 0.000172438 seconds slow of NTP time
Last offset : -0.000068146 seconds
RMS offset : 0.000485469 seconds
Frequency : 1.427 ppm slow
Residual freq : -0.003 ppm
Skew : 0.332 ppm
Root delay : 0.002358504 seconds
Root dispersion : 0.004779477 seconds
Update interval : 1028.7 seconds
Leap status : Normal
.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current best, '+' = combined, '-' = not combined,
| / 'x' = may be in error, '~' = too variable, '?' = unusable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* rpi5.salemdata.net 1 10 377 954 -244us[ -312us] +/- 4426us
jlpoole@zerodev2:/usr/local/src/ble-reticulum $

View file

@ -0,0 +1,380 @@
jlpoole@zerodev1:/usr/local/src/ble-reticulum $ cd /usr/local/src/ble-reticulum
git pull
cd migration/protocol_core
python3 setup.py build_ext --inplace
cd ../..
/home/jlpoole/rnsenv/bin/python3 -m pytest migration/tests/test_identity_helpers_cpp_equivalence.py -q -rs
/home/jlpoole/rnsenv/bin/python3 -m pytest migration/tests/test_fragmentation_cpp_equivalence.py migration/tests/test_fragmentation_backend_shim.py -q
remote: Enumerating objects: 24, done.
remote: Counting objects: 100% (24/24), done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 17 (delta 8), reused 0 (delta 0), pack-reused 0 (from 0)
Unpacking objects: 100% (17/17), 6.84 KiB | 94.00 KiB/s, done.
From https://salemdata.net/repo/jlpoole/ble-reticulum
7f0b302..91037ea c++migration -> origin/c++migration
* [new tag] phase1-ble-protocol-core-20260517 -> phase1-ble-protocol-core-20260517
Updating 7f0b302..91037ea
Fast-forward
migration/Migration_Testing_Journal.md | 1 +
migration/preserved_runs/README.md | 2 +-
migration/reports/executive_summary_20260517_1325.txt | 266 +++++++++++++++++++++++++++
migration/reports/identities_20260517_report.md | 101 ++++++++++
migration/reports/phase1_freeze_20260517_1331.md | 63 +++++++
.../sql/mark_identity_helpers_field_accepted_20260517.sql | 53 ++++++
6 files changed, 485 insertions(+), 1 deletion(-)
create mode 100644 migration/reports/executive_summary_20260517_1325.txt
create mode 100644 migration/reports/identities_20260517_report.md
create mode 100644 migration/reports/phase1_freeze_20260517_1331.md
create mode 100644 migration/sql/mark_identity_helpers_field_accepted_20260517.sql
running build_ext
copying build/lib.linux-aarch64-cpython-313/ble_protocol_core_cpp.cpython-313-aarch64-linux-gnu.so ->
-bash: /home/jlpoole/rnsenv/bin/python3: No such file or directory
-bash: /home/jlpoole/rnsenv/bin/python3: No such file or directory
jlpoole@zerodev1:/usr/local/src/ble-reticulum $ python3 -m pytest migration/tests/test_identity_helpers_cpp_equivalence.py -q -rs
====================================== test session starts ======================================
platform linux -- Python 3.13.5, pytest-8.3.5, pluggy-1.5.0
rootdir: /usr/local/src/ble-reticulum
configfile: pytest.ini
plugins: typeguard-4.4.2, asyncio-0.25.1
asyncio: mode=Mode.AUTO, asyncio_default_fixture_loop_scope=function
collected 21 items
migration/tests/test_identity_helpers_cpp_equivalence.py ..s.................. [100%]
==================================== short test summary info ====================================
SKIPPED [1] migration/tests/test_identity_helpers_cpp_equivalence.py:64: BLEInterface importable; source fallback not used
================================= 20 passed, 1 skipped in 1.02s =================================
jlpoole@zerodev1:/usr/local/src/ble-reticulum $ python3 -m pytest migration/tests/test_fragmentation_cpp_equivalence.py migration/tests/test_fragmentation_backend_shim.py -q
====================================== test session starts ======================================
platform linux -- Python 3.13.5, pytest-8.3.5, pluggy-1.5.0
rootdir: /usr/local/src/ble-reticulum
configfile: pytest.ini
plugins: typeguard-4.4.2, asyncio-0.25.1
asyncio: mode=Mode.AUTO, asyncio_default_fixture_loop_scope=function
collected 36 items
migration/tests/test_fragmentation_cpp_equivalence.py ............................ [ 77%]
migration/tests/test_fragmentation_backend_shim.py ........ [100%]
====================================== 36 passed in 4.97s =======================================
jlpoole@zerodev1:/usr/local/src/ble-reticulum $ ls -l ~/.reticulum/interfaces
readlink -f ~/.reticulum/interfaces/BLEInterface.py
readlink -f ~/.reticulum/interfaces/BLEFragmentationBackend.py
bluetoothctl show
sudo btmgmt find
# Control-C to exit btmgmt if it launches
total 324
lrwxrwxrwx 1 jlpoole jlpoole 58 May 17 04:35 BLEAgent.py -> /usr/local/src/ble-reticulum/src/ble_reticulum/BLEAgent.py
-rw-rw-r-- 1 jlpoole jlpoole 9751 May 15 12:19 BLEAgent.py.saved
lrwxrwxrwx 1 jlpoole jlpoole 66 May 17 04:35 BLEFragmentation.py -> /usr/local/src/ble-reticulum/src/ble_reticulum/BLEFragmentation.py
-rw-rw-r-- 1 jlpoole jlpoole 20471 May 15 12:19 BLEFragmentation.py.saved
lrwxrwxrwx 1 jlpoole jlpoole 73 May 17 04:35 BLEFragmentationBackend.py -> /usr/local/src/ble-reticulum/src/ble_reticulum/BLEFragmentationBackend.py
lrwxrwxrwx 1 jlpoole jlpoole 63 May 17 04:35 BLEGATTServer.py -> /usr/local/src/ble-reticulum/src/ble_reticulum/BLEGATTServer.py
-rw-rw-r-- 1 jlpoole jlpoole 27092 May 15 12:19 BLEGATTServer.py.saved
lrwxrwxrwx 1 jlpoole jlpoole 62 May 17 04:35 BLEInterface.py -> /usr/local/src/ble-reticulum/src/ble_reticulum/BLEInterface.py
-rw-rw-r-- 1 jlpoole jlpoole 119128 May 15 12:19 BLEInterface.py.saved
-rw-rw-r-- 1 jlpoole jlpoole 0 May 15 12:19 __init__.py
drwxrwxr-x 2 jlpoole jlpoole 4096 May 15 16:35 __pycache__
lrwxrwxrwx 1 jlpoole jlpoole 66 May 17 04:35 bluetooth_driver.py -> /usr/local/src/ble-reticulum/src/ble_reticulum/bluetooth_driver.py
-rw-rw-r-- 1 jlpoole jlpoole 7340 May 15 12:19 bluetooth_driver.py.saved
lrwxrwxrwx 1 jlpoole jlpoole 72 May 17 04:35 linux_bluetooth_driver.py -> /usr/local/src/ble-reticulum/src/ble_reticulum/linux_bluetooth_driver.py
-rw-rw-r-- 1 jlpoole jlpoole 107783 May 15 12:19 linux_bluetooth_driver.py.saved
/usr/local/src/ble-reticulum/src/ble_reticulum/BLEInterface.py
/usr/local/src/ble-reticulum/src/ble_reticulum/BLEFragmentationBackend.py
Controller B8:27:EB:82:B2:4C (public)
Manufacturer: 0x000f (15)
Version: 0x08 (8)
Name: zerodev1
Alias: zerodev1
Class: 0x00000000 (0)
Powered: yes
PowerState: on
Discoverable: no
DiscoverableTimeout: 0x000000b4 (180)
Pairable: no
UUID: Broadcast Audio Scan (0000184f-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Volume Control (00001844-0000-1000-8000-00805f9b34fb)
UUID: Audio Input Control (00001843-0000-1000-8000-00805f9b34fb)
UUID: Microphone Control (0000184d-0000-1000-8000-00805f9b34fb)
UUID: Volume Offset Control (00001845-0000-1000-8000-00805f9b34fb)
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0552
Discovering: no
Roles: central
Roles: peripheral
Advertising Features:
ActiveInstances: 0x00 (0)
SupportedInstances: 0x05 (5)
SupportedIncludes: tx-power
SupportedIncludes: appearance
SupportedIncludes: local-name
SupportedCapabilities.MinTxPower: 0x0007 (7)
SupportedCapabilities.MaxTxPower: 0x0000 (0)
SupportedCapabilities.MaxAdvLen: 0x1f (31)
SupportedCapabilities.MaxScnRspLen: 0x1f (31)
Advertisement Monitor Features:
SupportedMonitorTypes: or_patterns
Unable to start discovery. status 0x0b (Rejected)
jlpoole@zerodev1:/usr/local/src/ble-reticulum $ date
git rev-parse HEAD
git status --short --branch
pgrep -af 'ble_dual_node_echo|python|rnsd|bleak|bluezero'
bluetoothctl show
journalctl -u bluetooth --since "30 minutes ago" --no-pager
sudo btmgmt find
Sun May 17 14:05:43 PDT 2026
91037ea77d05ec9e3e33ec72e5b0da85d5eb8a53
## c++migration...origin/c++migration
?? If.txt
?? If_full.txt
?? scripts/run_sync.sh
Controller B8:27:EB:82:B2:4C (public)
Manufacturer: 0x000f (15)
Version: 0x08 (8)
Name: zerodev1
Alias: zerodev1
Class: 0x00000000 (0)
Powered: yes
PowerState: on
Discoverable: no
DiscoverableTimeout: 0x000000b4 (180)
Pairable: no
UUID: Broadcast Audio Scan (0000184f-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Volume Control (00001844-0000-1000-8000-00805f9b34fb)
UUID: Audio Input Control (00001843-0000-1000-8000-00805f9b34fb)
UUID: Microphone Control (0000184d-0000-1000-8000-00805f9b34fb)
UUID: Volume Offset Control (00001845-0000-1000-8000-00805f9b34fb)
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0552
Discovering: no
Roles: central
Roles: peripheral
Advertising Features:
ActiveInstances: 0x00 (0)
SupportedInstances: 0x05 (5)
SupportedIncludes: tx-power
SupportedIncludes: appearance
SupportedIncludes: local-name
SupportedCapabilities.MinTxPower: 0x0007 (7)
SupportedCapabilities.MaxTxPower: 0x0000 (0)
SupportedCapabilities.MaxAdvLen: 0x1f (31)
SupportedCapabilities.MaxScnRspLen: 0x1f (31)
Advertisement Monitor Features:
SupportedMonitorTypes: or_patterns
May 17 13:58:12 zerodev1 bluetoothd[509]: Adv Monitor app :1.36 disconnected from D-Bus
May 17 14:05:43 zerodev1 bluetoothd[509]: Adv Monitor app :1.37 disconnected from D-Bus
Unable to start discovery. status 0x0b (Rejected)
jlpoole@zerodev1:/usr/local/src/ble-reticulum $ pgrep -af 'ble_dual_node_echo|python|rnsd|bleak|bluezero'
jlpoole@zerodev1:/usr/local/src/ble-reticulum $ date
sudo systemctl restart bluetooth
sleep 5
bluetoothctl show
sudo btmgmt find
Sun May 17 14:07:24 PDT 2026
Controller B8:27:EB:82:B2:4C (public)
Manufacturer: 0x000f (15)
Version: 0x08 (8)
Name: zerodev1
Alias: zerodev1
Class: 0x00000000 (0)
Powered: yes
PowerState: on
Discoverable: no
DiscoverableTimeout: 0x000000b4 (180)
Pairable: no
UUID: Broadcast Audio Scan (0000184f-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Volume Control (00001844-0000-1000-8000-00805f9b34fb)
UUID: Audio Input Control (00001843-0000-1000-8000-00805f9b34fb)
UUID: Microphone Control (0000184d-0000-1000-8000-00805f9b34fb)
UUID: Volume Offset Control (00001845-0000-1000-8000-00805f9b34fb)
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0552
Discovering: no
Roles: central
Roles: peripheral
Advertising Features:
ActiveInstances: 0x00 (0)
SupportedInstances: 0x05 (5)
SupportedIncludes: tx-power
SupportedIncludes: appearance
SupportedIncludes: local-name
SupportedCapabilities.MinTxPower: 0x0007 (7)
SupportedCapabilities.MaxTxPower: 0x0000 (0)
SupportedCapabilities.MaxAdvLen: 0x1f (31)
SupportedCapabilities.MaxScnRspLen: 0x1f (31)
Advertisement Monitor Features:
SupportedMonitorTypes: or_patterns
Unable to start discovery. status 0x0b (Rejected)
jlpoole@zerodev1:/usr/local/src/ble-reticulum $ sudo reboot
jlpoole@zerodev1:/usr/local/src/ble-reticulum $ Connection to zerodev1 closed by remote host.
Connection to zerodev1 closed.
jlpoole@jp /usr/local/src/ble-reticulum/examples $ ssh zerodev1
Linux zerodev1 6.12.75+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.12.75-1+rpt1 (2026-03-11) aarch64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun May 17 04:34:23 2026 from 192.168.1.2
jlpoole@zerodev1:~ $ date
pgrep -af 'ble_dual_node_echo|python|rnsd|bleak|bluezero'
bluetoothctl show
sudo btmgmt find
Sun May 17 14:10:15 PDT 2026
Controller B8:27:EB:82:B2:4C (public)
Manufacturer: 0x000f (15)
Version: 0x08 (8)
Name: zerodev1
Alias: zerodev1
Class: 0x00000000 (0)
Powered: yes
PowerState: on
Discoverable: no
DiscoverableTimeout: 0x000000b4 (180)
Pairable: no
UUID: Broadcast Audio Scan (0000184f-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Volume Control (00001844-0000-1000-8000-00805f9b34fb)
UUID: Audio Input Control (00001843-0000-1000-8000-00805f9b34fb)
UUID: Microphone Control (0000184d-0000-1000-8000-00805f9b34fb)
UUID: Volume Offset Control (00001845-0000-1000-8000-00805f9b34fb)
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0552
Discovering: no
Roles: central
Roles: peripheral
Advertising Features:
ActiveInstances: 0x00 (0)
SupportedInstances: 0x05 (5)
SupportedIncludes: tx-power
SupportedIncludes: appearance
SupportedIncludes: local-name
SupportedCapabilities.MinTxPower: 0x0007 (7)
SupportedCapabilities.MaxTxPower: 0x0000 (0)
SupportedCapabilities.MaxAdvLen: 0x1f (31)
SupportedCapabilities.MaxScnRspLen: 0x1f (31)
Advertisement Monitor Features:
SupportedMonitorTypes: or_patterns
Unable to start discovery. status 0x0b (Rejected)
jlpoole@zerodev1:~ $ date
pgrep -af 'ble_dual_node_echo|python|rnsd|bleak|bluezero'
bluetoothctl show
journalctl -u bluetooth --since "5 minutes ago" --no-pager
Sun May 17 14:11:27 PDT 2026
Controller B8:27:EB:82:B2:4C (public)
Manufacturer: 0x000f (15)
Version: 0x08 (8)
Name: zerodev1
Alias: zerodev1
Class: 0x00000000 (0)
Powered: yes
PowerState: on
Discoverable: no
DiscoverableTimeout: 0x000000b4 (180)
Pairable: no
UUID: Broadcast Audio Scan (0000184f-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Volume Control (00001844-0000-1000-8000-00805f9b34fb)
UUID: Audio Input Control (00001843-0000-1000-8000-00805f9b34fb)
UUID: Microphone Control (0000184d-0000-1000-8000-00805f9b34fb)
UUID: Volume Offset Control (00001845-0000-1000-8000-00805f9b34fb)
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0552
Discovering: no
Roles: central
Roles: peripheral
Advertising Features:
ActiveInstances: 0x00 (0)
SupportedInstances: 0x05 (5)
SupportedIncludes: tx-power
SupportedIncludes: appearance
SupportedIncludes: local-name
SupportedCapabilities.MinTxPower: 0x0007 (7)
SupportedCapabilities.MaxTxPower: 0x0000 (0)
SupportedCapabilities.MaxAdvLen: 0x1f (31)
SupportedCapabilities.MaxScnRspLen: 0x1f (31)
Advertisement Monitor Features:
SupportedMonitorTypes: or_patterns
May 17 14:10:16 zerodev1 bluetoothd[511]: Adv Monitor app :1.14 disconnected from D-Bus
May 17 14:11:27 zerodev1 bluetoothd[511]: Adv Monitor app :1.15 disconnected from D-Bus
jlpoole@zerodev1:~ $ /home/jlpoole/rnsenv/bin/python3 - <<'PY'
import asyncio
from bleak import BleakScanner
count = 0
def cb(device, advertisement_data):
global count
count += 1
print(device.address, device.name, advertisement_data.local_name)
async def main():
scanner = BleakScanner(cb)
await scanner.start()
await asyncio.sleep(10)
await scanner.stop()
print("callbacks:", count)
asyncio.run(main())
PY
-bash: /home/jlpoole/rnsenv/bin/python3: No such file or directory
jlpoole@zerodev1:~ $ python3 - <<'PY'
import asyncio
from bleak import BleakScanner
count = 0
def cb(device, advertisement_data):
global count
count += 1
print(device.address, device.name, advertisement_data.local_name)
async def main():
scanner = BleakScanner(cb)
await scanner.start()
await asyncio.sleep(10)
await scanner.stop()
print("callbacks:", count)
asyncio.run(main())
PY
callbacks: 0
jlpoole@zerodev1:~ $
jlpoole@zerodev1:~ $ date
Sun May 17 14:16:54 PDT 2026
jlpoole@zerodev1:~ $ python3 - <<'PY'
import asyncio
from bleak import BleakScanner
count = 0
def cb(device, advertisement_data):
global count
count += 1
print(device.address, device.name, advertisement_data.local_name, advertisement_data.service_uuids)
async def main():
scanner = BleakScanner(cb)
await scanner.start()
await asyncio.sleep(20)
await scanner.stop()
print("callbacks:", count)
asyncio.run(main())
PY
B8:27:EB:54:BF:0E zerodev2 zerodev2 ['37145b00-442d-4a94-917f-8f42c5da28e3']
callbacks: 1
jlpoole@zerodev1:~ $

View file

@ -0,0 +1,230 @@
jlpoole@zerodev2:/usr/local/src/ble-reticulum $ date
Sun May 17 01:59:06 PM PDT 2026
jlpoole@zerodev2:/usr/local/src/ble-reticulum $ python3 -m pytest migration/tests/test_identity_helpers_cpp_equivalence.py -q -rs
python3 -m pytest migration/tests/test_fragmentation_cpp_equivalence.py migration/tests/test_fragmentation_backend_shim.py -q
ls -l ~/.reticulum/interfaces
readlink -f ~/.reticulum/interfaces/BLEInterface.py
readlink -f ~/.reticulum/interfaces/BLEFragmentationBackend.py
bluetoothctl show
sudo btmgmt find
# Control-C to exit btmgmt if it launches
===================================== test session starts =====================================
platform linux -- Python 3.13.5, pytest-8.3.5, pluggy-1.5.0
rootdir: /usr/local/src/ble-reticulum
configfile: pytest.ini
plugins: typeguard-4.4.2, asyncio-0.25.1
asyncio: mode=Mode.AUTO, asyncio_default_fixture_loop_scope=function
collected 21 items
migration/tests/test_identity_helpers_cpp_equivalence.py ..s.................. [100%]
=================================== short test summary info ===================================
SKIPPED [1] migration/tests/test_identity_helpers_cpp_equivalence.py:64: BLEInterface importable; source fallback not used
================================ 20 passed, 1 skipped in 1.02s ================================
===================================== test session starts =====================================
platform linux -- Python 3.13.5, pytest-8.3.5, pluggy-1.5.0
rootdir: /usr/local/src/ble-reticulum
configfile: pytest.ini
plugins: typeguard-4.4.2, asyncio-0.25.1
asyncio: mode=Mode.AUTO, asyncio_default_fixture_loop_scope=function
collected 36 items
migration/tests/test_fragmentation_cpp_equivalence.py ............................ [ 77%]
migration/tests/test_fragmentation_backend_shim.py ........ [100%]
===================================== 36 passed in 4.94s ======================================
total 324
lrwxrwxrwx 1 jlpoole jlpoole 58 May 17 04:35 BLEAgent.py -> /usr/local/src/ble-reticulum/src/ble_reticulum/BLEAgent.py
-rw-rw-r-- 1 jlpoole jlpoole 9751 May 15 12:19 BLEAgent.py.saved
lrwxrwxrwx 1 jlpoole jlpoole 73 May 17 04:35 BLEFragmentationBackend.py -> /usr/local/src/ble-reticulum/src/ble_reticulum/BLEFragmentationBackend.py
lrwxrwxrwx 1 jlpoole jlpoole 66 May 17 04:35 BLEFragmentation.py -> /usr/local/src/ble-reticulum/src/ble_reticulum/BLEFragmentation.py
-rw-rw-r-- 1 jlpoole jlpoole 20471 May 15 12:19 BLEFragmentation.py.saved
lrwxrwxrwx 1 jlpoole jlpoole 63 May 17 04:35 BLEGATTServer.py -> /usr/local/src/ble-reticulum/src/ble_reticulum/BLEGATTServer.py
-rw-rw-r-- 1 jlpoole jlpoole 27092 May 15 12:19 BLEGATTServer.py.saved
lrwxrwxrwx 1 jlpoole jlpoole 62 May 17 04:35 BLEInterface.py -> /usr/local/src/ble-reticulum/src/ble_reticulum/BLEInterface.py
-rw-rw-r-- 1 jlpoole jlpoole 119128 May 15 12:19 BLEInterface.py.saved
lrwxrwxrwx 1 jlpoole jlpoole 66 May 17 04:35 bluetooth_driver.py -> /usr/local/src/ble-reticulum/src/ble_reticulum/bluetooth_driver.py
-rw-rw-r-- 1 jlpoole jlpoole 7340 May 15 12:19 bluetooth_driver.py.saved
-rw-rw-r-- 1 jlpoole jlpoole 0 May 15 12:19 __init__.py
lrwxrwxrwx 1 jlpoole jlpoole 72 May 17 04:35 linux_bluetooth_driver.py -> /usr/local/src/ble-reticulum/src/ble_reticulum/linux_bluetooth_driver.py
-rw-rw-r-- 1 jlpoole jlpoole 107783 May 15 12:19 linux_bluetooth_driver.py.saved
drwxrwxr-x 2 jlpoole jlpoole 4096 May 15 16:13 __pycache__
/usr/local/src/ble-reticulum/src/ble_reticulum/BLEInterface.py
/usr/local/src/ble-reticulum/src/ble_reticulum/BLEFragmentationBackend.py
Controller B8:27:EB:54:BF:0E (public)
Manufacturer: 0x000f (15)
Version: 0x08 (8)
Name: zerodev2
Alias: zerodev2
Class: 0x00000000 (0)
Powered: yes
PowerState: on
Discoverable: no
DiscoverableTimeout: 0x000000b4 (180)
Pairable: no
UUID: Broadcast Audio Scan (0000184f-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Volume Control (00001844-0000-1000-8000-00805f9b34fb)
UUID: Audio Input Control (00001843-0000-1000-8000-00805f9b34fb)
UUID: Microphone Control (0000184d-0000-1000-8000-00805f9b34fb)
UUID: Volume Offset Control (00001845-0000-1000-8000-00805f9b34fb)
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0552
Discovering: no
Roles: central
Roles: peripheral
Advertising Features:
ActiveInstances: 0x00 (0)
SupportedInstances: 0x05 (5)
SupportedIncludes: tx-power
SupportedIncludes: appearance
SupportedIncludes: local-name
SupportedCapabilities.MinTxPower: 0x0007 (7)
SupportedCapabilities.MaxTxPower: 0x0000 (0)
SupportedCapabilities.MaxAdvLen: 0x1f (31)
SupportedCapabilities.MaxScnRspLen: 0x1f (31)
Advertisement Monitor Features:
SupportedMonitorTypes: or_patterns
Unable to start discovery. status 0x0b (Rejected)
jlpoole@zerodev2:/usr/local/src/ble-reticulum $ ^C
jlpoole@zerodev2:/usr/local/src/ble-reticulum $ date
git rev-parse HEAD
git status --short --branch
pgrep -af 'ble_dual_node_echo|python|rnsd|bleak|bluezero'
bluetoothctl show
journalctl -u bluetooth --since "30 minutes ago" --no-pager
sudo btmgmt find
Sun May 17 02:05:48 PM PDT 2026
7f0b302d00462316e39040abb852e2ab584f301f
## c++migration...origin/c++migration
Controller B8:27:EB:54:BF:0E (public)
Manufacturer: 0x000f (15)
Version: 0x08 (8)
Name: zerodev2
Alias: zerodev2
Class: 0x00000000 (0)
Powered: yes
PowerState: on
Discoverable: no
DiscoverableTimeout: 0x000000b4 (180)
Pairable: no
UUID: Broadcast Audio Scan (0000184f-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Volume Control (00001844-0000-1000-8000-00805f9b34fb)
UUID: Audio Input Control (00001843-0000-1000-8000-00805f9b34fb)
UUID: Microphone Control (0000184d-0000-1000-8000-00805f9b34fb)
UUID: Volume Offset Control (00001845-0000-1000-8000-00805f9b34fb)
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0552
Discovering: no
Roles: central
Roles: peripheral
Advertising Features:
ActiveInstances: 0x00 (0)
SupportedInstances: 0x05 (5)
SupportedIncludes: tx-power
SupportedIncludes: appearance
SupportedIncludes: local-name
SupportedCapabilities.MinTxPower: 0x0007 (7)
SupportedCapabilities.MaxTxPower: 0x0000 (0)
SupportedCapabilities.MaxAdvLen: 0x1f (31)
SupportedCapabilities.MaxScnRspLen: 0x1f (31)
Advertisement Monitor Features:
SupportedMonitorTypes: or_patterns
May 17 13:59:18 zerodev2 bluetoothd[513]: Adv Monitor app :1.46 disconnected from D-Bus
May 17 14:05:48 zerodev2 bluetoothd[513]: Adv Monitor app :1.47 disconnected from D-Bus
Unable to start discovery. status 0x0b (Rejected)
jlpoole@zerodev2:/usr/local/src/ble-reticulum $ pgrep -af 'ble_dual_node_echo|python|rnsd|bleak|bluezero'
jlpoole@zerodev2:/usr/local/src/ble-reticulum $ date
sudo systemctl restart bluetooth
sleep 5
bluetoothctl show
sudo btmgmt find
Sun May 17 02:07:40 PM PDT 2026
Controller B8:27:EB:54:BF:0E (public)
Manufacturer: 0x000f (15)
Version: 0x08 (8)
Name: zerodev2
Alias: zerodev2
Class: 0x00000000 (0)
Powered: yes
PowerState: on
Discoverable: no
DiscoverableTimeout: 0x000000b4 (180)
Pairable: no
UUID: Broadcast Audio Scan (0000184f-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Volume Control (00001844-0000-1000-8000-00805f9b34fb)
UUID: Audio Input Control (00001843-0000-1000-8000-00805f9b34fb)
UUID: Microphone Control (0000184d-0000-1000-8000-00805f9b34fb)
UUID: Volume Offset Control (00001845-0000-1000-8000-00805f9b34fb)
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0552
Discovering: no
Roles: central
Roles: peripheral
Advertising Features:
ActiveInstances: 0x00 (0)
SupportedInstances: 0x05 (5)
SupportedIncludes: tx-power
SupportedIncludes: appearance
SupportedIncludes: local-name
SupportedCapabilities.MinTxPower: 0x0007 (7)
SupportedCapabilities.MaxTxPower: 0x0000 (0)
SupportedCapabilities.MaxAdvLen: 0x1f (31)
SupportedCapabilities.MaxScnRspLen: 0x1f (31)
Advertisement Monitor Features:
SupportedMonitorTypes: or_patterns
Unable to start discovery. status 0x0b (Rejected)
jlpoole@zerodev2:/usr/local/src/ble-reticulum $ ls migration/scripts/
import_codex_review.pl
jlpoole@zerodev2:/usr/local/src/ble-reticulum $ ls scripts
analyze_reticulum_file_transfer_20260516_1130.pl
analyze_reticulum_latency.pl
compare_time_fast.sh
compare_time.sh
reticulum_file_transfer_analysis_20260516_1130.txt
jlpoole@zerodev2:/usr/local/src/ble-reticulum $ ls migration/test
ls: cannot access 'migration/test': No such file or directory
jlpoole@zerodev2:/usr/local/src/ble-reticulum $ ls migration/tests
__pycache__ test_fragmentation_cpp_equivalence.py
test_fragmentation_backend_shim.py test_identity_helpers_cpp_equivalence.py
jlpoole@zerodev2:/usr/local/src/ble-reticulum $
jlpoole@zerodev2:/usr/local/src/ble-reticulum $ date
Sun May 17 02:16:39 PM PDT 2026
jlpoole@zerodev2:/usr/local/src/ble-reticulum $ cd /usr/local/src/ble-reticulum
PYTHONPATH=/usr/local/src/ble-reticulum/migration/protocol_core \
BLE_RETICULUM_FRAGMENTATION_BACKEND=cpp \
BLE_RETICULUM_FRAGMENTATION_BACKEND_REPORT=1 \
python3 examples/ble_dual_node_echo.py \
--ble-role both \
--announce-only-when-disconnected
[14:16:42.543] Starting node zerodev2
[14:16:42.543] Reticulum config: ~/.reticulum
[14:16:42.544] Runtime config: /tmp/ble_reticulum_poc_zerodev2_brqodl56
BLEInterface[BLE Interface] fragmentation backend: cpp (fragmenter=ble_protocol_core_cpp.BLEFragmenter, reassembler=ble_protocol_core_cpp.BLEReassembler)
[14:16:45.513] Loaded identity: /home/jlpoole/.reticulum/ble_reticulum_poc_zerodev2.identity
[14:16:45.514] Destination hash: <e20458bdfdf39ea9c5481bf746543539>
[14:16:45.514] Use this hash as --peer on the other node.
[14:16:45.518] Announced <e20458bdfdf39ea9c5481bf746543539> as zerodev2
Advertisement registered
[2026-05-17 14:16:53] [Critical] BLEInterface[BLE Interface] driver critical: Scanner callback failure detected (0 callbacks for 3 consecutive scans). Bluetooth stack requires reboot. - Exception: BleakScanner callbacks not invoked
[2026-05-17 14:16:56] [Critical] BLEInterface[BLE Interface] driver critical: Scanner callback failure detected (0 callbacks for 4 consecutive scans). Bluetooth stack requires reboot. - Exception: BleakScanner callbacks not invoked
[2026-05-17 14:16:59] [Critical] BLEInterface[BLE Interface] driver critical: Scanner callback failure detected (0 callbacks for 5 consecutive scans). Bluetooth stack requires reboot. - Exception: BleakScanner callbacks not invoked
[2026-05-17 14:17:02] [Critical] BLEInterface[BLE Interface] driver critical: Scanner callback failure detected (0 callbacks for 6 consecutive scans). Bluetooth stack requires reboot. - Exception: BleakScanner callbacks not invoked
[2026-05-17 14:17:05] [Critical] BLEInterface[BLE Interface] driver critical: Scanner callback failure detected (0 callbacks for 7 consecutive scans). Bluetooth stack requires reboot. - Exception: BleakScanner callbacks not invoked
[2026-05-17 14:17:08] [Critical] BLEInterface[BLE Interface] driver critical: Scanner callback failure detected (0 callbacks for 8 consecutive scans). Bluetooth stack requires reboot. - Exception: BleakScanner callbacks not invoked
[2026-05-17 14:17:11] [Critical] BLEInterface[BLE Interface] driver critical: Scanner callback failure detected (0 callbacks for 9 consecutive scans). Bluetooth stack requires reboot. - Exception: BleakScanner callbacks not invoked
[2026-05-17 14:17:14] [Critical] BLEInterface[BLE Interface] driver critical: Scanner callback failure detected (0 callbacks for 10 consecutive scans). Bluetooth stack requires reboot. - Exception: BleakScanner callbacks not invoked
[14:17:15.524] Announced <e20458bdfdf39ea9c5481bf746543539> as zerodev2
[2026-05-17 14:17:17] [Critical] BLEInterface[BLE Interface] driver critical: Scanner callback failure detected (0 callbacks for 11 consecutive scans). Bluetooth stack requires reboot. - Exception: BleakScanner callbacks not invoked
[2026-05-17 14:17:20] [Critical] BLEInterface[BLE Interface] driver critical: Scanner callback failure detected (0 callbacks for 12 consecutive scans). Bluetooth stack requires reboot. - Exception: BleakScanner callbacks not invoked
[2026-05-17 14:17:23] [Critical] BLEInterface[BLE Interface] driver critical: Scanner callback failure detected (0 callbacks for 13 consecutive scans). Bluetooth stack requires reboot. - Exception: BleakScanner callbacks not invoked
^Cjlpoole@zerodev2:/usr/local/src/ble-reticulum $

View file

@ -0,0 +1,349 @@
#include "BLEPeerSessionManager.h"
#include <algorithm>
#include <stdexcept>
namespace ble_reticulum {
namespace {
constexpr uint16_t BLE_MINIMUM_MTU = 23;
SessionAction make_action(SessionActionType type, const ConnectionId& target) {
SessionAction action;
action.type = type;
action.target = target;
return action;
}
SessionAction make_message_action(SessionActionType type,
const ConnectionId& target,
const std::string& message) {
SessionAction action = make_action(type, target);
action.message = message;
return action;
}
} // namespace
BLEPeerSessionManager::BLEPeerSessionManager(double pending_identity_timeout,
double zombie_timeout)
: pending_identity_timeout_(pending_identity_timeout),
zombie_timeout_(zombie_timeout) {}
bool BLEPeerSessionManager::isIdentityHandshakePayload(const uint8_t* data,
size_t data_size) {
return data != nullptr && data_size == 16;
}
PeerIdentity BLEPeerSessionManager::identityFromPayload(const uint8_t* data,
size_t data_size) {
if (!isIdentityHandshakePayload(data, data_size)) {
throw std::invalid_argument("identity payload must be exactly 16 bytes");
}
PeerIdentity identity{};
std::copy(data, data + identity.size(), identity.begin());
return identity;
}
std::string BLEPeerSessionManager::computeIdentityKey(const PeerIdentity& identity) {
static constexpr char hex[] = "0123456789abcdef";
std::string out;
out.reserve(16);
for (size_t i = 0; i < 8; ++i) {
const uint8_t byte = identity[i];
out.push_back(hex[(byte >> 4) & 0x0f]);
out.push_back(hex[byte & 0x0f]);
}
return out;
}
std::string BLEPeerSessionManager::computeFragmenterKey(const PeerIdentity& identity) {
static constexpr char hex[] = "0123456789abcdef";
std::string out;
out.reserve(32);
for (uint8_t byte : identity) {
out.push_back(hex[(byte >> 4) & 0x0f]);
out.push_back(hex[byte & 0x0f]);
}
return out;
}
HandshakeResult BLEPeerSessionManager::handleIdentityHandshake(
const ConnectionSnapshot& connection,
const uint8_t* data,
size_t data_size,
double now_seconds) {
HandshakeResult result;
result.mtu = connection.negotiated_mtu.value_or(BLE_MINIMUM_MTU);
if (!isIdentityHandshakePayload(data, data_size)) {
result.decision = InputDecision::PassToReassembler;
result.consumed = false;
result.actions.push_back(make_action(SessionActionType::PassToReassembler,
connection.current));
return result;
}
PeerIdentity payload_identity = identityFromPayload(data, data_size);
result.peer_identity = payload_identity;
result.identity_key = computeIdentityKey(payload_identity);
result.fragmenter_key = computeFragmenterKey(payload_identity);
result.consumed = true;
if (connection.known_identity_for_address.has_value()) {
if (connection.known_identity_for_address.value() == payload_identity) {
result.decision = InputDecision::ConsumedDuplicateSameIdentity;
result.actions.push_back(make_action(SessionActionType::ConsumeInput,
connection.current));
return result;
}
result.decision = InputDecision::ConsumedDuplicateMismatchedIdentity;
result.actions.push_back(make_message_action(
SessionActionType::Warn,
connection.current,
"16-byte data differs from known identity; consumed as identity-like data"));
result.actions.push_back(make_action(SessionActionType::ConsumeInput,
connection.current));
return result;
}
const PeerSession* existing_session = findSessionByIdentityKey(result.identity_key);
std::optional<std::string> existing_address = connection.existing_address_for_identity;
if (!existing_address.has_value() && existing_session &&
!existing_session->current_address.empty()) {
existing_address = existing_session->current_address;
}
const bool duplicate_elsewhere =
existing_address.has_value() && existing_address.value() != connection.current.address;
if (duplicate_elsewhere) {
const bool stale_or_pending =
connection.identity_has_pending_detach ||
(!connection.existing_address_connected &&
!connection.existing_address_in_peer_table);
if (connection.existing_connection_is_zombie || stale_or_pending) {
SessionAction cleanup = make_action(SessionActionType::CleanupOldAddress,
connection.current);
cleanup.old_address = existing_address.value();
cleanup.new_address = connection.current.address;
result.actions.push_back(cleanup);
if (connection.existing_connection_is_zombie) {
result.should_disconnect_old = true;
SessionAction disconnect_old =
make_action(SessionActionType::DisconnectOldPeer, connection.current);
disconnect_old.old_address = existing_address.value();
result.actions.push_back(disconnect_old);
}
SessionAction update = make_action(SessionActionType::UpdatePeerAddress,
connection.current);
update.old_address = existing_address.value();
update.new_address = connection.current.address;
result.actions.push_back(update);
} else {
result.decision = InputDecision::RejectedDuplicateIdentity;
result.should_disconnect_current = true;
result.actions.push_back(make_action(SessionActionType::RejectDuplicateIdentity,
connection.current));
result.actions.push_back(make_action(SessionActionType::DisconnectCurrentPeer,
connection.current));
return result;
}
}
upsertAcceptedSession(connection, payload_identity, result.mtu, now_seconds);
removePendingIdentity(connection.current);
result.decision = InputDecision::AcceptedNewIdentity;
result.accepted = true;
result.actions.push_back(make_action(SessionActionType::AcceptNewIdentity,
connection.current));
result.actions.push_back(make_action(SessionActionType::CreateFragmentationState,
connection.current));
result.actions.push_back(make_action(SessionActionType::MarkPeerReady,
connection.current));
result.actions.push_back(make_action(SessionActionType::RemovePendingIdentity,
connection.current));
result.actions.push_back(make_action(SessionActionType::MarkRealData,
connection.current));
return result;
}
void BLEPeerSessionManager::markConnected(const ConnectionSnapshot& connection,
double now_seconds) {
if (connection.known_identity_for_address.has_value()) {
upsertAcceptedSession(connection,
connection.known_identity_for_address.value(),
connection.negotiated_mtu.value_or(BLE_MINIMUM_MTU),
now_seconds);
} else {
markPendingIdentity(connection.current, now_seconds);
}
}
void BLEPeerSessionManager::markDisconnected(const ConnectionId& connection,
double /*now_seconds*/) {
sessions_.erase(std::remove_if(sessions_.begin(), sessions_.end(),
[&](const PeerSession& session) {
return session.current_address == connection.address ||
session.current_handle == connection.handle;
}),
sessions_.end());
removePendingIdentity(connection);
}
void BLEPeerSessionManager::markMtu(const ConnectionId& connection, uint16_t mtu) {
PeerSession* session = findSessionByAddress(connection.address);
if (session) {
session->mtu = mtu;
}
}
void BLEPeerSessionManager::markPendingIdentity(const ConnectionId& connection,
double now_seconds) {
for (PendingIdentity& pending : pending_identities_) {
if (pending.connection.address == connection.address) {
pending.connection = connection;
pending.started_at = now_seconds;
return;
}
}
PendingIdentity pending;
pending.connection = connection;
pending.started_at = now_seconds;
pending_identities_.push_back(pending);
}
void BLEPeerSessionManager::removePendingIdentity(const ConnectionId& connection) {
pending_identities_.erase(
std::remove_if(pending_identities_.begin(), pending_identities_.end(),
[&](const PendingIdentity& pending) {
return pending.connection.address == connection.address;
}),
pending_identities_.end());
}
std::vector<ConnectionId> BLEPeerSessionManager::expiredPendingIdentities(
double now_seconds) const {
std::vector<ConnectionId> expired;
for (const PendingIdentity& pending : pending_identities_) {
if (now_seconds - pending.started_at > pending_identity_timeout_) {
expired.push_back(pending.connection);
}
}
return expired;
}
std::optional<PeerSessionView> BLEPeerSessionManager::sessionByAddress(
const std::string& address) const {
const PeerSession* session = findSessionByAddress(address);
if (!session) {
return std::nullopt;
}
PeerSessionView view;
view.identity = session->identity;
view.identity_key = session->identity_key;
view.current_address = session->current_address;
view.current_handle = session->current_handle;
view.mtu = session->mtu;
view.has_fragmentation_state = session->has_fragmentation_state;
view.peer_ready = session->peer_ready;
view.pending_identity_since = session->pending_identity_since;
view.last_real_data = session->last_real_data;
return view;
}
std::optional<PeerSessionView> BLEPeerSessionManager::sessionByIdentity(
const PeerIdentity& identity) const {
const PeerSession* session = findSessionByIdentityKey(computeIdentityKey(identity));
if (!session) {
return std::nullopt;
}
PeerSessionView view;
view.identity = session->identity;
view.identity_key = session->identity_key;
view.current_address = session->current_address;
view.current_handle = session->current_handle;
view.mtu = session->mtu;
view.has_fragmentation_state = session->has_fragmentation_state;
view.peer_ready = session->peer_ready;
view.pending_identity_since = session->pending_identity_since;
view.last_real_data = session->last_real_data;
return view;
}
BLEPeerSessionManager::PeerSession* BLEPeerSessionManager::findSessionByIdentityKey(
const std::string& identity_key) {
for (PeerSession& session : sessions_) {
if (session.identity_key == identity_key) {
return &session;
}
}
return nullptr;
}
const BLEPeerSessionManager::PeerSession* BLEPeerSessionManager::findSessionByIdentityKey(
const std::string& identity_key) const {
for (const PeerSession& session : sessions_) {
if (session.identity_key == identity_key) {
return &session;
}
}
return nullptr;
}
BLEPeerSessionManager::PeerSession* BLEPeerSessionManager::findSessionByAddress(
const std::string& address) {
for (PeerSession& session : sessions_) {
if (session.current_address == address) {
return &session;
}
}
return nullptr;
}
const BLEPeerSessionManager::PeerSession* BLEPeerSessionManager::findSessionByAddress(
const std::string& address) const {
for (const PeerSession& session : sessions_) {
if (session.current_address == address) {
return &session;
}
}
return nullptr;
}
void BLEPeerSessionManager::upsertAcceptedSession(
const ConnectionSnapshot& connection,
const PeerIdentity& identity,
uint16_t mtu,
double now_seconds) {
const std::string identity_key = computeIdentityKey(identity);
PeerSession* session = findSessionByIdentityKey(identity_key);
if (!session) {
PeerSession new_session;
new_session.identity = identity;
new_session.identity_key = identity_key;
sessions_.push_back(new_session);
session = &sessions_.back();
}
session->identity = identity;
session->identity_key = identity_key;
session->current_address = connection.current.address;
session->current_handle = connection.current.handle;
session->mtu = mtu;
session->has_fragmentation_state = true;
session->peer_ready = true;
session->pending_identity_since = 0.0;
session->last_real_data = now_seconds;
}
} // namespace ble_reticulum

View file

@ -0,0 +1,163 @@
#pragma once
#include <array>
#include <cstddef>
#include <cstdint>
#include <optional>
#include <string>
#include <vector>
namespace ble_reticulum {
using PeerIdentity = std::array<uint8_t, 16>;
enum class LocalRole : uint8_t {
Unknown,
Central,
Peripheral,
};
enum class InputDecision : uint8_t {
PassToReassembler,
ConsumedDuplicateSameIdentity,
ConsumedDuplicateMismatchedIdentity,
AcceptedNewIdentity,
RejectedDuplicateIdentity,
ErrorConsumed,
};
enum class SessionActionType : uint8_t {
ConsumeInput,
PassToReassembler,
AcceptNewIdentity,
RejectDuplicateIdentity,
DisconnectCurrentPeer,
DisconnectOldPeer,
CreateFragmentationState,
MarkPeerReady,
UpdatePeerAddress,
RemovePendingIdentity,
MarkRealData,
CleanupOldAddress,
Warn,
};
struct ConnectionId {
std::string address;
uint16_t handle = 0xffff;
bool operator==(const ConnectionId& other) const {
return address == other.address && handle == other.handle;
}
};
struct ConnectionSnapshot {
ConnectionId current;
LocalRole local_role = LocalRole::Unknown;
std::optional<PeerIdentity> known_identity_for_address;
std::optional<uint16_t> negotiated_mtu;
std::optional<std::string> existing_address_for_identity;
bool identity_has_pending_detach = false;
bool existing_address_connected = false;
bool existing_address_in_peer_table = false;
bool existing_connection_is_zombie = false;
double existing_last_real_data = 0.0;
};
struct SessionAction {
SessionActionType type = SessionActionType::ConsumeInput;
ConnectionId target;
std::string old_address;
std::string new_address;
std::string message;
};
struct HandshakeResult {
InputDecision decision = InputDecision::PassToReassembler;
std::vector<SessionAction> actions;
bool consumed = false;
bool accepted = false;
bool should_disconnect_current = false;
bool should_disconnect_old = false;
std::optional<PeerIdentity> peer_identity;
std::string identity_key;
std::string fragmenter_key;
uint16_t mtu = 23;
};
struct PeerSessionView {
PeerIdentity identity{};
std::string identity_key;
std::string current_address;
uint16_t current_handle = 0xffff;
uint16_t mtu = 23;
bool has_fragmentation_state = false;
bool peer_ready = false;
double pending_identity_since = 0.0;
double last_real_data = 0.0;
};
class BLEPeerSessionManager {
public:
explicit BLEPeerSessionManager(double pending_identity_timeout = 30.0,
double zombie_timeout = 45.0);
HandshakeResult handleIdentityHandshake(const ConnectionSnapshot& connection,
const uint8_t* data,
size_t data_size,
double now_seconds);
void markConnected(const ConnectionSnapshot& connection, double now_seconds);
void markDisconnected(const ConnectionId& connection, double now_seconds);
void markMtu(const ConnectionId& connection, uint16_t mtu);
void markPendingIdentity(const ConnectionId& connection, double now_seconds);
void removePendingIdentity(const ConnectionId& connection);
std::vector<ConnectionId> expiredPendingIdentities(double now_seconds) const;
std::optional<PeerSessionView> sessionByAddress(const std::string& address) const;
std::optional<PeerSessionView> sessionByIdentity(const PeerIdentity& identity) const;
static bool isIdentityHandshakePayload(const uint8_t* data, size_t data_size);
static PeerIdentity identityFromPayload(const uint8_t* data, size_t data_size);
static std::string computeIdentityKey(const PeerIdentity& identity);
static std::string computeFragmenterKey(const PeerIdentity& identity);
private:
double pending_identity_timeout_;
double zombie_timeout_;
struct PendingIdentity {
ConnectionId connection;
double started_at = 0.0;
};
struct PeerSession {
PeerIdentity identity{};
std::string identity_key;
std::string current_address;
uint16_t current_handle = 0xffff;
uint16_t mtu = 23;
bool has_fragmentation_state = false;
bool peer_ready = false;
double pending_identity_since = 0.0;
double last_real_data = 0.0;
};
std::vector<PeerSession> sessions_;
std::vector<PendingIdentity> pending_identities_;
PeerSession* findSessionByIdentityKey(const std::string& identity_key);
const PeerSession* findSessionByIdentityKey(const std::string& identity_key) const;
PeerSession* findSessionByAddress(const std::string& address);
const PeerSession* findSessionByAddress(const std::string& address) const;
void upsertAcceptedSession(const ConnectionSnapshot& connection,
const PeerIdentity& identity,
uint16_t mtu,
double now_seconds);
};
} // namespace ble_reticulum

View file

@ -0,0 +1,651 @@
**Phase 2 Investigation Report**
Target: [BLEInterface.py](/usr/local/src/ble-reticulum/src/ble_reticulum/BLEInterface.py:1202) `_handle_identity_handshake`
No files were modified.
**Source Excerpt**
```python
1202 def _handle_identity_handshake(self, address: str, data: bytes) -> bool:
1217 # Identity handshake detection: exactly 16 bytes
1218 if len(data) != 16:
1219 return False
1222 peer_identity = self.address_to_identity.get(address)
1223 if peer_identity:
1227 if data == peer_identity:
1228 RNS.log(...)
1229 return True
1233 RNS.log(...)
1234 return True
1238 central_identity = bytes(data)
1239 identity_hash = self._compute_identity_hash(central_identity)
1243 if self._check_duplicate_identity(address, central_identity):
1250 self.driver.disconnect(address)
1253 return True
1255 self.address_to_identity[address] = central_identity
1256 self.identity_to_address[identity_hash] = address
1261 mtu = self.driver.get_peer_mtu(address)
1262 if not mtu:
1263 mtu = 23
1266 frag_key = self._get_fragmenter_key(central_identity, address)
1268 with self.frag_lock:
1269 self.fragmenters[frag_key] = BLEFragmenter(mtu=mtu)
1271 self.reassemblers[frag_key] = BLEReassembler()
1274 if identity_hash not in self.spawned_interfaces:
1278 self._spawn_peer_interface(...)
1285 else:
1287 existing_if = self.spawned_interfaces[identity_hash]
1290 existing_if.peer_address = address
1291 self.address_to_interface[address] = existing_if
1297 self._last_real_data[identity_hash] = time.time()
1300 if address in self._pending_identity_connections:
1301 del self._pending_identity_connections[address]
1303 return True
1305 except Exception as e:
1306 RNS.log(...)
1307 return True
```
**Callers**
Direct caller:
- [BLEInterface._data_received_callback](/usr/local/src/ble-reticulum/src/ble_reticulum/BLEInterface.py:1309) calls `_handle_identity_handshake(address, data)` before normal packet handling.
Driver callback chain:
- [BLEInterface.__init__](/usr/local/src/ble-reticulum/src/ble_reticulum/BLEInterface.py:445) assigns `self.driver.on_data_received = self._data_received_callback`.
- [linux_bluetooth_driver.py](/usr/local/src/ble-reticulum/src/ble_reticulum/linux_bluetooth_driver.py:1332) calls `on_data_received(address, data)` for notifications.
- [linux_bluetooth_driver.py](/usr/local/src/ble-reticulum/src/ble_reticulum/linux_bluetooth_driver.py:2366) calls `on_data_received(central_address, data)` from the peripheral write path.
Related but separate:
- [handle_peripheral_data](/usr/local/src/ble-reticulum/src/ble_reticulum/BLEInterface.py:2113) contains older/parallel identity-handshake handling. It is not a caller of `_handle_identity_handshake`.
**Callees**
- `_compute_identity_hash(peer_identity)` at [line 1899](/usr/local/src/ble-reticulum/src/ble_reticulum/BLEInterface.py:1899)
- `_check_duplicate_identity(address, peer_identity)` at [line 1051](/usr/local/src/ble-reticulum/src/ble_reticulum/BLEInterface.py:1051)
- `self.driver.disconnect(address)`
- `self.driver.get_peer_mtu(address)`
- `_get_fragmenter_key(peer_identity, address)` at [line 1886](/usr/local/src/ble-reticulum/src/ble_reticulum/BLEInterface.py:1886)
- `BLEFragmenter(mtu=mtu)`
- `BLEReassembler()`
- `_spawn_peer_interface(...)` at [line 1920](/usr/local/src/ble-reticulum/src/ble_reticulum/BLEInterface.py:1920)
- `RNS.log(...)`
- `time.time()`
**Object Attributes Read**
- `self.address_to_identity`
- `self.identity_to_address`, indirectly through `_check_duplicate_identity`
- `self._pending_detach`, indirectly through `_check_duplicate_identity`
- `self.driver.connected_peers`, indirectly through `_check_duplicate_identity`
- `self.peers`, indirectly through `_check_duplicate_identity`
- `self._last_real_data`, indirectly through `_check_duplicate_identity`
- `self._zombie_timeout`, indirectly through `_check_duplicate_identity`
- `self.spawned_interfaces`
- `self.frag_lock`
- `self.fragmenters`
- `self.reassemblers`
- `self.address_to_interface`
- `self._pending_identity_connections`
**Object Attributes Mutated**
- `self.address_to_identity[address]`
- `self.identity_to_address[identity_hash]`
- `self.fragmenters[frag_key]`
- `self.reassemblers[frag_key]`
- `existing_if.peer_address`
- `self.address_to_interface[address]`
- `self._last_real_data[identity_hash]`
- `self._pending_identity_connections`, deletion
- Indirectly via `_check_duplicate_identity`: stale address cleanup and possible zombie disconnect behavior.
- Indirectly via `_spawn_peer_interface`: `spawned_interfaces`, `address_to_interface`, `address_to_identity`, `identity_to_address`, `_pending_detach`, `_last_real_data`, `RNS.Transport.interfaces`.
**External Objects Touched**
- `self.driver`: `disconnect()`, `get_peer_mtu()`, `connected_peers`.
- `BLEFragmenter` / `BLEReassembler`: imported through the backend shim at [lines 81-99](/usr/local/src/ble-reticulum/src/ble_reticulum/BLEInterface.py:81).
- `BLEPeerInterface`: created indirectly through `_spawn_peer_interface`.
- `RNS.Transport.interfaces`: mutated indirectly by `_spawn_peer_interface`.
- Wall clock: `time.time()`.
**Reticulum Dependencies**
- `RNS.log` is used directly for status, warnings, and errors.
- `RNS.Transport.interfaces` is modified indirectly when a peer interface is spawned.
- Interface lifecycle expectations are Reticulum-specific: creating a `BLEPeerInterface`, setting interface fields, and making it visible to Transport are not pure protocol work.
**BLE Driver / Platform Dependencies**
- MTU lookup uses `self.driver.get_peer_mtu(address)`.
- Duplicate rejection may call `self.driver.disconnect(address)`.
- Duplicate detection depends on `self.driver.connected_peers`.
- The whole function is called from BLE notification/write callbacks, so it sits directly on the driver/platform boundary.
- Address handling is BLE/MAC-rotation specific.
**Pure Protocol Decisions**
Small pieces are pure enough to extract:
- `len(data) == 16` means “candidate identity handshake”.
- Existing identity plus matching 16-byte payload means “duplicate handshake, consume”.
- Existing identity plus different 16-byte payload means “identity-like data, consume with warning”.
- New identity value is `bytes(data)`.
- `identity_hash = peer_identity.hex()[:16]`.
- `frag_key = peer_identity.hex()`.
- Default MTU fallback is `23` if no MTU is available, although this is BLE policy, not Reticulum protocol.
These decisions can be represented as a small classifier/result object.
**Side Effects**
The current function is mostly side effects:
- Consumes or rejects incoming data before normal reassembly.
- Logs multiple outcomes.
- Disconnects duplicate connections.
- Stores identity/address mappings.
- Creates fragmentation state.
- Spawns or updates Reticulum peer interfaces.
- Updates zombie/activity tracking.
- Removes pending identity timeout state.
- Suppresses all exceptions and consumes the packet anyway.
**Proposed Split**
A conservative split is possible, but only for a very small helper. I would not move the full function into C++/Rust. The function is too entangled with BLE driver state, Reticulum interface lifecycle, locks, MAC rotation, pending detach cleanup, and logging.
Good extraction candidate:
- A pure “classify identity handshake input” helper.
Keep in Python glue:
- Duplicate identity policy using current connection state.
- Driver disconnect.
- MTU lookup.
- Fragmenter/reassembler creation.
- Peer interface spawn/update.
- Reticulum registration.
- Logging.
- Pending timeout and zombie tracking.
**Proposed Python-Facing Helper API**
For protocol core:
```python
result = classify_identity_handshake(data, known_identity=None)
```
Possible result shape:
```python
{
"is_handshake": bool,
"consume": bool,
"status": "not_handshake" | "new_identity" | "duplicate_same" | "duplicate_mismatch",
"peer_identity": bytes | None,
"identity_hash": str | None,
"fragmenter_key": str | None,
}
```
Equivalent C++ binding could expose:
```python
ble_protocol_core_cpp.classify_identity_handshake(data, known_identity=None)
```
This should not decide duplicate-connection rejection. That decision currently depends on live Python/driver state.
**Risks**
- High fragility if the whole function is ported: it would pull platform and Reticulum lifecycle into protocol core.
- The “16 bytes means handshake” rule can collide with legitimate 16-byte data if identity is missing or already known. Current behavior intentionally consumes such data.
- `_check_duplicate_identity` has nontrivial live-state behavior: pending detach, stale connection cleanup, zombie timeout, and driver disconnect. Moving it would obscure race-sensitive behavior.
- There is duplicate identity-handshake logic in `handle_peripheral_data`; changing one path without reconciling the other could produce divergent behavior.
- Exception handling currently consumes packets even after failure. Tests should lock this down before any refactor.
**Test Plan**
Before extraction:
- Unit-test classification only: non-16-byte data, new 16-byte identity, duplicate matching identity, duplicate mismatching identity.
- Characterize existing `_handle_identity_handshake` behavior with fake driver and fake fragmenter/reassembler classes.
- Verify duplicate identity rejection calls `driver.disconnect(address)` and still returns `True`.
- Verify MTU fallback to `23`.
- Verify successful handshake mutates identity maps, creates fragmenter/reassembler, removes pending identity entry, and updates `_last_real_data`.
- Verify existing spawned interface path updates `peer_address` and `address_to_interface`.
- Verify exceptions return `True`, preserving current consume-on-error behavior.
Recommendation: extract only the pure classifier first, if anything. Leave `_handle_identity_handshake` as Python glue around that classifier. Full extraction would make the system more fragile at this phase.
# My Response
Our goal is to migrate this project to C++ so it can be integrated with the C++ microreticulum running on an ESP32-S (LilyGo! T-Beam SUPREME). You have the suggestion of keeping some Python. Given the migration goal, what is your updated assessment?
# Codex Reply
Updated assessment: for the migration goal, “keep Python glue” should mean “keep it only in the workstation Reticulum interface during transition,” not “preserve Python as part of the final ESP32 path.”
For `_handle_identity_handshake`, I would still not port the Python function wholesale. But I would now classify more of it as C++ migration-relevant than I did in the narrow Phase 2 report.
The right split is:
**Port to C++ protocol/core logic**
- Detect whether incoming data is an identity handshake: currently `len(data) == 16`.
- Represent the peer identity as the stable peer key.
- Compute:
- short identity key: `peer_identity.hex()[:16]`
- full fragmenter key: `peer_identity.hex()`
- Decide whether a 16-byte payload should be consumed as:
- new identity
- duplicate same identity
- duplicate mismatching identity-like data
- not handshake
- Maintain peer identity/address association in a platform-neutral peer/session table.
- Own fragmenter/reassembler creation policy once identity and MTU are known.
- Track pending identity timeout state.
- Track last real data time for duplicate/zombie replacement policy, if that policy is wanted on embedded too.
- Emit protocol events such as `IdentityAccepted`, `DuplicateRejected`, `PeerReady`, `DataConsumed`, `DataForReassembly`.
**Do not port as-is**
- Direct `RNS.log(...)`.
- Direct `RNS.Transport.interfaces.append(...)`.
- Python `BLEPeerInterface` creation.
- Python dictionaries as the authoritative model.
- Direct calls to `self.driver.disconnect(...)`.
- Python locking structure.
- BlueZ/Linux-specific connection assumptions.
Those should become adapter callbacks or platform bindings.
So the updated answer is: yes, this area is relevant to C++ migration, but not as a literal method extraction. It should become a C++ peer handshake/session state machine with a thin Python adapter on Linux and a BLE/NimBLE-style adapter on ESP32.
A plausible C++-first API would look like:
```cpp
enum class HandshakeAction {
NotHandshake,
ConsumedDuplicateSame,
ConsumedDuplicateMismatch,
AcceptedNewIdentity,
RejectDuplicate
};
struct IdentityHandshakeResult {
HandshakeAction action;
std::array<uint8_t, 16> peer_identity;
std::string identity_key; // first 8 bytes as 16 hex chars
std::string fragmenter_key; // full 16 bytes as 32 hex chars
bool should_disconnect;
bool should_create_fragmentation_state;
bool should_mark_peer_ready;
};
```
Then the Python side would temporarily do:
```python
result = protocol_core.handle_identity_handshake(address, data, mtu, connection_state)
if result.should_disconnect:
driver.disconnect(address)
if result.should_create_fragmentation_state:
fragmenters[result.fragmenter_key] = BLEFragmenter(mtu=result.mtu)
reassemblers[result.fragmenter_key] = BLEReassembler()
if result.should_mark_peer_ready:
_spawn_peer_interface(...)
```
On ESP32/microreticulum, the same result would drive C++ BLE connection/session objects instead of Python Reticulum interfaces.
My revised recommendation:
1. Do not migrate `_handle_identity_handshake` as one blob.
2. Do migrate its protocol/session semantics into C++.
3. First build a C++ `PeerSessionManager` or `BLEProtocolSession` that owns identity, MTU, duplicate, pending-handshake, and fragmenter/reassembler state.
4. Keep Python `BLEInterface.py` as a compatibility adapter until the embedded C++ path is ready.
5. Add equivalence tests that prove the C++ session manager makes the same decisions as current Python for known edge cases.
In short: the previous “leave Python glue” assessment is correct for the current Linux Reticulum integration, but for the ESP32 target the durable boundary should move lower. Python should become a test harness/adapter, while C++ should own the BLE protocol session model.
# Next Instruction from ChatGPT
Phase 2 goal is not to preserve Python as the final architecture.
The final target is a C++ BLE protocol/session layer usable by microReticulum on ESP32-S3/T-Beam SUPREME, with Python retained only as a transitional Linux test adapter.
Design a C++ BLEProtocolSession or PeerSessionManager.
Do not modify BLEInterface.py yet.
Use current BLEInterface._handle_identity_handshake behavior as the reference, but do not port it literally.
Produce:
1. proposed C++ header
2. state owned by the class
3. event/result structs
4. exact behavior mapping from current Python cases
5. what remains in Python adapter
6. what would become ESP32/microReticulum adapter code
7. unit test plan comparing decisions against current Python behavior
8. migration steps from current Python dictionaries toward C++ session ownership
# Codex response
**Updated Assessment**
Given the final target is ESP32-S3/microReticulum, `_handle_identity_handshake` should be treated as a reference behavior for a C++ session manager, not as Python glue with a small helper. The Python `BLEInterface.py` should eventually delegate identity/session decisions to C++ and only perform Linux/Reticulum adapter actions.
Below is the design I would use for Phase 2.
**1. Proposed C++ Header**
```cpp
#pragma once
#include <array>
#include <cstdint>
#include <optional>
#include <string>
#include <unordered_map>
#include <vector>
namespace ble_reticulum {
using PeerIdentity = std::array<uint8_t, 16>;
enum class Role {
Unknown,
Central,
Peripheral,
};
enum class HandshakeDecision {
NotHandshake,
DuplicateKnownIdentity,
MismatchedKnownIdentity,
AcceptedNewIdentity,
RejectedDuplicateIdentity,
ErrorConsumed,
};
enum class AdapterAction {
None,
DisconnectPeer,
CreateFragmentationState,
PeerReady,
UpdatePeerAddress,
RemovePendingIdentity,
MarkRealData,
};
struct ConnectionState {
std::string address;
Role role = Role::Unknown;
std::optional<PeerIdentity> known_identity;
std::optional<uint16_t> negotiated_mtu;
bool existing_identity_connected_elsewhere = false;
bool existing_address_connected = false;
bool existing_address_in_peer_table = false;
bool identity_has_pending_detach = false;
bool existing_connection_is_zombie = false;
std::string existing_address_for_identity;
};
struct HandshakeResult {
HandshakeDecision decision = HandshakeDecision::NotHandshake;
std::vector<AdapterAction> actions;
bool consumed = false;
bool accepted = false;
bool should_disconnect = false;
std::optional<PeerIdentity> peer_identity;
std::string identity_key; // first 8 bytes as 16 hex chars
std::string fragmenter_key; // full 16 bytes as 32 hex chars
uint16_t mtu = 23;
std::string peer_name;
std::string replacement_old_address;
std::string warning;
std::string error;
};
struct PeerSession {
std::string address;
PeerIdentity identity;
std::string identity_key;
std::string fragmenter_key;
uint16_t mtu = 23;
Role role = Role::Unknown;
double pending_identity_since = 0.0;
double last_real_data = 0.0;
bool has_fragmentation_state = false;
bool peer_ready = false;
};
class BLEProtocolSession {
public:
explicit BLEProtocolSession(double pending_identity_timeout = 30.0,
double zombie_timeout = 120.0);
HandshakeResult handle_identity_handshake(
const std::string& address,
const std::vector<uint8_t>& data,
const ConnectionState& state,
double now_seconds);
void mark_pending_identity(const std::string& address, double now_seconds);
void remove_pending_identity(const std::string& address);
bool has_identity_for_address(const std::string& address) const;
std::optional<PeerIdentity> identity_for_address(const std::string& address) const;
std::optional<std::string> address_for_identity_key(const std::string& identity_key) const;
void accept_identity(const std::string& address,
const PeerIdentity& identity,
uint16_t mtu,
Role role,
double now_seconds);
void update_peer_address(const std::string& identity_key,
const std::string& new_address,
double now_seconds);
void remove_address(const std::string& address);
static bool is_identity_handshake_payload(const std::vector<uint8_t>& data);
static PeerIdentity identity_from_payload(const std::vector<uint8_t>& data);
static std::string compute_identity_key(const PeerIdentity& identity);
static std::string compute_fragmenter_key(const PeerIdentity& identity);
private:
double pending_identity_timeout_;
double zombie_timeout_;
std::unordered_map<std::string, PeerIdentity> address_to_identity_;
std::unordered_map<std::string, std::string> identity_key_to_address_;
std::unordered_map<std::string, PeerSession> sessions_by_identity_key_;
std::unordered_map<std::string, double> pending_identity_connections_;
HandshakeResult consume_known_identity_case(
const std::string& address,
const std::vector<uint8_t>& data,
const PeerIdentity& known_identity) const;
bool should_reject_duplicate_identity(const std::string& address,
const std::string& identity_key,
const ConnectionState& state) const;
};
} // namespace ble_reticulum
```
This is intentionally session-oriented, not Reticulum-interface-oriented. It can be bound into Python with pybind11 now and compiled directly into microReticulum later.
**2. State Owned By The Class**
The C++ class should own protocol/session state that is currently scattered across Python dictionaries:
- `address_to_identity_`: address to 16-byte identity.
- `identity_key_to_address_`: short identity key to current address.
- `sessions_by_identity_key_`: stable peer session table.
- `pending_identity_connections_`: addresses waiting for identity handshake.
- Per-peer MTU value.
- Per-peer last real data timestamp.
- Whether fragmentation state should exist for the peer.
- Whether peer is ready for upper-layer routing.
It should not own Linux driver objects, Reticulum `Interface` objects, Python locks, or BlueZ-specific objects.
**3. Event / Result Structs**
`HandshakeResult` is the main bridge. It should be boring and explicit:
- `decision`: what happened.
- `consumed`: whether the input data must not go to the reassembler.
- `accepted`: whether a new identity was accepted.
- `should_disconnect`: whether the adapter should disconnect the peer.
- `actions`: ordered adapter work to perform.
- `peer_identity`, `identity_key`, `fragmenter_key`.
- `mtu`.
- `peer_name`.
- `replacement_old_address`.
- `warning` / `error` strings for adapter logging.
The adapter should never have to reverse-engineer behavior from side effects.
**4. Exact Behavior Mapping From Current Python**
Current Python behavior at [BLEInterface.py:1202](/usr/local/src/ble-reticulum/src/ble_reticulum/BLEInterface.py:1202):
| Python case | Current behavior | C++ decision |
|---|---|---|
| `len(data) != 16` | Return `False`; normal BLE data path continues | `NotHandshake`, `consumed=false` |
| `len(data) == 16`, known identity exists, payload matches known identity | Log debug, return `True`, do not reassemble | `DuplicateKnownIdentity`, `consumed=true` |
| `len(data) == 16`, known identity exists, payload differs | Log warning, return `True`, do not reassemble | `MismatchedKnownIdentity`, `consumed=true`, warning set |
| New 16-byte identity, duplicate identity check rejects | Log warning, call `driver.disconnect(address)`, return `True` | `RejectedDuplicateIdentity`, `consumed=true`, `should_disconnect=true`, action `DisconnectPeer` |
| New 16-byte identity accepted | Store mappings, get MTU or fallback 23, create fragmentation state, spawn/update peer interface, mark real data, clear pending identity | `AcceptedNewIdentity`, `consumed=true`, actions `CreateFragmentationState`, `PeerReady`, `MarkRealData`, `RemovePendingIdentity` |
| Existing `identity_hash` already spawned under old address | Update peer interface address and `address_to_interface` | `AcceptedNewIdentity` or address update result with action `UpdatePeerAddress` |
| Any exception | Log error, return `True`, consume data | `ErrorConsumed`, `consumed=true`, error set |
Duplicate identity behavior maps from `_check_duplicate_identity`:
| Python duplicate subcase | Current behavior | C++ result |
|---|---|---|
| No identity or invalid length | Allow | no rejection |
| Same identity, same address | Allow | no rejection |
| Same identity, different address, pending detach exists | Allow after stale cleanup | action/update state to replace stale address |
| Existing address not connected and not in peer table | Allow after stale cleanup | action/update state to replace stale address |
| Existing connection is zombie | Allow, request old disconnect | action `DisconnectPeer` for old address plus accept new |
| Existing connection alive | Reject duplicate | `RejectedDuplicateIdentity` |
**5. What Remains In Python Adapter**
During transition, Python should keep only adapter work:
- Receive driver callback.
- Convert Python `bytes` to C++ input.
- Build `ConnectionState` from current Linux/Reticulum state.
- Call `BLEProtocolSession.handle_identity_handshake(...)`.
- Log result using `RNS.log`.
- If requested, call `driver.disconnect(address)`.
- If requested, create Python `BLEFragmenter` / `BLEReassembler` until those are also session-owned in C++.
- If requested, call `_spawn_peer_interface(...)`.
- Maintain compatibility dictionaries only as mirrors while migrating:
- `address_to_identity`
- `identity_to_address`
- `spawned_interfaces`
- `address_to_interface`
- `_pending_identity_connections`
- `_last_real_data`
Eventually Python should stop being the source of truth for identity/session state.
**6. ESP32 / microReticulum Adapter Code**
On ESP32-S3, the adapter should replace Python-specific side effects with embedded equivalents:
- BLE stack callback receives connection handle/address and payload.
- Adapter builds `ConnectionState` from NimBLE/ESP-IDF connection table.
- Calls `BLEProtocolSession.handle_identity_handshake(...)`.
- If `should_disconnect`, call BLE stack disconnect for the connection handle.
- If `CreateFragmentationState`, allocate or initialize C++ fragmenter/reassembler objects for the peer session.
- If `PeerReady`, register the peer/session with microReticulums link/interface abstraction.
- If `UpdatePeerAddress`, update the connection handle/address mapping.
- If `RemovePendingIdentity`, clear pending timeout state.
- If `MarkRealData`, refresh liveness timestamp.
- If `consumed=false`, pass payload to the reassembler/data path.
ESP32 code should use connection handles internally where possible. BLE MAC address should be metadata, not the only stable key, because the Python behavior already shows MAC rotation issues.
**7. Unit Test Plan**
Tests should compare C++ decisions against current Python behavior before any behavior change.
Core C++ tests:
- Non-16-byte data returns `NotHandshake`, `consumed=false`.
- 16-byte new identity returns `AcceptedNewIdentity`, identity key equals `identity.hex()[:16]`.
- Fragmenter key equals full identity hex.
- Missing MTU falls back to `23`.
- Provided MTU is preserved.
- Known identity plus same payload returns `DuplicateKnownIdentity`, `consumed=true`.
- Known identity plus different payload returns `MismatchedKnownIdentity`, `consumed=true`.
- Duplicate same identity at live different address returns `RejectedDuplicateIdentity`, `should_disconnect=true`.
- Duplicate identity with pending detach is accepted and proposes stale address replacement.
- Duplicate identity with old address disconnected and absent from peer table is accepted.
- Duplicate identity with zombie old connection is accepted and requests old disconnect.
- Error-path compatibility: malformed adapter state should produce consumed error result if matching current Python consume-on-error semantics.
Python equivalence tests:
- Use a fake `BLEInterface` or small harness around current `_handle_identity_handshake`.
- Use a fake driver recording `disconnect()` and `get_peer_mtu()`.
- Run identical inputs through Python and C++.
- Compare:
- consumed/not consumed
- disconnect requested/called
- accepted/rejected
- identity key
- fragmenter key
- MTU
- pending identity removal
- mapping updates
- spawned/update-interface intent
Do not require log string equality. Test decision categories and side effects.
**8. Migration Steps**
1. Add pure C++ identity/session types alongside current protocol core.
2. Bind the session manager into `ble_protocol_core_cpp` for Python tests.
3. Add tests that encode current `_handle_identity_handshake` cases without changing `BLEInterface.py`.
4. Add a Python adapter harness in tests that converts current Python state into `ConnectionState`.
5. Once tests pass, add optional use of C++ session manager behind an environment flag, still mirroring Python dictionaries.
6. Move identity mapping source of truth to C++ session manager while keeping Python dictionaries as compatibility mirrors.
7. Move pending identity timeout and last-real-data tracking into C++.
8. Move fragmenter/reassembler ownership into C++ session state.
9. Reduce `_handle_identity_handshake` to adapter code: call C++, perform requested side effects.
10. Reuse the same C++ session manager from microReticulum ESP32 BLE adapter.
11. Once embedded path is stable, retire Python-only identity decision logic.
Bottom line: `_handle_identity_handshake` should become a C++ session-state decision engine plus thin platform adapters. Python remains useful for Linux field testing, but the authoritative BLE protocol/session model should move to C++.

View file

@ -0,0 +1,280 @@
============================================================
BLE Reticulum Migration Executive Summary
============================================================
1. Counts by phase/status/tag
phase status tag symbol_c
-------------- -------------- ---------- --------
0_inventory REVIEWED GLUE 39
0_inventory REVIEWED PLATFORM 33
0_inventory REVIEWED TEST 3
1_protocol_cor FIELD_ACCEPTED CORE 16
e
2_ble_protocol DESIGN GLUE 1
_session_manag
er
2. Phase-1 C++ candidates
source_file class_name symbol_nam line_num tag status
-------------- -------------- ---------- -------- ------ ------------------------------------------------------------
src/ble_reticu BLEFragmen 52 CORE FIELD_ACCEPTED
lum/BLEFragmen ter
tation.py
src/ble_reticu BLEFragmenter __init__ 68 CORE FIELD_ACCEPTED
lum/BLEFragmen
tation.py
src/ble_reticu BLEFragmenter fragment_p 82 CORE FIELD_ACCEPTED
lum/BLEFragmen acket
tation.py
src/ble_reticu BLEFragmenter get_fragme 158 CORE FIELD_ACCEPTED
lum/BLEFragmen nt_overhea
tation.py d
src/ble_reticu BLEReassem 176 CORE FIELD_ACCEPTED
lum/BLEFragmen bler
tation.py
src/ble_reticu BLEReassembler __init__ 187 CORE FIELD_ACCEPTED
lum/BLEFragmen
tation.py
src/ble_reticu BLEReassembler receive_fr 205 CORE FIELD_ACCEPTED
lum/BLEFragmen agment
tation.py
src/ble_reticu BLEReassembler _reassembl 380 CORE FIELD_ACCEPTED
lum/BLEFragmen e
tation.py
src/ble_reticu BLEReassembler cleanup_st 402 CORE FIELD_ACCEPTED
lum/BLEFragmen ale_buffer
tation.py s
src/ble_reticu BLEReassembler get_statis 429 CORE FIELD_ACCEPTED
lum/BLEFragmen tics
tation.py
src/ble_reticu BLEReassembler reset_stat 443 CORE FIELD_ACCEPTED
lum/BLEFragmen istics
tation.py
src/ble_reticu HDLCFramer 450 CORE FIELD_ACCEPTED
lum/BLEFragmen
tation.py
src/ble_reticu HDLCFramer frame_pack 464 CORE FIELD_ACCEPTED
lum/BLEFragmen et
tation.py
src/ble_reticu HDLCFramer deframe_pa 491 CORE FIELD_ACCEPTED
lum/BLEFragmen cket
tation.py
src/ble_reticu BLEInterface _handle_id 1202 GLUE DESIGN
lum/BLEInterfa entity_han
ce.py dshake
src/ble_reticu BLEInterface _get_fragm 1858 CORE FIELD_ACCEPTED
lum/BLEInterfa enter_key
ce.py
src/ble_reticu BLEInterface _compute_i 1871 CORE FIELD_ACCEPTED
lum/BLEInterfa dentity_ha
ce.py sh
3. Symbols marked TESTED or ACCEPTED
source_file class_name symbol_nam phase status notes_preview
-------------- -------------- ---------- -------- ------ ------------------------------------------------------------
src/ble_reticu BLEFragmen 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen ter ol_core ACCEPT ol cell: BLEFragment
tation.py ED
src/ble_reticu BLEFragmenter __init__ 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen ol_core ACCEPT ol cell: BLEFragment
tation.py ED
src/ble_reticu BLEFragmenter fragment_p 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen acket ol_core ACCEPT ol cell: BLEFragment
tation.py ED
src/ble_reticu BLEFragmenter get_fragme 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen nt_overhea ol_core ACCEPT ol cell: BLEFragment
tation.py d ED
src/ble_reticu BLEReassem 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen bler ol_core ACCEPT ol cell: BLEReassemb
tation.py ED
src/ble_reticu BLEReassembler __init__ 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen ol_core ACCEPT ol cell: BLEReassemb
tation.py ED
src/ble_reticu BLEReassembler receive_fr 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen agment ol_core ACCEPT ol cell: BLEReassemb
tation.py ED
src/ble_reticu BLEReassembler _reassembl 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen e ol_core ACCEPT ol cell: BLEReassemb
tation.py ED
src/ble_reticu BLEReassembler cleanup_st 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen ale_buffer ol_core ACCEPT ol cell: BLEReassemb
tation.py s ED
src/ble_reticu BLEReassembler get_statis 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen tics ol_core ACCEPT ol cell: BLEReassemb
tation.py ED
src/ble_reticu BLEReassembler reset_stat 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen istics ol_core ACCEPT ol cell: BLEReassemb
tation.py ED
src/ble_reticu HDLCFramer 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen ol_core ACCEPT ol cell: HDLCFramer
tation.py ED
src/ble_reticu HDLCFramer frame_pack 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen et ol_core ACCEPT ol cell: HDLCFramer.
tation.py ED
src/ble_reticu HDLCFramer deframe_pa 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen cket ol_core ACCEPT ol cell: HDLCFramer.
tation.py ED
src/ble_reticu BLEInterface _get_fragm 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEInterfa enter_key ol_core ACCEPT ol cell: _get_fragme
ce.py ED
src/ble_reticu BLEInterface _compute_i 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEInterfa dentity_ha ol_core ACCEPT ol cell: _compute_id
ce.py sh ED
4. Remaining CORE symbols not accepted
5. Unknown or needs-review symbols
6. Do-not-port-yet inventory
tag symbol_count
-------------- --------------
GLUE 40
PLATFORM 33
TEST 3
7. Candidate next tasks
source_file class_name symbol_nam line_num tag phase status cpp_candidate rationale_preview
-------------- -------------- ---------- -------- ------ ------------------------------------------------------------ ------ ------------- ------------------------------------------------------------
src/ble_reticu BLEInterface _handle_id 1202 GLUE 2_ble_protocol_session_manager DESIGN 1 Gate 2A treats this method as reference behavior for a C++ B
lum/BLEInterfa entity_han LEPeerSessionManager, not as a literal f
ce.py dshake
8. Latest review notes
reviewed_at reviewer source_fil class_na symbol old_status new_status note_preview
-------------- -------------- ---------- -------- ------ ------------------------------------------------------------ -------------- ------------------------------------------------------------
2026-05-18 21: Codex src/ble_re BLEInter _handl REVIEWED DESIGN Gate 2A opened as design-only. _handle_identity_handshake is
43:11 ticulum/BL face e_iden reference behavior for a future C++ BLE
EInterface tity_h
.py andsha
ke
2026-05-17 20: jlpoole + Code src/ble_re BLEFra FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: Phase 1 frozen at git tag phase1-ble-protocol-co
35:48 x + ChatGPT ticulum/BL gmente re-20260517. All CORE symbols are FIELD_
EFragmenta r
tion.py
2026-05-17 20: jlpoole + Code src/ble_re BLEFragm __init FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: Phase 1 frozen at git tag phase1-ble-protocol-co
35:48 x + ChatGPT ticulum/BL enter __ re-20260517. All CORE symbols are FIELD_
EFragmenta
tion.py
2026-05-17 20: jlpoole + Code src/ble_re BLEFragm fragme FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: Phase 1 frozen at git tag phase1-ble-protocol-co
35:48 x + ChatGPT ticulum/BL enter nt_pac re-20260517. All CORE symbols are FIELD_
EFragmenta ket
tion.py
2026-05-17 20: jlpoole + Code src/ble_re BLEFragm get_fr FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: Phase 1 frozen at git tag phase1-ble-protocol-co
35:48 x + ChatGPT ticulum/BL enter agment re-20260517. All CORE symbols are FIELD_
EFragmenta _overh
tion.py ead
2026-05-17 20: jlpoole + Code src/ble_re BLERea FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: Phase 1 frozen at git tag phase1-ble-protocol-co
35:48 x + ChatGPT ticulum/BL ssembl re-20260517. All CORE symbols are FIELD_
EFragmenta er
tion.py
2026-05-17 20: jlpoole + Code src/ble_re BLEReass __init FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: Phase 1 frozen at git tag phase1-ble-protocol-co
35:48 x + ChatGPT ticulum/BL embler __ re-20260517. All CORE symbols are FIELD_
EFragmenta
tion.py
2026-05-17 20: jlpoole + Code src/ble_re BLEReass receiv FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: Phase 1 frozen at git tag phase1-ble-protocol-co
35:48 x + ChatGPT ticulum/BL embler e_frag re-20260517. All CORE symbols are FIELD_
EFragmenta ment
tion.py
2026-05-17 20: jlpoole + Code src/ble_re BLEReass _reass FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: Phase 1 frozen at git tag phase1-ble-protocol-co
35:48 x + ChatGPT ticulum/BL embler emble re-20260517. All CORE symbols are FIELD_
EFragmenta
tion.py
2026-05-17 20: jlpoole + Code src/ble_re BLEReass cleanu FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: Phase 1 frozen at git tag phase1-ble-protocol-co
35:48 x + ChatGPT ticulum/BL embler p_stal re-20260517. All CORE symbols are FIELD_
EFragmenta e_buff
tion.py ers
2026-05-17 20: jlpoole + Code src/ble_re BLEReass get_st FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: Phase 1 frozen at git tag phase1-ble-protocol-co
35:48 x + ChatGPT ticulum/BL embler atisti re-20260517. All CORE symbols are FIELD_
EFragmenta cs
tion.py
2026-05-17 20: jlpoole + Code src/ble_re BLEReass reset_ FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: Phase 1 frozen at git tag phase1-ble-protocol-co
35:48 x + ChatGPT ticulum/BL embler statis re-20260517. All CORE symbols are FIELD_
EFragmenta tics
tion.py
2026-05-17 20: jlpoole + Code src/ble_re HDLCFr FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: Phase 1 frozen at git tag phase1-ble-protocol-co
35:48 x + ChatGPT ticulum/BL amer re-20260517. All CORE symbols are FIELD_
EFragmenta
tion.py
2026-05-17 20: jlpoole + Code src/ble_re HDLCFram frame_ FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: Phase 1 frozen at git tag phase1-ble-protocol-co
35:48 x + ChatGPT ticulum/BL er packet re-20260517. All CORE symbols are FIELD_
EFragmenta
tion.py
2026-05-17 20: jlpoole + Code src/ble_re HDLCFram defram FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: Phase 1 frozen at git tag phase1-ble-protocol-co
35:48 x + ChatGPT ticulum/BL er e_pack re-20260517. All CORE symbols are FIELD_
EFragmenta et
tion.py
2026-05-17 20: jlpoole + Code src/ble_re BLEInter _get_f FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: Phase 1 frozen at git tag phase1-ble-protocol-co
35:48 x + ChatGPT ticulum/BL face ragmen re-20260517. All CORE symbols are FIELD_
EInterface ter_ke
.py y
2026-05-17 20: jlpoole + Code src/ble_re BLEInter _compu FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: Phase 1 frozen at git tag phase1-ble-protocol-co
35:48 x + ChatGPT ticulum/BL face te_ide re-20260517. All CORE symbols are FIELD_
EInterface ntity_
.py hash
2026-05-17 20: jlpoole + Code src/ble_re BLEInter _compu FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: Identity helper C++ equivalents accepted after A
25:58 x + ChatGPT ticulum/BL face te_ide RM equivalence tests and successful bila
EInterface ntity_
.py hash
2026-05-17 20: jlpoole + Code src/ble_re BLEInter _get_f FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: Identity helper C++ equivalents accepted after A
25:58 x + ChatGPT ticulum/BL face ragmen RM equivalence tests and successful bila
EInterface ter_ke
.py y
2026-05-17 19: jlpoole + Code src/ble_re BLEFra FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: C++ fragmentation/reassembly/HDLC backend accept
27:31 x + ChatGPT ticulum/BL gmente ed after live bilateral Constitution tra
EFragmenta r
tion.py

View file

@ -0,0 +1,92 @@
BEGIN TRANSACTION;
INSERT INTO symbols (
source_file,
symbol_name,
symbol_type,
class_name,
line_number,
tag,
phase,
status,
cpp_candidate,
confidence,
rationale,
callers,
callees,
notes,
first_seen_at,
updated_at
)
VALUES (
'src/ble_reticulum/BLEInterface.py',
'_handle_identity_handshake',
'method',
'BLEInterface',
1202,
'GLUE',
'2_ble_protocol_session_manager',
'NATIVE_TESTED',
1,
'high',
'Gate 2B implemented a native C++ BLEPeerSessionManager skeleton and pure native tests covering current Python reference decisions. This remains reference behavior for C++ session ownership, not a literal method port.',
'_data_received_callback',
'_compute_identity_hash; _check_duplicate_identity; driver.disconnect; driver.get_peer_mtu; _get_fragmenter_key; BLEFragmenter; BLEReassembler; _spawn_peer_interface',
'Gate 2B native tests passed. No pybind11 bindings, Python integration, live BLE behavior, or Phase 1 FIELD_ACCEPTED rows were changed.',
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP
)
ON CONFLICT(source_file, class_name, symbol_name, line_number) DO UPDATE SET
tag = 'GLUE',
phase = '2_ble_protocol_session_manager',
status = 'NATIVE_TESTED',
cpp_candidate = 1,
confidence = 'high',
rationale = excluded.rationale,
callers = excluded.callers,
callees = excluded.callees,
notes = excluded.notes,
updated_at = CURRENT_TIMESTAMP;
INSERT INTO reviews (
symbol_id,
reviewed_at,
reviewer,
old_tag,
new_tag,
old_status,
new_status,
note
)
SELECT
symbol_id,
CURRENT_TIMESTAMP,
'Codex',
'GLUE',
'GLUE',
'DESIGN',
'NATIVE_TESTED',
'Gate 2B native C++ BLEPeerSessionManager skeleton implemented with pure native tests. Tests passed via g++ build and /tmp/test_ble_peer_session_manager. No live Python BLE behavior or Phase 1 FIELD_ACCEPTED records changed.'
FROM symbols
WHERE source_file = 'src/ble_reticulum/BLEInterface.py'
AND class_name = 'BLEInterface'
AND symbol_name = '_handle_identity_handshake'
AND line_number = 1202;
SELECT
symbol_id,
source_file,
class_name,
symbol_name,
tag,
phase,
status,
cpp_candidate,
updated_at
FROM symbols
WHERE source_file = 'src/ble_reticulum/BLEInterface.py'
AND class_name = 'BLEInterface'
AND symbol_name = '_handle_identity_handshake'
AND line_number = 1202;
COMMIT;

View file

@ -0,0 +1,35 @@
-- 20260517 ChatGPT
-- $Header$
--
-- Example:
-- cd /usr/local/src/ble-reticulum/migration
-- sqlite3 ble_migration.sqlite ".read sql/mark_phase1_frozen_20260517.sql"
--
-- Purpose:
-- Record Phase 1 freeze in review history.
BEGIN;
INSERT INTO reviews (
symbol_id,
reviewer,
old_tag,
new_tag,
old_status,
new_status,
note
)
SELECT
symbol_id,
'jlpoole + Codex + ChatGPT',
tag,
tag,
status,
status,
'2026-05-17: Phase 1 frozen at git tag phase1-ble-protocol-core-20260517. All CORE symbols are FIELD_ACCEPTED; no remaining CORE, UNKNOWN, or NEEDS_REVIEW symbols.'
FROM symbols
WHERE phase = '1_protocol_core'
AND tag = 'CORE'
AND status = 'FIELD_ACCEPTED';
COMMIT;

View file

@ -0,0 +1,76 @@
BEGIN TRANSACTION;
INSERT INTO symbols (
source_file,
symbol_name,
symbol_type,
class_name,
line_number,
tag,
phase,
status,
cpp_candidate,
confidence,
rationale,
callers,
callees,
notes,
first_seen_at,
updated_at
)
VALUES (
'src/ble_reticulum/BLEInterface.py',
'_handle_identity_handshake',
'method',
'BLEInterface',
1202,
'GLUE',
'2_ble_protocol_session_manager',
'DESIGN',
1,
'high',
'Gate 2A treats this method as reference behavior for a C++ BLEPeerSessionManager, not as a literal function port. The method mixes protocol decisions with Python, Linux driver, and Reticulum adapter side effects.',
'_data_received_callback',
'_compute_identity_hash; _check_duplicate_identity; driver.disconnect; driver.get_peer_mtu; _get_fragmenter_key; BLEFragmenter; BLEReassembler; _spawn_peer_interface',
'Gate 2A opened as design-only. Preserve tag GLUE because BLEInterface remains adapter/glue; cpp_candidate=1 means reference behavior for C++ session ownership, not direct port.',
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP
)
ON CONFLICT(source_file, class_name, symbol_name, line_number) DO UPDATE SET
tag = 'GLUE',
phase = '2_ble_protocol_session_manager',
status = 'DESIGN',
cpp_candidate = 1,
confidence = 'high',
rationale = excluded.rationale,
callers = excluded.callers,
callees = excluded.callees,
notes = excluded.notes,
updated_at = CURRENT_TIMESTAMP;
INSERT INTO reviews (
symbol_id,
reviewed_at,
reviewer,
old_tag,
new_tag,
old_status,
new_status,
note
)
SELECT
symbol_id,
CURRENT_TIMESTAMP,
'Codex',
'GLUE',
'GLUE',
'REVIEWED',
'DESIGN',
'Gate 2A opened as design-only. _handle_identity_handshake is reference behavior for a future C++ BLEPeerSessionManager, not a literal function port. Phase 1 records remain untouched.'
FROM symbols
WHERE source_file = 'src/ble_reticulum/BLEInterface.py'
AND class_name = 'BLEInterface'
AND symbol_name = '_handle_identity_handshake'
AND line_number = 1202;
COMMIT;

View file

@ -0,0 +1,279 @@
#include "../../protocol_core/BLEPeerSessionManager.h"
#include <cassert>
#include <cstdint>
#include <iostream>
#include <stdexcept>
#include <string>
#include <vector>
using namespace ble_reticulum;
namespace {
PeerIdentity identity_with_base(uint8_t base) {
PeerIdentity identity{};
for (size_t i = 0; i < identity.size(); ++i) {
identity[i] = static_cast<uint8_t>(base + i);
}
return identity;
}
std::vector<uint8_t> to_payload(const PeerIdentity& identity) {
return std::vector<uint8_t>(identity.begin(), identity.end());
}
ConnectionSnapshot snapshot(const std::string& address) {
ConnectionSnapshot snap;
snap.current.address = address;
snap.local_role = LocalRole::Peripheral;
return snap;
}
bool has_action(const HandshakeResult& result, SessionActionType type) {
for (const SessionAction& action : result.actions) {
if (action.type == type) {
return true;
}
}
return false;
}
void test_non_16_byte_payload() {
BLEPeerSessionManager manager;
auto snap = snapshot("AA:BB:CC:00:00:01");
std::vector<uint8_t> data{1, 2, 3};
HandshakeResult result =
manager.handleIdentityHandshake(snap, data.data(), data.size(), 10.0);
assert(result.decision == InputDecision::PassToReassembler);
assert(!result.consumed);
assert(!result.accepted);
assert(has_action(result, SessionActionType::PassToReassembler));
}
void test_new_16_byte_identity() {
BLEPeerSessionManager manager;
PeerIdentity identity = identity_with_base(0x10);
std::vector<uint8_t> data = to_payload(identity);
auto snap = snapshot("AA:BB:CC:00:00:02");
HandshakeResult result =
manager.handleIdentityHandshake(snap, data.data(), data.size(), 11.0);
assert(result.decision == InputDecision::AcceptedNewIdentity);
assert(result.consumed);
assert(result.accepted);
assert(result.identity_key == "1011121314151617");
assert(result.fragmenter_key == "101112131415161718191a1b1c1d1e1f");
assert(has_action(result, SessionActionType::AcceptNewIdentity));
assert(has_action(result, SessionActionType::CreateFragmentationState));
assert(has_action(result, SessionActionType::MarkPeerReady));
}
void test_known_identity_duplicate_same() {
BLEPeerSessionManager manager;
PeerIdentity identity = identity_with_base(0x20);
std::vector<uint8_t> data = to_payload(identity);
auto snap = snapshot("AA:BB:CC:00:00:03");
snap.known_identity_for_address = identity;
HandshakeResult result =
manager.handleIdentityHandshake(snap, data.data(), data.size(), 12.0);
assert(result.decision == InputDecision::ConsumedDuplicateSameIdentity);
assert(result.consumed);
assert(!result.accepted);
}
void test_known_identity_duplicate_mismatch() {
BLEPeerSessionManager manager;
PeerIdentity known = identity_with_base(0x30);
PeerIdentity incoming = identity_with_base(0x40);
std::vector<uint8_t> data = to_payload(incoming);
auto snap = snapshot("AA:BB:CC:00:00:04");
snap.known_identity_for_address = known;
HandshakeResult result =
manager.handleIdentityHandshake(snap, data.data(), data.size(), 13.0);
assert(result.decision == InputDecision::ConsumedDuplicateMismatchedIdentity);
assert(result.consumed);
assert(has_action(result, SessionActionType::Warn));
}
void test_duplicate_identity_active_elsewhere() {
BLEPeerSessionManager manager;
PeerIdentity identity = identity_with_base(0x50);
std::vector<uint8_t> data = to_payload(identity);
auto first = snapshot("AA:BB:CC:00:00:05");
manager.handleIdentityHandshake(first, data.data(), data.size(), 14.0);
auto duplicate = snapshot("AA:BB:CC:00:00:06");
duplicate.existing_address_for_identity = first.current.address;
duplicate.existing_address_connected = true;
duplicate.existing_address_in_peer_table = true;
HandshakeResult result =
manager.handleIdentityHandshake(duplicate, data.data(), data.size(), 15.0);
assert(result.decision == InputDecision::RejectedDuplicateIdentity);
assert(result.consumed);
assert(!result.accepted);
assert(result.should_disconnect_current);
assert(has_action(result, SessionActionType::DisconnectCurrentPeer));
}
void test_duplicate_identity_with_stale_pending_detach() {
BLEPeerSessionManager manager;
PeerIdentity identity = identity_with_base(0x60);
std::vector<uint8_t> data = to_payload(identity);
auto first = snapshot("AA:BB:CC:00:00:07");
manager.handleIdentityHandshake(first, data.data(), data.size(), 16.0);
auto rotated = snapshot("AA:BB:CC:00:00:08");
rotated.existing_address_for_identity = first.current.address;
rotated.identity_has_pending_detach = true;
HandshakeResult result =
manager.handleIdentityHandshake(rotated, data.data(), data.size(), 17.0);
assert(result.decision == InputDecision::AcceptedNewIdentity);
assert(result.accepted);
assert(has_action(result, SessionActionType::CleanupOldAddress));
assert(has_action(result, SessionActionType::UpdatePeerAddress));
auto view = manager.sessionByIdentity(identity);
assert(view.has_value());
assert(view->current_address == rotated.current.address);
}
void test_duplicate_identity_with_zombie_old_connection() {
BLEPeerSessionManager manager;
PeerIdentity identity = identity_with_base(0x70);
std::vector<uint8_t> data = to_payload(identity);
auto first = snapshot("AA:BB:CC:00:00:09");
manager.handleIdentityHandshake(first, data.data(), data.size(), 18.0);
auto replacement = snapshot("AA:BB:CC:00:00:0A");
replacement.existing_address_for_identity = first.current.address;
replacement.existing_address_connected = true;
replacement.existing_address_in_peer_table = true;
replacement.existing_connection_is_zombie = true;
HandshakeResult result =
manager.handleIdentityHandshake(replacement, data.data(), data.size(), 19.0);
assert(result.decision == InputDecision::AcceptedNewIdentity);
assert(result.accepted);
assert(result.should_disconnect_old);
assert(has_action(result, SessionActionType::DisconnectOldPeer));
assert(has_action(result, SessionActionType::CleanupOldAddress));
}
void test_mtu_provided() {
BLEPeerSessionManager manager;
PeerIdentity identity = identity_with_base(0x80);
std::vector<uint8_t> data = to_payload(identity);
auto snap = snapshot("AA:BB:CC:00:00:0B");
snap.negotiated_mtu = 185;
HandshakeResult result =
manager.handleIdentityHandshake(snap, data.data(), data.size(), 20.0);
assert(result.mtu == 185);
auto view = manager.sessionByIdentity(identity);
assert(view.has_value());
assert(view->mtu == 185);
}
void test_mtu_missing_fallback() {
BLEPeerSessionManager manager;
PeerIdentity identity = identity_with_base(0x90);
std::vector<uint8_t> data = to_payload(identity);
auto snap = snapshot("AA:BB:CC:00:00:0C");
HandshakeResult result =
manager.handleIdentityHandshake(snap, data.data(), data.size(), 21.0);
assert(result.mtu == 23);
}
void test_pending_identity_timeout() {
BLEPeerSessionManager manager(30.0, 45.0);
ConnectionId one{"AA:BB:CC:00:00:0D", 1};
ConnectionId two{"AA:BB:CC:00:00:0E", 2};
manager.markPendingIdentity(one, 100.0);
manager.markPendingIdentity(two, 120.0);
std::vector<ConnectionId> expired = manager.expiredPendingIdentities(131.0);
assert(expired.size() == 1);
assert(expired[0] == one);
manager.removePendingIdentity(one);
expired = manager.expiredPendingIdentities(200.0);
assert(expired.size() == 1);
assert(expired[0] == two);
}
void test_peer_address_update_fragmenter_key_unchanged() {
BLEPeerSessionManager manager;
PeerIdentity identity = identity_with_base(0xa0);
std::vector<uint8_t> data = to_payload(identity);
auto first = snapshot("AA:BB:CC:00:00:0F");
HandshakeResult first_result =
manager.handleIdentityHandshake(first, data.data(), data.size(), 22.0);
auto second = snapshot("AA:BB:CC:00:00:10");
second.existing_address_for_identity = first.current.address;
second.identity_has_pending_detach = true;
HandshakeResult second_result =
manager.handleIdentityHandshake(second, data.data(), data.size(), 23.0);
assert(first_result.fragmenter_key == second_result.fragmenter_key);
auto old_view = manager.sessionByAddress(first.current.address);
auto new_view = manager.sessionByAddress(second.current.address);
assert(!old_view.has_value());
assert(new_view.has_value());
assert(new_view->current_address == second.current.address);
}
void test_key_helpers() {
PeerIdentity identity = identity_with_base(0x01);
assert(BLEPeerSessionManager::computeIdentityKey(identity) == "0102030405060708");
assert(BLEPeerSessionManager::computeFragmenterKey(identity) ==
"0102030405060708090a0b0c0d0e0f10");
}
void test_identity_from_payload_rejects_non_16() {
std::vector<uint8_t> data{1, 2, 3};
bool threw = false;
try {
(void)BLEPeerSessionManager::identityFromPayload(data.data(), data.size());
} catch (const std::invalid_argument&) {
threw = true;
}
assert(threw);
}
} // namespace
int main() {
test_non_16_byte_payload();
test_new_16_byte_identity();
test_known_identity_duplicate_same();
test_known_identity_duplicate_mismatch();
test_duplicate_identity_active_elsewhere();
test_duplicate_identity_with_stale_pending_detach();
test_duplicate_identity_with_zombie_old_connection();
test_mtu_provided();
test_mtu_missing_fallback();
test_pending_identity_timeout();
test_peer_address_update_fragmenter_key_unchanged();
test_key_helpers();
test_identity_from_payload_rejects_non_16();
std::cout << "BLEPeerSessionManager native tests passed\n";
return 0;
}