Skip to content

Commit 0892f6f

Browse files
author
Leonor Boga
committed
ETCM-1058 Run scalafixAll
1 parent 33edc64 commit 0892f6f

File tree

16 files changed

+118
-60
lines changed

16 files changed

+118
-60
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@ package io.iohk.ethereum.ledger
33
import akka.actor.ActorRef
44
import akka.testkit.TestProbe
55
import akka.util.ByteString
6+
67
import cats.data.NonEmptyList
8+
79
import monix.execution.Scheduler
810
import monix.execution.schedulers.SchedulerService
911

1012
import scala.concurrent.duration._
13+
1114
import org.scalamock.scalatest.MockFactory
1215
import org.scalatest.BeforeAndAfterAll
1316
import org.scalatest.concurrent.Eventually
1417
import org.scalatest.flatspec.AnyFlatSpecLike
1518
import org.scalatest.matchers.should.Matchers
19+
1620
import io.iohk.ethereum.Fixtures
1721
import io.iohk.ethereum.Mocks
1822
import io.iohk.ethereum.NormalPatience

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ import akka.actor.ActorRef
44
import akka.actor.typed
55
import akka.actor.typed.scaladsl.adapter._
66
import akka.util.ByteString
7+
78
import cats.effect.Resource
9+
810
import monix.eval.Task
911
import monix.execution.Scheduler
1012

1113
import scala.concurrent.duration._
14+
1215
import io.iohk.ethereum.Mocks.MockValidatorsAlwaysSucceed
1316
import io.iohk.ethereum.blockchain.sync.PeersClient
1417
import io.iohk.ethereum.blockchain.sync.SyncProtocol
@@ -23,11 +26,13 @@ import io.iohk.ethereum.blockchain.sync.regular.BlockImporter.Start
2326
import io.iohk.ethereum.blockchain.sync.regular.RegularSync
2427
import io.iohk.ethereum.blockchain.sync.regular.RegularSync.NewCheckpoint
2528
import io.iohk.ethereum.checkpointing.CheckpointingTestHelpers
29+
import io.iohk.ethereum.consensus.Consensus
30+
import io.iohk.ethereum.consensus.ConsensusImpl
2631
import io.iohk.ethereum.consensus.blocks.CheckpointBlockGenerator
2732
import io.iohk.ethereum.consensus.mining.FullMiningConfig
2833
import io.iohk.ethereum.consensus.mining.MiningConfig
2934
import io.iohk.ethereum.consensus.mining.Protocol.NoAdditionalPoWData
30-
import io.iohk.ethereum.consensus.{Consensus, ConsensusImpl, pow}
35+
import io.iohk.ethereum.consensus.pow
3136
import io.iohk.ethereum.consensus.pow.EthashConfig
3237
import io.iohk.ethereum.consensus.pow.PoWMining
3338
import io.iohk.ethereum.consensus.pow.validators.ValidatorsExecutor

src/main/scala/io/iohk/ethereum/blockchain/sync/SyncController.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import akka.actor.ActorRef
66
import akka.actor.PoisonPill
77
import akka.actor.Props
88
import akka.actor.Scheduler
9+
910
import io.iohk.ethereum.blockchain.sync.fast.FastSync
1011
import io.iohk.ethereum.blockchain.sync.regular.RegularSync
1112
import io.iohk.ethereum.consensus.Consensus

src/main/scala/io/iohk/ethereum/blockchain/sync/regular/BlockImportResult.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.iohk.ethereum.blockchain.sync.regular
22

3-
import io.iohk.ethereum.domain.{Block, ChainWeight}
3+
import io.iohk.ethereum.domain.Block
4+
import io.iohk.ethereum.domain.ChainWeight
45
import io.iohk.ethereum.ledger.BlockData
56
import io.iohk.ethereum.mpt.MerklePatriciaTrie.MissingNodeException
67

src/main/scala/io/iohk/ethereum/blockchain/sync/regular/BlockImporter.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@ import akka.actor.ActorRef
77
import akka.actor.NotInfluenceReceiveTimeout
88
import akka.actor.Props
99
import akka.actor.ReceiveTimeout
10+
1011
import cats.data.NonEmptyList
1112
import cats.implicits._
13+
1214
import monix.eval.Task
1315
import monix.execution.Scheduler
1416

1517
import scala.concurrent.duration._
18+
1619
import io.iohk.ethereum.blockchain.sync.Blacklist.BlacklistReason
1720
import io.iohk.ethereum.blockchain.sync.regular.BlockBroadcast.BlockToBroadcast
1821
import io.iohk.ethereum.blockchain.sync.regular.BlockBroadcasterActor.BroadcastBlocks

src/main/scala/io/iohk/ethereum/blockchain/sync/regular/RegularSync.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import akka.actor.Scheduler
1010
import akka.actor.SupervisorStrategy
1111
import akka.actor.typed.scaladsl.adapter._
1212
import akka.actor.typed.{ActorRef => TypedActorRef}
13+
1314
import io.iohk.ethereum.blockchain.sync.Blacklist
1415
import io.iohk.ethereum.blockchain.sync.SyncProtocol
1516
import io.iohk.ethereum.blockchain.sync.SyncProtocol.Status

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

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

3+
import monix.eval.Task
4+
import monix.execution.Scheduler
5+
36
import io.iohk.ethereum.blockchain.sync.regular.BlockImportResult
47
import io.iohk.ethereum.domain.Block
58
import io.iohk.ethereum.utils.BlockchainConfig
6-
import monix.eval.Task
7-
import monix.execution.Scheduler
89

910
/** This file documents the original interface that was designed at ETCM-1018
1011
* but implements a different one to be used as a stepping stone to the new architecture

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

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

33
import akka.util.ByteString
4+
45
import cats.implicits._
5-
import io.iohk.ethereum.blockchain.sync.regular.{
6-
BlockEnqueued,
7-
BlockImportFailed,
8-
BlockImportFailedDueToMissingNode,
9-
BlockImportResult,
10-
BlockImportedToTop,
11-
ChainReorganised,
12-
DuplicateBlock
13-
}
14-
import io.iohk.ethereum.domain.{Block, BlockHeader, BlockchainImpl, BlockchainReader, BlockchainWriter, ChainWeight}
15-
import io.iohk.ethereum.ledger.BlockExecutionError.{MPTError, ValidationBeforeExecError}
16-
import io.iohk.ethereum.ledger.BlockQueue.Leaf
17-
import io.iohk.ethereum.ledger.{
18-
BlockData,
19-
BlockExecution,
20-
BlockExecutionError,
21-
BlockExecutionSuccess,
22-
BlockMetrics,
23-
BlockQueue,
24-
BlockValidation
25-
}
26-
import io.iohk.ethereum.mpt.MerklePatriciaTrie.MissingNodeException
27-
import io.iohk.ethereum.utils.{BlockchainConfig, ByteStringUtils, Logger}
6+
287
import monix.eval.Task
298
import monix.execution.Scheduler
30-
import org.bouncycastle.util.encoders.Hex
319

3210
import scala.annotation.tailrec
3311

12+
import org.bouncycastle.util.encoders.Hex
13+
14+
import io.iohk.ethereum.blockchain.sync.regular.BlockEnqueued
15+
import io.iohk.ethereum.blockchain.sync.regular.BlockImportFailed
16+
import io.iohk.ethereum.blockchain.sync.regular.BlockImportFailedDueToMissingNode
17+
import io.iohk.ethereum.blockchain.sync.regular.BlockImportResult
18+
import io.iohk.ethereum.blockchain.sync.regular.BlockImportedToTop
19+
import io.iohk.ethereum.blockchain.sync.regular.ChainReorganised
20+
import io.iohk.ethereum.blockchain.sync.regular.DuplicateBlock
21+
import io.iohk.ethereum.domain.Block
22+
import io.iohk.ethereum.domain.BlockHeader
23+
import io.iohk.ethereum.domain.BlockchainImpl
24+
import io.iohk.ethereum.domain.BlockchainReader
25+
import io.iohk.ethereum.domain.BlockchainWriter
26+
import io.iohk.ethereum.domain.ChainWeight
27+
import io.iohk.ethereum.ledger.BlockData
28+
import io.iohk.ethereum.ledger.BlockExecution
29+
import io.iohk.ethereum.ledger.BlockExecutionError
30+
import io.iohk.ethereum.ledger.BlockExecutionError.MPTError
31+
import io.iohk.ethereum.ledger.BlockExecutionError.ValidationBeforeExecError
32+
import io.iohk.ethereum.ledger.BlockExecutionSuccess
33+
import io.iohk.ethereum.ledger.BlockMetrics
34+
import io.iohk.ethereum.ledger.BlockQueue
35+
import io.iohk.ethereum.ledger.BlockQueue.Leaf
36+
import io.iohk.ethereum.ledger.BlockValidation
37+
import io.iohk.ethereum.mpt.MerklePatriciaTrie.MissingNodeException
38+
import io.iohk.ethereum.utils.BlockchainConfig
39+
import io.iohk.ethereum.utils.ByteStringUtils
40+
import io.iohk.ethereum.utils.Logger
41+
3442
class ConsensusImpl(
3543
blockchain: BlockchainImpl,
3644
blockchainReader: BlockchainReader,

src/main/scala/io/iohk/ethereum/jsonrpc/TestService.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,24 @@ package io.iohk.ethereum.jsonrpc
33
import akka.actor.ActorRef
44
import akka.util.ByteString
55
import akka.util.Timeout
6+
67
import monix.eval.Task
78
import monix.execution.Scheduler
89

910
import scala.concurrent.duration._
1011
import scala.util.Failure
1112
import scala.util.Success
1213
import scala.util.Try
14+
1315
import org.bouncycastle.util.encoders.Hex
16+
1417
import io.iohk.ethereum.blockchain.data.GenesisAccount
1518
import io.iohk.ethereum.blockchain.data.GenesisData
1619
import io.iohk.ethereum.blockchain.data.GenesisDataLoader
17-
import io.iohk.ethereum.blockchain.sync.regular.{BlockEnqueued, BlockImportResult, BlockImportedToTop, ChainReorganised}
20+
import io.iohk.ethereum.blockchain.sync.regular.BlockEnqueued
21+
import io.iohk.ethereum.blockchain.sync.regular.BlockImportResult
22+
import io.iohk.ethereum.blockchain.sync.regular.BlockImportedToTop
23+
import io.iohk.ethereum.blockchain.sync.regular.ChainReorganised
1824
import io.iohk.ethereum.consensus.blocks._
1925
import io.iohk.ethereum.consensus.mining.MiningConfig
2026
import io.iohk.ethereum.crypto

src/main/scala/io/iohk/ethereum/nodebuilder/NodeBuilder.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ package io.iohk.ethereum.nodebuilder
22

33
import java.time.Clock
44
import java.util.concurrent.atomic.AtomicReference
5+
56
import akka.actor.ActorRef
67
import akka.actor.ActorSystem
78
import akka.util.ByteString
9+
810
import cats.implicits._
11+
912
import monix.eval.Task
1013
import monix.execution.Scheduler
1114

@@ -14,13 +17,16 @@ import scala.concurrent.duration._
1417
import scala.util.Failure
1518
import scala.util.Success
1619
import scala.util.Try
20+
1721
import org.bouncycastle.crypto.AsymmetricCipherKeyPair
22+
1823
import io.iohk.ethereum.blockchain.data.GenesisDataLoader
1924
import io.iohk.ethereum.blockchain.sync.Blacklist
2025
import io.iohk.ethereum.blockchain.sync.BlockchainHostActor
2126
import io.iohk.ethereum.blockchain.sync.CacheBasedBlacklist
2227
import io.iohk.ethereum.blockchain.sync.SyncController
23-
import io.iohk.ethereum.consensus.{Consensus, ConsensusImpl}
28+
import io.iohk.ethereum.consensus.Consensus
29+
import io.iohk.ethereum.consensus.ConsensusImpl
2430
import io.iohk.ethereum.consensus.blocks.CheckpointBlockGenerator
2531
import io.iohk.ethereum.consensus.mining.MiningBuilder
2632
import io.iohk.ethereum.consensus.mining.MiningConfigBuilder

src/main/scala/io/iohk/ethereum/testmode/TestModeComponentsProvider.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package io.iohk.ethereum.testmode
22

33
import akka.util.ByteString
4-
import io.iohk.ethereum.consensus.{Consensus, ConsensusImpl}
4+
55
import monix.execution.Scheduler
6+
7+
import io.iohk.ethereum.consensus.Consensus
8+
import io.iohk.ethereum.consensus.ConsensusImpl
69
import io.iohk.ethereum.consensus.mining.MiningConfig
710
import io.iohk.ethereum.crypto
811
import io.iohk.ethereum.db.storage.EvmCodeStorage

src/test/scala/io/iohk/ethereum/blockchain/sync/ScenarioSetup.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
package io.iohk.ethereum.blockchain.sync
22

33
import java.util.concurrent.Executors
4+
45
import monix.execution.Scheduler
56

67
import scala.concurrent.ExecutionContext
78
import scala.concurrent.ExecutionContextExecutor
9+
810
import io.iohk.ethereum.Mocks
911
import io.iohk.ethereum.Mocks.MockVM
10-
import io.iohk.ethereum.consensus.{Consensus, ConsensusImpl}
12+
import io.iohk.ethereum.consensus.Consensus
13+
import io.iohk.ethereum.consensus.ConsensusImpl
1114
import io.iohk.ethereum.consensus.mining.Mining
1215
import io.iohk.ethereum.consensus.mining.Protocol
1316
import io.iohk.ethereum.consensus.mining.StdTestMiningBuilder
@@ -69,7 +72,7 @@ trait ScenarioSetup extends StdTestMiningBuilder with StxLedgerBuilder {
6972
protected def newTestMining(validators: Validators = mining.validators, vm: VMImpl = mining.vm): Mining =
7073
mining.withValidators(validators).withVM(vm)
7174

72-
protected def mkBlockExecution(validators: Validators = validators) = {
75+
protected def mkBlockExecution(validators: Validators = validators): BlockExecution = {
7376
val consensuz = mining.withValidators(validators).withVM(new Mocks.MockVM())
7477
val blockValidation = new BlockValidation(consensuz, blockchainReader, blockQueue)
7578
new BlockExecution(

src/test/scala/io/iohk/ethereum/blockchain/sync/regular/RegularSyncFixtures.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.iohk.ethereum.blockchain.sync.regular
22

33
import java.net.InetSocketAddress
4+
45
import akka.actor.ActorRef
56
import akka.actor.ActorSystem
67
import akka.actor.PoisonPill
@@ -10,9 +11,11 @@ import akka.testkit.TestKitBase
1011
import akka.testkit.TestProbe
1112
import akka.util.ByteString
1213
import akka.util.Timeout
14+
1315
import cats.Eq
1416
import cats.data.NonEmptyList
1517
import cats.implicits._
18+
1619
import monix.eval.Task
1720
import monix.execution.Scheduler
1821
import monix.reactive.Observable
@@ -23,11 +26,14 @@ import scala.concurrent.duration.DurationInt
2326
import scala.concurrent.duration.FiniteDuration
2427
import scala.math.BigInt
2528
import scala.reflect.ClassTag
29+
2630
import org.scalamock.scalatest.AsyncMockFactory
2731
import org.scalatest.matchers.should.Matchers
32+
2833
import io.iohk.ethereum.BlockHelpers
2934
import io.iohk.ethereum.blockchain.sync._
30-
import io.iohk.ethereum.consensus.{Consensus, ConsensusImpl}
35+
import io.iohk.ethereum.consensus.Consensus
36+
import io.iohk.ethereum.consensus.ConsensusImpl
3137
import io.iohk.ethereum.consensus.blocks.CheckpointBlockGenerator
3238
import io.iohk.ethereum.db.storage.StateStorage
3339
import io.iohk.ethereum.domain.BlockHeaderImplicits._

src/test/scala/io/iohk/ethereum/blockchain/sync/regular/RegularSyncSpec.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ import akka.testkit.TestActor.AutoPilot
88
import akka.testkit.TestKit
99
import akka.testkit.TestProbe
1010
import akka.util.ByteString
11+
1112
import cats.effect.Resource
1213
import cats.syntax.traverse._
14+
1315
import monix.eval.Task
1416
import monix.execution.Scheduler
1517

@@ -18,11 +20,13 @@ import scala.concurrent.Future
1820
import scala.concurrent.Promise
1921
import scala.concurrent.duration._
2022
import scala.math.BigInt
23+
2124
import org.scalamock.scalatest.AsyncMockFactory
2225
import org.scalatest.Assertion
2326
import org.scalatest.BeforeAndAfterEach
2427
import org.scalatest.diagrams.Diagrams
2528
import org.scalatest.matchers.should.Matchers
29+
2630
import io.iohk.ethereum.BlockHelpers
2731
import io.iohk.ethereum.ObjectGenerators
2832
import io.iohk.ethereum.ResourceFixtures
@@ -34,7 +38,8 @@ import io.iohk.ethereum.blockchain.sync.SyncProtocol.Status
3438
import io.iohk.ethereum.blockchain.sync.SyncProtocol.Status.Progress
3539
import io.iohk.ethereum.blockchain.sync.regular.BlockFetcher.Start
3640
import io.iohk.ethereum.blockchain.sync.regular.RegularSync.NewCheckpoint
37-
import io.iohk.ethereum.consensus.{Consensus, ConsensusImpl}
41+
import io.iohk.ethereum.consensus.Consensus
42+
import io.iohk.ethereum.consensus.ConsensusImpl
3843
import io.iohk.ethereum.crypto.kec256
3944
import io.iohk.ethereum.domain.BlockHeaderImplicits._
4045
import io.iohk.ethereum.domain._

0 commit comments

Comments
 (0)