Skip to content

Commit e9089fe

Browse files
author
Dmitry Voronov
committed
Scalafmt fixes
1 parent 80e6ff5 commit e9089fe

File tree

17 files changed

+49
-32
lines changed

17 files changed

+49
-32
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ trait ReceiptsValidator {
3131
case (Some(header), receipt) =>
3232
validators.blockValidator.validateBlockAndReceipts(header, receipt) match {
3333
case Left(err) => Some(Invalid(err))
34-
case _ => None
34+
case _ => None
3535
}
3636
case (None, _) => Some(DbError)
3737
}
3838

39-
val receiptsValidationError = errorIterator.collectFirst {
40-
case Some(error) => error
39+
val receiptsValidationError = errorIterator.collectFirst { case Some(error) =>
40+
error
4141
}
4242

4343
receiptsValidationError.getOrElse(Valid(blockHashesWithReceipts))

src/main/scala/io/iohk/ethereum/db/storage/AppStateStorage.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ import scala.collection.immutable.ArraySeq
1515
class AppStateStorage(val dataSource: DataSource) extends TransactionalKeyValueStorage[Key, Value] {
1616

1717
val namespace: IndexedSeq[Byte] = Namespaces.AppStateNamespace
18-
def keySerializer: Key => IndexedSeq[Byte] = k => ArraySeq.unsafeWrapArray(k.getBytes(StorageStringCharset.UTF8Charset))
18+
def keySerializer: Key => IndexedSeq[Byte] = k =>
19+
ArraySeq.unsafeWrapArray(k.getBytes(StorageStringCharset.UTF8Charset))
1920

2021
def keyDeserializer: IndexedSeq[Byte] => Key = k => new String(k.toArray, StorageStringCharset.UTF8Charset)
21-
def valueSerializer: String => IndexedSeq[Byte] = k => ArraySeq.unsafeWrapArray(k.getBytes(StorageStringCharset.UTF8Charset))
22+
def valueSerializer: String => IndexedSeq[Byte] = k =>
23+
ArraySeq.unsafeWrapArray(k.getBytes(StorageStringCharset.UTF8Charset))
2224
def valueDeserializer: IndexedSeq[Byte] => String = (valueBytes: IndexedSeq[Byte]) =>
2325
new String(valueBytes.toArray, StorageStringCharset.UTF8Charset)
2426

src/main/scala/io/iohk/ethereum/db/storage/BlockNumberMappingStorage.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class BlockNumberMappingStorage(val dataSource: DataSource)
1212
extends TransactionalKeyValueStorage[BigInt, BlockHeaderHash] {
1313
override val namespace: IndexedSeq[Byte] = Namespaces.HeightsNamespace
1414

15-
override def keySerializer: (BigInt) => IndexedSeq[Byte] = index => ArraySeq.unsafeWrapArray( index.toByteArray )
15+
override def keySerializer: (BigInt) => IndexedSeq[Byte] = index => ArraySeq.unsafeWrapArray(index.toByteArray)
1616

1717
override def keyDeserializer: IndexedSeq[Byte] => BigInt = bytes => new BigInt(new BigInteger(bytes.toArray))
1818

src/main/scala/io/iohk/ethereum/db/storage/FastSyncStateStorage.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ class FastSyncStateStorage(val dataSource: DataSource)
3535
.addConcreteType[EvmCodeHash]
3636
.addConcreteType[StorageRootHash]
3737

38-
override def keySerializer: String => IndexedSeq[Byte] = k => ArraySeq.unsafeWrapArray(k.getBytes(StorageStringCharset.UTF8Charset))
38+
override def keySerializer: String => IndexedSeq[Byte] = k =>
39+
ArraySeq.unsafeWrapArray(k.getBytes(StorageStringCharset.UTF8Charset))
3940

4041
override def keyDeserializer: IndexedSeq[Byte] => String = b =>
4142
new String(b.toArray, StorageStringCharset.UTF8Charset)

src/main/scala/io/iohk/ethereum/db/storage/TransactionalKeyValueStorage.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ trait TransactionalKeyValueStorage[K, V] {
6161
result.map { case (key, value) =>
6262
val kseq = keyDeserializer(ArraySeq.unsafeWrapArray(key))
6363
val vseq = valueDeserializer(ArraySeq.unsafeWrapArray(value))
64-
(kseq, vseq) }
64+
(kseq, vseq)
65+
}
6566
}
6667
}
6768
}

src/main/scala/io/iohk/ethereum/faucet/jsonrpc/FaucetBuilder.scala

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,12 @@ trait ShutdownHookBuilder {
9797

9898
def shutdown(): Unit = {
9999
Await.ready(
100-
system.terminate().map(
101-
_ ->
102-
log.info("actor system finished")
103-
)(system.dispatcher),
100+
system
101+
.terminate()
102+
.map(
103+
_ ->
104+
log.info("actor system finished")
105+
)(system.dispatcher),
104106
faucetConfig.shutdownTimeout
105107
)
106108
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -565,12 +565,11 @@ object EthJsonMethodsImplicits extends JsonMethodsImplicits {
565565
def toEitherOpt[A, B](opt: Option[Either[A, B]]): Either[A, Option[B]] = {
566566
opt match {
567567
case Some(Right(v)) => Right(Option(v))
568-
case Some(Left(e)) => Left(e)
569-
case None => Right(None)
568+
case Some(Left(e)) => Left(e)
569+
case None => Right(None)
570570
}
571571
}
572572

573-
574573
for {
575574
from <- toEitherOpt((obj \ "from").extractOpt[String].map(extractBytes))
576575
to <- toEitherOpt((obj \ "to").extractOpt[String].map(extractBytes))

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,9 @@ class EthService(
649649
case Right(data) =>
650650
call(CallRequest(CallTx(tx.from, tx.to, tx.gas, tx.gasPrice, tx.value, ByteString(data)), req.block))
651651
.map(_.map { callResponse =>
652-
IeleCallResponse(rlp.decode[Seq[ByteString]](callResponse.returnData.toArray[Byte])(seqEncDec[ByteString]()))
652+
IeleCallResponse(
653+
rlp.decode[Seq[ByteString]](callResponse.returnData.toArray[Byte])(seqEncDec[ByteString]())
654+
)
653655
})
654656
case Left(error) => Task.now(Left(error))
655657
}

src/main/scala/io/iohk/ethereum/ledger/BlockPreparator.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ class BlockPreparator(
313313

314314
val validatedStx = for {
315315
accData <- accountDataOpt
316-
_ <- signedTxValidator.validate(stx, accData._1, blockHeader, upfrontCost, acumGas)
316+
_ <- signedTxValidator.validate(stx, accData._1, blockHeader, upfrontCost, acumGas)
317317
} yield (accData)
318318

319319
validatedStx match {

src/main/scala/io/iohk/ethereum/network/PeerEventBusActor.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,8 @@ object PeerEventBusActor {
8282
* @param subscriber
8383
*/
8484
override def unsubscribe(subscriber: ActorRef): Unit = {
85-
messageSubscriptions = messageSubscriptions.filter {
86-
case ((sub, _), _) =>
87-
sub != subscriber
85+
messageSubscriptions = messageSubscriptions.filter { case ((sub, _), _) =>
86+
sub != subscriber
8887
}
8988
connectionSubscriptions = connectionSubscriptions.filterNot(_.subscriber == subscriber)
9089
}

src/main/scala/io/iohk/ethereum/network/rlpx/AuthInitiateMessage.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ case class AuthInitiateMessage(
4545
ByteString(if (knownPeer) 1.toByte else 0.toByte)
4646
)
4747

48-
4948
// lazy val encoded: ByteString = {
5049
// encodeECDSA(signature) ++
5150
// ephemeralPublicHash ++

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,12 @@ abstract class BaseNode extends Node {
8484
tryAndLogFailure(() => consensus.stopProtocol())
8585
tryAndLogFailure(() =>
8686
Await.ready(
87-
system.terminate().map(
88-
_ ->
89-
log.info("actor system finished")
90-
),
87+
system
88+
.terminate()
89+
.map(
90+
_ ->
91+
log.info("actor system finished")
92+
),
9193
shutdownTimeoutDuration
9294
)
9395
)

src/test/scala/io/iohk/ethereum/jsonrpc/server/http/JsonRpcHttpServerSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ class FakeJsonRpcHttpServer(
469469
def run(): Unit = ()
470470
override def corsAllowedOrigins: HttpOriginMatcher = cors
471471

472-
var mockedTime:Long = 0L
472+
var mockedTime: Long = 0L
473473

474474
override protected val rateLimit: RateLimit = new RateLimit(config.rateLimit) {
475475
override protected def getCurrentTimeNanos: Long = FakeJsonRpcHttpServer.this.mockedTime

src/test/scala/io/iohk/ethereum/ledger/BlockPreparatorSpec.scala

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ import io.iohk.ethereum.consensus.validators.{SignedTransactionValid, SignedTran
1010
import io.iohk.ethereum.crypto.{generateKeyPair, kec256}
1111
import io.iohk.ethereum.domain._
1212
import io.iohk.ethereum.ledger.Ledger.{BlockResult, VMImpl}
13-
import io.iohk.ethereum.vm.{InvalidJump, InvalidOpCode, OutOfGas, ProgramError, RevertOccurs, StackOverflow, StackUnderflow}
13+
import io.iohk.ethereum.vm.{
14+
InvalidJump,
15+
InvalidOpCode,
16+
OutOfGas,
17+
ProgramError,
18+
RevertOccurs,
19+
StackOverflow,
20+
StackUnderflow
21+
}
1422
import org.bouncycastle.crypto.AsymmetricCipherKeyPair
1523
import org.bouncycastle.crypto.params.ECPublicKeyParameters
1624
import org.scalatest.prop.{TableFor2, TableFor4}

src/test/scala/io/iohk/ethereum/ledger/LedgerSpec.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ class LedgerSpec extends AnyFlatSpec with ScalaCheckPropertyChecks with Matchers
158158
val correctStateRoot: ByteString = applyChanges(validBlockParentHeader.stateRoot, blockchainStorages, changes)
159159

160160
val correctGasUsed: BigInt = 0
161-
val incorrectStateRoot: ByteString = concatByteStrings(((correctStateRoot.head + 1) & 0xff).toByte, correctStateRoot.tail)
161+
val incorrectStateRoot: ByteString =
162+
concatByteStrings(((correctStateRoot.head + 1) & 0xff).toByte, correctStateRoot.tail)
162163
val table: TableFor3[ByteString, BigInt, Validators] = Table[ByteString, BigInt, Validators](
163164
("stateRootHash", "cumulativeGasUsedBlock", "validators"),
164165
(correctStateRoot, correctGasUsed + 1, new Mocks.MockValidatorsAlwaysSucceed),

src/test/scala/io/iohk/ethereum/network/handshaker/EtcHandshakerSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ class EtcHandshakerSpec extends AnyFlatSpec with Matchers {
219219

220220
it should "fail if a status msg is received with invalid genesisHash" in new LocalPeerPV63Setup
221221
with RemotePeerPV63Setup {
222-
val wrongGenesisHash = concatByteStrings( (localStatus.genesisHash.head + 1).toByte, localStatus.genesisHash.tail)
222+
val wrongGenesisHash = concatByteStrings((localStatus.genesisHash.head + 1).toByte, localStatus.genesisHash.tail)
223223

224224
val handshakerAfterHelloOpt = initHandshakerWithResolver.applyMessage(remoteHello)
225225
val handshakerAfterStatusOpt =

src/test/scala/io/iohk/ethereum/network/p2p/messages/NodeDataSpec.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ class NodeDataSpec extends AnyFlatSpec with Matchers {
5151
)
5252

5353
val encodedBranchNode = {
54-
val encodeableList: Array[RLPEncodeable] = (Array.fill[RLPValue](3)(RLPValue(Array.emptyByteArray)) :+ (exampleHash: RLPEncodeable)) ++
55-
(Array.fill[RLPValue](6)(RLPValue(Array.emptyByteArray)) :+ (exampleHash: RLPEncodeable)) ++
56-
(Array.fill[RLPValue](5)(RLPValue(Array.emptyByteArray)) :+ (Array.emptyByteArray: RLPEncodeable))
54+
val encodeableList: Array[RLPEncodeable] =
55+
(Array.fill[RLPValue](3)(RLPValue(Array.emptyByteArray)) :+ (exampleHash: RLPEncodeable)) ++
56+
(Array.fill[RLPValue](6)(RLPValue(Array.emptyByteArray)) :+ (exampleHash: RLPEncodeable)) ++
57+
(Array.fill[RLPValue](5)(RLPValue(Array.emptyByteArray)) :+ (Array.emptyByteArray: RLPEncodeable))
5758
RLPList(ArraySeq.unsafeWrapArray(encodeableList): _*)
5859
}
5960

0 commit comments

Comments
 (0)