Skip to content

Commit

Permalink
chore: tech-debt clean up all warnings (#564)
Browse files Browse the repository at this point in the history
  • Loading branch information
CryptoKnightIOG authored Jun 22, 2023
1 parent d6ff373 commit 495d0d0
Show file tree
Hide file tree
Showing 21 changed files with 30 additions and 9 deletions.
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ inThisBuild(
scalacOptions ++= Seq(
"-encoding",
"UTF-8",
"-feature",
"-deprecation",
"-unchecked",
"-Dquill.macro.log=false" // disable quill macro logs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import io.iohk.atala.resolvers._
import io.circe.Json
import io.circe.parser.*
import io.circe.syntax.*
import scala.language.implicitConversions

/** AgentCli
* {{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import io.iohk.atala.mercury.protocol.issuecredential._
import java.io.IOException

import io.iohk.atala.mercury.DidCommX
import scala.language.implicitConversions

object AgentHardCode extends ZIOAppDefault {

def run = for {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import org.didcommx.peerdid.core.PeerDIDUtils
import org.didcommx.didcomm.common._
import org.didcommx.didcomm.secret._
import scala.jdk.CollectionConverters.*
import scala.language.implicitConversions

object DidCommX {
val liveLayer: ZLayer[Any, Nothing, DidOps] = ZLayer.succeed(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import io.iohk.atala.mercury.model.*
import java.util.Random
import io.circe.*
import org.didcommx.didcomm.message.Attachment.Data
import scala.language.implicitConversions

given Conversion[PackEncryptedResult, EncryptedMessage] with {
def apply(msg: PackEncryptedResult): EncryptedMessage = EncryptedMessageImp(msg)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.didcommx.didcomm.model._
import io.circe.JsonObject.apply
import io.circe.JsonObject
import io.circe.Json
import scala.language.implicitConversions

final case class EncryptedMessageImp(private val msg: PackEncryptedResult) extends EncryptedMessage {
def string: String = msg.getPackedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.iohk.atala.mercury.model
import munit.*
import zio.*
import io.circe.JsonObject
import scala.language.implicitConversions

/** agentDidcommx/testOnly io.iohk.atala.mercury.model.UnpackMessageImpSpec */
class UnpackMessageImpSpec extends ZSuite {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ trait MailStorage {
final case class InmemoryMailStorage(private var bd: Map[DidId, Seq[MessageString]]) extends MailStorage {
def store(id: DidId, msg: MessageString): UIO[Unit] =
ZIO.succeed { bd = bd + (id -> (bd.getOrElse(id, Seq.empty) :+ msg)) }
<* ZIO.logInfo("InmemoryMailStorage: " + bd.mapValues(_.size).toMap.toString)
<* ZIO.logInfo("InmemoryMailStorage: " + bd.view.mapValues(_.size).toMap.toString)

def get(id: DidId): UIO[Seq[MessageString]] =
ZIO.succeed { bd.get(id).toSeq.flatten }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@ import java.time.Instant
val validator = Loader.empty.fromJson(io.circe.parser.parse(schemaCode).toOption.get)

def test(s: Json): Unit = {
val result = validator.right.get.validate(s)
println(s"Result of ${s}: ${result}")
validator match {
case Right(v) =>
val result = v.validate(s)
println(s"Result of $s: $result")
case Left(e) =>
println(s"Validation failed with error: $e")
}
}

test(Json.fromString("wrongType"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ object RepoModule {
val polluxTransactorLayer: TaskLayer[Transactor[Task]] = {
val transactorLayer = ZLayer.fromZIO {
ZIO.service[PolluxDbConfig].flatMap { config =>
Dispatcher[Task].allocated.map { case (dispatcher, _) =>
Dispatcher.parallel[Task].allocated.map { case (dispatcher, _) =>
given Dispatcher[Task] = dispatcher
io.iohk.atala.pollux.sql.repository.TransactorLayer.hikari[Task](config)
}
Expand All @@ -543,7 +543,7 @@ object RepoModule {
val connectTransactorLayer: TaskLayer[Transactor[Task]] = {
val transactorLayer = ZLayer.fromZIO {
ZIO.service[ConnectDbConfig].flatMap { config =>
Dispatcher[Task].allocated.map { case (dispatcher, _) =>
Dispatcher.parallel[Task].allocated.map { case (dispatcher, _) =>
given Dispatcher[Task] = dispatcher
io.iohk.atala.connect.sql.repository.TransactorLayer.hikari[Task](config)
}
Expand All @@ -569,7 +569,7 @@ object RepoModule {
val agentTransactorLayer: TaskLayer[Transactor[Task]] = {
val transactorLayer = ZLayer.fromZIO {
ZIO.service[AgentDbConfig].flatMap { config =>
Dispatcher[Task].allocated.map { case (dispatcher, _) =>
Dispatcher.parallel[Task].allocated.map { case (dispatcher, _) =>
given Dispatcher[Task] = dispatcher
io.iohk.atala.agent.server.sql.TransactorLayer.hikari[Task](config)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import io.iohk.atala.castor.core.model.did.w3c.{
import io.iohk.atala.castor.core.service.DIDService
import io.iohk.atala.castor.core.model.did.w3c.makeW3CResolver
import io.iohk.atala.castor.controller.DIDControllerImpl.resolutionStatusCodeMapping
import scala.language.implicitConversions

trait DIDController {
def getDID(did: String): UIO[(StatusCode, DIDResolutionResult)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import io.iohk.atala.castor.controller.http.UpdateManagedDIDRequest
import io.iohk.atala.castor.core.model.did.PrismDID
import io.iohk.atala.shared.utils.Traverse.*
import zio.*
import scala.language.implicitConversions

trait DIDRegistrarController {
def listManagedDid(paginationInput: PaginationInput)(rc: RequestContext): IO[ErrorResponse, ManagedDIDPage]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import sttp.tapir.Schema
import sttp.tapir.Schema.annotations.{description, encodedExample}
import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonEncoder, JsonDecoder}
import io.iohk.atala.castor.controller.http.DIDDocument.annotations
import scala.language.implicitConversions

@description("A W3C compliant Prism DID document representation.")
final case class DIDDocument(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import io.iohk.atala.shared.utils.Traverse.*
import sttp.tapir.Schema
import sttp.tapir.Schema.annotations.{description, encodedExample}
import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonEncoder, JsonDecoder}
import scala.language.implicitConversions

final case class ManagedDID(
@description(ManagedDID.annotations.did.description)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import sttp.tapir.Schema
import sttp.tapir.Schema.annotations.{description, encodedExample}
import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonEncoder, JsonDecoder}
import sttp.tapir.Codec
import scala.language.implicitConversions

final case class UpdateManagedDIDRequest(
actions: Seq[UpdateManagedDIDRequestAction]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import sttp.tapir.Schema
import sttp.tapir.Schema.annotations.{description, encodedExample}
import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonEncoder, JsonDecoder}
import io.iohk.atala.castor.controller.http.VerificationMethod.annotations
import scala.language.implicitConversions

@description(
"A cryptographic public key expressed in the DID document. https://www.w3.org/TR/did-core/#verification-methods"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import io.iohk.atala.pollux.credentialschema.http.{
FilterInput
}
import zio.{IO, Task, ZIO, ZLayer}
//import io.iohk.atala.api.http.ErrorResponse.*
import scala.language.implicitConversions

import java.util.UUID

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ object PostgresLayer {
ec <- ExecutionContexts.cachedThreadPool[Task]
xa <- HikariTransactor.fromHikariConfig[Task](config, ec)
} yield xa
layer <- Dispatcher[Task].allocated.map {
layer <- Dispatcher.parallel[Task].allocated.map {
case (dispatcher, _) => {
given Dispatcher[Task] = dispatcher
htxResource.toManaged.toLayer[Transactor[Task]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ object PostgresTestContainer {
ec <- ExecutionContexts.cachedThreadPool[Task]
xa <- HikariTransactor.fromHikariConfig[Task](config, ec)
} yield xa
layer <- Dispatcher[Task].allocated.map {
layer <- Dispatcher.parallel[Task].allocated.map {
case (dispatcher, _) => {
given Dispatcher[Task] = dispatcher
htxResource.toManaged.toLayer[Transactor[Task]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import io.iohk.atala.castor.core.util.DIDOperationValidator
import io.iohk.atala.mercury.PeerDID
import io.iohk.atala.mercury.model.DidId
import zio.*
import scala.language.implicitConversions

import java.security.{PrivateKey as JavaPrivateKey, PublicKey as JavaPublicKey}
import scala.collection.immutable.ArraySeq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import scala.collection.immutable.ArraySeq
import io.iohk.atala.castor.core.model.error.DIDOperationError
import io.iohk.atala.castor.core.model.did.ScheduleDIDOperationOutcome
import io.iohk.atala.castor.core.service.DIDService
import scala.language.implicitConversions

class PublicationHandler(didService: DIDService, keyResolver: KeyResolver)(masterKeyId: String) {
def signOperationWithMasterKey[E](state: ManagedDIDState, operation: PrismDIDOperation)(using
Expand Down

0 comments on commit 495d0d0

Please sign in to comment.