-
Notifications
You must be signed in to change notification settings - Fork 79
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/new types #296
Closed
Closed
Feat/new types #296
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
31dbece
fix: update Lib for new ebool type
immortal-tofu 71ddad9
fix: fix ebool_t
immortal-tofu b511101
feat: add 4bits
immortal-tofu 7b4669f
fix: fix boolean encryption on client side
immortal-tofu 9386803
fix: convert bool to euint8 for optReq
immortal-tofu 42de399
feat: add generator for overloads and implement 4bits tests
immortal-tofu c755940
fix: fix all tests
immortal-tofu b6b4398
fix: remove remaining .only
immortal-tofu 117ce9c
fix: force bigint for result potentially big
immortal-tofu a798189
fix: add bigint support for inputs
immortal-tofu 9212a32
fix: fix typo and add test for cast ebool from euint4 and euint8
immortal-tofu c0ec02a
fix: change strategy for random number
immortal-tofu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,29 @@ | ||
import overloads from './overloads.json'; | ||
import { OverloadSignature, signatureContractMethodName } from './testgen'; | ||
|
||
type OverloadTest = { | ||
inputs: number[]; | ||
type OverloadTestJSON = { | ||
inputs: (number | bigint | string)[]; | ||
output: boolean | number | bigint | string; | ||
}; | ||
const transformBigInt = (o: { [methodName: string]: OverloadTest[] }) => { | ||
|
||
type OverloadTest = { | ||
inputs: (number | bigint)[]; | ||
output: boolean | number | bigint; | ||
}; | ||
|
||
const transformBigInt = (o: { [methodName: string]: OverloadTestJSON[] }) => { | ||
Object.keys(o).forEach((k) => { | ||
o[k].forEach((test) => { | ||
test.inputs.forEach((input, i) => { | ||
if (typeof input === 'string') test.inputs[i] = BigInt(input); | ||
}); | ||
if (typeof test.output === 'string') test.output = BigInt(test.output); | ||
}); | ||
}); | ||
}; | ||
|
||
transformBigInt(overloads); | ||
|
||
export const overloadTests: { [methodName: string]: OverloadTest[] } = overloads; | ||
export const overloadTests: { [methodName: string]: OverloadTest[] } = overloads as unknown as { | ||
[methodName: string]: OverloadTest[]; | ||
}; |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure to understand why you would need the safeMin to be true here, if I understand this would mean that you force the output to be of type the lowest bitwidth of inputs, but this is not needed here, because you can indeed sum a euint8 with a euint64 and result would be a euint64
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, but the codegen expects a uint8 result, otherwise it fails. I think this is a mistake in the
testgen.ts
but I don't want to touch it now.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weird