{
  "schema_version": "1.0.0",
  "record_version": "1.0.0",
  "record_id": "dn-permit2-unordered-nonce-fixtures",
  "title": "Synthetic Permit2 unordered-nonce word and bit fixtures",
  "evidence_type": "synthetic",
  "source_review_date": "2026-12-03",
  "observation_window": null,
  "last_verified_utc": null,
  "canonical_url": "https://decentralised.news/ai-agent-permission-revocation-erc20-permit2-sessions#dn-permit2-nonce",
  "methodology_url": "/research-data/2026-12-03/permit2-nonce-methodology.md",
  "methodology_version": "1.0.0",
  "source_commit": "cc56ad0f3439c502c246fc5cfcc3db92bb8b7219",
  "input_schema": {
    "nonce": "Required string: 1–78 decimal digits or 0x/0X plus 1–64 hexadecimal digits; integer range 0 to 2^256−1.",
    "bitmap": "The same string grammar and range. This is the supplied word, not a nonce or a verified state read.",
    "normalization": "Leading zeroes within the length bound are accepted and normalized. Whitespace, signs, decimals, separators and exponent notation are rejected."
  },
  "units": "Dimensionless exact unsigned integers. All fixture integers are strings.",
  "construction": "Invented values. Expected results independently generated with Python integer divmod, exponentiation, division/remainder and conditional addition, without importing the JavaScript checker.",
  "scope": "Permit2 SignatureTransfer unordered nonces at the pinned source revision. No owner, contract, chain, block, token, spender or signature was observed.",
  "limitations": [
    "A set bit cannot distinguish consumed from explicitly invalidated.",
    "A clear bit does not establish signature validity or spending authority.",
    "Expected after-OR values are mathematical outputs, not transactions or observed state changes.",
    "A source revision is not proof of a matching deployed contract."
  ],
  "cases": [
    {
      "id": "zero",
      "evidence_type": "synthetic",
      "note": "The first bit in the first word.",
      "inputs": {
        "nonce": "0",
        "bitmap": "0"
      },
      "expected": {
        "word_position": "0",
        "bit_position": "0",
        "single_nonce_mask": "1",
        "selected_bit": "clear",
        "expected_bitmap_after_or": "1"
      }
    },
    {
      "id": "before-word-boundary",
      "evidence_type": "synthetic",
      "note": "The last bit of word zero.",
      "inputs": {
        "nonce": "255",
        "bitmap": "0"
      },
      "expected": {
        "word_position": "0",
        "bit_position": "255",
        "single_nonce_mask": "57896044618658097711785492504343953926634992332820282019728792003956564819968",
        "selected_bit": "clear",
        "expected_bitmap_after_or": "57896044618658097711785492504343953926634992332820282019728792003956564819968"
      }
    },
    {
      "id": "after-word-boundary",
      "evidence_type": "synthetic",
      "note": "The first bit of word one; a different existing bit is preserved.",
      "inputs": {
        "nonce": "256",
        "bitmap": "2"
      },
      "expected": {
        "word_position": "1",
        "bit_position": "0",
        "single_nonce_mask": "1",
        "selected_bit": "clear",
        "expected_bitmap_after_or": "3"
      }
    },
    {
      "id": "worked-example",
      "evidence_type": "synthetic",
      "note": "Invented example: word one, bit one, existing bits zero and two.",
      "inputs": {
        "nonce": "257",
        "bitmap": "5"
      },
      "expected": {
        "word_position": "1",
        "bit_position": "1",
        "single_nonce_mask": "2",
        "selected_bit": "clear",
        "expected_bitmap_after_or": "7"
      }
    },
    {
      "id": "worked-example-hex",
      "evidence_type": "synthetic",
      "note": "The same invented example in hexadecimal.",
      "inputs": {
        "nonce": "0x101",
        "bitmap": "0x05"
      },
      "expected": {
        "word_position": "1",
        "bit_position": "1",
        "single_nonce_mask": "2",
        "selected_bit": "clear",
        "expected_bitmap_after_or": "7"
      }
    },
    {
      "id": "already-set",
      "evidence_type": "synthetic",
      "note": "Repeating OR with a set bit changes nothing.",
      "inputs": {
        "nonce": "257",
        "bitmap": "7"
      },
      "expected": {
        "word_position": "1",
        "bit_position": "1",
        "single_nonce_mask": "2",
        "selected_bit": "set",
        "expected_bitmap_after_or": "7"
      }
    },
    {
      "id": "end-of-second-word",
      "evidence_type": "synthetic",
      "note": "The last bit of word one.",
      "inputs": {
        "nonce": "511",
        "bitmap": "1"
      },
      "expected": {
        "word_position": "1",
        "bit_position": "255",
        "single_nonce_mask": "57896044618658097711785492504343953926634992332820282019728792003956564819968",
        "selected_bit": "clear",
        "expected_bitmap_after_or": "57896044618658097711785492504343953926634992332820282019728792003956564819969"
      }
    },
    {
      "id": "start-of-third-word",
      "evidence_type": "synthetic",
      "note": "The first bit of word two.",
      "inputs": {
        "nonce": "512",
        "bitmap": "0"
      },
      "expected": {
        "word_position": "2",
        "bit_position": "0",
        "single_nonce_mask": "1",
        "selected_bit": "clear",
        "expected_bitmap_after_or": "1"
      }
    },
    {
      "id": "above-number-precision",
      "evidence_type": "synthetic",
      "note": "Exact integers above the JavaScript Number safe-integer boundary.",
      "inputs": {
        "nonce": "9007199254740993",
        "bitmap": "9007199254740993"
      },
      "expected": {
        "word_position": "35184372088832",
        "bit_position": "1",
        "single_nonce_mask": "2",
        "selected_bit": "clear",
        "expected_bitmap_after_or": "9007199254740995"
      }
    },
    {
      "id": "high-word",
      "evidence_type": "synthetic",
      "note": "A high nonce exercises the upper word-position bits.",
      "inputs": {
        "nonce": "1766847064778384329583297500742918515827483896875618958121606201292619777",
        "bitmap": "0"
      },
      "expected": {
        "word_position": "6901746346790563787434755862277025452451108972170386555162524223799296",
        "bit_position": "1",
        "single_nonce_mask": "2",
        "selected_bit": "clear",
        "expected_bitmap_after_or": "2"
      }
    },
    {
      "id": "largest-nonce-empty-word",
      "evidence_type": "synthetic",
      "note": "Maximum uint256 nonce, with an invented empty supplied bitmap.",
      "inputs": {
        "nonce": "115792089237316195423570985008687907853269984665640564039457584007913129639935",
        "bitmap": "0"
      },
      "expected": {
        "word_position": "452312848583266388373324160190187140051835877600158453279131187530910662655",
        "bit_position": "255",
        "single_nonce_mask": "57896044618658097711785492504343953926634992332820282019728792003956564819968",
        "selected_bit": "clear",
        "expected_bitmap_after_or": "57896044618658097711785492504343953926634992332820282019728792003956564819968"
      }
    },
    {
      "id": "largest-nonce-full-word",
      "evidence_type": "synthetic",
      "note": "Maximum uint256 nonce and all bits set.",
      "inputs": {
        "nonce": "115792089237316195423570985008687907853269984665640564039457584007913129639935",
        "bitmap": "115792089237316195423570985008687907853269984665640564039457584007913129639935"
      },
      "expected": {
        "word_position": "452312848583266388373324160190187140051835877600158453279131187530910662655",
        "bit_position": "255",
        "single_nonce_mask": "57896044618658097711785492504343953926634992332820282019728792003956564819968",
        "selected_bit": "set",
        "expected_bitmap_after_or": "115792089237316195423570985008687907853269984665640564039457584007913129639935"
      }
    },
    {
      "id": "largest-hex-inputs",
      "evidence_type": "synthetic",
      "note": "The maximum values in hexadecimal.",
      "inputs": {
        "nonce": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
        "bitmap": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
      },
      "expected": {
        "word_position": "452312848583266388373324160190187140051835877600158453279131187530910662655",
        "bit_position": "255",
        "single_nonce_mask": "57896044618658097711785492504343953926634992332820282019728792003956564819968",
        "selected_bit": "set",
        "expected_bitmap_after_or": "115792089237316195423570985008687907853269984665640564039457584007913129639935"
      }
    }
  ]
}
