-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Amounts #114
Merged
Merged
feat: Amounts #114
Conversation
This file contains 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
Code compiles but tests fail (fixed in a later commit). Co-authored-by: Thorkil Værge <[email protected]> Co-authored-by: Ferdinand Sauer <[email protected]>
In `get_swbf_indices`, the input was padded explicitly (!) before calling `pad_and_absorb_all`, resulting in a double pad. The output of this function disagreed with the tasm-lib snippet.
The motivation for this struct is to have something to implement `SecretWitness` for, which supplies the interface towards running the VM on (and, at a later stage, proving) the right program.
Internally `NeptuneCoins` represented amounts as `U32s<4>`. This commit changes that internal representation to `u128`. Also, it adds a function `safe_add` which returns `None` if the result sets the most significant bit.
Using `safe_add` as opposed to `+` catches overflows, which could lead to inflation bugs.
Also: fix bug in amounts balancer.
This closes #113.
|
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.
Amounts and amount logic are quite important in the design of a currency. This PR:
NativeCurrency
that verifies that transactions are balanced, i.e., do not generate new coins or have negative outputs.tasm-lib
.NeptuneCoins
amounts: it now uses au128
rather than aU32s<NUM_LIMBS>
.