paritytech / substrate-api-sidecar

REST service that makes it easy to interact with blockchain nodes built using Substrate's FRAME framework.

Home Page:https://paritytech.github.io/substrate-api-sidecar/dist/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

API request error:Unable to decode storage staking.ledger

zhy827827 opened this issue · comments

polkadot version: v1.12.0+substrate-api-sidecar:v19.0.1

curl --location 'http://127.0.0.1:8080/accounts/13JxzX2ZYxtRGPWCGgb8o8jnugzotyQ84XWkpr8tJRcmzbTS/staking-info?at=21157900' |jq

{
  "code": 400,
  "message": "Unable to decode storage staking.ledger:: createType(PalletBalancesError):: Unable to create Enum via index 102, in VestingBalance, LiquidityRestrictions, InsufficientBalance, ExistentialDeposit, Expendability, ExistingVestingSchedule, DeadAccount, TooManyReserves, TooManyHolds, TooManyFreezes, IssuanceDeactivated, DeltaZero",
  "stack": "BadRequestError: Unable to decode storage staking.ledger:: createType(PalletBalancesError):: Unable to create Enum via index 102, in VestingBalance, LiquidityRestrictions, InsufficientBalance, ExistentialDeposit, Expendability, ExistingVestingSchedule, DeadAccount, TooManyReserves, TooManyHolds, TooManyFreezes, IssuanceDeactivated, DeltaZero\n    at AccountsStakingInfoService.createHttpErrorForAddr (/usr/src/app/build/src/services/AbstractService.js:55:16)\n    at /usr/src/app/build/src/services/accounts/AccountsStakingInfoService.js:50:24\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async AccountsStakingInfoService.fetchAccountStakingInfo (/usr/src/app/build/src/services/accounts/AccountsStakingInfoService.js:45:79)\n    at async AccountsStakingInfoController.getAccountStakingInfo (/usr/src/app/build/src/controllers/accounts/AccountsStakingInfoController.js:76:62)\n    at async /usr/src/app/build/src/controllers/AbstractController.js:222:9",
  "level": "error"
}

I don't know how to solve this issuess

@zhy827827 Given the exact query above, i connected to wss://rpc.polkadot.io, used sidecar v19.0.1 and got a succesful response:

{
	"at": {
		"hash": "0xddc8972d95d3fae001a27cd366e0a9d2a88bf4f1f40c2c526be2f0150d5a9875",
		"height": "21157900"
	},
	"controller": "13JxzX2ZYxtRGPWCGgb8o8jnugzotyQ84XWkpr8tJRcmzbTS",
	"rewardDestination": {
		"account": "13JxzX2ZYxtRGPWCGgb8o8jnugzotyQ84XWkpr8tJRcmzbTS"
	},
	"numSlashingSpans": "0",
	"staking": {
		"stash": "13JxzX2ZYxtRGPWCGgb8o8jnugzotyQ84XWkpr8tJRcmzbTS",
		"total": "13000000000000000",
		"active": "13000000000000000",
		"unlocking": [],
		"legacyClaimedRewards": [
			"1219",
			"1220",
			"1221",
			"1222",
			"1223",
			"1224",
			"1225",
			"1226",
			"1227",
			"1228",
			"1229",
			"1230",
			"1231",
			"1232",
			"1233",
			"1234",
			"1235",
			"1236",
			"1237",
			"1238",
			"1239",
			"1240",
			"1241",
			"1242",
			"1243",
			"1244",
			"1245",
			"1246",
			"1247",
			"1248",
			"1249",
			"1250",
			"1251",
			"1252",
			"1253",
			"1254",
			"1255",
			"1256",
			"1257",
			"1258",
			"1259",
			"1260",
			"1261",
			"1262",
			"1263",
			"1264",
			"1265",
			"1266",
			"1267",
			"1268",
			"1269",
			"1270",
			"1271",
			"1272",
			"1273",
			"1274",
			"1275",
			"1276",
			"1277",
			"1278",
			"1279",
			"1280",
			"1281",
			"1282",
			"1283",
			"1284",
			"1285",
			"1286",
			"1287",
			"1288",
			"1289",
			"1290",
			"1291",
			"1292",
			"1293",
			"1294",
			"1295",
			"1296",
			"1297",
			"1298",
			"1299",
			"1300",
			"1301",
			"1302"
		]
	}
}
commented

hey @zhy827827 is this issue still happening? it seems we can't reproduce it at our end.

Yes, this problem often occurs. Every time I restart the sidecar to solve this issues