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

Inconsistent & missing data.events for different subscan server for the same block #79

Closed
jun0tpyrc opened this issue Oct 19, 2020 · 22 comments

Comments

@jun0tpyrc
Copy link

jun0tpyrc commented Oct 19, 2020

data.events are showing inconsistent behaviours, some time missing on public server, some time missing on private server

curl -XPOST https://westend.subscan.io/api/scan/block -d '{"block_num": 222841}' -H "Content-Type: application/json" | jq

data.events showing an empty array in this public testnet subscan

{
  "code": 0,
  "message": "Success",
  "ttl": 1,
  "data": {
    "block_num": 222841,
    "block_timestamp": 1587622782,
    "hash": "0x32e61276d35b3a415716496dacd06e1951ce02272f859e0f16bd3281a1da16aa",
    "parent_hash": "0x0e9cd4ce2d45d6a1966688c8e5af3ae9f9d328dbaf23b6b7f1e8e11437cb1f5e",
    "state_root": "0xd423f2b07a07d54d8a01999b420a69ba8c933a02300054750f1372a8e0a099ea",
    "extrinsics_root": "0x3a013d5fb19cf166315bb6f14df946f2893081e38216dad6af8bb676b277a4b4",
    "extrinsics": [
      {
        "block_timestamp": 1587622782,
        "block_num": 222841,
        "extrinsic_index": "222841-0",
        "call_module_function": "set",
        "call_module": "timestamp",
        "params": "[{\"name\":\"now\",\"type\":\"Compact\\u003cMoment\\u003e\",\"value\":1587622782,\"value_raw\":\"\"}]",
        "account_id": "",
        "account_index": "",
        "signature": "",
        "nonce": 0,
        "extrinsic_hash": "",
        "success": true,
        "fee": "0",
        "account_display": null
      },
      {
        "block_timestamp": 1587622782,
        "block_num": 222841,
        "extrinsic_index": "222841-1",
        "call_module_function": "final_hint",
        "call_module": "finalitytracker",
        "params": "[{\"name\":\"hint\",\"type\":\"Compact\\u003cBlockNumber\\u003e\",\"value\":222838,\"value_raw\":\"\"}]",
        "account_id": "",
        "account_index": "",
        "signature": "",
        "nonce": 0,
        "extrinsic_hash": "",
        "success": true,
        "fee": "0",
        "account_display": null
      },
      {
        "block_timestamp": 1587622782,
        "block_num": 222841,
        "extrinsic_index": "222841-2",
        "call_module_function": "set_heads",
        "call_module": "parachains",
        "params": "[{\"name\":\"heads\",\"type\":\"Vec\\u003cAttestedCandidate\\u003e\",\"value\":null,\"value_raw\":\"\"}]",
        "account_id": "",
        "account_index": "",
        "signature": "",
        "nonce": 0,
        "extrinsic_hash": "",
        "success": true,
        "fee": "0",
        "account_display": null
      }
    ],
    "events": [],
    "logs": [
      {
        "block_num": 222841,
        "log_index": "222841-0",
        "log_type": "PreRuntime",
        "origin_type": "PreRuntime",
        "data": "{\"data\":\"0x01000000009588c50f000000005801736a97bb9573819ff6ef3ac7a66f8ce43b6382b1f5a03732488a675064589b0cbbfd6e0daeaadad67f70c6ae46b6e1db357cedb3e0d974bf7968077a6b0180cd55df40b8cb404bed3516fc847aff41d253e430a7d8596c4204261e7e4007\",\"engine\":1161969986}"
      },
      {
        "block_num": 222841,
        "log_index": "222841-1",
        "log_type": "Seal",
        "origin_type": "Seal",
        "data": "{\"data\":\"0x1a53e367ab0dac3ef35666916c5ad7fc40858a971571daead257e36383fd313056b4774915a08699da94f8ad035beb531bc91b6d9751cb89e3eb8af637992d8c\",\"engine\":1161969986}"
      }
    ],
    "event_count": 0,
    "extrinsics_count": 3,
    "spec_version": 4,
    "validator": "5FZoQhgUCmqBxnkHX7jCqThScS2xQWiwiF61msg63CFL3Y8f",
    "validator_name": "",
    "validator_index_ids": "",
    "finalized": true,
    "account_display": {
      "address": "5FZoQhgUCmqBxnkHX7jCqThScS2xQWiwiF61msg63CFL3Y8f",
      "display": "",
      "judgements": null,
      "parent_display": "",
      "parent": "",
      "account_index": "",
      "identity": false
    }
  }
}

In the self-hosted instance , it contains some data for data.events

{
  "code": 0,
  "message": "Success",
  "ttl": 1,
  "data": {
    "block_num": 222841,
    "block_timestamp": 1587622782,
    "hash": "0x32e61276d35b3a415716496dacd06e1951ce02272f859e0f16bd3281a1da16aa",
    "parent_hash": "0x0e9cd4ce2d45d6a1966688c8e5af3ae9f9d328dbaf23b6b7f1e8e11437cb1f5e",
    "state_root": "0xd423f2b07a07d54d8a01999b420a69ba8c933a02300054750f1372a8e0a099ea",
    "extrinsics_root": "0x3a013d5fb19cf166315bb6f14df946f2893081e38216dad6af8bb676b277a4b4",
    "extrinsics": [
      {
        "block_timestamp": 1587622782,
        "block_num": 222841,
        "extrinsic_index": "222841-0",
        "call_module_function": "set",
        "call_module": "timestamp",
        "params": "[{\"name\":\"now\",\"type\":\"Compact\\u003cMoment\\u003e\",\"value\":1587622782,\"value_raw\":\"\"}]",
        "account_id": "",
        "account_index": "",
        "signature": "",
        "nonce": 0,
        "extrinsic_hash": "",
        "success": false,
        "fee": "0"
      },
      {
        "block_timestamp": 1587622782,
        "block_num": 222841,
        "extrinsic_index": "222841-1",
        "call_module_function": "final_hint",
        "call_module": "finalitytracker",
        "params": "[{\"name\":\"hint\",\"type\":\"Compact\\u003cBlockNumber\\u003e\",\"value\":222838,\"value_raw\":\"\"}]",
        "account_id": "",
        "account_index": "",
        "signature": "",
        "nonce": 0,
        "extrinsic_hash": "",
        "success": true,
        "fee": "0"
      },
      {
        "block_timestamp": 1587622782,
        "block_num": 222841,
        "extrinsic_index": "222841-2",
        "call_module_function": "set_heads",
        "call_module": "parachains",
        "params": "[{\"name\":\"heads\",\"type\":\"Vec\\u003cAttestedCandidate\\u003e\",\"value\":null,\"value_raw\":\"\"}]",
        "account_id": "",
        "account_index": "",
        "signature": "",
        "nonce": 0,
        "extrinsic_hash": "",
        "success": true,
        "fee": "0"
      }
    ],
    "events": [
      {
        "event_index": "222841-0",
        "block_num": 222841,
        "extrinsic_idx": 0,
        "module_id": "system",
        "event_id": "ExtrinsicSuccess",
        "params": "[{\"type\":\"DispatchInfo\",\"value\":{\"class\":\"Normal\",\"paysFee\":false,\"weight\":10000000},\"value_raw\":\"\"}]",
        "event_idx": 0,
        "extrinsic_hash": "",
        "block_timestamp": 0
      },
      {
        "event_index": "222841-258",
        "block_num": 222841,
        "extrinsic_idx": 258,
        "module_id": "indices",
        "event_id": "IndexAssigned",
        "params": "[{\"type\":\"AccountId\",\"value\":\"0000000080969800000000000201000002000000000000ca9a3b000000000201\",\"value_raw\":\"\"},{\"type\":\"AccountIndex\",\"value\":0,\"value_raw\":\"\"}]",
        "event_idx": 1,
        "extrinsic_hash": "",
        "block_timestamp": 0
      },
      {
        "event_index": "222841-0",
        "block_num": 222841,
        "extrinsic_idx": 0,
        "module_id": "",
        "event_id": "",
        "params": "[]",
        "event_idx": 2,
        "extrinsic_hash": "",
        "block_timestamp": 0
      }
    ],
    "logs": [
      {
        "block_num": 222841,
        "log_index": "222841-0",
        "log_type": "PreRuntime",
        "origin_type": "",
        "data": "{\"data\":\"0x01000000009588c50f000000005801736a97bb9573819ff6ef3ac7a66f8ce43b6382b1f5a03732488a675064589b0cbbfd6e0daeaadad67f70c6ae46b6e1db357cedb3e0d974bf7968077a6b0180cd55df40b8cb404bed3516fc847aff41d253e430a7d8596c4204261e7e4007\",\"engine\":1161969986}"
      },
      {
        "block_num": 222841,
        "log_index": "222841-1",
        "log_type": "Seal",
        "origin_type": "",
        "data": "{\"data\":\"0x1a53e367ab0dac3ef35666916c5ad7fc40858a971571daead257e36383fd313056b4774915a08699da94f8ad035beb531bc91b6d9751cb89e3eb8af637992d8c\",\"engine\":1161969986}"
      }
    ],
    "event_count": 3,
    "extrinsics_count": 3,
    "spec_version": 0,
    "validator": "5FZoQhgUCmqBxnkHX7jCqThScS2xQWiwiF61msg63CFL3Y8f",
    "validator_name": "",
    "validator_index_ids": "",
    "finalized": true
  }
}
@jun0tpyrc jun0tpyrc changed the title Inconsistent data.events for different subscan server, sometimes being empty array Inconsistent data.events for different subscan server for the same block Oct 19, 2020
@jun0tpyrc
Copy link
Author

another opposite example: block 2662841 in Westend testnet

curl -XPOST https://westend.subscan.io/api/scan/block -d '{"block_num": 2662841}' -H "Content-Type: application/json" | jq
public node shows non-empty data.events while our private node shows empty data.events even both are in sync

@jun0tpyrc
Copy link
Author

jun0tpyrc commented Oct 19, 2020

similarly for the mainnet subscan explorer , these all show empty data.events in public explorer

curl -XPOST https://polkadot.subscan.io/api/scan/block -d '{"block_num": 1221841}' -H "Content-Type: application/json" | jq
curl -XPOST https://polkadot.subscan.io/api/scan/block -d '{"block_num": 321841}' -H "Content-Type: application/json" | jq
curl -XPOST https://polkadot.subscan.io/api/scan/block -d '{"block_num": 434441}' -H "Content-Type: application/json" | jq
curl -XPOST https://polkadot.subscan.io/api/scan/block -d '{"block_num": 424441}' -H "Content-Type: application/json" | jq

If we look up using another explorer by polkascan, there should be various events under the block
https://polkascan.io/polkadot/block/1221841#events
https://polkascan.io/polkadot/block/321841#events
https://polkascan.io/polkadot/block/434441#events
https://polkascan.io/polkadot/block/424441#events

@jun0tpyrc jun0tpyrc changed the title Inconsistent data.events for different subscan server for the same block Inconsistent & missing data.events for different subscan server for the same block Oct 19, 2020
@freehere107
Copy link
Collaborator

@jun0tpyrc Subscan hide events like ExtrinsicSuccess or ExtrinsicFail

@jun0tpyrc
Copy link
Author

jun0tpyrc commented Oct 19, 2020

@jun0tpyrc Subscan hide events like ExtrinsicSuccess or ExtrinsicFail

is there flag or param allow us to 'unhide' them ,
btw this still does not explain for some block ,there are obvious not only ExtrinsicSuccess/Fail events

❯ curl -XPOST https://westend.subscan.io/api/scan/block -d '{"block_num": 2662841}' -H "Content-Type: application/json"  | 

(truncated , run curl to get response for public node)

there are various endowed , deposit, new account , PreRuntime etc .. for the one we host , all now these are missing too

{
  "code": 0,
  "message": "Success",
  "ttl": 1,
  "data": {
    "block_num": 2662841,
    "block_timestamp": 1602858294,
    "hash": "0x5fbc35acb1a694259698c05e7e1221d245fa929bb59b2c1b2fc4786c9f826d15",
    "parent_hash": "0x7749f9599cd43056eaf2bd4b65684817f8b49128ffa7216a58d75c83165e0e2e",
    "state_root": "0x7e9ba0638373371e0d56d0b1114a7375148a0ffd91f4202246cbf08392dd5e83",
    "extrinsics_root": "0x6a69dba24029915866ebc00e68f5ea48bad511555c515643d06b4b46c77b7307",
    "extrinsics": [
      {
        "block_timestamp": 1602858294,
        "block_num": 2662841,
        "extrinsic_index": "2662841-0",
        "call_module_function": "set",
        "call_module": "timestamp",
        "params": "[{\"name\":\"now\",\"type\":\"Compact\\u003cMoment\\u003e\",\"value\":1602858294,\"value_raw\":\"\"}]",
        "account_id": "",
        "account_index": "",
        "signature": "",
        "nonce": 0,
        "extrinsic_hash": "",
        "success": true,
        "fee": "0"
      },
      {
        "block_timestamp": 1602858294,
        "block_num": 2662841,
        "extrinsic_index": "2662841-1",
        "call_module_function": "transfer",
        "call_module": "balances",
        "params": "[{\"name\":\"dest\",\"type\":\"Address\",\"value\":\"3ca176059ed24c1f3ad5ccba01ff15e7146ed9982d66e36c97fc609ba8814cb4\",\"value_raw\":\"\"},{\"name\":\"value\",\"type\":\"Compact\\u003cBalance\\u003e\",\"value\":\"10702592500\",\"value_raw\":\"\"}]",
        "account_id": "5DPfa4b2i4paHwWtMow2U8mQXnP96HRWrhU7Z8TNU4YBPrED",
        "account_index": "",
        "signature": "9d970703655e108be1118af336c81a3b4255b2c432a78aabd2fdb7183e2714157a5d5c3f4aab056c7ad2ee9cd07b4e1eac03b6ffcad290c0a93197fea005e200",
        "nonce": 43,
        "extrinsic_hash": "0x550fda02648fda7e6364122e351637a4018ad07e1c61fb80fe8aef9425a172cf",
        "success": true,
        "fee": "15300000001"
      },
      {
        "block_timestamp": 1602858294,
        "block_num": 2662841,
        "extrinsic_index": "2662841-2",
        "call_module_function": "transfer",
        "call_module": "balances",
        "params": "[{\"name\":\"dest\",\"type\":\"Address\",\"value\":\"e165eff656afdcd89d6ba8df6ad9df2e6613974f6f56773e30229578b983e190\",\"value_raw\":\"\"},{\"name\":\"value\",\"type\":\"Compact\\u003cBalance\\u003e\",\"value\":\"10358508300\",\"value_raw\":\"\"}]",
        "account_id": "5DPfa4b2i4paHwWtMow2U8mQXnP96HRWrhU7Z8TNU4YBPrED",
        "account_index": "",
        "signature": "e18eeb07b128eb9d3731e0dcdeb988a50984697e4d77723cc73068fbb9d6cca88b7803e36742a3d625321d7553cc5df8e1610ff9c65a0aa86a4889892f8d480f",
        "nonce": 44,
        "extrinsic_hash": "0xedabb582dbb4e17bd13f725357ab4ac4f77525762ebbf6c71ed3e31d4b18574f",
        "success": true,
        "fee": "15300000001"
      },
      {
        "block_timestamp": 1602858294,
        "block_num": 2662841,
        "extrinsic_index": "2662841-3",
        "call_module_function": "transfer",
        "call_module": "balances",
        "params": "[{\"name\":\"dest\",\"type\":\"Address\",\"value\":\"ec1950ec70b1e5040f351bdeb84caef6f056f7cc875963a1be3ac61268f014df\",\"value_raw\":\"\"},{\"name\":\"value\",\"type\":\"Compact\\u003cBalance\\u003e\",\"value\":\"10786738500\",\"value_raw\":\"\"}]",
        "account_id": "5DPfa4b2i4paHwWtMow2U8mQXnP96HRWrhU7Z8TNU4YBPrED",
        "account_index": "",
        "signature": "3dbb91f39b1319dbea44b5b0217a84d3ab31aa0f326234738fd750eda3dd52ce06164cc9db0b3b041ba823ae67dde4d54bf06699621529f77a344782358f2f0c",
        "nonce": 45,
        "extrinsic_hash": "0x3922a3d895d1087f989fa1de362b939b97f48ce4bac1d2396dc661acbf4a29ce",
        "success": true,
        "fee": "15300000001"
      },
      {
        "block_timestamp": 1602858294,
        "block_num": 2662841,
        "extrinsic_index": "2662841-4",
        "call_module_function": "transfer",
        "call_module": "balances",
        "params": "[{\"name\":\"dest\",\"type\":\"Address\",\"value\":\"cea2bbf617a6a45bba82c2b967520771f65164fd38d24eaaa16f8425c9dd1a97\",\"value_raw\":\"\"},{\"name\":\"value\",\"type\":\"Compact\\u003cBalance\\u003e\",\"value\":\"10581162300\",\"value_raw\":\"\"}]",
        "account_id": "5DPfa4b2i4paHwWtMow2U8mQXnP96HRWrhU7Z8TNU4YBPrED",
        "account_index": "",
        "signature": "ee75b8c1308dc0f5ed19046e7d392210e2394b6514054dbe23523b34fbb2f1b9b9dfd6b72f4e63dd13faab9591affae2431050e51604b43dbe1787ab724b4b0e",
        "nonce": 46,
        "extrinsic_hash": "0x26faa8afc305f82ffc7f293cf425838dab724eb92f6d777c0a36516a61bccb9d",
        "success": true,
        "fee": "15300000001"
      },
      {
        "block_timestamp": 1602858294,
        "block_num": 2662841,
        "extrinsic_index": "2662841-5",
        "call_module_function": "transfer",
        "call_module": "balances",
        "params": "[{\"name\":\"dest\",\"type\":\"Address\",\"value\":\"98bb8dde89f50bb6bbdd98bdf2db78ddd290d60f113bdc5f7da927e5e30995df\",\"value_raw\":\"\"},{\"name\":\"value\",\"type\":\"Compact\\u003cBalance\\u003e\",\"value\":\"10094303700\",\"value_raw\":\"\"}]",
        "account_id": "5DPfa4b2i4paHwWtMow2U8mQXnP96HRWrhU7Z8TNU4YBPrED",
        "account_index": "",
        "signature": "caba5cbfecdcb8e97db02fdf7112b5e1917339e431f824591a7322979e0cead6ca8fe4c5ed8e2a97a42189d78426dddc4630a7d8edc4ab6f655cee3d8de6cf03",
        "nonce": 47,
        "extrinsic_hash": "0xc3960919c6e8cab0359b4cde3d106837aaeb126378ea1d2001cd670c36105923",
        "success": true,
        "fee": "15300000001"
      },
      {
        "block_timestamp": 1602858294,
        "block_num": 2662841,
        "extrinsic_index": "2662841-6",
        "call_module_function": "transfer",
        "call_module": "balances",
        "params": "[{\"name\":\"dest\",\"type\":\"Address\",\"value\":\"0f735b005d84ef227a653ccbc0dbfe9a2e8bfdf7b61f2666e668bf4b61287e60\",\"value_raw\":\"\"},{\"name\":\"value\",\"type\":\"Compact\\u003cBalance\\u003e\",\"value\":\"10999830600\",\"value_raw\":\"\"}]",
        "account_id": "5DPfa4b2i4paHwWtMow2U8mQXnP96HRWrhU7Z8TNU4YBPrED",
        "account_index": "",
        "signature": "430341f374c85b2cf0a424361c239d5dbc23aa33aee0489e6b43d6a75145724314b35fa7c45ee5547c76e6d01ad675ca7bb276bd303a53364cc664347beecb04",
        "nonce": 48,
        "extrinsic_hash": "0x1a35ea85cb3e385f23a98590e018553669c4ab9e92fd2fef9c69f67dcd8973da",
        "success": true,
        "fee": "15300000001"
      },
      {
        "block_timestamp": 1602858294,
        "block_num": 2662841,
        "extrinsic_index": "2662841-7",
        "call_module_function": "transfer",
        "call_module": "balances",
        "params": "[{\"name\":\"dest\",\"type\":\"Address\",\"value\":\"23a4869fcce843c55bc5320e14ec77616cea5a92af2949b911a5fba27d2f8e5d\",\"value_raw\":\"\"},{\"name\":\"value\",\"type\":\"Compact\\u003cBalance\\u003e\",\"value\":\"10189652100\",\"value_raw\":\"\"}]",
        "account_id": "5DPfa4b2i4paHwWtMow2U8mQXnP96HRWrhU7Z8TNU4YBPrED",
        "account_index": "",
        "signature": "c7f67e5197bbec62d61984113db92bee49d22b581f93069f949fc34a9c03276217d8c7e442bbb6ed7e7d5e049a96ef6ce97f80bcf4762e6992e3f3af47f7380d",
        "nonce": 49,
        "extrinsic_hash": "0x45ef429ddd0fb3123c6a3a1c289b3ee486abd68c34818d42c3ad91dcf334732c",
        "success": true,
        "fee": "15300000001"
      },
      {
        "block_timestamp": 1602858294,
        "block_num": 2662841,
        "extrinsic_index": "2662841-8",
        "call_module_function": "transfer",
        "call_module": "balances",
        "params": "[{\"name\":\"dest\",\"type\":\"Address\",\"value\":\"8f2c9e6a5ae10ec0cdd097102080488ef7472a3ed6073a3ee92829d45af82938\",\"value_raw\":\"\"},{\"name\":\"value\",\"type\":\"Compact\\u003cBalance\\u003e\",\"value\":\"10686894100\",\"value_raw\":\"\"}]",
        "account_id": "5DPfa4b2i4paHwWtMow2U8mQXnP96HRWrhU7Z8TNU4YBPrED",
        "account_index": "",
        "signature": "3ec2eb4457abef46d537adb78fee125fa9348db2f81a1f0c8206534f3c324f3f0bead1ab152616488d0caa651e74709461b75c04ca689b3a0f2e7cd1e539980d",
        "nonce": 50,
        "extrinsic_hash": "0x98fb999120ed2b21f43766dcd61dc68675215de8d9f6528a48e3ff7e4e96cece",
        "success": true,
        "fee": "15300000001"
      }
    ],
    "events": [],
    "logs": [],
    "event_count": 0,
    "extrinsics_count": 9,
    "spec_version": 0,
    "validator": "",
    "validator_name": "",
    "validator_index_ids": "",
    "finalized": false
  }
}

@freehere107
Copy link
Collaborator

@jun0tpyrc hello, https://westend.subscan.io/block/2662841?tab=event ,there has all events
And not flag or param allows us to 'unhide' them, maybe add them in future

@jun0tpyrc
Copy link
Author

jun0tpyrc commented Oct 19, 2020

@jun0tpyrc hello, https://westend.subscan.io/block/2662841?tab=event ,there has all events
And not flag or param allows us to 'unhide' them, maybe add them in future

for this example the problem is not on the public explorer, it's for the responses our private node return being incomplete, you may see in the above response , the subscan does store most data & extrinsics same as the public explorer , but events being empty
while no error logs etc for diagnosis / tracing

@freehere107
Copy link
Collaborator

@jun0tpyrc Could you check your chain_blocks table event field? Is there content inside?

@jun0tpyrc
Copy link
Author

jun0tpyrc commented Oct 20, 2020

@jun0tpyrc Could you check your chain_blocks table event field? Is there content inside?

mysql> select block_num, event from chain_blocks_2 order by id desc limit 10;
+-----------+------------------------------------------------------------------------------+
| block_num | event                                                                        |
+-----------+------------------------------------------------------------------------------+
|   2711501 | 0x0800000000000000881b990900000000020000000100000000000000000000000000020000 |
|   2711500 | 0x0800000000000000881b990900000000020000000100000000000000000000000000020000 |
|   2711499 | 0x0800000000000000881b990900000000020000000100000000000000000000000000020000 |
|   2711498 | 0x0800000000000000881b990900000000020000000100000000000000000000000000020000 |
|   2711497 | 0x0800000000000000881b990900000000020000000100000000000000000000000000020000 |
|   2711496 | 0x0800000000000000881b990900000000020000000100000000000000000000000000020000 |
|   2711495 | 0x0800000000000000881b990900000000020000000100000000000000000000000000020000 |
|   2711494 | 0x0800000000000000881b990900000000020000000100000000000000000000000000020000 |
|   2711493 | 0x0800000000000000881b990900000000020000000100000000000000000000000000020000 |
|   2711492 | 0x0400000000000000881b990900000000020000                                     |
+-----------+------------------------------------------------------------------------------+
10 rows in set (0.00 sec)

mysql> select block_num, event from chain_blocks_1 order by id desc limit 10;
+-----------+------------------------------------------------------------------------------------------------------------------+
| block_num | event                                                                                                            |
+-----------+------------------------------------------------------------------------------------------------------------------+
|   1999999 | 0x0c0000000000000080e36a09000000000200000001000000000000000000000000000200000002000000000000ca9a3b00000000020000 |
|   1999998 | 0x0c0000000000000080e36a09000000000200000001000000000000000000000000000200000002000000000000ca9a3b00000000020000 |
|   1999997 | 0x080000000000000080e36a09000000000200000001000000000000ca9a3b00000000020000                                     |
|   1999996 | 0x0c0000000000000080e36a09000000000200000001000000000000000000000000000200000002000000000000ca9a3b00000000020000 |
|   1999995 | 0x080000000000000080e36a09000000000200000001000000000000ca9a3b00000000020000                                     |
|   1999994 | 0x0c0000000000000080e36a09000000000200000001000000000000000000000000000200000002000000000000ca9a3b00000000020000 |
|   1999993 | 0x080000000000000080e36a09000000000200000001000000000000ca9a3b00000000020000                                     |
|   1999992 | 0x0c0000000000000080e36a09000000000200000001000000000000000000000000000200000002000000000000ca9a3b00000000020000 |
|   1999991 | 0x080000000000000080e36a09000000000200000001000000000000ca9a3b00000000020000                                     |
|   1999990 | 0x0c0000000000000080e36a09000000000200000001000000000000000000000000000200000002000000000000ca9a3b00000000020000 |
+-----------+------------------------------------------------------------------------------------------------------------------+
10 rows in set (0.00 sec)

mysql> select block_num, event from chain_blocks order by id desc limit 10;
+-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| block_num | event                                                                                                                                                                                                                                                                                                                                                                                                                                                |
+-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|    999999 | 0x180000000000000080e36a09000000000200000001000000000000000000000000000200000002000000000000ca9a3b0000000002000000030000000202fe747dadf0f62c7d1bac6988a156fdd41cf2d14ccfdc15e289512a7073bbf266feaf3b02510455da90a21c821c6b2653bbbfb441bab0ad1c10186d935662a321005cb2ec2200000000000000000000000000030000000204303c6efdb3f3871109208331303b24a3ab4de6aa40e47c5e03d64fb321b3035000ca9a3b0000000000000000000000000000030000000000c0769f0b00000000000000 |
|    999994 | 0x140000000000000080e36a09000000000200000001000000000000ca9a3b0000000002000000020000000202fe747dadf0f62c7d1bac6988a156fdd41cf2d14ccfdc15e289512a7073bbf266feaf3b02510455da90a21c821c6b2653bbbfb441bab0ad1c10186d935662a321005cb2ec2200000000000000000000000000020000000204943e99feea77d4d5de619ceb1493d232ca026fe0d2af6ca6ed304afd7738ae2d00ca9a3b0000000000000000000000000000020000000000c0769f0b00000000000000                                     |
|    999998 | 0x180000000000000080e36a09000000000200000001000000000000000000000000000200000002000000000000ca9a3b0000000002000000030000000202fe747dadf0f62c7d1bac6988a156fdd41cf2d14ccfdc15e289512a7073bbf266feaf3b02510455da90a21c821c6b2653bbbfb441bab0ad1c10186d935662a321005cb2ec220000000000000000000000000003000000020402cfb4c6a19df730aca94a2b34f0ea242daf1b7182ee613a0a416e2c71934a4300ca9a3b0000000000000000000000000000030000000000c0769f0b00000000000000 |
|    999997 | 0x180000000000000080e36a09000000000200000001000000000000000000000000000200000002000000000000ca9a3b0000000002000000030000000202fe747dadf0f62c7d1bac6988a156fdd41cf2d14ccfdc15e289512a7073bbf266feaf3b02510455da90a21c821c6b2653bbbfb441bab0ad1c10186d935662a321005cb2ec22000000000000000000000000000300000002040ce93a016f4a44d7a3072d6d5d2441d041c6d77dfcf8f5823f2de64af603b92900ca9a3b0000000000000000000000000000030000000000c0769f0b00000000000000 |
|    999996 | 0x0c0000000000000080e36a09000000000200000001000000000000000000000000000200000002000000000000ca9a3b00000000020000                                                                                                                                                                                                                                                                                                                                     |
|    999995 | 0x0c0000000000000080e36a09000000000200000001000000000000000000000000000200000002000000000000ca9a3b00000000020000                                                                                                                                                                                                                                                                                                                                     |
|    999993 | 0x180000000000000080e36a09000000000200000001000000000000000000000000000200000002000000000000ca9a3b0000000002000000030000000202fe747dadf0f62c7d1bac6988a156fdd41cf2d14ccfdc15e289512a7073bbf266feaf3b02510455da90a21c821c6b2653bbbfb441bab0ad1c10186d935662a321005cb2ec22000000000000000000000000000300000002040ce93a016f4a44d7a3072d6d5d2441d041c6d77dfcf8f5823f2de64af603b92900ca9a3b0000000000000000000000000000030000000000c0769f0b00000000000000 |
|    999992 | 0x080000000000000080e36a09000000000200000001000000000000ca9a3b00000000020000                                                                                                                                                                                                                                                                                                                                                                         |
|    999991 | 0x0c0000000000000080e36a09000000000200000001000000000000000000000000000200000002000000000000ca9a3b00000000020000                                                                                                                                                                                                                                                                                                                                     |
|    999990 | 0x080000000000000080e36a09000000000200000001000000000000ca9a3b00000000020000                                                                                                                                                                                                                                                                                                                                                                         |
+-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

We found this may be due to stuck block finalisation (but cannot confirm yet) , that it might be bug of polkadot node binary itself (keep synchronising new blocks, but cannot finalise very old block) , similar to paritytech/polkadot#1755
Screenshot 2020-10-19 at 5 59 39 PM

Might be subscan would only fill the events & logs field only after finalising the block but would index other block field first , may I clarify that?

@freehere107
Copy link
Collaborator

freehere107 commented Oct 20, 2020

@jun0tpyrc subscan will fill block data include extrinsics & events & logs when substrate output new header. Please check chain_logs & chain_events table data, I will debug with you

@jun0tpyrc
Copy link
Author

jun0tpyrc commented Oct 20, 2020

@jun0tpyrc subscan will fill block data include extrinsics & events & logs when substrate output new header. Please check chain_logs & chain_events table data, I will debug with you

Thanks so much , let's focus on the problematic block Westend 2662841 above

query from the mysql also seems the same , block & extrinsics table have its record, logs & events table empty for this record


mysql> select * from chain_blocks_2 where block_num = 2662841;
+--------+-----------+-----------------+--------------------------------------------------------------------+--------------------------------------------------------------------+--------------------------------------------------------------------+--------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+-----------+-------------+-----------+
| id     | block_num | block_timestamp | hash                                                               | parent_hash                                                        | state_root                                                         | extrinsics_root                                                    | logs                                                                                                                                                                                            | extrinsics                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | event_count | extrinsics_count | event                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | spec_version | validator | codec_error | finalized |
+--------+-----------+-----------------+--------------------------------------------------------------------+--------------------------------------------------------------------+--------------------------------------------------------------------+--------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+-----------+-------------+-----------+
| 703377 |   2662841 |      1602858294 | 0x5fbc35acb1a694259698c05e7e1221d245fa929bb59b2c1b2fc4786c9f826d15 | 0x7749f9599cd43056eaf2bd4b65684817f8b49128ffa7216a58d75c83165e0e2e | 0x7e9ba0638373371e0d56d0b1114a7375148a0ffd91f4202246cbf08392dd5e83 | 0x6a69dba24029915866ebc00e68f5ea48bad511555c515643d06b4b46c77b7307 | ["0x06424142453402090000008947ec0f00000000","0x054241424501013475d0db8a4cee5b42aba80f8e1e5c5c22f6d6146325ee3401234c72bca2f02156171784e0aca494a4bd38a22b55c95205964becb8cc9660b86e78f07e1e5c8b"] | ["0x280402000bf09acc317501","0x3502843ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867c009d970703655e108be1118af336c81a3b4255b2c432a78aabd2fdb7183e2714157a5d5c3f4aab056c7ad2ee9cd07b4e1eac03b6ffcad290c0a93197fea005e20000ac0004003ca176059ed24c1f3ad5ccba01ff15e7146ed9982d66e36c97fc609ba8814cb407f499ec7d02","0x3502843ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867c00e18eeb07b128eb9d3731e0dcdeb988a50984697e4d77723cc73068fbb9d6cca88b7803e36742a3d625321d7553cc5df8e1610ff9c65a0aa86a4889892f8d480f00b0000400e165eff656afdcd89d6ba8df6ad9df2e6613974f6f56773e30229578b983e190070c4b6a6902","0x3502843ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867c003dbb91f39b1319dbea44b5b0217a84d3ab31aa0f326234738fd750eda3dd52ce06164cc9db0b3b041ba823ae67dde4d54bf06699621529f77a344782358f2f0c00b4000400ec1950ec70b1e5040f351bdeb84caef6f056f7cc875963a1be3ac61268f014df074491f08202","0x3502843ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867c00ee75b8c1308dc0f5ed19046e7d392210e2394b6514054dbe23523b34fbb2f1b9b9dfd6b72f4e63dd13faab9591affae2431050e51604b43dbe1787ab724b4b0e00b8000400cea2bbf617a6a45bba82c2b967520771f65164fd38d24eaaa16f8425c9dd1a97073cb9af7602","0x3502843ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867c00caba5cbfecdcb8e97db02fdf7112b5e1917339e431f824591a7322979e0cead6ca8fe4c5ed8e2a97a42189d78426dddc4630a7d8edc4ab6f655cee3d8de6cf0300bc00040098bb8dde89f50bb6bbdd98bdf2db78ddd290d60f113bdc5f7da927e5e30995df07d4d9aa5902","0x3502843ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867c00430341f374c85b2cf0a424361c239d5dbc23aa33aee0489e6b43d6a75145724314b35fa7c45ee5547c76e6d01ad675ca7bb276bd303a53364cc664347beecb0400c00004000f735b005d84ef227a653ccbc0dbfe9a2e8bfdf7b61f2666e668bf4b61287e60074818a48f02","0x3502843ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867c00c7f67e5197bbec62d61984113db92bee49d22b581f93069f949fc34a9c03276217d8c7e442bbb6ed7e7d5e049a96ef6ce97f80bcf4762e6992e3f3af47f7380d00c400040023a4869fcce843c55bc5320e14ec77616cea5a92af2949b911a5fba27d2f8e5d0784c0595f02","0x3502843ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867c003ec2eb4457abef46d537adb78fee125fa9348db2f81a1f0c8206534f3c324f3f0bead1ab152616488d0caa651e74709461b75c04ca689b3a0f2e7cd1e539980d00c80004008f2c9e6a5ae10ec0cdd097102080488ef7472a3ed6073a3ee92829d45af82938071410fd7c02"] |           0 |                9 | 0x8c00000000000000881b990900000000020000000100000004023ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867c3ca176059ed24c1f3ad5ccba01ff15e7146ed9982d66e36c97fc609ba8814cb4f499ec7d02000000000000000000000000000100000004042a064d1443688f5b972d8dda6d9f8440acf64b96247d7c21e0b6113874b0334b0179f38f0300000000000000000000000000010000000000f0c9f20c0000000000000000020000000003e165eff656afdcd89d6ba8df6ad9df2e6613974f6f56773e30229578b983e1900000020000000400e165eff656afdcd89d6ba8df6ad9df2e6613974f6f56773e30229578b983e1900c4b6a6902000000000000000000000000000200000004023ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867ce165eff656afdcd89d6ba8df6ad9df2e6613974f6f56773e30229578b983e1900c4b6a6902000000000000000000000000000200000004042a064d1443688f5b972d8dda6d9f8440acf64b96247d7c21e0b6113874b0334b0179f38f0300000000000000000000000000020000000000f0c9f20c00000000000000000300000004023ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867cec1950ec70b1e5040f351bdeb84caef6f056f7cc875963a1be3ac61268f014df4491f08202000000000000000000000000000300000004042a064d1443688f5b972d8dda6d9f8440acf64b96247d7c21e0b6113874b0334b0179f38f0300000000000000000000000000030000000000f0c9f20c00000000000000000400000004023ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867ccea2bbf617a6a45bba82c2b967520771f65164fd38d24eaaa16f8425c9dd1a973cb9af7602000000000000000000000000000400000004042a064d1443688f5b972d8dda6d9f8440acf64b96247d7c21e0b6113874b0334b0179f38f0300000000000000000000000000040000000000f0c9f20c000000000000000005000000000398bb8dde89f50bb6bbdd98bdf2db78ddd290d60f113bdc5f7da927e5e30995df000005000000040098bb8dde89f50bb6bbdd98bdf2db78ddd290d60f113bdc5f7da927e5e30995dfd4d9aa5902000000000000000000000000000500000004023ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867c98bb8dde89f50bb6bbdd98bdf2db78ddd290d60f113bdc5f7da927e5e30995dfd4d9aa5902000000000000000000000000000500000004042a064d1443688f5b972d8dda6d9f8440acf64b96247d7c21e0b6113874b0334b0179f38f0300000000000000000000000000050000000000f0c9f20c00000000000000000600000000030f735b005d84ef227a653ccbc0dbfe9a2e8bfdf7b61f2666e668bf4b61287e6000000600000004000f735b005d84ef227a653ccbc0dbfe9a2e8bfdf7b61f2666e668bf4b61287e604818a48f02000000000000000000000000000600000004023ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867c0f735b005d84ef227a653ccbc0dbfe9a2e8bfdf7b61f2666e668bf4b61287e604818a48f02000000000000000000000000000600000004042a064d1443688f5b972d8dda6d9f8440acf64b96247d7c21e0b6113874b0334b0179f38f0300000000000000000000000000060000000000f0c9f20c000000000000000007000000000323a4869fcce843c55bc5320e14ec77616cea5a92af2949b911a5fba27d2f8e5d000007000000040023a4869fcce843c55bc5320e14ec77616cea5a92af2949b911a5fba27d2f8e5d84c0595f02000000000000000000000000000700000004023ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867c23a4869fcce843c55bc5320e14ec77616cea5a92af2949b911a5fba27d2f8e5d84c0595f02000000000000000000000000000700000004042a064d1443688f5b972d8dda6d9f8440acf64b96247d7c21e0b6113874b0334b0179f38f0300000000000000000000000000070000000000f0c9f20c00000000000000000800000000038f2c9e6a5ae10ec0cdd097102080488ef7472a3ed6073a3ee92829d45af8293800000800000004008f2c9e6a5ae10ec0cdd097102080488ef7472a3ed6073a3ee92829d45af829381410fd7c02000000000000000000000000000800000004023ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867c8f2c9e6a5ae10ec0cdd097102080488ef7472a3ed6073a3ee92829d45af829381410fd7c02000000000000000000000000000800000004042a064d1443688f5b972d8dda6d9f8440acf64b96247d7c21e0b6113874b0334b0179f38f0300000000000000000000000000080000000000f0c9f20c00000000000000 |           45 |           |           1 |         0 |
+--------+-----------+-----------------+--------------------------------------------------------------------+--------------------------------------------------------------------+--------------------------------------------------------------------+--------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+-----------+-------------+-----------+
1 row in set (0.00 sec)





mysql> select * from chain_logs_2 where block_num = 2662841;
Empty set (0.00 sec)


mysql> select * from chain_events_2 where block_num = 2662841;
Empty set (0.00 sec)




mysql> select * from chain_extrinsics_2 where block_num = 2662841;
+---------+-----------------+-----------+-----------------+------------------+--------------+-----------+----------------------+-------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------+-------+------+--------------------------------------------------------------------+-----------+---------+-------------+
| id      | extrinsic_index | block_num | block_timestamp | extrinsic_length | version_info | call_code | call_module_function | call_module | params                                                                                                                                                                                                                 | account_id                                                       | signature                                                                                                                        | nonce | era  | extrinsic_hash                                                     | is_signed | success | fee         |
+---------+-----------------+-----------+-----------------+------------------+--------------+-----------+----------------------+-------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------+-------+------+--------------------------------------------------------------------+-----------+---------+-------------+
| 1428625 | 2662841-0       |   2662841 |      1602858294 |                  | 04           | 0200      | set                  | timestamp   | [{"name":"now","type":"Compact\u003cMoment\u003e","value":1602858294,"value_raw":""}]                                                                                                                                  |                                                                  |                                                                                                                                  |     0 |      | NULL                                                               |         0 |       1 |           0 |
| 1428626 | 2662841-1       |   2662841 |      1602858294 |                  | 84           | 0400      | transfer             | balances    | [{"name":"dest","type":"Address","value":"3ca176059ed24c1f3ad5ccba01ff15e7146ed9982d66e36c97fc609ba8814cb4","value_raw":""},{"name":"value","type":"Compact\u003cBalance\u003e","value":"10702592500","value_raw":""}] | 3ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867c | 9d970703655e108be1118af336c81a3b4255b2c432a78aabd2fdb7183e2714157a5d5c3f4aab056c7ad2ee9cd07b4e1eac03b6ffcad290c0a93197fea005e200 |    43 | 00   | 0x550fda02648fda7e6364122e351637a4018ad07e1c61fb80fe8aef9425a172cf |         1 |       1 | 15300000001 |
| 1428627 | 2662841-2       |   2662841 |      1602858294 |                  | 84           | 0400      | transfer             | balances    | [{"name":"dest","type":"Address","value":"e165eff656afdcd89d6ba8df6ad9df2e6613974f6f56773e30229578b983e190","value_raw":""},{"name":"value","type":"Compact\u003cBalance\u003e","value":"10358508300","value_raw":""}] | 3ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867c | e18eeb07b128eb9d3731e0dcdeb988a50984697e4d77723cc73068fbb9d6cca88b7803e36742a3d625321d7553cc5df8e1610ff9c65a0aa86a4889892f8d480f |    44 | 00   | 0xedabb582dbb4e17bd13f725357ab4ac4f77525762ebbf6c71ed3e31d4b18574f |         1 |       1 | 15300000001 |
| 1428628 | 2662841-3       |   2662841 |      1602858294 |                  | 84           | 0400      | transfer             | balances    | [{"name":"dest","type":"Address","value":"ec1950ec70b1e5040f351bdeb84caef6f056f7cc875963a1be3ac61268f014df","value_raw":""},{"name":"value","type":"Compact\u003cBalance\u003e","value":"10786738500","value_raw":""}] | 3ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867c | 3dbb91f39b1319dbea44b5b0217a84d3ab31aa0f326234738fd750eda3dd52ce06164cc9db0b3b041ba823ae67dde4d54bf06699621529f77a344782358f2f0c |    45 | 00   | 0x3922a3d895d1087f989fa1de362b939b97f48ce4bac1d2396dc661acbf4a29ce |         1 |       1 | 15300000001 |
| 1428629 | 2662841-4       |   2662841 |      1602858294 |                  | 84           | 0400      | transfer             | balances    | [{"name":"dest","type":"Address","value":"cea2bbf617a6a45bba82c2b967520771f65164fd38d24eaaa16f8425c9dd1a97","value_raw":""},{"name":"value","type":"Compact\u003cBalance\u003e","value":"10581162300","value_raw":""}] | 3ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867c | ee75b8c1308dc0f5ed19046e7d392210e2394b6514054dbe23523b34fbb2f1b9b9dfd6b72f4e63dd13faab9591affae2431050e51604b43dbe1787ab724b4b0e |    46 | 00   | 0x26faa8afc305f82ffc7f293cf425838dab724eb92f6d777c0a36516a61bccb9d |         1 |       1 | 15300000001 |
| 1428630 | 2662841-5       |   2662841 |      1602858294 |                  | 84           | 0400      | transfer             | balances    | [{"name":"dest","type":"Address","value":"98bb8dde89f50bb6bbdd98bdf2db78ddd290d60f113bdc5f7da927e5e30995df","value_raw":""},{"name":"value","type":"Compact\u003cBalance\u003e","value":"10094303700","value_raw":""}] | 3ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867c | caba5cbfecdcb8e97db02fdf7112b5e1917339e431f824591a7322979e0cead6ca8fe4c5ed8e2a97a42189d78426dddc4630a7d8edc4ab6f655cee3d8de6cf03 |    47 | 00   | 0xc3960919c6e8cab0359b4cde3d106837aaeb126378ea1d2001cd670c36105923 |         1 |       1 | 15300000001 |
| 1428631 | 2662841-6       |   2662841 |      1602858294 |                  | 84           | 0400      | transfer             | balances    | [{"name":"dest","type":"Address","value":"0f735b005d84ef227a653ccbc0dbfe9a2e8bfdf7b61f2666e668bf4b61287e60","value_raw":""},{"name":"value","type":"Compact\u003cBalance\u003e","value":"10999830600","value_raw":""}] | 3ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867c | 430341f374c85b2cf0a424361c239d5dbc23aa33aee0489e6b43d6a75145724314b35fa7c45ee5547c76e6d01ad675ca7bb276bd303a53364cc664347beecb04 |    48 | 00   | 0x1a35ea85cb3e385f23a98590e018553669c4ab9e92fd2fef9c69f67dcd8973da |         1 |       1 | 15300000001 |
| 1428632 | 2662841-7       |   2662841 |      1602858294 |                  | 84           | 0400      | transfer             | balances    | [{"name":"dest","type":"Address","value":"23a4869fcce843c55bc5320e14ec77616cea5a92af2949b911a5fba27d2f8e5d","value_raw":""},{"name":"value","type":"Compact\u003cBalance\u003e","value":"10189652100","value_raw":""}] | 3ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867c | c7f67e5197bbec62d61984113db92bee49d22b581f93069f949fc34a9c03276217d8c7e442bbb6ed7e7d5e049a96ef6ce97f80bcf4762e6992e3f3af47f7380d |    49 | 00   | 0x45ef429ddd0fb3123c6a3a1c289b3ee486abd68c34818d42c3ad91dcf334732c |         1 |       1 | 15300000001 |
| 1428633 | 2662841-8       |   2662841 |      1602858294 |                  | 84           | 0400      | transfer             | balances    | [{"name":"dest","type":"Address","value":"8f2c9e6a5ae10ec0cdd097102080488ef7472a3ed6073a3ee92829d45af82938","value_raw":""},{"name":"value","type":"Compact\u003cBalance\u003e","value":"10686894100","value_raw":""}] | 3ab2332116bae6677b878d2a0fb43a18fe0e369a099578a842aee32492cd867c | 3ec2eb4457abef46d537adb78fee125fa9348db2f81a1f0c8206534f3c324f3f0bead1ab152616488d0caa651e74709461b75c04ca689b3a0f2e7cd1e539980d |    50 | 00   | 0x98fb999120ed2b21f43766dcd61dc68675215de8d9f6528a48e3ff7e4e96cece |         1 |       1 | 15300000001 |
+---------+-----------------+-----------+-----------------+------------------+--------------+-----------+----------------------+-------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------+-------+------+--------------------------------------------------------------------+-----------+---------+-------------+
9 rows in set (0.00 sec)



mysql> select * from chain_logs_1 where block_num = 2662841;
Empty set (0.00 sec)

mysql> select * from chain_logs_2 where block_num = 2662841;
Empty set (0.00 sec)

mysql> select * from chain_logs where block_num = 2662841;
Empty set (0.01 sec)

mysql> select * from chain_events_1 where block_num = 2662841;
Empty set (0.00 sec)

mysql> select * from chain_events_2 where block_num = 2662841;
Empty set (0.00 sec)

mysql> select * from chain_events_3 where block_num = 2662841;
Empty set (0.00 sec)

mysql> select * from chain_events where block_num = 2662841;
Empty set (0.01 sec)

mysql> select * from chain_logs_3 where block_num = 2662841;
Empty set (0.00 sec)

fields in block table is also different from its final state
curl -XPOST https://westend.subscan.io/api/scan/block -d '{"block_num": 2662841}' -H "Content-Type: application/json" | jq , which show 26 events 2 logs

@jun0tpyrc
Copy link
Author

jun0tpyrc commented Oct 20, 2020

@freehere107

I have more clues , this time for subscan-essentials being used with polkadot mainnet

the subscan-observer container like https://github.com/itering/subscan-essentials/blob/master/docker-compose.yml#L23 , having error logs inside

our docker baked from this commit bd8df32

2102017
INFO 10/20-06:09:43.604 /subscan/internal/service/substrate.go:199 Block num 2102017 hash 0xf6a6f1c1099e24f86d755ca1eadad7a3d89e5e585796d3adfa3dae5602026536
ERROR 10/20-06:09:43.605 /subscan/internal/service/block.go:40 Recovering from panic in DecodeEvent error is: runtime error: index out of range [5] with length 3

2102018
INFO 10/20-06:09:48.672 /subscan/internal/service/substrate.go:199 Block num 2102018 hash 0xbff4b58ba8cf289f744a7c54e23fcd7b7dde0bcd9934d5edd7d7e61a292d84d3
2102012
INFO 10/20-06:09:49.641 /subscan/internal/service/substrate.go:199 Block num 2102012 hash 0x3cb23d0c2c37594db520cbd8bc4266992f3419750055c11c64ccc1eb9c88a49d
ERR: Decode Event get error  Recovering from panic in DecodeEvent error is: runtime error: index out of range [5] with length 3
2102182
INFO 10/20-06:26:13.428 /subscan/internal/service/substrate.go:199 Block num 2102182 hash 0xc8f33896635095079b730631d33093a10b2fff2f96cb2150613effc4fecda558
ERROR 10/20-06:26:13.429 /subscan/internal/service/block.go:40 Recovering from panic in DecodeEvent error is: runtime error: index out of range [5] with length 3

2102177
2102183
INFO 10/20-06:26:18.750 /subscan/internal/service/substrate.go:199 Block num 2102183 hash 0x360eaa8ec3f00cf7298613ebc378eae7fc06d107aa52d65963db56d8f14bcd30
INFO 10/20-06:26:18.750 /subscan/internal/service/substrate.go:199 Block num 2102177 hash 0x3f9e05b063d2674fc69a03981a72b0f0f1291b9947f20024675e334e4c91f8d3
ERR: Decode Event get error  Recovering from panic in DecodeEvent error is: runtime error: index out of range [5] with length 3

2102178
INFO 10/20-06:26:23.045 /subscan/internal/service/substrate.go:199 Block num 2102178 hash 0xa7d2b9db04906ad215ed3f9e5284e10646282321cb5f4d5bf8547a8e129bbf33
2102184
INFO 10/20-06:26:25.822 /subscan/internal/service/substrate.go:199 Block num 2102184 hash 0xe7515fccaedd4fb822cee913d4bc9ae5ec85a4f4b4197d87d2411ca587bb5b58
ERROR 10/20-06:26:25.823 /subscan/internal/service/block.go:40 Recovering from panic in DecodeEvent error is: runtime error: index out of range [19] with length 3

2102017 & 2102012 are the blocks which finally end up never finalised in subscan and with empty logs and events field
(some of them not recovered afterwards forever, but It looks some do?)

@jun0tpyrc
Copy link
Author

changing to ad1c7cc commit now

2102272
INFO 10/20-06:35:13.548 /subscan/internal/service/substrate.go:199 Block num 2102272 hash 0x33d623a9852877e9f29818683168852b7d565db97d88bccca7964ca944f6193c
ERROR 10/20-06:35:13.549 /subscan/internal/service/block.go:40 Recovering from panic in DecodeEvent error is: Vec length 840747162 exceeds 1000

2102273
INFO 10/20-06:35:18.953 /subscan/internal/service/substrate.go:199 Block num 2102273 hash 0xefcab8cb062c53050943fc46b667f561fbde030ae993a9bfd984283ff612600c
2102267
INFO 10/20-06:35:19.671 /subscan/internal/service/substrate.go:199 Block num 2102267 hash 0xe42462d3a6762c3387a9bb86f5568ea359db8e6c64b1ca203649101d6f8765b5
2102268
INFO 10/20-06:35:23.585 /subscan/internal/service/substrate.go:199 Block num 2102268 hash 0x2d6df0895074bcd41f831eef933bb884bb124a56193cc264f8069e236f26a0b8
2102274
INFO 10/20-06:35:24.883 /subscan/internal/service/substrate.go:199 Block num 2102274 hash 0x2b75d1d5ce9a652bd5d008aa7c4c7f0ef21e0644d2f102c9c8f2ec0eca05a14d
2102275
INFO 10/20-06:35:32.004 /subscan/internal/service/substrate.go:199 Block num 2102275 hash 0x23e943e532e0ad71b6cd40d007bf7b34fadeed0ca12603673d9535c18ee99536
2102269
INFO 10/20-06:35:32.206 /subscan/internal/service/substrate.go:199 Block num 2102269 hash 0x35f92b97a655fe30e13b1c336738fb3c1ac653a09ba80e909076e1606841d687
2102270
INFO 10/20-06:35:36.447 /subscan/internal/service/substrate.go:199 Block num 2102270 hash 0x6b937297222eff73fe13706fb4519b4a0e61377ad00c192a810a151a9014a57d
2102276
INFO 10/20-06:35:37.360 /subscan/internal/service/substrate.go:199 Block num 2102276 hash 0x6785c3e9ec8514abb095eb7b1aadc7ab65de5f132bdf592e71e7ad6469ea1acd
2102271
INFO 10/20-06:35:40.355 /subscan/internal/service/substrate.go:199 Block num 2102271 hash 0xe68421e8c9fb727d8bc5a638345c4c41727b0939680c2262ea761c0971fee8a6
2102277
INFO 10/20-06:35:43.725 /subscan/internal/service/substrate.go:199 Block num 2102277 hash 0xbf6d99fda68c2aa679dd009098eb153ba3790a8c1fdc6b9554934431795990c2
2102272
INFO 10/20-06:35:48.957 /subscan/internal/service/substrate.go:199 Block num 2102272 hash 0x33d623a9852877e9f29818683168852b7d565db97d88bccca7964ca944f6193c
ERR: Decode Event get error  Recovering from panic in DecodeEvent error is: Vec length 840747162 exceeds 1000

2102278
INFO 10/20-06:35:49.191 /subscan/internal/service/substrate.go:199 Block num 2102278 hash 0x1b7cf140f00c0214f001c8892e503d584c7878d0569372987c0b60c22870b6c4
2102273
INFO 10/20-06:35:53.123 /subscan/internal/service/substrate.go:199 Block num 2102273 hash 0xefcab8cb062c53050943fc46b667f561fbde030ae993a9bfd984283ff612600c
2102279
INFO 10/20-06:35:55.954 /subscan/internal/service/substrate.go:199 Block num 2102279 hash 0x3e9264e4fe3399d6569b94e55876123d7f75885af33a87f90e828bda30cad7a9
ERROR 10/20-06:35:55.955 /subscan/internal/service/block.go:40 Recovering from panic in DecodeEvent error is: runtime error: index out of range [5] with length 3

similarly both 2102272 , 2102279 get blocks indexed but cannot finalised and with empty events&logs in our database

@freehere107
Copy link
Collaborator

@jun0tpyrc Your Polkadot custom type JSON can use this

{
  "Address": "AccountId",
  "BlockNumber": "U32",
  "LeasePeriod": "BlockNumber",
  "Weight": "u64",
  "Keys": "SessionKeysPolkadot",
  "DispatchInfo": {
    "type": "struct",
    "type_mapping": [
      [
        "weight",
        "Weight"
      ],
      [
        "class",
        "DispatchClass"
      ],
      [
        "paysFee",
        "Pays"
      ]
    ]
  },
  "DispatchClass": {
    "type": "enum",
    "value_list": [
      "Normal",
      "Operational",
      "Mandatory"
    ]
  },
  "DispatchResult": {
    "type": "enum",
    "type_mapping": [
      [
        "Ok",
        "Null"
      ],
      [
        "Error",
        "DispatchError"
      ]
    ]
  },
  "Timepoint": {
    "type": "struct",
    "type_mapping": [
      [
        "height",
        "BlockNumber"
      ],
      [
        "index",
        "u32"
      ]
    ]
  },
  "Multisig": {
    "type": "struct",
    "type_mapping": [
      [
        "when",
        "Timepoint"
      ],
      [
        "deposit",
        "Balance"
      ],
      [
        "depositor",
        "AccountId"
      ],
      [
        "approvals",
        "Vec<AccountId>"
      ]
    ]
  },
  "BalanceLock<Balance, BlockNumber>": {
    "type": "struct",
    "type_mapping": [
      [
        "id",
        "LockIdentifier"
      ],
      [
        "amount",
        "Balance"
      ],
      [
        "reasons",
        "Reasons"
      ]
    ]
  },
  "ProxyType": {
    "type": "enum",
    "value_list": [
      "Any",
      "NonTransfer",
      "Governance",
      "Staking",
      "SudoBalances",
      "IdentityJudgement"
    ]
  },
  "ReferendumInfo": {
    "type": "enum",
    "type_mapping": [
      [
        "Ongoing",
        "ReferendumStatus"
      ],
      [
        "Finished",
        "ReferendumInfoFinished"
      ]
    ]
  },
  "CompactAssignments#23-?": "CompactAssignmentsLatest",
  "RewardDestination#23-?": "RewardDestinationLatest",
  "RefCount": "u32"
}

@jun0tpyrc
Copy link
Author

jun0tpyrc commented Oct 20, 2020

@jun0tpyrc Your Polkadot custom type JSON can use this

{
  "Address": "AccountId",
  "BlockNumber": "U32",
  "LeasePeriod": "BlockNumber",
  "Weight": "u64",
  "Keys": "SessionKeysPolkadot",
  "DispatchInfo": {
    "type": "struct",
    "type_mapping": [
      [
        "weight",
        "Weight"
      ],
      [
        "class",
        "DispatchClass"
      ],
      [
        "paysFee",
        "Pays"
      ]
    ]
  },
  "DispatchClass": {
    "type": "enum",
    "value_list": [
      "Normal",
      "Operational",
      "Mandatory"
    ]
  },
  "DispatchResult": {
    "type": "enum",
    "type_mapping": [
      [
        "Ok",
        "Null"
      ],
      [
        "Error",
        "DispatchError"
      ]
    ]
  },
  "Timepoint": {
    "type": "struct",
    "type_mapping": [
      [
        "height",
        "BlockNumber"
      ],
      [
        "index",
        "u32"
      ]
    ]
  },
  "Multisig": {
    "type": "struct",
    "type_mapping": [
      [
        "when",
        "Timepoint"
      ],
      [
        "deposit",
        "Balance"
      ],
      [
        "depositor",
        "AccountId"
      ],
      [
        "approvals",
        "Vec<AccountId>"
      ]
    ]
  },
  "BalanceLock<Balance, BlockNumber>": {
    "type": "struct",
    "type_mapping": [
      [
        "id",
        "LockIdentifier"
      ],
      [
        "amount",
        "Balance"
      ],
      [
        "reasons",
        "Reasons"
      ]
    ]
  },
  "ProxyType": {
    "type": "enum",
    "value_list": [
      "Any",
      "NonTransfer",
      "Governance",
      "Staking",
      "SudoBalances",
      "IdentityJudgement"
    ]
  },
  "ReferendumInfo": {
    "type": "enum",
    "type_mapping": [
      [
        "Ongoing",
        "ReferendumStatus"
      ],
      [
        "Finished",
        "ReferendumInfoFinished"
      ]
    ]
  },
  "CompactAssignments#23-?": "CompactAssignmentsLatest",
  "RewardDestination#23-?": "RewardDestinationLatest",
  "RefCount": "u32"
}

Comparing the events that my private node can decode, they are having 0 spec_version , does this look a cause why it can't some events ? since inspecting the library this seem a param for decode.

However, I don't know how to fix this now, maybe from the polkadot node / subscan config? Do you have any idea on it?
May I also ask how do I apply the file above ?

(we don't use substrate frontend etc.. just the polkadot node binary & this subscan service)
Many thanks

2020/10/20 07:30:57 junoDebugPolkadot
2020/10/20 07:30:57 &{ID:106686 BlockNum:2102823 BlockTimestamp:1603179018 Hash:0x082519cfc27d53ae367c7d2caf1eab3a251cc3884b0a57016605402e87c1102c ParentHash:0xe856a6dd08e9a9621277ae0a0bf09ab2e1f995812876c9f2c358fa252bd38764 StateRoot:0x97c3bb02ba9e887d1ff27e0fff5d42d1ba5ce9d6265630fedfcfbed58efc7bb5 ExtrinsicsRoot:0xff0ada3dfc64e9bcfcc50c104608f0ce5cb77943c3d615e1e486af0302905bdd Logs:["0x0642414245b501035d0000005718ed0f0000000096575e59b2f8f65d1842438ddd014bc03d39b981c9f218429b6a80c49820d75be8ad1ca2fb0191ccaba641ef8b9c1f22477acc26f841a4bf42e67b737a6e1d03660c42834c4c2d167085585510111c44a40e2395e1f31b044dfba19f67649007","0x0542414245010172b03a909c7412010fa2a3cf3917678df5f584b002d6bd9ff193de2f768db567b88cb6f82520097871258aefa1175b33a4bef513e0a779b39f71f9eec421a183"] Extrinsics:["0x280403000b1077ea447501","0x1c040a0092588000","0x490284d21a5689680a5e569d3c4370d2a94daab5fbdf5befaa07b58d0a1658b0c6a4ad00f0266ab76f2637d77a02533a922e98959fa5fd928eec0a7ec513db798a36d8e1601a56f0e784a665ea6eda3e34e902bd3486b64cf2d656756e2358c04b5dce0df921020e010000050300e665005617222252d0052a835eaab1439adba4f42085a8e0ac163a8030f43e0b00b62ffe6024"] EventCount:0 ExtrinsicsCount:3 Event:0x1800000000000000881b99090000000002000000010000000000000000000000000002000000020000000502d21a5689680a5e569d3c4370d2a94daab5fbdf5befaa07b58d0a1658b0c6a4ad00e665005617222252d0052a835eaab1439adba4f42085a8e0ac163a8030f43e00b62ffe602400000000000000000000000002000000130600b688070000000000000000000000000000020000000504de1491e4b9f70678bf4eecc652a9e392fa6d2ccebee58879ad463aeda836fe33802de201000000000000000000000000000002000000000080cd380b00000000000000 SpecVersion:25 Validator: CodecError:true Finalized:false}
2020/10/20 07:30:57 ^^^^^^^^ ^^^^^^^^^
2020/10/20 07:30:57 25
ERR: Decode Event get error  Recovering from panic in DecodeEvent error is: runtime error: index out of range [5] with length 3

2102824
INFO 10/20-07:30:59.575 /subscan/internal/service/substrate.go:199 Block num 2102824 hash 0x2f67f694bcb3123a6c0d12dcefba936a1150881a03677425d4ba3cf14525b356
2102830
INFO 10/20-07:31:01.430 /subscan/internal/service/substrate.go:199 Block num 2102830 hash 0x194ec3a291054c53d55575474ffdda98e9c2000ec79155f96e9c5a693ef9a89d
2102831
INFO 10/20-07:31:06.847 /subscan/internal/service/substrate.go:199 Block num 2102831 hash 0x67d7d104da40ebb211e8ee94a0dd075fa92c0d9f1764d4186cc482ea8b121140
2102825
INFO 10/20-07:31:07.885 /subscan/internal/service/substrate.go:199 Block num 2102825 hash 0xf11f5d2c05ccfd932033fa1c5c79f1677d6f6b1c367e0a244510d9020f80c99e
2102826
INFO 10/20-07:31:12.033 /subscan/internal/service/substrate.go:199 Block num 2102826 hash 0x804810213eccb5f14568c9bb269f6628f14f948fa13a20cf9ea8040c84e98fe2
2020/10/20 07:31:12 junoDebugPolkadot
2020/10/20 07:31:12 &{ID:106689 BlockNum:2102826 BlockTimestamp:1603179036 Hash:0x804810213eccb5f14568c9bb269f6628f14f948fa13a20cf9ea8040c84e98fe2 ParentHash:0xf11f5d2c05ccfd932033fa1c5c79f1677d6f6b1c367e0a244510d9020f80c99e StateRoot:0x040e1cca15a6c4d249135a3eacc8ae7a9103e831d26f20978c00e352163b1afd ExtrinsicsRoot:0xde2fff3667f0b3ab4de4aacd85a4620e0b3439f486f9258567fd17688f2ff946 Logs:["0x0642414245b50101a20000005a18ed0f00000000826c85873545b1f889c6cc5467ca7bb3bf85c5a8d05aad4ecb61d455e49d17690647923c97e2c12357d3e1a74f08ecaf42476c286b4bb9e4e8f9d2dad866110343298e6235b4a0b2f066d83381b4656c1949c11a881f6bc440d45d531c67a701","0x05424142450101249cc13dfd2fc6d90170a644114eb08d5876ab26e35efa632d889e807c110621fd2b64ba2825f5127bfc5ba7d74ac31f95839f899b3b726f63b33221c80fde83"] Extrinsics:["0x280403000b6abdea447501","0x1c040a009e588000","0x39028400a4bb3ab8a1ae28a67526004108972e6d3e182667a9fe4b051aeb1546db096f01c4f059a3199654b7d6d165eb557527588178c969c4e839fb4fe5671fece02231ef3d85c908f1469457764f8badf88492ea30b07336cfce56a0c0963f5a6b6e840000000500c327c23750fd38957417810ad566e686313161d284688e0a672b904b4386b63e0bb4d91d749013"] EventCount:0 ExtrinsicsCount:3 Event:0x2000000000000000881b9909000000000200000001000000000000000000000000000200000002000000050100a4bb3ab8a1ae28a67526004108972e6d3e182667a9fe4b051aeb1546db096f40420f00000000000000000000000000000002000000000400a4bb3ab8a1ae28a67526004108972e6d3e182667a9fe4b051aeb1546db096f000002000000050200a4bb3ab8a1ae28a67526004108972e6d3e182667a9fe4b051aeb1546db096fc327c23750fd38957417810ad566e686313161d284688e0a672b904b4386b63eb4d91d74901300000000000000000000000002000000130600e257070000000000000000000000000000020000000504cad396f0c3b93229fe68d41bf94d3b5af0e129e5931ab36215fcc8382e7f5b6080f8d5010000000000000000000000000000020000000000f0c9f20c00000000000000 SpecVersion:25 Validator: CodecError:true Finalized:false}
2020/10/20 07:31:12 ^^^^^^^^ ^^^^^^^^^
2020/10/20 07:31:12 25
ERR: Decode Event get error  Recovering from panic in DecodeEvent error is: runtime error: index out of range [5] with length 3

2102832
INFO 10/20-07:31:13.011 /subscan/internal/service/substrate.go:199 Block num 2102832 hash 0xd8c5672292f13fc4e553312ce78ae4bcf5811a87f3844ec54982030eb7a62d0f
ERROR 10/20-07:31:13.012 /subscan/internal/service/block.go:41 Recovering from panic in DecodeEvent error is: runtime error: index out of range [7] with length 3

if I modify to print things out /internal/service/substrate.go just before decodeEvent , eventCount already 0 there

@jun0tpyrc
Copy link
Author

there are intermediate blocks which would be skipped completely too

[root@bprod-dot-1 app]# curl -H "Content-Type: application/json" -d '{"id":199999, "jsonrpc":"2.0", "method": "chain_getBlockHash", "params": [1112933] }' http://localhost:9933/ | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   192  100   108  100    84  36000  28000 --:--:-- --:--:-- --:--:-- 64000
{
  "jsonrpc": "2.0",
  "result": "0x91d10c2fcd8b0c934dfc4df8836fccd1fe6f08373cb1995ceb8697a57b5e0c0b",
  "id": 199999
}
[root@bprod-dot-1 app]# curl -H "Content-Type: application/json" -d '{"id":199999, "jsonrpc":"2.0", "method": "chain_getBlockHash", "params": [1112933] }' http://localhost:9933/ | jq ^C
[root@bprod-dot-1 app]# curl -H "Content-Type: application/json" -d '{"id":199999, "jsonrpc":"2.0", "method": "chain_getBlock", "params": ["0x91d10c2fcd8b0c934dfc4df8836fccd1fe6f08373cb1995ceb8697a57b5e0c0b"] }' http://localhost:9933/ | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   954  100   813  100   141   198k  35250 --:--:-- --:--:-- --:--:--  232k
{
  "jsonrpc": "2.0",
  "result": {
    "block": {
      "extrinsics": [
        "0x280403000ba0b364e17301",
        "0x1004140000"
      ],
      "header": {
        "digest": {
          "logs": [
            "0x0642414245b501039b00000016eddd0f0000000028a4b0f5cb4c226f03bd1b7a05706550f6027404a8e2e0181691229961018e6d1c705ebd93a3e286ef76e5535bae1e90330dcedddff02ca7c2824cdb64a1f502e4085d5123bb9277d1abe54342e886124b6e1a49835a7ba516c8c9ceab21fa05",
            "0x0542414245010140943bc5368a90a7aa284e60f9e480bdadf95e39ebec6243e8bd73163b5eb263eada939b7f0ff8f639abe14d38b9809ee7efe9c9884f1a465afd1b6d27186e8d"
          ]
        },
        "extrinsicsRoot": "0x4e909830674506e8c8f9aad55deea0e8cfdb103581df248f4d9d8e1be34f87d9",
        "number": "0x10fb65",
        "parentHash": "0x80122230ab0ea4ab6359b83cf8c1ca5f93dd97ad3650836f50826f1f167076aa",
        "stateRoot": "0xdd8f04c33e092185e48c38e55bb84ae45f48c535700ad50080033f558d2519fb"
      }
    },
    "justification": null
  },
  "id": 199999
}
[root@bprod-dot-1 app]# curl 0:4399/api/scan/block -d '{"block_num": 1112933}' -H "Content-Type: application/json"  | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    72  100    50  100    22     54     24 --:--:-- --:--:-- --:--:--    78
{
  "code": 0,
  "message": "Success",
  "ttl": 1,
  "data": null
}

@jun0tpyrc
Copy link
Author

if I compare those block with events we fail to decode (while public node can) , the events are mostly with these categories

[
      {
        "event_index": "2113880-2",
        "block_num": 2113880,
        "extrinsic_idx": 2,
        "module_id": "balances",
        "event_id": "Transfer",
        "params": "[{\"type\":\"AccountId\",\"value\":\"5a53de6e6edc44427dc43342f463c3421211547dfa0c2d332543d3015acac94a\",\"value_raw\":\"\"},{\"type\":\"AccountId\",\"value\":\"963d25117abdb4ee311583d5ed5d92d94c83e6e4a3780e0298f18338dff3866e\",\"value_raw\":\"\"},{\"type\":\"Balance\",\"value\":\"22308179421500\",\"value_raw\":\"\"}]",
        "event_idx": 2,
        "extrinsic_hash": "0xfe178acb95f76c8855b60abbba4589358090a6da75b6b3e66f5ecba3ef3ebcef",
        "block_timestamp": 0
      },
      {
        "event_index": "2113880-2",
        "block_num": 2113880,
        "extrinsic_idx": 2,
        "module_id": "treasury",
        "event_id": "Deposit",
        "params": "[{\"type\":\"Balance\",\"value\":\"124000000\",\"value_raw\":\"\"}]",
        "event_idx": 3,
        "extrinsic_hash": "0xfe178acb95f76c8855b60abbba4589358090a6da75b6b3e66f5ecba3ef3ebcef",
        "block_timestamp": 0
      },
      {
        "event_index": "2113880-2",
        "block_num": 2113880,
        "extrinsic_idx": 2,
        "module_id": "balances",
        "event_id": "Deposit",
        "params": "[{\"type\":\"AccountId\",\"value\":\"2c2a55b5a6413894e13836fb0165e6adce7d77c06dccf42b3b288397a27ddd3b\",\"value_raw\":\"\"},{\"type\":\"Balance\",\"value\":\"31000000\",\"value_raw\":\"\"}]",
        "event_idx": 4,
        "extrinsic_hash": "0xfe178acb95f76c8855b60abbba4589358090a6da75b6b3e66f5ecba3ef3ebcef",
        "block_timestamp": 0
      }
    ]
[
      {
        "event_index": "2113854-2",
        "block_num": 2113854,
        "extrinsic_idx": 2,
        "module_id": "treasury",
        "event_id": "Deposit",
        "params": "[{\"type\":\"Balance\",\"value\":\"298400000\",\"value_raw\":\"\"}]",
        "event_idx": 2,
        "extrinsic_hash": "0x72daa46fee0ced73a917aed74c0aaf7bec59f92cd6bb10373fe00638fc1135b5",
        "block_timestamp": 0
      },
      {
        "event_index": "2113854-2",
        "block_num": 2113854,
        "extrinsic_idx": 2,
        "module_id": "balances",
        "event_id": "Deposit",
        "params": "[{\"type\":\"AccountId\",\"value\":\"b2c9f470ebf3f043b8f3d668a7d4f08e8bb1eb47a69f42d2cc7ed6e97c4d0126\",\"value_raw\":\"\"},{\"type\":\"Balance\",\"value\":\"74600000\",\"value_raw\":\"\"}]",
        "event_idx": 3,
        "extrinsic_hash": "0x72daa46fee0ced73a917aed74c0aaf7bec59f92cd6bb10373fe00638fc1135b5",
        "block_timestamp": 0
      }
    ],

@jun0tpyrc
Copy link
Author

jun0tpyrc commented Oct 21, 2020

In this case I bet hosting own subscan by subscan-essentials might not be suitable for production workload ,
because there might be some logics / updated codecs in the backend behind subscan.io, but not ported to subscan-essentials open-source repo

may I confirm there is no rate limit etc behind subscan.io, or do we need to apply separately?

@freehere107
Copy link
Collaborator

@jun0tpyrc https://github.com/itering/subscan-essentials is subscan scaffold, it includes subscan.io basic features like blocks, extrinsic, event, and other. subscan.io uses the same codec as this project. Maybe you still need to read the code yourself to fully use this in a production environment

@jun0tpyrc
Copy link
Author

I am encountering similar things when using with Kusama mainnet

INFO 11/05-02:16:04.781 /subscan/internal/service/substrate.go:199 Block num 3339988 hash 0xc2360e75b8c08bb50237b42b3c20a85e5ae1c1c356a72a8786e8845c3de5a37b
INFO 11/05-02:16:04.781 /subscan/internal/service/substrate.go:199 Block num 3339989 hash 0xe54101c6d26ddf006e0fb9c0b7bded996e310b1daeb815e47a9a629c40ba8b9e
INFO 11/05-02:16:04.782 /subscan/internal/service/substrate.go:199 Block num 3339993 hash 0xa4a1bf3c4e1fbf60e8816bd2ab029442664fca809d53e10b10205aa35fdc529c
INFO 11/05-02:16:04.783 /subscan/internal/service/substrate.go:199 Block num 3339991 hash 0xcbd929788c162079df0e4fa2a1c8cc206581a15a692900152b8c77e609d541e4
INFO 11/05-02:16:04.783 /subscan/internal/service/substrate.go:199 Block num 3339994 hash 0xdd1f5ca9448f31c1254776af59baac672e4b09eac7720671814277d3240c0020
INFO 11/05-02:16:04.784 /subscan/internal/service/substrate.go:199 Block num 3339992 hash 0x0b97a91dda060c5fbc88ad9628297c4618f24f7ad93a964a28927cb231623a3e
ERROR 11/05-02:16:04.806 /subscan/internal/service/block.go:40 Recovering from panic in DecodeEvent error is: Vec length 208870114 exceeds 1000

ERROR 11/05-02:16:04.825 /subscan/internal/service/block.go:40 Recovering from panic in DecodeEvent error is: Vec length 597727847 exceeds 1000

[mysql] 2020/11/05 02:16:04 packets.go:36: read tcp 127.0.0.1:55540->127.0.0.1:3306: i/o timeout
[mysql] 2020/11/05 02:16:04 packets.go:36: read tcp 127.0.0.1:55542->127.0.0.1:3306: i/o timeout

some events can't be decoded as above

@freehere107
Copy link
Collaborator

please check kusama type.json

{
  "Keys": "SessionKeysPolkadot",
  "ValidatorPrefs": {
    "type": "struct",
    "type_mapping": [
      [
        "Commission",
        "Compact<Balance>"
      ]
    ]
  },
  "Timepoint": {
    "type": "struct",
    "type_mapping": [
      [
        "height",
        "BlockNumber"
      ],
      [
        "index",
        "u32"
      ]
    ]
  },
  "Multisig": {
    "type": "struct",
    "type_mapping": [
      [
        "when",
        "Timepoint"
      ],
      [
        "deposit",
        "Balance"
      ],
      [
        "depositor",
        "AccountId"
      ],
      [
        "approvals",
        "Vec<AccountId>"
      ]
    ]
  },
  "BalanceLock<Balance>": {
    "type": "struct",
    "type_mapping": [
      [
        "id",
        "LockIdentifier"
      ],
      [
        "amount",
        "Balance"
      ],
      [
        "reasons",
        "Reasons"
      ]
    ]
  },
  "ReferendumInfo<BlockNumber, Hash>": {
    "type": "enum",
    "type_mapping": [
      [
        "Ongoing",
        "ReferendumStatus"
      ],
      [
        "Finished",
        "ReferendumInfoFinished"
      ]
    ]
  },
  "DispatchClass": {
    "type": "enum",
    "value_list": [
      "Normal",
      "Operational",
      "Mandatory"
    ]
  },
  "DispatchResult": {
    "type": "enum",
    "type_mapping": [
      [
        "Ok",
        "Null"
      ],
      [
        "Error",
        "DispatchError"
      ]
    ]
  },
  "Heartbeat": {
    "type": "struct",
    "type_mapping": [
      [
        "blockNumber",
        "BlockNumber"
      ],
      [
        "networkState",
        "OpaqueNetworkState"
      ],
      [
        "sessionIndex",
        "SessionIndex"
      ],
      [
        "authorityIndex",
        "AuthIndex"
      ]
    ]
  },
  "Weight#1058-?": "u64",
  "Heartbeat#1062-?": {
    "type": "struct",
    "type_mapping": [
      [
        "blockNumber",
        "BlockNumber"
      ],
      [
        "networkState",
        "OpaqueNetworkState"
      ],
      [
        "sessionIndex",
        "SessionIndex"
      ],
      [
        "authorityIndex",
        "AuthIndex"
      ],
      [
        "validatorsLen",
        "u32"
      ]
    ]
  },
  "ReferendumInfo<BlockNumber, Hash, BalanceOf>": {
    "type": "enum",
    "type_mapping": [
      [
        "Ongoing",
        "ReferendumStatus"
      ],
      [
        "Finished",
        "ReferendumInfoFinished"
      ]
    ]
  },
  "DispatchInfo#1062-?": {
    "type": "struct",
    "type_mapping": [
      [
        "weight",
        "Weight"
      ],
      [
        "class",
        "DispatchClass"
      ],
      [
        "paysFee",
        "Pays"
      ]
    ]
  },
  "ReferendumInfo#1019-1054": {
    "type": "struct",
    "type_mapping": [
      [
        "end",
        "BlockNumber"
      ],
      [
        "proposal",
        "Proposal"
      ],
      [
        "threshold",
        "VoteThreshold"
      ],
      [
        "delay",
        "BlockNumber"
      ]
    ]
  },
  "DispatchError#1019-1031": {
    "type": "struct",
    "type_mapping": [
      [
        "module",
        "Option<u8>"
      ],
      [
        "error",
        "u8"
      ]
    ]
  },
  "ProxyType": {
    "type": "enum",
    "value_list": [
      "Any",
      "NonTransfer",
      "Governance",
      "Staking",
      "IdentityJudgement"
    ]
  },
  "Address#1050-?": "AccountId",
  "Box<Proposal>": "BoxProposal",
  "CompactAssignments#2023-?": "CompactAssignmentsLatest",
  "RewardDestination#2023-?": "RewardDestinationLatest",
  "RefCount": "u32"
}

you can use this

@jun0tpyrc
Copy link
Author

jun0tpyrc commented Nov 5, 2020

please check kusama type.json

{
  "Keys": "SessionKeysPolkadot",
  "ValidatorPrefs": {
    "type": "struct",
    "type_mapping": [
      [
        "Commission",
        "Compact<Balance>"
      ]
    ]
  },
  "Timepoint": {
    "type": "struct",
    "type_mapping": [
      [
        "height",
        "BlockNumber"
      ],
      [
        "index",
        "u32"
      ]
    ]
  },
  "Multisig": {
    "type": "struct",
    "type_mapping": [
      [
        "when",
        "Timepoint"
      ],
      [
        "deposit",
        "Balance"
      ],
      [
        "depositor",
        "AccountId"
      ],
      [
        "approvals",
        "Vec<AccountId>"
      ]
    ]
  },
  "BalanceLock<Balance>": {
    "type": "struct",
    "type_mapping": [
      [
        "id",
        "LockIdentifier"
      ],
      [
        "amount",
        "Balance"
      ],
      [
        "reasons",
        "Reasons"
      ]
    ]
  },
  "ReferendumInfo<BlockNumber, Hash>": {
    "type": "enum",
    "type_mapping": [
      [
        "Ongoing",
        "ReferendumStatus"
      ],
      [
        "Finished",
        "ReferendumInfoFinished"
      ]
    ]
  },
  "DispatchClass": {
    "type": "enum",
    "value_list": [
      "Normal",
      "Operational",
      "Mandatory"
    ]
  },
  "DispatchResult": {
    "type": "enum",
    "type_mapping": [
      [
        "Ok",
        "Null"
      ],
      [
        "Error",
        "DispatchError"
      ]
    ]
  },
  "Heartbeat": {
    "type": "struct",
    "type_mapping": [
      [
        "blockNumber",
        "BlockNumber"
      ],
      [
        "networkState",
        "OpaqueNetworkState"
      ],
      [
        "sessionIndex",
        "SessionIndex"
      ],
      [
        "authorityIndex",
        "AuthIndex"
      ]
    ]
  },
  "Weight#1058-?": "u64",
  "Heartbeat#1062-?": {
    "type": "struct",
    "type_mapping": [
      [
        "blockNumber",
        "BlockNumber"
      ],
      [
        "networkState",
        "OpaqueNetworkState"
      ],
      [
        "sessionIndex",
        "SessionIndex"
      ],
      [
        "authorityIndex",
        "AuthIndex"
      ],
      [
        "validatorsLen",
        "u32"
      ]
    ]
  },
  "ReferendumInfo<BlockNumber, Hash, BalanceOf>": {
    "type": "enum",
    "type_mapping": [
      [
        "Ongoing",
        "ReferendumStatus"
      ],
      [
        "Finished",
        "ReferendumInfoFinished"
      ]
    ]
  },
  "DispatchInfo#1062-?": {
    "type": "struct",
    "type_mapping": [
      [
        "weight",
        "Weight"
      ],
      [
        "class",
        "DispatchClass"
      ],
      [
        "paysFee",
        "Pays"
      ]
    ]
  },
  "ReferendumInfo#1019-1054": {
    "type": "struct",
    "type_mapping": [
      [
        "end",
        "BlockNumber"
      ],
      [
        "proposal",
        "Proposal"
      ],
      [
        "threshold",
        "VoteThreshold"
      ],
      [
        "delay",
        "BlockNumber"
      ]
    ]
  },
  "DispatchError#1019-1031": {
    "type": "struct",
    "type_mapping": [
      [
        "module",
        "Option<u8>"
      ],
      [
        "error",
        "u8"
      ]
    ]
  },
  "ProxyType": {
    "type": "enum",
    "value_list": [
      "Any",
      "NonTransfer",
      "Governance",
      "Staking",
      "IdentityJudgement"
    ]
  },
  "Address#1050-?": "AccountId",
  "Box<Proposal>": "BoxProposal",
  "CompactAssignments#2023-?": "CompactAssignmentsLatest",
  "RewardDestination#2023-?": "RewardDestinationLatest",
  "RefCount": "u32"
}

you can use this

yes, seems this one working and not seeing the same error for a few hours , after putting in subscan_configs/source/kusama.json

I note for blocks there might be problem fitting them into existing table schema due to long field

e.g. for kusama mainnet

INFO 11/05-05:50:24.972 /subscan/internal/service/substrate.go:199 Block num 3413965 hash 0xdfc8ea5bbac81fafe0e05f3667bd08bc8caccb2178d298561dfe036a08b859bb
3413964
INFO 11/05-05:50:24.997 /subscan/internal/service/substrate.go:199 Block num 3413967 hash 0xe9c5f4df86ec23eccd921d6201dca8c742dac70f492efa0e3737ce038dac1e08
3413973
3413974
3413975
3413965
3413976
3413977
INFO 11/05-05:50:25.093 /subscan/internal/service/substrate.go:199 Block num 3413969 hash 0xb78e5b3522cee5755275fab5d60616e7464203d89e3ae711e8a21d409c89b858
ERROR 11/05-05:50:25.186 /subscan/internal/service/substrate.go:266 Create chain block error Error 1406: Data too long for column 'logs' at row 1
ERROR 11/05-05:50:25.186 /subscan/internal/service/substrate.go:118 ChainGetBlockHash get error Error 1406: Data too long for column 'logs' at row 1
3413978
3413966
INFO 11/05-05:50:25.362 /subscan/internal/service/substrate.go:199 Block num 3413956 hash 0xdeabfa141981914fcffaee592948e9de794fddc4cd116930519367c2a426c17c
3413967
INFO 11/05-05:50:25.446 /subscan/internal/service/substrate.go:199 Block num 3413968 hash 0xe6078158837e0c775205f84a2b509643d2e07526dc8352aeb40eb8a8a46e212b
3413979
[mysql] 2020/11/05 05:50:25 packets.go:36: read tcp 127.0.0.1:44770->127.0.0.1:3306: i/o timeout
INFO 11/05-05:50:25.781 /subscan/internal/service/substrate.go:199 Block num 3413958 hash 0xa2e7fbd19bd87a564856d0d3e72d24e00e86d949e3528e9978839ed77ae1a841
3413968

@zoheb391
Copy link
Contributor

zoheb391 commented Aug 5, 2021

@jun0tpyrc how did you up the log level? Doesn't seem to work for me

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

3 participants