Skip to content

Commit

Permalink
Treat KeyWithMaintainers field structurally in all node types. (#10392)
Browse files Browse the repository at this point in the history
CHANGELOG_BEGIN
CHANGELOG_END
  • Loading branch information
nickchapman-da authored Jul 23, 2021
1 parent d7077e1 commit 1bed05f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ private final class Validation[Nid, Cid](implicit ECid: Equal[Cid]) {
actingParties1 == actingParties2 &&
signatories1 == signatories2 &&
stakeholders1 == stakeholders2 &&
(key1.isEmpty || keyIsReplayedBy(key1, key2)) &&
(keyIsReplayedBy(key1, key2)) &&
byKeyIsReplacedBy(version1, byKey1, byKey2) =>
loop(rest1, rest2, stack)
case (
Expand Down Expand Up @@ -294,7 +294,7 @@ private final class Validation[Nid, Cid](implicit ECid: Equal[Cid]) {
stakeholders1 == stakeholders2 &&
signatories1 == signatories2 &&
choiceObservers1 == choiceObservers2 &&
(key1.isEmpty || keyIsReplayedBy(key1, key2)) &&
(keyIsReplayedBy(key1, key2)) &&
byKeyIsReplacedBy(version1, byKey1, byKey2) =>
loop(
children1.iterator.to(LazyList),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,9 @@ class ValidationSpec extends AnyFreeSpec with Matchers with TableDrivenPropertyC
List(samKWM1, samKWM2, samKWM3).filter(y => x != y)
}

private val tweakOptKeyMaintainersSome = Tweak[OKWM] {
case None => List() // don't tweak from None
case Some(x) => None :: List(samKWM1, samKWM2, samKWM3).filter(y => x != y).map(Some(_))
}

private val tweakOptKeyMaintainersNone = Tweak[OKWM] { // sig only for Create nodes!
private val tweakOptKeyMaintainers = Tweak[OKWM] {
case None => List(Some(samKWM1), Some(samKWM2), Some(samKWM3))
case Some(_) => List() // don't tweak from Some
case Some(x) => None :: List(samKWM1, samKWM2, samKWM3).filter(y => x != y).map(Some(_))
}

private val tweakOptContractId = Tweak[Option[V.ContractId]] { case x =>
Expand Down Expand Up @@ -297,8 +292,7 @@ class ValidationSpec extends AnyFreeSpec with Matchers with TableDrivenPropertyC
"tweakCreateAgreementText" -> tweakCreateAgreementText,
"tweakCreateSignatories" -> tweakCreateSignatories,
"tweakCreateStakeholders" -> tweakCreateStakeholders,
"tweakCreateKey(None)" -> tweakCreateKey(tweakOptKeyMaintainersNone),
"tweakCreateKey(Some)" -> tweakCreateKey(tweakOptKeyMaintainersSome),
"tweakCreateKey" -> tweakCreateKey(tweakOptKeyMaintainers),
"tweakCreateVersion" -> tweakCreateVersion,
)

Expand Down Expand Up @@ -338,15 +332,14 @@ class ValidationSpec extends AnyFreeSpec with Matchers with TableDrivenPropertyC
"tweakFetchActingParties" -> tweakFetchActingPartiesNonEmpty,
"tweakFetchSignatories" -> tweakFetchSignatories,
"tweakFetchStakeholders" -> tweakFetchStakeholders,
"tweakFetchKey(Some)" -> tweakFetchKey(tweakOptKeyMaintainersSome),
"tweakFetchKey" -> tweakFetchKey(tweakOptKeyMaintainers),
"tweakFetchByKey(New Version)" -> tweakFetchByKey(versionSinceMinByKey),
"tweakFetchVersion" -> tweakFetchVersion,
)

private val insigFetchTweaks =
Map(
"tweakFetchKey(None)" -> tweakFetchKey(tweakOptKeyMaintainersNone),
"tweakFetchByKey(Old Version)" -> tweakFetchByKey(versionBeforeMinByKey),
"tweakFetchByKey(Old Version)" -> tweakFetchByKey(versionBeforeMinByKey)
)

//--[LookupByKey node tweaks]--
Expand Down Expand Up @@ -436,15 +429,14 @@ class ValidationSpec extends AnyFreeSpec with Matchers with TableDrivenPropertyC
"tweakExerciseSignatories" -> tweakExerciseSignatories,
"tweakExerciseChoiceObservers" -> tweakExerciseChoiceObservers,
"tweakExerciseExerciseResult" -> tweakExerciseExerciseResult,
"tweakExerciseKey(Some)" -> tweakExerciseKey(tweakOptKeyMaintainersSome),
"tweakExerciseKey" -> tweakExerciseKey(tweakOptKeyMaintainers),
"tweakExerciseByKey(New Version)" -> tweakExerciseByKey(versionSinceMinByKey),
"tweakExerciseVersion" -> tweakExerciseVersion,
)

private val insigExeTweaks =
Map(
"tweakExerciseKey(None)" -> tweakExerciseKey(tweakOptKeyMaintainersNone),
"tweakExerciseByKey(Old Version)" -> tweakExerciseByKey(versionBeforeMinByKey),
"tweakExerciseByKey(Old Version)" -> tweakExerciseByKey(versionBeforeMinByKey)
)

//--[significant and insignificant tx tweaks]--
Expand Down

0 comments on commit 1bed05f

Please sign in to comment.