Skip to content

Commit 1fcfbba

Browse files
rtkaczykpslaski
authored andcommitted
etcm-402 added negotiating protocol version in message codec
1 parent b151624 commit 1fcfbba

File tree

66 files changed

+355
-203
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+355
-203
lines changed

src/benchmark/scala/io/iohk/ethereum/rlp/RLPSpeedSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import akka.util.ByteString
44
import io.iohk.ethereum.ObjectGenerators
55
import io.iohk.ethereum.domain.Block._
66
import io.iohk.ethereum.domain._
7-
import io.iohk.ethereum.network.p2p.messages.CommonMessages.SignedTransactions._
7+
import io.iohk.ethereum.network.p2p.messages.PV60.SignedTransactions._
88
import io.iohk.ethereum.utils.Logger
99
import io.iohk.ethereum.utils.Hex
1010
import org.scalacheck.Gen

src/ets/scala/io/iohk/ethereum/ets/blockchain/BlockchainTestConfig.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ object BlockchainTestConfig {
3030
difficultyBombRemovalBlockNumber = 5900000,
3131
chainId = 0x1.toByte,
3232
networkId = 1,
33+
protocolVersion = 63,
3334
customGenesisFileOpt = Some("test-genesis.json"),
3435
monetaryPolicyConfig =
3536
MonetaryPolicyConfig(5000000, 0.2, BigInt("5000000000000000000"), BigInt("3000000000000000000")),

src/it/scala/io/iohk/ethereum/sync/util/CommonFakePeer.scala

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
package io.iohk.ethereum.sync.util
22

3-
import java.nio.file.Files
4-
import java.time.Clock
5-
import java.util.concurrent.atomic.AtomicReference
6-
73
import akka.actor.{ActorRef, ActorSystem}
84
import akka.testkit.TestProbe
95
import akka.util.{ByteString, Timeout}
106
import io.iohk.ethereum.blockchain.sync.regular.BlockBroadcast.BlockToBroadcast
11-
import io.iohk.ethereum.blockchain.sync.regular.{BlockBroadcast, BlockBroadcasterActor}
127
import io.iohk.ethereum.blockchain.sync.regular.BlockBroadcasterActor.BroadcastBlock
8+
import io.iohk.ethereum.blockchain.sync.regular.{BlockBroadcast, BlockBroadcasterActor}
139
import io.iohk.ethereum.blockchain.sync.{BlockchainHostActor, TestSyncConfig}
1410
import io.iohk.ethereum.db.components.{RocksDbDataSourceComponent, Storages}
1511
import io.iohk.ethereum.db.dataSource.{RocksDbConfig, RocksDbDataSource}
1612
import io.iohk.ethereum.db.storage.pruning.{ArchivePruning, PruningMode}
1713
import io.iohk.ethereum.db.storage.{AppStateStorage, Namespaces}
1814
import io.iohk.ethereum.domain.{Block, Blockchain, BlockchainImpl, ChainWeight}
19-
import io.iohk.ethereum.security.SecureRandomBuilder
2015
import io.iohk.ethereum.ledger.InMemoryWorldStateProxy
2116
import io.iohk.ethereum.mpt.MerklePatriciaTrie
2217
import io.iohk.ethereum.network.EtcPeerManagerActor.PeerInfo
@@ -25,18 +20,13 @@ import io.iohk.ethereum.network.discovery.PeerDiscoveryManager.DiscoveredNodesIn
2520
import io.iohk.ethereum.network.discovery.{DiscoveryConfig, Node}
2621
import io.iohk.ethereum.network.handshaker.{EtcHandshaker, EtcHandshakerConfiguration, Handshaker}
2722
import io.iohk.ethereum.network.p2p.EthereumMessageDecoder
23+
import io.iohk.ethereum.network.p2p.Message.Version
24+
import io.iohk.ethereum.network.p2p.messages.ProtocolNegotiator
2825
import io.iohk.ethereum.network.rlpx.AuthHandshaker
2926
import io.iohk.ethereum.network.rlpx.RLPxConnectionHandler.RLPxConfiguration
30-
import io.iohk.ethereum.network.{
31-
EtcPeerManagerActor,
32-
ForkResolver,
33-
KnownNodesManager,
34-
PeerEventBusActor,
35-
PeerManagerActor,
36-
PeerStatisticsActor,
37-
ServerActor
38-
}
27+
import io.iohk.ethereum.network.{EtcPeerManagerActor, ForkResolver, KnownNodesManager, PeerEventBusActor, PeerManagerActor, PeerStatisticsActor, ServerActor}
3928
import io.iohk.ethereum.nodebuilder.PruningConfigBuilder
29+
import io.iohk.ethereum.security.SecureRandomBuilder
4030
import io.iohk.ethereum.sync.util.SyncCommonItSpec._
4131
import io.iohk.ethereum.sync.util.SyncCommonItSpecUtils._
4232
import io.iohk.ethereum.utils.ServerStatus.Listening
@@ -45,6 +35,9 @@ import io.iohk.ethereum.vm.EvmConfig
4535
import io.iohk.ethereum.{Fixtures, Timeouts}
4636
import monix.eval.Task
4737

38+
import java.nio.file.Files
39+
import java.time.Clock
40+
import java.util.concurrent.atomic.AtomicReference
4841
import scala.concurrent.duration.{FiniteDuration, _}
4942

5043
abstract class CommonFakePeer(peerName: String, fakePeerCustomConfig: FakePeerCustomConfig)
@@ -169,10 +162,12 @@ abstract class CommonFakePeer(peerName: String, fakePeerCustomConfig: FakePeerCu
169162
override val peerConfiguration: PeerConfiguration = peerConf
170163
override val blockchain: Blockchain = bl
171164
override val appStateStorage: AppStateStorage = storagesInstance.storages.appStateStorage
172-
override val protocolVersion: Int = Config.Network.protocolVersion
165+
override val protocolVersion: Version = blockchainConfig.protocolVersion
173166
}
174167

175-
lazy val handshaker: Handshaker[PeerInfo] = EtcHandshaker(handshakerConfiguration)
168+
val protocolNegotiator = new ProtocolNegotiator(handshakerConfiguration.protocolVersion)
169+
170+
lazy val handshaker: Handshaker[PeerInfo] = EtcHandshaker(handshakerConfiguration, protocolNegotiator)
176171

177172
lazy val authHandshaker: AuthHandshaker = AuthHandshaker(nodeKey, secureRandom)
178173

@@ -190,7 +185,7 @@ abstract class CommonFakePeer(peerName: String, fakePeerCustomConfig: FakePeerCu
190185
authHandshaker,
191186
EthereumMessageDecoder,
192187
discoveryConfig,
193-
Config.Network.protocolVersion
188+
protocolNegotiator
194189
),
195190
"peer-manager"
196191
)

src/it/scala/io/iohk/ethereum/txExecTest/ECIP1017Test.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class ECIP1017Test extends AnyFlatSpec with Matchers {
2222
maxCodeSize = None,
2323
chainId = 0x3d.toByte,
2424
networkId = 1,
25+
protocolVersion = 63,
2526
frontierBlockNumber = 0,
2627
homesteadBlockNumber = 1150000,
2728
eip106BlockNumber = Long.MaxValue,

src/it/scala/io/iohk/ethereum/txExecTest/ForksTest.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class ForksTest extends AnyFlatSpec with Matchers {
2727
// unused
2828
bootstrapNodes = Set(),
2929
networkId = 1,
30+
protocolVersion = 63,
3031
maxCodeSize = None,
3132
eip161BlockNumber = Long.MaxValue,
3233
customGenesisFileOpt = None,

src/it/scala/io/iohk/ethereum/txExecTest/util/DumpChainApp.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import io.iohk.ethereum.network.PeerStatisticsActor
2323
import io.iohk.ethereum.network.discovery.DiscoveryConfig
2424
import io.iohk.ethereum.network.handshaker.{EtcHandshaker, EtcHandshakerConfiguration, Handshaker}
2525
import io.iohk.ethereum.network.p2p.EthereumMessageDecoder
26+
import io.iohk.ethereum.network.p2p.Message.Version
27+
import io.iohk.ethereum.network.p2p.messages.ProtocolNegotiator
2628
import io.iohk.ethereum.network.rlpx.RLPxConnectionHandler.RLPxConfiguration
2729
import io.iohk.ethereum.network.{ForkResolver, PeerEventBusActor, PeerManagerActor}
2830
import io.iohk.ethereum.nodebuilder.{AuthHandshakerBuilder, NodeKeyBuilder}
@@ -91,10 +93,12 @@ object DumpChainApp extends App with NodeKeyBuilder with SecureRandomBuilder wit
9193
override val peerConfiguration: PeerConfiguration = peerConfig
9294
override val blockchain: Blockchain = DumpChainApp.blockchain
9395
override val appStateStorage: AppStateStorage = storagesInstance.storages.appStateStorage
94-
override val protocolVersion: Int = Config.Network.protocolVersion
96+
override val protocolVersion: Version = blockchainConfig.protocolVersion
9597
}
9698

97-
lazy val handshaker: Handshaker[PeerInfo] = EtcHandshaker(handshakerConfiguration)
99+
val protocolNegotiator = new ProtocolNegotiator(handshakerConfiguration.protocolVersion)
100+
101+
lazy val handshaker: Handshaker[PeerInfo] = EtcHandshaker(handshakerConfiguration, protocolNegotiator)
98102

99103
val peerMessageBus = actorSystem.actorOf(PeerEventBusActor.props)
100104

@@ -111,7 +115,7 @@ object DumpChainApp extends App with NodeKeyBuilder with SecureRandomBuilder wit
111115
authHandshaker = authHandshaker,
112116
messageDecoder = EthereumMessageDecoder,
113117
discoveryConfig = discoveryConfig,
114-
bestProtocolVersion = Config.Network.protocolVersion
118+
protocolNegotiator = protocolNegotiator
115119
),
116120
"peer-manager"
117121
)

src/main/resources/application.conf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ mantis {
3434
}
3535

3636
network {
37-
# Ethereum protocol version
38-
# Supported versions:
39-
# 63, 64 (experimental version which enables usage of messages with checkpointing information. In the future after ETCM-355, ETCM-356, it will be 66 probably)
40-
protocol-version = 63
41-
4237
server-address {
4338
# Listening interface for Ethereum protocol connections
4439
interface = "0.0.0.0"

src/main/resources/chains/etc-chain.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
# 1 - mainnet, 3 - ropsten, 7 - mordor
44
network-id = 1
55

6+
# Ethereum protocol version
7+
# Supported versions:
8+
# 63, 64 (experimental version which enables usage of messages with checkpointing information. In the future after ETCM-355, ETCM-356, it will be 66 probably)
9+
network.protocol-version = 63
10+
611
# Possibility to set Proof of Work target time for testing purposes.
712
# null means that the standard difficulty calculation rules are used
813
pow-target-time = null

src/main/resources/chains/eth-chain.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
# 1 - mainnet, 3 - ropsten, 7 - mordor
44
network-id = 1
55

6+
# Ethereum protocol version
7+
# Supported versions:
8+
# 63, 64 (experimental version which enables usage of messages with checkpointing information. In the future after ETCM-355, ETCM-356, it will be 66 probably)
9+
network.protocol-version = 63
10+
611
# Possibility to set Proof of Work target time for testing purposes.
712
# null means that the standard difficulty calculation rules are used
813
pow-target-time = null

src/main/resources/chains/mordor-chain.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
# 1 - mainnet, 3 - ropsten, 7 - mordor
44
network-id = 7
55

6+
# Ethereum protocol version
7+
# Supported versions:
8+
# 63, 64 (experimental version which enables usage of messages with checkpointing information. In the future after ETCM-355, ETCM-356, it will be 66 probably)
9+
network.protocol-version = 63
10+
611
# Possibility to set Proof of Work target time for testing purposes.
712
# null means that the standard difficulty calculation rules are used
813
pow-target-time = null

src/main/resources/chains/ropsten-chain.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
# 1 - mainnet, 3 - ropsten, 7 - mordor
44
network-id = 3
55

6+
# Ethereum protocol version
7+
# Supported versions:
8+
# 63, 64 (experimental version which enables usage of messages with checkpointing information. In the future after ETCM-355, ETCM-356, it will be 66 probably)
9+
network.protocol-version = 63
10+
611
# Possibility to set Proof of Work target time for testing purposes.
712
# null means that the standard difficulty calculation rules are used
813
pow-target-time = null

src/main/resources/chains/test-chain.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
# 1 - mainnet, 7 - mordor
44
network-id = 1
55

6+
# Ethereum protocol version
7+
# Supported versions:
8+
# 63, 64 (experimental version which enables usage of messages with checkpointing information. In the future after ETCM-355, ETCM-356, it will be 66 probably)
9+
network.protocol-version = 63
10+
611
# Possibility to set Proof of Work target time for testing purposes.
712
# null means that the standard difficulty calculation rules are used
813
pow-target-time = null

src/main/resources/chains/testnet-internal-gac-chain.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
# 1 - mainnet, 3 - ropsten, 7 - mordor
44
network-id = 42
55

6+
# Ethereum protocol version
7+
# Supported versions:
8+
# 63, 64 (experimental version which enables usage of messages with checkpointing information. In the future after ETCM-355, ETCM-356, it will be 66 probably)
9+
network.protocol-version = 63
10+
611
# Possibility to set Proof of Work target time for testing purposes.
712
# null means that the standard difficulty calculation rules are used
813
pow-target-time = null

src/main/resources/chains/testnet-internal-nomad-chain.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
# 1 - mainnet, 3 - ropsten, 7 - mordor
44
network-id = 42
55

6+
# Ethereum protocol version
7+
# Supported versions:
8+
# 63, 64 (experimental version which enables usage of messages with checkpointing information. In the future after ETCM-355, ETCM-356, it will be 66 probably)
9+
network.protocol-version = 63
10+
611
# Possibility to set Proof of Work target time for testing purposes.
712
# null means that the standard difficulty calculation rules are used
813
pow-target-time = 30 seconds

src/main/scala/io/iohk/ethereum/blockchain/sync/regular/BlockBroadcast.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import io.iohk.ethereum.domain.{Block, ChainWeight}
66
import io.iohk.ethereum.network.EtcPeerManagerActor.PeerInfo
77
import io.iohk.ethereum.network.p2p.MessageSerializable
88
import io.iohk.ethereum.network.p2p.messages.PV62.BlockHash
9-
import io.iohk.ethereum.network.p2p.messages.{CommonMessages, PV62, PV64, ProtocolVersions}
9+
import io.iohk.ethereum.network.p2p.messages.{PV60, PV62, PV64, ProtocolVersions}
1010
import io.iohk.ethereum.network.{EtcPeerManagerActor, Peer}
1111

1212
import scala.util.Random
@@ -71,7 +71,7 @@ object BlockBroadcast {
7171
* (they are different versions of NewBlock msg)
7272
*/
7373
case class BlockToBroadcast(block: Block, chainWeight: ChainWeight) {
74-
def as63: CommonMessages.NewBlock = CommonMessages.NewBlock(block, chainWeight.totalDifficulty)
74+
def as63: PV60.NewBlock = PV60.NewBlock(block, chainWeight.totalDifficulty)
7575
def as64: PV64.NewBlock = PV64.NewBlock(block, chainWeight)
7676
}
7777
}

src/main/scala/io/iohk/ethereum/blockchain/sync/regular/BlockFetcher.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import io.iohk.ethereum.network.PeerEventBusActor.PeerEvent.MessageFromPeer
2121
import io.iohk.ethereum.network.PeerEventBusActor.SubscriptionClassifier.MessageClassifier
2222
import io.iohk.ethereum.network.PeerEventBusActor.{PeerSelector, Subscribe, Unsubscribe}
2323
import io.iohk.ethereum.network.PeerId
24-
import io.iohk.ethereum.network.p2p.messages.{Codes, CommonMessages, PV64}
24+
import io.iohk.ethereum.network.p2p.messages.{Codes, PV60, PV64}
2525
import io.iohk.ethereum.network.p2p.messages.PV62._
2626
import io.iohk.ethereum.network.p2p.messages.PV63.{GetNodeData, NodeData}
2727
import io.iohk.ethereum.utils.ByteStringUtils
@@ -197,7 +197,8 @@ class BlockFetcher(
197197
}
198198
supervisor ! ProgressProtocol.GotNewBlock(newState.knownTop)
199199
fetchBlocks(newState)
200-
case MessageFromPeer(CommonMessages.NewBlock(block, _), peerId) =>
200+
// Remember to always add match for every new version of NewBlock message
201+
case MessageFromPeer(PV60.NewBlock(block, _), peerId) =>
201202
handleNewBlock(block, peerId, state)
202203
case MessageFromPeer(PV64.NewBlock(block, _), peerId) =>
203204
handleNewBlock(block, peerId, state)

src/main/scala/io/iohk/ethereum/domain/Block.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ case class Block(header: BlockHeader, body: BlockBody) {
2929
object Block {
3030

3131
implicit class BlockEnc(val obj: Block) extends RLPSerializable {
32-
import io.iohk.ethereum.network.p2p.messages.CommonMessages.SignedTransactions._
32+
import io.iohk.ethereum.network.p2p.messages.PV60.SignedTransactions._
3333

3434
override def toRLPEncodable: RLPEncodeable = RLPList(
3535
obj.header.toRLPEncodable,
@@ -39,7 +39,7 @@ object Block {
3939
}
4040

4141
implicit class BlockDec(val bytes: Array[Byte]) extends AnyVal {
42-
import io.iohk.ethereum.network.p2p.messages.CommonMessages.SignedTransactions._
42+
import io.iohk.ethereum.network.p2p.messages.PV60.SignedTransactions._
4343
def toBlock: Block = rawDecode(bytes) match {
4444
case RLPList(header: RLPList, stx: RLPList, uncles: RLPList) =>
4545
Block(

src/main/scala/io/iohk/ethereum/domain/BlockBody.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ object BlockBody {
3131

3232
implicit class BlockBodyEnc(msg: BlockBody) extends RLPSerializable {
3333
override def toRLPEncodable: RLPEncodeable = {
34-
import io.iohk.ethereum.network.p2p.messages.CommonMessages.SignedTransactions._
34+
import io.iohk.ethereum.network.p2p.messages.PV60.SignedTransactions._
3535

3636
blockBodyToRlpEncodable(
3737
msg,
@@ -61,7 +61,7 @@ object BlockBody {
6161

6262
implicit class BlockBodyRLPEncodableDec(val rlpEncodeable: RLPEncodeable) {
6363
def toBlockBody: BlockBody = {
64-
import io.iohk.ethereum.network.p2p.messages.CommonMessages.SignedTransactions._
64+
import io.iohk.ethereum.network.p2p.messages.PV60.SignedTransactions._
6565

6666
rlpEncodableToBlockBody(
6767
rlpEncodeable,

src/main/scala/io/iohk/ethereum/domain/SignedTransaction.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@ import com.google.common.cache.{Cache, CacheBuilder}
55
import io.iohk.ethereum.crypto
66
import io.iohk.ethereum.crypto.{ECDSASignature, kec256}
77
import io.iohk.ethereum.mpt.ByteArraySerializable
8-
import io.iohk.ethereum.network.p2p.messages.CommonMessages.SignedTransactions._
8+
import io.iohk.ethereum.network.p2p.messages.PV60.SignedTransactions._
99
import io.iohk.ethereum.rlp.RLPImplicitConversions._
1010
import io.iohk.ethereum.rlp.RLPImplicits._
1111
import io.iohk.ethereum.rlp.{encode => rlpEncode, _}
12-
import java.math.BigInteger
13-
import java.util.concurrent.Executors
1412
import monix.eval.Task
1513
import monix.execution.Scheduler
1614
import org.bouncycastle.crypto.AsymmetricCipherKeyPair
1715
import org.bouncycastle.util.encoders.Hex
16+
17+
import java.math.BigInteger
18+
import java.util.concurrent.Executors
1819
import scala.util.Try
1920

2021
object SignedTransaction {

src/main/scala/io/iohk/ethereum/faucet/jsonrpc/WalletService.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import io.iohk.ethereum.faucet.FaucetConfig
77
import io.iohk.ethereum.jsonrpc.client.RpcClient.RpcError
88
import io.iohk.ethereum.keystore.KeyStore.KeyStoreError
99
import io.iohk.ethereum.keystore.{KeyStore, Wallet}
10-
import io.iohk.ethereum.network.p2p.messages.CommonMessages.SignedTransactions.SignedTransactionEnc
10+
import io.iohk.ethereum.network.p2p.messages.PV60.SignedTransactions.SignedTransactionEnc
1111
import io.iohk.ethereum.rlp
1212
import io.iohk.ethereum.utils.{ByteStringUtils, Logger}
1313
import monix.eval.Task

src/main/scala/io/iohk/ethereum/jsonrpc/EthTxService.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class EthTxService(
168168
}
169169

170170
def sendRawTransaction(req: SendRawTransactionRequest): ServiceResponse[SendRawTransactionResponse] = {
171-
import io.iohk.ethereum.network.p2p.messages.CommonMessages.SignedTransactions.SignedTransactionDec
171+
import io.iohk.ethereum.network.p2p.messages.PV60.SignedTransactions.SignedTransactionDec
172172

173173
Try(req.data.toArray.toSignedTransaction) match {
174174
case Success(signedTransaction) =>

src/main/scala/io/iohk/ethereum/jsonrpc/RawTransactionCodec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package io.iohk.ethereum.jsonrpc
22

33
import akka.util.ByteString
44
import io.iohk.ethereum.domain.SignedTransaction
5-
import io.iohk.ethereum.network.p2p.messages.CommonMessages.SignedTransactions.SignedTransactionEnc
5+
import io.iohk.ethereum.network.p2p.messages.PV60.SignedTransactions.SignedTransactionEnc
66
import io.iohk.ethereum.rlp
77

88
object RawTransactionCodec {

src/main/scala/io/iohk/ethereum/network/EtcPeerManagerActor.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import io.iohk.ethereum.network.handshaker.Handshaker.HandshakeResult
1313
import io.iohk.ethereum.network.p2p.messages.PV62.{BlockHeaders, GetBlockHeaders, NewBlockHashes}
1414
import io.iohk.ethereum.network.p2p.messages.PV64.NewBlock
1515
import io.iohk.ethereum.network.p2p.messages.WireProtocol.Disconnect
16-
import io.iohk.ethereum.network.p2p.messages.{Codes, CommonMessages, PV64}
16+
import io.iohk.ethereum.network.p2p.messages.{Codes, PV60, PV64}
1717
import io.iohk.ethereum.network.p2p.{Message, MessageSerializable}
1818
import io.iohk.ethereum.utils.ByteStringUtils
1919

@@ -159,7 +159,7 @@ class EtcPeerManagerActor(
159159
*/
160160
private def updateChainWeight(message: Message)(initialPeerInfo: PeerInfo): PeerInfo =
161161
message match {
162-
case newBlock: CommonMessages.NewBlock =>
162+
case newBlock: PV60.NewBlock =>
163163
initialPeerInfo.copy(chainWeight = ChainWeight.totalDifficultyOnly(newBlock.totalDifficulty))
164164
case newBlock: PV64.NewBlock => initialPeerInfo.copy(chainWeight = newBlock.chainWeight)
165165
case _ => initialPeerInfo
@@ -220,7 +220,7 @@ class EtcPeerManagerActor(
220220
message match {
221221
case m: BlockHeaders =>
222222
update(m.headers.map(header => (header.number, header.hash)))
223-
case m: CommonMessages.NewBlock =>
223+
case m: PV60.NewBlock =>
224224
update(Seq((m.block.header.number, m.block.header.hash)))
225225
case m: NewBlock =>
226226
update(Seq((m.block.header.number, m.block.header.hash)))
@@ -263,7 +263,7 @@ object EtcPeerManagerActor {
263263
RemoteStatus(status.protocolVersion, status.networkId, status.chainWeight, status.bestHash, status.genesisHash)
264264
}
265265

266-
def apply(status: CommonMessages.Status): RemoteStatus = {
266+
def apply(status: PV60.Status): RemoteStatus = {
267267
RemoteStatus(
268268
status.protocolVersion,
269269
status.networkId,

0 commit comments

Comments
 (0)