Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import akka.util.ByteString
import io.iohk.ethereum.ObjectGenerators
import io.iohk.ethereum.domain.Block._
import io.iohk.ethereum.domain._
import io.iohk.ethereum.network.p2p.messages.CommonMessages.SignedTransactions._
import io.iohk.ethereum.network.p2p.messages.BaseETH6XMessages.SignedTransactions._
import io.iohk.ethereum.utils.Logger
import io.iohk.ethereum.utils.Hex
import org.scalacheck.Gen
Expand Down
6 changes: 3 additions & 3 deletions src/it/scala/io/iohk/ethereum/sync/util/CommonFakePeer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package io.iohk.ethereum.sync.util
import java.nio.file.Files
import java.time.Clock
import java.util.concurrent.atomic.AtomicReference

import akka.actor.{ActorRef, ActorSystem}
import akka.testkit.TestProbe
import akka.util.{ByteString, Timeout}
Expand All @@ -25,6 +24,7 @@ import io.iohk.ethereum.network.discovery.PeerDiscoveryManager.DiscoveredNodesIn
import io.iohk.ethereum.network.discovery.{DiscoveryConfig, Node}
import io.iohk.ethereum.network.handshaker.{EtcHandshaker, EtcHandshakerConfiguration, Handshaker}
import io.iohk.ethereum.network.p2p.EthereumMessageDecoder
import io.iohk.ethereum.network.p2p.messages.Capability
import io.iohk.ethereum.network.rlpx.AuthHandshaker
import io.iohk.ethereum.network.rlpx.RLPxConnectionHandler.RLPxConfiguration
import io.iohk.ethereum.network.{
Expand Down Expand Up @@ -169,7 +169,7 @@ abstract class CommonFakePeer(peerName: String, fakePeerCustomConfig: FakePeerCu
override val peerConfiguration: PeerConfiguration = peerConf
override val blockchain: Blockchain = bl
override val appStateStorage: AppStateStorage = storagesInstance.storages.appStateStorage
override val protocolVersion: Int = Config.Network.protocolVersion
override val capabilities: List[Capability] = blockchainConfig.capabilities
}

lazy val handshaker: Handshaker[PeerInfo] = EtcHandshaker(handshakerConfiguration)
Expand All @@ -193,7 +193,7 @@ abstract class CommonFakePeer(peerName: String, fakePeerCustomConfig: FakePeerCu
EthereumMessageDecoder,
discoveryConfig,
blacklist,
Config.Network.protocolVersion
blockchainConfig.capabilities
),
"peer-manager"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import io.iohk.ethereum.crypto
import io.iohk.ethereum.domain._
import io.iohk.ethereum.ledger._
import io.iohk.ethereum.network.PeerId
import io.iohk.ethereum.network.p2p.messages.CommonMessages.NewBlock
import io.iohk.ethereum.network.p2p.messages.BaseETH6XMessages.NewBlock
import io.iohk.ethereum.nodebuilder.VmSetup
import io.iohk.ethereum.ommers.OmmersPool
import io.iohk.ethereum.sync.util.SyncCommonItSpecUtils.FakePeerCustomConfig.defaultConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import io.iohk.ethereum.network.PeerEventBusActor.SubscriptionClassifier.Message
import io.iohk.ethereum.network.PeerEventBusActor.{PeerSelector, Subscribe}
import io.iohk.ethereum.network.PeerManagerActor.{GetPeers, Peers}
import io.iohk.ethereum.network.p2p.messages.Codes
import io.iohk.ethereum.network.p2p.messages.PV62._
import io.iohk.ethereum.network.p2p.messages.PV63.MptNodeEncoders._
import io.iohk.ethereum.network.p2p.messages.PV63.ReceiptImplicits._
import io.iohk.ethereum.network.p2p.messages.PV63._
import io.iohk.ethereum.network.p2p.messages.ETH62._
import io.iohk.ethereum.network.p2p.messages.ETH63.MptNodeEncoders._
import io.iohk.ethereum.network.p2p.messages.ETH63.ReceiptImplicits._
import io.iohk.ethereum.network.p2p.messages.ETH63._
import io.iohk.ethereum.network.{Peer, PeerManagerActor}
import io.iohk.ethereum.txExecTest.util.DumpChainActor._
import org.bouncycastle.util.encoders.Hex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package io.iohk.ethereum.txExecTest.util

import java.time.Clock
import java.util.concurrent.atomic.AtomicReference

import akka.actor.ActorSystem
import akka.util.ByteString
import com.typesafe.config.ConfigFactory
Expand All @@ -25,6 +24,7 @@ import io.iohk.ethereum.network.PeerStatisticsActor
import io.iohk.ethereum.network.discovery.DiscoveryConfig
import io.iohk.ethereum.network.handshaker.{EtcHandshaker, EtcHandshakerConfiguration, Handshaker}
import io.iohk.ethereum.network.p2p.EthereumMessageDecoder
import io.iohk.ethereum.network.p2p.messages.Capability
import io.iohk.ethereum.network.rlpx.RLPxConnectionHandler.RLPxConfiguration
import io.iohk.ethereum.network.{ForkResolver, PeerEventBusActor, PeerManagerActor}
import io.iohk.ethereum.nodebuilder.{AuthHandshakerBuilder, NodeKeyBuilder}
Expand Down Expand Up @@ -93,7 +93,7 @@ object DumpChainApp extends App with NodeKeyBuilder with SecureRandomBuilder wit
override val peerConfiguration: PeerConfiguration = peerConfig
override val blockchain: Blockchain = DumpChainApp.blockchain
override val appStateStorage: AppStateStorage = storagesInstance.storages.appStateStorage
override val protocolVersion: Int = Config.Network.protocolVersion
override val capabilities: List[Capability] = blockchainConfig.capabilities
}

lazy val handshaker: Handshaker[PeerInfo] = EtcHandshaker(handshakerConfiguration)
Expand All @@ -116,7 +116,7 @@ object DumpChainApp extends App with NodeKeyBuilder with SecureRandomBuilder wit
messageDecoder = EthereumMessageDecoder,
discoveryConfig = discoveryConfig,
blacklist = blacklist,
bestProtocolVersion = Config.Network.protocolVersion
capabilities = blockchainConfig.capabilities
),
"peer-manager"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import io.iohk.ethereum.db.storage._
import io.iohk.ethereum.domain._
import io.iohk.ethereum.domain.BlockHeaderImplicits._
import io.iohk.ethereum.domain.BlockBody._
import io.iohk.ethereum.network.p2p.messages.PV63._
import io.iohk.ethereum.network.p2p.messages.ETH63._
import MptNodeEncoders._
import ReceiptImplicits._
import io.iohk.ethereum.db.cache.{AppCaches, LruCache}
Expand Down
11 changes: 3 additions & 8 deletions src/main/resources/conf/base.conf
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ mantis {
}

network {
# Ethereum protocol version
# Supported versions:
# 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)
protocol-version = 63

server-address {
# Listening interface for Ethereum protocol connections
interface = "0.0.0.0"
Expand Down Expand Up @@ -328,15 +323,15 @@ mantis {

mordor {include required("chains/mordor-chain.conf")}

pottery {include required("chains/pottery-chain.conf")}

ropsten {include required("chains/ropsten-chain.conf")}

test {include required("chains/test-chain.conf")}

testnet-internal-nomad {include required("chains/testnet-internal-nomad-chain.conf")}

testnet-internal-gac {include required("chains/testnet-internal-gac-chain.conf")}

pottery {include required("chains/pottery-chain.conf")}
testnet-internal-nomad {include required("chains/testnet-internal-nomad-chain.conf")}
}

sync {
Expand Down
8 changes: 5 additions & 3 deletions src/main/resources/conf/chains/etc-chain.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
# 1 - mainnet, 3 - ropsten, 7 - mordor
network-id = 1

# The ID of the accepted chain
chain-id = "0x3d"

capabilities = ["eth/63"]

# Possibility to set Proof of Work target time for testing purposes.
# null means that the standard difficulty calculation rules are used
pow-target-time = null
Expand Down Expand Up @@ -126,9 +131,6 @@
# Starting nonce of an empty account. Some networks (like Morden) use different values.
account-start-nonce = "0"

# The ID of the accepted chain
chain-id = "0x3d"

# Custom genesis JSON file path
# null value indicates using default genesis definition that matches the main network
custom-genesis-file = null
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/conf/chains/eth-chain.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# 1 - mainnet, 3 - ropsten, 7 - mordor
network-id = 1

capabilities = ["eth/63"]

# Possibility to set Proof of Work target time for testing purposes.
# null means that the standard difficulty calculation rules are used
pow-target-time = null
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/conf/chains/mordor-chain.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# 1 - mainnet, 3 - ropsten, 7 - mordor
network-id = 7

capabilities = ["eth/63"]

# Possibility to set Proof of Work target time for testing purposes.
# null means that the standard difficulty calculation rules are used
pow-target-time = null
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/conf/chains/pottery-chain.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ include "mordor-chain.conf"
# 1 - mainnet, 3 - ropsten, 7 - mordor, 9 - pottery
network-id = 9

capabilities = ["etc/64"]

ecip1098-block-number = "0"

ecip1097-block-number = "0"
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/conf/chains/ropsten-chain.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# 1 - mainnet, 3 - ropsten, 7 - mordor
network-id = 3

capabilities = ["eth/63"]

# Possibility to set Proof of Work target time for testing purposes.
# null means that the standard difficulty calculation rules are used
pow-target-time = null
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/conf/chains/test-chain.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# 1 - mainnet, 7 - mordor
network-id = 1

capabilities = ["eth/63"]

# Possibility to set Proof of Work target time for testing purposes.
# null means that the standard difficulty calculation rules are used
pow-target-time = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# 1 - mainnet, 3 - ropsten, 7 - mordor
network-id = 42

capabilities = ["eth/63"]

# Possibility to set Proof of Work target time for testing purposes.
# null means that the standard difficulty calculation rules are used
pow-target-time = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# 1 - mainnet, 3 - ropsten, 7 - mordor
network-id = 42

capabilities = ["etc/64"]

# Possibility to set Proof of Work target time for testing purposes.
# null means that the standard difficulty calculation rules are used
pow-target-time = 15 seconds
Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/conf/pottery.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ mantis {
}

network {
protocol-version = 64

discovery {
discovery-enabled = true
}
Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/conf/testnet-internal-nomad.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ mantis {
}

network {
protocol-version = 64

discovery {
discovery-enabled = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import io.iohk.ethereum.network.PeerEventBusActor.SubscriptionClassifier.Message
import io.iohk.ethereum.network.PeerEventBusActor.{PeerSelector, Subscribe}
import io.iohk.ethereum.network.PeerManagerActor.PeerConfiguration
import io.iohk.ethereum.network.p2p.{Message, MessageSerializable}
import io.iohk.ethereum.network.p2p.messages.PV62.{BlockBodies, BlockHeaders, GetBlockBodies, GetBlockHeaders}
import io.iohk.ethereum.network.p2p.messages.PV63.{GetNodeData, GetReceipts, NodeData, Receipts}
import io.iohk.ethereum.network.p2p.messages.PV63.MptNodeEncoders._
import io.iohk.ethereum.network.p2p.messages.ETH62.{BlockBodies, BlockHeaders, GetBlockBodies, GetBlockHeaders}
import io.iohk.ethereum.network.p2p.messages.ETH63.{GetNodeData, GetReceipts, NodeData, Receipts}
import io.iohk.ethereum.network.p2p.messages.ETH63.MptNodeEncoders._
import io.iohk.ethereum.network.EtcPeerManagerActor
import io.iohk.ethereum.network.p2p.messages.Codes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import io.iohk.ethereum.blockchain.sync.PeerListSupportNg.PeerWithInfo
import io.iohk.ethereum.network.EtcPeerManagerActor.PeerInfo
import io.iohk.ethereum.network.p2p.messages.Codes
import io.iohk.ethereum.network.{Peer, PeerId}
import io.iohk.ethereum.network.p2p.messages.PV62._
import io.iohk.ethereum.network.p2p.messages.PV63.{GetNodeData, NodeData}
import io.iohk.ethereum.network.p2p.messages.ETH62._
import io.iohk.ethereum.network.p2p.messages.ETH63.{GetNodeData, NodeData}
import io.iohk.ethereum.network.p2p.{Message, MessageSerializable}
import io.iohk.ethereum.utils.Config.SyncConfig

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import io.iohk.ethereum.blockchain.sync.fast.SyncStateSchedulerActor.{
UsefulData
}
import io.iohk.ethereum.crypto.kec256
import io.iohk.ethereum.network.p2p.messages.PV63.NodeData
import io.iohk.ethereum.network.p2p.messages.ETH63.NodeData
import io.iohk.ethereum.network.{Peer, PeerId}

import scala.annotation.tailrec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import io.iohk.ethereum.mpt.MerklePatriciaTrie
import io.iohk.ethereum.network.EtcPeerManagerActor.PeerInfo
import io.iohk.ethereum.network.Peer
import io.iohk.ethereum.network.p2p.messages.Codes
import io.iohk.ethereum.network.p2p.messages.PV62._
import io.iohk.ethereum.network.p2p.messages.PV63._
import io.iohk.ethereum.network.p2p.messages.ETH62._
import io.iohk.ethereum.network.p2p.messages.ETH63._
import io.iohk.ethereum.utils.ByteStringUtils
import io.iohk.ethereum.utils.Config.SyncConfig
import org.bouncycastle.util.encoders.Hex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import io.iohk.ethereum.db.storage.AppStateStorage
import io.iohk.ethereum.domain.{BlockHeader, Blockchain}
import io.iohk.ethereum.network.Peer
import io.iohk.ethereum.network.p2p.messages.Codes
import io.iohk.ethereum.network.p2p.messages.PV62.{BlockHeaders, GetBlockHeaders}
import io.iohk.ethereum.network.p2p.messages.ETH62.{BlockHeaders, GetBlockHeaders}
import io.iohk.ethereum.utils.Config.SyncConfig

import scala.concurrent.ExecutionContext.Implicits.global
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import io.iohk.ethereum.network.PeerEventBusActor.PeerEvent.MessageFromPeer
import io.iohk.ethereum.network.PeerEventBusActor.SubscriptionClassifier.MessageClassifier
import io.iohk.ethereum.network.PeerEventBusActor.{PeerSelector, Subscribe, Unsubscribe}
import io.iohk.ethereum.network.p2p.messages.Codes
import io.iohk.ethereum.network.p2p.messages.PV62.{BlockHeaders, GetBlockHeaders}
import io.iohk.ethereum.network.p2p.messages.ETH62.{BlockHeaders, GetBlockHeaders}
import io.iohk.ethereum.network.{EtcPeerManagerActor, Peer, PeerId}
import io.iohk.ethereum.utils.Config.SyncConfig

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import io.iohk.ethereum.blockchain.sync.fast.LoadableBloomFilter.BloomFilterLoad
import io.iohk.ethereum.blockchain.sync.fast.SyncStateScheduler._
import io.iohk.ethereum.domain.{Account, Blockchain}
import io.iohk.ethereum.mpt.{BranchNode, ExtensionNode, HashNode, LeafNode, MerklePatriciaTrie, MptNode}
import io.iohk.ethereum.network.p2p.messages.PV63.MptNodeEncoders.MptNodeDec
import io.iohk.ethereum.network.p2p.messages.ETH63.MptNodeEncoders.MptNodeDec
import io.vavr.collection.PriorityQueue
import monix.eval.Task

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import io.iohk.ethereum.blockchain.sync.fast.SyncStateSchedulerActor._
import io.iohk.ethereum.blockchain.sync.{Blacklist, PeerListSupportNg, PeerRequestHandler}
import io.iohk.ethereum.network.Peer
import io.iohk.ethereum.network.p2p.messages.Codes
import io.iohk.ethereum.network.p2p.messages.PV63.{GetNodeData, NodeData}
import io.iohk.ethereum.network.p2p.messages.ETH63.{GetNodeData, NodeData}
import io.iohk.ethereum.utils.ByteStringUtils
import io.iohk.ethereum.utils.Config.SyncConfig
import monix.eval.Task
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import io.iohk.ethereum.blockchain.sync.regular.BlockBroadcast.BlockToBroadcast
import io.iohk.ethereum.domain.{Block, ChainWeight}
import io.iohk.ethereum.network.EtcPeerManagerActor.PeerInfo
import io.iohk.ethereum.network.p2p.MessageSerializable
import io.iohk.ethereum.network.p2p.messages.PV62.BlockHash
import io.iohk.ethereum.network.p2p.messages.{CommonMessages, PV62, PV64, ProtocolVersions}
import io.iohk.ethereum.network.p2p.messages.ETH62.BlockHash
import io.iohk.ethereum.network.p2p.messages.{BaseETH6XMessages, ETH62, ETC64, ProtocolVersions}
import io.iohk.ethereum.network.{EtcPeerManagerActor, Peer, PeerId}

import scala.util.Random
Expand Down Expand Up @@ -40,15 +40,16 @@ class BlockBroadcast(val etcPeerManager: ActorRef) {
private def broadcastNewBlock(blockToBroadcast: BlockToBroadcast, peers: Map[PeerId, PeerWithInfo]): Unit =
obtainRandomPeerSubset(peers.values.map(_.peer).toSet).foreach { peer =>
val message: MessageSerializable =
if (peers(peer.id).peerInfo.remoteStatus.protocolVersion == ProtocolVersions.PV64) blockToBroadcast.as64
if (peers(peer.id).peerInfo.remoteStatus.protocolVersion.toByte == ProtocolVersions.ETC64.version)
blockToBroadcast.as64
else blockToBroadcast.as63
etcPeerManager ! EtcPeerManagerActor.SendMessage(message, peer.id)
}

private def broadcastNewBlockHash(blockToBroadcast: BlockToBroadcast, peers: Set[Peer]): Unit = peers.foreach {
peer =>
val newBlockHeader = blockToBroadcast.block.header
val newBlockHashMsg = PV62.NewBlockHashes(Seq(BlockHash(newBlockHeader.hash, newBlockHeader.number)))
val newBlockHashMsg = ETH62.NewBlockHashes(Seq(BlockHash(newBlockHeader.hash, newBlockHeader.number)))
etcPeerManager ! EtcPeerManagerActor.SendMessage(newBlockHashMsg, peer.id)
}

Expand All @@ -72,7 +73,7 @@ object BlockBroadcast {
* (they are different versions of NewBlock msg)
*/
case class BlockToBroadcast(block: Block, chainWeight: ChainWeight) {
def as63: CommonMessages.NewBlock = CommonMessages.NewBlock(block, chainWeight.totalDifficulty)
def as64: PV64.NewBlock = PV64.NewBlock(block, chainWeight)
def as63: BaseETH6XMessages.NewBlock = BaseETH6XMessages.NewBlock(block, chainWeight.totalDifficulty)
def as64: ETC64.NewBlock = ETC64.NewBlock(block, chainWeight)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import io.iohk.ethereum.network.PeerEventBusActor.SubscriptionClassifier.Message
import io.iohk.ethereum.network.PeerEventBusActor.{PeerSelector, Subscribe}
import io.iohk.ethereum.network.{Peer, PeerEventBusActor, PeerId}
import io.iohk.ethereum.network.p2p.Message
import io.iohk.ethereum.network.p2p.messages.{Codes, CommonMessages, PV64}
import io.iohk.ethereum.network.p2p.messages.PV62._
import io.iohk.ethereum.network.p2p.messages.PV63.NodeData
import io.iohk.ethereum.network.p2p.messages.{Codes, BaseETH6XMessages, ETC64}
import io.iohk.ethereum.network.p2p.messages.ETH62._
import io.iohk.ethereum.network.p2p.messages.ETH63.NodeData
import io.iohk.ethereum.utils.ByteStringUtils
import io.iohk.ethereum.utils.Config.SyncConfig
import io.iohk.ethereum.utils.FunctorOps._
Expand Down Expand Up @@ -214,10 +214,10 @@ class BlockFetcher(
supervisor ! ProgressProtocol.GotNewBlock(newState.knownTop)
fetchBlocks(newState)

case AdaptedMessageFromEventBus(CommonMessages.NewBlock(block, _), peerId) =>
case AdaptedMessageFromEventBus(BaseETH6XMessages.NewBlock(block, _), peerId) =>
handleNewBlock(block, peerId, state)

case AdaptedMessageFromEventBus(PV64.NewBlock(block, _), peerId) =>
case AdaptedMessageFromEventBus(ETC64.NewBlock(block, _), peerId) =>
handleNewBlock(block, peerId, state)

case BlockImportFailed(blockNr, reason) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import io.iohk.ethereum.blockchain.sync.regular.BlockFetcherState._
import io.iohk.ethereum.consensus.validators.BlockValidator
import io.iohk.ethereum.domain.{Block, BlockBody, BlockHeader, HeadersSeq}
import io.iohk.ethereum.network.PeerId
import io.iohk.ethereum.network.p2p.messages.PV62.BlockHash
import io.iohk.ethereum.network.p2p.messages.ETH62.BlockHash

import scala.annotation.tailrec
import scala.collection.immutable.Queue
Expand Down
Loading