Skip to content

Commit 2940e56

Browse files
author
Leonor Boga
authored
[ETCM-1001] Rename consensus classes to mining (#1053)
* ETCM-1001 Rename trait Consensus to Mining (and all variables that instantiate it) * ETCM-1001 Rename TestConsensus to TestMining (and al variables that instantiate it) * ETCM-1001 Rename PoWConsensus to PowMining (and all variables that instantiate it) * ETCM-1001 Rename ConsensusBuilder to MiningBuilder * ETCM-1001 Rename StdConsensusBuilder to StdMiningBuilder * ETCM-1001 Rename TestConsensusBuilder to TestMiningBuilder * ETCM-1001 Rename StdTestConsensusBuilder to StdTestMiningBuilder * ETCM-1001 Rename ConsensusConfig to MiningConfig (and all variables that instantiate it) * ETCM-1001 Rename ConsensusConfigBuilder to MiningConfigBuilder * ETCM-1001 Rename TestmodeConsensusBuilder to TestmodeMiningBuilder * ETCM-1001 Rename PoWConsensusSpec to PoWMiningSpec * ETCM-1001 Rename FullConsensusConfig to FullMiningConfig (and all variables that instantiate it) * ETCM-1001 Rename ConsensusConfigs to MiningConfigs * ETCM-1001 Rename TestmodeConsensus to TestmodeMining * ETCM-1001 Rename RichConsensus to RichMining * ETCM-1001 Rename ConsensusSpec to MiningSpec * ETCM-1001 Rename TestConsensus to TestMining (and all variables that ) * ETCM-1001 Rename ConsensusMetrics to MiningMetrics * ETCM-1001 Create new package mining and move related code there * ETCM-1001 Rename configuration key from consensus to mining
1 parent 74d6f3b commit 2940e56

File tree

87 files changed

+643
-617
lines changed

Some content is hidden

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

87 files changed

+643
-617
lines changed

docker/mantis/grafana/provisioning/dashboards/mantis-dashboard.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,7 +1930,7 @@
19301930
"steppedLine": false,
19311931
"targets": [
19321932
{
1933-
"expr": "rate(app_consensus_blocks_generate_timer_seconds_sum[$__rate_interval])/rate(app_consensus_blocks_generate_timer_seconds_count[$__rate_interval])",
1933+
"expr": "rate(app_mining_blocks_generate_timer_seconds_sum[$__rate_interval])/rate(app_mining_blocks_generate_timer_seconds_count[$__rate_interval])",
19341934
"interval": "",
19351935
"legendFormat": "{{class}}",
19361936
"refId": "A"
@@ -2027,7 +2027,7 @@
20272027
"steppedLine": false,
20282028
"targets": [
20292029
{
2030-
"expr": "app_consensus_blocks_generate_timer_seconds_max",
2030+
"expr": "app_mining_blocks_generate_timer_seconds_max",
20312031
"interval": "",
20322032
"legendFormat": "{{class}}",
20332033
"refId": "A"
@@ -2124,7 +2124,7 @@
21242124
"steppedLine": false,
21252125
"targets": [
21262126
{
2127-
"expr": "rate(app_consensus_minedblocks_evaluation_timer_seconds_sum[$__rate_interval]) / rate(app_consensus_minedblocks_evaluation_timer_seconds_count[$__rate_interval])\n",
2127+
"expr": "rate(app_mining_minedblocks_evaluation_timer_seconds_sum[$__rate_interval]) / rate(app_mining_minedblocks_evaluation_timer_seconds_count[$__rate_interval])\n",
21282128
"interval": "",
21292129
"legendFormat": "",
21302130
"refId": "A"
@@ -7866,4 +7866,4 @@
78667866
"title": "Mantis",
78677867
"uid": "L3y-GTyWk",
78687868
"version": 4
7869-
}
7869+
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ import io.iohk.ethereum.blockchain.sync.regular.BlockFetcher
2626
import io.iohk.ethereum.blockchain.sync.regular.BlockImporter
2727
import io.iohk.ethereum.blockchain.sync.regular.BlockImporter.NewCheckpoint
2828
import io.iohk.ethereum.checkpointing.CheckpointingTestHelpers
29-
import io.iohk.ethereum.consensus.GetBlockHeaderByHash
30-
import io.iohk.ethereum.consensus.GetNBlocksBack
3129
import io.iohk.ethereum.consensus.blocks.CheckpointBlockGenerator
30+
import io.iohk.ethereum.consensus.mining.GetBlockHeaderByHash
31+
import io.iohk.ethereum.consensus.mining.GetNBlocksBack
3232
import io.iohk.ethereum.consensus.pow.validators.OmmersValidator
3333
import io.iohk.ethereum.consensus.pow.validators.StdOmmersValidator
3434
import io.iohk.ethereum.consensus.validators.Validators
@@ -252,8 +252,8 @@ class TestFixture extends TestSetupWithVmAndValidators {
252252
blockchainWriter,
253253
storagesInstance.storages.evmCodeStorage,
254254
blockchainConfig,
255-
consensus.blockPreparator,
256-
new BlockValidation(consensus, blockchainReader, blockQueue)
255+
mining.blockPreparator,
256+
new BlockValidation(mining, blockchainReader, blockQueue)
257257
) {
258258
override def executeAndValidateBlock(
259259
block: Block,

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

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ import io.iohk.ethereum.blockchain.sync.regular.BlockImporter.Start
2626
import io.iohk.ethereum.blockchain.sync.regular.RegularSync
2727
import io.iohk.ethereum.blockchain.sync.regular.RegularSync.NewCheckpoint
2828
import io.iohk.ethereum.checkpointing.CheckpointingTestHelpers
29-
import io.iohk.ethereum.consensus.ConsensusConfig
30-
import io.iohk.ethereum.consensus.FullConsensusConfig
31-
import io.iohk.ethereum.consensus.Protocol.NoAdditionalPoWData
3229
import io.iohk.ethereum.consensus.blocks.CheckpointBlockGenerator
30+
import io.iohk.ethereum.consensus.mining.FullMiningConfig
31+
import io.iohk.ethereum.consensus.mining.MiningConfig
32+
import io.iohk.ethereum.consensus.mining.Protocol.NoAdditionalPoWData
3333
import io.iohk.ethereum.consensus.pow
3434
import io.iohk.ethereum.consensus.pow.EthashConfig
35-
import io.iohk.ethereum.consensus.pow.PoWConsensus
35+
import io.iohk.ethereum.consensus.pow.PoWMining
3636
import io.iohk.ethereum.consensus.pow.validators.ValidatorsExecutor
3737
import io.iohk.ethereum.crypto
3838
import io.iohk.ethereum.domain._
@@ -46,6 +46,7 @@ import io.iohk.ethereum.sync.util.SyncCommonItSpecUtils.FakePeerCustomConfig.def
4646
import io.iohk.ethereum.sync.util.SyncCommonItSpecUtils._
4747
import io.iohk.ethereum.transactions.PendingTransactionsManager
4848
import io.iohk.ethereum.utils._
49+
4950
object RegularSyncItSpecUtils {
5051

5152
class ValidatorsExecutorAlwaysSucceed extends MockValidatorsAlwaysSucceed {
@@ -62,13 +63,13 @@ object RegularSyncItSpecUtils {
6263
class FakePeer(peerName: String, fakePeerCustomConfig: FakePeerCustomConfig)
6364
extends CommonFakePeer(peerName, fakePeerCustomConfig) {
6465

65-
def buildEthashConsensus(): pow.PoWConsensus = {
66-
val consensusConfig: ConsensusConfig = ConsensusConfig(Config.config)
66+
def buildEthashMining(): pow.PoWMining = {
67+
val miningConfig: MiningConfig = MiningConfig(Config.config)
6768
val specificConfig: EthashConfig = pow.EthashConfig(config)
68-
val fullConfig = FullConsensusConfig(consensusConfig, specificConfig)
69+
val fullConfig = FullMiningConfig(miningConfig, specificConfig)
6970
val vm = VmSetup.vm(VmConfig(config), blockchainConfig, testMode = false)
70-
val consensus =
71-
PoWConsensus(
71+
val mining =
72+
PoWMining(
7273
vm,
7374
storagesInstance.storages.evmCodeStorage,
7475
bl,
@@ -78,7 +79,7 @@ object RegularSyncItSpecUtils {
7879
ValidatorsExecutorAlwaysSucceed,
7980
NoAdditionalPoWData
8081
)
81-
consensus
82+
mining
8283
}
8384

8485
lazy val checkpointBlockGenerator: CheckpointBlockGenerator = new CheckpointBlockGenerator
@@ -88,18 +89,18 @@ object RegularSyncItSpecUtils {
8889
"peers-client"
8990
)
9091

91-
lazy val consensus: PoWConsensus = buildEthashConsensus()
92+
lazy val mining: PoWMining = buildEthashMining()
9293

9394
lazy val blockQueue: BlockQueue = BlockQueue(bl, blockchainReader, syncConfig)
94-
lazy val blockValidation = new BlockValidation(consensus, blockchainReader, blockQueue)
95+
lazy val blockValidation = new BlockValidation(mining, blockchainReader, blockQueue)
9596
lazy val blockExecution =
9697
new BlockExecution(
9798
bl,
9899
blockchainReader,
99100
blockchainWriter,
100101
storagesInstance.storages.evmCodeStorage,
101102
blockchainConfig,
102-
consensus.blockPreparator,
103+
mining.blockPreparator,
103104
blockValidation
104105
)
105106
lazy val blockImport: BlockImport =
@@ -120,7 +121,7 @@ object RegularSyncItSpecUtils {
120121
"pending-transactions-manager"
121122
)
122123

123-
lazy val validators: ValidatorsExecutor = buildEthashConsensus().validators
124+
lazy val validators: ValidatorsExecutor = buildEthashMining().validators
124125

125126
val broadcasterRef: ActorRef = system.actorOf(
126127
BlockBroadcasterActor

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ class ContractTest extends AnyFlatSpec with Matchers {
2222

2323
//block only with ether transfers
2424
val blockValidation =
25-
new BlockValidation(consensus, blockchainReader, BlockQueue(blockchain, blockchainReader, syncConfig))
25+
new BlockValidation(mining, blockchainReader, BlockQueue(blockchain, blockchainReader, syncConfig))
2626
val blockExecution =
2727
new BlockExecution(
2828
blockchain,
2929
blockchainReader,
3030
blockchainWriter,
3131
testBlockchainStorages.evmCodeStorage,
3232
blockchainConfig,
33-
consensus.blockPreparator,
33+
mining.blockPreparator,
3434
blockValidation
3535
)
3636
blockExecution.executeAndValidateBlock(fixtures.blockByNumber(1)) shouldBe noErrors

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,15 @@ class ECIP1017Test extends AnyFlatSpec with Matchers {
8484
val blockchainWriter = BlockchainWriter(storages, blockchainMetadata)
8585
val blockchain = BlockchainImpl(storages, blockchainReader, blockchainMetadata)
8686
val blockValidation =
87-
new BlockValidation(consensus, blockchainReader, BlockQueue(blockchain, blockchainReader, syncConfig))
87+
new BlockValidation(mining, blockchainReader, BlockQueue(blockchain, blockchainReader, syncConfig))
8888
val blockExecution =
8989
new BlockExecution(
9090
blockchain,
9191
blockchainReader,
9292
blockchainWriter,
9393
testBlockchainStorages.evmCodeStorage,
9494
blockchainConfig,
95-
consensus.blockPreparator,
95+
mining.blockPreparator,
9696
blockValidation
9797
)
9898
blockExecution.executeAndValidateBlock(fixtures.blockByNumber(blockToExecute)) shouldBe noErrors

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ class ForksTest extends AnyFlatSpec with Matchers {
7777
val blockchainWriter = BlockchainWriter(storages, blockchainMetadata)
7878
val blockchain = BlockchainImpl(storages, blockchainReader, blockchainMetadata)
7979
val blockValidation =
80-
new BlockValidation(consensus, blockchainReader, BlockQueue(blockchain, blockchainReader, syncConfig))
80+
new BlockValidation(mining, blockchainReader, BlockQueue(blockchain, blockchainReader, syncConfig))
8181
val blockExecution =
8282
new BlockExecution(
8383
blockchain,
8484
blockchainReader,
8585
blockchainWriter,
8686
testBlockchainStorages.evmCodeStorage,
8787
blockchainConfig,
88-
consensus.blockPreparator,
88+
mining.blockPreparator,
8989
blockValidation
9090
)
9191
blockExecution.executeAndValidateBlock(fixtures.blockByNumber(blockToExecute)) shouldBe noErrors

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ mantis {
1515
mode = "archive"
1616
}
1717

18-
consensus {
18+
mining {
1919
coinbase = "0011223344556677889900112233445566778899" # has to be changed for each node
2020
mining-enabled = false
2121
protocol = "restricted-pow"

src/main/resources/conf/base.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ mantis {
273273
get-transaction-from-pool-timeout = 5.seconds
274274
}
275275

276-
consensus {
276+
mining {
277277
# Miner's coinbase address
278278
# Also used in non-Ethash consensus.
279279
coinbase = "0011223344556677889900112233445566778899"
@@ -287,7 +287,7 @@ mantis {
287287
# Also used by the generic `BlockGenerator`.
288288
block-cashe-size = 30
289289

290-
# See io.iohk.ethereum.consensus.Protocol for the available protocols.
290+
# See io.iohk.ethereum.consensus.mining.Protocol for the available protocols.
291291
# Declaring the protocol here means that a more protocol-specific configuration
292292
# is pulled from the corresponding consensus implementation.
293293
# For example, in case of ethash, a section named `ethash` is used.

src/main/resources/conf/pottery.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mantis {
1111
}
1212
}
1313

14-
consensus {
14+
mining {
1515
coinbase = "0011223344556677889900112233445566778899" # has to be changed for each node
1616
mining-enabled = true
1717
protocol = "restricted-pow"

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

Lines changed: 0 additions & 77 deletions
This file was deleted.

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

Lines changed: 0 additions & 9 deletions
This file was deleted.

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

Lines changed: 0 additions & 8 deletions
This file was deleted.

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

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/main/scala/io/iohk/ethereum/consensus/blocks/BlockGenerator.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,16 @@ import io.iohk.ethereum.ledger.InMemoryWorldStateProxy
88
/** We use a `BlockGenerator` to create the next block.
99
* In a PoW setting, this is what a miner typically does.
1010
* In general, a [[BlockGenerator]] depends on and is provided by the
11-
* [[io.iohk.ethereum.consensus.Consensus Consensus]].
11+
* [[Mining]].
1212
*
1313
* @note This is generally a stateful object.
14-
*
15-
* @see [[io.iohk.ethereum.consensus.Consensus#blockGenerator Consensus#blockGenerator()]],
14+
* @see [[Mining#blockGenerator]],
1615
* [[io.iohk.ethereum.ledger.BlockPreparator BlockPreparator]]
1716
*/
1817
trait BlockGenerator {
1918

2019
/** The type of consensus-specific data used in the block generation process.
21-
* For example, under [[io.iohk.ethereum.consensus.pow.PoWConsensus EthashConsensus]],
20+
* For example, under [[io.iohk.ethereum.consensus.pow.PoWMining EthashConsensus]],
2221
* this represents the [[io.iohk.ethereum.domain.BlockBody#uncleNodesList ommers]].
2322
*/
2423
type X

0 commit comments

Comments
 (0)