Skip to content

[ETCM-76] network messages for checkpointing#729

Merged
rtkaczyk merged 1 commit intodevelopfrom
etcm-76-checkpoint-network-messages
Oct 28, 2020
Merged

[ETCM-76] network messages for checkpointing#729
rtkaczyk merged 1 commit intodevelopfrom
etcm-76-checkpoint-network-messages

Conversation

@rtkaczyk
Copy link
Copy Markdown
Contributor

@rtkaczyk rtkaczyk commented Oct 9, 2020

Description

Network messages including latest checkpoint number for best peer selection. Depends on #728

@rtkaczyk rtkaczyk force-pushed the etcm-77-checkpoint-syncing branch 4 times, most recently from fbd1980 to b59b3af Compare October 15, 2020 16:10
@rtkaczyk rtkaczyk force-pushed the etcm-77-checkpoint-syncing branch 4 times, most recently from 70672f2 to f0416e0 Compare October 20, 2020 13:25
Base automatically changed from etcm-77-checkpoint-syncing to develop October 21, 2020 18:16
@rtkaczyk rtkaczyk force-pushed the etcm-76-checkpoint-network-messages branch from 898f733 to fb78ba5 Compare October 21, 2020 19:35
@rtkaczyk rtkaczyk marked this pull request as ready for review October 21, 2020 19:37
@rtkaczyk rtkaczyk requested review from ntallar and pslaski October 21, 2020 19:40
@rtkaczyk rtkaczyk force-pushed the etcm-76-checkpoint-network-messages branch from fb78ba5 to a2ad1a7 Compare October 22, 2020 08:31
Copy link
Copy Markdown
Contributor

@pslaski pslaski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just minor things

// log.warn(
// s"""
// |
// | KAPIBARA
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

protocolVersion,
networkId,
totalDifficulty,
latestCheckpointNumber,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be better to have latestCheckpointNumber as the last field on list, as it's something which might not exist?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, does it matter?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not now, but IMHO as encoding to the RLP means encode to the list of things it should be easier to decode it having optional fields on the end than having them somewhere in the middle

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it's not a case of optionality here. These are different messages with different codes, ie. once the code is determined a completely different structure may follow.
It's not a big deal the order doesn't really matter but these fields are closely related, in fact, after ETCM-263 they will correspond to a single type - ChainWeight, perhaps then it should even be encoded as a nested RLPList? 🤔

assert(obtainEncoded2 == expectedEncoded2)
}

ignore("Tests for NewBlock64?? - or are the ones in MessagesSerializationSpec sufficient") {}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO modifying newBlockGen to generate also code64 messages should be enough

Copy link
Copy Markdown

@ntallar ntallar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have other things to analyse but I'll do that tomorrow and add further comments!

@ntallar
Copy link
Copy Markdown

ntallar commented Oct 23, 2020

I don't like much that whether we send a 63 or 64 version message depends on our block number... on eth when they added eth64 capability (here for example) they made several changes (as far as I understood at least):

  • announce the new capability on handshake
  • have the messages that a node sends to it's peers depend on the capability that they have, instead of our block number. If they announce etc64 then we send Status64 and if not Status63

WDYT? The main drawback I see of the current approach is that you'd never be leaving away the old messages, with what I'm proposing eventually a good chunck of the network will have moved to etc64 and you can deprecate eth63 and even mark those peers as bad ones

@rtkaczyk
Copy link
Copy Markdown
Contributor Author

  • announce the new capability on handshake

I like the idea, but it sounds like a big refactor. For one, where we currently construct the message we don't even who the recipient is. Separate task?

Also do we need this separate notion of capability? Couldn't we just take advantage of protocolVersion?

@ntallar ntallar added the BREAKS PROTOCOL Affects Node2Node interactions in a way that makes them not interoperate label Oct 23, 2020
@ntallar
Copy link
Copy Markdown

ntallar commented Oct 23, 2020

Couldn't we just take advantage of protocolVersion?

Tbh I'm not sure what's the purpose of that protocolVersion... but from what I have seen, ETH/ETC updates of this sort are introduced as new capabilities, so we probably have no escape from that

I like the idea, but it sounds like a big refactor. For one, where we currently construct the message we don't even who the recipient is. Separate task?

Why would it be that big? For now I'm seeing the expected changes to be:

  • Modify our handshake so that the StatusExchangeState receives the capabilities of the peer in some way
  • Modify our peers information to know if a peer supports etc64 capability or not

What would the benefit be of having this PR merged as is?

@rtkaczyk
Copy link
Copy Markdown
Contributor Author

rtkaczyk commented Oct 23, 2020

Tbh I'm not sure what's the purpose of that protocolVersion... but from what I have seen, ETH/ETC updates of this sort are introduced as new capabilities, so we probably have no escape from that

Do you know of an example in ETC?

Why would it be that big? For now I'm seeing the expected changes to be:

Well, at least medium. We'll also need to change how blocks are broadcast. Currently PeerInfo is not available when constructing the message.

What would the benefit be of having this PR merged as is?

It will unblock ETCM-263

@rtkaczyk rtkaczyk force-pushed the etcm-76-checkpoint-network-messages branch from a2ad1a7 to 34a5958 Compare October 23, 2020 18:55
@ntallar
Copy link
Copy Markdown

ntallar commented Oct 23, 2020

Do you know of an example in ETC?

There were no changes like this to ETC post-ETH fork, there are some examples before that, as eth62 and so forth (but I haven't taken a look at them)

Currently PeerInfo is not available when constructing the message.

Couldn't we start building the message on BlockBroadcast? There we have the peer information (and I actually prefer it being built there, to decouple this network message from the syncing)

It will unblock ETCM-263

But I'm not sure about this 🤔 I don't see this PR as close to the ready version as it was the case with the syncing one, and you are doing both so there won't be much parallelization if merged... but yeah, if you think that there will be a lot of overlapping between this and that then we can leave that refactoring for a future task

@rtkaczyk rtkaczyk force-pushed the etcm-76-checkpoint-network-messages branch 2 times, most recently from cde4e85 to 94985ec Compare October 26, 2020 15:18
Copy link
Copy Markdown

@ntallar ntallar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from minor comments, LGTM!

Comment thread src/main/scala/io/iohk/ethereum/network/p2p/messages/CommonMessages.scala Outdated
Comment thread src/test/scala/io/iohk/ethereum/blockchain/sync/PeersClientSpec.scala Outdated
@ntallar
Copy link
Copy Markdown

ntallar commented Oct 26, 2020

But I'm not sure about this thinking I don't see this PR as close to the ready version as it was the case with the syncing one, and you are doing both so there won't be much parallelization if merged... but yeah, if you think that there will be a lot of overlapping between this and that then we can leave that refactoring for a future task

@pslaski regarding ☝️ we discussed it with @rtkaczyk and decided to merge this PR as is and complete the protocol changes implementation both with: https://jira.iohk.io/browse/ETCM-280 and https://jira.iohk.io/browse/ETCM-263

@rtkaczyk rtkaczyk force-pushed the etcm-76-checkpoint-network-messages branch from 94985ec to 024513c Compare October 27, 2020 13:11
Copy link
Copy Markdown

@ntallar ntallar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

 .\\            //.
. \ \          / /.
.\  ,\     /` /,.-
 -.   \  /'/ /  .
 ` -   `-'  \  -
   '.       /.\`
      -    .-
      :`//.'
      .`.'
      .' BP 

@rtkaczyk rtkaczyk force-pushed the etcm-76-checkpoint-network-messages branch from 024513c to 0423f35 Compare October 28, 2020 09:48
@rtkaczyk rtkaczyk force-pushed the etcm-76-checkpoint-network-messages branch from 0423f35 to f0befc1 Compare October 28, 2020 11:11
@rtkaczyk rtkaczyk merged commit f0befc1 into develop Oct 28, 2020
@rtkaczyk rtkaczyk deleted the etcm-76-checkpoint-network-messages branch October 28, 2020 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BREAKS PROTOCOL Affects Node2Node interactions in a way that makes them not interoperate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants