Storage node conversion to the runtime version based on Substrate 2.0.0-rc4#1189
Conversation
| async freeBalance(accountId) { | ||
| const decoded = this.base.identities.keyring.decodeAddress(accountId, true) | ||
| return this.base.api.query.balances.freeBalance(decoded) | ||
| return (await this.base.api.derive.balances.all(decoded)).freeBalance |
There was a problem hiding this comment.
In this context I think (await this.base.api.derive.balances.all(decoded)).availableBalance may actually be more suitable, because freeBalance = avaialble + locked and if the balance is locked it seems like it cannot be transferred or used to pay the fee.
There was a problem hiding this comment.
@Lezek123 is correct. The way we are using it we were not accounting for locked balance. It is only directly called by hasMinimumBalanceOf() which is the call that is really interested in a minimum transferable balance. We can fix this in a later PR.
There was a problem hiding this comment.
Leszek's solution is only a single line. I'm including the fix in the current PR.
| const leadOpeningId = await api.workers.devAddStorageLeadOpening() | ||
| const leadApplicationId = await api.workers.devApplyOnOpening(leadOpeningId, aliceMemberId, alice, alice) | ||
| api.workers.devBeginLeadOpeningReview(leadOpeningId) | ||
| await api.workers.devBeginLeadOpeningReview(leadOpeningId) |
There was a problem hiding this comment.
this await was left out so the two transactions can be finalized in the same block.
It works because the second call doesn't need to get any values from event(s) emitted by the first transaction.
Of course the second one will fail if the first fails.
So its just a speed optimization :)
There was a problem hiding this comment.
Ok. I'm rolling it back.
| async freeBalance(accountId) { | ||
| const decoded = this.base.identities.keyring.decodeAddress(accountId, true) | ||
| return this.base.api.query.balances.freeBalance(decoded) | ||
| return (await this.base.api.derive.balances.all(decoded)).freeBalance |
There was a problem hiding this comment.
@Lezek123 is correct. The way we are using it we were not accounting for locked balance. It is only directly called by hasMinimumBalanceOf() which is the call that is really interested in a minimum transferable balance. We can fix this in a later PR.
| providers[id] = new Worker(value) | ||
| } | ||
| } | ||
| const entries = (await this.base.api.query.storageWorkingGroup.workerById.entries()); |
|
The changes look good. To build I had to fix call to |
|
I'm seeing 9 linter errors that need to be fixed, we can fix in a separate PR? Running |
|
That is strange - I had successfully uploaded the video file during the testing. |
Is it possible that the packages wasn't rebuilt and used some pre-compiled code you had? I noticed storage-node is the only project we have where a |
|
Did some additional testing. LGTM. One bug I just realized in the |
Main changes:
IsFinalizedwas changed toasCompleted