Skip to content
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

fix(crypto): raise bignumber maximum #2777

Merged
merged 2 commits into from Jul 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions __tests__/unit/crypto/validation/keywords.test.ts
Expand Up @@ -144,8 +144,8 @@ describe("keyword bignumber", () => {
const validate = ajv.compile(schema);

expect(validate(Number.MAX_SAFE_INTEGER)).toBeTrue();
expect(validate(Number.MAX_SAFE_INTEGER + 1)).toBeFalse();
expect(validate(String(Number.MAX_SAFE_INTEGER) + "100")).toBeFalse();
expect(validate("9223372036854775807")).toBeTrue();
expect(validate("9223372036854775808")).toBeFalse();
});

it("should be ok for number, string and bignumber as input", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/src/validation/keywords.ts
Expand Up @@ -61,7 +61,7 @@ const bignumber = (ajv: Ajv) => {
compile(schema) {
return (data, dataPath, parentObject: any, property) => {
const minimum = typeof schema.minimum !== "undefined" ? schema.minimum : 0;
const maximum = typeof schema.maximum !== "undefined" ? schema.maximum : Number.MAX_SAFE_INTEGER;
const maximum = typeof schema.maximum !== "undefined" ? schema.maximum : "9223372036854775807"; // 8 byte maximum

const bignum = BigNumber.make(data);

Expand Down