Repository navigation
fix(py-sdk): count extended-slice targets correctly in DynArray 🐛 - #37
Conversation
GenVM PR actionsTick a box to run it (the box unticks itself when handled). Actions only run while the PR has the
Commands
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (3)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
b323d07 to
4df324a
Compare
4df324a to
f9f9a26
Compare
f9f9a26 to
b2283d5
Compare
b2283d5 to
5b582e1
Compare
5b582e1 to
0b03344
Compare
|
thanks for finding a bug, but I am unsure if we can change the hash now, so I am holding this PR for now. I will think more about it |
0b03344 to
41f8b27
Compare
|
Thanks! Landed as-is, executor commit included, on |
What
DynArray.__setitem__with an extended slice (step other than 1) counts its targets as(stop - start) // step, which undercounts whenever(stop - start) % step != 0. The surplus values then fall through to the insert branch, so the array grows and its tail is reordered; with fewer values than targets a bareStopIterationescapes.listrejects a size mismatch on an extended slice withValueError;DynArraysilently deleted or inserted instead.__getitem__and__delitem__already handle these slices correctly; only assignment was affected. The state is wrong the same way on every validator, so this is a contract data-integrity bug rather than a consensus split.Change (executor line v0.3,
runners/genlayer-py-std)storage/dyn_array.py: count targets withlen(range(start, stop, step))and raiseValueErroron a size mismatch for extended slices, matchinglist.tests/test_storage_vec.py: parametrized cases for positive/negative extended slices and the size-mismatch rejection. The existingtest_setitem_slicenever reached this path (it always assigns 5 values and returns early whenlistraises).runners/support/versions/current.nix: refreshedgenlayer-std,py-genlayer,py-genlayer-multihashes.Executor commit: kriss39/genvm-executor@7df2d9c on
pr/v0.3/fix/dynarray-extended-slice(rebased onto the current pinned7e0936a).Verification
runners/genlayer-py-std:pytest tests --ignore=tests/embeddings→ 976 passed, 1 failed (test_render_rejects_malformed_image, PIL not installed in my venv — unrelated). The new cases fail 7/8 on the unpatched code and pass with the fix.list(random get/set/del slice sequences): 1030/3000 mismatches before, 0 after.ruff format/ruff checkclean on the changed files.hash-updater.pyon this machine (no nix, and the repo does not build runners on macOS). Instead I reproduced the content-addressing locally —make-zip.pyunder Python 3.13 over thecleanSource-filteredsrc/plusrunner.json, then theDependsuids for the two wrappers — and confirmed it yields the three hashes currently committed bit-for-bit before applying the same procedure to the patched tree. Please treat the#runners-allnix build as unrun on my side; if it reports a mismatch I will update from thegot:values.v0.2.x does not vendor the Python runner sources, so no
pr/v0.2/...branch.Independent of the other two PRs I opened today; whichever
current.nixchange lands second I will rebase and recompute.