{
  "schemaVersion": 1,
  "article": {
    "wpId": 6046,
    "permalink": "/archives/6046",
    "sourceIssue": 188
  },
  "checkedAt": "2026-08-31",
  "localFixture": {
    "externalRpc": false,
    "mainnetFork": false,
    "realWallet": false,
    "userPrivateKey": false,
    "publicTransactionBroadcast": false,
    "realAsset": false,
    "environment": {
      "foundry": "1.8.0",
      "foundryCommit": "61ae26af36320d4fa1020f7db53785885e29eeb5",
      "foundryArchiveSha256": "0599b28a19af97c3ae91fab12ad868a1922db7770c4adff6b6d26235862153d0",
      "solidity": "0.8.36",
      "openzeppelinUpgradesCore": "1.46.0",
      "viem": "2.56.0",
      "evmVersion": "cancun",
      "chainId": 31347,
      "optimizer": true,
      "optimizerRuns": 200,
      "fuzzRuns": 256,
      "seed": "0x6046604660466046604660466046604660466046604660466046604660466046"
    },
    "tests": {
      "status": "pass",
      "foundryUnitTestCount": 10,
      "foundryUnitTests": [
        "testRootMatchesFormulaAndIsAlignedTo256Slots",
        "testTraditionalSafeAppendPreservesStateAcrossUpgrade",
        "testTraditionalReorderCorruptsPackedMeaning",
        "testTraditionalTypeChangeShiftsFollowingSlots",
        "testGapCanBeConsumedOnlyWhenTheReservedArrayShrinks",
        "testNamespacedSafeAppendPreservesStateAndUsesRootOffsets",
        "testNamespacedReorderAndTypeChangeRemainUnsafeInsideOneNamespace",
        "testNamespaceTypoMovesReadsToAnotherEmptyTree",
        "testDuplicateNamespaceIdsAliasTheSameSlot",
        "testLibraryAnnotationsDoNotPreventManualRootCollision"
      ],
      "upgradesCoreValidationCount": 10,
      "viemAnvilLifecycleCount": 1
    },
    "compilerLayouts": {
      "traditionalV1": [
        {
          "label": "owner",
          "slot": "0",
          "offset": 0,
          "type": "address"
        },
        {
          "label": "limit",
          "slot": "0",
          "offset": 20,
          "type": "uint96"
        },
        {
          "label": "points",
          "slot": "1",
          "offset": 0,
          "type": "uint256"
        }
      ],
      "traditionalV2Safe": [
        {
          "label": "owner",
          "slot": "0",
          "offset": 0,
          "type": "address"
        },
        {
          "label": "limit",
          "slot": "0",
          "offset": 20,
          "type": "uint96"
        },
        {
          "label": "points",
          "slot": "1",
          "offset": 0,
          "type": "uint256"
        },
        {
          "label": "nonce",
          "slot": "2",
          "offset": 0,
          "type": "uint256"
        }
      ],
      "traditionalV2Reordered": [
        {
          "label": "limit",
          "slot": "0",
          "offset": 0,
          "type": "uint96"
        },
        {
          "label": "owner",
          "slot": "0",
          "offset": 12,
          "type": "address"
        },
        {
          "label": "points",
          "slot": "1",
          "offset": 0,
          "type": "uint256"
        }
      ],
      "traditionalV2TypeChanged": [
        {
          "label": "owner",
          "slot": "0",
          "offset": 0,
          "type": "bytes32"
        },
        {
          "label": "limit",
          "slot": "1",
          "offset": 0,
          "type": "uint96"
        },
        {
          "label": "points",
          "slot": "2",
          "offset": 0,
          "type": "uint256"
        }
      ],
      "gapV1": [
        {
          "label": "value",
          "slot": "0",
          "offset": 0,
          "type": "uint256"
        },
        {
          "label": "__gap",
          "slot": "1",
          "offset": 0,
          "type": "uint256[49]"
        }
      ],
      "gapV2Safe": [
        {
          "label": "value",
          "slot": "0",
          "offset": 0,
          "type": "uint256"
        },
        {
          "label": "added",
          "slot": "1",
          "offset": 0,
          "type": "uint256"
        },
        {
          "label": "__gap",
          "slot": "2",
          "offset": 0,
          "type": "uint256[48]"
        }
      ],
      "note": "Solidity standard storageLayout lists declared state variables; ERC-7201 struct roots are represented below and validated from AST annotations by Upgrades Core."
    },
    "namespacedLayouts": {
      "namespaceId": "mikan.storage.Main",
      "root": "0x351e99d536f6929a0d7758896402b97bf95ac2715119a5c4fc2bfc39425ad500",
      "v1": [
        {
          "label": "owner",
          "relativeSlot": 0,
          "offset": 0,
          "type": "address"
        },
        {
          "label": "limit",
          "relativeSlot": 0,
          "offset": 20,
          "type": "uint96"
        },
        {
          "label": "points",
          "relativeSlot": 1,
          "offset": 0,
          "type": "uint256"
        }
      ],
      "v2Safe": [
        {
          "label": "owner",
          "relativeSlot": 0,
          "offset": 0,
          "type": "address"
        },
        {
          "label": "limit",
          "relativeSlot": 0,
          "offset": 20,
          "type": "uint96"
        },
        {
          "label": "points",
          "relativeSlot": 1,
          "offset": 0,
          "type": "uint256"
        },
        {
          "label": "nonce",
          "relativeSlot": 2,
          "offset": 0,
          "type": "uint256"
        }
      ]
    },
    "validationMatrix": [
      {
        "contract": "TraditionalV2Safe",
        "reference": "TraditionalV1",
        "expected": "pass",
        "needle": "SUCCESS",
        "observedExitCode": 0
      },
      {
        "contract": "GapV2Safe",
        "reference": "GapV1",
        "expected": "pass",
        "needle": "SUCCESS",
        "observedExitCode": 0
      },
      {
        "contract": "NamespacedV2Safe",
        "reference": "NamespacedV1",
        "expected": "pass",
        "needle": "SUCCESS",
        "observedExitCode": 0
      },
      {
        "contract": "TraditionalV2Reordered",
        "reference": "TraditionalV1",
        "expected": "fail",
        "needle": "Deleted `owner`",
        "observedExitCode": 1
      },
      {
        "contract": "TraditionalV2TypeChanged",
        "reference": "TraditionalV1",
        "expected": "fail",
        "needle": "Bad upgrade from address to bytes32",
        "observedExitCode": 1
      },
      {
        "contract": "NamespacedV2Reordered",
        "reference": "NamespacedV1",
        "expected": "fail",
        "needle": "Deleted `owner`",
        "observedExitCode": 1
      },
      {
        "contract": "NamespacedV2TypeChanged",
        "reference": "NamespacedV1",
        "expected": "fail",
        "needle": "Bad upgrade from address to bytes32",
        "observedExitCode": 1
      },
      {
        "contract": "NamespacedV2Typo",
        "reference": "NamespacedV1",
        "expected": "fail",
        "needle": "Deleted namespace `erc7201:mikan.storage.Main`",
        "observedExitCode": 1
      },
      {
        "contract": "DuplicateNamespaceHost",
        "expected": "fail",
        "needle": "DuplicateNamespaceError",
        "observedExitCode": 1
      },
      {
        "contract": "LibraryCollisionHost",
        "expected": "pass-with-warning",
        "needle": "Namespace struct Layout is defined outside of a contract",
        "observedExitCode": 0
      }
    ],
    "observation": {
      "chainId": 31347,
      "account": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
      "namespace": {
        "id": "mikan.storage.Main",
        "firstHash": "0x46ac441a23a08b973b966e62f20dded380a4e784563a30482e8bc9827dd72612",
        "root": "0x351e99d536f6929a0d7758896402b97bf95ac2715119a5c4fc2bfc39425ad500",
        "alignedTo256Slots": true,
        "typoId": "mikan.storage.Mian",
        "typoRoot": "0x2a2faa7b8b284411dad3c4b390dfa4621dc55ce9306dc4c5c01e9cdd87c40900"
      },
      "traditional": {
        "proxy": "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
        "implementationV1": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
        "implementationV2Safe": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
        "before": {
          "slot0": "0x000000000000000000003039f39fd6e51aad88f6f4ce6ab8827279cfffb92266",
          "slot1": "0x000000000000000000000000000000000000000000000000000000003ade68b1"
        },
        "after": {
          "owner": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
          "limit": "12345",
          "points": "987654321",
          "nonce": "77",
          "slot0": "0x000000000000000000003039f39fd6e51aad88f6f4ce6ab8827279cfffb92266",
          "slot1": "0x000000000000000000000000000000000000000000000000000000003ade68b1",
          "slot2": "0x000000000000000000000000000000000000000000000000000000000000004d"
        }
      },
      "namespaced": {
        "proxy": "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6",
        "implementationV1": "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707",
        "implementationV2Safe": "0x0165878A594ca255338adfa4d48449f69242Eb8F",
        "before": {
          "slot0": "0x0000000000000000000000000000000000000000000000000000000000000000",
          "root": "0x000000000000000000003039f39fd6e51aad88f6f4ce6ab8827279cfffb92266",
          "rootPlus1": "0x000000000000000000000000000000000000000000000000000000003ade68b1",
          "rootPlus2": "0x0000000000000000000000000000000000000000000000000000000000000000"
        },
        "after": {
          "owner": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
          "limit": "12345",
          "points": "987654321",
          "nonce": "77",
          "root": "0x000000000000000000003039f39fd6e51aad88f6f4ce6ab8827279cfffb92266",
          "rootPlus1": "0x000000000000000000000000000000000000000000000000000000003ade68b1",
          "rootPlus2": "0x000000000000000000000000000000000000000000000000000000000000004d"
        }
      },
      "namespaceTypo": {
        "proxy": "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e",
        "implementation": "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853",
        "ownerAtTypoRoot": "0x0000000000000000000000000000000000000000",
        "pointsAtTypoRoot": "0",
        "mainRootStillPresent": "0x000000000000000000003039f39fd6e51aad88f6f4ce6ab8827279cfffb92266",
        "typoRootValue": "0x0000000000000000000000000000000000000000000000000000000000000000"
      }
    }
  },
  "fixedConclusions": {
    "formula": "erc7201(id) is keccak256(abi.encode(uint256(keccak256(bytes(id))) - 1)) with the low 8 bits cleared",
    "alignment": "the tested namespace root is aligned to a 256-slot boundary",
    "compiler": "the NatSpec annotation is present in compiler AST output but Solidity does not enforce that assembly uses the annotated root",
    "safeAddition": "appending nonce after existing namespace fields preserves owner, limit and points in the local proxy state",
    "unsafeChanges": "reordering packed fields or changing address to bytes32 is rejected by Upgrades Core and changes runtime interpretation",
    "typo": "changing the namespace id moves reads to a different root while the old root remains populated",
    "duplicate": "duplicate namespace ids are rejected by Upgrades Core and manually assigning both structs to one root aliases state",
    "libraryBoundary": "namespace structs defined outside contracts are warned about and excluded from Upgrades Core namespace validation",
    "proxyBoundary": "ERC-7201 organizes delegatecall storage but does not define implementation discovery, upgrade authorization or migration execution"
  },
  "limits": [
    "This local fixture does not prove that a production upgrade, proxy admin, initializer or migration is safe.",
    "The Solidity storageLayout JSON format is experimental and may change in non-breaking compiler releases.",
    "Tool validation depends on complete build info, reference contracts, supported compiler output and annotations inside contract inheritance.",
    "UUPS, Transparent, Beacon and Diamond routing or authorization must be reviewed separately from namespace field compatibility.",
    "No public RPC, mainnet fork, browser wallet, user key, public transaction or real asset is used."
  ]
}
