Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Conversation

dorothy-zbornak
Copy link
Contributor

@dorothy-zbornak dorothy-zbornak commented Jan 31, 2020

This is the third in a series of PRs that splits #2456 into more manageable pieces.

Description

Chill, most of these files are just regenerated artifacts/wrappers.

@0x/contracts-dev-utils:

  • Refactors components of the DevUtils contract into public libraries, which get linked at deployment time.
  • Deletes the standalone LibTransactionDecoder contract that was introduced in Fix regression in DevUtils #2449 and folds it back into DevUtils.
  • Adds allowance() and balanceOf() to LibERC20Token.
  • Adds a _getTransferableConvertedMakerAssetAmount(), which currently just wraps _getTransferableAssetAmount(), but will be used for dydx maker assets in the next PR. This is necessary because dydx validation depends on the taker asset as well as the maker asset.

@0x/migrations:

  • Migrations now uses the contract artifacts instead of @0x/contract-wrappers, even for ganache migrations.

Testing instructions

Types of changes

Checklist:

  • Prefix PR title with [WIP] if necessary.
  • Add tests to cover changes as needed.
  • Update documentation as needed.
  • Add new entries to the relevant CHANGELOG.jsons.

@dorothy-zbornak dorothy-zbornak force-pushed the feat/contracts/dev-utils/public-libraries-refactor branch from 1223e1a to 68241ca Compare January 31, 2020 22:52
@buildsize
Copy link

buildsize bot commented Jan 31, 2020

File name Previous Size New Size Change
init.py 60.43 KB 60.43 KB 0 bytes (0%)
abi_gen_dummy.ts 99.36 KB [deleted]
lib_dummy.ts 11.53 KB [deleted]
test_lib_dummy.ts 15.64 KB [deleted]
environment.pickle 1.72 MB 1.72 MB 0 bytes (0%)
index.doctree 436.61 KB 436.61 KB 0 bytes (0%)
.buildinfo 230 bytes 230 bytes 0 bytes (0%)
genindex.html 31.42 KB 31.42 KB 0 bytes (0%)
index.html 4.69 KB 4.69 KB 0 bytes (0%)
objects.inv 1 KB 1 KB 0 bytes (0%)
py-modindex.html 3.07 KB 3.07 KB 0 bytes (0%)
search.html 2.84 KB 2.84 KB 0 bytes (0%)
searchindex.js 11.97 KB 11.97 KB 0 bytes (0%)
index.rst.txt 2.22 KB 2.22 KB 0 bytes (0%)
alabaster.css 10.92 KB 10.92 KB 0 bytes (0%)
basic.css 11.97 KB 11.97 KB 0 bytes (0%)
custom.css 42 bytes 42 bytes 0 bytes (0%)
doctools.js 9.05 KB 9.05 KB 0 bytes (0%)
documentation_options.js 324 bytes 324 bytes 0 bytes (0%)
file.png 286 bytes 286 bytes 0 bytes (0%)
jquery-[version].js 273.79 KB 273.79 KB 0 bytes (0%)
jquery.js 86.08 KB 86.08 KB 0 bytes (0%)
language_data.js 10.59 KB 10.59 KB 0 bytes (0%)
minus.png 90 bytes 90 bytes 0 bytes (0%)
plus.png 90 bytes 90 bytes 0 bytes (0%)
pygments.css 4.69 KB 4.69 KB 0 bytes (0%)
searchtools.js 15.65 KB 15.65 KB 0 bytes (0%)
underscore-[version].js 34.34 KB 34.34 KB 0 bytes (0%)
underscore.js 11.86 KB 11.86 KB 0 bytes (0%)
contract_addresses.html 16.8 KB 16.8 KB 0 bytes (0%)
contract_artifacts.html 8.24 KB 8.24 KB 0 bytes (0%)
json_schemas.html 12.56 KB 12.56 KB 0 bytes (0%)
order_utils.html 47.16 KB 47.16 KB 0 bytes (0%)
erc20_token.html 93.56 KB 93.56 KB 0 bytes (0%)
exchange.html 730.72 KB 730.72 KB 0 bytes (0%)
tx_params.html 9.41 KB 9.41 KB 0 bytes (0%)
local_message_signer.html 15.08 KB 15.08 KB 0 bytes (0%)
asset_data_utils.html 22.66 KB 22.66 KB 0 bytes (0%)
asset_proxy_owner.html 337.39 KB 337.39 KB 0 bytes (0%)
coordinator.html 128.72 KB 128.72 KB 0 bytes (0%)
coordinator_registry.html 39.59 KB 39.59 KB 0 bytes (0%)
dutch_auction.html 66.13 KB 66.13 KB 0 bytes (0%)
erc20_proxy.html 111.83 KB 111.83 KB 0 bytes (0%)
erc721_proxy.html 111.95 KB 111.95 KB 0 bytes (0%)
erc721_token.html 150.2 KB 150.2 KB 0 bytes (0%)
forwarder.html 130.08 KB 130.08 KB 0 bytes (0%)
i_asset_proxy.html 40.18 KB 40.18 KB 0 bytes (0%)
i_validator.html 27.06 KB 27.06 KB 0 bytes (0%)
i_wallet.html 24.9 KB 24.9 KB 0 bytes (0%)
multi_asset_proxy.html 146.81 KB 146.81 KB 0 bytes (0%)
order_validator.html 107.69 KB 107.69 KB 0 bytes (0%)
weth9.html 133.39 KB 133.39 KB 0 bytes (0%)
zrx_token.html 107.61 KB 107.61 KB 0 bytes (0%)
dev_utils.html 593.43 KB 488.08 KB -105.35 KB (18%)
types.html 8.54 KB 8.54 KB 0 bytes (0%)
erc1155_mintable.html 276.51 KB 276.51 KB 0 bytes (0%)
erc1155_proxy.html 133.15 KB 133.15 KB 0 bytes (0%)
static_call_proxy.html 34.04 KB 34.04 KB 0 bytes (0%)
relayer_api.html 113.37 KB 113.37 KB 0 bytes (0%)
relayer_api_asset_data_pairs_response_schema.html 13.86 KB 13.86 KB 0 bytes (0%)
relayer_api_asset_data_trade_info_schema.html 23.09 KB 23.09 KB 0 bytes (0%)
relayer_api_error_response_schema.html 19.74 KB 19.74 KB 0 bytes (0%)
relayer_api_error_response_schema_validation_errors.html 19.92 KB 19.92 KB 0 bytes (0%)
relayer_api_fee_recipients_response_schema.html 13.83 KB 13.83 KB 0 bytes (0%)
relayer_api_order_config_payload_schema.html 39.52 KB 39.52 KB 0 bytes (0%)
relayer_api_order_config_response_schema.html 25.23 KB 25.23 KB 0 bytes (0%)
relayer_api_order_schema.html 15.88 KB 15.88 KB 0 bytes (0%)
relayer_api_orderbook_response_schema.html 16.2 KB 16.2 KB 0 bytes (0%)
relayer_api_orders_channel_subscribe_payload_schema.html 35.06 KB 35.06 KB 0 bytes (0%)
relayer_api_orders_channel_subscribe_schema.html 22.98 KB 22.98 KB 0 bytes (0%)
relayer_api_orders_channel_update_schema.html 22.83 KB 22.83 KB 0 bytes (0%)
relayer_api_orders_response_schema.html 13.75 KB 13.75 KB 0 bytes (0%)
signed_order_schema.html 14.36 KB 14.36 KB 0 bytes (0%)

@dorothy-zbornak dorothy-zbornak force-pushed the feat/contracts/dev-utils/public-libraries-refactor branch 2 times, most recently from a6d8043 to 3947d37 Compare January 31, 2020 23:45
@dorothy-zbornak dorothy-zbornak marked this pull request as ready for review January 31, 2020 23:46
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 79.563% when pulling 3947d37 on feat/contracts/dev-utils/public-libraries-refactor into 80c58ce on feat/abi-gen/library-linking.

@@ -28,6 +32,18 @@ import { SupportedProvider, TxData } from 'ethereum-types';
import { constants } from './utils/constants';
import { erc20TokenInfo, erc721TokenInfo } from './utils/token_info';

const allArtifacts = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"zrxVault": "0x1941ff73d1154774d87521d2d0aaad5d19c8df60",
"staking": "0x0d8b0dd11f5d34ed41d556def5f841900d5b1c6b",
"stakingProxy": "0x38ef19fdf8e8415f18c307ed71967e19aac28ba1",
"zrxVault": "0xc4df27466183c0fe2a5924d6ea56e334deff146a",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did these need to be re-deployed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are ganache snapshot addresses. Every public library in DevUtils is a separate deployment now, so it moves the deployer's nonce so we end up with different addresses.

@@ -0,0 +1,374 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did any of the logic change between the code in contracts/src/LibAssetData.sol and this, or just refactored?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly refactored. _getConvertibleMakerBalanceAndAssetProxyAllowance() got added but it's just a no-op placeholder in this PR, so you'll see it again.

/// @param owner The owner of the tokens.
/// @param spender The address the spender.
/// @return allowance The allowance for a token, owner, and spender.
function allowance(address token, address owner, address spender)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we return 0 instead of reverting if the call fails?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This library is all about very permissive interactions. Plus I figured we really don't want to revert in DevUtils if we can help it.

Copy link
Contributor

@hysz hysz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple questions, but the changes look good to me 💯

Copy link
Contributor

@moodlezoup moodlezoup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

@dorothy-zbornak dorothy-zbornak force-pushed the feat/abi-gen/library-linking branch 2 times, most recently from 7da2d0b to 0b372a3 Compare February 8, 2020 04:04
@dorothy-zbornak dorothy-zbornak force-pushed the feat/contracts/dev-utils/public-libraries-refactor branch from 3947d37 to ebbf2f0 Compare February 8, 2020 04:22
@dorothy-zbornak dorothy-zbornak force-pushed the feat/abi-gen/library-linking branch from 0b372a3 to 8635849 Compare February 8, 2020 04:23
@dorothy-zbornak dorothy-zbornak force-pushed the feat/contracts/dev-utils/public-libraries-refactor branch from ebbf2f0 to a08399d Compare February 8, 2020 04:23
@dorothy-zbornak dorothy-zbornak merged commit 0cb7b75 into feat/abi-gen/library-linking Feb 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants