Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

governance:build-proposal can't handle big numbers #7466

Closed
nambrot opened this issue Mar 18, 2021 · 4 comments · Fixed by #8028
Closed

governance:build-proposal can't handle big numbers #7466

nambrot opened this issue Mar 18, 2021 · 4 comments · Fixed by #8028
Assignees
Labels
Applications Applications circle tasks bug Something isn't working cli Component: ContractKit devux Developer UX Priority: P2 Major

Comments

@nambrot
Copy link
Contributor

nambrot commented Mar 18, 2021

Expected Behavior

Building the proposal interactively should work

Current Behavior

build-proposal with GoldToken#approve 15000k CELO failed

{ Error: invalid BigNumber string (argument="value", value="1.5e+22", code=INVALID_ARGUMENT, version=bignumber/5.0.15)
    at Logger.makeError (/Users/nambrot/.config/yarn/global/node_modules/@ethersproject/logger/src.ts/index.ts:205:28)
    at Logger.throwError (/Users/nambrot/.config/yarn/global/node_modules/@ethersproject/logger/src.ts/index.ts:217:20)
    at Logger.throwArgumentError (/Users/nambrot/.config/yarn/global/node_modules/@ethersproject/logger/src.ts/index.ts:221:21)
    at Function.BigNumber.from (/Users/nambrot/.config/yarn/global/node_modules/@ethersproject/bignumber/src.ts/bignumber.ts:230:27)
    at NumberCoder.encode (/Users/nambrot/.config/yarn/global/node_modules/@ethersproject/abi/lib/coders/number.js:30:39)
    at /Users/nambrot/.config/yarn/global/node_modules/@ethersproject/abi/lib/coders/array.js:55:19
    at Array.forEach (<anonymous>)
    at Object.pack (/Users/nambrot/.config/yarn/global/node_modules/@ethersproject/abi/lib/coders/array.js:41:12)
    at TupleCoder.encode (/Users/nambrot/.config/yarn/global/node_modules/@ethersproject/abi/lib/coders/tuple.js:36:24)
    at AbiCoder.encode (/Users/nambrot/.config/yarn/global/node_modules/@ethersproject/abi/lib/abi-coder.js:86:15)
    at ABICoder.encodeParameters (/Users/nambrot/.config/yarn/global/node_modules/web3-eth-abi/lib/index.js:121:27)
    at /Users/nambrot/.config/yarn/global/node_modules/web3-eth-contract/lib/index.js:439:20
    at Array.map (<anonymous>)
    at Object._encodeMethodABI (/Users/nambrot/.config/yarn/global/node_modules/web3-eth-contract/lib/index.js:438:8)
    at ProposalBuilder.fromWeb3tx (/Users/nambrot/.config/yarn/global/node_modules/@celo/governance/src/proposals.ts:163:15)
    at ProposalBuilder.<anonymous> (/Users/nambrot/.config/yarn/global/node_modules/@celo/governance/src/proposals.ts:240:17)
    at step (/Users/nambrot/.config/yarn/global/node_modules/@celo/governance/lib/proposals.js:33:23)
    at Object.next (/Users/nambrot/.config/yarn/global/node_modules/@celo/governance/lib/proposals.js:14:53)
    at fulfilled (/Users/nambrot/.config/yarn/global/node_modules/@celo/governance/lib/proposals.js:5:58)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  reason: 'invalid BigNumber string',
  code: 'INVALID_ARGUMENT',
  argument: 'value',
  value: '1.5e+22' }
@nambrot nambrot added bug Something isn't working cli devux Developer UX Applications Applications circle tasks labels Mar 18, 2021
@yorhodes
Copy link
Contributor

we are checking that these values are indeed BigNumber compatible in the builder


it looks like this is in the CeloTxObject.encodeABI which is upstream

@aslawson
Copy link
Contributor

@nambrot @yorhodes -- is this blocking build-proposal from working? trying to understand the impact and urgency for this fix

@nambrot
Copy link
Contributor Author

nambrot commented Mar 27, 2021

IMO this is blocking indeed, I.e I was unable to use build-proposal for CGP20 for a simple ERC20 approval from the community fund

@barbaraliau
Copy link
Contributor

Possibly related to #6787

@eelanagaraj eelanagaraj self-assigned this May 31, 2021
@mergify mergify bot closed this as completed in #8028 Jun 2, 2021
mergify bot pushed a commit that referenced this issue Jun 2, 2021
Looks like this was related to ethers-io/ethers.js#228, but we just need to force the bignumber string to not be in scientific notation when transforming the value, and then this works as expected. Note that the outputted value in the outputted transaction will **not** be in scientific notation.

Closes #7466
tkporter pushed a commit that referenced this issue Jul 8, 2021
Looks like this was related to ethers-io/ethers.js#228, but we just need to force the bignumber string to not be in scientific notation when transforming the value, and then this works as expected. Note that the outputted value in the outputted transaction will **not** be in scientific notation.

Closes #7466
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Applications Applications circle tasks bug Something isn't working cli Component: ContractKit devux Developer UX Priority: P2 Major
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants