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

Set maximum WG budget increase amount (#2327) #3920

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

traumschule
Copy link
Contributor

#2327

BN seems to have a limit of 10000000000000000.

@vercel
Copy link

vercel bot commented Dec 4, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
dao ✅ Ready (Inspect) Visit Preview Feb 19, 2023 at 6:09PM (UTC)
pioneer-2 ✅ Ready (Inspect) Visit Preview Feb 19, 2023 at 6:09PM (UTC)
pioneer-2-storybook ✅ Ready (Inspect) Visit Preview Feb 19, 2023 at 6:09PM (UTC)

Copy link
Contributor

@oleksanderkorn oleksanderkorn left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@thesan thesan left a comment

Choose a reason for hiding this comment

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

@traumschule here: https://github.com/Joystream/pioneer/issues/2327#issuecomment-1336443690

You identified a bug where a javascript number was passed to asUpdateWorkingGroupBudget instead of a BN, I'm not sure why the type system doesn't detect this, but it's probably because somehow the fragment.amount is typed any.

Here's an example of BN with values > $2^{53} – 1$ (Number.MAX_SAFE_INTEGER): https://codepen.io/thesan/pen/poKmpzb?editors=0012

That said on chain most amount are encoded as u64 and currently the default maxAllowedValue of <TokenInput /> is powerOf2(128) so it should be changed to powerOf2(64)

Comment on lines 278 to 280
budgetUpdate: BNSchema.test(moreThanMixed(0, 'Amount must be greater than zero')).required('Field is required'),
budgetUpdate: BNSchema.test(moreThanMixed(0, 'Amount must be greater than zero.'))
.test(maxMixed(new BN(999999999999999), 'Amount must be less than 99999.', true))
.required('Field is required'),
Copy link
Member

Choose a reason for hiding this comment

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

@traumschule please remove this change. The budget can be over this amount and it won't cause any issue since: #4018.

FYI Zeeshan recently solved the underlying cause in Hydra here: Joystream/hydra#515. I'm not sure if this is deployed yet but either way everything will be fine as long as the value is less than 2⁶⁴

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builders-wg-code-review CI-passed community-dev issue suitable for community-dev pipeline
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants