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.
The use of custom classes to enforce signed and unsigned integers of a certain size reduces the readability of the code.
Plus it doesn't make much sense in TypeScript, it feels like trying to add C/Rust fixed-size integers to Typescript
Converting a Felt to
number
andbigint
must be doable:Number(felt)
works as expected becausetoString()
is overridden (see javascript object coercition)BigInt(value: string | number | bigint | boolean): bigint
has a fixed signature, we must define a method to return the bigint value from Felt, which is done byFelt.toBigInt(): bigint
Encoded instructions are defined on 64 bits. We can check that the instruction is indeed a number <$2^{64} - 1$ , as in the python VM , or simply ignore the bits > 64. The encoded instruction is decoded with masks, solely working on the 64 LSBs.
Values from the encoded instructions are truncated with masks of the expected size, there is no need to check that the offsets etc. are of the right size
fromBiased
should be a method of Instruction