[Fil 1351] rkhportal add method to add dc not set issue on metaalocator refreshes#88
Conversation
| proposeTransaction({ address, datacap: dataCap }).catch(error => { | ||
| async ({ dataCap, method }: ChangeDatacapFormValues) => { | ||
| const datacapForSubmit = | ||
| method === 'add' ? Number(dataCap) + Number(verifierData?.datacap || 0) : Number(dataCap); |
There was a problem hiding this comment.
I think this should error out rather than || 0 - otherwise it will be more surprising than the original behaviour!
In other words, if we don't know how much datacap they currently have, we can't possibly add!
src/config/environment.ts
Outdated
| metaAllocatorContractAddress: '0xB6F5d279AEad97dFA45209F3E53969c2EF43C21d', | ||
| githubOwner: 'filecoin-project', | ||
| safeAddress: '0x2e25A2f6bC2C0b7669DFB25180Ed57e07dAabe9e', | ||
| safeAddress: '0xa6d01c6e053170cff6de826116949d0a315aae80', |
There was a problem hiding this comment.
This looks like a mistake/residue from testing
src/providers/AccountProvider.tsx
Outdated
| ); | ||
|
|
||
| const datacap = await (api as any).client.stateVerifierStatus(actorId, null); | ||
| const datacapInPiB = BigInt(datacap.toString()) / BigInt(1_125_899_906_842_624); |
There was a problem hiding this comment.
Does this have to be an Int? It's extremely unusual for an Allocator to have an exact round number of PiB left.
SO long as it's not used for any actual allocation calculations this is minor, but we have to use the proper fractional numbers in any area of consequence.
src/providers/AccountProvider.tsx
Outdated
| const datacapInPiB = BigInt(datacap.toString()) / BigInt(1_125_899_906_842_624); | ||
|
|
||
| return { | ||
| datacap: Number(datacapInPiB), |
There was a problem hiding this comment.
As comment on line 386 - I think this will cause rounding issues in allocations
RKH flow:
addallowance to contract usingaddVerifiermethod without onchain changes, so I proposed a workaround. When user selectsAdd, I sum current datacap of the contract and input value. Then I use this sum toproposeAddVerifier.Allocator flow:
[edit]