Skip to content

Commit

Permalink
[ETCM-759] Refactor mining by adding a PowMiningCoordinator that hand…
Browse files Browse the repository at this point in the history
…les both Ethash and Keccak mining coordination

* [ETCM-759] Rename EthashBlockCreator to PoWBlockCreator
* [ETCM-759] Rename MinerResponse to MockedMinerResponse
* [ETCM-759] Add PoWMiningCoordinator
* [ETCM-759] Update PowConsensus to use new PoWMiningCoordinator instead of EthashMiner. PoWMiningCoordinator is a typed actor and MockedMiner is a classic actor, that's the reason for the extra code added.
* [ETCM-759] Modify EthashMiner to only mine on demand, managed by the PoWMiningManager
* [ETCM-759] Extract code to mining with Keccak into an actor called KeccakMiner. (Mining on demand, managed by the PoWMiningManager)
* [ETCM-759] Adjust MinerSpecSetup to contain shared setup between mock, keccak, ethash miners and the coordinator
* [ETCM-759] Rename PoWMinerCooordinatorSpec to PoWMiningCoordinatorSpec
* [ETCM-759] Add assertion in Ethash and Keccak miners spec
M-759] Fix PoWMiningCoordinatorSpec
* [ETCM-759] Renamed DoMining to MineNext in PoWMiningCoordinator
* [ETCM-759] Rename StartMining(mode: MiningMode) to SetMiningMode((mode: MiningMode)) in PoWMiningCoordinator
  • Loading branch information
Leonor Boga authored May 20, 2021
1 parent 0146d23 commit b81d183
Show file tree
Hide file tree
Showing 29 changed files with 1,209 additions and 541 deletions.
1 change: 1 addition & 0 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ object Dependencies {
val akka: Seq[ModuleID] = {
Seq(
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-actor-typed" % akkaVersion,
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,
"com.typesafe.akka" %% "akka-actor-typed" % akkaVersion,
"com.typesafe.akka" %% "akka-testkit" % akkaVersion,
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/conf/pottery.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ mantis {

consensus {
coinbase = "0011223344556677889900112233445566778899" # has to be changed for each node
mining-enabled = false
protocol = "restricted-ethash"
mining-enabled = true
protocol = "restricted-pow"
}

metrics {
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/io/iohk/ethereum/consensus/Consensus.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package io.iohk.ethereum.consensus

import io.iohk.ethereum.consensus.blocks.{BlockGenerator, TestBlockGenerator}
import io.iohk.ethereum.consensus.difficulty.DifficultyCalculator
import io.iohk.ethereum.consensus.pow.{MinerProtocol, MinerResponse}
import io.iohk.ethereum.consensus.pow.miners.MinerProtocol
import io.iohk.ethereum.consensus.pow.miners.MockedMiner.{MockedMinerProtocol, MockedMinerResponse}
import io.iohk.ethereum.consensus.validators.Validators
import io.iohk.ethereum.ledger.BlockPreparator
import io.iohk.ethereum.ledger.Ledger.VMImpl
Expand Down Expand Up @@ -63,7 +64,7 @@ trait Consensus {
/**
* Sends msg to the internal miner and waits for the response
*/
def askMiner(msg: MinerProtocol): Task[MinerResponse]
def askMiner(msg: MockedMinerProtocol): Task[MockedMinerResponse]

/**
* Sends msg to the internal miner
Expand Down
205 changes: 0 additions & 205 deletions src/main/scala/io/iohk/ethereum/consensus/pow/EthashMiner.scala

This file was deleted.

27 changes: 0 additions & 27 deletions src/main/scala/io/iohk/ethereum/consensus/pow/MinerProtocol.scala

This file was deleted.

12 changes: 0 additions & 12 deletions src/main/scala/io/iohk/ethereum/consensus/pow/MinerUtils.scala

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import io.iohk.ethereum.transactions.TransactionPicker
import monix.eval.Task
import scala.concurrent.duration.FiniteDuration

class EthashBlockCreator(
class PoWBlockCreator(
val pendingTransactionsManager: ActorRef,
val getTransactionFromPoolTimeout: FiniteDuration,
consensus: PoWConsensus,
Expand Down
Loading

0 comments on commit b81d183

Please sign in to comment.