Add M10.9d load drill harness and serialize Mbed TLS use
Foundation / checks (deploy) (push) Successful in 3m24s
Foundation / checks (ecs) (push) Successful in 1m56s
Foundation / checks (client) (push) Successful in 12m18s
Foundation / checks (network) (push) Successful in 13m30s
Foundation / checks (tsan) (push) Successful in 8m0s
Foundation / checks (checks) (push) Successful in 32m39s
Foundation / checks (postgres) (push) Successful in 45m47s
Foundation / postgres-tools (push) Successful in 17s
Foundation / image (push) Successful in 2m30s
Foundation / server-image (push) Successful in 4m8s

ADR-0097. tools/ops/load-drill.sh (runbook docs/networking/M10_LOAD_DRILL.md)
runs the evolution-dev reference qualification: synthetic inputs on for
the run (the ADR-0073 drill-time override, restored on exit), bundle-mode
evo-load bots through the public route, and each step's hold matched with
the server's reports. evo-server logs "m10 load-report" every 10 s, since
the agent cannot reach the ops port. evo-load gains --grants FILE
--grants-per-bot C, exhausted=, hold_utc= and close_reasons=;
evo-session-probe grants gains --accounts N.

Finding: Mbed TLS/PSA are built without MBEDTLS_THREADING_C, and bots on
different threads verifying their first connections at once were refused
as untrusted (two per smoke run). One process-wide recursive crypto lock
now guards every network-library entry point that touches them; the
smoke went from 2/2 failing to 3/3 clean. quic-transport adds a
concurrent-connect test. Refreshes the dev session window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-08 08:38:13 -04:00
co-authored by Claude Opus 5.5
parent 47b84bce74
commit ada77fd761
16 changed files with 609 additions and 70 deletions
+11
View File
@@ -1,4 +1,5 @@
#include "evo/network/handoff_ticket.hpp"
#include "evo/network/crypto_lock.hpp"
#include <algorithm>
#include <psa/crypto.h>
#include <utility>
@@ -57,6 +58,7 @@ bool looks_like_handoff_ticket(std::span<const std::uint8_t> bytes) noexcept {
std::expected<HandoffSigningKey, HandoffTicketError>
HandoffSigningKey::generate(DeploymentEnvironment environment, std::uint32_t key_id) {
const CryptoLock crypto{crypto_mutex()};
if (key_id == 0)
return std::unexpected(HandoffTicketError::invalid_key);
if (psa_crypto_init() != PSA_SUCCESS)
@@ -73,6 +75,7 @@ HandoffSigningKey::generate(DeploymentEnvironment environment, std::uint32_t key
std::expected<HandoffSigningKey, HandoffTicketError>
HandoffSigningKey::import(DeploymentEnvironment environment, std::uint32_t key_id,
std::span<const std::uint8_t> private_key) {
const CryptoLock crypto{crypto_mutex()};
if (key_id == 0 || private_key.size() != grant_private_key_bytes)
return std::unexpected(HandoffTicketError::invalid_key);
if (psa_crypto_init() != PSA_SUCCESS)
@@ -90,6 +93,7 @@ HandoffSigningKey::HandoffSigningKey(HandoffSigningKey&& other) noexcept
key_{std::exchange(other.key_, PSA_KEY_ID_NULL)} {}
HandoffSigningKey& HandoffSigningKey::operator=(HandoffSigningKey&& other) noexcept {
const CryptoLock crypto{crypto_mutex()};
if (this != &other) {
if (key_ != PSA_KEY_ID_NULL)
(void)psa_destroy_key(key_);
@@ -101,12 +105,14 @@ HandoffSigningKey& HandoffSigningKey::operator=(HandoffSigningKey&& other) noexc
}
HandoffSigningKey::~HandoffSigningKey() {
const CryptoLock crypto{crypto_mutex()};
if (key_ != PSA_KEY_ID_NULL)
(void)psa_destroy_key(key_);
}
std::expected<HandoffTicket, HandoffTicketError>
HandoffSigningKey::sign(const TicketClaims& claims) const {
const CryptoLock crypto{crypto_mutex()};
if (key_ == PSA_KEY_ID_NULL)
return std::unexpected(HandoffTicketError::invalid_key);
if (!structurally_valid(claims))
@@ -134,6 +140,7 @@ HandoffSigningKey::sign(const TicketClaims& claims) const {
}
std::expected<GrantPublicKey, HandoffTicketError> HandoffSigningKey::public_key() const {
const CryptoLock crypto{crypto_mutex()};
if (key_ == PSA_KEY_ID_NULL)
return std::unexpected(HandoffTicketError::invalid_key);
GrantPublicKey out{};
@@ -147,6 +154,7 @@ std::expected<GrantPublicKey, HandoffTicketError> HandoffSigningKey::public_key(
std::expected<HandoffVerifier, HandoffTicketError>
HandoffVerifier::create(DeploymentEnvironment environment, world::WorldIdentity world,
std::uint64_t region) {
const CryptoLock crypto{crypto_mutex()};
if (world.world == 0 || world.frame == 0 || region == 0)
return std::unexpected(HandoffTicketError::invalid_claims);
if (psa_crypto_init() != PSA_SUCCESS)
@@ -174,6 +182,7 @@ HandoffVerifier::~HandoffVerifier() {
}
void HandoffVerifier::destroy() noexcept {
const CryptoLock crypto{crypto_mutex()};
for (const auto& k : keys_)
(void)psa_destroy_key(k.key);
keys_.clear();
@@ -182,6 +191,7 @@ void HandoffVerifier::destroy() noexcept {
std::expected<void, HandoffTicketError>
HandoffVerifier::add_key(std::uint64_t source_region, std::uint32_t key_id,
std::span<const std::uint8_t> public_key) {
const CryptoLock crypto{crypto_mutex()};
if (source_region == 0 || source_region == region_ || key_id == 0 ||
public_key.size() != grant_public_key_bytes)
return std::unexpected(HandoffTicketError::invalid_key);
@@ -204,6 +214,7 @@ HandoffVerifier::add_key(std::uint64_t source_region, std::uint32_t key_id,
std::expected<VerifiedHandoffTicket, HandoffTicketError>
HandoffVerifier::verify(std::span<const std::uint8_t> ticket, std::uint64_t now_seconds) const {
const CryptoLock crypto{crypto_mutex()};
if (ticket.size() != handoff_ticket_bytes)
return std::unexpected(HandoffTicketError::malformed);
// The key id only selects which key must verify; it is itself signed.