Repository navigation
records: recordText checks the push length again (the check had slipped behind a comment) - #17
Merged
Conversation
…ed behind a comment '// minimal push only if (m[3].length !== len * 2 || len > 255) return null;' was one comment, so a record's declared push length was never compared with its data: 6a03 followed by the bytes of 'tally:x' (a 3-byte push, then bytes after it) read as the record 'tally:x'. The check is its own statement again; rules-test covers bytes after the push, bytes missing, and a long push over its length. sidestr-rs's records port has always checked, so the two readers now agree. Co-Authored-By: jjohare <[email protected]>
Contributor
|
Merged, thanks. Checked against the live tally chain first: its 36 non-coinbase OP_RETURN records read identically before and after; the 818 other OP_RETURNs are coinbase commitments (a 36-byte push plus the block signature) which the rules never read as records, and which the fixed reader now correctly returns null for. So no live chain changes meaning. rules-test 32/32 on the PR head. |
jjohare
added a commit
to JavaScriptSolidServer/podkey
that referenced
this pull request
Sep 25, 2026
sidestr/spec#17: recordText's length check had slipped behind a comment, so a script pushing 'tal' with 'ly:x' after the push read as the record 'tally:x'. Only records.mjs changes in Podkey's vendored set; a test holds the vendored reader to the fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
recordTextinsiding/lib/records.mjsnever checks that a push's declared length matches its data. The check is there, but on the same line as a comment:Effect:
6a03followed by the bytes oftally:x(a 3-byte push, then 4 more bytes after it) reads as the recordtally:x. A script that isn't a single push can therefore pass as a tally, an issue or a pool record. It also splits the two readers: sidestr-rs's port ofrecords.mjschecks the length, so a validator on each would read such a transaction differently.Fix: the check is its own statement again.
rules-test.mjsgains one assertion covering bytes after the push, bytes missing, a long push over its length, and a long push of exactly its length (still read).Verified: the records assertions pass against the patched module (round-trip plus the four new cases). I couldn't run the whole
rules-test.mjshere, because it imports blaketestnode from a local checkout path.If a live chain already has an
OP_RETURNwhose push length doesn't match its data, this changes how it reads, so it's worth a look before release.sidestr:dreamlabhas none, since its records were written by sidestr-rs, which never makes one.🤖 Generated by Claude Code