Repository navigation
fix: state the encodable range in Cbor.NumberTooLargeError - #675
Open
pucedoteth wants to merge 1 commit into
Open
pucedoteth wants to merge 1 commit into
pucedoteth wants to merge 1 commit into
Conversation
`Cbor.encode` only encodes integers from -4294967296 to 4294967295 (the decoder rejects 64-bit integers), but the error said the number exceeded `Number.MAX_SAFE_INTEGER`. A safe integer such as 2**32 was reported as exceeding a limit it is far below. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L75E8Ap183JW1mDfv8arqR
|
@pucedoteth is attempting to deploy a commit to the Wevm Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been 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.
Cbor.encodeonly encodes integers from-4294967296to4294967295(the 32-bit forms; the decoder rejects 64-bit integers viaCbor.Unsupported64BitIntegerError). Values outside that range throwCbor.NumberTooLargeError, but its message said:so a safe integer such as
2 ** 32, or a millisecond timestamp, was reported as exceedingNumber.MAX_SAFE_INTEGER, a limit it is far below. The encoder's actual cap is already documented inCbor.fuzz.ts("caps positive numbers at0xffffffffand negatives at-0x100000000"); only the message disagreed.The message now states the real range:
The alternative, encoding safe integers with the 8-byte form, would also need
Cbor.decodeto accept 64-bit integers, which it currently rejects on purpose, so I kept this to the message.0x100000000and-0x100000001. It fails without this PR and passes with it.vp checkpasses, and all 178Cbortests pass.