Closed Tbaut closed 1 year ago
chain_getHead
is alias of chain_getBlockHash
. We can add an alias here https://github.com/AcalaNetwork/chopsticks/blob/4a5e41e5d9c7a142e8174a237680754307ce6379/packages/chopsticks/src/rpc/substrate/chain.ts#L106
Thanks for the pointer. I added
export const chain_getHead = chain_getBlockHash
But since it expects a blockNumber as argument, I get
Error handling request: TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
So I added some more logic to fetch the latest block number if no argument was given (see my branch https://github.com/AcalaNetwork/chopsticks/compare/master...Tbaut:chopsticks:tbaut-subsquid-support?expand=1). But then things fail later, e.g when I submit an extrinsic. Not sure what's the culprit.. That's the error on the processor side
AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
(0, assert_1.default)((0, util_internal_1.last)(chain).height === head.height)
While Chopsticks shows no error or relevant log (even in trace) and built a block.
[00:34:51.065] INFO (block-builder/174246): Block built
number: 7437970
hash: "0xe786b54466eb089a6c96f7d6849ecb5d2fc21ff03bd9e301887d5bef72d0b200"
extrinsics: [
"0x11038400d43593c715fdd31c61141abd…4433cf13001e04000000000000000000"
]
pendingExtrinsicsCount: 0
ump: {}
Also I'd expect the node to emit some events such as InBlock
now it only emits the isFinalized
one which is not realistic and breaks the UI I'm testing :)
@Tbaut I've pushed a fix on master. Give it a try and let me know. Also chopsticks will emit tx events, what exactly not working?
Thanks a lot @ermalkaleci this doesn't work unfortunately, probably because the type isn't null
but undefined
. Take a look at my branch posted above. https://github.com/AcalaNetwork/chopsticks/compare/master...Tbaut:chopsticks:tbaut-subsquid-support?expand=1
I get:
Error handling request: TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator)) 'TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator)) at chain_getBlockHash (/home/thib/Github/Tbaut/chopsticks/packages/chopsticks/src/rpc/substrate/chain.ts:18:113)
Regarding the Tx events, when I have a code that looks like
api.tx.balances
.transfer(recipient, 123)
.signAndSend(sender, ({ status, events }) => {
console.log(status)
})
It goes from isReady
, to isFinalized
without the isInBlock
.
@Tbaut I have pushed a fix that handles both null and undefined. Make sure to pull master
It goes from
isReady
, toisFinalized
without theisInBlock
.
Chopsticks will emit inBlock and then immediately finalized. I don't know how why you're not getting it
@Tbaut event is sent but because they're sent too quickly somehow inblock is skipped
@Tbaut I have pushed a fix that handles both null and undefined. Make sure to pull master
I can't see that fix. I still get the same issue on master and the code doesn't have undefined
unless I missed something.
undefined is handle by getBlockAt
. please post more details
There's not much I can post more but to repeat what I've posted...
Error handling request: TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator)) 'TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator)) at chain_getBlockHash (/home/thib/Github/Tbaut/chopsticks/packages/chopsticks/src/rpc/substrate/chain.ts:18:113) at /home/thib/Github/Tbaut/chopsticks/packages/chopsticks/src/rpc/index.ts:35:12
This is pointing at line 18, which is chain_getBlockHash
which is the alias and gets called without params. Looking at this line, it's not handling undefined
and is trying to destructure an array with [blockNumber]
, although this param is undefined, that's I guess the culprit.
Ok got it. So it's a call without params. I thought a request without params is invalid. What tool is sending this request?
@Tbaut another fix is merged into master
Hey there,
I'm forking Rococo and I'd like to run a Subsquid indexer along side Chopsticks.
Running Chopsticks with
When I run the indexer pointing at the ws://localhost:8000 I get the following:
This is a method that exists on public RPCs: