Repository navigation
fix: address compiler findings from the 0.14 audit - #452
Merged
Merged
Conversation
- Fix LockingBytecodeNullData push opcodes for empty chunks and chunks of 128-255 bytes, which did not match the SDK's OP_RETURN encoding. Literal chunks are now pushed together with their push opcode, and literal chunks larger than 255 bytes are a compile error - Fix tuple reassignment bypassing bytes length narrowing, e.g. `x, bytes rest = y.split(5);` after `require(x.length == 20);` - Make hex literals with an odd number of digits a compile error - Remove the early return TODO in EnsureFinalRequireTraversal (tracked in #416 and #424) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #452 +/- ##
==========================================
+ Coverage 88.63% 88.76% +0.13%
==========================================
Files 61 61
Lines 4980 5012 +32
Branches 920 927 +7
==========================================
+ Hits 4414 4449 +35
+ Misses 436 433 -3
Partials 130 130 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…odes
String literal chunks (e.g. `bytes('memo')`) are pushed together with their
push opcode like hex literals, and chunks with a known length (e.g. bytes20)
are preceded by a constant push opcode. The push opcode is only computed at
runtime for chunks with an unknown length. Chunks whose size is known to be
larger than 255 bytes are a compile error.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
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.
Fixes the remaining compiler findings from the 0.14 audit (follow-up items 1, 2 and 7.1, and the early return TODO from the first review's item 6).
Changes
LockingBytecodeNullDatapush opcodes: the push opcode of a chunk was built fromOP_SIZE, which is a signed VM number. Empty chunks therefore got no push opcode (a bare6ainstead of the SDK's6a4c00), and chunks of 128-255 bytes got a malformed4c <size> 00prefix. The generated script now matchesencodeNullDataScript()(and soaddOpReturnOutput()) for every chunk size up to 255 bytes:bytes('memo')) are pushed together with their push opcode as a single constant.bytes20) are preceded by a constant push opcode.OP_PUSHDATA1for empty chunks and chunks of 76-255 bytes.NullDataChunkTooLargeError).LockingBytecodeNullData.require(x.length == 20),x, bytes rest = y.split(5);keptxtyped asbytes20while it held 5 bytes. Tuple reassignment targets are now checked against their current (narrowed) type, like plain assignments.0x123was silently compiled to0x1203and is now a compile error. Test contracts that used odd-length literals were updated without changing their bytes.EnsureFinalRequireTraversal, early and conditional returns are tracked in Consider allowing conditional returns (multi returns) in user-defined reusable functions #416 and Allow for passing through multiple return values from a function return #424.LockingBytecodeNullDatachunk encoding and release notes.Tests
bytesNchunks, odd-length hex literals and the tuple reassignment narrowing bypass, newtuple_reassignment_narrowing.cashandlocking_bytecode_nulldata_chunks.cashfixtures, and updated fixtures forannouncement.cashand the contracts whose hex literals changed.yarn build,yarn test,yarn lintandyarn spellcheckpass.🤖 Generated with Claude Code