Skip to content

Commit

Permalink
[ETCM-331] Minor Fixes - updates based on review
Browse files Browse the repository at this point in the history
  • Loading branch information
SoseMagarian committed Dec 1, 2020
1 parent 341db30 commit 6e82731
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import com.typesafe.config.{Config => TypesafeConfig}

import scala.concurrent.duration.{FiniteDuration, _}

trait JsonRpcHttpServer extends Json4sSupport with RateLimit {
trait JsonRpcHttpServer extends Json4sSupport with RateLimit with Logger {
val jsonRpcController: JsonRpcBaseController
val jsonRpcHealthChecker: JsonRpcHealthChecker
val config: JsonRpcHttpServerConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import java.time.Clock
import akka.http.scaladsl.model.RemoteAddress
import com.twitter.util.LruMap
import io.iohk.ethereum.jsonrpc.server.http.JsonRpcHttpServer.JsonRpcHttpServerConfig
import io.iohk.ethereum.utils.Logger

trait RateLimit extends Logger {
trait RateLimit {

val config: JsonRpcHttpServerConfig

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import scala.util.{Failure, Success}
class SecureJsonRpcHttpServer(
val jsonRpcController: JsonRpcBaseController,
val jsonRpcHealthChecker: JsonRpcHealthChecker,
override val config: JsonRpcHttpServerConfig,
val config: JsonRpcHttpServerConfig,
secureRandom: SecureRandom,
getSSLContext: () => Either[SSLError, SSLContext]
)(implicit val actorSystem: ActorSystem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,26 +241,26 @@ class JsonRpcHttpServerSpec extends AnyFlatSpec with Matchers with ScalatestRout
val fakeClock = new FakeClock

val mockJsonRpcHttpServer = new FakeJsonRpcHttpServer(
mockJsonRpcController,
mockJsonRpcHealthChecker,
serverConfig,
serverConfig.corsAllowedOrigins,
fakeClock)
jsonRpcController = mockJsonRpcController,
jsonRpcHealthChecker = mockJsonRpcHealthChecker,
config = serverConfig,
cors = serverConfig.corsAllowedOrigins,
testClock = fakeClock)

val corsAllowedOrigin = HttpOrigin("http://localhost:3333")
val mockJsonRpcHttpServerWithCors = new FakeJsonRpcHttpServer(
mockJsonRpcController,
mockJsonRpcHealthChecker,
serverConfig,
HttpOriginMatcher(corsAllowedOrigin),
fakeClock)
jsonRpcController = mockJsonRpcController,
jsonRpcHealthChecker = mockJsonRpcHealthChecker,
config = serverConfig,
cors = HttpOriginMatcher(corsAllowedOrigin),
testClock = fakeClock)

val mockJsonRpcHttpServerWithRateLimit = new FakeJsonRpcHttpServer(
mockJsonRpcController,
mockJsonRpcHealthChecker,
serverConfigWithRateLimit,
serverConfigWithRateLimit.corsAllowedOrigins,
fakeClock)
jsonRpcController = mockJsonRpcController,
jsonRpcHealthChecker = mockJsonRpcHealthChecker,
config = serverConfigWithRateLimit,
cors = serverConfigWithRateLimit.corsAllowedOrigins,
testClock = fakeClock)
}
}

Expand Down

0 comments on commit 6e82731

Please sign in to comment.