mirror of
https://github.com/paradigmxyz/solidity-lean.git
synced 2026-11-15 19:56:39 +00:00
A `mapping(string => V)` (or bytes-keyed mapping) indexed with a BARE state `string`/`bytes`/array variable — `m[k]` — is a value-use boundary: the key CONTENTS feed the value-slot hash `keccak256(keyBytes . slot)` (mappingStorageSlotForKey, key type bytesCalldata). A bare state string lowers to `Expr.storage key`, whose eval is the HEADER word (the `.length` convention); as the mapping index that word fed the hash and hit the `StorageLayout.string`/`asBytes? = none` path → RevertData.typeMismatch = Panic(0), thrown at the very first `m[k] = 123` write. solc+EVM copies the storage string to memory before deriving the slot, so `m[k]` and `m["lit"]` alias the SAME slot. Fix mirrors the other value-use boundaries (#4 abi.decode, #5 ternary, #6 tuple-RHS, #7 emit, #8 revert-custom-error): the storageIndex read/write lowering arms now wrap the key core with materializeStorageValueUseCore (`Expr.storage key` -> `Expr.storagePath key []`), reading full contents. Scalar keys load identically through either form; every other core shape passes through untouched. Witness SolidCore/Witness/MappingKeyStorageString: run() => 246 (was Panic(0)). Co-authored-by: Lean Semantics Review Agent <agent@solidcore.local> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
122 lines
4.5 KiB
122 lines
4.5 KiB