aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-07-27 13:09:55 +0800
committerGitHub <noreply@github.com>2018-07-27 13:09:55 +0800
commit554d5f97df55779beed35ef73214e80b386d7927 (patch)
treeeaf73ce6cbd61d96d541c08d7e2d640f02f32083 /packages/utils
parent95c627f581ec8d724a0c737cbbf5b53b96765f6e (diff)
downloaddexon-0x-contracts-554d5f97df55779beed35ef73214e80b386d7927.tar.gz
dexon-0x-contracts-554d5f97df55779beed35ef73214e80b386d7927.tar.zst
dexon-0x-contracts-554d5f97df55779beed35ef73214e80b386d7927.zip
Add combinatorial tests for internal Exchange functions (#807)
* WIP add combinatorial tests for internal Exchange functions * Change combinitorial testing strategy based on feedback * Check value of filled[orderHash] in updateFilledState tests * Add combinatorial tests for addFillResults * Add combinatorial tests for getPartialAmount * Implement generic `testWithReferenceFuncAsync` * Implement generic `testCombinatoriallyWithReferenceFuncAsync` * Add combinatorial tests for isRoundingError * Add combinatorial tests for calculateFillResults * Add support for Geth in internal contract tests * Fix contract artifacts * Change DECIMAL_PLACES to 78 and add a note. * Document new functions in utils * Optimize tests by only reseting state when needed * Rename/move some files * Print parameter names on failure in testWithReferenceFuncAsync * Add to changelog for utils package * Appease various linters * Rename some more things related to FillOrderCombinatorialUtils * Remove .only from test/exchange/internal.ts * Remove old test for isRoundingError and getPartialAmount * Appease linters again * Remove old todos * Fix typos, add comments, rename some things * Re-add some LibMath tests * Update contract internal tests to use new SafeMath revert reasons * Apply PR feedback from Amir * Apply PR feedback from Remco * Re-add networks to ZRXToken artifact * Remove duplicate Whitelist in compiler.json
Diffstat (limited to 'packages/utils')
-rw-r--r--packages/utils/CHANGELOG.json9
-rw-r--r--packages/utils/src/configured_bignumber.ts9
2 files changed, 16 insertions, 2 deletions
diff --git a/packages/utils/CHANGELOG.json b/packages/utils/CHANGELOG.json
index c5f82d73b..8abfbaf43 100644
--- a/packages/utils/CHANGELOG.json
+++ b/packages/utils/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "1.0.5",
+ "changes": [
+ {
+ "note": "Increased BigNumber decimal precision from 20 to 78",
+ "pr": 807
+ }
+ ]
+ },
+ {
"timestamp": 1532619515,
"version": "1.0.4",
"changes": [
diff --git a/packages/utils/src/configured_bignumber.ts b/packages/utils/src/configured_bignumber.ts
index e44c062c2..2b22b6938 100644
--- a/packages/utils/src/configured_bignumber.ts
+++ b/packages/utils/src/configured_bignumber.ts
@@ -1,9 +1,14 @@
import { BigNumber } from 'bignumber.js';
-// By default BigNumber's `toString` method converts to exponential notation if the value has
-// more then 20 digits. We want to avoid this behavior, so we set EXPONENTIAL_AT to a high number
BigNumber.config({
+ // By default BigNumber's `toString` method converts to exponential notation if the value has
+ // more then 20 digits. We want to avoid this behavior, so we set EXPONENTIAL_AT to a high number
EXPONENTIAL_AT: 1000,
+ // Note(albrow): This is the lowest value for which
+ // `x.div(y).floor() === x.divToInt(y)`
+ // for all values of x and y <= MAX_UINT256, where MAX_UINT256 is the
+ // maximum number represented by the uint256 type in Solidity (2^256-1).
+ DECIMAL_PLACES: 78,
});
export { BigNumber };