question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Api doesn't return all blocks from subscribeNewHeads when equivocation happens

See original GitHub issue

Not sure if this is polkadot-js/api, substrate related or both. I’ve got three development OSX machines on local network runing polkadot-kusama nodes trying to test and catch equivocations. My node version is 0.7.19-7c34a67 on all machines polkadot-js api version is 1.0.0-beta.17

My bootstrap validator node (Alice) is running with command

 ./target/release/polkadot   --base-path /tmp/alice   --chain local   --alice   --port 30333   --ws-port 9944   --rpc-port 9933 --validator

command to run equivocating validator nodes (Bob) is

./target/release/polkadot   --base-path /tmp/bob   --chain local   --bob   --port 30333   --ws-port 9944   --rpc-port 9933   --validator --bootnodes /ip4/192.168.0.94/tcp/30333/p2p/QmPUTDXgUonhf46aAXKufWJjnJXzxdGKVaAWEzFeao6wnv

I’m listening to new blocks via

api.rpc.chain.subscribeNewHeads()

When validator nodes Equivocate, Bob1 returns block 0xBob1, Bob2 returns block 0xBob2 Alice receives 0xBob1 or 0xBob2 not both. It also logs this into terminal, while Bob1 and Bob2 act normally.

Slot author Public(8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48 (5FHneW46...)) is equivocating at slot 263316560 with headers 0xBob1 and 0xBob2

Now, if I want to detect equivocation via polkadot-js/api I need to also

api.rpc.chain.subscribeFinalizedHeads()

I need to compare heads on the same height, if I detect different blocks with the same author, since it will also trigger if there was a fork, I can detect equivocation.

The problem with this is it needs to run on all validator instances all the time to be detectable, because it will not trigger for 0xBob2 if it’s the finalized block. It would be more predictable if every node received all the blocks just like when fork happens.

Is there any better way to do this right now?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
jacogrcommented, Jan 25, 2020

This s not on the API layer itself, the subscription is just a thin wrapper around the RPC - all it does extra is to take the raw data and creates an API type from it.

Even in the cases on forks, you will notice that the node will generally report more forks in the logs than what is received via RPC.

I have had a discussion with @tomusdrw in the past for an additional RPC on Substrate (like subscribeNewHeads), that actually returns everything. The existing RPC is not really the correct avenue to receive everything (which could also include blocks in the past from forks, the current follows the best tip).

0reactions
polkadot-js-botcommented, Jun 4, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

Read more comments on GitHub >

github_iconTop Results From Across the Web

what happens if we does not subscribe to HttpClient request ...
my understanding was this.http.get('assets/userDetail.json') will hit the url even if we does not subscribe to response data stream.
Read more >
Extrinsics - polkadot{.js}
summary: Disband the Alliance, remove all active members and unreserve deposits. Witness data must be set. elevateAlly(ally: MultiAddress )​. interface: api.tx.
Read more >
AlchemyWeb3.js Quickstart - Alchemy Docs
If you use your WebSocket URL when initializing, then when you create subscriptions using web3.eth.subscribe() , Alchemy Web3 will bring the following ...
Read more >
Untitled
Best middle linebackers of all time, Admin review application form, Saskpower boundary dam 3 ccs project, Metal bending youtube! Germany 1945 population ...
Read more >
What fallacy in Pascal's Wager allows replacing God with the ...
This is not the only issue with Pascal's Wager, but what is described in the question is called the fallacy of proving too...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found