Upgrade to scala 2.13.13, fix compiler errors (#5428)

This commit is contained in:
Chris Stewart 2024-02-27 10:21:39 -06:00 committed by GitHub
parent 8a0c00637c
commit 3ed78b5270
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 25 deletions

View File

@ -3,7 +3,6 @@ package org.bitcoins.core.util
import org.bitcoins.core.script.{
ExecutedScriptProgram,
ExecutionInProgressScriptProgram,
PreExecutionScriptProgram,
StartedScriptProgram
}
@ -17,7 +16,7 @@ trait ScriptProgramTestUtil {
def toExecutedScriptProgram(p: StartedScriptProgram): ExecutedScriptProgram =
p match {
case e: ExecutedScriptProgram => e
case _: PreExecutionScriptProgram | _: ExecutionInProgressScriptProgram =>
case _: ExecutionInProgressScriptProgram =>
throw new RuntimeException("Should be an executed script program")
}
@ -26,7 +25,7 @@ trait ScriptProgramTestUtil {
p: StartedScriptProgram): ExecutionInProgressScriptProgram =
p match {
case e: ExecutionInProgressScriptProgram => e
case _: PreExecutionScriptProgram | _: ExecutedScriptProgram =>
case _: ExecutedScriptProgram =>
throw new RuntimeException(
"Must be an execution in progress script program")
}

View File

@ -1248,8 +1248,7 @@ sealed abstract class ScriptInterpreter {
case newProgram: ExecutedScriptProgram =>
//script was marked invalid for other reasons, don't need to update the opcount
(newProgram, opCount)
case newProgram @ (_: ExecutionInProgressScriptProgram |
_: PreExecutionScriptProgram) =>
case newProgram: ExecutionInProgressScriptProgram =>
val programOrError = newProgram
val newOpCount =
calcOpCount(opCount, OP_CHECKMULTISIG) + BitcoinScriptUtil
@ -1263,8 +1262,7 @@ sealed abstract class ScriptInterpreter {
case newProgram: ExecutedScriptProgram =>
//script was marked invalid for other reasons, don't need to update the opcount
(newProgram, opCount)
case newProgram @ (_: ExecutionInProgressScriptProgram |
_: PreExecutionScriptProgram) =>
case newProgram: ExecutionInProgressScriptProgram =>
val programOrError = newProgram
val newOpCount =
calcOpCount(opCount, OP_CHECKMULTISIGVERIFY) + BitcoinScriptUtil

View File

@ -2,7 +2,7 @@ import sbt.Keys.excludeLintKeys
import scala.util.Properties
val scala2_13 = "2.13.12"
val scala2_13 = "2.13.13"
ThisBuild / scalafmtOnCompile := !Properties.envOrNone("CI").contains("true")

View File

@ -857,12 +857,9 @@ sealed abstract class ScriptGenerators {
Some(0),
hashType)
(cltvScriptSig.asInstanceOf[CLTVScriptSignature], cltv, privKeys)
case _: UnassignedWitnessScriptPubKey | _: WitnessScriptPubKeyV0 =>
throw new IllegalArgumentException(
"Cannot created a witness scriptPubKey for a CSVScriptSig since we do not have a witness")
case _: P2SHScriptPubKey | _: CLTVScriptPubKey |
_: P2PKWithTimeoutScriptPubKey | _: CSVScriptPubKey |
_: NonStandardScriptPubKey | _: WitnessCommitment =>
case _: CLTVScriptPubKey | _: P2PKWithTimeoutScriptPubKey |
_: CSVScriptPubKey | _: NonStandardScriptPubKey |
_: WitnessCommitment =>
throw new IllegalArgumentException(
"We only " +
"want to generate P2PK, P2PKH, and MultiSig ScriptSignatures when creating a CSVScriptSignature")
@ -910,12 +907,9 @@ sealed abstract class ScriptGenerators {
val csvScriptSig =
lockTimeHelper(None, sequence, csv, privKeys, Some(0), hashType)
(csvScriptSig.asInstanceOf[CSVScriptSignature], csv, privKeys)
case _: UnassignedWitnessScriptPubKey | _: WitnessScriptPubKeyV0 =>
throw new IllegalArgumentException(
"Cannot created a witness scriptPubKey for a CSVScriptSig since we do not have a witness")
case _: P2SHScriptPubKey | _: CLTVScriptPubKey |
_: P2PKWithTimeoutScriptPubKey | _: CSVScriptPubKey |
_: NonStandardScriptPubKey | _: WitnessCommitment =>
case _: CLTVScriptPubKey | _: P2PKWithTimeoutScriptPubKey |
_: CSVScriptPubKey | _: NonStandardScriptPubKey |
_: WitnessCommitment =>
throw new IllegalArgumentException(
"We only " +
"want to generate P2PK, P2PKH, and MultiSig ScriptSignatures when creating a CLTVScriptSignature.")
@ -1108,14 +1102,10 @@ sealed abstract class ScriptGenerators {
ConditionalScriptSignature(scriptSig, true)
case EmptyScriptPubKey =>
CSVScriptSignature(TrivialTrueScriptSignature)
case _: WitnessScriptPubKeyV0 | _: UnassignedWitnessScriptPubKey =>
//bare segwit always has an empty script sig, see BIP141
CSVScriptSignature(EmptyScriptSignature)
case _: LockTimeScriptPubKey | _: P2PKWithTimeoutScriptPubKey =>
throw new IllegalArgumentException(
"Cannot have a nested locktimeScriptPubKey inside a lockTimeScriptPubKey")
case x @ (_: NonStandardScriptPubKey | _: P2SHScriptPubKey |
_: WitnessCommitment) =>
case x @ (_: NonStandardScriptPubKey | _: WitnessCommitment) =>
throw new IllegalArgumentException(
"A NonStandardScriptPubKey/P2SHScriptPubKey/WitnessCommitment cannot be" +
"the underlying scriptSig in a CSVScriptSignature. Got: " + x)