{
 "number": 36690,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/36690",
 "title": "test: check guarantees of bech32 error detection",
 "author": "bartoli",
 "author_association": "FIRST_TIME_CONTRIBUTOR",
 "created_at": "2026-10-28T21:02:51Z",
 "updated_at": "2026-10-29T09:03:29Z",
 "description_hash": "cd5a4f34daf2d6fa",
 "age_days": 4,
 "draft": false,
 "labels": [
  "Tests"
 ],
 "milestone": null,
 "base": "master",
 "head_sha": "6151f1dd193fd4c478b2c17ac09d4855efa7074c",
 "head_ref": "bech32_tests",
 "head_repo": "bartoli/bitcoin",
 "head_history": [
  {
   "t": "2026-10-29T08:55:42Z",
   "sha": "6151f1dd193fd4c478b2c17ac09d4855efa7074c"
  }
 ],
 "additions": 94,
 "deletions": 2,
 "changed_files": 2,
 "commit_count": 2,
 "size_bucket": "S",
 "mergeable_state": "clean",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {},
   "conflicts": []
  }
 },
 "acks_parsed": {},
 "acks_tally": {
  "ack": 0,
  "stale_ack": 0,
  "concept_ack": 0,
  "approach_ack": 0,
  "nack": 0,
  "concept_nack": 0,
  "approach_nack": 0
 },
 "reviews": {
  "approved": 0,
  "changes_requested": 0,
  "distinct_reviewers": []
 },
 "signals": {
  "needs_rebase": false,
  "ci_failed": false,
  "mergeable_state": "clean",
  "last_author_activity": "2026-10-29T09:03:29Z",
  "last_reviewer_activity": null,
  "last_reviewer": null,
  "author_silent_days": 3,
  "waiting_on_author_days": 0,
  "days_since_update": 3
 },
 "refs": {
  "mentioned": [],
  "depends_on": [],
  "fixes": [],
  "linked_issues": [],
  "references": [],
  "conflicts": []
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [],
 "body": "This adds bech32 checks around the limits of bech32 strings, and the guarantees, as well as the limitations, of bech error detection.\n\nThe first commit adds those tests:\n- validity of a bech32 string at the base max length, and invalidity after that\n- validity of a bech32 string at the length limit for silent payment addresses (1023)\n- failing checksums after 1-4 changes for length 90\n- show that after 5 changes another valid checksum might exist\n- failing checksum after 1-3 changes for length 1023\n- show that after 4 changes another valid checksum might exist\n- Show that LocateErrors can locate up to 2 errors\n- Show that LocateErrors might locate a different solution to get a valid checksum\n\nSecond commit just modifies comments about error detection 'guarantees' around bech32 length limit constants. I think the formulation 'Guarantees finding up to N errors' is ambiguous.\nSomeone might interpret it as 'fixes up to N errors', but it's not. It's not even 'Locates up to N errors', since LocateErrors() can find up to 2 errors. Now with the new 1023 length, LocateError can't even anymore guarantee finding the correct 2 errors (2 errors in one direction, 2 changes tried in the other direction, and we are beyond the 3 changes that guarantee there is no other possible valid checksum).\nSo I think the comments should only say 'The checksum can detect up to N changes' instead, not guarantee more.\n\nContext :\nInitially I was just looking at all code around Silent Payments, looked if the bech32 test had been updated to have tests for the new CharLimit::SILENT_PAYMENTS, and saw less tests than I expected.",
 "commits": [
  {
   "sha": "24d3a26b6012fcc73a03a20e221df127b1d6e308",
   "date": "2026-10-29T08:54:57Z",
   "message": "bech32: test error detection guarantees\n\nAdd tests around error detection guarantees on bech32 strings\n- validity at base max length(90) and silent payments max length (1023)\n- checksum failure after up to 4 changes at length 90\n- and potential checksum success after 5 changes at length 90\n- LocateError can't find more than 2 errors\n- checksum failure after up to 3 changes at length 1023\n- potential checksum success after 4 changesi at length 1023\n- LocateError can find different errors at length 1023"
  },
  {
   "sha": "6151f1dd193fd4c478b2c17ac09d4855efa7074c",
   "date": "2026-10-29T08:55:10Z",
   "message": "bech32 : rephrase error detection guarantees\n\nSaying \"Guarantees finding N errors\" is ambiguous and can lead to fake\nillusion of safety. We can only guarantee that up to N character changes\ncan lead to no other valid checksum.\nNot that we can detect, locate or even less fix N errors"
  }
 ],
 "timeline": [
  {
   "t": "2026-10-29T08:55:42Z",
   "kind": "force_push",
   "who": "bartoli",
   "commit": "6151f1dd193fd4c478b2c17ac09d4855efa7074c",
   "id": "push:6151f1dd193fd4c478b2c17ac09d4855efa7074c"
  },
  {
   "t": "2026-10-29T09:03:29Z",
   "kind": "comment",
   "who": "bartoli",
   "assoc": "NONE",
   "text": "One error in a comment seen by Ralph has been fixed",
   "id": "c:6492467862",
   "url": "https://github.com/bitcoin/bitcoin/pull/36690#issuecomment-6492467862",
   "hash": "a401d291cbe32a75",
   "edited": null
  }
 ],
 "labels_log": [
  {
   "t": "2026-10-28T21:02:55Z",
   "action": "labeled",
   "label": "Tests",
   "who": "DrahtBot"
  }
 ],
 "state_log": [],
 "text_chars": 2510,
 "text_tokens_estimate": 627,
 "changed_paths": [
  "src/bech32.h",
  "src/test/bech32_tests.cpp"
 ],
 "files": [
  {
   "path": "src/bech32.h",
   "add": 2,
   "del": 2
  },
  {
   "path": "src/test/bech32_tests.cpp",
   "add": 92,
   "del": 0
  }
 ],
 "test_lines": 92,
 "git": {
  "head": "6151f1dd193fd4c478b2c17ac09d4855efa7074c",
  "head_matches_backup": true,
  "base": "aa76bd266df9742a266d52e0e5da8dbf033658f6",
  "patch_id": "09b51e9bb8b8f780",
  "commits": [
   {
    "sha": "24d3a26b60",
    "subject": "bech32: test error detection guarantees",
    "files": 1,
    "add": 92,
    "del": 0
   },
   {
    "sha": "6151f1dd19",
    "subject": "bech32 : rephrase error detection guarantees",
    "files": 1,
    "add": 2,
    "del": 2
   }
  ],
  "patch_truncated": false
 },
 "patch_id": "09b51e9bb8b8f780",
 "input_hash": "6bb10257543283a6",
 "extracted_at": "2026-11-02T01:09:49+00:00"
}