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

Investigate Apps type errors (Option<Market> returned from prediction_markets::markets) #59

Closed
morkeltry opened this issue May 6, 2021 · 2 comments

Comments

@morkeltry
Copy link
Contributor

result in Apps;

impossible result in CLI

Apps:

Fresh, not locally cached, reload of https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fbp-rpc.zeitgeist.pm#/chainstate
contains:

types:"{"Asset":{"_enum":{"CategoricalOutcome":"(MarketId, CategoryIndex)","ScalarOutcome":"(MarketId, ScalarPosition)","CombinatorialOutcome":"","PoolShare":"u128","Ztg":""}},"CurrencyIdOf":"Asset","CurrencyId":"Asset","CategoryIndex":"u16","RangeInclusive":"(u128, u128)","MarketType":{"_enum":{"Categorical":"u16","Scalar":"RangeInclusive"}},"Outcome":{"_enum":{"Categorical":"u16","Scalar":"u128"}},"Market":{"creator":"AccountId","creation":"MarketCreation","creator_fee":"u8","oracle":"AccountId","end":"MarketEnd","metadata":"Vec<u8>","market_type":"MarketType","status":"MarketStatus","report":"Option<Report>","resolved_outcome":"Outcome"}}"
``
Getting prediction_markets::markets (3)

logs error:

2021-05-06 14:36:08 DRR: Unable to decode storage predictionMarkets.markets: entry 0:: createType(Option):: Option:: Decoded input doesn't match input, received 0x0120c762c7f3b12ae691d3a444e80fc5ec7c89098bb820a934c71ede8bc53d54…0000000000000000000000000008000000000000000000000000000000010000 (159 bytes), created 0x0120c762c7f3b12ae691d3a444e80fc5ec7c89098bb820a934c71ede8bc53d54…0000000000000000000000080000000000000000000000000000000100000000 (161 bytes)


##### CLI:

Running CLI locally with `"name": "@zeitgeistpm/types", "version": "0.1.50"`,
and "@zeitgeistpm/type-defs",  "version": "0.1.50"`, which contains:

export default {
rpc: {
predictionMarkets: {
marketOutcomeShareId: {
description: "Get the market outcome share identifier.",
params: [
{
name: "market_id",
type: "MarketId",
},
{
name: "outcome",
type: "u16",
},
{
name: "at",
type: "Hash",
isOptional: true,
},
],
type: "Hash",
},
},
},
types: {
MarketCreation: {
_enum: ["Permissionless", "Advised"],
},
MarketEnd: {
_enum: {
Block: "BlockNumber",
Timestamp: "u64",
},
},
MarketId: "u128",
MarketType: {
_enum: {
Categorical: "u16",
Scalar: "(u128, u128)"
}
},
MarketStatus: {
_enum: [
"Proposed",
"Active",
"Suspended",
"Closed",
"Reported",
"Disputed",
"Resolved",
],
},
Market: {
creator: "AccountId",
creation: "MarketCreation",
creator_fee: "u8",
oracle: "AccountId",
end: "MarketEnd",
metadata: "Vec",
market_type: "MarketType",
market_status: "MarketStatus",
report: "Option",
resolved_outcome: "Option",
},
Outcome: {
_enum : {
Categorical: "u16",
Scalar: "u128"
}
},
Report: {
at: "BlockNumber",
by: "AccountId",
outcome: "Outcome",
},
MarketDispute: {
at: "BlockNumber",
by: "AccountId",
outcome: "Outcome",
},
},
};


logs the result:

wss://bp-rpc.zeitgeist.pm initialised in 1676 ms.
{
"creator": "5Cogct4f5ThQZJBVywY2a5GKW8LU3hvwdm8dqjLRikzpshMt",
"creation": "Permissionless",
"creatorFee": 0,
"oracle": "5Cogct4f5ThQZJBVywY2a5GKW8LU3hvwdm8dqjLRikzpshMt",
"end": {
"block": 2500
},
"metadata": "0x516d56787175647571333679666d4c4658364242386734316d4363593841347452516a337032445a703947434e66",
"marketType": {
"scalar": [
0,
8
]
},
"marketStatus": "Active",
"report": null,
"categories": [
"Acala",
"Plasm",
"Edgeware",
"Maker",
"Shyft",
"Mina",
"Cere"
],
"resolvedOutcome": null,
"marketId": 3,
"title": "Parachain slot (test #1)",
"description": "Who will win?",
"metadataString": "QmVxquduq36yfmLFX6BB8g41mCcY8A4tRQj3p2DZp9GCNf",
"outcomeAssets": [
{
"scalarOutcome": [
3,
"Long"
]
},
{
"scalarOutcome": [
3,
"Short"
]
}
]
}

ie a `scalar` market containing `categories` 

@morkeltry
Copy link
Contributor Author

morkeltry commented May 6, 2021

CLI problem solved - it's not a types error, rather sanity checking (see #60 )

The Apps problem is solved by a more complex types object:

{"Asset":{"_enum":{"CategoricalOutcome":"(MarketId, CategoryIndex)","ScalarOutcome":"(MarketId, ScalarPosition)","CombinatorialOutcome":"","PoolShare":"u128","Ztg":""}},"CurrencyIdOf":"Asset","CurrencyId":"Asset","CategoryIndex":"u16","RangeInclusive":"(u128, u128)","MarketType":{"_enum":{"Categorical":"u16","Scalar":"RangeInclusive"}},"Outcome":{"_enum":{"Categorical":"u16","Scalar":"u128"}},"Market":{"creator":"AccountId","creation":"MarketCreation","creator_fee":"u8","oracle":"AccountId","end":"MarketEnd","metadata":"Vec<u8>","market_type":"MarketType","status":"MarketStatus","report":"Option<Report>","resolved_outcome":"Outcome"}}

generated by

I just copied them from https://github.com/zeitgeistpm/tools/tree/main/packages/type-defs/src and added the latest addition from Logan without the alias 2f171a85

@morkeltry
Copy link
Contributor Author

morkeltry commented May 6, 2021

https://www.npmjs.com/package/@zeitgeistpm/type-defs shows package @1.50 published yesterday.
Above commit should be included in package @1.50

  • therefore the problem appears to be caused by polkadot.js.org serving an outdated bundle rather than that available on npm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant