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

Light client - rejects block on live sync push event #2289

Closed
2 tasks done
Eligioo opened this issue Mar 6, 2024 · 8 comments
Closed
2 tasks done

Light client - rejects block on live sync push event #2289

Eligioo opened this issue Mar 6, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@Eligioo
Copy link
Member

Eligioo commented Mar 6, 2024

New issue checklist

General information

  • Library version(s): 0.20
  • Reproducible in the testnet? (Yes/No): Yes

Bug report

It has been observed that running a light client for some time, causes the node to reject a block at some point. This prevents the node from accepting new blocks and thus falls behind. It is noteworthy that all the rejected blocks are macro blocks so far.

The node doesn't lose consensus as it keeps receiving gossipsubs. Eventually the block queue notices that the gossipsubs are to too far ahead (head_height + window_ahead_max) and starts a macro sync. Which brings the node back to the actual head of the chain and can from there on accept new blocks properly. Until the node rejects a block again and then this cycle repeats itself.

Although the blocks are rejected, they actually end up on the blockchain. Here are some example hashes which can be found in the attached log file:

d9da6da5af60ec28c25e36f3d56e31f51121e0818ffc8aa2ca0bf82e9128d6b4
f2b1aca4f451d61c87e8df38ca8a986c512896db2d8ef0f6037a5dc2d53c298f
dd317a6905bfefc758c8a6108e1d66f7f4e58c8c16b1741f251e51a62dcad284

Expected behavior

Be able to push and accept newly received blocks

Actual behavior

Rejecting some blocks.
Reason: Head push operation failed because of Invalid block: Missing body

Steps to reproduce

Set the sync_mode to light in the client.toml and run the client.

Crash log? Screenshots? Videos? Sample project?

Search the log file for Rejected block
light-client-rejects-live-push-event.log

@Eligioo Eligioo added the bug Something isn't working label Mar 6, 2024
@sisou
Copy link
Member

sisou commented Mar 6, 2024

Unfortunately no reason is given in the WARN message. Could you enable TRACE logs and see if any reason is logged?

@Eligioo
Copy link
Member Author

Eligioo commented Mar 6, 2024

Head push operation failed because of Invalid block: Missing body

@sisou
Copy link
Member

sisou commented Mar 6, 2024

Interesting! I learned from the test branch linked in #2288 (comment) that macro blocks always need to be gossiped with their body. So some node somewhere is sending them without body, and the light node cannot disregard the message and wait for another one. Or maybe that's not how gossipsub works 🤷

@Eligioo
Copy link
Member Author

Eligioo commented Mar 6, 2024

@sisou those rejections always come from peer with ID 12D3KooWJMppaYVt6JuMxBUuTXcpvNrDDiyJZfGyP7UQvY8udUKD, which is your node that is checked out on the nibhar/test/block-header-topic branch.

@sisou
Copy link
Member

sisou commented Mar 6, 2024

Haha, oh shit, really? I thought this was an older issue. How I read the code in that branch, that shouldn't be happening though. @nibhar

@Eligioo
Copy link
Member Author

Eligioo commented Mar 6, 2024

What is happening here is that in the nibhar/test/block-header-topic reads the block without a body (self.blockchain.read().get_block(&block_hash, false)). This causes the rebroadcast of a macro block to not contain a body.

@Eligioo Eligioo closed this as completed Mar 6, 2024
@sisou
Copy link
Member

sisou commented Mar 6, 2024

Fixed in aed4c43 and redeployed.

@hrxi
Copy link
Contributor

hrxi commented Mar 6, 2024

Still seems like a problem that you can DoS a light client like this.

hrxi added a commit that referenced this issue Mar 6, 2024
hrxi added a commit that referenced this issue Mar 11, 2024
@jsdanielh jsdanielh added this to the Nimiq PoS Mainnet milestone Mar 21, 2024
hrxi added a commit that referenced this issue May 16, 2024
jsdanielh pushed a commit that referenced this issue May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants