-
Notifications
You must be signed in to change notification settings - Fork 242
Remove admin client usage from Scala side code #22611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
carlpulley-da
wants to merge
6
commits into
main
Choose a base branch
from
cjp/upgrade-test-fixes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bb413b3
Remove admin client from daml
carlpulley-da d3b43ee
Remove admin client usage from Scala code base
carlpulley-da 2afd112
Remove debugging fluff
carlpulley-da 81bbd40
upgrade matrix fix
carlpulley-da 91c172a
Reverted debug change
carlpulley-da f57aaf2
Merge remote-tracking branch 'origin/main' into cjp/upgrade-test-fixes
carlpulley-da File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -513,41 +513,16 @@ object ScriptF { | |
| */ | ||
| final case class AllocParty( | ||
| partyHint: String, | ||
| participants: Option[ | ||
| (Participant, List[Participant]) | ||
| ], | ||
| owningParticipant: Option[Participant], | ||
| ) extends Cmd { | ||
| override def execute(env: Env)(implicit | ||
| ec: ExecutionContext, | ||
| mat: Materializer, | ||
| esf: ExecutionSequencerFactory, | ||
| ): Future[ExtendedValue] = { | ||
| val owningParticipant = participants.map(_._1) | ||
| for { | ||
| owningClient <- env.clients.assertGetParticipantFuture(owningParticipant) | ||
|
|
||
| party <- | ||
| if (participants.map(_._2.isEmpty).getOrElse(true)) { | ||
| owningClient.allocateParty(partyHint) | ||
| } else { | ||
| for { | ||
| otherClients <- Future.traverse(participants.map(_._2).getOrElse(List.empty))( | ||
| participant => env.clients.assertGetParticipantFuture(participant) | ||
| ) | ||
| clients = owningClient +: otherClients | ||
| participantIds = clients.map(_.getParticipantUid) | ||
|
|
||
| p <- owningClient.aggregateAllocatePartyOnMultipleParticipants( | ||
| clients, | ||
| partyHint, | ||
| owningClient.getParticipantUid.split("::").last, | ||
| participantIds, | ||
| ) | ||
| _ <- Future.traverse(env.clients.participants.values)( | ||
| _.waitUntilHostingVisible(p, participantIds) | ||
| ) | ||
| } yield p | ||
| } | ||
| party <- owningClient.allocateParty(partyHint) | ||
| } yield { | ||
| owningParticipant.foreach(env.addPartyParticipantMapping(party, _)) | ||
| ValueParty(party) | ||
|
|
@@ -883,8 +858,9 @@ object ScriptF { | |
| for { | ||
| client <- Converter.toFuture(env.clients.getParticipant(participant)) | ||
| _ <- client.vetPackages(packages) | ||
| participantUid <- client.getParticipantUid() | ||
| _ <- Future.traverse(env.clients.participants.values)( | ||
| _.waitUntilVettingVisible(packages, client.getParticipantUid) | ||
| _.waitUntilVettingVisible(packages, participantUid) | ||
| ) | ||
| } yield ValueUnit | ||
| } | ||
|
|
@@ -901,8 +877,9 @@ object ScriptF { | |
| for { | ||
| client <- Converter.toFuture(env.clients.getParticipant(participant)) | ||
| _ <- client.unvetPackages(packages) | ||
| participantUid <- client.getParticipantUid() | ||
| _ <- Future.traverse(env.clients.participants.values)( | ||
| _.waitUntilUnvettingVisible(packages, client.getParticipantUid) | ||
| _.waitUntilUnvettingVisible(packages, participantUid) | ||
| ) | ||
| } yield ValueUnit | ||
| } | ||
|
|
@@ -1128,7 +1105,7 @@ object ScriptF { | |
| for { | ||
| participantName <- Converter.toOptionalParticipantName(participantName) | ||
| idHint <- Converter.toPartyIdHint(givenHint, requestedName, globalRandom) | ||
| } yield AllocParty(idHint, participantName.map(p => (p, List.empty))) | ||
| } yield AllocParty(idHint, participantName) | ||
| case _ => Left(s"Expected AllocParty payload but got $v") | ||
| } | ||
|
|
||
|
|
@@ -1139,17 +1116,22 @@ object ScriptF { | |
| ImmArray( | ||
| (_, ValueText(requestedName)), | ||
| (_, ValueText(givenHint)), | ||
| (_, participantNames), | ||
| (_, participantNames @ ValueList(vs)), | ||
| ), | ||
| ) => | ||
| ) if vs.length <= 1 => | ||
| for { | ||
| participantNames <- Converter.toParticipantNames(participantNames) | ||
| idHint <- Converter.toPartyIdHint(givenHint, requestedName, globalRandom) | ||
| allocArg = participantNames match { | ||
| case head :: tail => Some((head, tail)) | ||
| case Nil => None | ||
| } | ||
| } yield AllocParty(idHint, allocArg) | ||
| } yield AllocParty(idHint, participantNames.headOption) | ||
| case ValueRecord( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure all other AllocParty payloads result in a non-generic error message |
||
| _, | ||
| ImmArray( | ||
| (_, ValueText(_)), | ||
| (_, ValueText(_)), | ||
| (_, ValueList(_)), | ||
| ), | ||
| ) => | ||
| Left(s"Expected AllocParty payload with at most one participant name but got $v") | ||
| case _ => Left(s"Expected AllocParty payload but got $v") | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to allow for an empty list case as well as the singleton list case (since daml-script tests sometimes use an empty list)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please (if you havent already) verify this is backwards compatible manually, i.e. build a script dar with some 3.4 version and run it (via
dpm script --dar <my-dar> --all --ide-ledger) using HEAD of main