Skip to content

Commit 8c4496b

Browse files
authored
Merge pull request #743 from input-output-hk/ETCM-141-scalafmt
[ETCM-141] scalafmt
2 parents 2fb06c0 + 12b4f31 commit 8c4496b

File tree

312 files changed

+5734
-3840
lines changed

Some content is hidden

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

312 files changed

+5734
-3840
lines changed

.buildkite/pipeline.nix

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,16 @@ in
3939
];
4040
};
4141

42+
scalafmt = commonAttrs // {
43+
label = "scalafmtCheck";
44+
command = ''
45+
nix-shell --run '$SBT scalafmtCheck'
46+
'';
47+
};
48+
4249
compile = commonAttrs // {
4350
label = "compile everything";
51+
dependsOn = [ scalafmt ];
4452
command = ''
4553
nix-shell --run '$SBT compile-all'
4654
'';

project/plugins.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
logLevel := sbt.Level.Warn
22
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
3+
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")
34
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")
45
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.7.5")
56
addSbtPlugin("com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings" % "3.0.0")

project/repo.nix

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,22 @@
529529
url = "https://repo1.maven.org/maven2/com/typesafe/config/1.2.0/config-1.2.0.pom";
530530
sha256 = "057A2C5F4D6A0AEEB8B74B0A1A020F8B84B425768DEBE878CEB04E5A6CEEE522";
531531
};
532+
"nix-public/com/typesafe/config/1.4.0/config-1.4.0-javadoc.jar" = {
533+
url = "https://repo1.maven.org/maven2/com/typesafe/config/1.4.0/config-1.4.0-javadoc.jar";
534+
sha256 = "768E976B8B59A2E04FD025507222A95F032447803F6FC3E463F45F2247E9B440";
535+
};
536+
"nix-public/com/typesafe/config/1.4.0/config-1.4.0-sources.jar" = {
537+
url = "https://repo1.maven.org/maven2/com/typesafe/config/1.4.0/config-1.4.0-sources.jar";
538+
sha256 = "FFAF8892DC8C61605BD7319C6CDCEA022B6C9C28B62776915A809E8DE93D8A6E";
539+
};
540+
"nix-public/com/typesafe/config/1.4.0/config-1.4.0.jar" = {
541+
url = "https://repo1.maven.org/maven2/com/typesafe/config/1.4.0/config-1.4.0.jar";
542+
sha256 = "AADBFD5A524551BEEF10D3F891D305B83BB27D54703D9A4DE7ACA2A12D9847E2";
543+
};
544+
"nix-public/com/typesafe/config/1.4.0/config-1.4.0.pom" = {
545+
url = "https://repo1.maven.org/maven2/com/typesafe/config/1.4.0/config-1.4.0.pom";
546+
sha256 = "7DF98E93E8BDC6A8EDB86314AC8BA31F260CBD4A0E6B86F5E9AFC932512EF0C7";
547+
};
532548
"nix-public/com/typesafe/ssl-config-core_2.12/0.2.2/ssl-config-core_2.12-0.2.2-javadoc.jar" = {
533549
url = "https://repo1.maven.org/maven2/com/typesafe/ssl-config-core_2.12/0.2.2/ssl-config-core_2.12-0.2.2-javadoc.jar";
534550
sha256 = "9185CF15E1393676F00A0D130E7AA307D1C69A0D2AA2CCD568E73DD1521AFCF9";
@@ -545,6 +561,22 @@
545561
url = "https://repo1.maven.org/maven2/com/typesafe/ssl-config-core_2.12/0.2.2/ssl-config-core_2.12-0.2.2.pom";
546562
sha256 = "521E96B4352FF2CB3B1D4FE7BBB935E53D1BCA9412DD1BC9D2E61F7027A1938F";
547563
};
564+
"nix-public/io/get-coursier/interface/0.0.17/interface-0.0.17-javadoc.jar" = {
565+
url = "https://repo1.maven.org/maven2/io/get-coursier/interface/0.0.17/interface-0.0.17-javadoc.jar";
566+
sha256 = "DA2F22B2A34EBA8BD03038D443412158DE67D022A6B1EB042DDEF84F3A50033E";
567+
};
568+
"nix-public/io/get-coursier/interface/0.0.17/interface-0.0.17-sources.jar" = {
569+
url = "https://repo1.maven.org/maven2/io/get-coursier/interface/0.0.17/interface-0.0.17-sources.jar";
570+
sha256 = "F79C739FE81C23DC60A13A4C12877155197F32C985700CA8055BDB1DD1837729";
571+
};
572+
"nix-public/io/get-coursier/interface/0.0.17/interface-0.0.17.jar" = {
573+
url = "https://repo1.maven.org/maven2/io/get-coursier/interface/0.0.17/interface-0.0.17.jar";
574+
sha256 = "B3987E8C02441E82D88AB8727ACD64EABF3A35217FFEDBA904B125E06A722A77";
575+
};
576+
"nix-public/io/get-coursier/interface/0.0.17/interface-0.0.17.pom" = {
577+
url = "https://repo1.maven.org/maven2/io/get-coursier/interface/0.0.17/interface-0.0.17.pom";
578+
sha256 = "6E23602D09BC9EAA98AF430DB24A2A18A9DD8834FF3820B58D90CA52E561643A";
579+
};
548580
"nix-public/jline/jline/2.14.4/jline-2.14.4-javadoc.jar" = {
549581
url = "https://repo1.maven.org/maven2/jline/jline/2.14.4/jline-2.14.4-javadoc.jar";
550582
sha256 = "0A8A33DFCC39D18D5EC065FA70289182456DC96F635892F41899DA0462293BC0";
@@ -2121,6 +2153,54 @@
21212153
url = "https://repo1.maven.org/maven2/org/scala-sbt/zinc_2.12/1.2.5/zinc_2.12-1.2.5.pom";
21222154
sha256 = "6F9E98A5449DD7D6EB4E4EF65236B5CFFB7821B94C2CDF83C75D658309C29454";
21232155
};
2156+
"nix-public/org/scalameta/sbt-scalafmt_2.12_1.0/2.4.2/sbt-scalafmt-2.4.2-javadoc.jar" = {
2157+
url = "https://repo1.maven.org/maven2/org/scalameta/sbt-scalafmt_2.12_1.0/2.4.2/sbt-scalafmt-2.4.2-javadoc.jar";
2158+
sha256 = "C49C0BFF9FDE1B8C1374760D942A13E063F3221A6A32AC6048109B205BB9959B";
2159+
};
2160+
"nix-public/org/scalameta/sbt-scalafmt_2.12_1.0/2.4.2/sbt-scalafmt-2.4.2-sources.jar" = {
2161+
url = "https://repo1.maven.org/maven2/org/scalameta/sbt-scalafmt_2.12_1.0/2.4.2/sbt-scalafmt-2.4.2-sources.jar";
2162+
sha256 = "6C4EDBE1A02CF207AB5F3E3C50EBD16F3CA1F072FC5E711742D59765F72C43A4";
2163+
};
2164+
"nix-public/org/scalameta/sbt-scalafmt_2.12_1.0/2.4.2/sbt-scalafmt-2.4.2.jar" = {
2165+
url = "https://repo1.maven.org/maven2/org/scalameta/sbt-scalafmt_2.12_1.0/2.4.2/sbt-scalafmt-2.4.2.jar";
2166+
sha256 = "6E8F1FE4487BD75C27B0004C4CFCD3D8497872068234206477A933FB36C595B7";
2167+
};
2168+
"nix-public/org/scalameta/sbt-scalafmt_2.12_1.0/2.4.2/sbt-scalafmt-2.4.2.pom" = {
2169+
url = "https://repo1.maven.org/maven2/org/scalameta/sbt-scalafmt_2.12_1.0/2.4.2/sbt-scalafmt-2.4.2.pom";
2170+
sha256 = "8551E14FA61006C5BE413B7F92893EEBE5819F9F3EC2BDC8EA0B3CA6AFACF80E";
2171+
};
2172+
"nix-public/org/scalameta/scalafmt-dynamic_2.12/2.6.4/scalafmt-dynamic_2.12-2.6.4-javadoc.jar" = {
2173+
url = "https://repo1.maven.org/maven2/org/scalameta/scalafmt-dynamic_2.12/2.6.4/scalafmt-dynamic_2.12-2.6.4-javadoc.jar";
2174+
sha256 = "41029FC1E01E39EAE3003524E5743461EB46FDCF92220BEC16899B08763D5B9F";
2175+
};
2176+
"nix-public/org/scalameta/scalafmt-dynamic_2.12/2.6.4/scalafmt-dynamic_2.12-2.6.4-sources.jar" = {
2177+
url = "https://repo1.maven.org/maven2/org/scalameta/scalafmt-dynamic_2.12/2.6.4/scalafmt-dynamic_2.12-2.6.4-sources.jar";
2178+
sha256 = "B282E2B6F32AB1D4A1A1B2F39DCDB41867175CE793687292C64C9C88DC662CC8";
2179+
};
2180+
"nix-public/org/scalameta/scalafmt-dynamic_2.12/2.6.4/scalafmt-dynamic_2.12-2.6.4.jar" = {
2181+
url = "https://repo1.maven.org/maven2/org/scalameta/scalafmt-dynamic_2.12/2.6.4/scalafmt-dynamic_2.12-2.6.4.jar";
2182+
sha256 = "3CA0741037FE210B263A9BFD19BFCBEF44D0FCEA0D53AB099379649E6C1DD34E";
2183+
};
2184+
"nix-public/org/scalameta/scalafmt-dynamic_2.12/2.6.4/scalafmt-dynamic_2.12-2.6.4.pom" = {
2185+
url = "https://repo1.maven.org/maven2/org/scalameta/scalafmt-dynamic_2.12/2.6.4/scalafmt-dynamic_2.12-2.6.4.pom";
2186+
sha256 = "F9BB5B151A2B57E1A0D7931C40B2C12E96A317A2DBAE6C435D4EEAAD1762E764";
2187+
};
2188+
"nix-public/org/scalameta/scalafmt-interfaces/2.6.4/scalafmt-interfaces-2.6.4-javadoc.jar" = {
2189+
url = "https://repo1.maven.org/maven2/org/scalameta/scalafmt-interfaces/2.6.4/scalafmt-interfaces-2.6.4-javadoc.jar";
2190+
sha256 = "1496DB1A12504C5F7C60AB97664F6254A9BC6A7D1A78F44FDDD52F7CF86510DC";
2191+
};
2192+
"nix-public/org/scalameta/scalafmt-interfaces/2.6.4/scalafmt-interfaces-2.6.4-sources.jar" = {
2193+
url = "https://repo1.maven.org/maven2/org/scalameta/scalafmt-interfaces/2.6.4/scalafmt-interfaces-2.6.4-sources.jar";
2194+
sha256 = "B501B8C7E4FA26F53E2B2EC4EBB4710DE2F0F23B7932FFDB75EEB4F3A2EFF367";
2195+
};
2196+
"nix-public/org/scalameta/scalafmt-interfaces/2.6.4/scalafmt-interfaces-2.6.4.jar" = {
2197+
url = "https://repo1.maven.org/maven2/org/scalameta/scalafmt-interfaces/2.6.4/scalafmt-interfaces-2.6.4.jar";
2198+
sha256 = "413C8D3A2EBE0C78055A526294A4462FB9DDC80633BFB3DCDBC9B66069FA757A";
2199+
};
2200+
"nix-public/org/scalameta/scalafmt-interfaces/2.6.4/scalafmt-interfaces-2.6.4.pom" = {
2201+
url = "https://repo1.maven.org/maven2/org/scalameta/scalafmt-interfaces/2.6.4/scalafmt-interfaces-2.6.4.pom";
2202+
sha256 = "E7FBB300A5FF656DDC91FC08D5399A6234FA38AF6F7A269EBBF7336C6B514754";
2203+
};
21242204
"nix-public/org/scalariform/scalariform_2.12/0.2.0/scalariform_2.12-0.2.0-javadoc.jar" = {
21252205
url = "https://repo1.maven.org/maven2/org/scalariform/scalariform_2.12/0.2.0/scalariform_2.12-0.2.0-javadoc.jar";
21262206
sha256 = "CACC165E5BEC7DF0C36A04C3B7B1194D5E521D53E691DA698B9CE07047169137";

src/main/scala/io/iohk/ethereum/App.scala

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import io.iohk.ethereum.faucet.Faucet
66
import io.iohk.ethereum.mallet.main.Mallet
77
import io.iohk.ethereum.utils.{Config, Logger}
88

9-
109
object App extends Logger {
1110

1211
def main(args: Array[String]): Unit = {
@@ -19,25 +18,26 @@ object App extends Logger {
1918
val faucet = "faucet"
2019
val ecKeyGen = "eckeygen"
2120

22-
args.headOption match {
23-
case None => Mantis.main(args)
24-
case Some(`launchMantis`) => Mantis.main(args.tail)
25-
case Some(`launchKeytool`) => KeyTool.main(args.tail)
26-
case Some(`downloadBootstrap`) => {
27-
Config.Db.dataSource match {
28-
case "rocksdb" => BootstrapDownload.main(args.tail :+ Config.Db.RocksDb.path)
29-
}
21+
args.headOption match {
22+
case None => Mantis.main(args)
23+
case Some(`launchMantis`) => Mantis.main(args.tail)
24+
case Some(`launchKeytool`) => KeyTool.main(args.tail)
25+
case Some(`downloadBootstrap`) => {
26+
Config.Db.dataSource match {
27+
case "rocksdb" => BootstrapDownload.main(args.tail :+ Config.Db.RocksDb.path)
3028
}
31-
case Some(`vmServer`) => VmServerApp.main(args.tail)
32-
case Some(`mallet`) => Mallet.main(args.tail)
33-
case Some(`faucet`) => Faucet.main(args.tail)
34-
case Some(`ecKeyGen`) => EcKeyGen.main(args.tail)
35-
case Some(unknown) =>
36-
log.error(s"Unrecognised launcher option, " +
37-
s"first parameter must be $launchKeytool, $downloadBootstrap, $launchMantis, " +
38-
s"$mallet, $faucet, $vmServer or $ecKeyGen")
3929
}
40-
30+
case Some(`vmServer`) => VmServerApp.main(args.tail)
31+
case Some(`mallet`) => Mallet.main(args.tail)
32+
case Some(`faucet`) => Faucet.main(args.tail)
33+
case Some(`ecKeyGen`) => EcKeyGen.main(args.tail)
34+
case Some(unknown) =>
35+
log.error(
36+
s"Unrecognised launcher option, " +
37+
s"first parameter must be $launchKeytool, $downloadBootstrap, $launchMantis, " +
38+
s"$mallet, $faucet, $vmServer or $ecKeyGen"
39+
)
40+
}
4141

4242
}
4343
}

src/main/scala/io/iohk/ethereum/BootstrapDownload.scala

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package io.iohk.ethereum
22

3-
43
import java.io.{File, FileInputStream, FileOutputStream}
54
import java.net.URL
65
import java.nio.file._
@@ -10,8 +9,6 @@ import java.util.zip.ZipInputStream
109
import io.iohk.ethereum.utils.Logger
1110
import org.bouncycastle.util.encoders.Hex
1211

13-
14-
1512
/**
1613
* A facility to
1714
* - check the download location for a minimum amount of free space
@@ -26,14 +23,17 @@ object BootstrapDownload extends Logger {
2623
val leveldbFolderName = "leveldb"
2724

2825
private def assertAndLog(cond: Boolean, msg: String): Unit = {
29-
if(!cond) log.info(msg)
26+
if (!cond) log.info(msg)
3027
assert(cond, msg)
3128
}
3229

3330
def cleanOutFolder(pathToDownloadTo: Path): Unit = {
3431
val leveldbFolder = pathToDownloadTo.toFile
3532
assertAndLog(leveldbFolder.isDirectory, s"${pathToDownloadTo} must be a folder.")
36-
assertAndLog(leveldbFolder.getName == leveldbFolderName, s"${pathToDownloadTo} must end in a folder named $leveldbFolderName")
33+
assertAndLog(
34+
leveldbFolder.getName == leveldbFolderName,
35+
s"${pathToDownloadTo} must end in a folder named $leveldbFolderName"
36+
)
3737
leveldbFolder.listFiles(pathname => !pathname.getName.endsWith(".zip")).foreach(_.delete())
3838
}
3939

@@ -43,12 +43,12 @@ object BootstrapDownload extends Logger {
4343
val dis = new DigestInputStream(new URL(urlToDownloadFrom).openStream(), sha512)
4444

4545
try {
46-
val out = new FileOutputStream(outFile)
47-
try {
48-
val buffer = new Array[Byte](bufferSize)
49-
Stream.continually(dis.read(buffer)).takeWhile(_ != -1).foreach(out.write(buffer, 0, _))
50-
} finally (out.close())
51-
Hex.toHexString(sha512.digest)
46+
val out = new FileOutputStream(outFile)
47+
try {
48+
val buffer = new Array[Byte](bufferSize)
49+
Stream.continually(dis.read(buffer)).takeWhile(_ != -1).foreach(out.write(buffer, 0, _))
50+
} finally (out.close())
51+
Hex.toHexString(sha512.digest)
5252

5353
} finally {
5454
dis.close()
@@ -74,34 +74,37 @@ object BootstrapDownload extends Logger {
7474
try {
7575
val buffer = new Array[Byte](bufferSize)
7676
Stream.continually(zis.read(buffer)).takeWhile(_ != -1).foreach(out.write(buffer, 0, _))
77-
} finally(out.close())
77+
} finally (out.close())
7878
}
7979
}
80-
} finally(zis.close())
81-
} finally(in.close())
80+
} finally (zis.close())
81+
} finally (in.close())
8282
}
8383

84-
8584
def deleteDownloadedFile(downloadedFile: File): Unit = {
86-
if(downloadedFile.delete()) log.info(s"Downloaded file $downloadedFile successfully deleted")
85+
if (downloadedFile.delete()) log.info(s"Downloaded file $downloadedFile successfully deleted")
8786
else log.info(s"Failed to delete downloaded file $downloadedFile")
8887
}
8988

89+
// scalastyle:off method.length
9090
def main(args: Array[String]): Unit = {
9191
//download a zip file from a url.
9292

93-
assertAndLog(args.length == 4, "Provide the url to download from, " +
94-
" expected hash of the downloaded file, " +
95-
" the minimum required free disk space in giga bytes" +
96-
" and the path to extract the file to")
93+
assertAndLog(
94+
args.length == 4,
95+
"Provide the url to download from, " +
96+
" expected hash of the downloaded file, " +
97+
" the minimum required free disk space in giga bytes" +
98+
" and the path to extract the file to"
99+
)
97100

98101
val urlToDownloadFrom = new URL(args(0))
99102
val expectedHash = args(1)
100103
val minimumExpectedDiskSpace = args(2)
101104
val pathToDownloadTo = Paths.get(args(3))
102105

103-
val bytesInOneGigaByte = 1024l * 1024l * 1024l
104-
val minimumExpectedDiskSpaceInBytes = minimumExpectedDiskSpace.toLong * bytesInOneGigaByte
106+
val bytesInOneGigaByte = 1024L * 1024L * 1024L
107+
val minimumExpectedDiskSpaceInBytes = minimumExpectedDiskSpace.toLong * bytesInOneGigaByte
105108

106109
val urlToDownloadFromAsFile = new File(urlToDownloadFrom.getFile)
107110
val pathToDownloadToAsFile = pathToDownloadTo.toFile
@@ -112,11 +115,13 @@ object BootstrapDownload extends Logger {
112115
log.info(s"Download path is $urlToDownloadFrom")
113116
log.info(s"Path to download to is $pathToDownloadTo")
114117

115-
if(!pathToDownloadToAsFile.exists()) pathToDownloadToAsFile.mkdirs()
118+
if (!pathToDownloadToAsFile.exists()) pathToDownloadToAsFile.mkdirs()
116119

117120
assertAndLog(pathToDownloadToAsFile.isDirectory, s"$pathToDownloadToAsFile must be a folder.")
118-
assertAndLog(pathToDownloadToAsFile.getUsableSpace() >= minimumExpectedDiskSpaceInBytes,
119-
s"There is not enough free space ($minimumExpectedDiskSpace GB) to download and expand to $pathToDownloadTo ")
121+
assertAndLog(
122+
pathToDownloadToAsFile.getUsableSpace() >= minimumExpectedDiskSpaceInBytes,
123+
s"There is not enough free space ($minimumExpectedDiskSpace GB) to download and expand to $pathToDownloadTo "
124+
)
120125

121126
log.info(s"Free space check ok, starting download! (this could take some time)")
122127
val hash = downloadFile(args(0), downloadedFile)

src/main/scala/io/iohk/ethereum/KeyTool.scala

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

3-
43
object KeyTool {
54

65
def main(args: Array[String]): Unit = sun.security.tools.keytool.Main.main(args)

src/main/scala/io/iohk/ethereum/Mantis.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ object Mantis extends Logger {
99
if (Config.testmode) {
1010
log.info("Starting Mantis in test mode")
1111
new TestNode
12-
}
13-
else new StdNode
12+
} else new StdNode
1413

1514
log.info("Using network {}", Config.blockchains.network)
1615

src/main/scala/io/iohk/ethereum/blockchain/data/GenesisDataLoader.scala

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ import org.bouncycastle.util.encoders.Hex
1818
import scala.io.Source
1919
import scala.util.{Failure, Success, Try}
2020

21-
class GenesisDataLoader(
22-
blockchain: Blockchain,
23-
blockchainConfig: BlockchainConfig)
24-
extends Logger{
21+
class GenesisDataLoader(blockchain: Blockchain, blockchainConfig: BlockchainConfig) extends Logger {
2522

2623
private val bloomLength = 512
2724
private val hashLength = 64
@@ -90,13 +87,17 @@ class GenesisDataLoader(
9087
val storage = stateStorage.getReadOnlyStorage
9188
val initalRootHash = MerklePatriciaTrie.EmptyRootHash
9289

93-
val stateMptRootHash = genesisData.alloc.zipWithIndex.foldLeft(initalRootHash) { case (rootHash, (((address, AllocAccount(balance)), idx))) =>
94-
val mpt = MerklePatriciaTrie[Array[Byte], Account](rootHash, storage)
95-
val paddedAddress = address.reverse.padTo(addressLength, "0").reverse.mkString
96-
val stateRoot = mpt.put(crypto.kec256(Hex.decode(paddedAddress)),
97-
Account(blockchainConfig.accountStartNonce, UInt256(BigInt(balance)), emptyTrieRootHash, emptyEvmHash)
98-
).getRootHash
99-
stateRoot
90+
val stateMptRootHash = genesisData.alloc.zipWithIndex.foldLeft(initalRootHash) {
91+
case (rootHash, (((address, AllocAccount(balance)), idx))) =>
92+
val mpt = MerklePatriciaTrie[Array[Byte], Account](rootHash, storage)
93+
val paddedAddress = address.reverse.padTo(addressLength, "0").reverse.mkString
94+
val stateRoot = mpt
95+
.put(
96+
crypto.kec256(Hex.decode(paddedAddress)),
97+
Account(blockchainConfig.accountStartNonce, UInt256(BigInt(balance)), emptyTrieRootHash, emptyEvmHash)
98+
)
99+
.getRootHash
100+
stateRoot
100101
}
101102

102103
val header: BlockHeader = prepareHeader(genesisData, stateMptRootHash)
@@ -108,8 +109,12 @@ class GenesisDataLoader(
108109
log.debug("Genesis data already in the database")
109110
Success(())
110111
case Some(_) =>
111-
Failure(new RuntimeException("Genesis data present in the database does not match genesis block from file." +
112-
" Use different directory for running private blockchains."))
112+
Failure(
113+
new RuntimeException(
114+
"Genesis data present in the database does not match genesis block from file." +
115+
" Use different directory for running private blockchains."
116+
)
117+
)
113118
case None =>
114119
storage.persist()
115120
stateStorage.forcePersist(GenesisDataLoad)
@@ -158,12 +163,13 @@ object GenesisDataLoader {
158163
case other => throw new RuntimeException("Expected hex string, but got: " + other)
159164
}
160165

161-
object ByteStringJsonSerializer extends CustomSerializer[ByteString](formats =>
162-
(
163-
{ case jv => deserializeByteString(jv) },
164-
PartialFunction.empty
165-
)
166-
)
166+
object ByteStringJsonSerializer
167+
extends CustomSerializer[ByteString](formats =>
168+
(
169+
{ case jv => deserializeByteString(jv) },
170+
PartialFunction.empty
171+
)
172+
)
167173

168174
}
169175
}

src/main/scala/io/iohk/ethereum/blockchain/data/genesis.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ case class GenesisData(
1212
gasLimit: String,
1313
coinbase: ByteString,
1414
timestamp: String,
15-
alloc: Map[String, AllocAccount])
15+
alloc: Map[String, AllocAccount]
16+
)

0 commit comments

Comments
 (0)