api icon indicating copy to clipboard operation
api copied to clipboard

RPC-CORE error when calling `api.derive.society.members()`

Open laurogripa opened this issue 1 year ago • 2 comments

  • I'm submitting a ...
  • [x] Bug report
  • [ ] Feature request
  • [ ] Support request
  • [ ] Other
  • What is the current behavior and expected behavior?

The Society pallet was update to V2 after the release of runtime v1.0. The api was update to reflect the changes. The regular query api seems to be working fine, but the derive api is throwing a weird RPC-CORE error for me when calling members(). It worked normally before the update and I don't seem any changes to how I should call the method.

RPC-CORE: subscribeStorage(keys?: Vec<StorageKey>): StorageChangeSet:: createType(Vec<StorageKey>):: Expected an array of 2 values as params to a Map query

Full error stack:

type.js:54 Uncaught (in promise) Error: createType(Vec<StorageKey>):: Expected an array of 2 values as params to a Map query
    at createTypeUnsafe (type.js:54:1)
    at TypeRegistry.createTypeUnsafe (registry.js:330:1)
    at RpcCore._formatParams (bundle.js:338:1)
    at Observable._subscribe (bundle.js:286:1)
    at Observable._trySubscribe (Observable.js:33:1)
    at Observable.js:27:1
    at errorContext (errorContext.js:23:1)
    at Observable.subscribe (Observable.js:23:1)
    at catchError.js:9:1
    at OperatorSubscriber.<anonymous> (lift.js:10:1)
    at Observable.js:27:1
    at errorContext (errorContext.js:23:1)
    at Observable.subscribe (Observable.js:23:1)
    at distinctUntilChanged.js:12:1
    at OperatorSubscriber.<anonymous> (lift.js:10:1)
    at Observable.js:27:1
    at errorContext (errorContext.js:23:1)
    at Observable.subscribe (Observable.js:23:1)
    at ConnectableObservable.connect (ConnectableObservable.js:43:1)
    at Observable._subscribe (refCountDelay.js:15:1)
    at Observable._trySubscribe (Observable.js:33:1)
    at Observable.js:27:1
    at errorContext (errorContext.js:23:1)
    at Observable.subscribe (Observable.js:23:1)
    at combineLatest.js:42:1
    at maybeSchedule (combineLatest.js:68:1)
    at _loop_1 (combineLatest.js:39:1)
    at combineLatest.js:59:1
    at maybeSchedule (combineLatest.js:68:1)
    at Observable._subscribe (combineLatest.js:33:1)
    at Observable._trySubscribe (Observable.js:33:1)
    at Observable.js:27:1
    at errorContext (errorContext.js:23:1)
    at Observable.subscribe (Observable.js:23:1)
    at map.js:6:1
    at OperatorSubscriber.<anonymous> (lift.js:10:1)
    at Observable.js:27:1
    at errorContext (errorContext.js:23:1)
    at Observable.subscribe (Observable.js:23:1)
    at Observable._subscribe (memo.js:14:1)
    at Observable._trySubscribe (Observable.js:33:1)
    at Observable.js:27:1
    at errorContext (errorContext.js:23:1)
    at Observable.subscribe (Observable.js:23:1)
    at catchError.js:9:1
    at OperatorSubscriber.<anonymous> (lift.js:10:1)
    at Observable.js:27:1
    at errorContext (errorContext.js:23:1)
    at Observable.subscribe (Observable.js:23:1)
    at distinctUntilChanged.js:12:1

The error seems to be happening inside the combineLast call around here

  • What is the motivation for changing the behavior?

Fix KappaSigmaMu website to reflect the new changes to the Society pallet

  • Please tell us about your environment:
  • Version:

  • Environment:

    • [x] Node.js (v20.10.0)
    • [x] Browser (Brave)
    • [ ] Other (limited support for other environments)
  • Language:

    • [ ] JavaScript
    • [x] TypeScript (include tsc --version)
    • [ ] Other

laurogripa avatar Nov 29 '23 20:11 laurogripa

UPDATE:

I managed to narrow down the error to these calls api.query.society.defenderVotes.multi<Option<PalletSocietyVote>>(accountIds) and api.query.society.defenderVotes.multi(accountIds)

Both thrown the same error when called alone

laurogripa avatar Dec 01 '23 01:12 laurogripa

Ok, I figured it out.

The new defenderVotes method on the society pallet takes 2 arguments:

  1. An U32 for the round index
  2. The AccountId

The multi calls are missing the round number

laurogripa avatar Dec 01 '23 06:12 laurogripa

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

polkadot-js-bot avatar Mar 31 '24 16:03 polkadot-js-bot