Skip to content

Commit

Permalink
Tolerate invalid trees.
Browse files Browse the repository at this point in the history
  • Loading branch information
oskin1 committed Nov 9, 2023
1 parent ae73d4e commit 9dcc271
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ lazy val commonSettings = Seq(
scalacOptions ++= commonScalacOptions,
scalaVersion := "2.12.15",
organization := "org.ergoplatform",
version := "9.17.8",
version := "9.17.9",
resolvers += Resolver.sonatypeRepo("public"),
resolvers += Resolver.sonatypeRepo("snapshots"),
libraryDependencies ++= dependencies.Testing ++ dependencies.CompilerPlugins,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ object sigma {
private val constantSerializer: ConstantSerializer = ConstantSerializer(DeserializationSigmaBuilder)

@inline def deserializeErgoTree[F[_]: Applicative: Throws](raw: HexString): F[Values.ErgoTree] =
Base16.decode(raw.unwrapped).map(treeSerializer.deserializeErgoTree).fold(_.raise, _.pure)
Base16
.decode(raw.unwrapped)
.map(treeSerializer.deserializeErgoTree)
.fold(_ => Values.ErgoTree.fromProposition(FalseLeaf.toSigmaProp).pure, _.pure)

@inline def extractErgoTreeConstants[F[_]: Applicative: Throws](
raw: HexString
Expand Down Expand Up @@ -68,7 +71,9 @@ object sigma {
@inline def addressToErgoTreeHex(address: Address)(implicit enc: ErgoAddressEncoder): HexString =
addressToErgoTree(address) |> (tree => HexString.fromStringUnsafe(Base16.encode(tree.bytes)))

@inline def addressToErgoTreeNewtype(address: Address)(implicit enc: ErgoAddressEncoder): org.ergoplatform.explorer.ErgoTree =
@inline def addressToErgoTreeNewtype(address: Address)(implicit
enc: ErgoAddressEncoder
): org.ergoplatform.explorer.ErgoTree =
addressToErgoTreeHex(address) |> (tree => org.ergoplatform.explorer.ErgoTree(tree))

@inline def hexStringToBytes[
Expand Down

0 comments on commit 9dcc271

Please sign in to comment.