You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bump rain-lib-memkv to 0.2.0: fingerprint the stateKV contents, not the handle word #585
rainlang pins rain-lib-memkv 0.1.5. rain.lib.memkv 0.2.0 (rainlanguage/rain.lib.memkv#166, closes rainlanguage/rain.lib.memkv#13) changes what a MemoryKV handle is. It is now the address of a 16-word header in memory instead of a packed word of 16-bit head pointers and a count. That removes the 64 KiB ceiling. A store can now grow past 0xFFFF instead of reverting MemoryKVOverflow. Function signatures, MEMORY_KV_EMPTY and the export pair order are unchanged. Two behaviours change:
Copies of a non-empty handle are one store: inserts and updates show through every copy, and only the empty handle branches.
After the first insert the handle word stops changing, so anything that hashes or compares the handle no longer sees inserts.
test/lib/state/LibInterpreterStateFingerprint.sol hashes abi.encode(state), which includes the stateKV handle word. On 0.2.0 an insert into a non-empty stateKV leaves the fingerprint unchanged. Updates were already invisible to it on 0.1.5.
rainlang main 5874169 with 0.2.0's LibMemoryKV.sol swapped into the 0.1.5 dependency path gives the same per-test pass/fail set as 0.1.5: 1492 pass, and the same 6 RPC-dependent constructor failures. No rainlang source copies, branches or restores a handle. Every use goes through state.stateKV and is assigned back: LibOpSet, the LibOpGet miss cache, the BaseRainlangInterpreter.eval4 overlay, the LibEval export, and the init in LibInterpreterStateDataContract.
A probe built on the real LibOpSet.run and the real fingerprint helper passes on 0.1.5 and fails on 0.2.0 at "fingerprint must move on an insert into a non-empty stateKV". No existing rainlang test observes this, because every opReferenceCheck starts from an empty stateKV.
Every rainlang test with a fixed gas figure that changed got cheaper; none got more expensive. Rainterpreter deploy gas fell by 107375.
Proposed fix
Bump rain-lib-memkv to 0.2.0 in foundry.toml and soldeer.lock, and rewrite the versioned import prefix rain-lib-memkv-0.1.5/ to the new one.
LibInterpreterStateFingerprint: hash the store's contents, for example stateKV.toBytes32Array(), instead of the handle word, so an insert into a non-empty store moves the fingerprint.
Update the gas figures that moved.
The Rainterpreter runtime bytecode changes, so the release needs a new deploy through rainlang.deploy. raindex, rain.erc4626.words, rain.flare, rain.merkle and rain.pyth pin rain-lib-memkv next to rainlang, and bump both together.
Activity