Skip to content

Commit 3ea65c1

Browse files
author
Leonor Boga
authored
[ETCM-746] Added support for PoW with Keccak-256 (ECIP-1049) (#960)
Renamed several classes from Ethash to PoW because they will be used in both Ethash Pow and Keccak PoW
1 parent 2999dde commit 3ea65c1

File tree

88 files changed

+897
-584
lines changed

Some content is hidden

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

88 files changed

+897
-584
lines changed

build.sbt

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,23 @@ val nixBuild = sys.props.isDefinedAt("nix")
1313
val mantisDev = sys.props.get("mantisDev").contains("true") || sys.env.get("MANTIS_DEV").contains("true")
1414

1515
lazy val compilerOptimizationsForProd = Seq(
16-
"-opt:l:method", // method-local optimizations
17-
"-opt:l:inline", // inlining optimizations
16+
"-opt:l:method", // method-local optimizations
17+
"-opt:l:inline", // inlining optimizations
1818
"-opt-inline-from:io.iohk.**" // inlining the project only
1919
)
2020

2121
// Releasing. https://github.com/olafurpg/sbt-ci-release
22-
inThisBuild(List(
23-
organization := "io.iohk",
24-
homepage := Some(url("https://github.com/input-output-hk/mantis")),
25-
scmInfo := Some(ScmInfo(url("https://github.com/input-output-hk/mantis"), "[email protected]:input-output-hk/mantis.git")),
26-
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
27-
developers := List()
28-
))
22+
inThisBuild(
23+
List(
24+
organization := "io.iohk",
25+
homepage := Some(url("https://github.com/input-output-hk/mantis")),
26+
scmInfo := Some(
27+
ScmInfo(url("https://github.com/input-output-hk/mantis"), "[email protected]:input-output-hk/mantis.git")
28+
),
29+
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
30+
developers := List()
31+
)
32+
)
2933

3034
// https://github.com/sbt/sbt/issues/3570
3135
updateOptions := updateOptions.value.withGigahorse(false)

bytes/src/main/scala/io/iohk/ethereum/utils/Hex.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ object Hex {
66

77
def decode(hex: String): Array[Byte] =
88
hex.toSeq.sliding(2, 2).toArray.map { s =>
9-
Integer.parseInt(s.mkString(""), 16).toByte
9+
Integer.parseInt(s.mkString(""), 16).toByte
1010
}
1111
}

crypto/src/main/scala/io/iohk/ethereum/crypto/package.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ package object crypto {
4141
def kec256(input: ByteString): ByteString =
4242
ByteString(kec256(input.toArray))
4343

44+
def kec256PoW(header: Array[Byte], nonce: Array[Byte]): Array[Byte] = {
45+
val digest = new KeccakDigest(256)
46+
digest.update(header, 0, header.length)
47+
digest.update(nonce, 0, nonce.length)
48+
val output = Array.ofDim[Byte](32)
49+
digest.doFinal(output, 0)
50+
output
51+
}
52+
4453
def kec512(input: Array[Byte]): Array[Byte] = synchronized {
4554
val out = Array.ofDim[Byte](kec512.getDigestSize)
4655
kec512.update(input, 0, input.length)

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

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package io.iohk.ethereum.ets.blockchain
22

33
import akka.util.ByteString
44
import io.iohk.ethereum.consensus.Protocol
5-
import io.iohk.ethereum.consensus.validators.std.ValidatorsExecutor
5+
import io.iohk.ethereum.consensus.pow.validators.ValidatorsExecutor
66
import io.iohk.ethereum.domain.{Address, UInt256}
77
import io.iohk.ethereum.utils.{BlockchainConfig, DaoForkConfig, MonetaryPolicyConfig}
88
import org.bouncycastle.util.encoders.Hex
@@ -46,7 +46,8 @@ object BlockchainTestConfig {
4646
ecip1098BlockNumber = Long.MaxValue,
4747
treasuryAddress = Address(0),
4848
ecip1097BlockNumber = Long.MaxValue,
49-
ecip1099BlockNumber = Long.MaxValue
49+
ecip1099BlockNumber = Long.MaxValue,
50+
ecip1049BlockNumber = None
5051
)
5152

5253
val FrontierConfig = BaseBlockchainConfig.copy(
@@ -316,19 +317,19 @@ object BlockchainTestConfig {
316317
object Validators {
317318
import BlockchainTestConfig._
318319

319-
val frontierValidators = ValidatorsExecutor(FrontierConfig, Protocol.Ethash)
320-
val homesteadValidators = ValidatorsExecutor(HomesteadConfig, Protocol.Ethash)
321-
val eip150Validators = ValidatorsExecutor(Eip150Config, Protocol.Ethash)
322-
val frontierToHomesteadValidators = ValidatorsExecutor(FrontierToHomesteadAt5, Protocol.Ethash)
323-
val homesteadToEipValidators = ValidatorsExecutor(HomesteadToEIP150At5, Protocol.Ethash)
324-
val homesteadToDaoValidators = ValidatorsExecutor(HomesteadToDaoAt5, Protocol.Ethash)
325-
val eip158Validators = ValidatorsExecutor(Eip158Config, Protocol.Ethash)
326-
val byzantiumValidators = ValidatorsExecutor(ByzantiumConfig, Protocol.Ethash)
327-
val constantinopleValidators = ValidatorsExecutor(ConstantinopleConfig, Protocol.Ethash)
328-
val constantinopleFixValidators = ValidatorsExecutor(ConstantinopleFixConfig, Protocol.Ethash)
329-
val istanbulValidators = ValidatorsExecutor(IstanbulConfig, Protocol.Ethash)
330-
val eip158ToByzantiumValidators = ValidatorsExecutor(Eip158ToByzantiumAt5Config, Protocol.Ethash)
331-
val byzantiumToConstantinopleAt5 = ValidatorsExecutor(ByzantiumToConstantinopleAt5, Protocol.Ethash)
320+
val frontierValidators = ValidatorsExecutor(FrontierConfig, Protocol.PoW)
321+
val homesteadValidators = ValidatorsExecutor(HomesteadConfig, Protocol.PoW)
322+
val eip150Validators = ValidatorsExecutor(Eip150Config, Protocol.PoW)
323+
val frontierToHomesteadValidators = ValidatorsExecutor(FrontierToHomesteadAt5, Protocol.PoW)
324+
val homesteadToEipValidators = ValidatorsExecutor(HomesteadToEIP150At5, Protocol.PoW)
325+
val homesteadToDaoValidators = ValidatorsExecutor(HomesteadToDaoAt5, Protocol.PoW)
326+
val eip158Validators = ValidatorsExecutor(Eip158Config, Protocol.PoW)
327+
val byzantiumValidators = ValidatorsExecutor(ByzantiumConfig, Protocol.PoW)
328+
val constantinopleValidators = ValidatorsExecutor(ConstantinopleConfig, Protocol.PoW)
329+
val constantinopleFixValidators = ValidatorsExecutor(ConstantinopleFixConfig, Protocol.PoW)
330+
val istanbulValidators = ValidatorsExecutor(IstanbulConfig, Protocol.PoW)
331+
val eip158ToByzantiumValidators = ValidatorsExecutor(Eip158ToByzantiumAt5Config, Protocol.PoW)
332+
val byzantiumToConstantinopleAt5 = ValidatorsExecutor(ByzantiumToConstantinopleAt5, Protocol.PoW)
332333
}
333334

334335
// Connected with: https://github.com/ethereum/tests/issues/480

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
package io.iohk.ethereum.ets.blockchain
22

33
import io.iohk.ethereum.consensus.difficulty.DifficultyCalculator
4-
import io.iohk.ethereum.consensus.ethash.validators.EthashBlockHeaderValidator
5-
import io.iohk.ethereum.consensus.validators.{ BlockHeaderError, BlockHeaderValid, BlockHeaderValidatorSkeleton }
4+
import io.iohk.ethereum.consensus.pow.validators.EthashBlockHeaderValidator
5+
import io.iohk.ethereum.consensus.validators.{BlockHeaderError, BlockHeaderValid, BlockHeaderValidatorSkeleton}
66
import io.iohk.ethereum.domain.BlockHeader
77
import io.iohk.ethereum.utils.BlockchainConfig
88

9-
class EthashTestBlockHeaderValidator(blockchainConfig: BlockchainConfig) extends BlockHeaderValidatorSkeleton(blockchainConfig) {
9+
class EthashTestBlockHeaderValidator(blockchainConfig: BlockchainConfig)
10+
extends BlockHeaderValidatorSkeleton(blockchainConfig) {
1011
import EthashBlockHeaderValidator._
1112

1213
// NOTE the below comment is from before PoW decoupling
1314
// we need concurrent map since validators can be used from multiple places
14-
protected val powCaches: java.util.concurrent.ConcurrentMap[Long, PowCacheData] = new java.util.concurrent.ConcurrentHashMap[Long, PowCacheData]()
15+
protected val powCaches: java.util.concurrent.ConcurrentMap[Long, PowCacheData] =
16+
new java.util.concurrent.ConcurrentHashMap[Long, PowCacheData]()
1517

1618
protected def difficulty: DifficultyCalculator = DifficultyCalculator(blockchainConfig)
1719

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package io.iohk.ethereum.ets.blockchain
22

33
import akka.util.ByteString
4-
import io.iohk.ethereum.consensus.Protocol.NoAdditionalEthashData
5-
import io.iohk.ethereum.consensus.ethash.EthashConsensus
6-
import io.iohk.ethereum.consensus.validators.std.ValidatorsExecutor
7-
import io.iohk.ethereum.consensus.{ConsensusConfig, FullConsensusConfig, TestConsensus, ethash}
4+
import io.iohk.ethereum.consensus.Protocol.NoAdditionalPoWData
5+
import io.iohk.ethereum.consensus.pow.{EthashConfig, PoWConsensus}
6+
import io.iohk.ethereum.consensus.pow.validators.ValidatorsExecutor
7+
import io.iohk.ethereum.consensus.{ConsensusConfig, FullConsensusConfig, TestConsensus, pow}
88
import io.iohk.ethereum.db.components.Storages.PruningModeComponent
99
import io.iohk.ethereum.db.components.{EphemDataSourceComponent, Storages}
1010
import io.iohk.ethereum.db.storage.pruning.{ArchivePruning, PruningMode}
@@ -23,16 +23,16 @@ import scala.util.{Failure, Success, Try}
2323

2424
object ScenarioSetup {
2525
val testContext = Scheduler.fixedPool("scenario-setup-pool", 4)
26-
val specificConfig = ethash.EthashConfig(Config.config)
26+
val specificConfig = EthashConfig(Config.config)
2727
val fullConfig = FullConsensusConfig(ConsensusConfig(Config.config), specificConfig)
2828

2929
def loadEthashConsensus(
3030
vm: VMImpl,
3131
blockchain: BlockchainImpl,
3232
blockchainConfig: BlockchainConfig,
3333
validators: ValidatorsExecutor
34-
): ethash.EthashConsensus = {
35-
val consensus = EthashConsensus(vm, blockchain, blockchainConfig, fullConfig, validators, NoAdditionalEthashData)
34+
): PoWConsensus = {
35+
val consensus = PoWConsensus(vm, blockchain, blockchainConfig, fullConfig, validators, NoAdditionalPoWData)
3636
consensus
3737
}
3838

src/it/scala/io/iohk/ethereum/ledger/BlockImporterItSpec.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ import io.iohk.ethereum.blockchain.sync.regular.{BlockFetcher, BlockImporter}
88
import io.iohk.ethereum.checkpointing.CheckpointingTestHelpers
99
import io.iohk.ethereum.consensus.{GetBlockHeaderByHash, GetNBlocksBack}
1010
import io.iohk.ethereum.consensus.blocks.CheckpointBlockGenerator
11-
import io.iohk.ethereum.consensus.ethash.validators.OmmersValidator
11+
import io.iohk.ethereum.consensus.pow.validators.{OmmersValidator, StdOmmersValidator}
1212
import io.iohk.ethereum.consensus.validators.Validators
13-
import io.iohk.ethereum.consensus.validators.std.StdOmmersValidator
1413
import io.iohk.ethereum.domain._
1514
import io.iohk.ethereum.mpt.MerklePatriciaTrie
1615
import io.iohk.ethereum.utils.Config.SyncConfig

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ import io.iohk.ethereum.blockchain.sync.regular.{
1717
import io.iohk.ethereum.blockchain.sync.regular.RegularSync.NewCheckpoint
1818
import io.iohk.ethereum.blockchain.sync.{PeersClient, SyncProtocol}
1919
import io.iohk.ethereum.checkpointing.CheckpointingTestHelpers
20-
import io.iohk.ethereum.consensus.Protocol.NoAdditionalEthashData
20+
import io.iohk.ethereum.consensus.Protocol.NoAdditionalPoWData
2121
import io.iohk.ethereum.consensus.blocks.CheckpointBlockGenerator
22-
import io.iohk.ethereum.consensus.ethash.{EthashConfig, EthashConsensus}
23-
import io.iohk.ethereum.consensus.{ConsensusConfig, FullConsensusConfig, ethash}
22+
import io.iohk.ethereum.consensus.pow.{EthashConfig, PoWConsensus}
23+
import io.iohk.ethereum.consensus.{ConsensusConfig, FullConsensusConfig, pow}
2424
import io.iohk.ethereum.crypto
2525
import io.iohk.ethereum.domain._
2626
import io.iohk.ethereum.ledger._
@@ -54,13 +54,13 @@ object RegularSyncItSpecUtils {
5454
class FakePeer(peerName: String, fakePeerCustomConfig: FakePeerCustomConfig)
5555
extends CommonFakePeer(peerName, fakePeerCustomConfig) {
5656

57-
def buildEthashConsensus(): ethash.EthashConsensus = {
57+
def buildEthashConsensus(): pow.PoWConsensus = {
5858
val consensusConfig: ConsensusConfig = ConsensusConfig(Config.config)
59-
val specificConfig: EthashConfig = ethash.EthashConfig(config)
59+
val specificConfig: EthashConfig = pow.EthashConfig(config)
6060
val fullConfig = FullConsensusConfig(consensusConfig, specificConfig)
6161
val vm = VmSetup.vm(VmConfig(config), blockchainConfig, testMode = false)
6262
val consensus =
63-
EthashConsensus(vm, bl, blockchainConfig, fullConfig, ValidatorsExecutorAlwaysSucceed, NoAdditionalEthashData)
63+
PoWConsensus(vm, bl, blockchainConfig, fullConfig, ValidatorsExecutorAlwaysSucceed, NoAdditionalPoWData)
6464
consensus
6565
}
6666

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ class ECIP1017Test extends AnyFlatSpec with Matchers {
4949
ecip1098BlockNumber = Long.MaxValue,
5050
treasuryAddress = Address(0),
5151
ecip1097BlockNumber = Long.MaxValue,
52-
ecip1099BlockNumber = Long.MaxValue
52+
ecip1099BlockNumber = Long.MaxValue,
53+
ecip1049BlockNumber = None
5354
)
5455
val ec = ExecutionContext.fromExecutor(Executors.newFixedThreadPool(4))
5556

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ class ForksTest extends AnyFlatSpec with Matchers {
4848
ecip1098BlockNumber = Long.MaxValue,
4949
treasuryAddress = Address(0),
5050
ecip1097BlockNumber = Long.MaxValue,
51-
ecip1099BlockNumber = Long.MaxValue
51+
ecip1099BlockNumber = Long.MaxValue,
52+
ecip1049BlockNumber = None
5253
)
5354

5455
val noErrors = a[Right[_, Seq[Receipt]]]

src/main/resources/conf/base-testnet.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ mantis {
1818
consensus {
1919
coinbase = "0011223344556677889900112233445566778899" # has to be changed for each node
2020
mining-enabled = false
21-
protocol = "restricted-ethash"
21+
protocol = "restricted-pow"
2222
}
2323

2424
network {

src/main/resources/conf/base.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,9 @@ mantis {
287287
# Declaring the protocol here means that a more protocol-specific configuration
288288
# is pulled from the corresponding consensus implementation.
289289
# For example, in case of ethash, a section named `ethash` is used.
290-
# Available protocols: ethash, mocked, restricted-ethash
290+
# Available protocols: pow, mocked, restricted-pow
291291
# In case of mocked, remember to enable qa api
292-
protocol = ethash
292+
protocol = pow
293293

294294
# If true then the consensus protocol uses this node for mining.
295295
# In the case of ethash PoW, this means mining new blocks, as specified by Ethereum.
@@ -305,7 +305,7 @@ mantis {
305305

306306
# This is the section dedicated to Ethash mining.
307307
# This consensus protocol is selected by setting `mantis.consensus.protocol = ethash`.
308-
ethash {
308+
pow {
309309
# Maximum number of ommers kept in the pool
310310
ommers-pool-size = 30
311311

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@
9696
# https://ecips.ethereumclassic.org/ECIPs/ecip-1099
9797
ecip1099-block-number = "11700000"
9898

99+
# ECIP-1049 soft fork block number
100+
# https://ecips.ethereumclassic.org/ECIPs/ecip-1049
101+
# https://github.com/ethereumclassic/ECIPs/issues/394
102+
# ecip1049-block-number = "0" // TODO to be determined
103+
99104
# DAO fork configuration (Ethereum HF/Classic split)
100105
# https://blog.ethereum.org/2016/07/20/hard-fork-completed/
101106
dao {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
# Set of initial nodes
162162
bootstrap-nodes = []
163163

164-
# List of hex encoded public keys of miners which can extend chain (only used when using restricted-ethash consensus)
164+
# List of hex encoded public keys of miners which can extend chain (only used when using restricted-pow consensus)
165165
# empty means that everybody can mine
166166
allowed-miners = []
167167
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
# List of hex encoded public keys of Checkpoint Authorities
146146
checkpoint-public-keys = []
147147

148-
# List of hex encoded public keys of miners which can extend chain (only used when using restricted-ethash consensus)
148+
# List of hex encoded public keys of miners which can extend chain (only used when using restricted-pow consensus)
149149
# empty means that everybody can mine
150150
include "testnet-allowed-miners"
151151
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
"5355fc1bba22b121c3954b0174c8ebfd52efe95e3d062980a916770aec1316c6116a46af591f47f07074f48564cb31c15c90498f2ff9fadf86639e60f3cb2c0d"
158158
]
159159

160-
# List of hex encoded public keys of miners which can extend chain (only used when using restricted-ethash consensus)
160+
# List of hex encoded public keys of miners which can extend chain (only used when using restricted-pow consensus)
161161
# empty means that everybody can mine
162162
include "testnet-allowed-miners"
163163
}

src/main/scala/io/iohk/ethereum/consensus/Consensus.scala

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

33
import io.iohk.ethereum.consensus.blocks.{BlockGenerator, TestBlockGenerator}
44
import io.iohk.ethereum.consensus.difficulty.DifficultyCalculator
5-
import io.iohk.ethereum.consensus.ethash.{MinerProtocol, MinerResponse}
5+
import io.iohk.ethereum.consensus.pow.{MinerProtocol, MinerResponse}
66
import io.iohk.ethereum.consensus.validators.Validators
77
import io.iohk.ethereum.ledger.BlockPreparator
88
import io.iohk.ethereum.ledger.Ledger.VMImpl

src/main/scala/io/iohk/ethereum/consensus/ConsensusBuilder.scala

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package io.iohk.ethereum.consensus
22

3-
import io.iohk.ethereum.consensus.Protocol.{NoAdditionalEthashData, RestrictedEthashMinerData}
4-
import io.iohk.ethereum.consensus.ethash.EthashConsensus
5-
import io.iohk.ethereum.consensus.validators.std.ValidatorsExecutor
3+
import io.iohk.ethereum.consensus.Protocol.{NoAdditionalPoWData, RestrictedPoWMinerData}
4+
import io.iohk.ethereum.consensus.pow.PoWConsensus
5+
import io.iohk.ethereum.consensus.pow.validators.ValidatorsExecutor
66
import io.iohk.ethereum.nodebuilder._
77
import io.iohk.ethereum.utils.{Config, Logger}
88

@@ -15,7 +15,7 @@ trait ConsensusBuilder {
1515
* This is done dynamically when Mantis boots, based on its configuration.
1616
*
1717
* @see [[io.iohk.ethereum.consensus.Consensus Consensus]],
18-
* [[io.iohk.ethereum.consensus.ethash.EthashConsensus EthashConsensus]],
18+
* [[io.iohk.ethereum.consensus.pow.PoWConsensus PoWConsensus]],
1919
*/
2020
trait StdConsensusBuilder extends ConsensusBuilder {
2121
self: VmBuilder
@@ -31,19 +31,19 @@ trait StdConsensusBuilder extends ConsensusBuilder {
3131
FullConsensusConfig(consensusConfig, c)
3232

3333
//TODO [ETCM-397] refactor configs to avoid possibility of running mocked or
34-
// restricted-ethash consensus on real network like ETC or Mordor
35-
protected def buildEthashConsensus(): ethash.EthashConsensus = {
36-
val specificConfig = ethash.EthashConfig(mantisConfig)
34+
// restricted-pow consensus on real network like ETC or Mordor
35+
protected def buildPoWConsensus(): pow.PoWConsensus = {
36+
val specificConfig = pow.EthashConfig(mantisConfig)
3737

3838
val fullConfig = newConfig(specificConfig)
3939

4040
val validators = ValidatorsExecutor(blockchainConfig, consensusConfig.protocol)
4141

42-
val additionalEthashData = consensusConfig.protocol match {
43-
case Protocol.Ethash | Protocol.MockedPow => NoAdditionalEthashData
44-
case Protocol.RestrictedEthash => RestrictedEthashMinerData(nodeKey)
42+
val additionalPoWData = consensusConfig.protocol match {
43+
case Protocol.PoW | Protocol.MockedPow => NoAdditionalPoWData
44+
case Protocol.RestrictedPoW => RestrictedPoWMinerData(nodeKey)
4545
}
46-
val consensus = EthashConsensus(vm, blockchain, blockchainConfig, fullConfig, validators, additionalEthashData)
46+
val consensus = PoWConsensus(vm, blockchain, blockchainConfig, fullConfig, validators, additionalPoWData)
4747
consensus
4848
}
4949

@@ -53,7 +53,7 @@ trait StdConsensusBuilder extends ConsensusBuilder {
5353

5454
val consensus =
5555
config.protocol match {
56-
case Protocol.Ethash | Protocol.MockedPow | Protocol.RestrictedEthash => buildEthashConsensus()
56+
case Protocol.PoW | Protocol.MockedPow | Protocol.RestrictedPoW => buildPoWConsensus()
5757
}
5858

5959
log.info(s"Using '${protocol.name}' consensus [${consensus.getClass.getName}]")

src/main/scala/io/iohk/ethereum/consensus/ConsensusConfig.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ object ConsensusConfig extends Logger {
3535
}
3636

3737
final val AllowedProtocols = Set(
38-
Protocol.Names.Ethash,
38+
Protocol.Names.PoW,
3939
Protocol.Names.MockedPow,
40-
Protocol.Names.RestrictedEthash
40+
Protocol.Names.RestrictedPoW
4141
)
4242

4343
final val AllowedProtocolsError = (s: String) =>

src/main/scala/io/iohk/ethereum/consensus/ConsensusMetrics.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import io.iohk.ethereum.metrics.MetricsContainer
44

55
object ConsensusMetrics extends MetricsContainer {
66
private final val blockGenTimer = "consensus.blocks.generate.timer"
7-
final val EthashBlockGeneratorTiming = metrics.timer(blockGenTimer, "class", "EthashBlockGenerator")
8-
final val RestrictedEthashBlockGeneratorTiming =
9-
metrics.timer(blockGenTimer, "class", "RestrictedEthashBlockGenerator")
7+
final val PoWBlockGeneratorTiming = metrics.timer(blockGenTimer, "class", "PoWBlockGenerator")
8+
final val RestrictedPoWBlockGeneratorTiming =
9+
metrics.timer(blockGenTimer, "class", "RestrictedPoWBlockGenerator")
1010
final val NoOmmersBlockGeneratorTiming = metrics.timer(blockGenTimer, "class", "NoOmmersBlockGenerator")
1111

1212
final val MinedBlockEvaluationTimer = metrics.timer("consensus.minedblocks.evaluation.timer")

0 commit comments

Comments
 (0)