Skip to content
This repository was archived by the owner on May 24, 2022. It is now read-only.

Update @parity/* packages & fix #298#274

Merged
amaury1093 merged 13 commits intomasterfrom
am-bump-packages
Dec 21, 2018
Merged

Update @parity/* packages & fix #298#274
amaury1093 merged 13 commits intomasterfrom
am-bump-packages

Conversation

@amaury1093
Copy link
Collaborator

@amaury1093 amaury1093 commented Nov 26, 2018

No feature change, no code change. @parity/* packages just had some internal reorg.

Edit: now also fixes #298

@Tbaut
Copy link
Collaborator

Tbaut commented Nov 26, 2018

The tokens don't show up and I get:
image

@Tbaut
Copy link
Collaborator

Tbaut commented Nov 26, 2018

The health is also not showing:
image

@amaury1093
Copy link
Collaborator Author

:( I think this is blocked by #212. react-script@1 can't minify debug@4 (which I updated from debug@3 because of vulnerabilities).

@amaury1093
Copy link
Collaborator Author

Will reopen once #212 is done

@amaury1093 amaury1093 closed this Dec 6, 2018
@amaury1093 amaury1093 reopened this Dec 18, 2018
@amaury1093
Copy link
Collaborator Author

Added a fix to fix #298.

@amaury1093 amaury1093 requested a review from ltfschoen December 18, 2018 13:19
@ltfschoen
Copy link
Contributor

Added a fix to fix #298.

i just fetched a copy of this branch using the latest Node.js v10.14.2 nvm use v10.14.2 with git fetch origin am-bump-packages:am-bump-packages, installed dependencies and ran it with yarn; yarn electron, then opened developer tools (View > Toggle Developer Tools) and selected the Console tab, then in the Fether UI i selected an account, then selected Ether, and entered an Amount of 0.0000000000000000011 and a recipient address of 0x005072Fb985cc64d8A1Ce00ECe26279f73c12F8a, and it showed the following error:

Uncaught Error: [format/input::inNumber16] the given number is not an integer: 1.1
    at Object.t.inNumber16 (input.js:140)
    at input.js:191
    at Array.forEach (<anonymous>)
    at t.inOptions (input.js:164)
    at e.estimateGas (eth.js:75)
    at estimateGas.js:61
    at n (memoize.js:65)
    at Ca (estimateGas.js:30)
    at gas (TxForm.js:53)
    at final-form-calculate.es.js:49

screen shot 2018-12-18 at 4 54 25 pm

The error is triggered because once a valid amount and recipient address have been entered it calls estimateGas https://github.com/paritytech/fether/blob/master/packages/fether-react/src/Send/TxForm/TxForm.js#L53, and then txForEth https://github.com/paritytech/fether/blob/master/packages/fether-react/src/utils/estimateGas.js#L30 is called since we've chosen to send Ether, but it crashes when it tries to call estimateGasForEth (it doesn't return from the promise), which in turn tries calling api.eth.estimateGas(txForEth), where api was passed through as an argument and comes from parityStore.api, where parityStore is a MobX store that was injected as props into the component with @inject('parityStore' ....
It calls estimateGas of https://github.com/paritytech/js-libs/blob/master/packages/api/src/rpc/eth/eth.js#L63, which calls .send('eth_estimateGas', inOptions(options)) https://github.com/paritytech/js-libs/blob/master/packages/api/src/format/input.ts#L167

If we're sending Ether and we enter a value of 1 Wei then estimateGasForEth passes a BN options[key] value of 1 corresponding to a value of key in the case statement being value, and returns a BN value of 21000.
Whereas if we enter a value of 1.1 Wei then the options[key].toString() value is 1.1 so
it returns an error Uncaught Error: [format/input::inNumber16] the given number is not an integer: 1.1, since it's a decimal value.

When the key is value in the case statement it calls https://github.com/paritytech/js-libs/blob/master/packages/api/src/format/input.ts#L199 inNumber16(options[key])

It then checks if the amount is an integer, and if it isn't it crashes with the error https://github.com/paritytech/js-libs/blob/master/packages/api/src/format/input.ts#L145

Note: inNumber16's function signature expects an argument of type BlockNumber (even though inNumber16 is called for amount values and nonces in addition to block numbers) https://github.com/paritytech/js-libs/blob/master/packages/api/src/format/input.ts#L140, so should we add an issue to update types.ts to be more specific https://github.com/paritytech/js-libs/blob/master/packages/api/src/types.ts?

"@parity/light.js": "^1.0.9",
"@parity/light.js-react": "^1.0.0",
"@parity/api": "^3.0.10",
"@parity/contracts": "^3.0.10",
Copy link
Contributor

Choose a reason for hiding this comment

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

@parity/contracts is at 3.0.11 https://www.npmjs.com/package/@parity/contracts

"@parity/light.js-react": "^1.0.0",
"@parity/api": "^3.0.10",
"@parity/contracts": "^3.0.10",
"@parity/light.js": "^3.0.10",
Copy link
Contributor

Choose a reason for hiding this comment

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

@parity/light.js is at 3.0.11 https://www.npmjs.com/package/@parity/light.js

"@parity/api": "^3.0.10",
"@parity/contracts": "^3.0.10",
"@parity/light.js": "^3.0.10",
"@parity/light.js-react": "^3.0.10",
Copy link
Contributor

Choose a reason for hiding this comment

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

@parity/light.js-react is at 3.0.11 https://www.npmjs.com/package/@parity/light.js-react

@amaury1093 amaury1093 changed the title Update @parity/* packages Update @parity/* packages & fix #298 Dec 18, 2018
@amaury1093
Copy link
Collaborator Author

amaury1093 commented Dec 18, 2018

@ltfschoen Ah yes, you're totally right about the inNumber16, it should be BigNumber | string | number. Do you want to create a PR there?

values.gas
.mul(toWei(values.gasPrice, 'shannon'))
.multipliedBy(toWei(values.gasPrice, 'shannon'))
.plus(token.address === 'ETH' ? toWei(values.amount) : 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

token.address(i.e. 0x005072Fb985cc64d8A1Ce00ECe26279f73c12F8a) should be token.symbol (i.e. ETH)

Copy link
Collaborator Author

@amaury1093 amaury1093 Dec 18, 2018

Choose a reason for hiding this comment

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

No, token.address is an unique field, whereas token.symbol might not be. We consider in Fether Ethereum as a token, to factorize some code.

Edit: Apparently this creates more confusion then solves problem. A better idea is probably to rename to token.id everywhere (where token.id = 'ETH' | address)

Copy link
Contributor

Choose a reason for hiding this comment

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

when i'm in "Send Ether" and debug the value of token it displays:

screen shot 2018-12-18 at 7 35 48 pm

whereas when i'm in "Send THIBCoin" and debug the value of token it displays:

screen shot 2018-12-18 at 7 34 08 pm

Copy link
Contributor

Choose a reason for hiding this comment

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

i see what you mean, i think it makes sense the way you've done it then

@Tbaut
Copy link
Collaborator

Tbaut commented Dec 18, 2018

Just for info,I got (at launch) the following errors, otherwise it works (made a successful token transfer) :
image

The tokens took a while to appear, I got a 404 for this image (from the console):
GET https://raw.githubusercontent.com/GuildWorx/images/e2c802875bc9afbb9297560adc4b0d4566ecb000/17436729.png 404 (Not Found)

My terminal is spammed by the following, but not sure it's related either.
[32473:1218/174702.444245:ERROR:CONSOLE(105)] "Uncaught (in promise) Error: Could not instantiate: ProductRegistryImpl.Registry", source: chrome-devtools://devtools/bundled/inspector.js

@amaury1093
Copy link
Collaborator Author

@Tbaut multiple issues:

  1. yes, logged here: Implement eth_subscribe('syncing') parity-ethereum#10080. It's due to the upgrade in light.js: before, we were doing parity_subscribe('eth_syncing') in light.js, but for Geth compat, I switched to eth_subscribe('syncing')
  2. Tokens took a while to appear -> happens to me too. I think they only appear if we get the balance after the network call, maybe a placeholder (like before, but prettier) it an idea?
  3. Not sure, maybe 2.0.0-beta.2 devtools & CSP: Uncaught … ProductRegistryImpl.Registry inspector.js(105) electron/electron#12185?

@Tbaut
Copy link
Collaborator

Tbaut commented Dec 19, 2018

  1. totally, if we have the icon and the name, we can have a spinner for the amount. This would also prevent the screen to "jump"
  2. ok not really a big issue anyways, might be resolved by Update to Electron 4 #309

@ltfschoen
Copy link
Contributor

@amaurymartiny @Tbaut LGTM!

@Tbaut
Copy link
Collaborator

Tbaut commented Dec 20, 2018

Can you add your green mark? I'll do a full test with DL of the headers just to make sure we didn't break anything.

Copy link
Collaborator

@Tbaut Tbaut left a comment

Choose a reason for hiding this comment

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

Got the following error when:

  • sending a token (enough balance)
  • pasting a valid address in the "to" field
    image

@amaury1093
Copy link
Collaborator Author

Correct, I forgot one multipliedBy

Copy link
Collaborator

@Tbaut Tbaut left a comment

Choose a reason for hiding this comment

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

Works well.

@amaury1093
Copy link
Collaborator Author

Can this be merged? Someone else wants to give a review?

@amaury1093 amaury1093 merged commit 02b1822 into master Dec 21, 2018
@amaury1093 amaury1093 deleted the am-bump-packages branch December 21, 2018 13:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uncaught Error: [format/input::inNumber16] the given number is not an integer

3 participants