foundry icon indicating copy to clipboard operation
foundry copied to clipboard

Do not download invalid block's children

Open majecty opened this issue 5 years ago • 9 comments

A CodeChain node downloads child blocks of an invalid block. Since the parent block is invalid, verifying the child blocks always fails.

majecty avatar Sep 23 '19 06:09 majecty

We may block the peer for a few hours.

Go Ethereum discussed a similar issue. https://github.com/ethereum/go-ethereum/issues/17935

majecty avatar Dec 24 '19 09:12 majecty

I discussed this issue with @kseo before. @HoOngEe @joojis @Remagpie @sgkim126 What do you think about banning a peer that sent an invalid block for a hour? We may expose the ban time through configuration.

Bitcoin Satoshi client bans IP addresses that misbehave for 24 hours.(link)

majecty avatar Dec 26 '19 06:12 majecty

I want to add the "Good first issue" label in this issue after deciding the policy.

majecty avatar Dec 26 '19 06:12 majecty

@majecty I agree on the policy, but I'm not sure blocking one hour is easy to implement.

sgkim126 avatar Dec 26 '19 09:12 sgkim126

I think it's good enough. Are we going to handle only the peers that sent an invalid block? or are we going to handle other misbehaviors(e.g. too late response) too?

remagpie avatar Dec 26 '19 09:12 remagpie

@sgkim126 I considered adding duration in the blacklist that is used in the network code. Since we already have the blacklist feature, I thought that adding duration in the list is not that hard.

@Remagpie I intend to ban only the peers that sent invalid blocks. We may ban other peers who do different misbehaviors later.

majecty avatar Dec 26 '19 09:12 majecty

Okay. Let's try it.

sgkim126 avatar Dec 26 '19 10:12 sgkim126

@sgkim126 I remember you had some plan about "scoring" the peers for managing the connections. Is that still valid? and would it be related to this issue?

remagpie avatar Dec 27 '19 02:12 remagpie

@Remagpie Yes, I still had, but it needs some more discussion yet. I think timed-blocking would work well for now.

sgkim126 avatar Dec 27 '19 07:12 sgkim126