Closed Tbaut closed 11 months ago
This is the failed assertion https://github.com/subsquid/squid-sdk/blob/85c33df3231d0feb985d5cb8c568c4129cb5d470/util/util-internal-ingest-tools/src/hot.ts#L106
I don't really see anything wrong with Chopsticks. Will ask subsquid team for help.
Did you manage to get some more insight into this?
Haven't got an answer from subsquid team. Will followup.
Hey, @Tbaut , could you post full reproduction instructions here?
Sure, it's not straight forward unfortunately since it involves many systems. Here is something that's as simple as it gets:
chopsticks-config.yml
endpoint: wss://rococo-rpc.polkadot.io
mock-signature-host: true
block: 7437969
db: ./db.sqlite
import-storage: System: Account:
And the command
```bash
npx @acala-network/chopsticks@latest --config ./chopsticks-config.yml
Install the squid cli to be able to use sqd
npm i -g @subsquid/cli@latest
Clone the example repo that indexes Rococo transfers, I changed minor things to point it at Chopsticks, and run it (it's with npm as yarn isn't supported by subsquid)
git clone https://github.com/Tbaut/squid-substrate-template.git;
cd squid-substrate-template;
npm ci;
# start target Postgres database and detach
sqd up;
# build the project and start the processor
sqd process;
This will start an indexer pointed at chopsticks and start at the same block height, 7437969, (see the .env
).
It should be firing a bunch of rpcMethod: chain_getHead
at chopsticks.
Get the fatal error on the processor
9:30:58 FATAL sqd:processor AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
(0, assert_1.default)((0, util_internal_1.last)(chain).height === head.height)
Here is the reason
15:10:11 DEBUG sqd:processor:rpc rpc response
rpcUrl: ws://localhost:8000
rpcId: 365
rpcMethod: chain_getBlock
rpcParams: ["0xe786b54466eb089a6c96f7d6849ecb5d2fc21ff03bd9e301887d5bef72d0b200"]
rpcResponse: {"id":365,"jsonrpc":"2.0","result":{"block":{"header":{"parentHash":"0xfd5bbc6e2cd2221a2f608b51c63ca5e1f124a92980f7ab6eafd581c49d2b6c27","number":7437970, ....
chain_getBlock
returns block.header.number
equal to 7437970
, but standard RPC endpoints return hex encoded number.
As a result block number becomes misparsed to a wrong value.
Nice one, it's now fully working :tada: thank you so much for your work.
Hello there, here is my next error. My setup is still the same, still forking rococo at the same block. #7,437,969 and pointing my indexer at it. Then I make a transaction, Chopsticks creates a block, and the indexer fires some rpc at it. Then it fails because it seems that the chain head didn't get updated in Chopsticks.
Here's the log of Chopsticks
Subsquid rpcs and error at the end: