Skip to content

Conversation

roienatan
Copy link
Contributor

resolves: #512

@roienatan roienatan requested a review from orenyodfat July 16, 2020 08:26
Copy link
Contributor

@orenyodfat orenyodfat left a comment

Choose a reason for hiding this comment

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

any test which cover this case ?

@roienatan
Copy link
Contributor Author

any test which cover this case ?

Yes and it passes now

@@ -16,7 +16,7 @@ export interface ITransaction {
opts?: {
gasLimit?: number
gasPrice?: number
Copy link
Contributor

@orenyodfat orenyodfat Jul 18, 2020

Choose a reason for hiding this comment

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

should gasPrice b e also a sting ? it might not fit into 53 bit number as well..
@jellegerbrandy does this struct is used by common in some way ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does it related to this PR?
Looks like there is no use of gasPrice in joinAndQuit/plugin.ts

Copy link
Contributor

Choose a reason for hiding this comment

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

Seem not related, but neither is the change on the next line :)

In any case, to be consistent with most of the usage in arc.js, we would use a BN, not.a string (and not a number) here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The change is necessary if I change to "toString" in plugin.ts.

Copy link
Contributor

Choose a reason for hiding this comment

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

gasPrice cannot be a number as it is not fit into 53 bits .
it might be BN though

@@ -154,7 +155,7 @@ export class JoinAndQuit extends ProposalPlugin<
let opts
if ((await state).pluginParams.fundingToken === NULL_ADDRESS) {
// if we have no funding token, we shoudl send the fee as ETH
opts = { value: options.fee.toNumber()}
opts = { value: new BigNumber(options.fee.toString()).toHexString() }
Copy link
Contributor

Choose a reason for hiding this comment

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

I have nothing against this if this works, but in other places we just pass a a string to the contracts (instead of a BigNumber), so this could just read "options.fee.toString()"

Copy link
Contributor Author

@roienatan roienatan Jul 21, 2020

Choose a reason for hiding this comment

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

Both changes are depended, and if I change here to "toString" I must change in operation.ts to "string".
In other places in Alchemy we pass also numbers to the contracts and there is no reason that fee would not be a number also.

Copy link
Contributor

@orenyodfat orenyodfat Jul 21, 2020

Choose a reason for hiding this comment

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

fee must be a String here as ether.js look for the value as String for sure it cannot be Number as it not fits in 53 bits
I think as it is with the update it will cover all cases... both passing BN or String

Copy link
Contributor

@orenyodfat orenyodfat Jul 23, 2020

Choose a reason for hiding this comment

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

I have nothing against this if this works, but in other places we just pass a a string to the contracts (instead of a BigNumber), so this could just read "options.fee.toString()"

though the test pass a BN https://github.com/daostack/arc.js/blob/client-2-0/test/proposal-joinAndQuit.spec.ts#L52

@@ -16,7 +16,7 @@ export interface ITransaction {
opts?: {
gasLimit?: number
gasPrice?: number
Copy link
Contributor

Choose a reason for hiding this comment

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

Seem not related, but neither is the change on the next line :)

In any case, to be consistent with most of the usage in arc.js, we would use a BN, not.a string (and not a number) here.

@dkent600
Copy link
Contributor

All I ask is that arc.js be consistent with these data types.

@roienatan roienatan merged commit 771cb4a into client-2-0 Jul 26, 2020
@roienatan roienatan deleted the gh-issue-512 branch July 26, 2020 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants