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

feat(order_utils.py): sign_hash() #1254

Merged
merged 9 commits into from
Nov 14, 2018
Merged

Conversation

feuGeneA
Copy link
Contributor

@feuGeneA feuGeneA commented Nov 13, 2018

Implemented zero_ex.order_utils.sign_hash().

Also moved is_valid_signature() into main package module, for simplicity.

Also consolidated a handul of in-line pylint disable directives into the .pylintrc config file.

Description

Testing instructions

./setup.py test
./setup.py lint

Both of which are integrated with CI.

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • Prefix PR title with [WIP] if necessary.
  • Prefix PR title with bracketed package name(s) corresponding to the changed package(s). For example: [sol-cov] Fixed bug.
  • Add tests to cover changes as needed.
  • Update documentation as needed.
  • Add new entries to the relevant CHANGELOG.jsons.

Also moved is_valid_signature() into main package module, for
simplicity.

Also consolidated a handul of in-line pylint disable directives into the
.pylintrc config file.

class Constants: # pylint: disable=too-few-public-methods

class _Constants:
Copy link
Contributor

Choose a reason for hiding this comment

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

What does the underscore mean/do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It implies that it's "private/internal." More concretely, though, it means that the automatic documentation generation will not include this class in the doc page.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went with a class because member variables that are initialized in the declaration are considered "static", meaning that they're only initialized once. (So, for us, the json artifacts are only read from disk once, at declaration time.) I went back and forth on whether to call the class _StaticData instead. Thinking more, maybe it's appropriate to have a class Constants (no underscore, so publicly documented) with things like contract_name_to_abi and null_address, things that other people might want to use; and to have a separate class _StaticData (so "private," not documented) that contains things that are only used internally, like precomputed keccak hashes and stuff. Just brainstorming... Dunno how much people would re-use that stuff right now, and in the future we'll probably have separate public packages to more properly expose things like ABI's and contract addresses.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I like that idea. Maybe we could call them Constants and _PrivateConstants?

if not isinstance(provider, Web3.HTTPProvider):
raise TypeError("provider is not a Web3.HTTPProvider")
if not is_address(signer_address):
raise ValueError("signer_address is not a valid address")
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's wrap this into asset_is_address() function

@coveralls
Copy link

coveralls commented Nov 14, 2018

Coverage Status

Coverage increased (+0.009%) to 84.705% when pulling 8e84d29 on feature/python-sign-order into 7b4f63a on development.

@feuGeneA feuGeneA changed the title feat(order_utils.py): sign_order_hash() feat(order_utils.py): sign_hash() Nov 14, 2018
@feuGeneA feuGeneA merged commit e1d64de into development Nov 14, 2018
xianny added a commit that referenced this pull request Nov 27, 2018
* feat: add coinbase wallet app logo to wallet prompt

* chore: remove unused import

* fix(instant): catch errors coming from calls to the orderValidator contract

* feat: center title label with circle

* feat: dont show payment dropdown content on mobile

* refactor: move wallet panel content os switching logic into two methods

* fix: do not remove payment dropdown when confirmation pending

* Fix a bug in an order-watcher order removal when maker token is ZRX

* Add a comment

* Updated CHANGELOGS

* Publish

 - 0x.js@2.0.4
 - @0x/abi-gen@1.0.16
 - @0x/abi-gen-wrappers@1.0.5
 - @0x/assert@1.0.17
 - @0x/asset-buyer@3.0.0
 - @0x/base-contract@3.0.6
 - @0x/connect@3.0.6
 - @0x/contract-wrappers@4.0.2
 - contracts@2.1.54
 - @0x/dev-tools-pages@0.0.6
 - @0x/dev-utils@1.0.17
 - @0x/fill-scenarios@1.0.12
 - @0x/instant@0.0.7
 - @0x/json-schemas@2.1.1
 - @0x/metacoin@0.0.28
 - @0x/migrations@2.0.4
 - @0x/order-utils@3.0.2
 - @0x/order-watcher@2.2.4
 - @0x/react-docs@1.0.18
 - @0x/react-shared@1.0.21
 - @0x/sol-compiler@1.1.12
 - @0x/sol-cov@2.1.12
 - @0x/sol-doc@1.0.7
 - @0x/sra-spec@1.0.10
 - @0x/subproviders@2.1.4
 - @0x/testnet-faucets@1.0.56
 - @0x/utils@2.0.5
 - @0x/web3-wrapper@3.1.4
 - @0x/website@0.0.59

* feat(order_utils.py): sign_hash() (#1254)

Also moved is_valid_signature() into main package module, for
simplicity.

Also consolidated a handul of in-line pylint disable directives into the
.pylintrc config file.

* fix(order_utils.py): validate order w/json schema (#1260)

* fix(instant): fix tabbing into erc20 token selector

* fix(instant): border radius

* fix(instant): match token search on prefix

* fix(order_utils.py): lazy load contract artifacts (#1262)

* fix(instant): fix tabIndex attribute error

* feat: use capital values for enums

* chore: update yarn lock

* fix(website): currentProvider called on undefined

* fix(website): remove node env definition from webpack

* feat: expose webpack-dev-server content to local network

* feat: use stable version of bowser

* feat: use blue for wallet prompt on mobile

* chore: remove wallet panel content for mobile

* feat: make onUnlockWalletClick different based on ON

* First pass on widget version of heap

* fix: add http to external url string

* feat(instant): Heap middleware and first tracking events

* Use pure functions instead of class

* Report ETH in units

* Introduce ANALYTICS_ENABLED constant

* Move where we track widget opened, and report on networkId and providerName

* Take out console.logs

* Linting

* feat: use stable version of bowser

* feat: use blue for wallet prompt on mobile

* chore: remove wallet panel content for mobile

* feat: make onUnlockWalletClick different based on ON

* fix: remove redundant handler

* Update call-to-action links

* Add support for responsive left

* Move variable assignments around to be more clear

* Have heartbeat update not trigger errors

* fix linter issue

* Send in affiliate info as option

* feat: change webpack config and make instant public

* feat: add npmignore

* feat: rename bundle to instant.js and move build to umd dir

* fix: deploy commands

* chore: update gitignore

* feat: change version to 1.0.0

* chore: run linter

* fix: remove unused vars

* fix: remove private config line

* chore(instant): fix lint error

* feat(instant): add icons to token selector

* fix(asset-buyer): change lodash version to the same as other 0x packages

* fix(instant): change lodash version to the same as other 0x packages

* fix: fix exceeds block gas limit error

* feat: Deploy contracts to Rinkeby

* Add launch kit to Developer home list of tools

* Add disclaimer

* Add blogpost URL

* Fix disclaimer

* Update LICENSE

* Update icons

* Typesafe analytic actions

* Point directly to README for docs link

* Make user and event properties more specific

* We may not know num available assets available when wallet ready, so not trackin there

* Remove excess semi-colon

* Fix capitalization in title

* Add Apache license link

* Add smart contract docs to Developer Home

* Fix disclaimer on mobile

* Add access to environment variables

* Switch heap id on environment, and make sure app id is what we expect

* Remove unused import

* Take out old TODO

* Add initials to TODO note

* null -> undefined

* Report on git sha and npm version of build

* Disable tslint for unused function so we can include this for future tracking events

* Update blog post feature

* fix: tslint ignore rule in wrong place

* feat: add new bundle name to bundle watch

* Move ip import back

* Getting rid of unused function, and using track prefix

* feat: close and open instant based on history changes

* feat: rename props to config

* Trigger Wallet Ready when address changed

* Widget -> Instant

* Remove old function

* feat: allow integrator to disable pushstate logic

* Specify fallback web3 provider in analytics

* feat: be more specific with callback name

* feat: add assert for shouldDisablePushToHistory

* feat: add URL override param

* fix: bug where we did not call onClose config

* chore: use lodash where relevant

* Better way of reporting Fallback provider

* feat: add isInstantRendered check to safeguard against double renders and double removes

* Add way to disable via props

* feat: refer to map file in postpublish configs

* fix: make instant package private

* chore: make instant public

* feat: fix instant build and add to project references

* fix: specify new location of index.js in package.json

* fix(order_utils.py): publish docs to S3, not RTD (#1264)

Publishing to readthedocs.io (RTD) wasn't working, for various reasons.

Changed to publish docs to S3.

* Improve our CONTRIBUTING.md instructions

* Fixes to CONTRIBUTING.md

* Add 0x-order-utils.py library to developers home

* No need to explicit send in NODE_ENV

* Change disabled analytics name, add assertion, and always set

* feat(instant): support custom iconUrls

* Get heap analytics id from ENV variable

* Linting: rename variable

* Check for instant heap production credentials in pre-publish step

* fix: npmignore file ignoring index.d.ts

* feat(instant): Add powered by 0x image

* Use anchor instead of Text

* Fix linting

* fix(instant): Don't allow changing of assets when order processing

* fix: do not use document on import

* Add ability to import SVGs in TS

* Import via TS

* Properly unmarshall TransactionReceiptRPC to TransactionReceipt

* Add nonce to TxOpts

* Update packages/contract-wrappers/CHANGELOG.json

Co-Authored-By: LogvinovLeon <logvinov.leon@gmail.com>

* Update packages/contract-wrappers/src/types.ts

Co-Authored-By: LogvinovLeon <logvinov.leon@gmail.com>

* Allow user to select other token on success

* fix(instant): Autofocus text amount input

* fix(instant): Right align amounts

* autofocus -> hasAutoFocus

* isDisabled -> isInputDisabled

* fix(instant): Use new valid svg image for instant

* Update issue template

* Move out generating of event properties, and send in orderSource

* Allow a `SimpleContractArtifact` to be passed into `deployFrom0xArtifactAsync`

* feat(instant): Add more event properties to heap

* Add @0x/types to dependencies of `@0x/abi-gen-wrappers`

* Update abi-gen-wrappers

* Fix `SimpleContractArtifact` type

* Fix prettier

* feat(instant): implement account related events

* Add CHANGELOG entry

* Add additional CHANGELOG to types package

* Create migrations doc reference page

* Add migrations, contract-addresses and contract-artifacts to Developers home

* Improve comments

* Fix additional comments

* Add CHANGELOG entry

* remove unused flag

* Fix prettier

* Improve top-level README

* reduce text side in README

* Reduce title size

* feat: add more to instant dev env

* chore: clean up index.umd.ts a bit

* Put python package above TS/JS packages

* immediately return the patch incremented version if no changelog entries exist

* print out error message and stack

* fix: multiple render and closes edge case for onpopstate render

* Send in explicit props

* chore(instant): refactor account tracking logic in middleware to be more readable

* Updated CHANGELOGS

* Publish

 - 0x.js@2.0.5
 - @0x/abi-gen@1.0.17
 - @0x/abi-gen-wrappers@1.1.0
 - @0x/assert@1.0.18
 - @0x/asset-buyer@3.0.1
 - @0x/base-contract@3.0.7
 - @0x/connect@3.0.7
 - @0x/contract-addresses@1.2.0
 - @0x/contract-wrappers@4.1.0
 - contracts@2.1.55
 - @0x/dev-tools-pages@0.0.7
 - @0x/dev-utils@1.0.18
 - @0x/fill-scenarios@1.0.13
 - @0x/instant@1.0.1
 - @0x/json-schemas@2.1.2
 - @0x/metacoin@0.0.29
 - @0x/migrations@2.1.0
 - @0x/monorepo-scripts@1.0.14
 - @0x/order-utils@3.0.3
 - @0x/order-watcher@2.2.5
 - @0x/react-docs@1.0.19
 - @0x/react-shared@1.0.22
 - @0x/sol-compiler@1.1.13
 - @0x/sol-cov@2.1.13
 - @0x/sol-doc@1.0.8
 - @0x/sol-resolver@1.0.17
 - @0x/sra-spec@1.0.11
 - @0x/subproviders@2.1.5
 - @0x/testnet-faucets@1.0.57
 - @0x/types@1.3.0
 - @0x/utils@2.0.6
 - @0x/web3-wrapper@3.1.5
 - @0x/website@0.0.60

* chore(instant): refactor usage of event properties in heap

* chore(instant): revert usage of event properties

* Force scaling input component to rerender when a different asset is chosen

* Add comment

* Make contract-templates an npm package

* bug: Only unmarshall receipt if blockNumber present.

openethereum/parity-ethereum#1180
Parity can return a pending transaction receipt with a number of null values

* bug: Use Testnet Exchange over mainnet

* Copy assets in referenced in instant on commonjs build

* Fix the lerna paremeter name from cdVersions to cd-versions

* Rename contract-templates to abi-gen-templates

* chore: Fund forwarder in migrations

* chore: Update CHANGELOGS use mainnet ZRX amount in Forwarder.

* Revert "[@0x/instant] Fix CI build broken by instant installation tests"

* Add autolabeler config

* Remove the instruction to prefix PRs with package name from a/PULL_REQUEST_TEMPLATE.md

* Add command-line interface to @0x/migrations

* Fix typo

* Add CHANGELOG entry to migrations

* fix(order_utils.py): work aroud pylint bug (#1322)

* Rename node-endpoint to rpc-url for clarity

* feat: Add Xianny to about page

* fix: add --exclude-missing flag to yarn clean command
@feuGeneA feuGeneA deleted the feature/python-sign-order branch March 13, 2019 23:52
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.

None yet

3 participants