Skip to content

Commit 13c47db

Browse files
author
Aurélien Richez
committed
remove Blockchain dependency where it is not needed anymore
1 parent 7d2feed commit 13c47db

File tree

17 files changed

+22
-46
lines changed

17 files changed

+22
-46
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ContractTest extends AnyFlatSpec with Matchers {
2525

2626
//block only with ether transfers
2727
val blockValidation =
28-
new BlockValidation(consensus, blockchain, blockchainReader, BlockQueue(blockchain, syncConfig))
28+
new BlockValidation(consensus, blockchainReader, BlockQueue(blockchain, syncConfig))
2929
val blockExecution =
3030
new BlockExecution(blockchain, blockchainReader, blockchainConfig, consensus.blockPreparator, blockValidation)
3131
blockExecution.executeAndValidateBlock(fixtures.blockByNumber(1)) shouldBe noErrors
@@ -38,7 +38,7 @@ class ContractTest extends AnyFlatSpec with Matchers {
3838

3939
//contract creation
4040
val blockValidation =
41-
new BlockValidation(consensus, blockchain, blockchainReader, BlockQueue(blockchain, syncConfig))
41+
new BlockValidation(consensus, blockchainReader, BlockQueue(blockchain, syncConfig))
4242
val blockExecution =
4343
new BlockExecution(blockchain, blockchainReader, blockchainConfig, consensus.blockPreparator, blockValidation)
4444
blockExecution.executeAndValidateBlock(fixtures.blockByNumber(2)) shouldBe noErrors
@@ -51,7 +51,7 @@ class ContractTest extends AnyFlatSpec with Matchers {
5151

5252
//block with ether transfers and contract call
5353
val blockValidation =
54-
new BlockValidation(consensus, blockchain, blockchainReader, BlockQueue(blockchain, syncConfig))
54+
new BlockValidation(consensus, blockchainReader, BlockQueue(blockchain, syncConfig))
5555
val blockExecution =
5656
new BlockExecution(blockchain, blockchainReader, blockchainConfig, consensus.blockPreparator, blockValidation)
5757
blockExecution.executeAndValidateBlock(fixtures.blockByNumber(3)) shouldBe noErrors
@@ -64,7 +64,7 @@ class ContractTest extends AnyFlatSpec with Matchers {
6464

6565
//block contains contract paying 2 accounts
6666
val blockValidation =
67-
new BlockValidation(consensus, blockchain, blockchainReader, BlockQueue(blockchain, syncConfig))
67+
new BlockValidation(consensus, blockchainReader, BlockQueue(blockchain, syncConfig))
6868
val blockExecution =
6969
new BlockExecution(blockchain, blockchainReader, blockchainConfig, consensus.blockPreparator, blockValidation)
7070
blockExecution.executeAndValidateBlock(fixtures.blockByNumber(3)) shouldBe noErrors

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class ECIP1017Test extends AnyFlatSpec with Matchers {
7979
val blockchainReader = BlockchainReader(storages)
8080
val blockchain = BlockchainImpl(storages, blockchainReader)
8181
val blockValidation =
82-
new BlockValidation(consensus, blockchain, blockchainReader, BlockQueue(blockchain, syncConfig))
82+
new BlockValidation(consensus, blockchainReader, BlockQueue(blockchain, syncConfig))
8383
val blockExecution =
8484
new BlockExecution(blockchain, blockchainReader, blockchainConfig, consensus.blockPreparator, blockValidation)
8585
blockExecution.executeAndValidateBlock(fixtures.blockByNumber(blockToExecute)) shouldBe noErrors

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class ForksTest extends AnyFlatSpec with Matchers {
7070
val blockchainReader = BlockchainReader(storages)
7171
val blockchain = BlockchainImpl(storages, blockchainReader)
7272
val blockValidation =
73-
new BlockValidation(consensus, blockchain, blockchainReader, BlockQueue(blockchain, syncConfig))
73+
new BlockValidation(consensus, blockchainReader, BlockQueue(blockchain, syncConfig))
7474
val blockExecution =
7575
new BlockExecution(blockchain, blockchainReader, blockchainConfig, consensus.blockPreparator, blockValidation)
7676
blockExecution.executeAndValidateBlock(fixtures.blockByNumber(blockToExecute)) shouldBe noErrors

src/main/scala/io/iohk/ethereum/blockchain/sync/fast/SyncBlocksValidator.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ package io.iohk.ethereum.blockchain.sync.fast
33
import akka.actor.ActorLogging
44
import akka.util.ByteString
55
import io.iohk.ethereum.consensus.validators.{BlockHeaderError, BlockHeaderValid, Validators}
6-
import io.iohk.ethereum.consensus.validators.std.StdBlockValidator
7-
import io.iohk.ethereum.consensus.validators.std.StdBlockValidator.BlockValid
8-
import io.iohk.ethereum.domain.{BlockBody, BlockHeader, Blockchain, BlockchainReader}
6+
import io.iohk.ethereum.domain.{BlockBody, BlockHeader, BlockchainReader}
97

108
trait SyncBlocksValidator { this: ActorLogging =>
119

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import io.iohk.ethereum.utils.ByteUtils.or
2222
* This is a skeleton for a generic [[io.iohk.ethereum.consensus.blocks.BlockGenerator BlockGenerator]].
2323
*/
2424
abstract class BlockGeneratorSkeleton(
25-
blockchain: Blockchain,
2625
blockchainConfig: BlockchainConfig,
2726
consensusConfig: ConsensusConfig,
2827
difficultyCalc: DifficultyCalculator,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ abstract class NoOmmersBlockGenerator(
1515
difficultyCalc: DifficultyCalculator,
1616
blockTimestampProvider: BlockTimestampProvider = DefaultBlockTimestampProvider
1717
) extends BlockGeneratorSkeleton(
18-
blockchain,
1918
blockchainConfig,
2019
consensusConfig,
2120
difficultyCalc,

src/main/scala/io/iohk/ethereum/consensus/pow/PoWConsensus.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ class PoWConsensus private (
162162

163163
new PoWBlockGeneratorImpl(
164164
validators = _validators,
165-
blockchain = blockchain,
166165
blockchainReader = blockchainReader,
167166
blockchainConfig = blockchainConfig,
168167
consensusConfig = config.generic,
@@ -246,7 +245,6 @@ object PoWConsensus {
246245
)
247246

248247
val blockGenerator: PoWBlockGeneratorImpl = buildBlockGenerator(
249-
blockchain,
250248
blockchainReader,
251249
blockchainConfig,
252250
config,
@@ -269,7 +267,6 @@ object PoWConsensus {
269267
}
270268

271269
private def buildBlockGenerator(
272-
blockchain: BlockchainImpl,
273270
blockchainReader: BlockchainReader,
274271
blockchainConfig: BlockchainConfig,
275272
config: FullConsensusConfig[EthashConfig],
@@ -281,7 +278,6 @@ object PoWConsensus {
281278
case RestrictedPoWMinerData(key) =>
282279
new RestrictedPoWBlockGeneratorImpl(
283280
validators = validators,
284-
blockchain = blockchain,
285281
blockchainReader = blockchainReader,
286282
blockchainConfig = blockchainConfig,
287283
consensusConfig = config.generic,
@@ -293,7 +289,6 @@ object PoWConsensus {
293289
case NoAdditionalPoWData =>
294290
new PoWBlockGeneratorImpl(
295291
validators = validators,
296-
blockchain = blockchain,
297292
blockchainReader = blockchainReader,
298293
blockchainConfig = blockchainConfig,
299294
consensusConfig = config.generic,

src/main/scala/io/iohk/ethereum/consensus/pow/blocks/PoWBlockGenerator.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,13 @@ trait PoWBlockGenerator extends TestBlockGenerator {
2424

2525
class PoWBlockGeneratorImpl(
2626
validators: ValidatorsExecutor,
27-
blockchain: Blockchain,
2827
blockchainReader: BlockchainReader,
2928
blockchainConfig: BlockchainConfig,
3029
consensusConfig: ConsensusConfig,
3130
val blockPreparator: BlockPreparator,
3231
difficultyCalc: DifficultyCalculator,
3332
blockTimestampProvider: BlockTimestampProvider = DefaultBlockTimestampProvider
3433
) extends BlockGeneratorSkeleton(
35-
blockchain,
3634
blockchainConfig,
3735
consensusConfig,
3836
difficultyCalc,
@@ -81,7 +79,7 @@ class PoWBlockGeneratorImpl(
8179
val blockNumber = pHeader.number + 1
8280
val parentHash = pHeader.hash
8381

84-
val ommers = validators.ommersValidator.validate(parentHash, blockNumber, x, blockchain, blockchainReader) match {
82+
val ommers = validators.ommersValidator.validate(parentHash, blockNumber, x, blockchainReader) match {
8583
case Left(_) => emptyX
8684
case Right(_) => x
8785
}
@@ -106,7 +104,6 @@ class PoWBlockGeneratorImpl(
106104
def withBlockTimestampProvider(blockTimestampProvider: BlockTimestampProvider): PoWBlockGeneratorImpl =
107105
new PoWBlockGeneratorImpl(
108106
validators,
109-
blockchain,
110107
blockchainReader,
111108
blockchainConfig,
112109
consensusConfig,

src/main/scala/io/iohk/ethereum/consensus/pow/blocks/RestrictedPoWBlockGeneratorImpl.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ import io.iohk.ethereum.consensus.blocks.{BlockTimestampProvider, DefaultBlockTi
55
import io.iohk.ethereum.consensus.difficulty.DifficultyCalculator
66
import io.iohk.ethereum.consensus.pow.RestrictedPoWSigner
77
import io.iohk.ethereum.consensus.pow.validators.ValidatorsExecutor
8-
import io.iohk.ethereum.domain.{Address, Block, Blockchain, BlockchainReader, SignedTransaction}
8+
import io.iohk.ethereum.domain.{Address, Block, BlockchainReader, SignedTransaction}
99
import io.iohk.ethereum.ledger.{BlockPreparator, InMemoryWorldStateProxy}
1010
import io.iohk.ethereum.utils.BlockchainConfig
1111
import org.bouncycastle.crypto.AsymmetricCipherKeyPair
1212
import io.iohk.ethereum.consensus.ConsensusMetrics
1313

1414
class RestrictedPoWBlockGeneratorImpl(
1515
validators: ValidatorsExecutor,
16-
blockchain: Blockchain,
1716
blockchainReader: BlockchainReader,
1817
blockchainConfig: BlockchainConfig,
1918
consensusConfig: ConsensusConfig,
@@ -23,7 +22,6 @@ class RestrictedPoWBlockGeneratorImpl(
2322
blockTimestampProvider: BlockTimestampProvider = DefaultBlockTimestampProvider
2423
) extends PoWBlockGeneratorImpl(
2524
validators,
26-
blockchain,
2725
blockchainReader,
2826
blockchainConfig,
2927
consensusConfig,
@@ -44,7 +42,7 @@ class RestrictedPoWBlockGeneratorImpl(
4442
val parentHash = pHeader.hash
4543

4644
val validatedOmmers =
47-
validators.ommersValidator.validate(parentHash, blockNumber, ommers, blockchain, blockchainReader) match {
45+
validators.ommersValidator.validate(parentHash, blockNumber, ommers, blockchainReader) match {
4846
case Left(_) => emptyX
4947
case Right(_) => ommers
5048
}

src/main/scala/io/iohk/ethereum/consensus/pow/validators/OmmersValidator.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import akka.util.ByteString
44
import io.iohk.ethereum.consensus.pow.validators.OmmersValidator.{OmmersError, OmmersValid}
55
import io.iohk.ethereum.consensus.validators.BlockHeaderError
66
import io.iohk.ethereum.consensus.{GetBlockHeaderByHash, GetNBlocksBack}
7-
import io.iohk.ethereum.domain.{Block, BlockHeader, Blockchain, BlockchainReader}
7+
import io.iohk.ethereum.domain.{Block, BlockHeader, BlockchainReader}
88

99
trait OmmersValidator {
1010

@@ -20,7 +20,6 @@ trait OmmersValidator {
2020
parentHash: ByteString,
2121
blockNumber: BigInt,
2222
ommers: Seq[BlockHeader],
23-
blockchain: Blockchain,
2423
blockchainReader: BlockchainReader
2524
): Either[OmmersError, OmmersValid] = {
2625

0 commit comments

Comments
 (0)