Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Don't allow negative numbers to be used as Quantity #2728

Closed
MicaiahReid opened this issue Mar 28, 2022 · 2 comments · Fixed by #2983
Closed

Don't allow negative numbers to be used as Quantity #2728

MicaiahReid opened this issue Mar 28, 2022 · 2 comments · Fixed by #2983
Labels
bug json-rpc refactor Used to group issues to reference when refactoring the json-rpc files priority3 🔧

Comments

@MicaiahReid
Copy link
Contributor

Don't do it!

@MicaiahReid
Copy link
Contributor Author

MicaiahReid commented Mar 29, 2022

This TODO and four other similar TODOs on the same file need to be fixed once this is merged: https://github.com/trufflesuite/ganache/pull/2565/files#diff-7c45b1ed67b5ed69774d3ae2bf54711bd5fd4522eccff16f7e8d6a16f6dd582aR484

@jeffsmale90
Copy link
Contributor

There's a couple of todos here #2716 also.

@MicaiahReid MicaiahReid added the json-rpc refactor Used to group issues to reference when refactoring the json-rpc files label Mar 30, 2022
jeffsmale90 added a commit that referenced this issue May 27, 2022
…e error message for Quantity with 0x value
jeffsmale90 added a commit that referenced this issue Jun 1, 2022
…e error message for Quantity with 0x value
jeffsmale90 added a commit that referenced this issue Jun 7, 2022
…e error message for Quantity with 0x value
jeffsmale90 added a commit that referenced this issue Jun 15, 2022
…e error message for Quantity with 0x value
jeffsmale90 added a commit that referenced this issue Jun 15, 2022
* perf: Refactor json rpc data classes to improve performance and maintainability. Minimal changes to exposed API.

* Use static Quantity / Data .toType methods throughout codebase

* Tidy ups and improvements

* Replace noop parsers with explicit noopParseAndValidate - add docs comments to input-parsers.ts

* Tidy up JSON-RPC classes

* Make the json-rpc-types even better - changes to review

* Move JSON RPC type constants to static properties

* Implement todos in call.test.ts pending #2725 #2728 #2857, and improve error message for Quantity with 0x value

* fixes for review, remove 'toStringTag's in JSON-RPC types.

* Fix toValidLengthAddress to correctly throw if input is incorrect length. Treat empty buffer as null. Move selection of parseAndValidate function into BaseJsonRpcType. Return "0x" for null Data types.

* Small tidy ups

* Tidy ups as per review. Reinstated a couple of skipped tests, return null exclusively from toString / Buffer / etc when value isNull, don't accept Data as argument to Data, add specific test ta
rgetting #2857 validation

* Change validation message to be more sensible, rename some tests to be more clear

* Add coverage for Quantity.isNull(), Data.isNull(). Re-add skipped test cases in call.test.ts.

* Tidy ups per review - improved validation messages for string inputs to JSON-rpc data classes

* Prettier modified files
jeffsmale90 added a commit that referenced this issue Jun 15, 2022
…e error message for Quantity with 0x value
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug json-rpc refactor Used to group issues to reference when refactoring the json-rpc files priority3 🔧
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants