Skip to content

Commit bc4a749

Browse files
committed
Merge remote-tracking branch 'origin/develop' into ETCM-165-separate-rlp-sbt-project
2 parents 60dcecb + 482d682 commit bc4a749

File tree

12 files changed

+67
-30
lines changed

12 files changed

+67
-30
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ val mantisDev = sys.props.get("mantisDev").contains("true") || sys.env.get("MANT
1212
def commonSettings(projectName: String): Seq[sbt.Def.Setting[_]] = Seq(
1313
name := projectName,
1414
organization := "io.iohk",
15-
version := "3.2.0",
15+
version := "3.2.1",
1616
scalaVersion := "2.12.12",
1717
// Scalanet snapshots are published to Sonatype after each build.
1818
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",

src/main/resources/chains/testnet-internal-nomad-chain.conf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@
141141

142142
# Set of initial nodes
143143
bootstrap-nodes = [
144-
"enode://ff86741b7b35087b2b53f44a612b233336490d5fae10b1434619b7714fe2d5346c71427a5e126cd27b9422a4d4376c1534ef66e88c5e62d6441d2541f63de0cf@mantis-4.mantis.ws:9004",
145-
"enode://f92aa66337ab1993cc7269d4295d296aefe6199b34e900eac08c514c947ec7340d46a5648ffc2da10325dbaba16bdf92aa9c0b5e51d97a7818c3f495d478ddad@mantis-1.mantis.ws:9001",
146-
"enode://442e2bd50eece65f90dee0d5c6075da4e1b4bc62e36b261a52e7f393dae6a68241e4dbad868c7ecc14fed277ed72e99a289a811b6172f35fb18bdca0b7a5602c@mantis-3.mantis.ws:9003",
147-
"enode://af97643f364b805d5b0e32b5356578a16afcc4fb9d1b6622998e9441eeb7795e8daf8e6b0ff3330da9879034112be56954f9269164513ece0f7394b805be3633@mantis-5.mantis.ws:9005",
148-
"enode://d8a010f019db37dcaf2e1fb98d4fcbf1f57dbd7e2a7f065e92fbe77dca8b9120d6e79f1617e98fa6134e6af8858ac8f3735b1e70a5708eb14f228080356eb0a7@mantis-2.mantis.ws:9002"
144+
"enode://ff86741b7b35087b2b53f44a612b233336490d5fae10b1434619b7714fe2d5346c71427a5e126cd27b9422a4d4376c1534ef66e88c5e62d6441d2541f63de0cf@mantis-4.mantis.ws:9004?discport=9504",
145+
"enode://f92aa66337ab1993cc7269d4295d296aefe6199b34e900eac08c514c947ec7340d46a5648ffc2da10325dbaba16bdf92aa9c0b5e51d97a7818c3f495d478ddad@mantis-1.mantis.ws:9001?discport=9501",
146+
"enode://442e2bd50eece65f90dee0d5c6075da4e1b4bc62e36b261a52e7f393dae6a68241e4dbad868c7ecc14fed277ed72e99a289a811b6172f35fb18bdca0b7a5602c@mantis-3.mantis.ws:9003?discport=9503",
147+
"enode://af97643f364b805d5b0e32b5356578a16afcc4fb9d1b6622998e9441eeb7795e8daf8e6b0ff3330da9879034112be56954f9269164513ece0f7394b805be3633@mantis-5.mantis.ws:9005?discport=9505",
148+
"enode://d8a010f019db37dcaf2e1fb98d4fcbf1f57dbd7e2a7f065e92fbe77dca8b9120d6e79f1617e98fa6134e6af8858ac8f3735b1e70a5708eb14f228080356eb0a7@mantis-2.mantis.ws:9002?discport=9502"
149149
]
150150

151151
# List of hex encoded public keys of Checkpoint Authorities

src/main/scala/io/iohk/ethereum/domain/Address.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ object Address {
3131

3232
def apply(hexString: String): Address = {
3333
val bytes = Hex.decode(hexString.replaceFirst("^0x", ""))
34-
require(bytes.length <= Length, s"Invalid address: $hexString")
34+
require(bytes.nonEmpty && bytes.length <= Length, s"Invalid address: $hexString")
3535
Address(bytes)
3636
}
3737

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,14 @@ trait JsonMethodsImplicits {
9494

9595
for {
9696
from <- input.get("from") match {
97-
case Some(JString(s)) => extractAddress(s)
97+
case Some(JString(s)) if s.nonEmpty => extractAddress(s)
9898
case Some(_) => Left(InvalidAddress)
9999
case _ => Left(InvalidParams("TX 'from' is required"))
100100
}
101101

102102
to <- input.get("to") match {
103-
case Some(JString(s)) =>
104-
extractAddress(s).map(Some(_))
105-
103+
case Some(JString(s)) if s.nonEmpty => extractAddress(s).map(Option.apply)
104+
case Some(JString(_)) => extractAddress("0x0").map(Option.apply)
106105
case Some(_) => Left(InvalidAddress)
107106
case None => Right(None)
108107
}

src/main/scala/io/iohk/ethereum/jsonrpc/server/http/JsonRpcHttpServer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ trait JsonRpcHttpServer extends Json4sSupport with RateLimit with Logger {
103103
entity = HttpEntity(ContentTypes.`application/json`, serialization.writePretty(response))
104104
)
105105
}
106-
complete(httpResponseF)
106+
complete(httpResponseF.runToFuture)
107107
}
108108

109109
private def handleRequest(request: JsonRpcRequest) = {

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import akka.actor.ActorSystem
66
import akka.testkit.{TestKit, TestProbe}
77
import com.miguno.akka.testing.VirtualTime
88
import io.iohk.ethereum.Mocks.{MockValidatorsAlwaysSucceed, MockValidatorsFailingOnBlockBodies}
9-
import io.iohk.ethereum.{BlockHelpers, Timeouts}
9+
import io.iohk.ethereum.{BlockHelpers, Timeouts, WithActorSystemShutDown}
1010
import io.iohk.ethereum.Fixtures.{Blocks => FixtureBlocks}
1111
import io.iohk.ethereum.blockchain.sync.PeersClient.BlacklistPeer
1212
import io.iohk.ethereum.blockchain.sync.regular.BlockFetcher.{InternalLastBlockImport, InvalidateBlocksFrom, PickBlocks}
@@ -24,7 +24,11 @@ import org.scalatest.matchers.should.Matchers
2424

2525
import scala.concurrent.duration._
2626

27-
class BlockFetcherSpec extends TestKit(ActorSystem("BlockFetcherSpec_System")) with AnyFreeSpecLike with Matchers {
27+
class BlockFetcherSpec
28+
extends TestKit(ActorSystem("BlockFetcherSpec_System"))
29+
with AnyFreeSpecLike
30+
with WithActorSystemShutDown
31+
with Matchers {
2832

2933
"BlockFetcher" - {
3034

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@ package io.iohk.ethereum.blockchain.sync.regular
33
import akka.actor.ActorSystem
44
import akka.testkit.{TestKit, TestProbe}
55
import io.iohk.ethereum.Mocks.MockValidatorsAlwaysSucceed
6-
import io.iohk.ethereum.BlockHelpers
6+
import io.iohk.ethereum.{BlockHelpers, WithActorSystemShutDown}
77
import io.iohk.ethereum.network.PeerId
88
import org.scalatest.matchers.should.Matchers
99
import org.scalatest.wordspec.AnyWordSpecLike
1010

1111
import scala.collection.immutable.Queue
1212

13-
class BlockFetcherStateSpec extends TestKit(ActorSystem()) with AnyWordSpecLike with Matchers {
13+
class BlockFetcherStateSpec
14+
extends TestKit(ActorSystem("BlockFetcherStateSpec_System"))
15+
with AnyWordSpecLike
16+
with WithActorSystemShutDown
17+
with Matchers {
1418

1519
lazy val validators = new MockValidatorsAlwaysSucceed
1620

src/test/scala/io/iohk/ethereum/consensus/ethash/EthashMinerSpec.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package ethash
33

44
import akka.actor.{ActorRef, ActorSystem}
55
import akka.testkit.{TestActor, TestActorRef, TestKit, TestProbe}
6-
import io.iohk.ethereum.Fixtures
6+
import io.iohk.ethereum.{Fixtures, WithActorSystemShutDown}
77
import io.iohk.ethereum.consensus.blocks.{PendingBlock, PendingBlockAndState}
88
import io.iohk.ethereum.consensus.ethash.validators.EthashBlockHeaderValidator
99
import io.iohk.ethereum.consensus.validators.BlockHeaderValid
@@ -16,11 +16,17 @@ import monix.eval.Task
1616
import org.bouncycastle.util.encoders.Hex
1717
import org.scalamock.scalatest.MockFactory
1818
import org.scalatest.Tag
19+
1920
import scala.concurrent.duration._
2021
import org.scalatest.flatspec.AnyFlatSpecLike
2122
import org.scalatest.matchers.should.Matchers
2223

23-
class EthashMinerSpec extends TestKit(ActorSystem("EthashMinerSpec_System")) with AnyFlatSpecLike with Matchers {
24+
class EthashMinerSpec
25+
extends TestKit(ActorSystem("EthashMinerSpec_System"))
26+
with AnyFlatSpecLike
27+
with WithActorSystemShutDown
28+
with Matchers {
29+
2430
final val EthashMinerSpecTag = Tag("EthashMinerSpec")
2531

2632
private implicit val timeout: Duration = 10.minutes

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

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package io.iohk.ethereum.jsonrpc.server.http
33
import java.net.InetAddress
44
import java.time.{Clock, Instant, ZoneId}
55
import java.util.concurrent.TimeUnit
6-
76
import akka.actor.ActorSystem
87
import akka.http.scaladsl.model._
98
import akka.http.scaladsl.model.headers.{HttpOrigin, Origin}
@@ -19,13 +18,33 @@ import org.scalamock.scalatest.MockFactory
1918
import org.scalatest.flatspec.AnyFlatSpec
2019
import org.scalatest.matchers.should.Matchers
2120
import akka.http.scaladsl.model.headers._
21+
import io.iohk.ethereum.healthcheck.{HealthcheckResponse, HealthcheckResult}
2222
import io.iohk.ethereum.utils.Logger
2323
import io.iohk.ethereum.jsonrpc.server.controllers.JsonRpcBaseController
24-
2524
import scala.concurrent.duration.FiniteDuration
2625

2726
class JsonRpcHttpServerSpec extends AnyFlatSpec with Matchers with ScalatestRouteTest {
2827

28+
it should "respond to healthcheck" in new TestSetup {
29+
(mockJsonRpcHealthChecker.healthCheck _)
30+
.expects()
31+
.returning(Task.now(HealthcheckResponse(List(HealthcheckResult("listening", "OK", None)))))
32+
33+
val getRequest = HttpRequest(HttpMethods.GET, uri = "/healthcheck")
34+
35+
getRequest ~> Route.seal(mockJsonRpcHttpServer.route) ~> check {
36+
status shouldEqual StatusCodes.OK
37+
responseAs[String] shouldEqual """{
38+
| "checks":[
39+
| {
40+
| "description":"listening",
41+
| "status":"OK"
42+
| }
43+
| ]
44+
|}""".stripMargin
45+
}
46+
}
47+
2948
it should "pass valid json request to controller" in new TestSetup {
3049
(mockJsonRpcController.handleRequest _)
3150
.expects(*)

src/test/scala/io/iohk/ethereum/network/PeerManagerSpec.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import io.iohk.ethereum.network.p2p.messages.CommonMessages.NewBlock
1818
import io.iohk.ethereum.network.p2p.messages.ProtocolVersions
1919
import io.iohk.ethereum.network.p2p.messages.WireProtocol.Disconnect
2020
import io.iohk.ethereum.utils.Config
21-
import io.iohk.ethereum.{Fixtures, NormalPatience}
21+
import io.iohk.ethereum.{Fixtures, NormalPatience, WithActorSystemShutDown}
2222
import org.bouncycastle.util.encoders.Hex
2323
import org.scalatest.concurrent.Eventually
2424
import org.scalatest.flatspec.AnyFlatSpecLike
@@ -28,6 +28,7 @@ import org.scalatest.matchers.should.Matchers
2828
class PeerManagerSpec
2929
extends TestKit(ActorSystem("PeerManagerSpec_System"))
3030
with AnyFlatSpecLike
31+
with WithActorSystemShutDown
3132
with Matchers
3233
with Eventually
3334
with NormalPatience {

src/test/scala/io/iohk/ethereum/network/discovery/PeerDiscoveryManagerSpec.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
package io.iohk.ethereum.network.discovery
22

3-
import akka.pattern.ask
43
import akka.actor.ActorSystem
4+
import akka.pattern.{AskTimeoutException, ask}
55
import akka.testkit.{TestActorRef, TestKit}
66
import akka.util.{ByteString, Timeout}
77
import cats.effect.Resource
8-
import io.iohk.ethereum.NormalPatience
9-
import io.iohk.ethereum.utils.Config
108
import io.iohk.ethereum.db.storage.KnownNodesStorage
9+
import io.iohk.ethereum.utils.Config
10+
import io.iohk.ethereum.{NormalPatience, WithActorSystemShutDown}
1111
import io.iohk.scalanet.discovery.crypto.PublicKey
1212
import io.iohk.scalanet.discovery.ethereum.v4.DiscoveryService
1313
import io.iohk.scalanet.discovery.ethereum.{Node => ENode}
1414
import monix.eval.Task
1515
import monix.execution.Scheduler
1616
import monix.execution.atomic.AtomicInt
17-
import org.scalatest.concurrent.Eventually
17+
import org.scalamock.scalatest.MockFactory
18+
import org.scalatest.concurrent.{Eventually, ScalaFutures}
1819
import org.scalatest.flatspec.AnyFlatSpecLike
1920
import org.scalatest.matchers.should.Matchers
20-
import org.scalatest.concurrent.ScalaFutures
21-
import org.scalamock.scalatest.MockFactory
22-
import scala.concurrent.duration._
2321
import scodec.bits.BitVector
24-
import scala.util.control.NoStackTrace
22+
2523
import scala.collection.immutable.SortedSet
26-
import akka.pattern.AskTimeoutException
24+
import scala.concurrent.duration._
25+
import scala.util.control.NoStackTrace
2726

2827
class PeerDiscoveryManagerSpec
2928
extends TestKit(ActorSystem("PeerDiscoveryManagerSpec_System"))
3029
with AnyFlatSpecLike
30+
with WithActorSystemShutDown
3131
with Matchers
3232
with Eventually
3333
with MockFactory

src/universal/conf/testnet-internal-nomad.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ mantis {
77

88
network {
99
protocol-version = 64
10+
11+
discovery {
12+
discovery-enabled = true
13+
}
1014
}
1115

1216
}

0 commit comments

Comments
 (0)